Package org.geoserver.catalog

Examples of org.geoserver.catalog.WorkspaceInfo


           
            //handle the case of a store changing workspace
            if ( source instanceof StoreInfo ) {
                i = event.getPropertyNames().indexOf( "workspace");
                if ( i > -1 ) {
                    WorkspaceInfo newWorkspace = (WorkspaceInfo) event.getNewValues().get( i );
                    File oldDir = dir( (StoreInfo) source );
                    oldDir.renameTo( new File( dir( newWorkspace ), oldDir.getName() ) );
                }
            }
           
            //handle default workspace
            if ( source instanceof Catalog ) {
                i = event.getPropertyNames().indexOf("defaultWorkspace");
                if ( i > -1 ) {
                    WorkspaceInfo defWorkspace = (WorkspaceInfo) event.getNewValues().get( i );
                    File d = rl.createDirectory( "workspaces");
                    persist(defWorkspace, new File(d, "default.xml"));
                }
            }
           
View Full Code Here


     *            the {@link Format#getName() name} of the format to create a new raster coverage
     *            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");
View Full Code Here

        }
        if (store.getWorkspace() == null) {
            throw new IllegalArgumentException("Store must be part of a workspace");
        }

        WorkspaceInfo workspace = store.getWorkspace();
        StoreInfo existing = getStoreByName(workspace, store.getName(), StoreInfo.class);
        if (existing != null && !existing.getId().equals(store.getId())) {
            String msg = "Store '" + store.getName() + "' already exists in workspace '"
                    + workspace.getName() + "'";
            throw new IllegalArgumentException(msg);
        }
    }
View Full Code Here

                name, clazz);
    }

    public <T extends StoreInfo> List<T> getStoresByWorkspace(String workspaceName, Class<T> clazz) {

        WorkspaceInfo workspace = null;
        if (workspaceName != null) {
            workspace = getWorkspaceByName(workspaceName);
            if (workspace == null) {
                return Collections.EMPTY_LIST;
            }
View Full Code Here

    void validate(WorkspaceInfo workspace, boolean isNew) {
        if (isNull(workspace.getName())) {
            throw new NullPointerException("workspace name must not be null");
        }

        WorkspaceInfo existing = catalogDAO.getWorkspaceByName(workspace.getName());
        if (existing != null && !existing.getId().equals(workspace.getId())) {
            throw new IllegalArgumentException("Workspace named '" + workspace.getName()
                    + "' already exists.");
        }

    }
View Full Code Here

        saved(workspace);
    }

    public WorkspaceInfo getDefaultWorkspace() {
        WorkspaceInfo workspace = catalogDAO.getDefaultWorkspace();
        if (workspace != null) {
            resolve(workspace);
            return createProxy(workspace, WorkspaceInfo.class);
        } else
            return null;
View Full Code Here

    }

    public void setDefaultWorkspace(WorkspaceInfo workspace) {

        WorkspaceInfo wsold = catalogDAO.getDefaultWorkspace();
        WorkspaceInfo wsnew = catalogDAO.getWorkspaceByName(workspace.getName());
        if (wsnew == null) {
            throw new IllegalArgumentException("No such workspace: '" + workspace.getName() + "'");
        }

        if (wsold != null && wsold.getName().equals(wsnew.getName())) // setting existing default
            return;

        ((WorkspaceInfoImpl) wsnew).setDefault(true);
        catalogDAO.update(wsnew);
        if (wsold != null) {
View Full Code Here

        return createProxyList(workspaces, WorkspaceInfo.class);

    }

    public WorkspaceInfo getWorkspace(String id) {
        WorkspaceInfo workspace = catalogDAO.getWorkspace(id);
        if (workspace != null) {
            resolve(workspace);
            return createProxy(workspace, WorkspaceInfo.class);
        } else
            return null;
View Full Code Here

            return null;

    }

    public WorkspaceInfo getWorkspaceByName(String name) {
        WorkspaceInfo workspace = catalogDAO.getWorkspaceByName(name);
        if (workspace != null) {
            resolve(workspace);
            return createProxy(workspace, WorkspaceInfo.class);
        } else
            return null;
View Full Code Here

    protected void resolve(StoreInfo store) {
        StoreInfoImpl s = (StoreInfoImpl) store;

        // resolve the workspace
        WorkspaceInfo resolved = ResolvingProxy.resolve(this, s.getWorkspace());
        if (resolved != null) {
            s.setWorkspace(resolved);
        } else {
            // this means the workspace has not yet been added to the catalog, keep the proxy around
        }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.WorkspaceInfo

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.