> 
> The FileDataStoreSpi is badly designed for a number of reasons:
> - it assumes you deal with certain extensions. This is overrated, the
>   datastore could operate by inspecting magic numbers in the file header
>   instead of using extensions
> - it assumes you can create a datastore with a url alone. Nope, we want
>   a namespace too
> - it assumes there is only one feature type per url. Nope, a file can
>   be complex and contain many layers
> 
> Since I wanted to work on this both in trunk and 2.5.x I tried hard
> to stay away from any mandatory new interface and work with what's 
> already there. Any datastore dealing with files has at least to
> be able and handle a url and a namespace, so that's just as much
> I'd like to assume.
> 
> What would be useful, but I don't consider mandatory, is a FileDataStore
> interface that provides a list of files captured by a certain datastore,
> so that I can avoid scanning them. I can workaround the lack of it
> by forcing the registration of a single feature type just once, with
> the first datastore that can handle it. When I open a file, I'll
> grab all the feature types inside of it, in the case of property data
> store for example, that will mean all the property files in the
> current directory (that's how property data store works if my memory
> serves me right).

Ok, fair enough, but still confused about how you can detect if a 
datastore works with files. Is the approach to assume that if the 
datastore can handle files it has a "url" parameter with a type of 
java.io.File?
> 
>>> Issues:
>>> - a certain datastore can open multiple files (shapefile, property ds),
>>>    we want to avoid keeping duplicate datastores around
>>> - a directory (or worse, a tree) can hold a massive amount of feature
>>>    types, there are legitimate scalability/memory consumption concerns.
>>>
>>> Using a lightweight (soft reference based) cache has issues with
>>> datastore disposal, as the datastore we're trying to dispose might be 
>>> the holder or a resource that  might be in use by a reader or a feature
>>> source, closing it might kill the current user...
>>> This one is hard actually, the api does not give us any clue on
>>> whether a datastore generated object is still being used or not...
>>> To avoid it we'd have to keep strong references to all datastores
>>> that have returned a feature source, a reader or a writer at
>>> least once. Maybe we can add a custom api to this datastore to
>>> force some resource release (stop gap measure for the lack of a better
>>> way).
>>>
>> Yeah tricky. It seems to me what we lack is a dispose on FeatureSource. 
> 
> Hummm.. yeah, but I fear this will escalate badly codebase refactoring 
> wise.
> If we add that, we'll also have to start keeping references to all 
> resource holders provided to the clients
> inside the DataStore itself. This accounts not only for FeatureSource,
> but also for collections, subcollections, readers, iterators, writers... 
> given the variety of ways a datastore has been created in the past
> years, the mind boggles at the thought.
> I'd say we first simplify a little bit the datastore interfaces (die
> feature collection, die!) and then we can think hanging ourselves
> with nice resource tracking?
Yup, its messy. But perhaps a first cut we could assume that client is 
well behaved and does not dispose a FeatureSource while iterators are 
still open on collections? That way we just have to worry about calling 
dispose() on FeatureSource when we are done with it. And if we have been 
bad we will find out about it. It would theoretically work in GeoServer 
would it not?

Anyways, i am fine to push it back and just for a first pass use a hard 
cache... or perhaps just limit the number of sub datastores or something.
> 
> Cheers
> Andrea
> 
> 


-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to