Package org.geoserver.catalog

Examples of org.geoserver.catalog.NamespaceInfo


                Serializable value = (Serializable) entry.getValue();
               
                dataStore.getConnectionParameters().put(key,value);
            }
            //set the namespace parameter
            NamespaceInfo ns = catalog.getNamespaceByPrefix(dataStore.getWorkspace().getName());
            dataStore.getConnectionParameters().put( "namespace", ns.getURI());

            dataStore.setEnabled( (Boolean) map.get( "enabled") );
            catalog.add(dataStore);
           
            if ( dataStore.isEnabled() ) {
View Full Code Here


            Map.Entry entry = (Map.Entry) n.next();
            if (entry.getKey() == null || "".equals(entry.getKey())) {
                continue;
            }

            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);
            }
           
            LOGGER.info( "Loaded namespace '" + namespace.getPrefix() +
                "' (" + namespace.getURI() + ")");
        }
       
        if ( catalog.getDefaultNamespace() != null ) {
            LOGGER.info( "Default namespace: '" + catalog.getDefaultNamespace().getPrefix() + "'" );
        } else {
View Full Code Here

                    }
                }

                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

        return catalog.getLayers();
    }

    public String getNamespaceByPrefix(final String prefix) {
        Catalog catalog = getCatalog();
        NamespaceInfo namespaceInfo = catalog.getNamespaceByPrefix(prefix);
        return namespaceInfo == null ? null : namespaceInfo.getURI();
    }
View Full Code Here

        return global.getNumDecimals();
    }

    public String getNameSpacePrefix(final String nsUri) {
        Catalog catalog = getCatalog();
        NamespaceInfo ns = catalog.getNamespaceByURI(nsUri);
        return ns == null ? null : ns.getPrefix();
    }
View Full Code Here

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

        // Param[] parametersInfo = dsFact.getParametersInfo();
View Full Code Here

    public void testAddNamespace() {
        assertTrue( catalog.getNamespaces().isEmpty() );
        catalog.add( ns );
        assertEquals( 1, catalog.getNamespaces().size() );
       
        NamespaceInfo ns2 = catalog.getFactory().createNamespace();
       
        try {
            catalog.add( ns2 );
            fail( "adding without a prefix should throw exception");
        }
        catch( Exception e ) {
        }
       
        ns2.setPrefix( "ns2Prefix");
        try {
            catalog.add( ns2 );
            fail( "adding without a uri should throw exception");
        }
        catch( Exception e ) {
        }
       
        ns2.setURI( "bad uri");
        try {
            catalog.add( ns2 );
            fail( "adding an invalid uri should throw exception");
        }
        catch( Exception e ) {
        }
       
        ns2.setURI( "ns2URI");
       
        try {
            catalog.getNamespaces().add( ns2 );
            fail( "adding directly should throw an exception" );
        }
View Full Code Here

        assertTrue( catalog.getNamespaces().isEmpty() );
    }

    public void testGetNamespaceById() {
        catalog.add( ns );
        NamespaceInfo ns2 = catalog.getNamespace(ns.getId());
       
        assertNotNull(ns2);
        assertFalse( ns == ns2 );
        assertEquals( ns, ns2 );
    }
View Full Code Here

        assertEquals( ns, ns2 );
    }
   
    public void testGetNamespaceByPrefix() {
        catalog.add( ns );
        NamespaceInfo ns2 = catalog.getNamespaceByPrefix(ns.getPrefix());
       
        assertNotNull(ns2);
        assertFalse( ns == ns2 );
        assertEquals( ns, ns2 );
    }
View Full Code Here

        assertEquals( ns, ns2 );
    }
   
    public void testGetNamespaceByURI() {
        catalog.add( ns );
        NamespaceInfo ns2 = catalog.getNamespaceByURI(ns.getURI());
       
        assertNotNull(ns2);
        assertFalse( ns == ns2 );
        assertEquals( ns, ns2 );
    }
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.