Package org.geoserver.platform.resource

Examples of org.geoserver.platform.resource.Resource


     * namespace.  An empty path will retrieve the directory itself.
     * @param ws The namespace
     * @return A {@link Resource}
     */
    public @Nonnull Resource get(NamespaceInfo ns, String... path) {
        Resource r = getWorkspaces(ns.getPrefix(), Paths.path(path));
        assert r!=null;
        return r;
    }
View Full Code Here


     * Retrieve the namespace configuration XML as a Resource
     * @param ns The namespace
     * @return A {@link Resource}
     */
    public @Nonnull Resource config(NamespaceInfo ns) {
        Resource r = get(ns, NAMESPACE_XML);
        assert r!=null;
        return r;
    }
View Full Code Here

     * retrieve the directory itself.
     * @param store The store
     * @return A {@link Resource}
     */
    public @Nonnull Resource get(StoreInfo store, String... path) {
        Resource r = get(store.getWorkspace(), store.getName(), Paths.path(path));
        assert r!=null;
        return r;
    }
View Full Code Here

public class InspireInitializer implements GeoServerInitializer {

    public void initialize(GeoServer geoServer) throws Exception {
        // copy over the schema
        GeoServerResourceLoader l = geoServer.getCatalog().getResourceLoader();
        Resource resource = l.get(Paths.path("www", "inspire", "inspire_vs.xsd"));
        File target = resource.file();
        l.copyFromClassPath("inspire_vs.xsd", target, InspireInitializer.class);
        Assert.isTrue(target.exists());
    }
View Full Code Here

     * Default constructor
     */
    public IpBlacklistFilter() {
        try {
            GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
            Resource resource = loader.get(PROPERTYFILENAME);
            configFile = new PropertyFileWatcher(resource);
            blackListedAddresses = reloadConfiguration(BLPROPERTY);
            whiteListedAddresses = reloadConfiguration(WLPROPERTY);
        } catch (Exception e) {
            LOGGER.log(Level.FINER, e.getMessage(), e);
View Full Code Here

            //handle the case of a store changing workspace
            if ( source instanceof StoreInfo ) {
                i = event.getPropertyNames().indexOf( "workspace");
                if ( i > -1 ) {
                    WorkspaceInfo newWorkspace = (WorkspaceInfo) event.getNewValues().get( i );
                    Resource oldDir = dd.get((StoreInfo) source );
                    moveResToDir(oldDir, dd.get(newWorkspace));
                }
            }
           
            //handle the case of a feature type changing store
            if ( source instanceof FeatureTypeInfo ) {
                i = event.getPropertyNames().indexOf( "store");
                if ( i > -1 ) {
                    StoreInfo newStore = (StoreInfo) event.getNewValues().get( i );
                    Resource oldDir = dd.get((FeatureTypeInfo) source);
                    Resource newDir = dd.get(newStore);
                    moveResToDir(oldDir, newDir);
                }
            }

            //handle the case of a style changing workspace
            if (source instanceof StyleInfo) {
                i = event.getPropertyNames().indexOf("workspace");
                if (i > -1) {
                    WorkspaceInfo newWorkspace = (WorkspaceInfo) event.getNewValues().get( i );
                    Resource newDir = dd.getStyles(newWorkspace);

                    //look for any resource files (image, etc...) and copy them over, don't move
                    // since they could be shared among other styles
                    for (Resource old : dd.additionalStyleResources((StyleInfo) source)) {
                        copyResToDir(old, newDir);
                    }

                    //move over the config file and the sld
                    for (Resource old : baseResources((StyleInfo)source)) {
                        moveResToDir(old, newDir);
                    }

                }
            }

            //handle the case of a layer group changing workspace
            if (source instanceof LayerGroupInfo) {
                i = event.getPropertyNames().indexOf("workspace");
                if (i > -1) {
                    final WorkspaceInfo newWorkspace = (WorkspaceInfo) event.getNewValues().get( i );
                    final Resource oldRes = dd.config((LayerGroupInfo)source);
                    final Resource newDir = dd.getLayerGroups(newWorkspace);
                    moveResToDir(oldRes, newDir);
                }
            }

            //handle default workspace
View Full Code Here

    }
   
    //workspaces
    private void addWorkspace( WorkspaceInfo ws ) throws IOException {
        LOGGER.fine( "Persisting workspace " + ws.getName() );
        Resource xml = dd.config(ws);
        ensureParent(xml);
        persist( ws, xml );
    }
View Full Code Here

        persist( ws, xml );
    }
   
    private void renameWorkspace( WorkspaceInfo ws, String newName ) throws IOException {
        LOGGER.fine( "Renaming workspace " + ws.getName() + "to " + newName );
        Resource directory = dd.get(ws);
        renameRes(directory, newName);
    }
View Full Code Here

        renameRes(directory, newName);
    }
   
    private void modifyWorkspace( WorkspaceInfo ws ) throws IOException {
        LOGGER.fine( "Persisting workspace " + ws.getName() );
        Resource r = dd.config(ws);
        persist( ws, r );
    }
View Full Code Here

        persist( ws, r );
    }
   
    private void removeWorkspace( WorkspaceInfo ws ) throws IOException {
        LOGGER.fine( "Removing workspace " + ws.getName() );
        Resource directory = dd.get(ws);
        rmRes(directory);
    }
View Full Code Here

TOP

Related Classes of org.geoserver.platform.resource.Resource

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.