Package org.geoserver.catalog

Examples of org.geoserver.catalog.WorkspaceInfo


            NamespaceInfo namespace = factory.createNamespace();
            namespace.setPrefix((String) entry.getKey());
            namespace.setURI((String) entry.getValue());
            catalog.add(namespace);
           
            WorkspaceInfo workspace = factory.createWorkspace();
            workspace.setName( (String) entry.getKey() );
            catalog.add(workspace);
           
            if ( namespace.getURI().equals( namespaces.get( "" ) )) {
                catalog.setDefaultNamespace(namespace);
                catalog.setDefaultWorkspace(workspace);
View Full Code Here


                        // nothing to do
                        return;
                    }
                }

                WorkspaceInfo ws = (WorkspaceInfo) wsDropDown.getModelObject();
                String prefix = ws.getName();
                NamespaceInfo namespaceInfo = getCatalog().getNamespaceByPrefix(prefix);
                namespacePanel.setModelObject(namespaceInfo);
                target.addComponent(namespacePanel.getFormComponent());
            }
        });
View Full Code Here

     *            the type of datastore to create, given by its factory display name
     */
    public DataAccessNewPage(final String dataStoreFactDisplayName) {
        super();

        final WorkspaceInfo defaultWs = getCatalog().getDefaultWorkspace();
        if (defaultWs == null) {
            throw new IllegalStateException("No default Workspace configured");
        }
        final NamespaceInfo defaultNs = getCatalog().getDefaultNamespace();
        if (defaultNs == null) {
View Full Code Here

    public void validate(final IValidatable validatable) {

        final Catalog catalog = GeoServerApplication.get().getCatalog();
        final StoreInfo store = catalog.getStore(storeId, StoreInfo.class);
        final WorkspaceInfo previousWorkspace = catalog.getWorkspace(wsId);

        final WorkspaceInfo newWorkspace = (WorkspaceInfo) validatable.getValue();
        if (previousWorkspace.equals(newWorkspace)) {
            return;
        }

        final NamespaceInfo newNamespace = catalog.getNamespaceByPrefix(newWorkspace.getName());

        List<ResourceInfo> configuredResources = catalog.getResourcesByStore(store,
                ResourceInfo.class);

        // The datastore namespace may have changed and resources with the same name may already
View Full Code Here

    public void testAddWorkspace() {
        assertTrue( catalog.getWorkspaces().isEmpty() );
        catalog.add( ws );
        assertEquals( 1, catalog.getWorkspaces().size() );
       
        WorkspaceInfo ws2 = catalog.getFactory().createWorkspace();
       
        try {
            catalog.getNamespaces().add( ws2 );
            fail( "adding directly should throw an exception" );
        }
        catch( Exception e ) {
        }
       
        try {
            catalog.add( ws2 );
            fail( "addign without a name should throw an exception");
        }
        catch( Exception e ) {
        }
       
        ws2.setName( "ws2" );
        catalog.add( ws2 );
    }
View Full Code Here

        assertNull(catalog.getDefaultNamespace());
    }

    public void testGetWorkspaceById() {
        catalog.add( ws );
        WorkspaceInfo ws2 = catalog.getWorkspace(ws.getId());
       
        assertNotNull(ws2);
        assertFalse( ws == ws2 );
        assertEquals( ws, ws2 );
    }
View Full Code Here

        assertEquals( ws, ws2 );
    }
   
    public void testGetWorkspaceByName() {
        catalog.add( ws );
        WorkspaceInfo ws2 = catalog.getWorkspaceByName(ws.getName());
       
        assertNotNull(ws2);
        assertFalse( ws == ws2 );
        assertEquals( ws, ws2 );
    }
View Full Code Here

    }
   
    public void testModifyWorkspace() {
        catalog.add( ws );
       
        WorkspaceInfo ws2 = catalog.getWorkspaceByName(ws.getName());
        ws2.setName( null );
        try {
            catalog.save( ws2 );
            fail( "setting name to null should throw exception");
        }
        catch( Exception e) {
        }
       
        ws2.setName( "ws2");
       
        WorkspaceInfo ws3 = catalog.getWorkspaceByName(ws.getName());
        assertEquals( "wsName", ws3.getName() );
       
        catalog.save( ws2 );
        ws3 = catalog.getWorkspaceByName(ws2.getName());
        assertEquals(ws2, ws3);
        assertEquals( "ws2", ws3.getName() );
    }
View Full Code Here

   
    public void testWorkspaceEvents() {
        TestListener l = new TestListener();
        catalog.addListener( l );
       
        WorkspaceInfo ws = catalog.getFactory().createWorkspace();
        ws.setName( "ws2");
       
        assertTrue( l.added.isEmpty() );
        assertTrue( l.modified.isEmpty() );
        catalog.add( ws );
        assertEquals( 1, l.added.size() );
        assertEquals( ws, l.added.get(0).getSource());
        assertEquals( catalog, l.modified.get(0).getSource());
        assertEquals( "defaultWorkspace", l.modified.get(0).getPropertyNames().get(0));
       
        ws = catalog.getWorkspaceByName( "ws2" );
        ws.setName( "changed");
       
        catalog.save( ws );
        assertEquals( 2, l.modified.size() );
        assertTrue(l.modified.get(1).getPropertyNames().contains( "name" ));
        assertTrue(l.modified.get(1).getOldValues().contains( "ws2" ));
View Full Code Here

    }
   
    public void testChangeDataStoreWorkspace() throws Exception {
        catalog.add( ds );
       
        WorkspaceInfo ws2 = catalog.getFactory().createWorkspace();
        ws2.setName( "newWorkspace");
        catalog.add( ws2 );
        ws2 = catalog.getWorkspaceByName( ws2.getName() );
       
        DataStoreInfo ds2 = catalog.getDataStoreByName(ds.getName());
        ds2.setWorkspace( ws2 );
        catalog.save( ds2 );
       
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.