Examples of CatalogFactory


Examples of org.geoserver.catalog.CatalogFactory

        assertEquals( "coverageStore", dom.getDocumentElement().getNodeName() );
    }
   
    public void testWMSStore() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        WorkspaceInfo ws = cFactory.createWorkspace();
        ws.setName( "foo" );
       
        WMSStoreInfo wms1 = cFactory.createWebMapServer();
        wms1.setName( "bar" );
        wms1.setWorkspace( ws );
        wms1.setCapabilitiesURL( "http://fake.host/wms?request=GetCapabilities&service=wms");
       
        ByteArrayOutputStream out = out();
View Full Code Here

Examples of org.geoserver.catalog.CatalogFactory

        assertEquals( "wmsStore", dom.getDocumentElement().getNodeName() );
    }
   
    public void testStyle() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        StyleInfo s1 = cFactory.createStyle();
        s1.setName( "foo" );
        s1.setFilename( "foo.sld" );
       
        ByteArrayOutputStream out = out();
        persister.save( s1, out );
View Full Code Here

Examples of org.geoserver.catalog.CatalogFactory

        assertEquals( "style", dom.getDocumentElement().getNodeName() );
    }
   
    public void testCatalog() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        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();
View Full Code Here

Examples of org.geoserver.catalog.CatalogFactory

        assertEquals( "style.sld", s.getFilename() );
    }
   
    public void testFeatureType() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        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 );
       
        FeatureTypeInfo ft = cFactory.createFeatureType();
        ft.setStore( ds );
        ft.setNamespace( ns );
        ft.setName( "ft" );
        ft.setAbstract( "abstract");
        ft.setSRS( "EPSG:4326");
View Full Code Here

Examples of org.geoserver.catalog.CatalogFactory

        assertTrue( CRS.equalsIgnoreMetadata( CRS.decode( "EPSG:4326"), ft.getNativeCRS() ) );
    }
   
    public void testWMSLayer() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        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 );
       
        WMSStoreInfo wms = cFactory.createWebMapServer();
        wms.setWorkspace( ws );
        wms.setName( "foo" );
        wms.setCapabilitiesURL( "http://fake.host/wms?request=getCapabilities");
        catalog.add( wms );
       
        WMSLayerInfo wl = cFactory.createWMSLayer();
        wl.setStore( wms );
        wl.setNamespace( ns );
        wl.setName( "wmsLayer" );
        wl.setAbstract( "abstract");
        wl.setSRS( "EPSG:4326");
View Full Code Here

Examples of org.geoserver.catalog.CatalogFactory

        assertEquals( "wmsLayer", dom.getDocumentElement().getNodeName() );
    }
   
    public void testLayer() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        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 );
       
        FeatureTypeInfo ft = cFactory.createFeatureType();
        ft.setStore( ds );
        ft.setNamespace( ns );
        ft.setName( "ft" );
        ft.setAbstract( "abstract");
        ft.setSRS( "EPSG:4326");
        ft.setNativeCRS( CRS.decode( "EPSG:4326") );
        catalog.add( ft );
       
        StyleInfo s = cFactory.createStyle();
        s.setName( "style" );
        s.setFilename( "style.sld" );
        catalog.add( s );
       
        LayerInfo l = cFactory.createLayer();
        // TODO: reinstate when layer/publish slipt is actually in place
        // l.setName( "layer" );
        l.setResource( ft );
        l.setDefaultStyle( s );
        catalog.add( l );
View Full Code Here

Examples of org.geoserver.catalog.CatalogFactory

       
    }
   
    public void testVirtualTable() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        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 );
       
        VirtualTable vt = new VirtualTable("riverReduced",
                "select a, b, c * %mulparam% \n from table \n where x > 1 %andparam%");
        vt.addGeometryMetadatata("geom", LineString.class, 4326);
        vt.setPrimaryKeyColumns(Arrays.asList("a", "b"));
        vt.addParameter(new VirtualTableParameter("mulparam", "1", new RegexpValidator("\\d+")));
        vt.addParameter(new VirtualTableParameter("andparam", null));
       
        FeatureTypeInfo ft = cFactory.createFeatureType();
        ft.setStore( ds );
        ft.setNamespace( ns );
        ft.setName( "ft" );
        ft.setAbstract( "abstract");
        ft.setSRS( "EPSG:4326");
View Full Code Here

Examples of org.geoserver.catalog.CatalogFactory

    protected StyleInfo s;
   
    protected void setUp() throws Exception {
        catalog = createCatalog();
      
        CatalogFactory factory = catalog.getFactory();
       
        ns = factory.createNamespace();
        ns.setPrefix( "nsPrefix" );
        ns.setURI( "nsURI" );
       
        ws = factory.createWorkspace();
        ws.setName( "wsName");
       
        ds = factory.createDataStore();
        ds.setEnabled(true);
        ds.setName( "dsName");
        ds.setDescription("dsDescription");
        ds.setWorkspace( ws );
       
        ft = factory.createFeatureType();
        ft.setEnabled(true);
        ft.setName( "ftName" );
        ft.setAbstract( "ftAbstract" );
        ft.setDescription( "ftDescription" );
        ft.setStore( ds );
        ft.setNamespace( ns );

        cs = factory.createCoverageStore();
        cs.setName("csName");
        cs.setType("fakeCoverageType");
        cs.setURL("file://fake");
       
        cv = factory.createCoverage();
        cv.setName("cvName");
        cv.setStore(cs);
       
        wms = factory.createWebMapServer();
        wms.setName("wmsName");
        wms.setType("WMS");
        wms.setCapabilitiesURL("http://fake.url");
        wms.setWorkspace(ws);
       
        wl = factory.createWMSLayer();
        wl.setEnabled(true);
        wl.setName("wmsLayer");
        wl.setStore(wms);
        wl.setNamespace(ns);
       
        s = factory.createStyle();
        s.setName( "styleName" );
        s.setFilename( "styleFilename" );
       
        l = factory.createLayer();
        l.setEnabled(true);
        l.setResource( ft );
        l.setDefaultStyle( s );
    }
