Package org.geoserver.catalog

Examples of org.geoserver.catalog.NamespaceInfo


       
        File d = new File( testData.getDataDirectoryRoot(),
            "workspaces/acme/foostore/foo");
        assertFalse( d.exists() );
       
        NamespaceInfo ns = catalog.getFactory().createNamespace();
        ns.setPrefix( "bar" );
        ns.setURI( "http://bar" );
        catalog.add( ns );
       
        CoverageInfo ft = catalog.getFactory().createCoverage();
        ft.setName( "foo" );
        ft.setNamespace( ns );
View Full Code Here


               
                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 );
                    }
View Full Code Here

       
        NodeList links = xp.getMatchingNodes("//html:a", dom );
        assertEquals( namespaces.size(), links.getLength() );
       
        for ( int i = 0; i < namespaces.size(); i++ ){
            NamespaceInfo ws = namespaces.get( i );
            Element link = (Element) links.item( i );
           
            assertTrue( link.getAttribute("href").endsWith( ws.getPrefix() + ".html") );
        }
    }
View Full Code Here

        MockHttpServletResponse response = postAsServletResponse( "/rest/namespaces", xml, "text/xml" );
        assertEquals( 201, response.getStatusCode() );
        assertNotNull( response.getHeader( "Location") );
        assertTrue( response.getHeader("Location").endsWith( "/namespaces/foo" ) );
       
        NamespaceInfo ws = getCatalog().getNamespaceByPrefix( "foo" );
        assertNotNull(ws);
    }
View Full Code Here

        assertEquals( 201, response.getStatusCode() );
        assertNotNull( response.getHeader( "Location") );
        assertTrue( response.getHeader("Location").endsWith( "/namespaces/foo" ) );
       
       
        NamespaceInfo ws = getCatalog().getNamespaceByPrefix( "foo" );
        assertNotNull(ws);
    }
View Full Code Here

        assertEquals( 1, dom.getElementsByTagName( "prefix" ).getLength() );
        assertEquals( 1, dom.getElementsByTagName( "uri" ).getLength() );
    }
   
    public void testPutDefaultNamespace() throws Exception {
        NamespaceInfo def = getCatalog().getDefaultNamespace();
        assertEquals( "gs", def.getPrefix() );
       
        String json = "{'namespace':{ 'prefix':'sf' }}";
        put( "/rest/namespaces/default", json, "text/json");
       
        def = getCatalog().getDefaultNamespace();
        assertEquals( "sf", def.getPrefix() );
    }
View Full Code Here

       
        if ( this.ns == null ) {
            //ns set to null, if all given types are from the same namespace, us that one
            if ( !types.isEmpty() ) {
                Iterator<FeatureTypeInfo> i = types.iterator();
                NamespaceInfo namespace = i.next().getNamespace();
                while( i.hasNext() ) {
                    FeatureTypeInfo type = i.next();
                    if ( !namespace.equals( type.getNamespace() ) ) {
                        namespace = null;
                        break;
                    }
                }
               
View Full Code Here

        if ( existing != null && !existing.getId().equals( resource.getId() ) ) {
            String msg = "Resource named '"+resource.getName()+"' already exists in store: '"+ store.getName()+"'";
            throw new IllegalArgumentException( msg );
        }
       
        NamespaceInfo namespace = resource.getNamespace();
        existing =  getResourceByName( namespace, resource.getName(), ResourceInfo.class);
        if ( existing != null && !existing.getId().equals( resource.getId() ) ) {
            String msg = "Resource named '"+resource.getName()+"' already exists in namespace: '"+ namespace.getPrefix()+"'";
            throw new IllegalArgumentException( msg );
        }
       
    }
View Full Code Here

        return null;
    }

    public <T extends ResourceInfo> T getResourceByName(String ns, String name, Class<T> clazz) {

        NamespaceInfo namespace = null;
        if ("".equals( ns ) ) {
            ns = null;
        }
        if ( ns == null ) {
            //if namespace was null, try the default namespace
            if ( getDefaultNamespace() != null ) {
                namespace = getDefaultNamespace();
            }
        }
        else {
            namespace = getNamespaceByPrefix( ns );
            if ( namespace == null ) {
                namespace = getNamespaceByURI( ns );
            }
        }

        List l = lookup(clazz, resources);
        if ( namespace != null ) {
            for (Iterator i = l.iterator(); i.hasNext();) {
                ResourceInfo resource = (ResourceInfo) i.next();
                if (name.equals(resource.getName())) {
                    NamespaceInfo namespace1 = resource.getNamespace();
                    if (namespace1 != null && namespace1.equals( namespace )) {
                            return ModificationProxy.create( (T) resource, clazz );
                    }
                }
            }
        }
View Full Code Here

        String name = featureType.getTypeName();
        String namespace = featureType.getName().getNamespaceURI();
        FeatureTypeInfo ftInfo = null;
        Catalog data = getCatalog();
        if(namespace != null) {
            NamespaceInfo nsInfo = data.getNamespaceByURI(namespace);
            if(nsInfo != null)
                ftInfo = data.getFeatureTypeByName( nsInfo.getPrefix(), name);
        }
        if(ftInfo == null)
            ftInfo = data.getFeatureTypeByName(name);
        if(ftInfo == null)
            return null;
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.