Package org.geoserver.platform.resource

Examples of org.geoserver.platform.resource.Resource.file()


            if (config.getType() == Type.UNDEFINED) {
                InputStream conf = getClass().getResourceAsStream("default-config.yaml");
                IOUtils.copy(conf, config.file());
            }
            File qualifiedConfig = config.file();
            if (!qualifiedConfig.canRead()) {
                LOG.warning("Printing module missing its configuration.  Any actions it takes will fail.");
                return;
            }
            initParameters.setProperty("config", qualifiedConfig.getCanonicalPath());
View Full Code Here


   * @throws IOException if an error occurs while opening the user configuration file
   */
    private File getUserFile() throws ConfigurationException, IOException {
        GeoServerResourceLoader loader = geoServer.getCatalog().getResourceLoader();
        Resource user = loader.get("security/users.properties");
        File userFile = user.file(); // find or create
        if( userFile == null ){
            throw new ConfigurationException("Couldn't create users.properties");
        }
        return userFile;
    }
View Full Code Here

        if (cust_proj_file == null) {
            GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
            if( loader != null ){ // not available during construction SystemTestData - call CRS reset to fix
                Resource custom_proj = loader.get("user_projections/epsg.properties");
                if( custom_proj.getType() == Type.RESOURCE ){
                    cust_proj_file = custom_proj.file().getAbsolutePath();
                }
            }
        }
        if( cust_proj_file != null ){
            // Attempt to load user-defined projections
View Full Code Here

        if (cust_proj_file == null) {
            GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
            if( loader !=null ){ // Not available for SystemTestData
                Resource custom_proj = loader.get("user_projections/epsg_overrides.properties");
                if( custom_proj.getType() == Type.RESOURCE ){
                    cust_proj_file = custom_proj.file().getAbsolutePath();
                }
            }
        }
        // Attempt to load user-defined projections
        if( cust_proj_file != null ){
View Full Code Here

    protected URL getDefinitionsURL() {
        GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
        if( loader != null ){ // not available for SystemTestData
            Resource definition = loader.get("user_projections/" + FILENAME);
            if( definition.getType() == Type.RESOURCE ){
                File file = definition.file();
                URL url = DataUtilities.fileToURL(file);
                if( url != null ){
                    return url;
                }
                else {
View Full Code Here

            return null; // must be test case still loading
        }
        Resource gridfile = loader.get("user_projections/" + grid);

        if (gridfile.getType() == Type.RESOURCE ) {
            return DataUtilities.fileToURL(gridfile.file());
        } else {
            return null;
        }
    }
}
View Full Code Here

    public @Nonnull Style parsedStyle(final StyleInfo s) throws IOException {
        final Resource styleResource = style(s);
        if ( styleResource.getType() == Type.UNDEFINED ){
            throw new IOException( "No such resource: " + s.getFilename());
        }
        File input = styleResource.file();

        DefaultResourceLocator locator = new DefaultResourceLocator() {
           
            @Override
            public URL locateResource(String uri) {
View Full Code Here

                                + " exists and is an .svg file");
            }
        }
        try {
            if (xmlFile != null) {
                generator = GradientColorMapGenerator.getColorMapGenerator(xmlFile.file());
            } else {
                generator = GradientColorMapGenerator.getColorMapGenerator(colorMap);
            }
            return generator.generateColorMap(min, max);
        } catch (Exception e) {
View Full Code Here

    @Theory
    public void theoryHaveFile(String path) throws Exception {
        Resource res = getResource(path);
        assumeThat(res, resource());
       
        File result = res.file();
       
        assertThat(result, notNullValue());
    }
   
    @Theory
View Full Code Here

            ostream.close();
        }
       
        byte[] result=new byte[test.length];
       
        InputStream istream = new FileInputStream(res.file());
        try {
            istream.read(result);
            assertThat(istream.read(), is(-1));
        } finally {
            istream.close();
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.