/** * @return * @throws OXFException */ public ServiceIdentification mapServiceIdentification(WCSCapabilitiesType w) throws OXFException { String title = w.getService().getLabel(); String serviceType = "OGC:WCS"; // -> cause its a WCS-Adapter String[] serviceTypeVersion = new String[] {"1.0.0"}; ServiceIdentification si; try { si = new ServiceIdentification(title, serviceType, serviceTypeVersion); } catch (IllegalArgumentException e) { throw new OXFException(e); } return si; }
/** Supports WCS 1.0.0 */ public ServiceProvider mapServiceProvider(WCSCapabilitiesType wt) throws OXFException { ResponsiblePartyType responsibleParty = wt.getService().getResponsibleParty(); ServiceContact serviceContact = null; String providerName = "xyz"; // TODO: vernuenftigen Provider-Namen heraus ziehen if (responsibleParty != null) { List<JAXBElement> list = responsibleParty.getContent(); for (JAXBElement e : list) { String localPart = e.getName().getLocalPart(); String individualName = null; String organisationName = null; String positionName = null; Contact contact = null; if (localPart.equalsIgnoreCase("individualName")) { individualName = e.getValue().toString(); } else if (localPart.equalsIgnoreCase("organisationName")) { organisationName = e.getValue().toString(); } else if (localPart.equalsIgnoreCase("positionName")) { positionName = e.getValue().toString(); } else if (localPart.equalsIgnoreCase("contactInfo")) { // Sub-Section "ContactInfo": ContactType ct = (ContactType) e.getValue(); // Sub-Section "OnlineResource": OnlineResourceType ort = (OnlineResourceType) ct.getOnlineResource(); OnlineResource onlineResource = null; if (ort != null) { onlineResource = new OnlineResource( ort.getType(), ort.getHref(), ort.getRole(), ort.getArcrole(), ort.getShow(), ort.getActuate(), ort.getTitle()); } // Sub-Section "Phone": TelephoneType tt = (TelephoneType) ct.getPhone(); String[] telephone = null; if (tt != null) { telephone = new String[tt.getVoice().size()]; tt.getVoice().toArray(telephone); } // Sub-Section "Address": AddressType at = (AddressType) ct.getAddress(); Address address = null; if (at != null) { String administrativeArea = at.getAdministrativeArea(); String city = at.getCity(); String country = at.getCountry(); String postalCode = at.getPostalCode(); String[] tempDeliveryPointArray = new String[at.getDeliveryPoint().size()]; at.getDeliveryPoint().toArray(tempDeliveryPointArray); String[] deliveryPoints = tempDeliveryPointArray; String[] tempElectronicMailAddressArray = new String[at.getElectronicMailAddress().size()]; at.getElectronicMailAddress().toArray(tempElectronicMailAddressArray); String[] electronicMailAddresses = tempElectronicMailAddressArray; address = new Address( city, administrativeArea, postalCode, country, deliveryPoints, electronicMailAddresses); } contact = new Contact(telephone, null, null, null, address, onlineResource); } serviceContact = new ServiceContact(individualName, organisationName, positionName, contact); } } ServiceProvider sp = new ServiceProvider(providerName, serviceContact); return sp; }
/** Supports WCS 1.0.0 */ public OperationsMetadata mapOperationsMetadata(WCSCapabilitiesType wt, Contents contents) throws OXFException { // --- GetCapabilities-Operation: Request.GetCapabilities getCaps = wt.getCapability().getRequest().getGetCapabilities(); List<DCPTypeType> dcpListGetCapabilities = getCaps.getDCPType(); Parameter serviceParameter = new Parameter("SERVICE", true, new StringValueDomain("WCS"), null); Parameter getCapRequest = new Parameter("REQUEST", true, new StringValueDomain("GetCapabilities"), null); String[] versions = new String[] {"1.0.0"}; Parameter versionParameter = new Parameter("VERSION", true, new StringValueDomain(versions), null); Parameter section = new Parameter( "SECTION", false, new StringValueDomain( new String[] { "WCS_Capabilities/Service", "WCS_Capabilities/Capability", "WCS_Capabilities/ContentMetadata" }), null); Parameter[] getCapabilitiesParameters = new Parameter[] {versionParameter, serviceParameter, getCapRequest, section}; Operation opGetCapabilities = new Operation( "GetCapabilities", getCapabilitiesParameters, null, parseDCPList(dcpListGetCapabilities)); // --- DescribeCoverage-Operation: Request.DescribeCoverage descCov = wt.getCapability().getRequest().getDescribeCoverage(); List<DCPTypeType> dcpListDescribeCoverage = descCov.getDCPType(); Parameter descCovRequest = new Parameter("REQUEST", true, new StringValueDomain("DescribeCoverage"), null); // -------- Coverage-Namen raus-parsen: String[] covNames = new String[contents.getDataIdentificationCount()]; for (int i = 0; i < contents.getDataIdentificationCount(); i++) { covNames[i] = contents.getDataIdentification(i).getIdentifier(); } // -------- fertig Parameter coverageParameter = new Parameter( "COVERAGE", false, new StringValueDomain(covNames), Parameter.COMMON_NAME_RESOURCE_ID); Parameter[] describeCoverageParameters = new Parameter[] {versionParameter, serviceParameter, descCovRequest, coverageParameter}; Operation opDescribeCoverage = new Operation( "DescribeCoverage", describeCoverageParameters, null, parseDCPList(dcpListDescribeCoverage)); // --- GetCoverage-Operation: Request.GetCoverage getCov = wt.getCapability().getRequest().getGetCoverage(); List<DCPTypeType> dcpListGetCoverage = getCov.getDCPType(); ArrayList<Parameter> getCoverageParameterList = new ArrayList<Parameter>(); Parameter getCovRequestParameter = new Parameter("REQUEST", true, new StringValueDomain("GetCoverage"), null); for (int i = 0; i < contents.getDataIdentificationCount(); i++) { String[] availableCRS = contents.getDataIdentification(i).getAvailableCRSs(); if (availableCRS != null) { getCoverageParameterList.add( new DatasetParameter( "CRS", true, new StringValueDomain(availableCRS), contents.getDataIdentification(i), Parameter.COMMON_NAME_SRS)); } for (int j = 0; j < contents.getDataIdentification(i).getBoundingBoxes().length; j++) { getCoverageParameterList.add( new DatasetParameter( "BBOX", true, contents.getDataIdentification(i).getBoundingBoxes()[j], contents.getDataIdentification(i), Parameter.COMMON_NAME_BBOX)); } TemporalValueDomain temporalDomain = (TemporalValueDomain) contents.getDataIdentification(i).getTemporalDomain(); if (temporalDomain != null) { getCoverageParameterList.add( new DatasetParameter( "TIME", true, temporalDomain, contents.getDataIdentification(i), Parameter.COMMON_NAME_TIME)); } ArrayList<String> formatList = new ArrayList<String>(); if (contents.getDataIdentification(i).getOutputFormats() != null) { for (int j = 0; j < contents.getDataIdentification(i).getOutputFormats().length; j++) { formatList.add(contents.getDataIdentification(i).getOutputFormats()[j]); } getCoverageParameterList.add( new DatasetParameter( "FORMAT", true, new StringValueDomain(formatList), contents.getDataIdentification(i), Parameter.COMMON_NAME_FORMAT)); } } Parameter widthParameter = new Parameter( "WIDTH", true, new IntegerRangeValueDomain(0, Integer.MAX_VALUE), Parameter.COMMON_NAME_WIDTH); Parameter heightParameter = new Parameter( "HEIGHT", true, new IntegerRangeValueDomain(0, Integer.MAX_VALUE), Parameter.COMMON_NAME_HEIGHT); getCoverageParameterList.add(versionParameter); getCoverageParameterList.add(serviceParameter); getCoverageParameterList.add(getCovRequestParameter); getCoverageParameterList.add(coverageParameter); getCoverageParameterList.add(widthParameter); getCoverageParameterList.add(heightParameter); Parameter[] getCoverageParameters = new Parameter[getCoverageParameterList.size()]; getCoverageParameterList.toArray(getCoverageParameters); Operation opGetCoverage = new Operation("GetCoverage", getCoverageParameters, null, parseDCPList(dcpListGetCoverage)); Operation[] ops = new Operation[] {opGetCapabilities, opDescribeCoverage, opGetCoverage}; OperationsMetadata om = new OperationsMetadata(ops); return om; }
/** * Supports WCS 1.0.0 * * <p>uses the WCSCapabilitiesType returned by the GetCapabilities-Operation to produce a * Content-object. * * @param wc * @return * @throws OXFException */ public Contents mapContents(WCSCapabilitiesType wc) { List<CoverageOfferingBriefType> covOffList = wc.getContentMetadata().getCoverageOfferingBrief(); ArrayList<Dataset> dataIdentificationList = new ArrayList<Dataset>(); for (CoverageOfferingBriefType covOff : covOffList) { // --- create identifier: List<JAXBElement> nameList = covOff.getName(); String identifier = nameList.get(0).getValue().toString(); // --- create title: String title = covOff.getLabel(); // --- create boundingBox: LonLatEnvelopeType lle = covOff.getLonLatEnvelope(); // directPositionList enth�lt 2 Double-Listen die die Koordinatenwerte f�r die 2 definierenden // Punkte der BBox enthalten List<DirectPositionType> directPositionList = lle.getPos(); DirectPositionType dpt0 = directPositionList.get(0); DirectPositionType dpt1 = directPositionList.get(1); double[] lowerLeft = new double[dpt0.getValue().size()]; for (int i = 0; i < dpt0.getValue().size(); i++) { lowerLeft[i] = dpt0.getValue().get(i); } double[] upperRight = new double[dpt1.getValue().size()]; for (int i = 0; i < dpt1.getValue().size(); i++) { upperRight[i] = dpt1.getValue().get(i); } String srsName = covOff.getLonLatEnvelope().getSrsName(); BoundingBox bBox = new BoundingBox(srsName, lowerLeft, upperRight); // --- create srs: String[] srsArray = new String[] {lle.getSrsName()}; // --- create temporalDomain: List<TimePositionType> timePosList = lle.getTimePosition(); List<ITime> timeList = new ArrayList<ITime>(); if (timePosList != null) { for (TimePositionType timePosition : timePosList) { ITime time = TimeFactory.createTime(timePosition.getValue().toString()); timeList.add(time); } } // add Dataset to list: Dataset dataID = new Dataset( title, identifier, new BoundingBox[] {bBox}, null, srsArray, null, null, null, (timeList.isEmpty() ? null : new TemporalValueDomain(timeList)), null, null); dataIdentificationList.add(dataID); } Contents c = new Contents(dataIdentificationList); return c; }