private static void exportOperationsMetadata( XMLStreamWriter writer ) throws XMLStreamException { List<Operation> operations = new LinkedList<Operation>(); List<DCP> dcps = null; try { DCP dcp = new DCP( new URL( OGCFrontController.getHttpGetURL() ), new URL( OGCFrontController.getHttpPostURL() ) ); dcps = Collections.singletonList( dcp ); } catch ( MalformedURLException e ) { // should never happen } List<Domain> params = new ArrayList<Domain>(); List<Domain> constraints = new ArrayList<Domain>(); List<OMElement> mdEls = new ArrayList<OMElement>(); operations.add( new Operation( "GetCapabilities", dcps, params, constraints, mdEls ) ); operations.add( new Operation( "DescribeProcess", dcps, params, constraints, mdEls ) ); operations.add( new Operation( "Execute", dcps, params, constraints, mdEls ) ); OperationsMetadata operationsMd = new OperationsMetadata( operations, params, constraints, null ); exportOperationsMetadata110( writer, operationsMd ); }
public Operation( String name, List<DCP> dcps, List<Domain> params, List<Domain> constraints, List<OMElement> metadata ) { this.name = name; this.dcp = dcps; if ( params != null ) { this.parameters = params; } else { this.parameters = new ArrayList<Domain>(); } if ( constraints != null ) { this.constraints = constraints; } else { this.constraints = new ArrayList<Domain>(); } if ( metadata != null ) { this.metadata = metadata; } else { this.metadata = new ArrayList<OMElement>(); } for ( DCP dcp : dcps ) { for ( Pair<URL, List<Domain>> urls : dcp.getGetEndpoints() ) { getUrls.add( urls.first ); } for ( Pair<URL, List<Domain>> urls : dcp.getPostEndpoints() ) { postUrls.add( urls.first ); } } }
Operation operation = getOperations().getOperation( GetRecords.name() ); for ( DCP dcp : operation.getDCPs() ) { for ( Pair<URL, List<Domain>> pe : dcp.getPostEndpoints() ) { for ( Domain d : pe.second ) { if ( "PostEncoding".equals( d.getName() ) ) {
void exportOperationsMetadata() throws XMLStreamException { List<Operation> operations = new LinkedList<Operation>(); List<DCP> dcps = null; try { DCP dcp = new DCP( new URL( OGCFrontController.getHttpGetURL() ), null ); dcps = Collections.singletonList( dcp ); } catch ( MalformedURLException e ) { // should never happen } List<Domain> params = new ArrayList<Domain>(); List<Domain> constraints = new ArrayList<Domain>(); constraints.add( new Domain( "GetEncoding", Collections.singletonList( "KVP" ) ) ); List<OMElement> mdEls = new ArrayList<OMElement>(); operations.add( new Operation( "GetCapabilities", dcps, params, constraints, mdEls ) ); operations.add( new Operation( "GetTile", dcps, params, constraints, mdEls ) ); operations.add( new Operation( "GetFeatureInfo", dcps, params, constraints, mdEls ) ); OperationsMetadata operationsMd = new OperationsMetadata( operations, params, constraints, null ); exportOperationsMetadata110( writer, operationsMd ); }
if ( dcp.getGetEndpoints() != null ) { for ( Pair<URL, List<Domain>> getEndpoint : dcp.getGetEndpoints() ) { writer.writeEmptyElement( owsNS, "Get" ); writer.writeAttribute( XLN_NS, "href", getEndpoint.first.toString() ); if ( dcp.getPostEndpoints() != null ) { for ( Pair<URL, List<Domain>> postEndpoint : dcp.getPostEndpoints() ) { writer.writeEmptyElement( owsNS, "Post" ); writer.writeAttribute( XLN_NS, "href", postEndpoint.first.toString() );
@SuppressWarnings("unchecked") private void sendCapabilities( Map<String, String> map, HttpServletRequest request, HttpResponseBuffer response ) throws IOException { GetCapabilities req = GetCapabilitiesKVPParser.parse( map ); XMLOutputFactory factory = XMLOutputFactory.newInstance(); factory.setProperty( IS_REPAIRING_NAMESPACES, true ); try { XMLStreamWriter xsw = factory.createXMLStreamWriter( response.getOutputStream(), "UTF-8" ); IndentingXMLStreamWriter xmlWriter = new IndentingXMLStreamWriter( xsw ); List<Operation> operations = new ArrayList<Operation>(); List<DCP> dcps = Collections.singletonList( new DCP( new URL( OGCFrontController.getHttpGetURL() ), null ) ); List<Domain> params = Collections.emptyList(); List<Domain> constraints = Collections.emptyList(); for ( String operation : allowedOperations ) { operations.add( new Operation( operation, dcps, params, constraints, EMPTY_LIST ) ); } OperationsMetadata operationsMd = new OperationsMetadata( operations, params, constraints, null ); new CapabilitiesXMLAdapter().export040( xmlWriter, req, identification, provider, operationsMd, service.getServiceConfiguration() ); xmlWriter.writeEndDocument(); } catch ( XMLStreamException e ) { throw new IOException( e ); } }
private DCP parseDCP( OMElement dcpEl ) { XPath xpath = new XPath( getPrefix() + "HTTP/" + getPrefix() + "Get", nsContext ); List<OMElement> getEls = getElements( dcpEl, xpath ); List<Pair<URL, List<Domain>>> getEndpoints = new ArrayList<Pair<URL, List<Domain>>>( getEls.size() ); if ( getEls != null ) { for ( OMElement getEl : getEls ) { xpath = new XPath( getPrefix() + "OnlineResource/@xlink:href", nsContext ); URL href = getNodeAsURL( getEl, xpath, null ); getEndpoints.add( new Pair<URL, List<Domain>>( href, new ArrayList<Domain>() ) ); } } xpath = new XPath( getPrefix() + "HTTP/" + getPrefix() + "Post", nsContext ); List<OMElement> postEls = getElements( dcpEl, xpath ); List<Pair<URL, List<Domain>>> postEndpoints = new ArrayList<Pair<URL, List<Domain>>>( postEls.size() ); if ( postEls != null ) { for ( OMElement postEl : postEls ) { xpath = new XPath( getPrefix() + "OnlineResource/@xlink:href", nsContext ); URL href = getNodeAsURL( postEl, xpath, null ); postEndpoints.add( new Pair<URL, List<Domain>>( href, new ArrayList<Domain>() ) ); } } return new DCP( getEndpoints, postEndpoints ); }
List<DCP> post = null; try { getAndPost = Collections.singletonList( new DCP( new URL( getHttpGetURL() ), new URL( getHttpPostURL() ) ) ); post = singletonList( new DCP( null, new URL( getHttpPostURL() ) ) ); get = singletonList( new DCP( new URL( getHttpGetURL() ), null ) ); } catch ( MalformedURLException e ) {
return new DCP( getEndpoints, postEndpoints );
List<DCP> get = null; try { getAndPost = singletonList( new DCP( new URL( getHttpGetURL() ), new URL( getHttpPostURL() ) ) ); post = singletonList( new DCP( null, new URL( getHttpPostURL() ) ) ); get = singletonList( new DCP( new URL( getHttpGetURL() ), null ) ); } catch ( MalformedURLException e ) {