Class DescriptorSourceFactory
- java.lang.Object
-
- org.torproject.descriptor.DescriptorSourceFactory
-
public final class DescriptorSourceFactory extends java.lang.ObjectFactory for descriptor sources which in turn produce descriptors.Descriptor sources are the only producers of classes implementing the
Descriptorsuperinterface. There exist descriptor sources for obtaining remote descriptor data (DescriptorCollector) and descriptor sources for processing local descriptor data (DescriptorReaderandDescriptorParser).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.collectordescriptor.parserdescriptor.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.StringCOLLECTOR_DEFAULTDefault implementation of theDescriptorCollectordescriptor source.static java.lang.StringCOLLECTOR_PROPERTYProperty name for overriding the implementation of theDescriptorCollectordescriptor source, which is by default set to the class inCOLLECTOR_DEFAULT.static java.lang.StringPARSER_DEFAULTDefault implementation of theDescriptorParserdescriptor source.static java.lang.StringPARSER_PROPERTYProperty name for overriding the implementation of theDescriptorParserdescriptor source, which is by default set to the class inPARSER_DEFAULT.static java.lang.StringREADER_DEFAULTDefault implementation of theDescriptorReaderdescriptor source.static java.lang.StringREADER_PROPERTYProperty name for overriding the implementation of theDescriptorReaderdescriptor 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 DescriptorCollectorcreateDescriptorCollector()Create a newDescriptorCollectorby instantiating the class inCOLLECTOR_PROPERTY.static DescriptorParsercreateDescriptorParser()Create a newDescriptorParserby instantiating the class inPARSER_PROPERTY.static DescriptorReadercreateDescriptorReader()Create a newDescriptorReaderby instantiating the class inREADER_PROPERTY.
-
-
-
Field Detail
-
PARSER_DEFAULT
public static final java.lang.String PARSER_DEFAULT
Default implementation of theDescriptorParserdescriptor source.- Since:
- 1.0.0
- See Also:
- Constant Field Values
-
READER_DEFAULT
public static final java.lang.String READER_DEFAULT
Default implementation of theDescriptorReaderdescriptor source.- Since:
- 1.0.0
- See Also:
- Constant Field Values
-
COLLECTOR_DEFAULT
public static final java.lang.String COLLECTOR_DEFAULT
Default implementation of theDescriptorCollectordescriptor 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 theDescriptorParserdescriptor 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 theDescriptorReaderdescriptor 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 theDescriptorCollectordescriptor 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 newDescriptorParserby instantiating the class inPARSER_PROPERTY.- Since:
- 1.0.0
-
createDescriptorReader
public static DescriptorReader createDescriptorReader()
Create a newDescriptorReaderby instantiating the class inREADER_PROPERTY.- Since:
- 1.0.0
-
createDescriptorCollector
public static DescriptorCollector createDescriptorCollector()
Create a newDescriptorCollectorby instantiating the class inCOLLECTOR_PROPERTY.- Since:
- 1.0.0
-
-