oracle.ifs.beans
Class LibraryObject


java.lang.Object

  |

  +--oracle.ifs.beans.LibraryObject

All Implemented Interfaces:
IfsEventHandler, LibraryObjectInterface, Traceable
Direct Known Subclasses:
TieLibraryObject

public abstract class LibraryObject
extends java.lang.Object
implements IfsEventHandler, LibraryObjectInterface

The LibraryObject class is the base class for all persistent Internet File System objects. Functionality common to all such classes is provided by this class.

See Also:
LibraryObjectDefinition

Method Summary
 boolean equals(LibraryObject item)
          Compares whether two LibraryObjects are the same IFS object.
 void free()
          Permanently deletes this object.
 void free(LibraryObjectDefinition def)
          Permanently removes this object from the repository, with options.
 AttributeValue getAttribute(java.lang.String attr_name)
          Returns an AttributeValue object that holds the value of the requested attribute.
 AttributeValue getAttributeByUpperCaseName(java.lang.String attr_name)
          Returns the attribute value for the specified attribute.
 AttributeValue[] getAttributes(java.lang.String[] attrNames)
          Returns an array of AttributeValue objects that holds the values of the requested attributes.
 AttributeValue[] getAttributesByUpperCaseNames(java.lang.String[] attrNames)
          Returns an array of AttributeValue objects that holds the values of the requested attributes.
 java.lang.Long getClassId()
          Return this object's Class Id.
 ClassObject getClassObject()
          Returns this object's class.
 LibraryObjectDefinition getDefinition()
          Creates a LibraryObjectDefinition which represents this object.
 java.lang.Long getId()
          Returns this object's ID (as a Long).
 java.lang.String getLabel()
          Returns the Label for this object, based on the object's name.
 java.lang.String getName()
          Returns the Name of this object, or null of this object does not have a NAME attribute.
 LibrarySession getSession()
          Returns the LibrarySession in which this object was instantiated.
 void handleEvent(IfsEvent event)
          Handles the specified event.
protected  boolean hasNameAttribute()
          Returns true if this object is an instance of a class that has a NAME attribute, and false otherwise.
 java.io.Serializable invokeServerMethod(java.lang.String methodName, java.io.Serializable payload)
          Invokes a custom server-side method.
 boolean isInstanceOf(ClassObject clss)
          Determine if this is an instance of the specified ClassObject.
 boolean isTraced(int channel, int level)
          Gets whether tracing is enabled for the specified channel and level.
 java.lang.String lookupInstanceLabel()
          Lookup the InstanceLabel for this object, and return null if no value is defined.
 void postEvent(int eventType, int eventStatus)
          Posts an event of the specified type and status.
 void postEvent(int eventType, int eventSubtype, int eventStatus, long longPayload)
          Posts an event of the specified type, subtype, and status.
 java.io.Reader renderAsReader(java.lang.String rendererType, java.lang.String rendererName, java.util.Hashtable options)
          Renders this LibraryObject as a Reader.
 java.io.InputStream renderAsStream(java.lang.String rendererType, java.lang.String rendererName, java.util.Hashtable options)
          Renders this LibraryObject as an InputStream.
 void setAttribute(AttributeValue attr_value)
          Set this object's attribute to the specified value.
 void setAttribute(java.lang.String attr_name, AttributeValue attr_value)
          Set this object's attribute to the specified value.
 void setAttributes(AttributeValue[] attr_values)
          Set this object's attributes to the specified values.
 void setAttributes(java.lang.String[] attr_names, AttributeValue[] values)
          Set the values for a list of Attributes in the database.
 void setName(java.lang.String name)
          Set the Name of this object.
 java.lang.String toString()
          returns the Name of this object, or null of the object does not have a NAME attribute.
 void trace(int channel, int level, java.lang.String payload)
          Issues a trace request to the trace logger.
 void update(LibraryObjectDefinition def)
          Updates this object from the attributes and options set in the specified LibraryObjectDefinition.
 

Method Detail


getName


public java.lang.String getName()
                         throws IfsException
Returns the Name of this object, or null of this object does not have a NAME attribute.
Returns:
the name of this object.
Throws:
IfsException - if operation fails.

hasNameAttribute


protected boolean hasNameAttribute()
                            throws IfsException
Returns true if this object is an instance of a class that has a NAME attribute, and false otherwise.
Returns:
true if the object has a NAME attribute.
Throws:
IfsException - if operation fails.

getLabel


public java.lang.String getLabel()
                          throws IfsException
Returns the Label for this object, based on the object's name. This is overridden by ClassObject and Attribute to return the ClassObjectLabel and AttributeLabel (respectively) strings from the Localizer, so that these names can be localized. For all other objects this method is invoked, which looks up the InstanceLabel in the Localizer and returns the localized value or simply the name if no localized label is defined.
Returns:
the label for this object.
Throws:
IfsException - if operation fails.

