Xindice API

org.apache.xindice.client.xmldb.resources
Class XMLResourceImpl

java.lang.Object
  |
  +--org.apache.xindice.client.xmldb.resources.XMLResourceImpl
All Implemented Interfaces:
Resource, XMLResource

public class XMLResourceImpl
extends java.lang.Object
implements XMLResource

XMLResourceImpl provides an implementation to handle XML resources and convert easily between Text, DOM or SAX presentations.

Note: SAX is not yet implemented.


Fields inherited from interface org.xmldb.api.modules.XMLResource
RESOURCE_TYPE
 
Constructor Summary
XMLResourceImpl(java.lang.String id, Collection collection)
          Constructor for the XMLResourceImpl object
XMLResourceImpl(java.lang.String id, Collection collection, java.lang.String content)
          Constructor for the XMLResourceImpl object
XMLResourceImpl(java.lang.String id, Collection collection, SymbolTable syms, byte[] bytes)
          Constructor for the XMLResourceImpl object used in conjunction with Wire Compression
XMLResourceImpl(java.lang.String id, java.lang.String documentId, Collection collection)
          Constructor for the XMLResourceImpl object
XMLResourceImpl(java.lang.String id, java.lang.String documentId, Collection collection, java.lang.String content)
          Constructor for the XMLResourceImpl object
XMLResourceImpl(java.lang.String id, java.lang.String documentId, Collection collection, SymbolTable syms, byte[] bytes)
          Constructor for the XMLResourceImpl object used in conjunction with Wire Compression
 
Method Summary
 java.lang.Object getContent()
          Gets the content of the XMLResourceImpl object
 org.w3c.dom.Node getContentAsDOM()
          Returns the content of the resource as a DOM Node.
 void getContentAsSAX(org.xml.sax.ContentHandler handler)
          getContentAsSAX enables retrieving of the content via the use of a SAX ContentHandler.
 java.lang.String getDocumentId()
          Returns the unique id for the parent document to this Resource or null if the Resource does not have a parent document.
 java.lang.String getId()
          Gets the Id attribute of the XMLResourceImpl object
 Collection getParentCollection()
          Gets the parent Collection instance for this resource
 java.lang.String getResourceType()
          Returns the resource type for this Resource.
 void setContent(java.lang.Object value)
          Sets the Content attribute of the XMLResourceImpl object.
 void setContentAsDOM(org.w3c.dom.Node content)
          Sets the content of the resource from a DOM Node.
 org.xml.sax.ContentHandler setContentAsSAX()
          setContentAsSAX returns a SAX ContentHandler that can be used to set the content of the resource.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLResourceImpl

public XMLResourceImpl(java.lang.String id,
                       Collection collection)
Constructor for the XMLResourceImpl object
Parameters:
id - The unique id associated with this resource
collection - the parent collection for the resource

XMLResourceImpl

public XMLResourceImpl(java.lang.String id,
                       java.lang.String documentId,
                       Collection collection)
Constructor for the XMLResourceImpl object
Parameters:
id - The unique id associated with this resource
documentId - The parent document id associated with this resource
collection - the parent collection for the resource

XMLResourceImpl

public XMLResourceImpl(java.lang.String id,
                       Collection collection,
                       java.lang.String content)
Constructor for the XMLResourceImpl object
Parameters:
id - The unique id associated with this resource
collection - the parent collection for the resource
content - the content to associate with the resource

XMLResourceImpl

public XMLResourceImpl(java.lang.String id,
                       java.lang.String documentId,
                       Collection collection,
                       java.lang.String content)
Constructor for the XMLResourceImpl object
Parameters:
id - The unique id associated with this resource
documentId - The parent document id associated with this resource
collection - the parent collection for the resource
content - the content to associate with the resource

XMLResourceImpl

public XMLResourceImpl(java.lang.String id,
                       java.lang.String documentId,
                       Collection collection,
                       SymbolTable syms,
                       byte[] bytes)
Constructor for the XMLResourceImpl object used in conjunction with Wire Compression
Parameters:
id - The unique id associated with this resource
collection - the parent collection for the resource
bytes - the content to associate with the resource

XMLResourceImpl

public XMLResourceImpl(java.lang.String id,
                       Collection collection,
                       SymbolTable syms,
                       byte[] bytes)
Constructor for the XMLResourceImpl object used in conjunction with Wire Compression
Parameters:
id - The unique id associated with this resource
collection - the parent collection for the resource
bytes - the content to associate with the resource
Method Detail

getDocumentId

public java.lang.String getDocumentId()
                               throws XMLDBException
Returns the unique id for the parent document to this Resource or null if the Resource does not have a parent document.
Specified by:
getDocumentId in interface XMLResource
Returns:
the id for the parent document of this Resource or null if there is no parent document for this Resource.
Throws:
XMLDBException -  

setContent

public void setContent(java.lang.Object value)
                throws XMLDBException
Sets the Content attribute of the XMLResourceImpl object. The value being set must be well formed XML text.
Specified by:
setContent in interface Resource
Parameters:
value - The new Content value
Throws:
XMLDBException -  

setContentAsDOM

public void setContentAsDOM(org.w3c.dom.Node content)
                     throws XMLDBException
Sets the content of the resource from a DOM Node.
Specified by:
setContentAsDOM in interface XMLResource
Parameters:
content - Node containing the new content.
Throws:
XMLDBException -  

setContentAsSAX

public org.xml.sax.ContentHandler setContentAsSAX()
                                           throws XMLDBException
setContentAsSAX returns a SAX ContentHandler that can be used to set the content of the resource.
Specified by:
setContentAsSAX in interface XMLResource
Returns:
The ContentHandler that is used to insert data into the database.
Throws:
XMLDBException -  

getParentCollection

public Collection getParentCollection()
                               throws XMLDBException
Gets the parent Collection instance for this resource
Specified by:
getParentCollection in interface Resource
Returns:
The ParentCollection value
Throws:
XMLDBException -  

getResourceType

public java.lang.String getResourceType()
                                 throws XMLDBException
Returns the resource type for this Resource.

XML:DB defined resource types are:

XMLResource - all XML data stored in the database
BinaryResource - Binary blob data stored in the database

Specified by:
getResourceType in interface Resource
Returns:
the resource type for the Resource.
Throws:
XMLDBException -  

getId

public java.lang.String getId()
                       throws XMLDBException
Gets the Id attribute of the XMLResourceImpl object
Specified by:
getId in interface Resource
Returns:
The Id value
Throws:
XMLDBException -  

getContent

public java.lang.Object getContent()
                            throws XMLDBException
Gets the content of the XMLResourceImpl object
Specified by:
getContent in interface Resource
Returns:
The Content value
Throws:
XMLDBException -  

getContentAsDOM

public org.w3c.dom.Node getContentAsDOM()
                                 throws XMLDBException
Returns the content of the resource as a DOM Node.
Specified by:
getContentAsDOM in interface XMLResource
Returns:
The content as a DOM node
Throws:
XMLDBException -  

getContentAsSAX

public void getContentAsSAX(org.xml.sax.ContentHandler handler)
                     throws XMLDBException
getContentAsSAX enables retrieving of the content via the use of a SAX ContentHandler.
Specified by:
getContentAsSAX in interface XMLResource
Parameters:
handler - The ContentHandler to use.
Throws:
XMLDBException -  

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation