|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.factory.AbstractFactory org.geotools.referencing.factory.AbstractFactory org.geotools.referencing.factory.AbstractAuthorityFactory org.geotools.referencing.factory.BufferedAuthorityFactory org.geotools.referencing.factory.DeferredAuthorityFactory
A buffered authority factory which will defer the creation of a backing store until when first needed. This approach allow to etablish a connection to a database (for example) only when first needed. In addition, the backing store can be automatically disposed after a timeout and recreated when needed again.
Field Summary |
Fields inherited from class org.geotools.referencing.factory.AbstractAuthorityFactory |
factories |
Fields inherited from class org.geotools.referencing.factory.AbstractFactory |
LOGGER |
Fields inherited from class org.geotools.factory.AbstractFactory |
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority |
Constructor Summary | |
protected |
DeferredAuthorityFactory(FactoryGroup factories,
int priority)
Deprecated. Use DeferredAuthorityFactory(Hints,int) instead. |
protected |
DeferredAuthorityFactory(FactoryGroup factories,
int priority,
int maxStrongReferences)
Deprecated. Use DeferredAuthorityFactory(Hints,int,int) instead. |
protected |
DeferredAuthorityFactory(Hints hints,
int priority)
Constructs an instance without initial backing store. |
protected |
DeferredAuthorityFactory(Hints hints,
int priority,
int maxStrongReferences)
Constructs an instance without initial backing store. |
Method Summary | |
protected boolean |
canDisposeBackingStore(AbstractAuthorityFactory backingStore)
Returns if the backing store can be disposed now. |
protected abstract AbstractAuthorityFactory |
createBackingStore()
Creates the backing store authority factory. |
void |
dispose()
Releases resources immediately instead of waiting for the garbage collector. |
boolean |
isConnected()
Returns if this deferred factory is connected to its backing store. |
boolean |
isReady()
Returns if this factory is ready. |
void |
setTimeout(long delay)
Set a timer for disposing the backing store after the specified amount of milliseconds of inactivity. |
Methods inherited from class org.geotools.referencing.factory.AbstractAuthorityFactory |
getImplementationHints, noSuchAuthorityCode, onRegistration, trimAuthority |
Methods inherited from class org.geotools.referencing.factory.AbstractFactory |
ensureNonNull |
Methods inherited from class org.geotools.factory.AbstractFactory |
onDeregistration |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.geotools.factory.Factory |
getImplementationHints |
Constructor Detail |
protected DeferredAuthorityFactory(FactoryGroup factories, int priority)
DeferredAuthorityFactory(Hints,int)
instead.
createBackingStore()
method is
invoked.
factories
- The factories to use.priority
- The priority for this factory, as a number between
MINIMUM_PRIORITY
and
MAXIMUM_PRIORITY
inclusive.createBackingStore()
protected DeferredAuthorityFactory(FactoryGroup factories, int priority, int maxStrongReferences)
DeferredAuthorityFactory(Hints,int,int)
instead.
createBackingStore()
method is
invoked.
factories
- The factories to use.priority
- The priority for this factory, as a number between
MINIMUM_PRIORITY
and
MAXIMUM_PRIORITY
inclusive.maxStrongReferences
- The maximum number of objects to keep by strong reference.createBackingStore()
protected DeferredAuthorityFactory(Hints hints, int priority)
createBackingStore()
method is
invoked.
This constructor recognizes the CRS
, CS
,
DATUM
and MATH_TRANSFORM
hints. In addition, the FactoryGroup.HINT_KEY
hint may be used as
a low-level substitute for all the above.
hints
- The factories to use as a set of hints.priority
- The priority for this factory, as a number between
MINIMUM_PRIORITY
and
MAXIMUM_PRIORITY
inclusive.createBackingStore()
protected DeferredAuthorityFactory(Hints hints, int priority, int maxStrongReferences)
createBackingStore()
method is
invoked.
This constructor recognizes the CRS
, CS
,
DATUM
and MATH_TRANSFORM
hints. In addition, the FactoryGroup.HINT_KEY
hint may be used as
a low-level substitute for all the above.
hints
- The factories to use as a set of hints.priority
- The priority for this factory, as a number between
MINIMUM_PRIORITY
and
MAXIMUM_PRIORITY
inclusive.maxStrongReferences
- The maximum number of objects to keep by strong reference.createBackingStore()
Method Detail |
public boolean isReady()
createBackingStore()
throws an exception.
isReady
in interface OptionalFactory
protected abstract AbstractAuthorityFactory createBackingStore() throws org.opengis.referencing.FactoryException
FactoryNotFoundException
- if the backing store has not been found.
org.opengis.referencing.FactoryException
- if the creation of backing store failed for an other reason.public boolean isConnected()
public void setTimeout(long delay)
createBackingStore()
method will be responsible for creating a new
backing store when needed. Note that the backing store disposal can be vetoed if
canDisposeBackingStore(org.geotools.referencing.factory.AbstractAuthorityFactory)
returns .
delay
- The minimal delay before to close the backing store. This delay is very
approximative. The backing store will not be closed before, but may take as
much as twice that time before to be closed.protected boolean canDisposeBackingStore(AbstractAuthorityFactory backingStore)
setTimeout(long)
if the factory
were not used during that time. The default implementation always returns .
Subclasses should override this method and returns if they want to prevent
the backing store disposal under some circonstances.
backingStore
- The backing store in process of being disposed.public void dispose() throws org.opengis.referencing.FactoryException
canDisposeBackingStore(org.geotools.referencing.factory.AbstractAuthorityFactory)
value.
dispose
in class BufferedAuthorityFactory
org.opengis.referencing.FactoryException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |