コード例 #1
0
 /**
  * If this factory is a wrapper for the specified factory that do not add any additional
  * {@linkplain #getAuthorityCodes authority codes}, returns {@code true}. This method is for
  * {@link FallbackAuthorityFactory} internal use only and should not be public. A cheap test
  * without {@link #getBackingStore} invocation is suffisient for our needs.
  */
 @Override
 boolean sameAuthorityCodes(final AuthorityFactory factory) {
   final AbstractAuthorityFactory backingStore = this.backingStore; // Protect from changes.
   if (backingStore != null && backingStore.sameAuthorityCodes(factory)) {
     return true;
   }
   return super.sameAuthorityCodes(factory);
 }
コード例 #2
0
 /** Releases resources immediately instead of waiting for the garbage collector. */
 @Override
 public synchronized void dispose() throws FactoryException {
   if (backingStore != null) {
     backingStore.dispose();
     backingStore = null;
   }
   objectCache.clear();
   super.dispose();
 }
コード例 #3
0
 /**
  * Constructs an instance wrapping the specified factory. The {@code 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.
  *
  * <p>This constructor is protected because subclasses must declare which of the {@link
  * DatumAuthorityFactory}, {@link CSAuthorityFactory}, {@link CRSAuthorityFactory} and {@link
  * CoordinateOperationAuthorityFactory} interfaces they choose to implement.
  *
  * @param factory The factory to cache. Can not be {@code null}.
  * @param maxStrongReferences The maximum number of objects to keep by strong reference.
  */
 protected ThreadedAuthorityFactory(
     AbstractAuthorityFactory factory, final int maxStrongReferences) {
   super(factory.getPriority());
   while (factory instanceof ThreadedAuthorityFactory) {
     factory = ((ThreadedAuthorityFactory) factory).backingStore;
   }
   this.backingStore = factory;
   this.objectCache = new OldReferencingObjectCache(maxStrongReferences);
   completeHints();
 }
コード例 #4
0
 /**
  * Returns the organization or party responsible for definition and maintenance of the underlying
  * database.
  */
 public synchronized Citation getAuthority() {
   return (backingStore != null) ? backingStore.getAuthority() : null;
 }
コード例 #5
0
 /** Returns the vendor responsible for creating the underlying factory implementation. */
 @Override
 public synchronized Citation getVendor() {
   return (backingStore != null) ? backingStore.getVendor() : super.getVendor();
 }