/** * find an enum type by a given name ignoring case, or if the citetest mode is enabled map perfectly. * * @param requestName * @return the Enum type or <code>null</code> if the request was not found. */ public T getRequestTypeByName( String requestName ) { T requestType = null; if ( requestName != null ) { if ( citeTestMode ) { requestType = handledRequestsMap.get( requestName ); } else { for ( String req : getHandledRequests() ) { if ( req.equalsIgnoreCase( requestName ) ) { requestType = handledRequestsMap.get( req ); break; } } } } return requestType; }
/** * Returns the {@link OWS} instance that is responsible for handling requests with a certain name, e.g. GetMap, * GetFeature. * * @param requestName * request name, e.g. "GetMap" or "GetFeature" * @return responsible <code>OWS</code> or null, if no responsible service was found */ public List<OWS> getByRequestName( String requestName ) { List<ResourceIdentifier<OWS>> list = workspace.getResourcesOfType( OWSProvider.class ); List<OWS> services = new ArrayList<OWS>(); for ( ResourceIdentifier<OWS> id : list ) { OWS ows = workspace.getResource( OWSProvider.class, id.getId() ); if ( ows == null ) { continue; } for ( String name : ( (OWSProvider) ows.getMetadata().getProvider() ).getImplementationMetadata().getHandledRequests() ) { if ( name.equalsIgnoreCase( "GetCapabilities" ) ) { continue; } if ( name.equalsIgnoreCase( requestName ) ) { services.add( ows ); } } } return services; }
private void checkRequiredKeys( Map<String, String> param ) throws OWSException { try { ImplementationMetadata<?> imd = ( (OWSProvider) getMetadata().getProvider() ).getImplementationMetadata(); String service = KVPUtils.getRequired( param, "SERVICE" ); if ( !"WCS".equalsIgnoreCase( service ) ) { throw new OWSException( "SERVICE " + service + " is not supported", OWSException.INVALID_PARAMETER_VALUE, "SERVICE" ); } String request = KVPUtils.getRequired( param, "REQUEST" ); if ( !imd.getHandledRequests().contains( request ) ) { throw new OWSException( "REQUEST " + request + " is not supported", OWSException.OPERATION_NOT_SUPPORTED, "REQUEST" ); } String version; if ( imd.getRequestTypeByName( request ) != WCSRequestType.GetCapabilities ) { // no version required version = KVPUtils.getRequired( param, "VERSION" ); if ( version != null && !offeredVersions.contains( Version.parseVersion( version ) ) ) { throw new OWSException( "VERSION " + version + " is not supported", OWSException.VERSION_NEGOTIATION_FAILED, "VERSION" ); } } } catch ( MissingParameterException e ) { throw new OWSException( e.getMessage(), OWSException.MISSING_PARAMETER_VALUE ); } }