-
-
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.
[GEOS-8392] WMTS service configured metdata will only appear in the c…
…apabilities document if INSPIRE extension is installed
- Loading branch information
Nuno Oliveira
committed
Nov 15, 2017
1 parent
f9d6800
commit 4dd7c9a
Showing
4 changed files
with
73 additions
and
75 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
60 changes: 60 additions & 0 deletions
60
src/gwc/src/main/java/org/geoserver/gwc/wmts/WMTSCapabilitiesProvider.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,60 @@ | ||
/* (c) 2016 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.gwc.wmts; | ||
|
||
import org.geoserver.config.ContactInfo; | ||
import org.geoserver.config.GeoServer; | ||
import org.geowebcache.config.meta.ServiceContact; | ||
import org.geowebcache.config.meta.ServiceInformation; | ||
import org.geowebcache.config.meta.ServiceProvider; | ||
import org.geowebcache.service.wmts.WMTSExtensionImpl; | ||
|
||
/** | ||
* Makes WMTS service metadata configured in GeoServer available to GWC | ||
*/ | ||
public class WMTSCapabilitiesProvider extends WMTSExtensionImpl { | ||
|
||
private final GeoServer geoserver; | ||
|
||
public WMTSCapabilitiesProvider(GeoServer geoserver) { | ||
this.geoserver = geoserver; | ||
} | ||
|
||
@Override | ||
public ServiceInformation getServiceInformation() { | ||
// make WMTS service metadata configured in GeoServer available to GWC | ||
WMTSInfo gsInfo = geoserver.getService(WMTSInfo.class); | ||
ServiceInformation gwcInfo = new ServiceInformation(); | ||
// add service information | ||
gwcInfo.setTitle(gsInfo.getTitle()); | ||
gwcInfo.setTitle(gsInfo.getTitle()); | ||
gwcInfo.setDescription(gsInfo.getAbstract()); | ||
gwcInfo.getKeywords().addAll(gsInfo.keywordValues()); | ||
gwcInfo.setFees(gsInfo.getFees()); | ||
gwcInfo.setAccessConstraints(gsInfo.getAccessConstraints()); | ||
// add provider information | ||
ServiceProvider serviceProvider = new ServiceProvider(); | ||
serviceProvider.setProviderName(gsInfo.getMaintainer()); | ||
serviceProvider.setProviderName(gsInfo.getOnlineResource()); | ||
// add contact information | ||
ContactInfo gsContactInfo = geoserver.getSettings().getContact(); | ||
if (gsContactInfo != null) { | ||
ServiceContact gwcContactInfo = new ServiceContact(); | ||
gwcContactInfo.setIndividualName(gsContactInfo.getContactPerson()); | ||
gwcContactInfo.setPositionName(gsContactInfo.getContactPosition()); | ||
gwcContactInfo.setAddressType(gsContactInfo.getAddressType()); | ||
gwcContactInfo.setAddressStreet(gsContactInfo.getAddress()); | ||
gwcContactInfo.setAddressCity(gsContactInfo.getAddressCity()); | ||
gwcContactInfo.setAddressPostalCode(gsContactInfo.getAddressPostalCode()); | ||
gwcContactInfo.setAddressCountry(gsContactInfo.getAddressCountry()); | ||
gwcContactInfo.setPhoneNumber(gsContactInfo.getContactVoice()); | ||
gwcContactInfo.setFaxNumber(gsContactInfo.getContactFacsimile()); | ||
gwcContactInfo.setAddressEmail(gsContactInfo.getAddressElectronicMailAddress()); | ||
serviceProvider.setServiceContact(gwcContactInfo); | ||
} | ||
gwcInfo.setServiceProvider(serviceProvider); | ||
return gwcInfo; | ||
} | ||
} |
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