Class DescriptorSourceFactory
- java.lang.Object
-
- org.torproject.descriptor.DescriptorSourceFactory
-
public final class DescriptorSourceFactory extends java.lang.Object
Factory for descriptor sources which in turn produce descriptors.Descriptor sources are the only producers of classes implementing the
Descriptor
superinterface. There exist descriptor sources for obtaining remote descriptor data (DescriptorCollector
) and descriptor sources for processing local descriptor data (DescriptorReader
andDescriptorParser
).By default, this factory returns implementations from the library's own impl package. This may be overridden by setting Java properties, though most users will simply use the default implementations.
These properties can be used for setting the implementation:
descriptor.collector
descriptor.parser
descriptor.reader
Assuming the classpath contains the special implementation referenced, your application classes as well as a descriptor API jar the following is an example for using a different implementation of the descriptor downloader:
java -Ddescriptor.downloader=my.special.descriptorimpl.Downloader \ my.app.Mainclass
- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COLLECTOR_DEFAULT
Default implementation of theDescriptorCollector
descriptor source.static java.lang.String
COLLECTOR_PROPERTY
Property name for overriding the implementation of theDescriptorCollector
descriptor source, which is by default set to the class inCOLLECTOR_DEFAULT
.static java.lang.String
PARSER_DEFAULT
Default implementation of theDescriptorParser
descriptor source.static java.lang.String
PARSER_PROPERTY
Property name for overriding the implementation of theDescriptorParser
descriptor source, which is by default set to the class inPARSER_DEFAULT
.static java.lang.String
READER_DEFAULT
Default implementation of theDescriptorReader
descriptor source.static java.lang.String
READER_PROPERTY
Property name for overriding the implementation of theDescriptorReader
descriptor source, which is by default set to the class inREADER_DEFAULT
.
-
Constructor Summary
Constructors Constructor Description DescriptorSourceFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DescriptorCollector
createDescriptorCollector()
Create a newDescriptorCollector
by instantiating the class inCOLLECTOR_PROPERTY
.static DescriptorParser
createDescriptorParser()
Create a newDescriptorParser
by instantiating the class inPARSER_PROPERTY
.static DescriptorReader
createDescriptorReader()
Create a newDescriptorReader
by instantiating the class inREADER_PROPERTY
.
-
-
-
Field Detail
-
PARSER_DEFAULT
public static final java.lang.String PARSER_DEFAULT
Default implementation of theDescriptorParser
descriptor source.- Since:
- 1.0.0
- See Also:
- Constant Field Values
-
READER_DEFAULT
public static final java.lang.String READER_DEFAULT
Default implementation of theDescriptorReader
descriptor source.- Since:
- 1.0.0
- See Also:
- Constant Field Values
-
COLLECTOR_DEFAULT
public static final java.lang.String COLLECTOR_DEFAULT
Default implementation of theDescriptorCollector
descriptor source.- Since:
- 1.0.0
- See Also:
- Constant Field Values
-
PARSER_PROPERTY
public static final java.lang.String PARSER_PROPERTY
Property name for overriding the implementation of theDescriptorParser
descriptor source, which is by default set to the class inPARSER_DEFAULT
.- Since:
- 1.0.0
- See Also:
- Constant Field Values
-
READER_PROPERTY
public static final java.lang.String READER_PROPERTY
Property name for overriding the implementation of theDescriptorReader
descriptor source, which is by default set to the class inREADER_DEFAULT
.- Since:
- 1.0.0
- See Also:
- Constant Field Values
-
COLLECTOR_PROPERTY
public static final java.lang.String COLLECTOR_PROPERTY
Property name for overriding the implementation of theDescriptorCollector
descriptor source, which is by default set to the class inCOLLECTOR_DEFAULT
.- Since:
- 1.0.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
createDescriptorParser
public static DescriptorParser createDescriptorParser()
Create a newDescriptorParser
by instantiating the class inPARSER_PROPERTY
.- Since:
- 1.0.0
-
createDescriptorReader
public static DescriptorReader createDescriptorReader()
Create a newDescriptorReader
by instantiating the class inREADER_PROPERTY
.- Since:
- 1.0.0
-
createDescriptorCollector
public static DescriptorCollector createDescriptorCollector()
Create a newDescriptorCollector
by instantiating the class inCOLLECTOR_PROPERTY
.- Since:
- 1.0.0
-
-