Package org.geoserver.catalog

Examples of org.geoserver.catalog.CoverageStoreInfo


     *            for
     */
    public CoverageStoreNewPage(final String coverageFactoryName) {
        Catalog catalog = getCatalog();
        final WorkspaceInfo workspace = catalog.getDefaultWorkspace();
        CoverageStoreInfo store = catalog.getFactory().createCoverageStore();
        store.setWorkspace(workspace);
        store.setType(coverageFactoryName);
        store.setEnabled(true);
        store.setURL("file:data/example.extension");

        initUI(store);
    }
View Full Code Here


        /*
         * Try saving a copy of it so if the process fails somehow the original "info" does not end
         * up with an id set
         */
        CoverageStoreInfo savedStore = catalog.getFactory().createCoverageStore();
        clone(info, savedStore);

        // GR: this shouldn't fail, the Catalog.save(StoreInfo) API does not declare any action in
        // case
        // of a failure!... strange, why a save can't fail?
        // Still, be cautious and wrap it in a try/catch block so the page does not blow up
        try {
            catalog.save(savedStore);
        } catch (RuntimeException e) {
            LOGGER.log(Level.INFO, "Adding the store for " + info.getURL(), e);
            throw new IllegalArgumentException(
                    "The coverage store could not be saved. Failure message: " + e.getMessage());
        }

        // the StoreInfo save succeeded... try to present the list of coverages (well, _the_
        // coverage while the getotools coverage api does not allow for more than one
        NewLayerPage layerChooserPage;
        try {
            layerChooserPage = new NewLayerPage(savedStore.getId());
        } catch (RuntimeException e) {
            LOGGER.log(Level.INFO, "Getting list of coverages for saved store " + info.getURL(), e);
            // doh, can't present the list of coverages, means saving the StoreInfo is meaningless.
            try {// be extra cautious
                catalog.remove(savedStore);
View Full Code Here

     * @param parameters
     */
    public CoverageStoreEditPage(PageParameters parameters) {
        String wsName = parameters.getString(WS_NAME);
        String storeName = parameters.getString(STORE_NAME);
        CoverageStoreInfo csi = getCatalog().getCoverageStoreByName(wsName, storeName);
       
        if(csi == null) {
            error(new ParamResourceModel("CoverageStoreEditPage.notFound", this, wsName, storeName).getString());
            setResponsePage(StorePage.class);
            return;
View Full Code Here

     * @param storeId
     *            the store id
     */
    public CoverageStoreEditPage(final String storeId) throws IllegalArgumentException {
        Catalog catalog = getCatalog();
        CoverageStoreInfo store = catalog.getCoverageStore(storeId);
        if (store == null) {
            throw new IllegalArgumentException("Cannot find coverage store " + storeId);
        }

        initUI(store);
View Full Code Here

                target.addComponent(paramsForm);
            }

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form form) {
                CoverageStoreInfo info = (CoverageStoreInfo) form.getModelObject();
                try {
                    onSave(info, target);
                } catch (IllegalArgumentException e) {
                    paramsForm.error(e.getMessage());
                    target.addComponent(paramsForm);
View Full Code Here

        endTransaction();
        // ----------------------------------------------------------------------
        startNewTransaction();

        // create a new store
        CoverageStoreInfo store = catalog.getFactory().createCoverageStore();
        store.setWorkspace(ws);
        store.setName("coverageStore");
        store.setDescription("store description");
        store.setEnabled(true);
        store.setType("type");
        store.setURL("url");

        store.getMetadata().put("1", "one");
        store.getMetadata().put("2", new Double(2.0));

        catalog.add(store);

        endTransaction();
        // Logging.getLogger(this.getClass()).warning("##################### id:" + store.getId() +
        // " name:"+store.getName() );

        // ----------------------------------------------------------------------
        startNewTransaction();

        List<CoverageStoreInfo> stores = catalog.getCoverageStores();
        // for (CoverageStoreInfo storex : stores) {
        // Logging.getLogger(this.getClass()).warning(":::::::::: id:" + storex.getId() +
        // " name:"+storex.getName() );
        // }
        assertEquals(1, stores.size());
        // Logging.getLogger(this.getClass()).warning("::::::::::::::::::::: id:" +
        // stores.get(0).getId() + " name:"+stores.get(0).getName() );

        CoverageStoreInfo loadedStore = catalog.getCoverageStore(store.getId());
        assertNotNull("Store " + store.getId() + " was not persisted properly.", loadedStore);
        assertEquals("coverageStore", loadedStore.getName());
        assertEquals("store description", loadedStore.getDescription());
        assertTrue(loadedStore.isEnabled());
        assertEquals("type", loadedStore.getType());

        assertEquals("url", loadedStore.getURL());

        assertEquals("one", loadedStore.getMetadata().get("1"));
        assertEquals(new Double(2.0), loadedStore.getMetadata().get("2"));
    }
View Full Code Here

        catalog.add(ws);

        endTransaction();
        startNewTransaction();

        CoverageStoreInfo coverageStore = catalog.getFactory().createCoverageStore();
        coverageStore.setName("coverageStore2");
        coverageStore.setWorkspace(ws);

        catalog.add(coverageStore);

        CoverageInfo coverage = catalog.getFactory().createCoverage();
        coverage.setName("coverage");
View Full Code Here

    private LayerInfo createLayer(WorkspaceInfo ws, String csname, String covname, String covnname,
            String covtitle, String lname) {
        LayerInfo layer1;

        CoverageStoreInfo coverageStore = catalog.getFactory().createCoverageStore();
        coverageStore.setName(csname);
        coverageStore.setWorkspace(ws);

        catalog.add(coverageStore);

        CoverageInfo coverage = catalog.getFactory().createCoverage();
        coverage.setName(covname);
View Full Code Here

    protected List handleListGet() throws Exception {
        String ws = getAttribute("workspace");
        String cs = getAttribute("coveragestore");
       
        if ( cs != null ) {
            CoverageStoreInfo coverageStore = catalog.getCoverageStoreByName( cs );
            return catalog.getCoveragesByCoverageStore(coverageStore);   
        }
       
        NamespaceInfo ns = catalog.getNamespaceByPrefix( ws );
        return catalog.getCoveragesByNamespace( ns );
View Full Code Here

            throw new RestletException( "", Status.CLIENT_ERROR_NOT_FOUND );
        }

        LOGGER.fine( "GET coverage " + coveragestore + "," + coverage );
        CoverageStoreInfo cs = catalog.getCoverageStoreByName(workspace, coveragestore);
        return catalog.getCoverageByCoverageStore( cs, coverage );
    }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.CoverageStoreInfo

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.