Package org.apache.any23.writer
Class WriterFactoryRegistry
- java.lang.Object
-
- org.apache.any23.writer.WriterFactoryRegistry
-
public class WriterFactoryRegistry extends Object
Registry class forWriterFactory
s.- 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 String
getIdentifier(WriterFactory writerClass)
Reads the identifier specified for the givenWriterFactory
.List<String>
getIdentifiers()
static WriterFactoryRegistry
getInstance()
static String
getMimeType(WriterFactory writerClass)
Reads the MIME Type specified for the givenWriterFactory
.Collection<String>
getMimeTypes()
WriterFactory
getWriterByIdentifier(String id)
Returns theWriterFactory
identified byid
.FormatWriter
getWriterInstanceByIdentifier(String id, OutputStream os)
Deprecated.since 2.3.List<WriterFactory>
getWriters()
Collection<WriterFactory>
getWritersByMimeType(String mimeType)
Returns all the writers matching the specifiedmimeType
.boolean
hasIdentifier(String id)
Verifies if aWriterFactory
with givenid
identifier has been registered.void
register(WriterFactory f)
Registers a newWriterFactory
to 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
WriterFactoryRegistry
singleton instance.
-
register
public void register(WriterFactory f)
Registers a newWriterFactory
to 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 aWriterFactory
with givenid
identifier has been registered.- Parameters:
id
- identifier.- Returns:
true
if the identifier has been registered,false
otherwise.
-
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
WriterFactory
instances.
-
getWriters
public List<WriterFactory> getWriters()
- Returns:
- the list of all the registered
WriterFactory
instances.
-
getWriterByIdentifier
public WriterFactory getWriterByIdentifier(String id)
Returns theWriterFactory
identified byid
.- Parameters:
id
- the writer identifier.- Returns:
- the
WriterFactory
matching theid
ornull
if 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 ofFormatWriter
ready to write on the givenOutputStream
.- Parameters:
id
- the identifier of theFormatWriter
to instantiate.os
- the output stream.- Returns:
- the not
null
FormatWriter
instance. - Throws:
NullPointerException
- if theid
doesn't match any registered writer.
-
-