/** * Constructs an instance wrapping the specified factory with a default cache. * * <p>The provided authority factory must implement {@link DatumAuthorityFactory}, {@link * CSAuthorityFactory}, {@link CRSAuthorityFactory} and {@link * CoordinateOperationAuthorityFactory} . * * @param factory The factory to cache. Can not be {@code null}. */ public CachedCRSAuthorityDecorator(final CRSAuthorityFactory factory) { this(factory, createCache(GeoTools.getDefaultHints())); }
protected String toKey(String code) { return ObjectCaches.toKey(getAuthority(), code); }
public GeocentricCRS createGeocentricCRS(String code) throws FactoryException { final String key = toKey(code); GeocentricCRS crs = (GeocentricCRS) cache.get(key); if (crs == null) { try { cache.writeLock(key); crs = (GeocentricCRS) cache.peek(key); if (crs == null) { crs = crsAuthority.createGeocentricCRS(code); cache.put(key, crs); } } finally { cache.writeUnLock(key); } } return crs; }
final AbstractAuthorityFactory factory = new CachedCRSAuthorityDecorator(this.factory); final GeographicCRS CRS84 = factory.createGeographicCRS("CRS:84"); final IdentifiedObjectFinder finder =
public GeographicCRS createGeographicCRS(String code) throws FactoryException { final String key = toKey(code); GeographicCRS crs = (GeographicCRS) cache.get(key); if (crs == null) { try { cache.writeLock(key); crs = (GeographicCRS) cache.peek(key); if (crs == null) { crs = crsAuthority.createGeographicCRS(code); cache.put(key, crs); } } finally { cache.writeUnLock(key); } } return crs; }
public VerticalCRS createVerticalCRS(String code) throws FactoryException { final String key = toKey(code); VerticalCRS crs = (VerticalCRS) cache.get(key); if (crs == null) { try { cache.writeLock(key); crs = (VerticalCRS) cache.peek(key); if (crs == null) { crs = crsAuthority.createVerticalCRS(code); cache.put(key, crs); } } finally { cache.writeUnLock(key); } } return crs; }
public synchronized CompoundCRS createCompoundCRS(final String code) throws FactoryException { final String key = toKey(code); CompoundCRS crs = (CompoundCRS) cache.get(key); if (crs == null) { try { cache.writeLock(key); crs = (CompoundCRS) cache.peek(key); if (crs == null) { crs = crsAuthority.createCompoundCRS(code); cache.put(key, crs); } } finally { cache.writeUnLock(key); } } return crs; }
public EngineeringCRS createEngineeringCRS(String code) throws FactoryException { final String key = toKey(code); EngineeringCRS crs = (EngineeringCRS) cache.get(key); if (crs == null) { try { cache.writeLock(key); crs = (EngineeringCRS) cache.peek(key); if (crs == null) { crs = crsAuthority.createEngineeringCRS(code); cache.put(key, crs); } } finally { cache.writeUnLock(key); } } return crs; }
public ProjectedCRS createProjectedCRS(String code) throws FactoryException { final String key = toKey(code); ProjectedCRS crs = (ProjectedCRS) cache.get(key); if (crs == null) { try { cache.writeLock(key); crs = (ProjectedCRS) cache.peek(key); if (crs == null) { crs = crsAuthority.createProjectedCRS(code); cache.put(key, crs); } } finally { cache.writeUnLock(key); } } return crs; }
public IdentifiedObject createObject(String code) throws FactoryException { final String key = toKey(code); IdentifiedObject obj = (IdentifiedObject) cache.get(key); if (obj == null) { try { cache.writeLock(key); obj = (IdentifiedObject) cache.peek(key); if (obj == null) { obj = crsAuthority.createObject(code); cache.put(key, obj); } } finally { cache.writeUnLock(key); } } return obj; }
public DerivedCRS createDerivedCRS(String code) throws FactoryException { final String key = toKey(code); DerivedCRS crs = (DerivedCRS) cache.get(key); if (crs == null) { try { cache.writeLock(key); crs = (DerivedCRS) cache.peek(key); if (crs == null) { crs = crsAuthority.createDerivedCRS(code); cache.put(key, crs); } } finally { cache.writeUnLock(key); } } return crs; }
public TemporalCRS createTemporalCRS(String code) throws FactoryException { final String key = toKey(code); TemporalCRS crs = (TemporalCRS) cache.get(key); if (crs == null) { try { cache.writeLock(key); crs = (TemporalCRS) cache.peek(key); if (crs == null) { crs = crsAuthority.createTemporalCRS(code); cache.put(key, crs); } } finally { cache.writeUnLock(key); } } return crs; }
public ImageCRS createImageCRS(String code) throws FactoryException { final String key = toKey(code); ImageCRS crs = (ImageCRS) cache.get(key); if (crs == null) { try { cache.writeLock(key); crs = (ImageCRS) cache.peek(key); if (crs == null) { crs = crsAuthority.createImageCRS(code); cache.put(key, crs); } } finally { cache.writeUnLock(key); } } return crs; }
public CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws FactoryException { final String key = toKey(code); CoordinateReferenceSystem crs = (CoordinateReferenceSystem) cache.get(key); if (crs == null) { try { cache.writeLock(key); crs = (CoordinateReferenceSystem) cache.peek(key); if (crs == null) { crs = crsAuthority.createCoordinateReferenceSystem(code); cache.put(key, crs); } } finally { cache.writeUnLock(key); } } return crs; }