Examples of WMSStoreInfo


Examples of org.geoserver.catalog.WMSStoreInfo

            store = info;
        }
        else if ( params.has("url") &&
                params.str("url").toLowerCase().contains("Service=WMS") &&
                params.str("url").startsWith("http")){
            WMSStoreInfo info = factory.createWebMapServer();
            info.setWorkspace(workspace);
            info.setType(name);
           
            // connect and defaults
            info.setCapabilitiesURL(params.str("url"));
            try {
                WebMapServer service = info.getWebMapServer(new NullProgressListener());
                info.setDescription( service.getInfo().getDescription() );
                info.setEnabled(true);
            } catch (Throwable e) {
                info.setError(e);
                info.setEnabled(false);
            }
            store = info;
        }
        else {
            HashMap map = new HashMap(params.raw());
            Map resolved = ResourcePool.getParams(map, cat.getResourceLoader() );
            DataAccess dataStore = DataAccessFinder.getDataStore(resolved);           
            if( dataStore == null ){
                throw new IllegalArgumentException("Connection parameters incomplete (does not match an available data store, coverage store or wms store).");
            }
            DataStoreInfo info = factory.createDataStore();
            info.setWorkspace(workspace);
            info.setType(name);
            info.getConnectionParameters().putAll(map);
            try {
                info.setDescription( dataStore.getInfo().getDescription());
                info.setEnabled(true);
            } catch (Throwable e) {
                info.setError(e);
                info.setEnabled(false);
            }
            store = info;
        }       
        boolean refresh = define( store, obj );
        if( refresh ){
View Full Code Here

Examples of org.geoserver.catalog.WMSStoreInfo

                        }
                    }
                }
            }
            else if( store instanceof WMSStoreInfo){
                WMSStoreInfo info = (WMSStoreInfo) store;
                if("connection".equals(prop)){
                    JSONObj connection = obj.object(prop);
                    if(!connection.has("url") && connection.str("url") != null){
                        throw new IllegalArgumentException("Property connection.url required for wms store");
                    }
                    for( String param : connection.keys()){
                        if("url".equals(param)){
                            String url = connection.str(param);
                            reconnect = reconnect || url == null || !url.equals(info.getCapabilitiesURL());
                            info.setCapabilitiesURL(url);
                        }
                    }
                }
            }
            if( store instanceof DataStoreInfo){
                DataStoreInfo info = (DataStoreInfo) store;
                if("connection".equals(prop)){
                    JSONObj connection = obj.object(prop);
                    info.getConnectionParameters().clear();
                    info.getConnectionParameters().putAll( connection.raw() );
                    reconnect = true;
                }
            }
        }
       
View Full Code Here

Examples of org.geoserver.catalog.WMSStoreInfo

        if (store instanceof CoverageStoreInfo) {
            CoverageStoreInfo info = (CoverageStoreInfo) store;
            connection.put("raster", info.getURL());
        }
        if (store instanceof WMSStoreInfo) {
            WMSStoreInfo info = (WMSStoreInfo) store;
            json.put("wms", info.getCapabilitiesURL());
        }
        json.put("connection", connection );
        json.put("error", IO.error( new JSONObj(), store.getError()));

        if (store.isEnabled()) {
View Full Code Here

Examples of org.geoserver.catalog.WMSStoreInfo

    Component newWMSImportLink() {
        return new AjaxLink("createWMSImport") {
           
            @Override
            public void onClick(AjaxRequestTarget target) {
                WMSStoreInfo wms = getCatalog().getStore(storeId, WMSStoreInfo.class);
                PageParameters pp = new PageParameters("storeId=" + storeId);
                setResponsePage(WMSLayerImporterPage.class, pp);
            }
        };
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSStoreInfo

    public void testAddWMSStore() {
        assertTrue( catalog.getStores(WMSStoreInfo.class).isEmpty() );
        addWMSStore();
        assertEquals( 1, catalog.getStores(WMSStoreInfo.class).size() );
       
        WMSStoreInfo retrieved = catalog.getStore(wms.getId(), WMSStoreInfo.class);
       
        WMSStoreInfo wms2 = catalog.getFactory().createWebMapServer();
        wms2.setName( "wms2Name" );
        wms2.setWorkspace( ws );
       
        catalog.add( wms2 );
        assertEquals( 2, catalog.getStores(WMSStoreInfo.class).size() );
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSStoreInfo

        testAddWorkspace();
       
        File dir = new File( testData.getDataDirectoryRoot(), "workspaces/acme/demowms");
        assertFalse( dir.exists() );
       
        WMSStoreInfo wms = catalog.getFactory().createWebMapServer();
        wms.setName( "demowms" );
        wms.setWorkspace( catalog.getWorkspaceByName( "acme" ) );
        catalog.add( wms );
       
        assertTrue( dir.exists() );
        assertTrue( new File( dir, "wmsstore.xml").exists() );
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSStoreInfo

    }
   
    public void testModifyWMSStore() throws Exception {
        testAddWMSStore();
       
        WMSStoreInfo wms = catalog.getStoreByName( "acme", "demowms", WMSStoreInfo.class );
        assertNull( wms.getCapabilitiesURL() );
       
        String capsURL = "http://demo.opengeo.org:8080/geoserver/wms?request=GetCapabilites&service=WMS";
        wms.setCapabilitiesURL(capsURL);
        catalog.save( wms );
       
        File f = new File( testData.getDataDirectoryRoot(), "workspaces/acme/demowms/wmsstore.xml");
        Document dom = dom( f );
        assertXpathEvaluatesTo(capsURL, "/wmsStore/capabilitiesURL/text()", dom);
View Full Code Here

Examples of org.geoserver.catalog.WMSStoreInfo

        testAddWMSStore();
       
        File f = new File( testData.getDataDirectoryRoot(), "workspaces/acme/demowms");
        assertTrue( f.exists() );
       
        WMSStoreInfo wms = catalog.getStoreByName("acme", "demowms", WMSStoreInfo.class);
        catalog.remove( wms );
        assertFalse( f.exists() );
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSStoreInfo

public class WMSStoreNewPage extends AbstractWMSStorePage {

    public WMSStoreNewPage() {
        try {
            CatalogBuilder builder = new CatalogBuilder(getCatalog());
            WMSStoreInfo store = builder.buildWMSStore(null);

            initUI(store);
            capabilitiesURL.getFormComponent().add(new WMSCapabilitiesURLValidator());
        } catch (IOException e) {
            throw new RuntimeException("Could not setup the WMS store: " + e.getMessage(), e);
View Full Code Here

Examples of org.geoserver.catalog.WMSStoreInfo

            throws IllegalArgumentException {
        /*
         * Try saving a copy of it so if the process fails somehow the original "info" does not end
         * up with an id set
         */
        WMSStoreInfo savedStore = getCatalog().getFactory().createWebMapServer();
        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 {
            getCatalog().save(savedStore);
        } catch (RuntimeException e) {
            LOGGER.log(Level.INFO, "Adding the store for " + info.getCapabilitiesURL(), e);
            throw new IllegalArgumentException(
                    "The WMS 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 layers for the WMS store " + info.getCapabilitiesURL(), e);
            // doh, can't present the list of coverages, means saving the StoreInfo is meaningless.
            try {// be extra cautious
                getCatalog().remove(savedStore);
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.