Examples of GranuleStackImpl


Examples of org.geoserver.wcs2_0.response.GranuleStackImpl

                    }
                }
                final List<DimensionBean> dimensions = helper.setupDimensions();
                final String nativeName = cinfo.getNativeCoverageName();
                final String coverageName = nativeName != null ? nativeName : reader.getGridCoverageNames()[0];
                final GranuleStackImpl stack = new GranuleStackImpl(coverageName, reader.getCoordinateReferenceSystem(), dimensions);
                // Geoserver max memory limit definition
                long outputLimit = wcs.getMaxOutputMemory() * 1024;
                long inputLimit = wcs.getMaxInputMemory() * 1024;
                // Object value used for storing the sum of the output size of each internal coverage
                ImageSizeRecorder incrementalOutputSize=new ImageSizeRecorder(outputLimit,false);
                // Object used for storing the sum of the output size of each internal coverage
                ImageSizeRecorder incrementalInputSize=new ImageSizeRecorder(inputLimit,true);
                // Image size estimation
                final int numRequests = requests.size();
                final Iterator<GridCoverageRequest> requestsIterator = requests.iterator();
                GridCoverageRequest firstRequest = requestsIterator.next();
                GridCoverage2D firstCoverage = setupCoverage(helper, firstRequest, request, reader, hints, extensions, dimensions,
                        incrementalOutputSize, incrementalInputSize, coverageFactory);
                // check the first coverage memory usage
                long actual = incrementalInputSize.finalSize();
                // Estimated size
                long estimatedSize = actual*numRequests;
                //Check if the estimated size is greater than that of the maximum output memory
                // Limit check is performed only when the limit is defined
                if(outputLimit > 0 && estimatedSize > outputLimit){
                    throw new WcsException("This request is trying to generate too much data, " +
                            "the limit is " + formatBytes(outputLimit) + " but the estimated amount of bytes to be " +
                                    "written in the output is " + formatBytes(estimatedSize));
                }
                // If the estimated size does not exceed the limit, the first coverage is added to the GranuleStack
                stack.addCoverage(firstCoverage);

                // Get a coverage for each subrequest
                while (requestsIterator.hasNext()) {
                    GridCoverageRequest subRequest = requestsIterator.next();
                    GridCoverage2D singleCoverage = setupCoverage(helper, subRequest, request, reader, hints, extensions, dimensions,
                            incrementalOutputSize, incrementalInputSize, coverageFactory);
                    stack.addCoverage(singleCoverage);
                }
                coverage = stack;
            } else {
                // IncrementalSize not used
                coverage = setupCoverage(helper, gcr, request, reader, hints, extensions, null, null, null, coverageFactory);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.