Package net.opengis.wcs10

Examples of net.opengis.wcs10.GetCoverageType


    @Override
    public Operation operationDispatched(Request request, Operation operation) {
        Object[] parameters = operation.getParameters();
        if(parameters != null && parameters.length > 0 && parameters[0] instanceof GetCoverageType) {
            // check we are going against a granule
            GetCoverageType gc = (GetCoverageType) parameters[0];
            String coverageId = gc.getCoverageId();
            if(coverageId == null) {
                throw new WCS20Exception("Required parameter coverageId is missing",
                        WCS20Exception.WCS20ExceptionCode.MissingParameterValue, "coverageId");
            }
            CoverageInfo coverage = codec.getGranuleCoverage(coverageId);
            if(coverage != null) {
                // set the actual coverage name
                String actualCoverageId = NCNameResourceCodec.encode(coverage);
                gc.setCoverageId(actualCoverageId);
               
                // extract the granule filter
                Filter granuleFilter = codec.getGranuleFilter(coverageId);
               
                // check the filter actually matches one granule
                if(!readerHasGranule(coverage, granuleFilter)) {
                    throw new WCS20Exception("Could not locate coverage " + coverageId, WCS20ExceptionCode.NoSuchCoverage, "coverageId");
                }
               
                // set and/or merge with the previous filter
                Filter previous = gc.getFilter();
                if(previous == null || previous == Filter.INCLUDE) {
                    gc.setFilter(granuleFilter);
                } else {
                    gc.setFilter(FF.and(previous, granuleFilter));
                }
            }
        }
       
        return operation;
View Full Code Here


        super(GetCoverageType.class, WCS20_FACTORY);
    }

    @Override
    public Object read(Object request, Map kvp, Map rawKvp) throws Exception {
        GetCoverageType gc = (GetCoverageType) super.read(request, kvp, rawKvp);

        // handle dimension subsets
        Object subsets = kvp.get("subset");
        if (subsets instanceof DimensionSubsetType) {
            gc.getDimensionSubset().add((DimensionSubsetType) subsets);
        } else if (subsets instanceof List) {
            for (Object subset : (List) subsets) {
                gc.getDimensionSubset().add((DimensionSubsetType) subset);
            }
        }

        // prepare for extensions
        gc.setExtension(WCS20_FACTORY.createExtensionType());

        // parse the extensions. Note, here we do only the validation bits that are not shared
        // with the XML, everything else is in GetCoverage
        parseGeoTiffExtension(gc, kvp);
        parseCRSExtension(gc, rawKvp);
View Full Code Here

    @SuppressWarnings("unchecked")
    protected GetCoverageType parse(String url) throws Exception {
        Map<String, Object> rawKvp = new CaseInsensitiveMap(KvpUtils.parseQueryString(url));
        Map<String, Object> kvp = new CaseInsensitiveMap(parseKvp(rawKvp));
        WCS20GetCoverageRequestReader reader = new WCS20GetCoverageRequestReader();
        GetCoverageType gc = (GetCoverageType) reader.createRequest();
        return (GetCoverageType) reader.read(gc, kvp, rawKvp);
    }
View Full Code Here

        if (!(firstParam instanceof GetCoverageType)) {
            // we only handle WCS 2.0 requests
            return false;
        }

        GetCoverageType getCoverage = (GetCoverageType) firstParam;

        // this class only handles encoding the coverage with mediatype
        String mediaType = getCoverage.getMediaType();
        return mediaType != null && mediaType.equals("multipart/related");
    }
View Full Code Here

    public void write(Object value, OutputStream output, Operation operation) throws IOException {
        // grab the coverage
        GridCoverage2D coverage = (GridCoverage2D) value;

        // grab the format
        GetCoverageType getCoverage = (GetCoverageType) operation.getParameters()[0];
        String format = getCoverage.getFormat();
        if (format == null) {
            format = "image/tiff";
        }

        // extract additional extensions
        final Map<String, String> encodingParameters = new HashMap<String, String>();
        final ExtensionType extension = getCoverage.getExtension();
        if (extension != null) {
            final EList<ExtensionItemType> extensions = extension.getContents();
            for (ExtensionItemType ext : extensions) {
                encodingParameters.put(ext.getName(), ext.getSimpleContent());
            }
        }

        // grab the delegate
        CoverageResponseDelegate delegate = responseFactory.encoderFor(format);

        // use javamail classes to actually encode the document
        try {
            MimeMultipart multipart = new MimeMultipart();
            multipart.setSubType("related");
           
            String fileName = "/coverages/" + getCoverage.getCoverageId() + "." + delegate.getFileExtension(format);
           
            // coverages xml structure, which is very close to the DescribeFeatureType output
            BodyPart coveragesPart = new MimeBodyPart();
            FileReference reference = new FileReference(fileName, delegate.getMimeType(format), delegate.getConformanceClass(format));
            final CoverageData coveragesData = new CoverageData(coverage, reference, envelopeDimensionsMapper);
View Full Code Here

    }

    @Override
    public String getAttachmentFileName(Object value, Operation operation) {
        // the only thing that can open this format normally available on a desktop is a e-mail client
        GetCoverageType getCoverage = (GetCoverageType) operation.getParameters()[0];
        return getCoverage.getCoverageId() + ".eml";
    }
View Full Code Here

        super(GridCoverage.class);
        this.responseFactory = responseFactory;
    }

    public String getMimeType(Object value, Operation operation) {
        GetCoverageType getCoverage = (GetCoverageType) operation.getParameters()[0];
        String format = getCoverage.getFormat();
        if (format == null) {
            return "image/tiff";
        } else {
            CoverageResponseDelegate delegate = responseFactory.encoderFor(format);
            if (delegate == null) {
View Full Code Here

        if (!(firstParam instanceof GetCoverageType)) {
            // we only handle WCS 2.0 requests
            return false;
        }

        GetCoverageType getCoverage = (GetCoverageType) firstParam;
        // this class only handles encoding the coverage in its output format
        return getCoverage.getMediaType() == null;
    }
View Full Code Here

    public void write(Object value, OutputStream output, Operation operation) throws IOException {
        // grab the coverage
        GridCoverage2D coverage = (GridCoverage2D) value;
       
        // grab the format
        GetCoverageType getCoverage = (GetCoverageType) operation.getParameters()[0];
        String format = getCoverage.getFormat();
        if (format == null) {
            format = "image/tiff";
        }
       
        // extract additional extensions
        final Map<String,String> encodingParameters= new HashMap<String,String>();       
        final ExtensionType extension = getCoverage.getExtension();
        if(extension!=null){
            final EList<ExtensionItemType> extensions = extension.getContents();
            for(ExtensionItemType ext:extensions){
                encodingParameters.put(ext.getName(),ext.getSimpleContent());
            }           
View Full Code Here

    }
   
    @Override
    public String getAttachmentFileName(Object value, Operation operation) {
        // grab the format
        GetCoverageType getCoverage = (GetCoverageType) operation.getParameters()[0];
        String format = getCoverage.getFormat();
        if (format == null) {
            format = "image/tiff";
        }
       
        // grab the delegate and thus the extension
        CoverageResponseDelegate delegate = responseFactory.encoderFor(format);
        String extension = delegate.getFileExtension(format);
       
        // collect the name of the coverages that have been requested
        return getCoverage.getCoverageId() + "." + extension;
    }
View Full Code Here

TOP

Related Classes of net.opengis.wcs10.GetCoverageType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.