Package org.geoserver.catalog

Examples of org.geoserver.catalog.CatalogFactory


        assertNull(catalog.getDefaultNamespace());
    }
   
    @Test
    public void testAutoCascadeDefaultNamespace() {
        CatalogFactory factory = catalog.getFactory();
        NamespaceInfo ns1 = factory.createNamespace();
        ns1.setPrefix("1");
        ns1.setURI("http://www.geoserver.org/1");
        NamespaceInfo ns2 = factory.createNamespace();
        ns2.setPrefix("2");
        ns2.setURI("http://www.geoserver.org/2");
        catalog.add(ns1);
        catalog.add(ns2);
        assertEquals(ns1, catalog.getDefaultNamespace());
View Full Code Here


    }

    @Test
    public void testGetLayerGroupByNameWithColon() {
        addLayer();
        CatalogFactory factory = catalog.getFactory();
        LayerGroupInfo lg = factory.createLayerGroup();

        String lgName = "MyFakeWorkspace:layerGroup";
        lg.setName(lgName);
        lg.setWorkspace(ws);
        lg.getLayers().add(l);
View Full Code Here

    @Test
    public void testGetLayerGroupByNameWithWorkspace() {
        addLayer();
       
        CatalogFactory factory = catalog.getFactory();
        LayerGroupInfo lg1 = factory.createLayerGroup();
        lg1.setName("lg");
        lg1.setWorkspace(ws);
        lg1.getLayers().add(l);
        lg1.getStyles().add(s);
        catalog.add(lg1);

        WorkspaceInfo ws2 = factory.createWorkspace();
        ws2.setName("ws2");
        catalog.add(ws2);

        NamespaceInfo ns2 = factory.createNamespace();
        //namespace prefix shall match workspace name, until we decide it cannot
        ns2.setPrefix("ns2");
        //ns2.setPrefix(ws2.getName());
        ns2.setURI("http://ns2");
        catalog.add(ns2);
       
        DataStoreInfo ds2 = factory.createDataStore();
        ds2.setEnabled(true);
        ds2.setName( "dsName");
        ds2.setDescription("dsDescription");
        ds2.setWorkspace( ws2 );
        catalog.add(ds2);
       
        FeatureTypeInfo ft2 = factory.createFeatureType();
        ft2.setEnabled(true);
        ft2.setName( "ftName" );
        ft2.setAbstract( "ftAbstract" );
        ft2.setDescription( "ftDescription" );
        ft2.setStore( ds2 );
        ft2.setNamespace( ns2 );
        catalog.add(ft2);

        StyleInfo s2 = factory.createStyle();
        s2.setName( "styleName" );
        s2.setFilename( "styleFilename" );
        s2.setWorkspace(ws2);
        catalog.add(s2);
       
        LayerInfo l2 = factory.createLayer();
        l2.setResource(ft2);
        l2.setEnabled(true);
        l2.setDefaultStyle(s2);
        catalog.add(l2);
       
View Full Code Here

    @Override
    protected void oneTimeSetUp() throws Exception {
        super.oneTimeSetUp();

        CatalogFactory cf = getCatalog().getFactory();
        CatalogBuilder cb = new CatalogBuilder(getCatalog());
        LayerGroupInfo gi = cf.createLayerGroup();
        gi.setName("testGroup");
        gi.getLayers().add(getCatalog().getLayerByName(MockData.BASIC_POLYGONS.getLocalPart()));
        gi.getStyles().add(getCatalog().getStyleByName("polygon"));
        cb.calculateLayerGroupBounds(gi);
        getCatalog().add(gi);
View Full Code Here

            super(ready, done);
            this.idx = idx;
        }

        protected void runInternal() throws Exception {
            CatalogFactory factory = catalog.getFactory();
            for (int i = 0; i < GET_LAYER_BY_ID_WITH_CONCURRENT_ADD_TEST_COUNT; i++) {
                // GR: Adding a new feature type info too, we can't really add multiple layers per
                // feature type yet. Setting the name of the layer changes the name of the resource,
                // then all previous layers for that resource get screwed
                String name = "LAYER-" + i + "-" + idx;
                FeatureTypeInfo resource = factory.createFeatureType();
                resource.setName(name);
                resource.setNamespace(ns);
                resource.setStore(ds);
                catalog.add(resource);
               
                LayerInfo layer = factory.createLayer();
                layer.setResource(resource);
                layer.setName(name);
                catalog.add(layer);
            }
        }
View Full Code Here

    public LayerInfo layer() throws IOException {
        return layer(json);
    }

    LayerInfo layer(JSONObject json) throws IOException {
        CatalogFactory f = importer.getCatalog().getFactory();

        if (json.has("layer")) {
            json = json.getJSONObject("layer");
        }

        //TODO: what about coverages?
        ResourceInfo r = f.createFeatureType();
        if (json.has("name")) {
            r.setName(json.getString("name"));
        }
        if (json.has("nativeName")) {
            r.setNativeName(json.getString("nativeName"));
        }
        if (json.has("srs")) {
            r.setSRS(json.getString("srs"));
            try {
                r.setNativeCRS(CRS.decode(json.getString("srs")));
            }
            catch(Exception e) {
                //should fail later
            }
           
        }
        if (json.has("bbox")) {
            r.setNativeBoundingBox(bbox(json.getJSONObject("bbox")));
        }
        if (json.has("title")) {
            r.setTitle(json.getString("title"));
        }
        if (json.has("abstract")) {
            r.setAbstract(json.getString("abstract"));
        }
        if (json.has("description")) {
            r.setDescription(json.getString("description"));
        }

        LayerInfo l = f.createLayer();
        l.setResource(r);
        //l.setName(); don't need to this, layer.name just forwards to name of underlying resource
       
        if (json.has("style")) {
            JSONObject sobj = new JSONObject();
View Full Code Here

    @Test
    public void testGroupLayerInWorkspace() {
        WorkspaceInfo workspace = catalog.getWorkspaceByName("sf");
        WorkspaceInfo workspace2 = catalog.getWorkspaceByName("cite");
        CatalogFactory factory = catalog.getFactory();
        LayerGroupInfo globalGroup = factory.createLayerGroup();
        globalGroup.setName("globalGroup");
        globalGroup.setWorkspace(workspace2);
        globalGroup.getLayers().add(catalog.getLayerByName("Lakes"));
        catalog.add(globalGroup);

        LayerGroupInfo localGroup = factory.createLayerGroup();
        localGroup.setName("localGroup");
        localGroup.setWorkspace(workspace);
        localGroup.getLayers().add(catalog.getLayerByName("GenericEntity"));
        catalog.add(localGroup);
        String localName = localGroup.prefixedName();
View Full Code Here

        List<LayerInfo> layers = catalog.getLayers();

        WorkspaceInfo sf = catalog.getWorkspaceByName("sf");
        WorkspaceInfo cite = catalog.getWorkspaceByName("cite");

        CatalogFactory factory = catalog.getFactory();
       
        DataStoreInfo citeStore = factory.createDataStore();
        citeStore.setEnabled(true);
        citeStore.setName("globalStore");
        citeStore.setWorkspace(cite);
        catalog.add(citeStore);
       
        FeatureTypeInfo citeFeatureType = factory.createFeatureType();
        citeFeatureType.setName("citeLayer");
        citeFeatureType.setStore(citeStore);
        citeFeatureType.setNamespace(catalog.getNamespaceByPrefix("cite"));
        catalog.add(citeFeatureType);
       
        LayerInfo citeLayer = factory.createLayer();
        citeLayer.setResource(citeFeatureType);
        citeLayer.setEnabled(true);
        //citeLayer.setName("citeLayer");
        catalog.add(citeLayer);

        assertNotNull(catalog.getLayerByName("citeLayer"));
        assertEquals("cite:citeLayer", catalog.getLayerByName("citeLayer").prefixedName());

        DataStoreInfo sfStore = factory.createDataStore();
        sfStore.setEnabled(true);
        sfStore.setName("localStore");
        sfStore.setWorkspace(sf);
        catalog.add(sfStore);
       
        FeatureTypeInfo sfFeatureType = factory.createFeatureType();
        sfFeatureType.setName("sfLayer");
        sfFeatureType.setStore(sfStore);
        sfFeatureType.setNamespace(catalog.getNamespaceByPrefix("sf"));
        catalog.add(sfFeatureType);

        LayerInfo sfLayer = factory.createLayer();
        sfLayer.setResource(sfFeatureType);
        sfLayer.setEnabled(true);
        //sfLayer.setName("sfLayer");
        catalog.add(sfLayer);
View Full Code Here

    }
   
    @Test
    public void testDataStore() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        WorkspaceInfo ws = cFactory.createWorkspace();
        ws.setName( "foo" );
       
        DataStoreInfo ds1 = cFactory.createDataStore();
        ds1.setName( "bar" );
        ds1.setWorkspace( ws );
       
        ByteArrayOutputStream out = out();
        persister.save( ds1 , out );
View Full Code Here

    }
   
    @Test
    public void testCoverageStore() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        WorkspaceInfo ws = cFactory.createWorkspace();
        ws.setName( "foo" );
       
        CoverageStoreInfo cs1 = cFactory.createCoverageStore();
        cs1.setName( "bar" );
        cs1.setWorkspace( ws );
       
        ByteArrayOutputStream out = out();
        persister.save( cs1 , out );
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.CatalogFactory

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.