|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFactory
ReferencingFactory
AbstractAuthorityFactory
AuthorityFactoryAdapter
MultiAuthoritiesFactory
@ThreadSafe public class MultiAuthoritiesFactory
An authority factory that delegates the object creation to an other factory determined from the
authority part in "authority:code" arguments. The set of factories to use as delegates
shall be specified at construction time. This is different than AllAuthoritiesFactory,
which get its delegates from the AuthorityFactoryFinder.
This factory requires that every codes given to a createXXX(String) method are prefixed
by the authority name, for example "EPSG:4326". When a createXXX(String) method
is invoked, this class extracts the authority name from the "authority:code" argument
and searches for a factory for that authority in the list of factories given at construction
time. If a factory is found, then the work is delegated to that factory. Otherwise a
NoSuchAuthorityCodeException is thrown.
This class is not registered in AuthorityFactoryFinder, because it is not a real
authority factory. There is not a single authority name associated to this factory, but
rather a set of names determined from all available authority factories. If an instance
of this class is desired, it must be created explicitly.
| referencing/geotk-referencing (download) | View source code for this class |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class Factory |
|---|
Factory.Availability, Factory.Organizer |
| Field Summary |
|---|
| Fields inherited from class AbstractAuthorityFactory |
|---|
nameFactory |
| Fields inherited from class ReferencingFactory |
|---|
LOGGER |
| Fields inherited from class Factory |
|---|
EMPTY_HINTS, hints |
| Constructor Summary | |
|---|---|
MultiAuthoritiesFactory(Collection<? extends AuthorityFactory> factories)
Creates a new factory using the specified set of user factories. |
|
| Method Summary | ||
|---|---|---|
IdentifiedObject |
createObject(String code)
Returns an arbitrary object from a code. |
|
Citation |
getAuthority()
Returns the organization or party responsible for definition and maintenance of the database. |
|
Set<String> |
getAuthorityCodes(Class<? extends IdentifiedObject> type)
Returns the set of authority codes of the given type. |
|
protected
|
getAuthorityFactory(Class<T> type,
String code)
Searches for a factory of the given type. |
|
protected AuthorityFactory |
getAuthorityFactory(String code)
Returns an arbitrary object authority factory for the specified "AUTHORITY:NUMBER"
code. |
|
Set<String> |
getAuthorityNames()
Returns the authority names of every factories given at construction time. |
|
String |
getBackingStoreDescription()
Returns a description of the underlying backing store, or null if unknown. |
|
protected CoordinateOperationAuthorityFactory |
getCoordinateOperationAuthorityFactory(String code)
Returns the operation authority factory for the specified "AUTHORITY:NUMBER" code. |
|
protected CRSAuthorityFactory |
getCRSAuthorityFactory(String code)
Returns the CRS authority factory for the specified "AUTHORITY:NUMBER" code. |
|
protected CSAuthorityFactory |
getCSAuthorityFactory(String code)
Returns the CS authority factory for the specified "AUTHORITY:NUMBER" code. |
|
protected DatumAuthorityFactory |
getDatumAuthorityFactory(String code)
Returns the datum authority factory for the specified "AUTHORITY:NUMBER" code. |
|
InternationalString |
getDescriptionText(String code)
Gets a description of the object corresponding to a code. |
|
List<AuthorityFactory> |
getFactories()
Returns the factories on which to delegate object creations. |
|
IdentifiedObjectFinder |
getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type)
Returns a finder which can be used for looking up unidentified objects. |
|
protected char |
getSeparator(String code)
Returns the character separator for the specified code. |
|
Citation |
getVendor()
Returns the vendor responsible for creating this factory implementation. |
|
| Methods inherited from class AbstractAuthorityFactory |
|---|
dispose, noSuchAuthorityCode, trimAuthority |
| Methods inherited from class ReferencingFactory |
|---|
ensureNonNull |
| Methods inherited from class Factory |
|---|
equals, hasCompatibleHints, hashCode, setOrdering, toString |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface CRSAuthorityFactory |
|---|
createCompoundCRS, createCoordinateReferenceSystem, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRS |
| Methods inherited from interface CSAuthorityFactory |
|---|
createCartesianCS, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createUnit, createVerticalCS |
| Methods inherited from interface DatumAuthorityFactory |
|---|
createDatum, createEllipsoid, createEngineeringDatum, createGeodeticDatum, createImageDatum, createPrimeMeridian, createTemporalDatum, createVerticalDatum |
| Methods inherited from interface CoordinateOperationAuthorityFactory |
|---|
createCoordinateOperation, createFromCoordinateReferenceSystemCodes, createOperationMethod |
| Constructor Detail |
|---|
public MultiAuthoritiesFactory(Collection<? extends AuthorityFactory> factories)
createFoo(code) method will scan the supplied factories in their iteration
order. The first factory implementing the appropriate interface and having the expected
authority name will be used.
If the factories collection contains more than one factory for the same authority
and interface, then all additional factories will be fallbacks, to be tried in iteration order only if the first acceptable factory failed to
create the requested object.
factories - A set of user-specified factories to try.| Method Detail |
|---|
public List<AuthorityFactory> getFactories()
AUTHORITY:CODE" string, this MultiAuthoritiesFactory will delegate the
object creation to the first factory from the list having an authority name equals to
the "AUTHORITY" part of the above string.
This factory list is determined from the collection given at construction time, but may not be identical.
MultiAuthoritiesFactory will delegate
object creations, in iteration order.protected char getSeparator(String code)
':',
except if the code looks like a URL (e.g. "http://www.opengis.net/"), in which
case this method returns '/'.
In the current implementation, "looks like a URL" means that the first
non-aplhanumeric characters
are "://". But this heuristic rule may change in future implementations.
code - The code for which to returns the separator character.
public Citation getVendor()
getVendor in interface FactorygetVendor in class AuthorityFactoryAdapterCitations.GEOTOOLKITpublic Citation getAuthority()
getAuthority in interface AuthorityFactorygetAuthority in class AuthorityFactoryAdapterpublic Set<String> getAuthorityNames()
public String getBackingStoreDescription()
throws FactoryException
null if unknown.
getBackingStoreDescription in class AuthorityFactoryAdapternull.
FactoryException - if a failure occurred while fetching the engine description.
protected <T extends AuthorityFactory> T getAuthorityFactory(Class<T> type,
String code)
throws NoSuchAuthorityCodeException
AllAuthoritiesFactory, then this method request for a factory using
AuthorityFactoryFinder. The authority name is inferred from the specified code.
getAuthorityFactory in class AuthorityFactoryAdapterT - The type of the authority factory to find.type - The interface to be implemented.code - The code of the object to create.
NoSuchAuthorityCodeException - if no suitable factory were found.
protected final AuthorityFactory getAuthorityFactory(String code)
throws NoSuchAuthorityCodeException
"AUTHORITY:NUMBER"
code. This method delegates to getAuthorityFactory(AuthorityFactory.class, code).
getAuthorityFactory in class AuthorityFactoryAdaptercode - The code to parse.
NoSuchAuthorityCodeException - if no authority name has been found.
protected final DatumAuthorityFactory getDatumAuthorityFactory(String code)
throws NoSuchAuthorityCodeException
"AUTHORITY:NUMBER" code.
This method delegates to getAuthorityFactory(DatumAuthorityFactory.class, code).
getDatumAuthorityFactory in class AuthorityFactoryAdaptercode - The code to parse.
NoSuchAuthorityCodeException - if no authority name has been found.
protected final CSAuthorityFactory getCSAuthorityFactory(String code)
throws NoSuchAuthorityCodeException
"AUTHORITY:NUMBER" code.
This method delegates to getAuthorityFactory(CSAuthorityFactory.class, code).
getCSAuthorityFactory in class AuthorityFactoryAdaptercode - The code to parse.
NoSuchAuthorityCodeException - if no authority name has been found.
protected final CRSAuthorityFactory getCRSAuthorityFactory(String code)
throws NoSuchAuthorityCodeException
"AUTHORITY:NUMBER" code.
This method delegates to getAuthorityFactory(CRSAuthorityFactory.class, code).
getCRSAuthorityFactory in class AuthorityFactoryAdaptercode - The code to parse.
NoSuchAuthorityCodeException - if no authority name has been found.
protected final CoordinateOperationAuthorityFactory getCoordinateOperationAuthorityFactory(String code)
throws NoSuchAuthorityCodeException
"AUTHORITY:NUMBER" code.
This method delegates to getAuthorityFactory(CoordinateOperationAuthorityFactory.class, code).
getCoordinateOperationAuthorityFactory in class AuthorityFactoryAdaptercode - The code to parse.
NoSuchAuthorityCodeException - if no authority name has been found.
public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type)
throws FactoryException
getAuthorityCodes in interface AuthorityFactorygetAuthorityCodes in class AuthorityFactoryAdaptertype - The spatial reference objects type (may be IdentifiedObject.class).
FactoryException - if access to the underlying database failed.
public InternationalString getDescriptionText(String code)
throws FactoryException
getDescriptionText in interface AuthorityFactorygetDescriptionText in class AuthorityFactoryAdaptercode - Value allocated by authority.
null if the object
corresponding to the specified code has no description.
FactoryException - if the query failed.
public IdentifiedObject createObject(String code)
throws FactoryException
createObject in interface AuthorityFactorycreateObject in class AuthorityFactoryAdaptercode - Value allocated by authority.
FactoryException - if the object creation failed.AuthorityFactoryAdapter.createCoordinateReferenceSystem(java.lang.String),
AuthorityFactoryAdapter.createDatum(java.lang.String),
AuthorityFactoryAdapter.createEllipsoid(java.lang.String),
AuthorityFactoryAdapter.createUnit(java.lang.String)
public IdentifiedObjectFinder getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type)
throws FactoryException
getIdentifiedObjectFinder in class AuthorityFactoryAdaptertype - The type of objects to look for. Should be a GeoAPI interface like
GeographicCRS.class, but this method accepts also implementation
class. If the type is unknown, use IdentifiedObject.class. A more
accurate type may help to speed up the search, since it reduces the amount
of tables to scan in some implementations (for example the factories backed
by EPSG databases).
FactoryException - if the finder can not be created.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||