View Full Code Here

Examples of org.geoserver.catalog.CatalogFactory

   
                    SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
                    cb.setupBounds(featureType, featureSource);
   
                    //add attributes
                    CatalogFactory factory = catalog.getFactory();
                    SimpleFeatureType schema = featureSource.getSchema();
                    for (AttributeDescriptor ad : schema.getAttributeDescriptors()) {
                        AttributeTypeInfo att = factory.createAttribute();
                        att.setName(ad.getLocalName());
                        att.setBinding(ad.getType().getBinding());
                        featureType.getAttributes().add(att);
                    }
   
View Full Code Here

Examples of org.geoserver.catalog.CatalogFactory

     * @param dir
     *                The root of the data directory.
     *
     */
    public void imprt(File dir) throws Exception {
        CatalogFactory factory = catalog.getFactory();

        // first off, import the main catalog so that namespaces, workspaces, styles,
        // datastores and coveragestores are read
        File catalogFile = new File(dir, "catalog.xml");
        if (!catalogFile.exists()) {
            throw new FileNotFoundException("Could not find catalog.xml under:"
                    + dir.getAbsolutePath());
        }
        importCatalog(catalogFile);
       
        // for each feature type file, load the info.xml into a FeatureTypeInfo
        File featureTypes = new File(dir, "featureTypes");
        if(!featureTypes.exists())
            featureTypes.mkdir();
        File[] featureTypeDirectories = featureTypes.listFiles();
        for (int i = 0; i < featureTypeDirectories.length; i++) {
            File featureTypeDirectory = featureTypeDirectories[i];
            if (!featureTypeDirectory.isDirectory() || featureTypeDirectory.isHidden() )
                continue;

            // load info.xml
            File ftInfoFile = new File(featureTypeDirectory, "info.xml");
            if (!ftInfoFile.exists()) {
                LOGGER.fine("No info.xml found in directory: '" + featureTypeDirectory.getName() "', ignoring");
                continue;
            }

            LegacyFeatureTypeInfoReader ftInfoReader = new LegacyFeatureTypeInfoReader();
            try {
                ftInfoReader.read(ftInfoFile);
                FeatureTypeInfo featureType = readFeatureType(ftInfoReader, featureTypeDirectory);
                if ( featureType == null ) {
                    continue;
                }
                catalog.add(featureType);
               
                LOGGER.info( "Loaded feature type '" + featureType.getPrefixedName() + "'" );
               
                // create a wms layer for the feature type
                LayerInfo layer = factory.createLayer();
                layer.setResource(featureType);
                layer.setName(featureType.getName());
                layer.setPath(ftInfoReader.wmsPath());
                if ( layer.getPath() == null ) {
                    layer.setPath( "/" );
                }
                layer.setType(LayerInfo.Type.VECTOR);
              
                String defaultStyleName = ftInfoReader.defaultStyle();
                if ( defaultStyleName != null ) {
                    StyleInfo style = catalog.getStyleByName(defaultStyleName);
                    if ( style != null ) {
                        layer.setDefaultStyle(style);
                    }
                }
                List<String> styles = ftInfoReader.styles();
                if(styles != null) {
                    for (String styleName : styles) {
                        StyleInfo style = catalog.getStyleByName(styleName);
                        if ( style != null ) {
                            layer.getStyles().add(style);
                        }
                    }
                }
               
                Map legendURL = ftInfoReader.legendURL();
                if( legendURL != null ) {
                    LegendInfo legend = factory.createLegend();
                    legend.setHeight( (Integer) legendURL.get( "height" ) );
                    legend.setWidth( (Integer) legendURL.get( "width" ) );
                    legend.setFormat( (String) legendURL.get( "format" ) );
                    legend.setOnlineResource( (String) legendURL.get( "onlineResource" ) );
                    layer.setLegend( legend );
                }
               
                layer.setEnabled(featureType.isEnabled());
                catalog.add(layer);
            } catch( Exception e ) {
                LOGGER.warning( "Error loadin '" + featureTypeDirectory.getName() + "/info.xml', ignoring" );
                LOGGER.log( Level.INFO, "", e );
                continue;
            }
        }
       
        // for each coverage definition in coverage, read it
        File coverages = new File(dir, "coverages");
        if(!coverages.exists())
            coverages.mkdir();
        File[] coverageDirectories = coverages.listFiles();
        for (int i = 0; i < coverageDirectories.length; i++) {
            File coverageDirectory = coverageDirectories[i];
            if (!coverageDirectory.isDirectory() || coverageDirectory.isHidden())
                continue;

            // load info.xml
            File cInfoFile = new File(coverageDirectory, "info.xml");
            if (!cInfoFile.exists()) {
                LOGGER.fine("No info.xml found in directory: '" + coverageDirectory.getName() "', ignoring");
                continue;
            }

            LegacyCoverageInfoReader cInfoReader = new LegacyCoverageInfoReader();
            try {
                cInfoReader.read(cInfoFile);
   
                CoverageInfo coverage = readCoverage(cInfoReader);
                if ( coverage == null ) {
                    continue;
                }
                catalog.add(coverage);
   
                // create a wms layer for the feature type
                LayerInfo layer = factory.createLayer();
                layer.setResource(coverage);
                layer.setName(coverage.getName());
                layer.setPath(cInfoReader.wmsPath());
                if ( layer.getPath() == null ) {
                    layer.setPath( "/" );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.