Package org.geoserver.catalog

Examples of org.geoserver.catalog.NamespaceInfo


            String local = s.substring(i + 1);
           
            //first match the prefix back to a uri, since the prefix might not match the one
            // used by the catalog
            String namespaceURI = namespaceContext.getNamespaceURI(prefix);
            NamespaceInfo nsInfo = null;
            if (namespaceURI != null) {
                nsInfo = data.getNamespaceByURI(namespaceURI);
            }
            else {
                //fall back to just looking up by prefix
                nsInfo = data.getNamespaceByPrefix(prefix);
            }
           
            if (nsInfo != null) {
                return new QName(nsInfo.getURI(), local, nsInfo.getPrefix());
            }
           
            return new QName(namespaceURI, local, prefix);
        }
View Full Code Here


            if (template != null) {
                return template;
            }

            if (featureType != null) {
                NamespaceInfo nsInfo = null;
                if ( featureType.getName().getNamespaceURI() != null ) {
                    nsInfo = catalog.getNamespaceByURI(featureType.getName().getNamespaceURI());
                }
                // the feature type might not be registered, it may come from WMS feature portrayal, be a
                // remote one
                if(nsInfo != null) {
                    //try looking up the template in the default location for the particular namespaces
                    // under templates/<namespace>
                    template = (File) fileTemplateLoader.findTemplateSource(
                            "templates" + File.separator + nsInfo.getPrefix() + File.separator + path
                            );
                }
            }

            if (template != null) return template;
View Full Code Here

    private void doSaveStore(final CoverageStoreInfo info) {
        try {
            Catalog catalog = getCatalog();

            final String prefix = info.getWorkspace().getName();
            final NamespaceInfo namespace = catalog.getNamespaceByPrefix(prefix);

            List<CoverageInfo> alreadyConfigured;
            alreadyConfigured = catalog.getResourcesByStore(info, CoverageInfo.class);

            for (CoverageInfo coverage : alreadyConfigured) {
View Full Code Here

            String prefix = token.substring(0, i);
            String local = token.substring(i + 1);
           
            String uri = null;
            if(prefix != null && !"".equals(prefix)) {
                final NamespaceInfo namespace = catalog.getNamespaceByPrefix(prefix);
                if(namespace == null)
                    throw new WFSException("Unknown namespace [" + prefix + "]");
                uri = namespace.getURI();
            }

            return new QName(uri, local, prefix);
        } else {
            /*
 
View Full Code Here

    }

    public ResourceConfigurationPage(String workspaceName, String layerName) {
        LayerInfo layer;
        if(workspaceName != null) {
            NamespaceInfo ns = getCatalog().getNamespaceByPrefix(workspaceName);
            if(ns == null) {
                // unlikely to happen, requires someone making modifications on the workspaces
                // with a layer page open in another tab/window
                throw new RuntimeException("Could not find workspace " + workspaceName);
            }
            String nsURI = ns.getURI();
            layer = getCatalog().getLayerByName(new NameImpl(nsURI, layerName));
        } else {
            layer = getCatalog().getLayerByName(layerName);
        }
       
View Full Code Here

        protected String getFeatureTypeURL() throws IOException {
            GeoServer gs = mapContext.getRequest().getWMS().getGeoServer();
            Catalog catalog = gs.getCatalog();
            String nsUri = mapLayer.getFeatureSource().getSchema().getName().getNamespaceURI();
            NamespaceInfo ns = catalog.getNamespaceByURI(nsUri);
            String featureTypeName = mapLayer.getFeatureSource().getSchema()
                    .getName().getLocalPart();
            GetMapRequest request = mapContext.getRequest();

            return buildURL(baseURL(request.getHttpServletRequest()),
                    appendPath("rest", ns.getPrefix(), featureTypeName), null, URLType.SERVICE);
        }
View Full Code Here

            String msg = "Resource named '" + resource.getName() + "' already exists in store: '"
                    + store.getName() + "'";
            throw new IllegalArgumentException(msg);
        }

        NamespaceInfo namespace = resource.getNamespace();
        existing = getResourceByName(namespace, resource.getName(), ResourceInfo.class);
        if (existing != null && !existing.getId().equals(resource.getId())) {
            String msg = "Resource named '" + resource.getName()
                    + "' already exists in namespace: '" + namespace.getPrefix() + "'";
            throw new IllegalArgumentException(msg);
        }

    }
View Full Code Here

    }

    public <T extends ResourceInfo> T getResourceByName(String ns, String name, Class<T> clazz) {

        NamespaceInfo namespace = null;
        if ("".equals(ns)) {
            ns = null;
        }
        if (ns == null) {
            // if namespace was null, try the default namespace
            if (getDefaultNamespace() != null) {
                namespace = getDefaultNamespace();
            }
        } else {
            namespace = getNamespaceByPrefix(ns);
            if (namespace == null) {
                namespace = getNamespaceByURI(ns);
            }
        }

        if (namespace != null) {
            ResourceInfo resource = catalogDAO.getResourceByName(namespace.getName(), name, clazz);
            if (resource != null) {
                resolve(resource);
            // return ModificationProxy.create( (T) resource, clazz );
                return createProxy((T) resource, (Class<T>) mapResourceClass(resource));
            }
View Full Code Here

    public <T extends ResourceInfo> List<T> getResourcesByNamespace(String namespace, Class<T> clazz) {
        if (namespace == null) {
            return getResourcesByNamespace((NamespaceInfo) null, clazz);
        }

        NamespaceInfo ns = getNamespaceByPrefix(namespace);
        if (ns == null) {
            ns = getNamespaceByURI(namespace);
        }
        if (ns == null) {
            return Collections.EMPTY_LIST;
View Full Code Here

    }

    public LayerInfo getLayerByName(Name name) {
        if (name.getNamespaceURI() != null) {
            NamespaceInfo ns = getNamespaceByURI(name.getNamespaceURI());
            if (ns != null) {
                return getLayerByName(ns.getPrefix() + ":" + name.getLocalPart());
            }
        }

        return getLayerByName(name.getLocalPart());
    }
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.