On Tue, Apr 19, 2011 at 8:02 AM, Luca Morandini <luca.morandi...@gmail.com> wrote: >> Something easier like: >> >> interface ResourceLocator { >> InputStream getResource(String location); >> } >> >> could easily be implemented in different ways as something that can lookup >> in the classpath or relative to a parent folder. > > I did not get it: how would the software know which is the parent dir in > different > environment (GS or uDIG, for instance) ?
I guess you're thinking configurable, I'm thinking programmable. I don't like configurable because it restricts possibilities. Here is how the GS approach would work: public class FileResourceLocator implements ResourceLocator { File root; public FileResourceLocator(File root) { this.root = root; } InputStream getResource(String path) { File file = new File(root, path); if(file.exists()) { return new FileInputStream(file); } else { return null; } } } and somewhere in GeoServer startup code: GeoServerDataDirectory dd = ... ; FileResourceLocator locator = new FileResourceLocator(dd.root()); WKTMarkFactory.addLocator(locator); I don't pretend to have the above compile, just to give you an idea. Other possible locators could be one that works based on classpath and root class, one that works out of a base url, one that picks stuff from a database using the path as a key, one that look into a LDAP for user specific set of symbols and so on. > >> The GS one would use the data dir or the style dir as the parent folder. > > I am investigating Jody's suggestion of implementing the same mechanism used > to > use external images (via ExternalGraphic and xlink): I presume that may be the > optimal solution (bar the xlink part). That works too. As said, it's a configuration based approach, it sets up front the range of possibilities, you have classpath and one folder, no other loading mechanisms can be injected. Cheers Andrea -- ------------------------------------------------------- Ing. Andrea Aime GeoSolutions S.A.S. Tech lead Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 962313 mob: +39 333 8128928 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://www.youtube.com/user/GeoSolutionsIT http://www.linkedin.com/in/andreaaime http://twitter.com/geowolf ------------------------------------------------------- ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel