Package org.geoserver.catalog

Examples of org.geoserver.catalog.ResourceInfo


            }
        }

        // layers.add(layer);
        LayerInfo unwrapped = unwrap(layer);
        ResourceInfo resource = unwrapped.getResource();
        if (resource != null) {
            resource = unwrap(resource);
            unwrapped.setResource(resource);
        }
View Full Code Here


        assertTrue(caughtException);
       
        // 5) Introducing new LayerInfo
        LayerInfo layerInfo = cat.getFactory().createLayer();
        layerInfo.setName("hithere");
        ResourceInfo resInfo = li.getResource();
        resInfo.setName("hithere");
        resInfo.getNamespace().setPrefix("sf");
        layerInfo.setResource(resInfo);
       
        cat.add(layerInfo);
        TileLayer tl3 = tld.getTileLayer("sf:hithere");
        assertEquals(tl3.getName(),"sf:hithere");
View Full Code Here

    }

    private String findTitle(MapLayer layer, Catalog catalog) {
        String[] nameparts = layer.getTitle().split(":");

        ResourceInfo resource = nameparts.length > 1
            ? catalog.getResourceByName(nameparts[0], nameparts[1], ResourceInfo.class)
            : catalog.getResourceByName(nameparts[0], ResourceInfo.class);

        return resource != null
            ? resource.getTitle()
            : layer.getTitle();
    }
View Full Code Here

        // FIXME we are replacing some referenced object here because hib would recognized original
        // ones as unattached.
        if (entity.getResource().getId() != null) {
            Query query = buildQuery("from ", entity.getResource().getClass(), " where id = ",
                    param(entity.getResource().getId()));
            ResourceInfo ri = (ResourceInfo) first(query);
            entity.setResource(ri);
        }

        // FIXME we are replacing some referenced object here because hib would recognized original
        // ones as unattached.
View Full Code Here

                    HierarchicalStreamWriter writer, MarshallingContext context) {
                if ( obj instanceof StyleInfo ) {
                    encodeLink( "/styles/" + ((StyleInfo)obj).getName(), writer);   
                }
                if ( obj instanceof ResourceInfo ) {
                    ResourceInfo r = (ResourceInfo) obj;
                    StringBuffer link = new StringBuffer( "/workspaces/" ).
                        append( r.getStore().getWorkspace().getName() ).append( "/" );
                    if ( r instanceof FeatureTypeInfo ) {
                        link.append( "datastores/").append( r.getStore().getName() )
                            .append( "/featuretypes/");
                    }
                    else if ( r instanceof CoverageInfo ) {
                        link.append( "coveragestores/").append( r.getStore().getName() )
                        .append( "/coverages/");
                    }
                    else {
                        return;
                    }
                   
                    link.append( r.getName() );
                    encodeLink(link.toString(), writer);
                }
            }
        });
       
View Full Code Here

    private void checkUserAccessFlat(DataAccessManager manager, Authentication user, boolean expectedRead, boolean expectedWrite) {
        // states as a layer
        assertEquals(expectedRead, manager.canAccess(user, statesLayer, AccessMode.READ));
        assertEquals(expectedWrite, manager.canAccess(user, statesLayer, AccessMode.WRITE));
        // states as a resource
        final ResourceInfo resource = statesLayer.getResource();
        assertEquals(expectedRead, manager.canAccess(user, resource, AccessMode.READ));
        assertEquals(expectedWrite, manager.canAccess(user, resource, AccessMode.WRITE));
        // the topp ws
        assertEquals(expectedRead, manager.canAccess(user, toppWs, AccessMode.READ));
        assertEquals(expectedWrite, manager.canAccess(user, toppWs, AccessMode.WRITE));
View Full Code Here

            super(clazz);
        }
       
        public Object doUnmarshal(Object result,
                HierarchicalStreamReader reader, UnmarshallingContext context) {
            ResourceInfo obj = (ResourceInfo) super.doUnmarshal(result, reader, context);
           
            String enabled = obj.isEnabled() ? "enabled" : "disabled";
            String type = obj instanceof CoverageInfo ? "coverage" :
                obj instanceof FeatureTypeInfo ? "feature type" : "resource";
           
            LOGGER.info( "Loaded " + type + " '" + obj.getName() + "', " + enabled );
           
            return obj;
        }
View Full Code Here

            expect((DataStore)((DataStoreInfo) store).getDataStore(null)).andReturn(dstore);
        }
        expect(store.getWorkspace()).andReturn(ws).anyTimes();
        replay(store);

        ResourceInfo resource = createNiceMock(resourceClass);
        expect(resource.getStore()).andReturn(store).anyTimes();
        expect(resource.getName()).andReturn(name).anyTimes();
        if (resource instanceof FeatureTypeInfo) {
            expect(
                    ((FeatureTypeInfo) resource).getFeatureSource((ProgressListener) anyObject(),
                            (Hints) anyObject())).andReturn(fs).anyTimes();
        }
View Full Code Here

        String citeStore = MockData.CITE_PREFIX;
        StoreInfo store = catalog.getStoreByName(citeStore, StoreInfo.class);
        String buildings = getLayerId(MockData.BUILDINGS);
        String lakes = getLayerId(MockData.LAKES);
        LayerInfo bl = catalog.getLayerByName(buildings);
        ResourceInfo br = catalog.getResourceByName(buildings, ResourceInfo.class);
        LayerInfo ll = catalog.getLayerByName(lakes);
        ResourceInfo lr = catalog.getResourceByName(lakes, ResourceInfo.class);
       
        store.accept(visitor);
       
        assertEquals(store, visitor.getObjects(StoreInfo.class, ModificationType.DELETE).get(0));
        List<LayerInfo> layers = visitor.getObjects(LayerInfo.class, ModificationType.DELETE);
View Full Code Here

        List<ResourceInfo> resources = catalog.getResourcesByNamespace("sf",ResourceInfo.class);
        NodeList listItems = xp.getMatchingNodes("//html:li", dom );
        assertEquals( resources.size(), listItems.getLength() );
       
        for ( int i = 0; i < resources.size(); i++ ){
            ResourceInfo resource = resources.get( i );
            Element listItem = (Element) listItems.item( i );
           
            assertTrue( listItem.getFirstChild().getNodeValue().endsWith( resource.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.