Package it.geosolutions.geobatch.unredd.script.util

Examples of it.geosolutions.geobatch.unredd.script.util.GeoStoreUtil


        conf = configuration;

    }

    private void initialize() {
        srcGeostore = new GeoStoreUtil(conf.getSrcGeoStoreConfig(), getTempDir());
        dstGeostore = new GeoStoreUtil(conf.getDstGeoStoreConfig(), getTempDir());
    }
View Full Code Here


        }
        if(! getTempDir().exists()) {
            throw new IllegalStateException("temp dir does not exist");
        }

        geoStoreUtil = new GeoStoreUtil(conf.getGeoStoreConfig(), getTempDir());


//        initComponents(properties);

        final Queue<FileSystemEvent> ret = new LinkedList<FileSystemEvent>();
View Full Code Here

    protected synchronized GeoStoreUtil getGeoStoreUtil() {
        // we're creating geostoreUtil lazily, bc invoking getTempDir causes it to be created even if we dont need it
        if(geostoreUtil == null)
//            geostoreUtil = new GeoStoreUtil(geostore_url, geostore_username, geostore_password, getTempDir());
            geostoreUtil = new GeoStoreUtil(geoStoreConfig, getTempDir());
        return geostoreUtil;
    }
View Full Code Here

        if( ! dataFile.isFile()) {
            throw new ActionException(this, "Could not read main data file " + dataFile);
        }

        /*****************/
        GeoStoreUtil geostore = new GeoStoreUtil(cfg.getGeoStoreConfig(), this.getTempDir());

        /******************
         *  Load Layer data
         ******************/

        this.listenerForwarder.progressing(15, "Searching layer in GeoStore");

        final Resource layerRes;
        try {
            layerRes = geostore.searchLayer(layername);
        } catch(Exception e) {
            throw new ActionException(this, "Error loading Layer "+layername, e);
        }

        if(layerRes == null)
            throw new ActionException(this, "Layer not found: "+layername);

        UNREDDLayer layer = new UNREDDLayer(layerRes);

        LOGGER.info("Layer resource found ");

        if( ! layer.getAttribute(Attributes.LAYERTYPE).equalsIgnoreCase(request.getFormat().getName()))
            throw new ActionException(this, "Bad Layer format "
                    + "(declared:"+ request.getFormat().getName()
                    + ", expected:"+layer.getAttribute(Attributes.LAYERTYPE) );

        // this attribute is read for moving the raster file to the destination directory, not for rasterization
        String mosaicDirPath = layer.getAttribute(UNREDDLayer.Attributes.MOSAICPATH);
        if( mosaicDirPath == null) {
            throw new ActionException(this, "Null mosaic directory for layer: '" + layername + "'... check the layer configuration on geostore");
        }

        File mosaicDir = new File(mosaicDirPath);
        if( ! mosaicDir.isDirectory() && ! mosaicDir.isAbsolute()) {
            throw new ActionException(this, "Bad mosaic directory for layer '" + layername + "': " + mosaicDir + " doesn't exist... create it or check the layer configuration on geostore");
        }

        // ******************
        // Check for LayerUpdate
        // ******************
        this.listenerForwarder.progressing(20, "Check for existing LayerUpdate in GeoStore");

        Resource existingLayerUpdate = null;
        try {
            existingLayerUpdate = geostore.searchLayerUpdate(layername, year, month, day);
        } catch (Exception e) {
            LOGGER.debug("Parameter : [layerSnapshot=" + layerUpdateName + "]");
            throw new ActionException(this, "Error searching for a LayerUpdate (layer:"+layername+" year:"+year+ " month:"+month+")", e);
        }

        if (existingLayerUpdate != null) {
            throw new ActionException(this, "LayerUpdate already exists (layer:"+layername+" year:"+year+ " month:"+month+")");
        }

        /********************************
         *
         * Image processing
         *
         *******************************/
        final File rasterFile;
        if (request.getFormat() == UNREDDFormat.VECTOR ) {
            rasterFile = processVector(dataFile, layername, year, month, day, layer, mosaicDir);

        } else {
            rasterFile = processRaster(dataFile, layer, mosaicDir, layername);

        }

        // *** Image processing has finished

        // ********************
        // Create LayerUpdate
        // ********************

        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Adding LayerUpdate into GeoStore");
        }
        this.listenerForwarder.progressing(70, "Adding LayerUpdate into GeoStore");

        try {
            geostore.insertLayerUpdate(layername, year, month, day);
        } catch (Exception e) {
            LOGGER.debug("Parameter : [layername=" + layername + ", year=" + year + ", month=" + month + "]");
            throw new ActionException(this, "Error while inserting a LayerUpdate", e);
        }

View Full Code Here

TOP

Related Classes of it.geosolutions.geobatch.unredd.script.util.GeoStoreUtil

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.