A buffered authority factory which will defer the
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.
since: 2.1 version: $Id: DeferredAuthorityFactory.java 25972 2007-06-21 13:38:35Z desruisseaux $ author: Martin DesruisseauxBufferedAuthorityFactory
Returns
true if the backing store can be disposed now. This method is invoked
automatically after the amount of time specified by
DeferredAuthorityFactory.setTimeout if the factory
were not used during that time. The default implementation always returns
true .
Subclasses should override this method and returns
false if they want to prevent
the backing store disposal under some circonstances.
Parameters: backingStore - The backing store in process of being disposed.
Creates the backing store authority factory. This method is invoked the first time a
createXXX(...) method is invoked.
The backing store to uses in createXXX(...) methods. throws: FactoryNotFoundException - if the backing store has not been found. throws: FactoryException - if the creation of backing store failed for an other reason.
dispose
public synchronized void dispose() throws FactoryException(Code)
Returns the backing store authority factory.
The backing store to uses in createXXX(...) methods. throws: FactoryException - if the creation of backing store failed.
Returns
true if this deferred factory is connected to its backing store.
This method returns
false if no
createFoo method has been invoked,
if the backing store has been automatically disposed after the
or if this factoy has been
.
setTimeout
public synchronized void setTimeout(long delay)(Code)
Set a timer for disposing the backing store after the specified amount of milliseconds of
inactivity. The
DeferredAuthorityFactory.createBackingStore method will be responsible for creating a new
backing store when needed. Note that the backing store disposal can be vetoed if
DeferredAuthorityFactory.canDisposeBackingStore returns
false .
Parameters: delay - The minimal delay before to close the backing store. This delay is veryapproximative. The backing store will not be closed before, but may take asmuch as twice that time before to be closed.
Fields inherited from org.geotools.referencing.factory.BufferedAuthorityFactory