-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c0a5b0
commit 0b2d622
Showing
32 changed files
with
931 additions
and
54 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
21 changes: 21 additions & 0 deletions
21
src/extension/csw/core/src/main/java/org/geoserver/csw/CSWResourceVoter.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,21 @@ | ||
/* (c) 2018 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.csw; | ||
|
||
import org.geoserver.catalog.ResourceInfo; | ||
import org.geoserver.catalog.ServiceResourceVoter; | ||
|
||
public class CSWResourceVoter implements ServiceResourceVoter { | ||
|
||
@Override | ||
public boolean hideService(ResourceInfo resource) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String serviceName() { | ||
return "CSW"; | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
src/extension/wps/wps-core/src/main/java/org/geoserver/wps/WPSResourceVoter.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,21 @@ | ||
/* (c) 2018 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.wps; | ||
|
||
import org.geoserver.catalog.ResourceInfo; | ||
import org.geoserver.catalog.ServiceResourceVoter; | ||
|
||
public class WPSResourceVoter implements ServiceResourceVoter { | ||
|
||
@Override | ||
public boolean hideService(ResourceInfo resource) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String serviceName() { | ||
return "WPS"; | ||
} | ||
} |
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
36 changes: 36 additions & 0 deletions
36
src/main/src/main/java/org/geoserver/catalog/ServiceResourceUtil.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,36 @@ | ||
/* (c) 2018 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.catalog; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import org.geoserver.platform.GeoServerExtensions; | ||
import org.springframework.beans.BeansException; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.ApplicationContextAware; | ||
|
||
public class ServiceResourceUtil implements ApplicationContextAware { | ||
|
||
public static final String BEAN_ID = "serviceResourceUtil"; | ||
|
||
protected ApplicationContext context; | ||
|
||
public ServiceResourceUtil() {} | ||
|
||
public List<String> getLayerVotedServices(ResourceInfo resource) { | ||
List<ServiceResourceVoter> voters = | ||
GeoServerExtensions.extensions(ServiceResourceVoter.class, context); | ||
return voters.stream() | ||
.filter(v -> !v.hideService(resource)) | ||
.map(v -> v.serviceName()) | ||
.collect(Collectors.toCollection(ArrayList::new)); | ||
} | ||
|
||
@Override | ||
public void setApplicationContext(ApplicationContext context) throws BeansException { | ||
this.context = context; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/src/main/java/org/geoserver/catalog/ServiceResourceVoter.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,24 @@ | ||
/* (c) 2018 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.catalog; | ||
|
||
/** | ||
* Allows to verify if a given layer is suitable for publishing on a given service. A single | ||
* negative vote will make the service disappear from the selective service layer UI | ||
* | ||
* @author Andrea Aime, Geosolutions | ||
* @author Fernando Mino, Geosolutions | ||
*/ | ||
public interface ServiceResourceVoter { | ||
|
||
/** | ||
* Returns true if the services is not considered suitable for the given layer. In case the | ||
* answer is unknown by this voter, false will be returned | ||
*/ | ||
boolean hideService(ResourceInfo resource); | ||
|
||
/** Returns service name for registered Resource voter */ | ||
String serviceName(); | ||
} |
Oops, something went wrong.