Examples of WorkspaceInfo


Examples of org.geoserver.catalog.WorkspaceInfo

        assertFalse( ws.exists() );
    }
   
    public void testDefaultWorkspace() throws Exception {
        testAddWorkspace();
        WorkspaceInfo ws = catalog.getWorkspaceByName("acme");
        catalog.setDefaultWorkspace(ws);
       
        File dws = new File( testData.getDataDirectoryRoot(), "workspaces/default.xml" );
        assertTrue( dws.exists() );
       
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

        testAddDataStore();
        File f1 =
            new File( testData.getDataDirectoryRoot(), "workspaces/acme/foostore/datastore.xml");
        assertTrue( f1.exists() );
       
        WorkspaceInfo nws = catalog.getFactory().createWorkspace();
        nws.setName( "topp");
        catalog.add( nws );
       
        DataStoreInfo ds = catalog.getDataStoreByName( "acme", "foostore" );
        ds.setWorkspace( nws );
        catalog.save( ds );
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

        out.close();
    
        //persist resources
        File workspaces = resourceLoader.findOrCreateDirectory( "workspaces" );
        for ( ResourceInfo r : catalog.getResources( ResourceInfo.class ) ) {
            WorkspaceInfo ws = r.getStore().getWorkspace();
            File workspace = new File( workspaces, ws.getName() );
            if ( !workspace.exists() ) {
                workspace.mkdir();
            }
           
            String dirName = r.getStore().getName() + "_" + r.getNativeName();
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

        //workspaces, stores, and resources
        File workspaces = resourceLoader.find( "workspaces" );
        if ( workspaces != null ) {
            //do a first quick scan over all workspaces, setting the default
            File dws = new File(workspaces, "default.xml");
            WorkspaceInfo defaultWorkspace = null;
            if (dws.exists()) {
                try {
                    defaultWorkspace = depersist(xp, dws, WorkspaceInfo.class);
                    LOGGER.info("Loaded default workspace " + defaultWorkspace.getName());
                }
                catch( Exception e ) {
                    LOGGER.log(Level.WARNING, "Failed to load default workspace", e);
                }
            }
            else {
                LOGGER.warning("No default workspace was found.");
            }
           
            for ( File wsd : list(workspaces, DirectoryFileFilter.INSTANCE ) ) {
                File f = new File( wsd, "workspace.xml");
                if ( !f.exists() ) {
                    continue;
                }
               
                WorkspaceInfo ws = null;
                try {
                    ws = depersist( xp, f, WorkspaceInfo.class );
                    catalog.add( ws );   
                }
                catch( Exception e ) {
                    LOGGER.log( Level.WARNING, "Failed to load workspace '" + wsd.getName() + "'" , e );
                    continue;
                }
               
                LOGGER.info( "Loaded workspace '" + ws.getName() +"'");
               
                //load the namespace
                File nsf = new File( wsd, "namespace.xml" );
                NamespaceInfo ns = null;
                if ( nsf.exists() ) {
                    try {
                        ns = depersist( xp, nsf, NamespaceInfo.class );
                        catalog.add( ns );
                    }
                    catch( Exception e ) {
                        LOGGER.log( Level.WARNING, "Failed to load namespace for '" + wsd.getName() + "'" , e );
                    }
                }
               
                //set the default workspace, this value might be null in the case of coming from a
                // 2.0.0 data directory. See http://jira.codehaus.org/browse/GEOS-3440
                if (defaultWorkspace != null ) {
                    if (ws.getName().equals(defaultWorkspace.getName())) {
                        catalog.setDefaultWorkspace(ws);
                        if (ns != null) {
                            catalog.setDefaultNamespace(ns);
                        }
                    }
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

        assertTrue(resources.contains(br));
        assertTrue(resources.contains(lr));
    }
   
    public void testCascadeWorkspace() {
        WorkspaceInfo ws = catalog.getWorkspaceByName(MockData.CITE_PREFIX);
        assertNotNull(ws);
        List<StoreInfo> stores = getCatalog().getStoresByWorkspace(ws, StoreInfo.class);
       
        ws.accept(visitor);
       
        assertTrue(stores.containsAll(visitor.getObjects(StoreInfo.class, ModificationType.DELETE)));
    }
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

        }
        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

Examples of org.geoserver.catalog.WorkspaceInfo

    }
   
    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

Examples of org.geoserver.catalog.WorkspaceInfo

    void validate(WorkspaceInfo workspace, boolean isNew) {
        if ( isNull(workspace.getName()) ) {
            throw new NullPointerException( "workspace name must not be null");
        }
       
        WorkspaceInfo existing = getWorkspaceByName( workspace.getName() );
        if ( existing != null && !existing.getId().equals( workspace.getId() ) ) {
            throw new IllegalArgumentException( "Workspace named '"+ workspace.getName() +"' already exists.");
        }
       
    }
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

            throw new IllegalArgumentException( "Cannot delete non-empty workspace.");
        }
       
        workspaces.remove( workspace.getName() );
       
        WorkspaceInfo defaultWorkspace = getDefaultWorkspace();
        if (workspace.equals(defaultWorkspace)) {
            workspaces.remove(null);
           
            //default removed, choose another workspace to become default
            if (!workspaces.isEmpty()) {
View Full Code Here

Examples of org.geoserver.catalog.WorkspaceInfo

        validate(workspace,false);
       
        ModificationProxy h =
            (ModificationProxy) Proxy.getInvocationHandler(workspace);
       
        WorkspaceInfo ws = (WorkspaceInfo) h.getProxyObject();
        if ( !workspace.getName().equals( ws.getName() ) ) {
            synchronized (workspaces) {
                workspaces.remove( ws.getName() );
                workspaces.put( workspace.getName(), ws );
            }
        }
       
        saved(workspace);
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.