Package org.geoserver.catalog

Examples of org.geoserver.catalog.Catalog


        assertEquals( "style", s.getName() );
        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" );
View Full Code Here


        form.setDefaultButton(submit);
        form.add(new BookmarkablePageLink("cancel", WorkspacePage.class));
    }

    private void saveWorkspace() {
        final Catalog catalog = getCatalog();

        NamespaceInfo namespaceInfo = (NamespaceInfo) nsModel.getObject();
        WorkspaceInfo workspaceInfo = (WorkspaceInfo) wsModel.getObject();
       
        // sync up workspace name with namespace prefix, temp measure until the two become separate
        namespaceInfo.setPrefix(workspaceInfo.getName());
       
        // this will ensure all datastore namespaces are updated when the workspace is modified
        catalog.save(workspaceInfo);
        catalog.save(namespaceInfo);
        if(defaultWs) {
            catalog.setDefaultWorkspace(workspaceInfo);
        }
        setResponsePage(WorkspacePage.class);
    }
View Full Code Here

*/
@SuppressWarnings("serial")
public class WorkspacesModel extends LoadableDetachableModel {
    @Override
    protected Object load() {
        Catalog catalog = GeoServerApplication.get().getCatalog();
        List<WorkspaceInfo> workspaces = new ArrayList<WorkspaceInfo>(catalog.getWorkspaces());
        Collections.sort(workspaces, new WorkspaceComparator());
        return workspaces;
    }
View Full Code Here

