Examples of GeoServerResourceLoader


Examples of org.geoserver.platform.GeoServerResourceLoader

    // initializes GeoServer Resource Loading (is needed by some tests to not produce exceptions)
   
      System.setProperty("org.geotools.referencing.forceXY", "true");
    File testdata=TestData.file(this, ".");
    System.setProperty("GEOSERVER_DATA_DIR", testdata.getAbsolutePath());
    GeoServerResourceLoader loader = new GeoServerResourceLoader(testdata);   
        GenericWebApplicationContext context = new GenericWebApplicationContext();
        context.getBeanFactory().registerSingleton("resourceLoader", loader);
        GeoserverDataDirectory.init(context);
   
        // initialized WGS84 CRS (used by many tests)
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

            if ( catalog.getStyleByName( name ) != null ) {
                throw new RestletException( "Style " + name + " already exists.", Status.CLIENT_ERROR_FORBIDDEN  );
            }
           
            //serialize the style out into the data directory
            GeoServerResourceLoader loader = catalog.getResourceLoader();
            File f;
            try {
                f = loader.find( "styles/" +  name + ".sld" );
            }
            catch (IOException e) {
                throw new RestletException( "Error looking up file", Status.SERVER_ERROR_INTERNAL, e );
            }
           
            if ( f != null ) {
                String msg = "SLD file " + name + ".sld already exists.";
                throw new RestletException( msg, Status.CLIENT_ERROR_FORBIDDEN);
            }
           
            //TODO: have the writing out of the style delegate to ResourcePool.writeStyle()
            try {
                f = loader.createFile( "styles/" + name + ".sld") ;
               
                //serialize the file to the styles directory
                BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream ( f ) );
               
                SLDFormat format = new SLDFormat(true);
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

        form.add(cancel);
    }

    private void logLevelsAppend(Form form, IModel loggingInfoModel) {
        // search for *LOGGING.properties files in the data directory
        GeoServerResourceLoader loader = GeoServerApplication.get().getBeanOfType(
                GeoServerResourceLoader.class);
        List<String> logProfiles = null;
        try {
            File logsDirectory = loader.find("logs");
            if(logsDirectory.exists() && logsDirectory.isDirectory()) {
                String[] propFiles = logsDirectory.list(new FilenameFilter() {
                   
                    public boolean accept(File dir, String name) {
                        return name.toLowerCase().endsWith("logging.properties");
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

   
    /**
     * Creates the data directory specifying the base directory.
     */
    public GeoServerDataDirectory( File baseDirectory ) {
        this( new GeoServerResourceLoader( baseDirectory ) );
    }
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

        if(Boolean.valueOf(relinquishLoggingControl)) {
            getLogger().info("RELINQUISH_LOG4J_CONTROL on, won't attempt to reconfigure LOG4J loggers");
        } else {
            try {
                File baseDir = new File(GeoserverDataDirectory.findGeoServerDataDir(context));
                GeoServerResourceLoader loader = new GeoServerResourceLoader(baseDir);
               
                File f= loader.find( "logging.xml" );
                if ( f != null ) {
                    XStreamPersister xp = new XStreamPersisterFactory().createXMLPersister();
                    BufferedInputStream in = new BufferedInputStream( new FileInputStream( f ) );
                    try {
                        LoggingInfo loginfo = xp.load(in,LoggingInfo.class);
                        LoggingUtils.initLogging(loader, loginfo.getLevel(), !loginfo.isStdOutLogging(),
                            loginfo.getLocation());
                    }
                    finally {
                        in.close();
                    }
                }
                else {
                    //check for old style data directory
                    f = loader.find( "services.xml" );
                    if ( f != null ) {
                        LegacyLoggingImporter loggingImporter = new LegacyLoggingImporter();
                        loggingImporter.imprt(baseDir);
                        LoggingUtils.initLogging(loader, loggingImporter.getConfigFileName(), loggingImporter
                                .getSuppressStdOutLogging(), loggingImporter.getLogFile());
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

            Logging.ALL.setLoggerFactory(Log4JLoggerFactory.getInstance());
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "Could not configure log4j logging redirection", e);
        }
        System.setProperty(LoggingUtils.RELINQUISH_LOG4J_CONTROL, "true");
        GeoServerResourceLoader loader = new GeoServerResourceLoader(testData.getDataDirectoryRoot());
        LoggingUtils.configureGeoServerLogging(loader, getClass().getResourceAsStream(getLogConfiguration()), false, true, null);

        //HACK: once we port tests to the new data directory, remove this
        GeoServerLoader.setLegacy( useLegacyDataDirectory() );
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

            when(catalogBuilder.catalog.getResourceLoader())
                .thenAnswer(new Answer<GeoServerResourceLoader>() {
                    @Override
                    public GeoServerResourceLoader answer(InvocationOnMock invocation) throws Throwable {
                        return new GeoServerResourceLoader(resourceStore);
                    }
                });

            this.paths = new ArrayList<String>();
        }
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

        temp = Files.createTempDirectory(null);
        work = temp.resolve("work");
        work.toFile().mkdirs();

        sourceDataDir = new GeoServerDataDirectory(catalog.getResourceLoader());
        exportDataDir = new GeoServerDataDirectory(new GeoServerResourceLoader(work.toFile()));
        //exportDataDir.setConfigFileExtension("json");

        // config serializer
        xsp = new XStreamPersisterFactory().createXMLPersister();
        xsp.setExcludeIds();
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

        MockGeoServer.get().catalog()
            .workspace("foo", "http://scratch.org", true).catalog()
            .workspace("bar", "http://bar.org", false).catalog()
            .geoServer().build(geoServer);

        GeoServerResourceLoader resourceLoader = mock(GeoServerResourceLoader.class);
        when(resourceLoader.get("workspaces/foo/workspace.xml")).thenAnswer(mockResource());
        when(resourceLoader.get("workspaces/bar/workspace.xml")).thenAnswer(mockResource());

        Catalog catalog = geoServer.getCatalog();
        when(catalog.getResourceLoader()).thenReturn(resourceLoader);

        MvcResult result = mvc.perform(get("/api/workspaces"))
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

            .workspace("foo", "http://scratch.org", true)
                .layer("foo").workspace().catalog()
            .workspace("bar", "http://bar.org", false).catalog()
            .geoServer().build(geoServer);

        GeoServerResourceLoader resourceLoader = mock(GeoServerResourceLoader.class);
        when(resourceLoader.get("workspaces/foo/workspace.xml")).thenAnswer(mockResource());
        when(resourceLoader.get("workspaces/bar/workspace.xml")).thenAnswer(mockResource());

        Catalog catalog = geoServer.getCatalog();
        when(catalog.getResourceLoader()).thenReturn(resourceLoader);

        MvcResult result = mvc.perform(get("/api/workspaces/foo"))
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.