-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from groldan/wps_plugin_require_no_wps_install…
…ed_in_geoserver Make it possible to have the gs-acl-plugin-wps module on the classpath if the WPS extension is not installed
- Loading branch information
Showing
4 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...s/src/main/java/org/geoserver/acl/plugin/config/wps/WPSResourceManagerClassCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* (c) 2024 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
*/ | ||
package org.geoserver.acl.plugin.config.wps; | ||
|
||
import com.google.common.annotations.VisibleForTesting; | ||
|
||
import org.springframework.context.annotation.ConditionContext; | ||
import org.springframework.context.annotation.ConfigurationCondition; | ||
import org.springframework.core.type.AnnotatedTypeMetadata; | ||
|
||
/** | ||
* Spring without spring boot equivalent to {@code @ConditionalOnClass(WPSResourceManager.class)}, | ||
* so the {@code gs-acl-plugin-wps} module can be on the vanilla GeoServer classpath when the | ||
* geoserver WPS extension is not installed. | ||
*/ | ||
public class WPSResourceManagerClassCondition implements ConfigurationCondition { | ||
|
||
private static ClassLoader classLoader; | ||
|
||
@VisibleForTesting | ||
public static void classLoader(ClassLoader cl) { | ||
classLoader = cl; | ||
} | ||
|
||
@Override | ||
public ConfigurationPhase getConfigurationPhase() { | ||
return ConfigurationPhase.PARSE_CONFIGURATION; | ||
} | ||
|
||
@Override | ||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { | ||
try { | ||
if (null == classLoader) classLoader = getClass().getClassLoader(); | ||
classLoader.loadClass("org.geoserver.wps.resource.WPSResourceManager"); | ||
return true; | ||
} catch (ClassNotFoundException e) { | ||
return false; | ||
} | ||
} | ||
} |