Package org.geoserver.catalog

Examples of org.geoserver.catalog.NamespaceInfo


        return getAttribute( "namespace") == null;
    }
   
    @Override
    protected String handleObjectPost(Object object) throws Exception {
        NamespaceInfo namespace = (NamespaceInfo) object;
        catalog.add( namespace );
       
        //JD: we need to keep namespace and workspace in sync, so create a worksapce
        // if one does not already exists, we can remove this once we get to a point
        // where namespace is just an attribute on a layer, and not a containing element
        if ( catalog.getWorkspaceByName( namespace.getPrefix() ) == null ) {
            WorkspaceInfo ws = catalog.getFactory().createWorkspace();
            ws.setName( namespace.getPrefix() );
            catalog.add( ws );
        }
       
        LOGGER.info( "POST namespace " + namespace );
        return namespace.getPrefix();
    }
View Full Code Here


        return getAttribute( "namespace") != null;
    }
   
    @Override
    protected void handleObjectPut(Object object) throws Exception {
        NamespaceInfo namespace = (NamespaceInfo) object;
        String ns = (String) getRequest().getAttributes().get( "namespace" );
       
        if ( "default".equals( ns ) ) {
            catalog.setDefaultNamespace( namespace );
        }
        else {
            NamespaceInfo original = catalog.getNamespaceByPrefix( ns );
            //ensure this is not a prefix change
            if ( namespace.getPrefix() != null && !namespace.getPrefix().equals( original.getPrefix() ) ) {
                throw new RestletException( "Can't change the prefix of a namespace.", Status.CLIENT_ERROR_FORBIDDEN );
            }

            new CatalogBuilder(catalog).updateNamespace( original, namespace );
            catalog.save( original );
View Full Code Here

    }
   
    @Override
    protected void handleObjectDelete() throws Exception {
        String namespace = (String) getRequest().getAttributes().get( "namespace");
        NamespaceInfo ns = catalog.getNamespaceByPrefix( namespace );
       
        if ( !catalog.getResourcesByNamespace(ns, ResourceInfo.class).isEmpty() ) {
            throw new RestletException( "Namespace not empty", Status.CLIENT_ERROR_UNAUTHORIZED );
        }
       
View Full Code Here

                    catalog.getCoverageByCoverageStore(catalog.getCoverageStoreByName(ws, cs), c) == null) {
                throw new RestletException( "No such coverage: "+ws+","+cs+","+c, Status.CLIENT_ERROR_NOT_FOUND );
            }
            else {
                //look up by workspace/namespace
                NamespaceInfo ns = catalog.getNamespaceByPrefix( ws );
                if ( ns == null || catalog.getCoverageByName( ns, c ) == null ) {
                    throw new RestletException( "No such coverage: "+ws+","+c, Status.CLIENT_ERROR_NOT_FOUND );
                }
           
            }
View Full Code Here

    }

    public void run() {
        DataAccess da = null;
        try {
            NamespaceInfo namespace = catalog.getNamespaceByPrefix(storeInfo.getWorkspace().getName());

            // prepare
            CatalogBuilder builder = new CatalogBuilder(catalog);
            da = storeInfo.getDataStore(null);
            StyleGenerator styles = new StyleGenerator(catalog);
View Full Code Here

        // "dataStoreForm:parameters:1:parameterPanel:border:paramValue";
        final String namespacePath = "dataStoreForm:parametersPanel:parameters:1:parameterPanel:paramValue";

        startPage();

        NamespaceInfo defaultNs = getCatalog().getDefaultNamespace();

        tester.assertModelValue(namespacePath, defaultNs.getURI());

    }
View Full Code Here

        Serializable directory = store.getConnectionParameters().get("directory");
        tester.assertModelValue(directoryParamPath, directory);

        WorkspaceInfo expectedWorkspace = catalog.getWorkspaceByName(MockData.CDF_PREFIX);
        NamespaceInfo expectedNamespace = catalog.getNamespaceByPrefix(MockData.CDF_PREFIX);

        // select the fifth item in the drop down, which is the cdf workspace
        formTester.select("workspacePanel:border:paramValue", 4);
        Component wsDropDown = tester.getComponentFromLastRenderedPage(wsDropdownPath);
        tester.executeAjaxEvent(wsDropDown, "onchange");

        // final String namespaceParamPath =
        // "dataStoreForm:parameters:1:parameterPanel:border:paramValue";

        // did the workspace change?
        tester.assertModelValue(wsDropdownPath, expectedWorkspace);
        // did the namespace change accordingly?
        // tester.assertModelValue(namespaceParamPath, expectedNamespace);
        tester.assertModelValue(namespaceParamPath, expectedNamespace.getURI());
        tester.assertModelValue(directoryParamPath, directory);

        // use clickLink to simulate hitting the save button instead of calling
        // formTester.submit(). Otherwise the save action is not called at all
        // print(tester.getLastRenderedPage(), true, true);
        final boolean isAjax = true;
        tester.clickLink("dataStoreForm:save", isAjax);

        // did the save finish normally?
        tester.assertRenderedPage(StorePage.class);

        // was the namespace datastore parameter updated?
        DataStoreInfo dataStore = catalog.getDataStore(store.getId());
        Serializable namespace = dataStore.getConnectionParameters().get("namespace");
        assertEquals(expectedNamespace.getURI(), namespace);

        // was the namespace for the datastore resources updated?
        List<FeatureTypeInfo> resourcesByStore = catalog.getResourcesByStore(dataStore,
                FeatureTypeInfo.class);
        for (FeatureTypeInfo ft : resourcesByStore) {
View Full Code Here

            String namespaceURI = featureType.getName().getNamespaceURI();
            FeatureTypeInfo meta = catalog.getFeatureTypeByName( namespaceURI, featureType.getTypeName() );
            if(meta == null)
                throw new WFSException("Could not find feature type " + namespaceURI + ":" + featureType.getTypeName() + " in the GeoServer catalog");

            NamespaceInfo ns = catalog.getNamespaceByURI( namespaceURI );
            ns2metas.put( ns, meta );
        }

        Collection<FeatureTypeInfo> featureTypes = ns2metas.values();
       
        //create the encoder
        ApplicationSchemaXSD xsd = new ApplicationSchemaXSD( null, catalog, gft.getBaseUrl(),
            org.geotools.wfs.v1_0.WFS.getInstance(), featureTypes );
        Configuration configuration = new ApplicationSchemaConfiguration( xsd, new org.geotools.wfs.v1_0.WFSConfiguration() );
       
        Encoder encoder = new Encoder(configuration);
        //encoder.setEncoding(wfs.getCharSet());
       
       encoder.setSchemaLocation(org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
               buildSchemaURL(gft.getBaseUrl(), "wfs/1.0.0/WFS-basic.xsd"));

        //declare application schema namespaces
        Map<String, String> params = params("service", "WFS", "version", "1.0.0", "request", "DescribeFeatureType");
        for (Iterator i = ns2metas.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();

            NamespaceInfo ns = (NamespaceInfo) entry.getKey();
            String namespaceURI = ns.getURI();
           
            Collection metas = (Collection) entry.getValue();

            StringBuffer typeNames = new StringBuffer();
View Full Code Here

            // it to be interpreted as being in the GeoServer's "default
            // namespace". Yet, the xml parser did its job and since TypeName is
            // of QName type, not having a ns prefix means it got parsed as a
            // QName in the default namespace. That is, in the wfs namespace.
            List hackedNames = new ArrayList(names.size());
            final NamespaceInfo defaultNameSpace = catalog.getDefaultNamespace();
            if (defaultNameSpace == null) {
                throw new IllegalStateException("No default namespace configured in GeoServer");
            }
            final String defaultNsUri = defaultNameSpace.getURI();
            for (Iterator it = names.iterator(); it.hasNext();) {
                QName name = (QName) it.next();
                String nsUri = name.getNamespaceURI();
                if (org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE.equals(nsUri)) {
                    // for this one we need to assign the default geoserver
View Full Code Here

       
        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 );
       
        FeatureTypeInfo ft = catalog.getFactory().createFeatureType();
        ft.setName( "foo" );
        ft.setNamespace( ns );
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.