lookupInstanceLabel


public java.lang.String lookupInstanceLabel()
                                     throws IfsException
Lookup the InstanceLabel for this object, and return null if no value is defined.
Returns:
the InstanceLabel for this object.
Throws:
IfsException - if operation fails.

toString


public java.lang.String toString()
returns the Name of this object, or null of the object does not have a NAME attribute.
Overrides:
toString in class java.lang.Object
Returns:
the name of this object.

setName


public void setName(java.lang.String name)
             throws IfsException
Set the Name of this object. Does nothing if this object does not have a NAME attribute
Parameters:
name - the name of this object.
Throws:
IfsException - if operation fails.

getAttribute


public final AttributeValue getAttribute(java.lang.String attr_name)
                                  throws IfsException
Returns an AttributeValue object that holds the value of the requested attribute.
Parameters:
attr_name - the name of the Attribute
Returns:
the requested AttributeValue
Throws:
IfsException - if operation fails.

getAttributeByUpperCaseName


public final AttributeValue getAttributeByUpperCaseName(java.lang.String attr_name)
                                                 throws IfsException
Returns the attribute value for the specified attribute. The attribute name must be UPPER CASE. This method is slightly faster as it does not automatically call toUpperCase on the attribute name.
Parameters:
attr_name - the attribute name; must be all upper case
Returns:
the AttributeValue
Throws:
IfsException - if the operation fails

getAttributes


public AttributeValue[] getAttributes(java.lang.String[] attrNames)
                               throws IfsException
Returns an array of AttributeValue objects that holds the values of the requested attributes.
Parameters:
attr_names - the names of the Attributes
Returns:
the requested array of AttributeValues
Throws:
IfsException - if operation fails.

getAttributesByUpperCaseNames


public AttributeValue[] getAttributesByUpperCaseNames(java.lang.String[] attrNames)
                                               throws IfsException
Returns an array of AttributeValue objects that holds the values of the requested attributes.
Parameters:
attrNames - the names of the Attributes; must be all upper case
Returns:
the requested array of AttributeValues
Throws:
IfsException - if operation fails.

setAttribute


public void setAttribute(java.lang.String attr_name,
                         AttributeValue attr_value)
                  throws IfsException
Set this object's attribute to the specified value. This variant will set the attribute's name in the AttributeValue to the name argument provided.
Parameters:
attr_name - the name of the Attribute
attr_value - the desired value of the Attribute
Throws:
IfsException - if operation fails.

setAttribute


public void setAttribute(AttributeValue attr_value)
                  throws IfsException
Set this object's attribute to the specified value. The name of the attribute must have been set in the AttributeValue.
Parameters:
attr_value - the desired name & value of the Attribute
Throws:
IfsException - if operation fails.

setAttributes


public void setAttributes(java.lang.String[] attr_names,
                          AttributeValue[] values)
                   throws IfsException
Set the values for a list of Attributes in the database. Use this variant when your AttributeValues don't have their names set. You must provide the names in a separate String array.
Parameters:
attr_name - the names of the Attributes
values - the desired values of the Attributes
Throws:
IfsException - if operation fails.

setAttributes


public void setAttributes(AttributeValue[] attr_values)
                   throws IfsException
Set this object's attributes to the specified values. Each AttributeValue must have its name set. This variant is slightly more efficient then the one that takes the attribute names in a seperate String array.
Parameters:
attr_values - the desired name & values of the Attributes
Throws:
IfsException - if operation fails.

update


public void update(LibraryObjectDefinition def)
            throws IfsException
Updates this object from the attributes and options set in the specified LibraryObjectDefinition.
Parameters:
def - the LibraryObjectDefinition describing the desired updates.
Throws:
IfsException - if operation fails.

invokeServerMethod


public java.io.Serializable invokeServerMethod(java.lang.String methodName,
                                               java.io.Serializable payload)
                                        throws IfsException
Invokes a custom server-side method. The payload and return are arbitrary Serializable objects. There must be a method with the specified name on the server-side Java class that maps to the target instance.
Parameters:
methodName - the method name.
payload - the method argument
Returns:
the method result
Throws:
IfsException - if operation fails.

renderAsStream


public java.io.InputStream renderAsStream(java.lang.String rendererType,
                                          java.lang.String rendererName,
                                          java.util.Hashtable options)
                                   throws IfsException
Renders this LibraryObject as an InputStream.

The rendererType and rendererName together determine which Renderer implementation is to be used as follows:

If rendererName is not null, the Policy named rendererName for the operation specified by rendererType is obtained. The fully-qualified classname of the Renderer is contained in the IMPLEMENTATION attribute of that Policy.

If rendererName is null, the default Policy for this LibraryObject for the operation specified by rendererType is obtained. The fully- qualified classname of the Renderer is contained in the IMPLEMENTATION attribute of that Policy.

