forked from geoserver/geoserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GEOS-10058] Dynamic GeoServer Welcome Page service capability links
This is the subject of GSIP-202: * Introduce ServiceDescriptionProvider as a replacement for CapabilitiesHomePageProvider * GeoServerHomePage allows the selection of worksapce and layer / layer group to determine service capability links displayed * Contact Information panel allows for configuration of welcome, online resource, address delivery point * GeoServerHomePage description updates dynmicly to reflect global service or virtual services being shown * Contact information (welcome, organization name, online resource) used to create welcome blurb at top of page * Contact information (email address) used to show contact administrator in page footer
- Loading branch information
1 parent
5c42623
commit 6bd4864
Showing
63 changed files
with
3,016 additions
and
503 deletions.
There are no files selected for viewing
102 changes: 102 additions & 0 deletions
102
...ension/wps/web-wps/src/main/java/org/geoserver/wps/web/WPSServiceDescriptionProvider.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,102 @@ | ||
/* (c) 2022 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.web; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.logging.Logger; | ||
import org.geoserver.catalog.Catalog; | ||
import org.geoserver.catalog.PublishedInfo; | ||
import org.geoserver.catalog.WorkspaceInfo; | ||
import org.geoserver.config.GeoServer; | ||
import org.geoserver.platform.GeoServerExtensions; | ||
import org.geoserver.platform.Service; | ||
import org.geoserver.web.ServiceDescription; | ||
import org.geoserver.web.ServiceDescriptionProvider; | ||
import org.geoserver.web.ServiceLinkDescription; | ||
import org.geoserver.wps.WPSInfo; | ||
import org.geoserver.wps.WebProcessingService; | ||
import org.geotools.util.logging.Logging; | ||
|
||
/** Provide description of WPS services for welcome page. */ | ||
public class WPSServiceDescriptionProvider extends ServiceDescriptionProvider { | ||
|
||
static final Logger LOGGER = Logging.getLogger(WPSServiceDescriptionProvider.class); | ||
|
||
GeoServer geoserver; | ||
Catalog catalog; | ||
|
||
public WPSServiceDescriptionProvider(GeoServer gs) { | ||
this.geoserver = gs; | ||
catalog = gs.getCatalog(); | ||
} | ||
|
||
/** | ||
* Lookup WPSInfo using workspaceInfo / layerInfo context. | ||
* | ||
* @param workspaceInfo Workspace, or null for global. | ||
* @param layerInfo Layer, LayerGroup, or null for any | ||
* @return WPSInfo if available for workspace, or global WPSInfo. | ||
*/ | ||
protected WPSInfo info(WorkspaceInfo workspaceInfo, PublishedInfo layerInfo) { | ||
WPSInfo info = null; | ||
if (workspaceInfo != null) { | ||
info = geoserver.getService(workspaceInfo, WPSInfo.class); | ||
} | ||
if (info == null) { | ||
info = geoserver.getService(WPSInfo.class); | ||
} | ||
return info; | ||
} | ||
|
||
@Override | ||
public List<ServiceDescription> getServices( | ||
WorkspaceInfo workspaceInfo, PublishedInfo layerInfo) { | ||
|
||
List<ServiceDescription> descriptions = new ArrayList<>(); | ||
WPSInfo info = info(workspaceInfo, layerInfo); | ||
|
||
if (workspaceInfo != null || geoserver.getGlobal().isGlobalServices()) { | ||
descriptions.add(description(info, workspaceInfo, layerInfo)); | ||
} | ||
return descriptions; | ||
} | ||
|
||
@Override | ||
public List<ServiceLinkDescription> getServiceLinks( | ||
WorkspaceInfo workspaceInfo, PublishedInfo layerInfo) { | ||
List<ServiceLinkDescription> links = new ArrayList<>(); | ||
|
||
if (workspaceInfo == null && !geoserver.getGlobal().isGlobalServices()) { | ||
return links; | ||
} | ||
|
||
List<Service> extensions = GeoServerExtensions.extensions(Service.class); | ||
|
||
for (Service service : extensions) { | ||
if (service.getService() instanceof WebProcessingService) { | ||
String serviceId = service.getId(); | ||
|
||
String link = null; | ||
if (service.getOperations().contains("GetCapabilities")) { | ||
link = getCapabilitiesURL(workspaceInfo, layerInfo, service); | ||
} else if (service.getCustomCapabilitiesLink() != null) { | ||
link = service.getCustomCapabilitiesLink(); | ||
} | ||
|
||
if (link != null) { | ||
links.add( | ||
new ServiceLinkDescription( | ||
serviceId.toLowerCase(), | ||
service.getVersion(), | ||
link, | ||
workspaceInfo != null ? workspaceInfo.getName() : null, | ||
layerInfo != null ? layerInfo.getName() : null)); | ||
} | ||
} | ||
} | ||
return links; | ||
} | ||
} |
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
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
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
20 changes: 10 additions & 10 deletions
20
src/web/core/src/main/java/org/geoserver/web/CapabilitiesHomePagePanel.html
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
<html xmlns:wicket="http://wicket.apache.org/"> | ||
<body> | ||
<wicket:panel> | ||
<li wicket:id="services"> | ||
<span wicket:id="service"></span> | ||
<ul class="flat"> | ||
<li wicket:id="versions"> | ||
<a wicket:id="link" class="external icon"> | ||
<span wicket:id="version"> | ||
</span></a> | ||
</li> | ||
</ul> | ||
</li> | ||
<div wicket:id="services"> | ||
<a wicket:id="link"> | ||
<div class="link-bordered"> | ||
<span wicket:id="service" class="serviceProtocol"></span> | ||
<hr> | ||
<span wicket:id="version" class="serviceVersion"></span> | ||
</div> | ||
</a> | ||
<div class="spacer"></div> | ||
</div> | ||
</wicket:panel> | ||
</body> | ||
</html> |
Oops, something went wrong.