On Mon, Apr 18, 2011 at 1:24 PM, Luca Morandini
<luca.morandi...@gmail.com> wrote:
> On 04/18/2011 10:03 AM, Andrea Aime wrote:
>>       /**
>>        * Return a Resource handle for the specified resource.
>>        * The handle should always be a reusable resource descriptor,
>>        * allowing for multiple {@link Resource#getInputStream()} calls.
>>        *<p><ul>
>>       *<li>Must support fully qualified URLs, e.g. "file:C:/test.dat".
>
> An URL object would fit the bill for this option.
>
>
>>        *<li>Must support classpath pseudo-URLs, e.g. "classpath:test.dat".
>
> Hmm... I haven't tried this, but URLStreamHandler should do it, though I think
> styles do not belong to the lib or classes directories.
>
>
>>        *<li>Should support relative file paths, e.g. "WEB-INF/test.dat".
>
> I presume this would be the most popular option to specify WKT libraries, but 
> how
> to do it in such a way that could be used with or without Spring and 
> GeoServer ?
>
> AFAIK, Java lets you either load resources using an absolute path or one that 
> is
> relative to the current classloader and you cannot use environment variables.
>
> Come to think of it: why don't detect (and expand) the environment variables 
> in
> the URL before loading the properties file ?
> This way an absolute path URL may be rendered relative, like:
> wktlib://file://${GEOSERVER_DATA_DIR}/styles/mywkt.properties
>
> What do you think ?

I believe it would inflict quite some pain to the GS users, all in the
GS styling
system is there to avoid have you mention the data dir to start with (think
referencing fonts, graphics).

I was not referencing the ResourceLoader interface as something to implement
verbatim, more like something to get inspiration from.

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.
The GS one would use the data dir or the style dir as the parent folder.

To keep things simple the registration could of a new locator could a
static method
in the WKTMarkFactory class

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

Reply via email to