/** Supports WCS 1.1.1 */ public OperationsMetadata mapOperationsMetadata(CapabilitiesDocument capDoc, Contents contents) throws OXFException { List<DCP> getCapDcps = new ArrayList<DCP>(); List<DCP> desCovDcps = new ArrayList<DCP>(); List<DCP> getCovDcps = new ArrayList<DCP>(); net.opengis.ows.x11.OperationDocument.Operation[] opsArray = capDoc.getCapabilities().getOperationsMetadata().getOperationArray(); for (net.opengis.ows.x11.OperationDocument.Operation op : opsArray) { if (op.getName().equalsIgnoreCase("GetCapabilities")) { getCapDcps.add(makeDCP(op)); } else if (op.getName().equalsIgnoreCase("GetCoverage")) { getCovDcps.add(makeDCP(op)); } else if (op.getName().equalsIgnoreCase("DescribeCoverage")) { desCovDcps.add(makeDCP(op)); } } // --- GetCapabilities-Operation: ---------------------------------------------------------- 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.1.1"}; 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, getCapDcps.toArray(new DCP[0])); // --- DescribeCoverage Operation ---------------------------------------------------------- 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, desCovDcps.toArray(new DCP[0])); // --- GetCoverage Operation --------------------------------------------------------------- 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)); } } // GridParameter // -------- GridParameter raus-parsen: String[] gridBaseCRSs = new String[contents.getDataIdentificationCount()]; String[] gridTypes = new String[contents.getDataIdentificationCount()]; String[] gridCSs = new String[contents.getDataIdentificationCount()]; for (int i = 0; i < contents.getDataIdentificationCount(); i++) { gridBaseCRSs[i] = ((CoverageDataset) contents.getDataIdentification(i)).getGridBaseCRS(); gridTypes[i] = ((CoverageDataset) contents.getDataIdentification(i)).getGridType(); gridCSs[i] = ((CoverageDataset) contents.getDataIdentification(i)).getGridCS(); } Parameter gridBaseCRS = new Parameter("GRIDBASECRS", true, new StringValueDomain(gridBaseCRSs), null); Parameter gridType = new Parameter("GRIDTYPE", true, new StringValueDomain(gridTypes), null); Parameter gridCS = new Parameter("GRIDCS", true, new StringValueDomain(gridCSs), null); Parameter gridOrigin = new Parameter("GRIDORIGIN", true, new StringValueDomain(), null); Parameter gridOffsets = new Parameter("GRIDOFFSETS", true, new StringValueDomain(), null); 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(gridBaseCRS); getCoverageParameterList.add(gridType); getCoverageParameterList.add(gridCS); getCoverageParameterList.add(gridOffsets); getCoverageParameterList.add(gridOrigin); getCoverageParameterList.add(widthParameter); getCoverageParameterList.add(heightParameter); Parameter[] getCoverageParameters = new Parameter[getCoverageParameterList.size()]; getCoverageParameterList.toArray(getCoverageParameters); Operation opGetCoverage = new Operation("GetCoverage", getCoverageParameters, null, getCovDcps.toArray(new DCP[0])); Operation[] ops = new Operation[] {opGetCapabilities, opDescribeCoverage, opGetCoverage}; OperationsMetadata om = new OperationsMetadata(ops); return om; }
/** 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; }