Package org.geoserver.catalog

Examples of org.geoserver.catalog.NamespaceInfo


            String namespace, Class<T> clazz) {
        if ( namespace == null ) {
            return getResourcesByNamespace((NamespaceInfo)null,clazz);
        }
       
        NamespaceInfo ns = getNamespaceByPrefix(namespace);
        if ( ns == null ) {
            ns = getNamespaceByURI(namespace);
        }
        if ( ns == null ) {
            return Collections.EMPTY_LIST;
View Full Code Here


    }
   
   
    public LayerInfo getLayerByName(Name name) {
        if ( name.getNamespaceURI() != null ) {
            NamespaceInfo ns = getNamespaceByURI( name.getNamespaceURI() );
            if ( ns != null ) {
                return getLayerByName( ns.getPrefix() + ":" + name.getLocalPart() );
            }
        }
       
        return getLayerByName( name.getLocalPart() );
    }
View Full Code Here

        return null;
    }

    public NamespaceInfo getNamespaceByPrefix(String prefix) {
        NamespaceInfo ns = namespaces.get( prefix );
        return ns != null ? ModificationProxy.create(ns, NamespaceInfo.class ) : null;
    }
View Full Code Here

    void validate(NamespaceInfo namespace, boolean isNew) {
        if ( isNull(namespace.getPrefix()) ) {
            throw new NullPointerException( "Namespace prefix must not be null");
        }
       
        NamespaceInfo existing = getNamespaceByPrefix( namespace.getPrefix() );
        if ( existing != null && !existing.getId().equals( namespace.getId() ) ) {
            throw new IllegalArgumentException( "Namespace with prefix '" + namespace.getPrefix() + "' already exists.");
        }
       
        existing = getNamespaceByURI( namespace.getURI() );
        if ( existing != null && !existing.getId().equals( namespace.getId() ) ) {
            throw new IllegalArgumentException( "Namespace with URI '" + namespace.getURI() + "' already exists.");
        }
   
        if ( isNull(namespace.getURI()) ) {
            throw new NullPointerException( "Namespace uri must not be null");
View Full Code Here

    public void remove(NamespaceInfo namespace) {
        if ( !getResourcesByNamespace(namespace, ResourceInfo.class ).isEmpty() ) {
            throw new IllegalArgumentException( "Unable to delete non-empty namespace.");
        }

        NamespaceInfo defaultNamespace = getDefaultNamespace();
        if (namespace.equals(defaultNamespace)) {
            namespaces.remove(null);
        }
       
        namespaces.remove(namespace.getPrefix());
View Full Code Here

        validate(namespace,false);
       
        ModificationProxy h =
            (ModificationProxy) Proxy.getInvocationHandler(namespace);
       
        NamespaceInfo ns = (NamespaceInfo) h.getProxyObject();
        if ( !namespace.getPrefix().equals( ns.getPrefix() ) ) {
            synchronized (namespaces) {
                namespaces.remove( ns.getPrefix() );
                namespaces.put( namespace.getPrefix(), ns );
            }
        }
       
        saved(namespace);
View Full Code Here

        return namespaces.containsKey(null) ?
                ModificationProxy.create(namespaces.get( null ),NamespaceInfo.class) : null;
    }

    public void setDefaultNamespace(NamespaceInfo defaultNamespace) {
        NamespaceInfo ns = namespaces.get( defaultNamespace.getPrefix() );
        if ( ns == null ) {
            throw new IllegalArgumentException( "No such namespace: '" + defaultNamespace.getPrefix() + "'" );
        }
       
        NamespaceInfo old = namespaces.get(null);
        namespaces.put( null, ns );
       
        //fire change event
        fireModified(this,
            Arrays.asList("defaultNamespace"), Arrays.asList(old), Arrays.asList(defaultNamespace));
View Full Code Here

       
        WorkspaceInfo ws = cFactory.createWorkspace();
        ws.setName( "foo" );
        catalog.add( ws );
       
        NamespaceInfo ns = cFactory.createNamespace();
        ns.setPrefix( "acme" );
        ns.setURI( "http://acme.org" );
        catalog.add( ns );
       
        DataStoreInfo ds = cFactory.createDataStore();
        ds.setWorkspace( ws );
        ds.setName( "foo" );
        catalog.add( ds );
       
        CoverageStoreInfo cs = cFactory.createCoverageStore();
        cs.setWorkspace( ws );
        cs.setName( "bar" );
        catalog.add( cs );
       
        StyleInfo s = cFactory.createStyle();
        s.setName( "style" );
        s.setFilename( "style.sld" );
        catalog.add(s);
    
        ByteArrayOutputStream out = out();
        persister.save( catalog, out );
       
        catalog = persister.load( in(out), Catalog.class );
        assertNotNull(catalog);
       
        assertEquals( 1, catalog.getWorkspaces().size() );
        assertNotNull( catalog.getDefaultWorkspace() );
        ws = catalog.getDefaultWorkspace();
        assertEquals( "foo", ws.getName() );
       
        assertEquals( 1, catalog.getNamespaces().size() );
        assertNotNull( catalog.getDefaultNamespace() );
        ns = catalog.getDefaultNamespace();
        assertEquals( "acme", ns.getPrefix() );
        assertEquals( "http://acme.org", ns.getURI() );
       
        assertEquals( 1, catalog.getDataStores().size() );
        ds = catalog.getDataStores().get( 0 );
        assertEquals( "foo", ds.getName() );
        assertNotNull( ds.getWorkspace() );
View Full Code Here

       
        WorkspaceInfo ws = cFactory.createWorkspace();
        ws.setName( "foo" );
        catalog.add( ws );
       
        NamespaceInfo ns = cFactory.createNamespace();
        ns.setPrefix( "acme" );
        ns.setURI( "http://acme.org" );
        catalog.add( ns );
       
        DataStoreInfo ds = cFactory.createDataStore();
        ds.setWorkspace( ws );
        ds.setName( "foo" );
View Full Code Here

       
        WorkspaceInfo ws = cFactory.createWorkspace();
        ws.setName( "foo" );
        catalog.add( ws );
       
        NamespaceInfo ns = cFactory.createNamespace();
        ns.setPrefix( "acme" );
        ns.setURI( "http://acme.org" );
        catalog.add( ns );
       
        DataStoreInfo ds = cFactory.createDataStore();
        ds.setWorkspace( ws );
        ds.setName( "foo" );
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.NamespaceInfo

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.