public List<OMElement> getRequiredElements( OMElement context, XPath xpath ) throws XMLParsingException { List<OMElement> elements = getElements( context, xpath ); if ( elements.size() == 0 ) { String msg = "Required element '" + xpath + "' (starting from '" + context.getQName() + "') is missing."; throw new XMLParsingException( this, context, msg ); } return elements; }
public List<ExtrinsicObject> getExtrinsicObjects( String type ) { if ( !extrinsicObjects.containsKey( type ) ) { List<ExtrinsicObject> eos = new ArrayList<ExtrinsicObject>(); List<OMElement> eoElems = adapter.getElements( adapter.getRootElement(), getEOPath( type ) ); for ( OMElement eoElem : eoElems ) { eos.add( new ExtrinsicObject( eoElem ) ); } extrinsicObjects.put( type, eos ); } return extrinsicObjects.get( type ); }
private BBoxOutputType parseBBoxOutput( OMElement bboxData, CodeType id, LanguageString outputTitle, LanguageString outputAbstract ) { XPath xpath = new XPath( "Default/CRS", nsContext ); String defaultCrs = omResponse.getElement( bboxData, xpath ).getText(); xpath = new XPath( "Supported/CRS", nsContext ); List<OMElement> omSupported = omResponse.getElements( bboxData, xpath ); String[] supportedCrs = new String[omSupported.size()]; for ( int i = 0; i < omSupported.size(); i++ ) { supportedCrs[i] = omSupported.get( i ).getText(); } return new BBoxOutputType( id, outputTitle, outputAbstract, defaultCrs, supportedCrs ); }
private BBoxInputType parseBBoxData( OMElement input, CodeType id, LanguageString inputTitle, LanguageString inputAbstract, String minOccurs, String maxOccurs ) { XPath xpath = new XPath( "Default/CRS", nsContext ); String defaultCRS = omResponse.getElement( input, xpath ).getText(); xpath = new XPath( "Supported/CRS", nsContext ); List<OMElement> omSupported = omResponse.getElements( input, xpath ); String[] supportedCRSs = new String[omSupported.size()]; for ( int i = 0; i < omSupported.size(); i++ ) { supportedCRSs[i] = omSupported.get( i ).getText(); } return new BBoxInputType( id, inputTitle, inputAbstract, minOccurs, maxOccurs, defaultCRS, supportedCRSs ); }
/** * @return the associations */ public List<Association> getAssociations() { if ( associations == null ) { List<OMElement> associationElements = adapter.getElements( adapter.getRootElement(), new XPath( "./rim:RegistryObjectList/rim:Association", ns ) ); associations = new ArrayList<Association>(); for ( OMElement associationElem : associationElements ) { associations.add( new Association( associationElem ) ); } } return associations; }
/** * @return the classifications */ public List<Classification> getClassifications() { if ( classifications == null ) { List<OMElement> classificationElems = adapter.getElements( adapter.getRootElement(), new XPath( "./rim:RegistryObjectList/rim:Classification", ns ) ); classifications = new ArrayList<Classification>(); for ( OMElement classificationElem : classificationElems ) { classifications.add( new Classification( classificationElem ) ); } } return classifications; }
/** * @return */ public List<ClassificationNode> getClassificationNodes() { if ( classificationNodes == null ) { // ALL classifictionNodes are parsed -> they can be childs of ClassificationNode or ClassificationScheme // (...) List<OMElement> classNodeElems = adapter.getElements( adapter.getRootElement(), new XPath( "./rim:RegistryObjectList//rim:ClassificationNode", ns ) ); classificationNodes = new ArrayList<ClassificationNode>(); for ( OMElement classNodeElem : classNodeElems ) { classificationNodes.add( new ClassificationNode( classNodeElem ) ); } } return classificationNodes; }
/** * * @return all datasets that are queryable */ public synchronized List<String> getQueryableDatasets() { List<String> res = new LinkedList<String>(); XPath xp = new XPath( "//wpvs:Dataset[@queryable='true']", nsContext ); List<OMElement> datasets = capabilities.getElements( capabilities.getRootElement(), xp ); for ( OMElement node : datasets ) { if ( node != null ) { XPath xpName = new XPath( "wpvs:Name", nsContext ); String name = capabilities.getNodeAsString( node, xpName, null ); if ( name != null ) { res.add( name ); LOG.info( "dataset found in GetCapabilities: " + name ); } } else LOG.warn( "Found an empty dataset!" ); } return res; }
return result; List<OMElement> parameterValues = adapter.getElements( rootElement, new XPath( PRE + "parameterValue", nsContext ) ); if ( parameterValues == null || parameterValues.size() < 0 ) {
/** * * @return all elevation models defined */ public synchronized List<String> getElevationModels() { List<String> res = new LinkedList<String>(); XPath xp = new XPath( "//wpvs:ElevationModel", nsContext ); List<OMElement> elModels = capabilities.getElements( capabilities.getRootElement(), xp ); for ( OMElement node : elModels ) if ( node != null ) { XPath xpName = new XPath( "wpvs:Name", nsContext ); String name = capabilities.getNodeAsString( node, xpName, null ); if ( name != null ) res.add( name ); } return res; }
private List<OutputType> parseOutputs() { XPath xpath = new XPath( "/wps:ProcessDescriptions/ProcessDescription/ProcessOutputs/Output", nsContext ); List<OMElement> omOutputs = omResponse.getElements( omResponse.getRootElement(), xpath ); List<OutputType> outputs = new ArrayList<OutputType>( omOutputs.size() ); for ( OMElement output : omOutputs ) { CodeType id = parseId( output ); LanguageString outputTitle = parseLanguageString( output, "Title" ); LanguageString outputAbstract = parseLanguageString( output, "Abstract" ); OutputType outputDesc = parseOutputData( output, id, outputTitle, outputAbstract ); outputs.add( outputDesc ); } return outputs; }
List<OMElement> omFormats = omResponse.getElements( input, xpath ); ComplexFormat[] supported = new ComplexFormat[omFormats.size()]; for ( int i = 0; i < omFormats.size(); i++ ) {
List<OMElement> omSupported = omResponse.getElements( omComplex, xpath ); ComplexFormat[] supportedFormats = new ComplexFormat[omSupported.size()]; for ( int i = 0; i < omSupported.size(); i++ ) {
private List<InputType> parseInputs() { XPath xpath = new XPath( "/wps:ProcessDescriptions/ProcessDescription/DataInputs/Input", nsContext ); List<OMElement> omInputs = omResponse.getElements( omResponse.getRootElement(), xpath ); List<InputType> inputs = new ArrayList<InputType>( omInputs.size() ); for ( OMElement input : omInputs ) { String minOccurs = input.getAttribute( new QName( null, "minOccurs" ) ).getAttributeValue(); String maxOccurs = input.getAttribute( new QName( null, "maxOccurs" ) ).getAttributeValue(); CodeType id = parseId( input ); LanguageString inputTitle = parseLanguageString( input, "Title" ); LanguageString inputAbstract = parseLanguageString( input, "Abstract" ); InputType inputDesc = parseData( input, id, inputTitle, inputAbstract, minOccurs, maxOccurs ); inputs.add( inputDesc ); } return inputs; }
private LiteralOutputType parseLiteralOutput( OMElement omLiteral, CodeType id, LanguageString outputTitle, LanguageString outputAbstract ) { OMElement omDataType = omLiteral.getFirstChildWithName( new QName( owsNS, "DataType" ) ); ValueWithRef dataType = null; if ( omDataType != null ) { String dataTypeStr = omDataType.getText(); String dataTypeRefStr = omDataType.getAttributeValue( new QName( owsNS, "reference" ) ); dataType = new ValueWithRef( dataTypeStr, dataTypeRefStr ); } XPath xpath = new XPath( "UOMs/Default/ows:UOM", nsContext ); OMElement omDefault = omResponse.getElement( omLiteral, xpath ); ValueWithRef defaultUom = null; if ( omDefault != null ) { String defaultUomStr = omDefault.getText(); String defaultUomRefStr = omDefault.getAttributeValue( new QName( owsNS, "reference" ) ); defaultUom = new ValueWithRef( defaultUomStr, defaultUomRefStr ); } xpath = new XPath( "UOMs/Supported/ows:UOM", nsContext ); List<OMElement> omSupported = omResponse.getElements( omLiteral, xpath ); ValueWithRef[] supportedUoms = null; if ( omSupported != null ) { supportedUoms = new ValueWithRef[omSupported.size()]; for ( int i = 0; i < omSupported.size(); i++ ) { OMElement omSupp = omSupported.get( i ); String supportedRefStr = omSupp.getAttributeValue( new QName( owsNS, "reference" ) ); supportedUoms[i] = new ValueWithRef( omSupp.getText(), supportedRefStr ); } } return new LiteralOutputType( id, outputTitle, outputAbstract, dataType, defaultUom, supportedUoms ); }
List<OMElement> omSupported = omResponse.getElements( input, xpath ); ValueWithRef[] supportedUom = null; if ( omSupported != null ) {
public List<CRSCodeType[]> getAvailableCRSIds() { List<OMElement> crsIDs = new LinkedList<OMElement>(); try { XPath xpath = new XPath( "//" + PRE + "dictionaryEntry/*[" + PRE + "ProjectedCRS|" + PRE + "CompoundCRS|" + PRE + "GeodeticCRS]", nsContext ); crsIDs.addAll( adapter.getElements( getRootElement(), xpath ) ); } catch ( XMLParsingException e ) { throw new CRSConfigurationException( Messages.getMessage( "CRS_CONFIG_GET_ALL_ELEMENT_IDS", e.getMessage() ), e ); } List<CRSCodeType[]> result = new ArrayList<CRSCodeType[]>(); for ( OMElement crs : crsIDs ) { if ( crs != null ) { String[] ids = adapter.getNodesAsStrings( crs, new XPath( PRE + "identifier", nsContext ) ); if ( ids != null ) { CRSCodeType[] r = new CRSCodeType[ids.length]; for ( int i = 0; i < ids.length; ++i ) { if ( ids[i] != null ) { r[i] = new CRSCodeType( ids[i] ); } } result.add( r ); } } } return result; }
nsContext ) ); List<OMElement> operatesOnElemList = a.getElements( identificationInfo, new XPath( "./srv:SV_ServiceIdentification/srv:operatesOn", nsContext ) ); List<OMElement> operatesOnCoupledResources = a.getElements( identificationInfo, new XPath( "./srv:SV_ServiceIdentification/srv:coupledResource/srv:SV_CoupledResource",
List<OMElement> metaDatas = adapter.getElements( rootElement, new XPath( PRE + "metaDataProperty", nsContext ) ); if ( metaDatas != null && metaDatas.size() > 0 ) { LOG.warn( "Ignoring meta data properties" ); List<OMElement> domainsOfValidity = adapter.getElements( rootElement, new XPath( PRE + "domainOfValidity", nsContext ) ); if ( domainsOfValidity != null && domainsOfValidity.size() > 0 ) {
String dataIdentificationId = identificationInfo.getAttributeValue( new QName( "id" ) ); String dataIdentificationUuId = identificationInfo.getAttributeValue( new QName( "uuid" ) ); List<OMElement> identifier = a.getElements( identificationInfo, new XPath( "./gmd:citation/gmd:CI_Citation/gmd:identifier", nsContext ) );