/** * Returns the root of the directory which contains security configuration files, if the * directory does exist it is created. * * <p>This directory is called 'security', and is located directly under {@link #root()} * * @deprecated As of GeoServer 2.6, replaced by @link {@link #getSecurity()} */ @Deprecated public File findOrCreateSecurityRoot() throws IOException { return getSecurity().dir(); // will create directory as needed }
/** * Returns the configuration file for the specified namespace, if the file does not exist a file * object is still returned. * * @deprecated As of GeoServer 2.6, replaced by {@link #get(WorkspaceInfo, String...)} */ @Deprecated public File findOrResolveNamespaceFile(WorkspaceInfo ws) throws IOException { Resource directory = get(ws); return directory.dir(); }
/** * Returns the root of the directory which contains spatial data files, if the directory does * not exist it will be created. * * <p>This directory is called 'data', and is located directly under {@link #root()} */ public File findOrCreateDataRoot() throws IOException { Resource directory = get("data"); return directory.dir(); // will create directory as needed }
/** * Returns the directory in which a resources configuration is persisted, if the directory does * not exist it will be created. * * @deprecated As of GeoServer 2.6, replaced by {@link #get(ResourceInfo, String...)} */ public File findOrCreateResourceDir(ResourceInfo r) throws IOException { Resource directory = get(r); return directory.dir(); }
/** * Role configuration root directory. * * @deprecated Use {@link #role()} */ public File getRoleRoot() throws IOException { return get("security/role").dir(); }
/** * User/group configuration root directory. * * @deprecated Use {@link #userGroup()} */ public File getUserGroupRoot() throws IOException { return get("security/usergroup").dir(); }
/** * Returns the directory for the specified workspace, if the directory does not exist it will be * created. * * @param create If set to true the directory will be created when it does not exist. * @deprecated As of GeoServer 2.6, replaced by {@link #get(WorkspaceInfo, String...)} */ @Deprecated public File findOrCreateWorkspaceDir(WorkspaceInfo ws) throws IOException { Resource directory = get(ws); return directory.dir(); }
/** * Authentication configuration root directory. * * @deprecated use {@link #auth()} */ public File getAuthRoot() throws IOException { return get("security/auth").dir(); }
/** * Master password provider root * * @deprecated Use {@link #masterPasswordProvider()} */ public File getMasterPasswordProviderRoot() throws IOException { return get("security/masterpw").dir(); }
/** * Returns the directory in which global styles are persisted, if the directory does not exist * it will be created. * * @deprecated As of GeoServer 2.6, replaced by {@link #get(StyleInfo, String...)} */ public File findOrCreateStyleDir() throws IOException { Resource styles = get(STYLE_DIR); return styles.dir(); }
/** * Security configuration root directory. * * @deprecated Use {@link #get(String)}} */ public File getSecurityRoot() throws IOException { return get("security").dir(); }
/** * Returns a directory under the {@link #root()} directory, if the directory does not exist it * will be created. * * @return directory (created if needed) */ public File findOrCreateDir(String... location) throws IOException { return get(Paths.path(location)).dir(); }
/** * Performs a directory lookup, creating the file if it does not exist. * * @param location The location of the directory to find or create. * @return The file handle. * @throws IOException If any i/o errors occur. */ public File findOrCreateDirectory(String location) throws IOException { Resource directory = get(Paths.convert(location)); return directory.dir(); // will create directory as needed }
/** * Performs a directory lookup, creating the file if it does not exist. * * @param location The components of the path that make up the location of the directory to find * or create. */ public File findOrCreateDirectory(String... location) throws IOException { Resource directory = get(Paths.path(location)); return directory.dir(); // will create directory as needed }
private void writeCurrentVersion() throws IOException { Resource security = security(); security.dir(); Resource properties = security.get(VERSION_PROPERTIES); Properties p = new Properties(); p.put(VERSION, CURR_VERSION.toString()); try (OutputStream os = properties.out()) { p.store( os, "Current version of the security directory. Do not remove or alter this file"); } }
/** * Returns a directory under the {@link #dataRoot()} directory, if the directory does not exist * it will be created. */ public File findOrCreateDataDir(String... location) throws IOException { Resource resource = get(Paths.path("data", Paths.path(location))); return resource.dir(); }
/** * Performs a directory lookup, creating the file if it does not exist. * * @param parentFile The containing directory, possibly null. * @param location The components of the path that make up the location of the directory to find * or create. */ public File findOrCreateDirectory(File parentFile, String... location) throws IOException { Resource directory = get(Paths.convert(getBaseDirectory(), parentFile, location)); return directory.dir(); // will create directory as needed }
/** * Performs a directory lookup, creating the file if it does not exist. * * @param parentFile The containing directory, may be null. * @param location The location of the directory to find or create. * @return The file handle. * @throws IOException If any i/o errors occur. */ public File findOrCreateDirectory(File parentFile, String location) throws IOException { Resource directory = get(Paths.convert(getBaseDirectory(), parentFile, location)); return directory.dir(); // will create directory as needed }
@Test public void testReloadWithRuinedCoverageStore() throws Exception { // ruin one coverage description File root = getDataDirectory().getRoot().dir(); File targetCoverage = new File(root, "workspaces/wcs/BlueMarble/coveragestore.xml"); FileUtils.writeStringToFile(targetCoverage, "boom!"); // reload and check it does not go belly up getGeoServer().reload(); // check the coverage in question is no more getCatalog().getCoverageByName(getLayerId(MockData.TASMANIA_BM)); } }
@Test public void testGetParamsFixesDatabaseFilePath() { Catalog catalog = getCatalog(); ResourcePool pool = new ResourcePool(catalog); DataStoreInfo ds = getCatalog().getFactory().createDataStore(); ds.getConnectionParameters().put("database", "file:data/test.gpkg"); Map newParams = pool.getParams(ds.getConnectionParameters(), getResourceLoader()); GeoServerDataDirectory dataDir = new GeoServerDataDirectory(getResourceLoader()); String absolutePath = dataDir.get("data/test.gpkg").dir().getAbsolutePath(); assertNotEquals(newParams.get("database"), "file:data/test.gpkg"); assertTrue(((String) newParams.get("database")).contains(absolutePath)); }