Package org.geoserver.catalog

Examples of org.geoserver.catalog.ResourceInfo


            Envelope layerBbox = null;

            LOGGER.finer("Collecting summarized latlonbbox and common SRS...");

            for (LayerInfo layer : layers) {
                ResourceInfo resource = layer.getResource();
                layerBbox = resource.getLatLonBoundingBox();
                latlonBbox.expandToInclude(layerBbox);
            }

            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.fine("Summarized LatLonBBox is " + latlonBbox);
View Full Code Here


        if ( resource.getNamespace() == null ) {
            throw new IllegalArgumentException( "Resource must be part of a namespace");
        }
       
        StoreInfo store = resource.getStore();
        ResourceInfo existing = getResourceByStore( store, resource.getName(), ResourceInfo.class);
        if ( existing != null && !existing.getId().equals( resource.getId() ) ) {
            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 getResource(String id, Class<T> clazz) {
        List l = lookup(clazz, resources);
        for (Iterator i = l.iterator(); i.hasNext();) {
            ResourceInfo resource = (ResourceInfo) i.next();
            if (id.equals(resource.getId())) {
                return ModificationProxy.create((T) resource, clazz );
            }
        }

        return null;
View Full Code Here

        }

        List l = lookup(clazz, resources);
        if ( namespace != null ) {
            for (Iterator i = l.iterator(); i.hasNext();) {
                ResourceInfo resource = (ResourceInfo) i.next();
                if (name.equals(resource.getName())) {
                    NamespaceInfo namespace1 = resource.getNamespace();
                    if (namespace1 != null && namespace1.equals( namespace )) {
                            return ModificationProxy.create( (T) resource, clazz );
                    }
                }
            }
        }

        if ( ns == null ) {
            // no namespace was specified, so do an exhaustive lookup
            List matches = new ArrayList();
            for (Iterator i = l.iterator(); i.hasNext();) {
                ResourceInfo resource = (ResourceInfo) i.next();
                if (name.equals(resource.getName())) {
                    matches.add( resource );
                }
            }
           
            if ( matches.size() == 1 ) {
View Full Code Here

    public <T extends ResourceInfo> T getResourceByName(Name name, Class<T> clazz) {
        return getResourceByName( name.getNamespaceURI(), name.getLocalPart(), clazz );
    }
   
    public <T extends ResourceInfo> T getResourceByName( String name, Class<T> clazz ) {
        ResourceInfo resource;
       
        // check is the name is a fully qualified one
        int colon = name.indexOf( ':' );
        if ( colon != -1 ) {
            String ns = name.substring(0, colon);
View Full Code Here

        if ( namespace == null ) {
            namespace = getDefaultNamespace();
        }

        for (Iterator r = all.iterator(); r.hasNext();) {
            ResourceInfo resource = (ResourceInfo) r.next();
            if (namespace != null ) {
                if (namespace.equals(resource.getNamespace())) {
                    matches.add( resource );
                }
            }
            else if ( resource.getNamespace() == null ) {
                matches.add(resource);
            }
        }

        return ModificationProxy.createList( matches, clazz );
View Full Code Here

    public <T extends ResourceInfo> T getResourceByStore(StoreInfo store,
            String name, Class<T> clazz) {
        List all = lookup(clazz,resources);
        for (Iterator r = all.iterator(); r.hasNext(); ) {
            ResourceInfo resource = (ResourceInfo) r.next();
            if ( name.equals( resource.getName() ) && store.equals( resource.getStore() ) ) {
                return ModificationProxy.create((T)resource, clazz);
            }
               
        }
       
View Full Code Here

            StoreInfo store, Class<T> clazz) {
        List all = lookup(clazz,resources);
        List matches = new ArrayList();
       
        for (Iterator r = all.iterator(); r.hasNext();) {
            ResourceInfo resource = (ResourceInfo) r.next();
            if (store.equals(resource.getStore())) {
                matches.add(resource);
            }
        }

        return  ModificationProxy.createList( matches, clazz );
View Full Code Here

            prefix = name.substring( 0, colon );
            resource = name.substring( colon + 1 );
           
            for (Iterator l = layers.iterator(); l.hasNext();) {
                LayerInfo layer = (LayerInfo) l.next();
                ResourceInfo r = layer.getResource();
               
                if ( prefix.equals( r.getNamespace().getPrefix() ) && resource.equals( r.getName() ) ) {
                    return ModificationProxy.create( layer, LayerInfo.class );
                }
            }
        }
        else {
View Full Code Here

       
        // l = catalog.getLayerByName( "layerName");
        LayerInfo l = catalog.getLayerByName(ft.getName());
        assertTrue( l instanceof Proxy );
       
        ResourceInfo r = l.getResource();
        assertTrue( r instanceof Proxy );
       
        r.setName( "changed");
        catalog.save( l );
       
        // l = catalog.getLayerByName( "layerName");
        l = catalog.getLayerByName(ft.getName());
        assertEquals( "changed", l.getResource().getName() );
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.ResourceInfo

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.