Novell exteNd
Director 5.2 API

com.sssw.fw.resource
Class EboResourceElement

java.lang.Object
 |
 +--com.sssw.fw.resource.EboResourceElement
All Implemented Interfaces:
Serializable

public class EboResourceElement
extends Object
implements Serializable

See Also:
Serialized Form

Constructor Summary
EboResourceElement(String resourceSetName, String directoryName, String diskPath, String fileName, byte[] bytes)
           
 
Method Summary
 boolean canPersist()
           
 String getAsJavaPackage()
           
 byte[] getBytes()
          Returns the bytes for the resource.
 Class getClassDef()
           
 Class getClassDef(ClassLoader loader)
           
 String getDirectoryName()
           
 String getDiskPath()
           
 Document getDocument()
          If the resource is an XML document, this method will return a parsed DOM of the resource.
 String getElementString()
          Deprecated. The method does not allow for specification of the encoding, and always assumes UTF8 which may not be proper in all cases. Please get the bytes directly, or the InputStream and do your own conversion to string by specifying the appropriate encoding. This method will be removed in the next version.
 String getFileName()
           
 String getFileNameOnly()
           
 InputStream getInputStream(com.sssw.fw.resource.EbiContext context)
          Returns an input stream to the resource.
 long getLastModified()
           
 String getPath()
           
 String getPrimaryKey()
           
 com.sssw.fw.resource.EboResource getResourceSet()
           
 String getResourceSetName()
           
 Map getSecondaryKeys()
           
 String[] getSecondaryKeys(String secondaryKey)
           
 boolean getTemporary()
           
 String getURL()
           
 String getUUID()
           
 boolean hasDocument()
           
 boolean implementsInterface(Class clazz, String interfaceClass)
           
 boolean implementsInterface(String interfaceClass)
           
 boolean isClass()
           
 boolean isFromDisk()
           
 boolean isFromJar()
           
 boolean isHTML()
           
 boolean isJava()
           
 boolean isJSP()
           
 boolean isTemporary()
           
 boolean isXML()
           
 boolean isXSL()
           
 void setBytes(byte[] bytes)
          Modifies the bytes of the resource.
 void setBytes(String bytes)
          Deprecated. This method does not allow the encoding to be specified and assumes UTF8 which may not be appropriate. Please set the bytes by calling setBytes(byte[]) intead. This method will be removed in the next version.
 void setDirectoryName(String directoryName)
           
 void setDiskPath(String diskPath)
           
 void setDocument(Document document)
          Deprecated. Do not use this method, it will be removed in the next version. Instead, call set bytes, then getDocument(). When using this method, there is no guarantee the document you set will be the document that is returned from getDocument() since that one is looked for in the cache, then if not found, is recreated based on the resource element's content.
 void setFileName(String fileName)
           
 void setJavaPackage(String javaPackage)
           
 void setLastModified(long lastModified)
           
 void setResourceSetName(String resourceSetName)
           
 void setTemporary(boolean temporary)
           
 int size()
           
 String toString()
           
 void updateFrom(EboResourceElement source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EboResourceElement

public EboResourceElement(String resourceSetName,
                          String directoryName,
                          String diskPath,
                          String fileName,
                          byte[] bytes)
Method Detail

implementsInterface

public boolean implementsInterface(String interfaceClass)

implementsInterface

public boolean implementsInterface(Class clazz,
                                   String interfaceClass)

getUUID

public String getUUID()

size

public int size()

updateFrom

public void updateFrom(EboResourceElement source)

getDocument

public Document getDocument()
If the resource is an XML document, this method will return a parsed DOM of the resource. This method returns a DOM from cache if found. As such this DOM should not be modified and the returned document will be read only. If an attempt to modify the the returned document is made, it will fail with a DOMException. If modifications need to be made, a clone of the document must be made, and the close must be operated upon.

To create a clone use this code: Document cloneDoc = (Document) reEl.getDocument().cloneNode(true);

Returns:
Document with the parsed contents of the resource or null if the resource could not be turned into a DOM. The returned document will be read only and should not be modified.

setDocument

public void setDocument(Document document)
Deprecated. Do not use this method, it will be removed in the next version. Instead, call set bytes, then getDocument(). When using this method, there is no guarantee the document you set will be the document that is returned from getDocument() since that one is looked for in the cache, then if not found, is recreated based on the resource element's content.


hasDocument

public boolean hasDocument()

getURL

public String getURL()

getPath

public String getPath()

getPrimaryKey

public String getPrimaryKey()

getSecondaryKeys

public String[] getSecondaryKeys(String secondaryKey)

getSecondaryKeys

public Map getSecondaryKeys()

getResourceSet

public com.sssw.fw.resource.EboResource getResourceSet()

getResourceSetName

public String getResourceSetName()

setResourceSetName

public void setResourceSetName(String resourceSetName)

getDirectoryName

public String getDirectoryName()

setDirectoryName

public void setDirectoryName(String directoryName)

isJava

public boolean isJava()

isJSP

public boolean isJSP()

isClass

public boolean isClass()

getAsJavaPackage

public String getAsJavaPackage()

setJavaPackage

public void setJavaPackage(String javaPackage)

getClassDef

public Class getClassDef()

getClassDef

public Class getClassDef(ClassLoader loader)

isXML

public boolean isXML()

isXSL

public boolean isXSL()

isHTML

public boolean isHTML()

isTemporary

public boolean isTemporary()

getTemporary

public boolean getTemporary()

setTemporary

public void setTemporary(boolean temporary)

getDiskPath

public String getDiskPath()

setDiskPath

public void setDiskPath(String diskPath)

getBytes

public byte[] getBytes()
Returns the bytes for the resource. If the resource has not been modified by calling setBytes(byte[]), then the bytes returned are returned directly from the the resource and are not cached. If the bytes have been set and the resource has not been persisted, then the bytes that were set will be returned. Once the resource is saved however, the set bytes are cleared from memory and the bytes will again come directly from the resource.
Returns:
byte[] that represents the content of the resource.

getInputStream

public InputStream getInputStream(com.sssw.fw.resource.EbiContext context)
                           throws com.sssw.fw.resource.EboUnrecoverableSystemException,
                                  com.sssw.fw.resource.EboSecurityException
Returns an input stream to the resource. If a direct input stream is available, this will be used, or if the bytes have been set by the setBytes(byte[]) method and the resource has not been saved since, the input stream to those bytes will be returned.
Parameters:
context - The context used to retreive the resource's input stream. If null is passed, a dummy context will be used. This can be useful in cases where there is no context available and the resource is a file.
Returns:
InputStream to the resource element.
Throws:
com.sssw.fw.resource.EboUnrecoverableSystemException - thrown if an error which could not be recovered from occurs.
com.sssw.fw.resource.EboSecurityException - thrown if the input stream can not be gotten due to security constraints.
Since:
5.2

setBytes

public void setBytes(String bytes)
Deprecated. This method does not allow the encoding to be specified and assumes UTF8 which may not be appropriate. Please set the bytes by calling setBytes(byte[]) intead. This method will be removed in the next version.

See Also:
EboResourceElement.setBytes(byte[])

setBytes

public void setBytes(byte[] bytes)
Modifies the bytes of the resource. Once this is called, the internal bytes for the resource are set but not persisted. A call to persist() will save the changed bytes and flush the saved byte array from memory.
Parameters:
bytes - The byte array representing the new context of the resource.

setLastModified

public void setLastModified(long lastModified)

getLastModified

public long getLastModified()

setFileName

public void setFileName(String fileName)

getFileName

public String getFileName()

getFileNameOnly

public String getFileNameOnly()

getElementString

public String getElementString()
Deprecated. The method does not allow for specification of the encoding, and always assumes UTF8 which may not be proper in all cases. Please get the bytes directly, or the InputStream and do your own conversion to string by specifying the appropriate encoding. This method will be removed in the next version.

See Also:
EboResourceElement.getBytes(), #getInputStream(com.sssw.fw.api.EbiContext)

isFromJar

public boolean isFromJar()

canPersist

public boolean canPersist()

isFromDisk

public boolean isFromDisk()

toString

public String toString()
Overrides:
toString in class Object

Novell exteNd
Director 5.2 API