An authority factory that caches all objects created by an other factory. All
createFoo(String) methods first looks if a previously created object
exists for the given code. If such an object exists, it is returned. Otherwise,
the object creation is delegated to the
specified at creation time, and the result is cached in this buffered factory.
Objects are cached by strong references, up to the amount of objects specified at
construction time. If a greater amount of objects are cached, the oldest ones will
be retained through a
instead of a strong
one. This means that this buffered factory will continue to returns them as long as
they are in use somewhere else in the Java virtual machine, but will be discarted
(and recreated on the fly if needed) otherwise.
since: 2.1 version: $Id: BufferedAuthorityFactory.java 26078 2007-06-28 15:00:59Z desruisseaux $ author: Martin Desruisseaux
This constructor is protected because subclasses must declare which of the
DatumAuthorityFactory ,
CSAuthorityFactory ,
CRSAuthorityFactory and
CoordinateOperationAuthorityFactory interfaces they choose to implement.
Parameters: factory - The factory to cache.
Constructs an instance wrapping the specified factory with a default number
of entries to keep by strong reference.
This constructor is protected because subclasses must declare which of the
DatumAuthorityFactory ,
CSAuthorityFactory ,
CRSAuthorityFactory and
CoordinateOperationAuthorityFactory interfaces they choose to implement.
Parameters: factory - The factory to cache. Can not be null .
Constructs an instance wrapping the specified factory. The
maxStrongReferences argument specify the maximum number of objects to keep by strong reference. If a greater
amount of objects are created, then the strong references for the oldest ones are replaced
by weak references.
This constructor is protected because subclasses must declare which of the
DatumAuthorityFactory ,
CSAuthorityFactory ,
CRSAuthorityFactory and
CoordinateOperationAuthorityFactory interfaces they choose to implement.
Parameters: factory - The factory to cache. Can not be null . Parameters: maxStrongReferences - The maximum number of objects to keep by strong reference.
BufferedAuthorityFactory
BufferedAuthorityFactory(int priority, int maxStrongReferences)(Code)
Completes the set of hints according the value currently set in this object. This method
is invoked by
BufferedAuthorityFactory or by
DeferredAuthorityFactory at
backing store creation time.
Returns the direct dependencies. The returned list contains the backing store
specified at construction time, or the exception if it can't be obtained.
dispose
public synchronized void dispose() throws FactoryException(Code)
Releases resources immediately instead of waiting for the garbage collector.
Returns the organization or party responsible for definition and maintenance of the
underlying database.
getAuthorityCodes
public synchronized Set getAuthorityCodes(Class type) throws FactoryException(Code)
Returns the set of authority codes of the given type. The
type argument specify the base class.
Parameters: type - The spatial reference objects type. The set of authority codes for spatial reference objects of the given type.If this factory doesn't contains any object of the given type, then this methodreturns an . throws: FactoryException - if access to the underlying database failed.
Returns the backing store authority factory.
The backing store to uses in createXXX(...) methods. throws: FactoryException - if the creation of backing store failed.
getBackingStoreDescription
public synchronized String getBackingStoreDescription() throws FactoryException(Code)
Returns a description of the underlying backing store, or
null if unknow.
This is for example the database software used for storing the data.
throws: FactoryException - if a failure occured while fetching the engine description.
getDescriptionText
public synchronized InternationalString getDescriptionText(String code) throws FactoryException(Code)
Gets a description of the object corresponding to a code.
Parameters: code - Value allocated by authority. A description of the object, or null if the objectcorresponding to the specified code has no description. throws: NoSuchAuthorityCodeException - if the specified code was not found. throws: FactoryException - if the query failed for some other reason.
Returns a finder which can be used for looking up unidentified objects.
The default implementation delegates lookup to the underlying backing
store and caches the result.
since: 2.4
Returns
true if this factory is available. The default implementation returns
false if no backing store were setup and
DeferredAuthorityFactory.createBackingStore throws an exception.
If this factory is a wrapper for the specified factory that do not add any additional
, returns
true . This method is
for
FallbackAuthorityFactory internal use only and should not be public. A
cheap test without
BufferedAuthorityFactory.getBackingStore invocation is suffisient for our needs.
Methods inherited from org.geotools.referencing.factory.AbstractAuthorityFactory