Package org.geoserver.catalog

Examples of org.geoserver.catalog.StoreInfo


        }
       
        @Override
        public Object doUnmarshal(Object result,
                HierarchicalStreamReader reader, UnmarshallingContext context) {
            StoreInfo store = (StoreInfo) super.doUnmarshal(result, reader, context);
           
            // 2.1.3+ backwards compatibility check
            if (store instanceof WMSStoreInfo) {
                WMSStoreInfo wmsStore = (WMSStoreInfo) store;
                MetadataMap metadata = wmsStore.getMetadata();
                Integer maxConnections = null;
                Integer connectTimeout = null;
                Integer readTimeout = null;
                if (metadata != null) {
                    maxConnections = metadata.get("maxConnections", Integer.class);
                    connectTimeout = metadata.get("connectTimeout", Integer.class);
                    readTimeout = metadata.get("readTimeout", Integer.class);
                    metadata.remove("maxConnections");
                    metadata.remove("connectTimeout");
                    metadata.remove("readTimeout");
                }
                if (wmsStore.getMaxConnections() <= 0) {
                    wmsStore.setMaxConnections(maxConnections != null
                            && maxConnections.intValue() > 0 ? maxConnections
                            : WMSStoreInfoImpl.DEFAULT_MAX_CONNECTIONS);
                }
                if (wmsStore.getConnectTimeout() <= 0) {
                    wmsStore.setConnectTimeout(connectTimeout != null
                            && connectTimeout.intValue() > 0 ? connectTimeout
                            : WMSStoreInfoImpl.DEFAULT_CONNECT_TIMEOUT);
                }
                if (wmsStore.getReadTimeout() <= 0) {
                    wmsStore.setReadTimeout(readTimeout != null && readTimeout.intValue() > 0 ? readTimeout
                            : WMSStoreInfoImpl.DEFAULT_READ_TIMEOUT);
                }
            }

            //process any parameters that require decryption
            GeoServerSecurityManager secMgr = encryptPasswordFields ? getSecurityManager() : null;
            if (secMgr != null) {
                secMgr.getConfigPasswordEncryptionHelper().decode(store);
            }

            log(Level.INFO, "Loaded store '" +  store.getName() "', " + (store.isEnabled() ? "enabled" : "disabled"));
            return store;
        }
View Full Code Here


        return ws;
    }

    static StoreInfo resolve(StoreInfo s, Catalog cat, boolean lookupByName) {
        if (s != null) {
            StoreInfo resolved = null;
            if (s.getId() != null) {
                resolved = cat.getStore(s.getId(), StoreInfo.class);
            }
           
            if (resolved == null && lookupByName) {
View Full Code Here

                cat.add( targetWorkspace );
                cat.add( ns );
            }
        }

        StoreInfo targetStore = (StoreInfo) (store.getObject() != null ? store
                .getObject() : null);

        Importer importer = ImporterWebUtils.importer();
        return importer.createContextAsync(source, targetWorkspace, targetStore);
View Full Code Here

     * Adding special treatment for H2 databases, we want to also kill the db itself
     */
    @Override
    protected void removeStore(String workspaceName, String name) {
        Catalog cat = getCatalog();
        StoreInfo store = cat.getStoreByName(workspaceName, name, StoreInfo.class);
        if (store == null) {
            return;
        }
       
        // store the database location in case it's a H2 store
        Map<String, Serializable> params = store.getConnectionParameters();
        String databaseLocation = null;
        if("h2".equals(params.get("dbtype"))) {
            databaseLocation = (String) params.get("database");
        }

        CascadeDeleteVisitor v = new CascadeDeleteVisitor(getCatalog());
        store.accept(v);
       
        // clean up the database files if needed
        if(databaseLocation != null) {
            final File dbFile = new File(databaseLocation);
            File container = dbFile.getParentFile();
View Full Code Here

        this.storeModel = storeModel;
    }

    @Override
    protected List<String> load() {
        StoreInfo store = storeModel.getObject();
        if (store == null) {
            return Collections.emptyList();
        }
        try {
            Catalog catalog = GeoServerApplication.get().getCatalog();
View Full Code Here

    }

    public <T extends StoreInfo> T getStore(String id, Class<T> clazz) {
        List l = lookup(clazz, stores);
        for (Iterator i = l.iterator(); i.hasNext();) {
            StoreInfo store = (StoreInfo) i.next();
            if (id.equals(store.getId())) {
                return ModificationProxy.create( (T) store, clazz );
            }
        }

        return null;
View Full Code Here

            }
        }
        else {
           
            for (Iterator i = l.iterator(); i.hasNext();) {
                StoreInfo store = (StoreInfo) i.next();
                if (name.equals(store.getName()) && store.getWorkspace().equals( workspace )) {
                    return ModificationProxy.create( (T) store, clazz );
                }
            }
        }
        return null;
View Full Code Here

        List all = lookup(clazz, stores);
        List matches = new ArrayList();

        for (Iterator s = all.iterator(); s.hasNext();) {
            StoreInfo store = (StoreInfo) s.next();
            if (workspace.equals(store.getWorkspace())) {
                matches.add(store);
            }
        }

        return ModificationProxy.createList(matches,clazz);
View Full Code Here

        WorkspacesModel wm = new WorkspacesModel();
        List<WorkspaceInfo> wl = (List<WorkspaceInfo>) wm.getObject();
        WorkspaceInfo ws = wl.get(2);

        // check it's the same
        StoreInfo store = getCatalog().getStoreByName("testStore", DataStoreInfo.class);
        assertEquals(getCatalog().getNamespaceByPrefix(ws.getName()).getURI(), store.getConnectionParameters().get("namespace"));
    }
View Full Code Here

     *
     * @param layer
     */
    private void delete(LayerInfo layer) {
        ResourceInfo resource = layer.getResource();
        StoreInfo store = resource.getStore();
        catalog.remove(layer);
        catalog.remove(resource);
        catalog.remove(store);
    }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.StoreInfo

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.