Package org.apache.any23.writer
Class WriterFactoryRegistry
- java.lang.Object
-
- org.apache.any23.writer.WriterFactoryRegistry
-
public class WriterFactoryRegistry extends Object
Registry class forWriterFactorys.- Author:
- Michele Mostarda (mostarda@fbk.eu), Hans Brende (hansbrende@apache.org)
-
-
Constructor Summary
Constructors Constructor Description WriterFactoryRegistry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static StringgetIdentifier(WriterFactory writerClass)Reads the identifier specified for the givenWriterFactory.List<String>getIdentifiers()static WriterFactoryRegistrygetInstance()static StringgetMimeType(WriterFactory writerClass)Reads the MIME Type specified for the givenWriterFactory.Collection<String>getMimeTypes()WriterFactorygetWriterByIdentifier(String id)Returns theWriterFactoryidentified byid.FormatWritergetWriterInstanceByIdentifier(String id, OutputStream os)Deprecated.since 2.3.List<WriterFactory>getWriters()Collection<WriterFactory>getWritersByMimeType(String mimeType)Returns all the writers matching the specifiedmimeType.booleanhasIdentifier(String id)Verifies if aWriterFactorywith givenididentifier has been registered.voidregister(WriterFactory f)Registers a newWriterFactoryto the registry.
-
-
-
Method Detail
-
getIdentifier
public static String getIdentifier(WriterFactory writerClass)
Reads the identifier specified for the givenWriterFactory.- Parameters:
writerClass- writer class.- Returns:
- identifier.
-
getMimeType
public static String getMimeType(WriterFactory writerClass)
Reads the MIME Type specified for the givenWriterFactory.- Parameters:
writerClass- writer class.- Returns:
- MIME type.
-
getInstance
public static WriterFactoryRegistry getInstance()
- Returns:
- the
WriterFactoryRegistrysingleton instance.
-
register
public void register(WriterFactory f)
Registers a newWriterFactoryto the registry.- Parameters:
f- the writer factory to be registered.- Throws:
IllegalArgumentException- if the id or the mimetype are null or empty strings or if the identifier has been already defined.
-
hasIdentifier
public boolean hasIdentifier(String id)
Verifies if aWriterFactorywith givenididentifier has been registered.- Parameters:
id- identifier.- Returns:
trueif the identifier has been registered,falseotherwise.
-
getIdentifiers
public List<String> getIdentifiers()
- Returns:
- the list of all the specified identifiers.
-
getMimeTypes
public Collection<String> getMimeTypes()
- Returns:
- the list of MIME types covered by the registered
WriterFactoryinstances.
-
getWriters
public List<WriterFactory> getWriters()
- Returns:
- the list of all the registered
WriterFactoryinstances.
-
getWriterByIdentifier
public WriterFactory getWriterByIdentifier(String id)
Returns theWriterFactoryidentified byid.- Parameters:
id- the writer identifier.- Returns:
- the
WriterFactorymatching theidornullif not found.
-
getWritersByMimeType
public Collection<WriterFactory> getWritersByMimeType(String mimeType)
Returns all the writers matching the specifiedmimeType.- Parameters:
mimeType- a MIMEType.- Returns:
- a list of matching writers or an empty list.
-
getWriterInstanceByIdentifier
@Deprecated public FormatWriter getWriterInstanceByIdentifier(String id, OutputStream os)
Deprecated.since 2.3. UsegetWriterByIdentifier(String)in combination withTripleWriterFactory.getTripleWriter(OutputStream, Settings)instead.Returns an instance ofFormatWriterready to write on the givenOutputStream.- Parameters:
id- the identifier of theFormatWriterto instantiate.os- the output stream.- Returns:
- the not
nullFormatWriterinstance. - Throws:
NullPointerException- if theiddoesn't match any registered writer.
-
-