Examples of GeoServerResourceLoader


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 (source instanceof String) {
            String path = (String) source;
           
            GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
            File f = loader.url(path);
            URL url = null;
            if (f!= null && f.exists()) {
                url = f.toURI().toURL();
            } else {
                url = new URL(path);
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

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

Examples of org.geoserver.platform.GeoServerResourceLoader

    /**
     * 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

Examples of org.geoserver.platform.GeoServerResourceLoader

    public void setInitParameters(Properties initParameters) {
        // find the config parameter and update it so it points to $GEOSERVER_DATA_DIR/printing/$CONFIG
        String configProp = initParameters.getProperty("config");

        try {
            GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
            String configPath = Paths.path("printing", Paths.convert(configProp));
            Resource config = loader.get(configPath);

            if (config.getType() == Type.UNDEFINED) {
                InputStream conf = getClass().getResourceAsStream("default-config.yaml");
                IOUtils.copy(conf, config.file());
            }
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

   * Find the file that should provide the user information.
   * @throws ConfigurationException if the user configuration file does not exist and cannot be created
   * @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

Examples of org.geoserver.platform.GeoServerResourceLoader

     * @return The URL, or {@code null} if none.
     */
    protected URL getDefinitionsURL() {
        String cust_proj_file = System.getProperty(SYSTEM_DEFAULT_USER_PROJ_FILE);
        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();
                }
            }
        }
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

     * @return The URL, or {@code null} if none.
     */
    protected URL getDefinitionsURL() {
        String cust_proj_file = System.getProperty(SYSTEM_DEFAULT_USER_PROJ_FILE);
        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();
                }
            }
        }
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

     * Returns the URL to the property file that contains Operation definitions from
     * $GEOSERVER_DATA_DIR/user_projections/{@value #FILENAME}
     * @return The URL, or {@code null} if none.
     */
    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;
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

    @Override
    public URL locateGrid(String grid) {
        if (grid == null)
            return null;
       
        GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
        if( loader == null ){
            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
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.