/** * Copies a resource from the classpath to a specified file. * * @param classpathResource Path to classpath content to be copied * @param target File to copy content into (must be already created) */ public void copyFromClassPath(String classpathResource, File target) throws IOException { copyFromClassPath(classpathResource, target, null); }
/** * Copies a resource located on the classpath to a specified path. * * <p>The <tt>resource</tt> is obtained from teh context class loader of the current thread. * When the <tt>to</tt> parameter is specified as a relative path it is considered to be * relative to {@link #getBaseDirectory()}. * * @param classpathResource The resource to copy. * @param location The destination to copy to. */ public void copyFromClassPath(String classpathResource, String location) throws IOException { Resource resource = get(Paths.convert(location)); copyFromClassPath(classpathResource, resource.file()); }
resourceLoader.copyFromClassPath( "org/geoserver/ows/smileyface.png", "styles/smileyface.png"); paths.add(new String[] {"styles", "smileyface.png"}); resourceLoader.copyFromClassPath( "org/geoserver/ows/smileyface.png", "styles/icons/smileyface.png"); paths.add(new String[] {"styles", "icons", "smileyface.png"}); resourceLoader.copyFromClassPath( "org/geoserver/ows/house.svg", "workspaces/cite/styles/house.svg"); paths.add(new String[] {"styles", "cite", "house.svg"}); resourceLoader.copyFromClassPath( "org/geoserver/ows/house.svg", "workspaces/cite/styles/icons/house.svg"); paths.add(new String[] {"styles", "cite", "icons", "house.svg"}); resourceLoader.copyFromClassPath("org/geoserver/ows/smileyface.png", "styles/override.png"); resourceLoader.copyFromClassPath( "org/geoserver/ows/grass_fill.png", "workspaces/cite/styles/override.png"); resourceLoader.copyFromClassPath( "org/geoserver/ows/smileyface.png", "styles/icons/override.png"); resourceLoader.copyFromClassPath( "org/geoserver/ows/grass_fill.png", "workspaces/cite/styles/icons/override.png");
File target = new File(lcdir.getAbsolutePath(), lcfiles[i]); if (!target.exists()) { resourceLoader.copyFromClassPath(lcfiles[i], target);
/** Keys for overriding default layer properties */ public static class StyleProperty<T> { T get(Map<StyleProperty, Object> map, T def) { return map != null && map.containsKey(this) ? (T) map.get(this) : def; } public static StyleProperty<String> FORMAT = new StyleProperty<String>(); public static StyleProperty<Version> FORMAT_VERSION = new StyleProperty<Version>(); public static StyleProperty<LegendInfo> LEGEND_INFO = new StyleProperty<LegendInfo>(); }
.copyFromClassPath(filename, new File(storeDir, filename), scope);
/** * Copies a resource located on the classpath to a specified path. * <p> * The <tt>resource</tt> is obtained from teh context class loader of the * current thread. When the <tt>to</tt> parameter is specified as a relative * path it is considered to be relative to {@link #getBaseDirectory()}. </p> * * @param resource The resource to copy. * @param to The destination to copy to. */ public void copyFromClassPath( String resource, String to ) throws IOException { File target = new File( to ); if ( !target.isAbsolute() ) { target = new File( getBaseDirectory(), to ); } copyFromClassPath(resource, target); }
private void loadAppSchemaTestData() throws IOException { GeoServerResourceLoader loader = new GeoServerResourceLoader(getTestData().getDataDirectoryRoot()); loader.copyFromClassPath( "test-data/mappedPolygons.properties", "data/gsml/mappedPolygons.properties"); loader.copyFromClassPath( "test-data/mappedPolygons.oasis.xml", "data/gsml/mappedPolygons.oasis.xml"); loader.copyFromClassPath( "test-data/commonSchemas_new/GeoSciML/CGI_basicTypes.xsd", "data/gsml/commonSchemas_new/GeoSciML/CGI_basicTypes.xsd"); loader.copyFromClassPath( "test-data/commonSchemas_new/GeoSciML/CGI_Value.xsd", "data/gsml/commonSchemas_new/GeoSciML/CGI_Value.xsd"); loader.copyFromClassPath( "test-data/commonSchemas_new/GeoSciML/earthMaterial.xsd", "data/gsml/commonSchemas_new/GeoSciML/earthMaterial.xsd"); loader.copyFromClassPath( "test-data/commonSchemas_new/GeoSciML/fossil.xsd", "data/gsml/commonSchemas_new/GeoSciML/fossil.xsd"); loader.copyFromClassPath( "test-data/commonSchemas_new/GeoSciML/geologicStructure.xsd", "data/gsml/commonSchemas_new/GeoSciML/geologicStructure.xsd"); loader.copyFromClassPath( "test-data/commonSchemas_new/GeoSciML/geologicUnit.xsd", "data/gsml/commonSchemas_new/GeoSciML/geologicUnit.xsd"); loader.copyFromClassPath( "test-data/commonSchemas_new/GeoSciML/geosciml.xsd", "data/gsml/commonSchemas_new/GeoSciML/geosciml.xsd"); loader.copyFromClassPath( "test-data/commonSchemas_new/GeoSciML/Gsml.xsd",
if (url != null) { properties = loader.createFile(PROPERTYFILENAME); loader.copyFromClassPath( DEFAULT_PROPERTY_PATH, properties,
loader.copyFromClassPath( xmppServerEmbeddedCertFile.trim(), this.certificateFile /*,
loader.copyFromClassPath( xmppServerEmbeddedCertFile.trim(), this.certificateFile /*,
coverageName.getPrefix() + File.separator + coverageName.getLocalPart()); File target = new File(targetDir, coverageName.getLocalPart() + ".zip"); loader.copyFromClassPath("org/geoserver/wms/dimension/watertemp.zip", target);
legend.setOnlineResource("legend.png"); File file = getResourceLoader().createFile("styles", "legend.png"); getResourceLoader().copyFromClassPath("../legend.png", file, getClass()); testData.addStyle(null, "custom", "point_test.sld", getClass(), catalog, legend); .createFile( "workspaces", defaultWorkspace.getName(), "styles", "legend.png"); getResourceLoader().copyFromClassPath("../legend.png", wsFile, getClass()); testData.addStyle( defaultWorkspace, "wsCustom", "point_test.sld", getClass(), catalog, legend);
getResourceLoader().copyFromClassPath("../legend.png", resource.file(), getClass());
getResourceLoader().copyFromClassPath("../legend.png", resource.file(), getClass()); getResourceLoader().copyFromClassPath("../legend.png", resourceWs.file(), getClass());