|
Project JXTA | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.jxta.util.ClassFactory
|
+--net.jxta.document.StructuredDocumentFactory
A factory for constructing instances of StructuredDocument.
Behind the scenes, it also provides for the registration of the mime-types
and constructors needed to accomplish the construction. All supported
mime-types will need to register their implementation in this factory.
The configuration is done via the property net.jxta.impl.config.StructuredDocumentInstanceTypes
Document,
StructuredTextDocument,
StructuredDocument,
MimeMediaType| Inner Class Summary | |
static interface |
StructuredDocumentFactory.Instantiator
Interface for instantiators of StructuredDocuments |
static interface |
StructuredDocumentFactory.TextInstantiator
Interface for instantiators of StructuredTextDocuments |
| Method Summary | |
protected java.util.Hashtable |
getAssocTable()
Used by ClassFactory methods to get the mapping of Mime Types to constructors. |
protected java.lang.Class |
getClassForKey()
Used by ClassFactory methods to ensure that all keys used with the mapping are of the correct type. |
protected java.lang.Class |
getClassOfInstantiators()
Used by ClassFactory methods to ensure that all of the instantiators which are registered with this factory have the correct interface. |
static java.lang.String |
getFileExtensionForMimeType(MimeMediaType mimetype)
Returns the prefered extension for a given mime-type. |
static MimeMediaType |
getMimeTypeForFileExtension(java.lang.String extension)
Returns the prefered mime-type for a given file extension. |
static StructuredDocument |
newStructuredDocument(MimeMediaType mimetype,
java.io.InputStream stream)
Constructs an instance of StructuredDocument matching
the mime-type specified by the mimetype parameter. |
static StructuredDocument |
newStructuredDocument(MimeMediaType mimetype,
java.io.Reader reader)
Constructs an instance of StructuredDocument matching
the mime-type specified by the mimetype parameter. |
static StructuredDocument |
newStructuredDocument(MimeMediaType mimetype,
java.lang.String doctype)
Constructs an instance of StructuredDocument matching
the mime-type specified by the mimetype parameter. |
static StructuredDocument |
newStructuredDocument(MimeMediaType mimetype,
java.lang.String doctype,
java.lang.String value)
Constructs an instance of StructuredDocument matching
the mime-type specified by the mimetype parameter. |
protected boolean |
registerAssoc(java.lang.String className)
Register a class with the factory from its class name. |
static boolean |
registerInstantiator(MimeMediaType mimetype,
StructuredDocumentFactory.Instantiator instantiator)
Register an instantiator object a mime-type of documents to be constructed. |
| Methods inherited from class net.jxta.util.ClassFactory |
getAvailableKeys, getInstantiator, registerAssoc, registerFromResources, registerFromString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
protected java.util.Hashtable getAssocTable()
getAssocTable in class ClassFactoryprotected java.lang.Class getClassForKey()
getClassForKey in class ClassFactoryprotected java.lang.Class getClassOfInstantiators()
getClassOfInstantiators in class ClassFactoryprotected boolean registerAssoc(java.lang.String className)
registerAssoc in class ClassFactoryclassName - The class name which will be regiestered.public static java.lang.String getFileExtensionForMimeType(MimeMediaType mimetype)
mimetype - the MimeMediaType we wish to know the file extension for.public static MimeMediaType getMimeTypeForFileExtension(java.lang.String extension)
extension - The extension we wish to know the mime-type for.
public static boolean registerInstantiator(MimeMediaType mimetype,
StructuredDocumentFactory.Instantiator instantiator)
mimetype - the mime-type associated.instantiator - the instantiator that wants to be registered..java.lang.SecurityException - there were permission problems registering
the instantiator.
public static StructuredDocument newStructuredDocument(MimeMediaType mimetype,
java.lang.String doctype)
StructuredDocument matching
the mime-type specified by the mimetype parameter. The
doctype parameter identifies the base type of the
StructuredDocument.mimetype - Specifies the mime media type to be associated with
the StructuredDocument to be created.doctype - Specifies the root type of the StructuredDocument
to be created.StructuredDocument
or null if it could not be created.NoSuchElementException - invalid mime-media-type
public static StructuredDocument newStructuredDocument(MimeMediaType mimetype,
java.lang.String doctype,
java.lang.String value)
StructuredDocument matching
the mime-type specified by the mimetype parameter. The
doctype parameter identifies the base type of the
StructuredDocument. Value supplies a value for the root
element.mimetype - Specifies the mime media type to be associated with
the StructuredDocument to be created.doctype - Specifies the root type of the StructuredDocument
to be created.value - Specifies a value for the root element.StructuredDocument
or null if it could not be created.NoSuchElementException - if the mime-type has not been registerd.
public static StructuredDocument newStructuredDocument(MimeMediaType mimetype,
java.io.InputStream stream)
throws java.io.IOException
StructuredDocument matching
the mime-type specified by the mimetype parameter. The
doctype parameter identifies the base type of the
StructuredDocument.mimetype - Specifies the mime media type to be associated with the
StructuredDocument to be created.stream - Contains an InputStream from which the document will be
constructed.StructuredDocument
or null if it could not be created.java.io.IOException - If there is a problem reading from the stream.NoSuchElementException - if the mime-type has not been registerd.
public static StructuredDocument newStructuredDocument(MimeMediaType mimetype,
java.io.Reader reader)
throws java.io.IOException
StructuredDocument matching
the mime-type specified by the mimetype parameter. The
doctype parameter identifies the base type of the
StructuredDocument.mimetype - Specifies the mime media type to be associated with the
StructuredDocument to be created.reader - A Reader from which the document will be constructed.StructuredDocument
or null if it could not be created.java.io.IOException - If there is a problem reading from the stream.NoSuchElementException - if the mime-type has not been registerd.java.lang.UnsupportedOperationException - if the mime-type provided is not
a text oriented mimetype.
|
Project JXTA | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||