Examples of WorkspaceInfo


Examples of org.geoserver.catalog.WorkspaceInfo

        return getAttribute( "workspace") != null;
    }
   
    @Override
    protected void handleObjectPut(Object object) throws Exception {
        WorkspaceInfo workspace = (WorkspaceInfo) object;
        String ws = (String) getRequest().getAttributes().get( "workspace" );
       
        if ( "default".equals( ws ) ) {
            catalog.setDefaultWorkspace( workspace );
        }
        else {
            WorkspaceInfo original = catalog.getWorkspaceByName( ws );
           
            //ensure this is not a name change
            if ( workspace.getName() != null && !workspace.getName().equals( original.getName() ) ) {
                throw new RestletException( "Can't change the name of a workspace.", Status.CLIENT_ERROR_FORBIDDEN );
            }
           
            new CatalogBuilder(catalog).updateWorkspace( original, workspace );
            catalog.save( original );
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

    }
   
    @Override
    protected void handleObjectDelete() throws Exception {
        String workspace = (String) getRequest().getAttributes().get( "workspace");
        WorkspaceInfo ws = catalog.getWorkspaceByName( workspace );
       
        if ( !catalog.getStoresByWorkspace(ws, StoreInfo.class).isEmpty() ) {
            throw new RestletException( "Workspace not empty", Status.CLIENT_ERROR_FORBIDDEN );
        }
       
        //check for "linked" workspace
        NamespaceInfo ns = catalog.getNamespaceByPrefix( ws.getName() );
        if ( ns != null ) {
            if ( !catalog.getFeatureTypesByNamespace( ns ).isEmpty() ) {
                throw new RestletException( "Namespace for workspace not empty.", Status.CLIENT_ERROR_FORBIDDEN );
            }
            catalog.remove( ns );
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

       
        //JD: we need to keep namespace and workspace in sync, so create a worksapce
        // if one does not already exists, we can remove this once we get to a point
        // where namespace is just an attribute on a layer, and not a containing element
        if ( catalog.getWorkspaceByName( namespace.getPrefix() ) == null ) {
            WorkspaceInfo ws = catalog.getFactory().createWorkspace();
            ws.setName( namespace.getPrefix() );
            catalog.add( ws );
        }
       
        LOGGER.info( "POST namespace " + namespace );
        return namespace.getPrefix();
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

        String workspace = getAttribute( "workspace" );

        DataStoreInfo ds = (DataStoreInfo) object;
        if ( ds.getWorkspace() != null ) {
             //ensure the specifried workspace matches the one dictated by the uri
             WorkspaceInfo ws = (WorkspaceInfo) ds.getWorkspace();
             if ( !workspace.equals( ws.getName() ) ) {
                 throw new RestletException( "Expected workspace " + workspace +
                     " but client specified " + ws.getName(), Status.CLIENT_ERROR_FORBIDDEN );
             }
        }
        else {
             ds.setWorkspace( catalog.getWorkspaceByName( workspace ) );
        }
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

    public void testDefaultWorkspace() {

        startPage();

        WorkspaceInfo defaultWs = getCatalog().getDefaultWorkspace();

        tester.assertModelValue("dataStoreForm:workspacePanel:border:paramValue", defaultWs);

        WorkspaceInfo anotherWs = getCatalog().getFactory().createWorkspace();
        anotherWs.setName("anotherWs");

        getCatalog().add(anotherWs);
        getCatalog().setDefaultWorkspace(anotherWs);
        anotherWs = getCatalog().getDefaultWorkspace();
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

                MockData.CITE_PREFIX).getURI());

        Serializable directory = store.getConnectionParameters().get("directory");
        tester.assertModelValue(directoryParamPath, directory);

        WorkspaceInfo expectedWorkspace = catalog.getWorkspaceByName(MockData.CDF_PREFIX);
        NamespaceInfo expectedNamespace = catalog.getNamespaceByPrefix(MockData.CDF_PREFIX);

        // select the fifth item in the drop down, which is the cdf workspace
        formTester.select("workspacePanel:border:paramValue", 4);
        Component wsDropDown = tester.getComponentFromLastRenderedPage(wsDropdownPath);
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

        // did the save finish normally?
        tester.assertRenderedPage(StorePage.class);

        CoverageStoreInfo store = catalog.getCoverageStore(coverageStore.getId());
        WorkspaceInfo workspace = store.getWorkspace();
        assertFalse(MockData.WCS_PREFIX.equals(workspace.getName()));

        // was the namespace for the datastore resources updated?
        List<CoverageInfo> resourcesByStore;
        resourcesByStore = catalog.getResourcesByStore(store, CoverageInfo.class);

        assertTrue(resourcesByStore.size() > 0);

        for (CoverageInfo cv : resourcesByStore) {
            assertEquals("Namespace for " + cv.getName() + " was not updated", workspace.getName(),
                    cv.getNamespace().getPrefix());
        }
    }
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

    protected <T extends NamespaceInfo> T checkAccess(Authentication user, T ns) {
        if(ns == null)
            return null;
       
        // route the security check thru the associated workspace info
        WorkspaceInfo ws = delegate.getWorkspaceByName(ns.getPrefix());
        if(ws == null) {
            // temporary workaround, build a fake workspace, as we're probably
            // in between a change of workspace/namespace name
            ws = delegate.getFactory().createWorkspace();
            ws.setName(ns.getPrefix());
        }
        WorkspaceInfo info = checkAccess(user, ws);
        if (info == null)
            return null;
        else
            return ns;
    }
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

   
    public void testAddWorkspace() throws Exception {
        File ws = new File( testData.getDataDirectoryRoot(), "workspaces/acme" );
        assertFalse( ws.exists() );
       
        WorkspaceInfo acme = catalog.getFactory().createWorkspace();
        acme.setName( "acme" );
        catalog.add( acme );
       
        assertTrue( ws.exists() );
    }
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

        testAddWorkspace();
       
        File ws = new File( testData.getDataDirectoryRoot(), "workspaces/acme" );
        assertTrue( ws.exists() );
       
        WorkspaceInfo acme = catalog.getWorkspaceByName( "acme" );
        catalog.remove( acme );
        assertFalse( ws.exists() );
    }
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.