Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.ide.model
Class DocumentFactory  view DocumentFactory download DocumentFactory.java

java.lang.Object
  extended byjavax.ide.Service
      extended byjavax.ide.model.DocumentFactory

public abstract class DocumentFactory
extends javax.ide.Service

The DocumentFactory interface is responsible for creating intances of Documents.

The type of Document that gets created depends on the java.net.URI that is passed into the findOrCreate(URI) 55 and findOrCreate(MetaClass, URI) 55 methods. The DocumentFactory makes use of registered Recognizer instances to determine what Document class corresponds to a particular java.net.URI.

JSR-198 specifies a number of ways to recognize documents:

For case 1. extension writers need only map a file extension or some part of the URI to a document interface.

For case 2. extension writers can map the XML namespace, doctype, or root element to a document interface.

For case3. extension writers can introduce their own custom Recognizer.

Every Document instance created by the DocumentFactory is cached. An instance of an already created Document can be retrieved from the cache by calling the find(URI) 55 method.


Field Summary
 
Fields inherited from class javax.ide.Service
 
Constructor Summary
DocumentFactory()
           
 
Method Summary
abstract  Document find(java.net.URI uri)
          Find the Document associated with the java.net.URI.
abstract  java.lang.String findDocumentTypeIdentifier(java.lang.Class clazz, boolean useInheritance)
          Find the document type identifier for the given document java.lang.Class.
abstract  Document findOrCreate(javax.ide.util.MetaClass type, java.net.URI uri)
          Returns the Document associated with the java.net.URI.
abstract  Document findOrCreate(java.net.URI uri)
          Returns the Document associated with the java.net.URI.
abstract  java.util.Collection getCachedDocuments()
          Returns a java.util.Collection of the Document instances that are currently cached.
static DocumentFactory getDocumentFactory()
          Get the DocumentFactory implementation for this IDE.
abstract  java.util.Collection getRecognizedDocuments()
          Returns a javax.ide.util.MetaClass collection of recognized documents.
abstract  Document recache(java.net.URI oldURI, java.net.URI newURI, Document document)
          Removes the oldURI from the cache and puts the newURI in the cache so that it is associated with the given Document.
abstract  javax.ide.util.MetaClass recognize(java.net.URI uri)
          Returns the recognized javax.ide.util.MetaClass for a URI.
 
Methods inherited from class javax.ide.Service
getService, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentFactory

public DocumentFactory()
Method Detail

findOrCreate

public abstract Document findOrCreate(java.net.URI uri)
                               throws java.lang.IllegalAccessException,
                                      java.lang.InstantiationException,
                                      java.lang.ClassNotFoundException
Returns the Document associated with the java.net.URI. If the Document does not exist, a new Document is created.


findOrCreate

public abstract Document findOrCreate(javax.ide.util.MetaClass type,
                                      java.net.URI uri)
                               throws java.lang.IllegalAccessException,
                                      java.lang.InstantiationException,
                                      java.lang.ClassNotFoundException
Returns the Document associated with the java.net.URI. If the Document does not exist, a new Document is created.


find

public abstract Document find(java.net.URI uri)
Find the Document associated with the java.net.URI. If the Document does not exist, null is returned.


recache

public abstract Document recache(java.net.URI oldURI,
                                 java.net.URI newURI,
                                 Document document)
Removes the oldURI from the cache and puts the newURI in the cache so that it is associated with the given Document.


getCachedDocuments

public abstract java.util.Collection getCachedDocuments()
Returns a java.util.Collection of the Document instances that are currently cached. The iteration order of the returned collection is not guaranteed.


recognize

public abstract javax.ide.util.MetaClass recognize(java.net.URI uri)
Returns the recognized javax.ide.util.MetaClass for a URI.


getRecognizedDocuments

public abstract java.util.Collection getRecognizedDocuments()
Returns a javax.ide.util.MetaClass collection of recognized documents.


findDocumentTypeIdentifier

public abstract java.lang.String findDocumentTypeIdentifier(java.lang.Class clazz,
                                                            boolean useInheritance)
Find the document type identifier for the given document java.lang.Class. The identifier comes from the document declaration in the Extension Deployment Descriptor.


getDocumentFactory

public static DocumentFactory getDocumentFactory()
Get the DocumentFactory implementation for this IDE.