/** * Locates and returns the property file, or returns null otherwise (e.g., the parent folder is * not there, or permission issues) * * @return * @throws ConfigurationException */ private File getPropertyFile() throws ConfigurationException { File securityDir = GeoserverDataDirectory.findCreateConfigDir("security"); if (securityDir != null) { return new File(securityDir, AUTHKEYS_FILE); } else { return null; } }
/** * This function gets the stream of the request to copy it into a file. * @deprecated use {@link #handleBinUpload(String, File, Request)}. */ public static File handleBinUpload(String datasetName, String extension, Request request) throws IOException, ConfigurationException { final File dir = GeoserverDataDirectory.findCreateConfigDir("data"); return handleBinUpload( datasetName + "." + extension, dir, request ); }
/** * Unzip a zipped dataset. * * @param storeName the name of the store to handle. * @param zipFile the zipped archive * @return null if the zip file does not point to a valid zip file, the output directory otherwise. * * @deprecated use {@link #unzipFile(File, File)} * */ public static File unpackZippedDataset(String storeName, File zipFile) throws IOException, ConfigurationException { File outputDirectory = new File(GeoserverDataDirectory.findCreateConfigDir("data"), storeName); unzipFile(zipFile, outputDirectory); return outputDirectory; }
public void clearCache(FeatureTypeInfo cfg){ try{ DeleteDbFiles.execute( GeoserverDataDirectory.findCreateConfigDir("geosearch").getCanonicalPath(), "h2cache_" + getDatabaseName(cfg), true ); } catch (Exception ioe) { LOGGER.severe("Couldn't clear out config dir due to: " + ioe); } }
/** * Handles the upload of a dataset using the URL method. * * @param datasetName the name of the uploaded dataset. * @param extension the extension of the uploaded dataset. * @param request the incoming request. * @return a {@link File} that points to the final uploaded dataset. * * @throws IOException * @throws ConfigurationException * * @deprecated use {@link #handleURLUpload(String, File, Request)}. */ public static File handleURLUpload(String datasetName, String extension, Request request) throws IOException, ConfigurationException { //// // // Get the dir where to write and create a file there // //// File dir = GeoserverDataDirectory.findCreateConfigDir("data"); return handleURLUpload(datasetName + "." + extension, dir, request); }
File getWpsOutputStorage() { File wpsStore = null; try { File temp = GeoserverDataDirectory.findCreateConfigDir("temp"); wpsStore = new File(temp, "wps"); if(!wpsStore.exists()) { mkdir(wpsStore); } } catch(Exception e) { throw new WcsException("Could not create the temporary storage directory for WPS"); } return wpsStore; }
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 { File dir = GeoserverDataDirectory.findCreateConfigDir("printing"); File qualifiedConfig = new File(dir, configProp); if (!qualifiedConfig.exists()) { InputStream conf = getClass().getResourceAsStream("default-config.yaml"); IOUtils.copy(conf, qualifiedConfig); } if (!qualifiedConfig.canRead()) { LOG.warning("Printing module missing its configuration. Any actions it takes will fail."); return; } initParameters.setProperty("config", qualifiedConfig.getCanonicalPath()); } catch(org.vfny.geoserver.global.ConfigurationException e){ LOG.warning("Explosion while attempting to access/create config directory for MapFish " + "printing module. Module will fail when run. Config exception is: " + e); } catch(java.io.IOException e){ LOG.warning("Explosion while calculating canonical path for MapFish printing servlet. " + "Module will fail when run. IO Exception is: " + e); } super.setInitParameters(initParameters); } }
File temp = GeoserverDataDirectory.findCreateConfigDir("temp"); wcsStore = new File(temp, "wcs"); if(!wcsStore.exists())
File styles = GeoserverDataDirectory.findCreateConfigDir("styles"); File rasterLegend = new File(styles, "rasterLegend.png"); if(rasterLegend.exists())