|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFactoryDependencies
public class FactoryDependencies
Build a tree of factory dependencies, usually for printing to the console. This is a
convenience utility for inspecting the dependencies between Geotk referencing factories.
For example the following code will prints the full set of factories used by the
CRS.decode(String) method:
The output will looks like the tree below (actual output may vary depending the plugins available on the classpath). The "FactoryDependencies report = new FactoryDependencies(CRS.getAuthorityFactory(null)); report.setColorEnabled(true); // Use only if the output console is ANSI X3.64 compliant. report.setAbridged(true); report.print();
…⬏" suffix means that the factory has already
been defined in a previous line and its dependencies are not repeated.
For example if an "epsg.properties" file is provided on the classpath, then the above code snippet is useful for verifying thatDefaultAuthorityFactory["All"] └───AllAuthoritiesFactory["All"] ├───ThreadedEpsgFactory["EPSG"] │ └───AnsiDialectEpsgFactory["EPSG"] │ ├───ReferencingObjectFactory[objects] │ └───DatumAliases[objects] ├───AutoCRSFactory["AUTO2", "AUTO"] │ ├───ReferencingObjectFactory[objects] …⬏ │ └───DatumAliases[objects] …⬏ ├───WebCRSFactory["CRS", "OGC"] │ ├───ReferencingObjectFactory[objects] …⬏ │ └───DatumAliases[objects] …⬏ ├───URN_AuthorityFactory["urn:ogc:def", "urn:x-ogc:def"] │ └───AllAuthoritiesFactory["All"] │ ├───ThreadedEpsgFactory["EPSG"] …⬏ │ ├───AutoCRSFactory["AUTO2"] …⬏ │ └───WebCRSFactory["CRS"] …⬏ └───HTTP_AuthorityFactory["http://www.opengis.net"] └───AllAuthoritiesFactory["All"] …⬏
PropertyEpsgFactory appears as expected. It should be visible below
ThreadedEpsgFactory in a fallback chain.
An other way to gather information about the factories available at runtime is to set the
logging level of org.geotoolkit loggers to CONFIG or a finer level.
| referencing/geotk-referencing (download) | View source code for this class |
| Constructor Summary | |
|---|---|
FactoryDependencies(Factory factory)
Creates a new dependency tree for the specified factory. |
|
| Method Summary | |
|---|---|
TreeNode |
asTree()
Returns the dependencies as a tree. |
boolean |
isAbridged()
Returns true if only the first node of duplicated factories will be reported. |
boolean |
isAttributeEnabled()
Returns true if attributes are to be printed. |
boolean |
isColorEnabled()
Returns true if syntax coloring is enabled. |
void |
print()
Prints the dependencies as a tree to the standard output stream. |
void |
print(Appendable out)
Prints the dependencies as a tree to the specified writer. |
void |
print(PrintWriter out)
Prints the dependencies as a tree to the specified printer. |
void |
setAbridged(boolean abridged)
Sets whetever the tree should be abridged. |
void |
setAttributeEnabled(boolean enabled)
Enables or disables the addition of attributes after factory names. |
void |
setColorEnabled(boolean enabled)
Enables or disables syntax coloring on ANSI X3.64 (aka ECMA-48 and ISO/IEC 6429) compatible terminal. |
String |
toString()
Returns the string representation of the dependencies tree. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FactoryDependencies(Factory factory)
factory - The factory for which to build a dependency tree.| Method Detail |
|---|
public boolean isColorEnabled()
true if syntax coloring is enabled.
Syntax coloring is disabled by default.
true if syntax coloring is enabled.public void setColorEnabled(boolean enabled)
enabled - true for enabling syntax coloring.public boolean isAttributeEnabled()
true if attributes are to be printed.
By default, attributes are not printed.
true if attributes will be printed.public void setAttributeEnabled(boolean enabled)
crs", "datum", etc. put between
parenthesis. They give indications on the services implemented by the factory
(e.g. CRSAuthorityFactory, DatumAuthorityFactory, etc.).
enabled - true for printing attributes.public boolean isAbridged()
true if only the first node of duplicated factories will be reported.
The default value is false, which means that the full branch will be expanded
on every occurrence of a factory in the dependency graph.
true if only the first node of duplicated factories will be reported,
except for the first occurrence.public void setAbridged(boolean abridged)
true, only the first node of
duplicated factories will be reported (except the first occurrence which is expanded
like usual).
abridged - true for an abridged tree, or false for expanding
every branches unconditionally.public void print()
public void print(PrintWriter out)
out - Where to print the dependencies tree.
public void print(Appendable out)
throws IOException
out - Where to write the dependencies tree.
IOException - if an error occurred while writing to the stream.public TreeNode asTree()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||