private String analyseWmsConfigurations( HashMap<String, List<FeatureLayer>> map ) throws XMLStreamException { String crs = null; OwsManager mgr = workspace.getResourceManager( OwsManager.class ); XMLInputFactory infac = XMLInputFactory.newInstance(); List<OWS> wmss = mgr.getByOWSClass( WMSController.class ); for ( OWS ows : wmss ) { StreamSource streamSource = new StreamSource( ows.getMetadata().getLocation().getAsStream() ); XMLStreamReader reader = infac.createXMLStreamReader( streamSource ); reader.next(); while ( reader.hasNext() ) { if ( crs == null && reader.isStartElement() && reader.getLocalName().equals( "CRS" ) ) { crs = reader.getElementText(); } if ( reader.isStartElement() && ( reader.getLocalName().equals( "RequestableLayer" ) || reader.getLocalName().equals( "LogicalLayer" ) ) ) { extractLayer( reader, map ); } reader.next(); } } return crs; }
private OWS determineOWSByPath( HttpServletRequest request ) throws OWSException { OWS ows = null; String pathInfo = request.getPathInfo(); if ( pathInfo != null ) { // remove start "/" String serviceId = pathInfo.substring( 1 ); ows = workspace.getNewWorkspace().getResource( OWSProvider.class, serviceId ); if ( ows == null && serviceConfiguration.isSingleServiceConfigured() ) { ows = serviceConfiguration.getSingleConfiguredService(); } if ( ows == null ) { String msg = "No service with identifier '" + serviceId + "' available."; throw new OWSException( msg, NOT_FOUND ); } } return ows; }
Collection<ResourceMetadata<OWS>> mds = mgr.getResourceMetadata(); for ( ResourceMetadata<OWS> md : mds ) { OWSProvider prov = (OWSProvider) md.getProvider();
public String getMetadataURLTemplate() { // TODO handle this properly in init(), needs service level dependency management if ( metadataURLTemplate == null ) { OwsManager mgr = workspace.getResourceManager( OwsManager.class ); Map<String, List<OWS>> ctrls = mgr.getAll(); for ( List<OWS> lists : ctrls.values() ) { for ( OWS o : lists ) { ImplementationMetadata<?> md = ( (OWSProvider) o.getMetadata().getProvider() ).getImplementationMetadata(); for ( String s : md.getImplementedServiceName() ) { if ( s.equalsIgnoreCase( "csw" ) && md.getImplementedVersions().contains( new Version( 2, 0, 2 ) ) ) { this.metadataURLTemplate = ""; // special case to use requested address } } } } } return metadataURLTemplate; }
List<OWS> services = serviceConfiguration.getByServiceType( service ); if ( services != null && !services.isEmpty() ) { if ( services.size() > 1 ) { List<OWS> services = serviceConfiguration.getByRequestName( request ); if ( services != null && !services.isEmpty() ) { if ( services.size() > 1 ) { if ( service != null && serviceConfiguration.getByServiceType( service ) == null ) { OWSException ex = new OWSException( "No service for service type '" + service + "' is configured / active.", "InvalidParameterValue", "service" ); && serviceConfiguration.getByRequestName( request ) == null ) { OWSException ex = new OWSException( "No service for request type '" + request + "' is configured / active.", "InvalidParameterValue", "request" );
List<OWS> services = serviceConfiguration.getByRequestNS( ns ); if ( services == null || services.isEmpty() ) { String msg = "Cannot dispatch XML request with namespace '" + ns
public boolean isSingleServiceConfigured() { return getSingleConfiguredService() != null; }
Collection<ResourceMetadata<OWS>> mds = mgr.getResourceMetadata(); for ( ResourceMetadata<OWS> md : mds ) { OWSProvider prov = (OWSProvider) md.getProvider();
Collection<List<OWS>> values = serviceConfiguration.getAll().values(); if ( values.size() > 0 && !values.iterator().next().isEmpty() ) { ows = values.iterator().next().get( 0 );
List<OWS> services = serviceConfiguration.getByRequestNS( requestNs ); if ( services == null || services.isEmpty() ) { String msg = "Cannot dispatch SOAP request with body namespace '" + requestNs
Collection<ResourceMetadata<OWS>> mds = mgr.getResourceMetadata(); for ( ResourceMetadata<OWS> md : mds ) { OWSProvider prov = (OWSProvider) md.getProvider();
public void transform() throws TransformerException, XMLStreamException { OwsManager mgr = workspace.getResourceManager( OwsManager.class ); List<OWS> wmss = mgr.getByOWSClass( WMSController.class ); for ( OWS ows : wmss ) { ResourceMetadata<? extends Resource> md = ows.getMetadata(); ResourceIdentifier<? extends Resource> id = md.getIdentifier(); File loc = md.getLocation().resolveToFile( id.getId() + ".xml" ); ByteArrayOutputStream bos = new ByteArrayOutputStream(); transformer.transform( new StreamSource( loc ), new StreamResult( bos ) ); ThemeXmlStreamEncoder.writeOut( bos ); WorkspaceUtils.activateSynthetic( workspace, ThemeProvider.class, id.getId(), new String( bos.toByteArray(), Charset.forName( "UTF-8" ) ) ); } }
private OWS determineOWSByPathQuirk( HttpServletRequest request ) throws OWSException { OWS ows = null; String pathInfo = request.getPathInfo(); if ( pathInfo != null ) { // remove start "/" String serviceId; // nice hack to work around the most stupid WFS 1.1.0 CITE tests // I'm sure there are a bazillion clients around that send out broken URLs, then validate the exception // responses, see the error of their ways and then send a proper request... if ( pathInfo.indexOf( "#" ) != -1 ) { serviceId = pathInfo.substring( 1, pathInfo.indexOf( "#" ) ); } else if ( pathInfo.indexOf( "=" ) != -1 ) { serviceId = pathInfo.substring( 1, pathInfo.indexOf( "=" ) ); } else { serviceId = pathInfo.substring( 1 ); } ows = workspace.getNewWorkspace().getResource( OWSProvider.class, serviceId ); if ( ows == null && serviceConfiguration.isSingleServiceConfigured() ) { ows = serviceConfiguration.getSingleConfiguredService(); } if ( ows == null ) { String msg = "No service with identifier '" + serviceId + "' available."; throw new OWSException( msg, NOT_FOUND ); } } return ows; }
throw new FileNotFoundException( "No web service configurations were found in the workspace." ); if ( workspace.getResourceManager( OwsManager.class ).getByOWSClass( WPVSController.class ) == null ) { throw new FileNotFoundException( "No WPVS configuration was found in the workspace." );
List<OWS> wpvsControllers = wsConfig.getByOWSClass( WPVSController.class ); if ( wpvsControllers.isEmpty() ) { throw new ServiceInitException( "No active WPVS found in workspace." );