Package it.geosolutions.geostore.services.rest.model

Examples of it.geosolutions.geostore.services.rest.model.RESTResource


        UNREDDChartScript chartScript = new UNREDDChartScript();
        chartScript.setAttribute(Attributes.SCRIPTPATH, testScript.getAbsolutePath());
        chartScript.addReverseAttribute(ReverseAttributes.STATSDEF, STATSDEFNAME);

        RESTResource chartScriptRes = chartScript.createRESTResource();
        chartScriptRes.setName("testChartScript");
        gstcu.insert(chartScriptRes);
//        Resource fullChartScript = gstcu.getGeoStoreClient().getResource(chartScriptId);

        SearchFilter chartDataFilter = new CategoryFilter(UNREDDCategories.CHARTDATA.getName(), SearchOperator.EQUAL_TO);
        ShortResourceList res0 = gstcu.getGeoStoreClient().searchResources(chartDataFilter);
View Full Code Here


        }
       
        // this part creates the file to feed the GeoStoreAction
        File tmpFile = null;
        try {
            RESTResource resource = new RESTResource(); // this is just a packaging for id+data
            resource.setId(id);
            resource.setData(data);           
            tmpFile = File.createTempFile("UpdateData", ".xml", tempDir);
            Marshaller m = JAXBMarshallerBuilder.getJAXBMarshaller(resource.getClass());
            m.marshal(resource, tmpFile);

            GeostoreActionConfiguration geoStoreCfg = createConfiguration();
            geoStoreCfg.setShortResource(true);
            geoStoreCfg.setOperation(GeostoreOperation.Operation.UPDATEDATA);
View Full Code Here

     */
    @Override
    public void delete(long id) throws GeoStoreException {

        try {
            RESTResource resource = new RESTResource();
            resource.setId(id);

            // this part creates the file to feed the GeoStoreAction
            File inputFile = File.createTempFile("Delete", ".xml", tempDir);
            Marshaller m = JAXBMarshallerBuilder.getJAXBMarshaller(resource.getClass());
            m.marshal(resource, inputFile);

            GeostoreActionConfiguration geoStoreCfg = createConfiguration();
            geoStoreCfg.setShortResource(true);
            geoStoreCfg.setOperation(GeostoreOperation.Operation.DELETE);
View Full Code Here

        }

    }

    public static Long insertStatsDef(String statsdefname, String content, String layer) {
        RESTResource statsDefRRes = UNREDDResourceBuilder.createStatsDefResource(statsdefname, content, layer);
        return geostoreClient1.insert(statsDefRRes);
    }
View Full Code Here

        RESTResource statsDefRRes = UNREDDResourceBuilder.createStatsDefResource(statsdefname, content, layer);
        return geostoreClient1.insert(statsDefRRes);
    }

    public static void insertLayerUpdate(String layer, String year, String month, String day) {      
        RESTResource rs = UNREDDResourceBuilder.createLayerUpdateResource(layer, year, month, day, null);
        geostoreClient1.insert(rs);
    }
View Full Code Here

        RESTResource rs = UNREDDResourceBuilder.createLayerUpdateResource(layer, year, month, day, null);
        geostoreClient1.insert(rs);
    }

    public static Long insertStatsData(String statsdef, String year, String month, String day, String content) {
        RESTResource rs = UNREDDResourceBuilder.createStatsDataResource(statsdef, year, month, day, content);
        return geostoreClient1.insert(rs);
    }
View Full Code Here

            UNREDDChartScript chartScript = new UNREDDChartScript();
            chartScript.setAttribute(Attributes.SCRIPTPATH, testScript.getAbsolutePath());
            chartScript.addReverseAttribute(ReverseAttributes.STATSDEF, "area_admin1_fc13"); // any one is good

            RESTResource chartScriptRes = chartScript.createRESTResource();
            chartScriptRes.setName("testChartScript");
            gstcu.insert(chartScriptRes);
        }

//        Resource fullChartScript = gstcu.getGeoStoreClient().getResource(chartScriptId);
View Full Code Here

        {
            String mosaicDir = classFile.getAbsoluteFile().getParent();

            UNREDDLayer layer = new UNREDDLayer();
            layer.setAttribute(UNREDDLayer.Attributes.MOSAICPATH, mosaicDir);
            RESTResource layerRes = layer.createRESTResource();
            layerRes.setName(LAYERNAME);
            gstcu.insert(layerRes);
        }

        // add a layerUpdate
        {
            gstcu.insertLayerUpdate(LAYERNAME, "2010", null, null);
        }

        // add a statsDef
        {
            File dataFile = loadFile("reprocess/stats/rdc_area.tif");
            assertNotNull(dataFile);

            String smallStat = " <statisticConfiguration>"
                            + "   <name>area_admin_small</name>"
                            + "   <title>Low resolution admin areas</title>"
                            + "   <description>Compute the area for the administrative areas. Low resolutions raster.</description>"
                            + "   <stats>"
                            + "      <stat>SUM</stat>"
                            + "      <stat>MIN</stat>"
                            + "      <stat>MAX</stat>"
                            + "      <stat>COUNT</stat>"
                            + "   </stats>"
                            + "   <deferredMode>true</deferredMode>"
                            + "   <dataLayer>"
                            + "      <file>"+dataFile.getAbsolutePath()+"</file>" // in production, this will be a fixed string as here
                            + "   </dataLayer>"
                            + "   <classificationLayer zonal=\"true\">"
                            + "      <file>{"+Tokens.FILEPATH+"}</file>"          // in production, this will be expanded as a token as in here
                            + "      <nodata>65535</nodata>"
                            + "   </classificationLayer>"
                            + "   <output>"
                            + "      <format>CSV</format>"
                            + "      <separator>;</separator>"
                            + "      <NaNValue>-1</NaNValue>"
                            + "   </output>"
                            + "</statisticConfiguration>";

            UNREDDGeoStoreTestUtil.insertStatsDef(STATSDEFNAME, smallStat, LAYERNAME);
//            Resource statsDef = gstcu.getFullResource(sdId);
        }

        // insert chartScript
        {
            File testScript = loadFile("configuration/script/testScript.groovy");
            LOGGER.info("Test groovy script is " + testScript);

            UNREDDChartScript chartScript = new UNREDDChartScript();
            chartScript.setAttribute(Attributes.SCRIPTPATH, testScript.getAbsolutePath());
            chartScript.addReverseAttribute(ReverseAttributes.STATSDEF, STATSDEFNAME);

            RESTResource chartScriptRes = chartScript.createRESTResource();
            chartScriptRes.setName("testChartScript");
            gstcu.insert(chartScriptRes);
        }

        LOGGER.info("--------------- Data setup complete-- running real test ----------");
       
View Full Code Here

            String sid = basename.substring(basename.indexOf("_")+1);
            String dataFileName = "data_"+sid+".txt";
            File dataFile = new File(geostoreDir,dataFileName);
            String data = IOUtils.toString(new FileReader(dataFile));

            RESTResource restRes = FlowUtil.copyResource(res);
            restRes.setData(data);

            LOGGER.info("INSERTING " + res.getCategory().getName() + " : " + res.getName());
            geostore.insert(restRes);
        }
View Full Code Here

TOP

Related Classes of it.geosolutions.geostore.services.rest.model.RESTResource

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.