The values in the options Hashtable must be serializable.

Parameters:
rendererType - the type of the desired Renderer
rendererName - the name of the desired Renderer
options - any Renderer-specific options
Returns:
the InputStream
Throws:
IfsException - (IFS-30110) if the operation fails

renderAsReader


public java.io.Reader renderAsReader(java.lang.String rendererType,
                                     java.lang.String rendererName,
                                     java.util.Hashtable options)
                              throws IfsException
Renders this LibraryObject as a Reader.

The rendererType and rendererName together determine which Renderer implementation is to be used as follows:

If rendererName is not null, the Policy named rendererName for the operation specified by rendererType is obtained. The fully-qualified classname of the Renderer is contained in the IMPLEMENTATION attribute of that Policy.

If rendererName is null, the default Policy for this LibraryObject for the operation specified by rendererType is obtained. The fully- qualified classname of the Renderer is contained in the IMPLEMENTATION attribute of that Policy.

The values in the options Hashtable must be serializable.

Parameters:
rendererType - the type of the desired Renderer
rendererName - the name of the desired Renderer
options - any Renderer-specific options
Returns:
the Reader
Throws:
IfsException - (IFS-30110) if the operation fails

getSession


public LibrarySession getSession()
                          throws IfsException
Returns the LibrarySession in which this object was instantiated.
Returns:
the LibrarySession in which this object was instantiated.

equals


public boolean equals(LibraryObject item)
               throws IfsException
Compares whether two LibraryObjects are the same IFS object. The comparison returns true only if the specified object is not null and only if both objects refer to an object that is not freed.
Returns:
true if the objects have the same Id.
Throws:
IfsException - if operation fails.

getClassObject


public ClassObject getClassObject()
                           throws IfsException
Returns this object's class.
Returns:
this object's class
Throws:
IfsException - if operation fails.

free


public void free()
          throws IfsException
Permanently deletes this object.
Throws:
IfsException - if operation fails.

free


public void free(LibraryObjectDefinition def)
          throws IfsException
Permanently removes this object from the repository, with options.
Throws:
IfsException - if operation fails.

getId


public java.lang.Long getId()
                     throws IfsException
Returns this object's ID (as a Long).
Specified by:
getId in interface LibraryObjectInterface
Returns:
this object's Long Id.
Throws:
IfsException - if operation fails.

getClassId


public java.lang.Long getClassId()
                          throws IfsException
Return this object's Class Id.
Returns:
this object's Class Id.

getDefinition


public LibraryObjectDefinition getDefinition()
                                      throws IfsException
Creates a LibraryObjectDefinition which represents this object. This method is generally used to allow a new object to be created based on this object. Because of that, attributes that should not be propigated (e.g., CREATEDATE) are not represented in the returned definition.
Returns:
a LibraryObjectDefinition which represents this object
Throws:
IfsException - if operation fails.

isInstanceOf


public boolean isInstanceOf(ClassObject clss)
                     throws IfsException
Determine if this is an instance of the specified ClassObject.
Returns:
true if this is an instance of the specified ClassObject.
Throws:
IfsException - if operation fails.

isTraced


public final boolean isTraced(int channel,
                              int level)
                       throws IfsException
Gets whether tracing is enabled for the specified channel and level.
Specified by:
isTraced in interface Traceable
Parameters:
channel - the channel number
level - the level
Returns:
whether tracing is enabled
Throws:
IfsException - (IFS-11201) if the channel is invalid

trace


public final void trace(int channel,
                        int level,
                        java.lang.String payload)
Issues a trace request to the trace logger.
Specified by:
trace in interface Traceable
Parameters:
channel - the channel number
level - the level
payload - a string containing any additional information to be placed in the trace log

postEvent


public final void postEvent(int eventType,
                            int eventStatus)
                     throws IfsException
Posts an event of the specified type and status.
Parameters:
eventType - the event type; must be one of the event type constants enumerated in IfsEvent
eventStatus - the event status; must be one of the event status constants enumerated in IfsEvent
Throws:
IfsException - if the operation fails

postEvent


public final void postEvent(int eventType,
                            int eventSubtype,
                            int eventStatus,
                            long longPayload)
                     throws IfsException
Posts an event of the specified type, subtype, and status.
Parameters:
eventType - the event type; must be one of the event type constants enumerated in IfsEvent
eventSubtype - the event subtype; the meaningful values are eventType variant
eventStatus - the event status; must be one of the event status constants enumerated in IfsEvent
longPayload - the long payload; the meaningful values are eventType variant
Throws:
IfsException - if the operation fails

handleEvent


public void handleEvent(IfsEvent event)
                 throws IfsException
Handles the specified event.
Specified by:
handleEvent in interface IfsEventHandler
Parameters:
event - the event
Throws:
IfsException - if the operation fails