Package org.geoserver.config

Examples of org.geoserver.config.GeoServerDataDirectory


    /**
     * Retrieves the GeoServer data directory
     * @return
     */
    private String getDataDirectory() {
        GeoServerDataDirectory dd = getGeoServerApplication().getBeanOfType(GeoServerDataDirectory.class);
        return dd.root().getAbsolutePath();
    }
View Full Code Here


       
        // enable disk quota in H2 mode
        quota.setEnabled(true);
        quota.setQuotaStore("H2");
        gwc.saveDiskQuotaConfig(quota, null);
        GeoServerDataDirectory dd = GeoServerExtensions.bean(GeoServerDataDirectory.class);
        File jdbcConfigFile = dd.findFile("gwc/geowebcache-diskquota-jdbc.xml");
        assertNull("jdbc config should not be there", jdbcConfigFile);
        File h2DefaultStore = dd.findFile("gwc/diskquota_page_store_h2");
        assertNotNull("jdbc store should be there", h2DefaultStore);
        assertTrue(getActualStore(provider) instanceof JDBCQuotaStore);
       
        // disable again and clean up
        quota.setEnabled(false);
        gwc.saveDiskQuotaConfig(quota, null);
        FileUtils.deleteDirectory(h2DefaultStore);
       
        // now enable it in JDBC mode, with H2 local storage
        quota.setEnabled(true);
        quota.setQuotaStore("JDBC");
        jdbc = new JDBCConfiguration();
        jdbc.setDialect("H2");
        ConnectionPoolConfiguration pool = new ConnectionPoolConfiguration();
        pool.setDriver("org.h2.Driver");
        pool.setUrl("jdbc:h2:./target/quota-h2");
        pool.setUsername("sa");
        pool.setPassword("");
        pool.setMinConnections(1);
        pool.setMaxConnections(1);
        pool.setMaxOpenPreparedStatements(50);
        jdbc.setConnectionPool(pool);
        gwc.saveDiskQuotaConfig(quota, jdbc);
        jdbcConfigFile = dd.findFile("gwc/geowebcache-diskquota-jdbc.xml");
        assertNotNull("jdbc config should be there", jdbcConfigFile);
        assertNull("jdbc store should be there", dd.findDataFile("gwc/diskquota_page_store_h2"));
        File newQuotaStore = new File("./target/quota-h2.data.db");
        assertTrue(newQuotaStore.exists());
       
        FileInputStream fis = null;
        try {
View Full Code Here

     * @param name The name of the style.
     * @param filename The filename to copy from classpath.
     * @param scope Class from which to load sld resource from.
     */
    public void addStyle(WorkspaceInfo ws, String name, String filename, Class scope, Catalog catalog) throws IOException {
        GeoServerDataDirectory dd = new GeoServerDataDirectory(catalog.getResourceLoader());
        File styles;
        if(ws==null) {
            styles=dd.findOrCreateStyleDir();
        } else {
            styles = new File(dd.findOrCreateWorkspaceDir(ws), "styles");
            styles.mkdir();
        }
        String target = new File( filename ).getName();
       
        catalog.getResourceLoader().copyFromClassPath(filename, new File(styles, target ), scope);
View Full Code Here

        }
        logFile = new File(location);
       
        if (!logFile.isAbsolute()) {
            // locate the geoserver.log file
            GeoServerDataDirectory dd = getGeoServerApplication().getBeanOfType(
                    GeoServerDataDirectory.class);
            logFile = new File(dd.root(), logFile.getPath());
        }
       
        if (!logFile.exists()) {
            error("Could not find the GeoServer log file: " + logFile.getAbsolutePath());
        }
View Full Code Here

    //
    // lookup/accessor helper methods
    //

    protected GeoServerDataDirectory getDataDirectory() {
        return new GeoServerDataDirectory(getResourceLoader());
    }
View Full Code Here

    private GeoServerBasicAuthenticationFilter createAuthenticationFilter() {
        GeoServerBasicAuthenticationFilter authenticationFilter = new GeoServerBasicAuthenticationFilter();
        GeoServerSecurityManager sm = null;
        try {
            sm = new GeoServerSecurityManager(new GeoServerDataDirectory(new File("target")));
            authenticationFilter.setSecurityManager(sm);
            BasicAuthenticationFilterConfig config = new BasicAuthenticationFilterConfig();
            authenticationFilter.initializeFromConfig(config);
        } catch (Exception e) {
            throw new RuntimeException("Failed to initialize authentication authenticationFilter.");
View Full Code Here

    protected GeoServerResourceLoader getResourceLoader() {
        return (GeoServerResourceLoader) applicationContext.getBean( "resourceLoader" );
    }
   
    protected GeoServerDataDirectory getDataDirectory() {
        return new GeoServerDataDirectory(getResourceLoader());
    }
View Full Code Here

  static StyleFactory styleFactory = CommonFactoryFinder
      .getStyleFactory(null);
  private GeoServerDataDirectory dataDir;

  public Styles3D(Catalog catalog) {
    this.dataDir = new GeoServerDataDirectory(catalog.getResourceLoader());
  }
View Full Code Here

        File dir = File.createTempFile("data", "tmp", new File("target"));
        dir.delete();
        dir.mkdirs();

        scriptMgr = new ScriptManager(new GeoServerDataDirectory(dir));
    }
View Full Code Here

            protected ResourceState getResourceState() {
                return new ResourceState() {

                    @Override
                    public byte[] getData() {
                        GeoServerDataDirectory dd = GeoServerExtensions.bean(GeoServerDataDirectory.class, getGeoServerApplication().getApplicationContext());
                        StyleInfo si = new StyleInfoImpl(getCatalog());
                        String styleName = "tmp" + UUID.randomUUID().toString();
                        String styleFileName =  styleName + ".sld";
                        si.setFilename(styleFileName);
                        si.setName(styleName);
                        si.setWorkspace(wsChoice.getModel().getObject());
                        File styleFile = null;
                        try {
                            styleFile = dd.findOrCreateStyleSldFile(si);
                            FileUtils.writeStringToFile(styleFile, lastStyle);
                            StyledLayerDescriptor sld = styleHandler().parse(styleFile, null, null, null);
                            if (sld != null && sld.getStyledLayers().length > 0) {
                                Style style = null;
                                StyledLayer sl = sld.getStyledLayers()[0];
View Full Code Here

TOP

Related Classes of org.geoserver.config.GeoServerDataDirectory

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.