     *         contribution specific for the given storeInfo's type
     */
    private static DataStorePanelInfo findPanelInfo(final StoreInfo storeInfo,
            final GeoServerApplication app) {

        final Catalog catalog = storeInfo.getCatalog();
        final ResourcePool resourcePool = catalog.getResourcePool();

        Class<?> factoryClass = null;
        if (storeInfo instanceof DataStoreInfo) {
            DataAccessFactory storeFactory;
            try {
View Full Code Here

@SuppressWarnings("serial")
public class NamespacesModel extends LoadableDetachableModel {

    @Override
    protected Object load() {
        Catalog catalog = GeoServerApplication.get().getCatalog();
        List<NamespaceInfo> namespaces = new ArrayList<NamespaceInfo>(catalog.getNamespaces());
        Collections.sort(namespaces, new Comparator<NamespaceInfo>() {
            public int compare(NamespaceInfo o1, NamespaceInfo o2) {
                return o1.getPrefix().compareTo(o2.getPrefix());
            }
        });
View Full Code Here

       
        // the max number of rendering errors
        wms.setMaxRenderingErrors((Integer) props.get("maxRenderingErrors"));
       
        // base maps
        Catalog catalog = geoServer.getCatalog();
        // ... we need access to the actual catalog, not a filtered out view of the
        // layers accessible to the current user
        if(catalog instanceof Wrapper)
            catalog = ((Wrapper) catalog).unwrap(Catalog.class);
        CatalogFactory factory = catalog.getFactory();
       
        List<Map> baseMaps = (List<Map>) props.get( "BaseMapGroups");
        if ( baseMaps != null ) {
         O:  for ( Map baseMap : baseMaps ) {
                LayerGroupInfo bm = factory.createLayerGroup();
                bm.setName( (String) baseMap.get( "baseMapTitle" ) );
               
                //process base map layers
                List<String> layerNames = (List) baseMap.get( "baseMapLayers");
                for ( String layerName : layerNames ) {
                    ResourceInfo resource = null;
                    if ( layerName.contains( ":" ) ) {
                        String[] qname = layerName.split( ":" );
                        resource = catalog.getResourceByName( qname[0],qname[1], ResourceInfo.class );
                    }
                    else {
                        resource = catalog.getResourceByName( layerName, ResourceInfo.class );
                    }
                  
                    if ( resource == null ) {
                        LOGGER.warning("Ignoring layer group '" + bm.getName() +
                            "', resource '"+ layerName + "' does not exist" );
                        continue O;
                    }
               
                    List<LayerInfo> layers = catalog.getLayers(resource);
                    if ( layers.isEmpty() ) {
                        LOGGER.warning( "Ignoring layer group '" + bm.getName() +
                            "', no layer found for resource '" + layerName + "'");
                        continue O;
                    }
                   
                    bm.getLayers().add( layers.get( 0 ) );
                }
               
                //process base map styles
                List<String> styleNames = (List) baseMap.get( "baseMapStyles" );
                if ( styleNames.isEmpty() ) {
                    //use defaults
                    for ( LayerInfo l : bm.getLayers() ) {
                        bm.getStyles().add(null);
                    }
                }
                else {
                    for ( int i = 0; i < styleNames.size(); i++ ) {
                        String styleName = styleNames.get( i );
                        styleName = styleName.trim();
                       
                        StyleInfo style = null;
                        if ( "".equals( styleName ) ) {
                            style = null;
                        }
                        else {
                            style = catalog.getStyleByName( styleName );   
                        }
                        bm.getStyles().add( style );
                    }   
                }
                bm.getMetadata().put( "rawStyleList", (String)baseMap.get("rawBaseMapStyles"));
               
                //base map enveloper
                ReferencedEnvelope e = (ReferencedEnvelope) baseMap.get( "baseMapEnvelope");
                if ( e == null ) {
                    e = new ReferencedEnvelope();
                    e.setToNull();
                }
                bm.setBounds( e );
               
                LOGGER.info( "Processed layer group '" + bm.getName() + "'" );
                catalog.add( bm );
            }
        }
       
        wms.getVersions().add( new Version( "1.1.1" ) );
        return wms;
View Full Code Here

        WorkspaceInfo ws = getCatalog().getFactory().createWorkspace();
       
        form = new Form( "form", new CompoundPropertyModel( ws ) ) {
            @Override
            protected void onSubmit() {
                Catalog catalog = getCatalog();
               
                WorkspaceInfo ws = (WorkspaceInfo) form.getModelObject();
               
                NamespaceInfo ns = catalog.getFactory().createNamespace();
                ns.setPrefix ( ws.getName() );
                ns.setURI(nsUriTextField.getModelObjectAsString());
               
                catalog.add( ws );
                catalog.add( ns );
                if(defaultWs)
                    catalog.setDefaultWorkspace(ws);
               
                //TODO: set the response page to be the edit
                setResponsePage(WorkspacePage.class );
            }
        };
View Full Code Here

    public DefaultDataStoreEditPanel(final String componentId, final Form storeEditForm) {
        super(componentId, storeEditForm);

        final IModel model = storeEditForm.getModel();
        final DataStoreInfo info = (DataStoreInfo) model.getObject();
        final Catalog catalog = getCatalog();
        final ResourcePool resourcePool = catalog.getResourcePool();
        DataAccessFactory dsFactory;
        try {
            dsFactory = resourcePool.getDataStoreFactory(info);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        final Map<String, ParamInfo> paramsMetadata = new LinkedHashMap<String, ParamInfo>();

        {
            final boolean isNew = null == info.getId();
            final Param[] dsParams = dsFactory.getParametersInfo();
            for (Param p : dsParams) {
                ParamInfo paramInfo = new ParamInfo(p);
                paramsMetadata.put(p.key, paramInfo);

                if (isNew) {
                    // set default value
                    Serializable defValue;
                    if ("namespace".equals(paramInfo.getName())) {
                        defValue = catalog.getDefaultNamespace().getURI();
                    } else if (URL.class == paramInfo.getBinding()) {
                        defValue = "file:data/example.extension";
                    } else {
                        defValue = paramInfo.getValue();
                    }
View Full Code Here

    public static Test suite() {
        return new OneTimeTestSetup(new WFSXmlTest());
    }

    WFSConfiguration configuration() {
        Catalog catalog = getCatalog();
        FeatureTypeSchemaBuilder sb =
            new FeatureTypeSchemaBuilder.GML3(getGeoServer());
        return new WFSConfiguration(catalog,sb,new WFS(sb));
    }
View Full Code Here

                };
            }
           
            protected boolean onSubmit(AjaxRequestTarget target, Component contents) {
                // cascade delete the whole selection
                Catalog catalog = GeoServerApplication.get().getCatalog();
                CascadeDeleteVisitor visitor = new CascadeDeleteVisitor(catalog);
                for (CatalogInfo ci : selection) {
                    ci.accept(visitor);
                }
               
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.Catalog

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.