com.infoengine.SAK
Class Webject

java.lang.Object
  extended by com.infoengine.object.factory.Webject
      extended by com.infoengine.SAK.Webject
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
DisplayWebject, ExternalWebject, GroupWebject, ManagementWebject, ObjectWebject

public class Webject
extends Webject

This class provides methods to construct and execute webjects of any type in applications and JSP pages. This is the base class for other classes that are used to construct specific types of webjects.

Version:
1.0 2/19/2000
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.infoengine.object.factory.Webject
CLASS, DISPLAY, EXTERNAL, GROUP, GROUP_IN, GROUP_OUT, MESSAGE, OBJECT, OUTPUT, TASK, text, TYPE, UNKNOWN
 
Constructor Summary
Webject()
          Constructs a webject with no name or type.
Webject(java.lang.String name)
          Constructs a webject with a specific name but no type.
Webject(java.lang.String name, java.lang.String type)
          Constructs a webject with a specific name and type.
Webject(java.lang.String name, java.lang.String type, IeService service)
          Constructs a webject with a specific name, type, and server context.
 
Method Summary
 void addParam(java.lang.String name, java.lang.String value)
          Adds a parameter with a specific name and value to the webject.
 IeMultipartInputStream getInputStream()
          Returns the input stream currently associated with the webject.
 java.io.OutputStream getOutputStream()
          Returns the output stream currently associated with this webject.
static Webject getProcessor(java.lang.String type)
          Create a webject processor instance of a specified webject type.
static java.lang.String getProcessorClassName(java.lang.String type)
          Determines the name of the subclass that processes webjects of a specified type.
 IeService getService()
          Returns the server context currently associated with this webject.
 void invoke()
          Invokes the webject in the server context.
 void invoke(Task task)
          Invokes the webject in the server context using a specified task object.
static void run(java.util.Vector webjects)
          Runs a set of webjects, each in its own thread, and waits for all of them to complete.
 void setInputStream(IeMultipartInputStream is)
          Sets the input stream from which the webject can read BLOB data.
 void setInputStream(java.io.InputStream is, java.lang.String contentType, java.lang.String name, java.lang.String filename)
          Sets the input stream from which the webject can read BLOB data.
 void setInputStream(javax.servlet.ServletRequest request)
          Sets the input stream from which the webject can read BLOB data.
 void setOutputStream(java.io.OutputStream os)
          Sets the output stream associated with this webject.
 void setOutputStream(java.io.Writer writer)
          Sets the output stream associated with this webject.
 void setParam(java.lang.String name, java.lang.String value)
          Sets a new value for a specific parameter of the webject.
 void setService(IeService service)
          Sets the server context associated with this webject.
 
Methods inherited from class com.infoengine.object.factory.Webject
addKey, addMessage, addMeta, addMetaValue, addOutput, addParam, addUniqueKey, addUniqueValue, addValue, addValue, addWebject, clearParams, clone, deepClone, getClassName, getDefinition, getGroupInName, getGroupInNames, getGroupOutName, getGroupOutNames, getKey, getKeys, getMessages, getMetaValue, getName, getNode, getOutput, getParam, getParamNames, getParams, getPassword, getType, getUserName, getValue, getValues, getWebjects, objectParamValue, objectParamValue, paramValue, paramValue, paramValues, printTree, removeAllWebjects, removeParam, removeParams, removeWebject, setClassName, setName, setParam, setPassword, setType, setUserName, setValue, toString, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Webject

public Webject()
Constructs a webject with no name or type.


Webject

public Webject(java.lang.String name)
Constructs a webject with a specific name but no type.

Parameters:
name - The name to be assigned to the webject.

Webject

public Webject(java.lang.String name,
               java.lang.String type)
Constructs a webject with a specific name and type.

Parameters:
name - The name to be assigned to the webject.
type - The type to be assigned to the webject.

Webject

public Webject(java.lang.String name,
               java.lang.String type,
               IeService service)
Constructs a webject with a specific name, type, and server context.

Parameters:
name - The name to be assigned to the webject.
type - The type to be assigned to the webject.
service - The server context to be assigned to the webject.
Method Detail

setService

public void setService(IeService service)
Sets the server context associated with this webject.

Parameters:
service - The new server context.

getService

public IeService getService()
Returns the server context currently associated with this webject.

Returns:
The webject's current server context.

setInputStream

public void setInputStream(java.io.InputStream is,
                           java.lang.String contentType,
                           java.lang.String name,
                           java.lang.String filename)
                    throws java.io.IOException
Sets the input stream from which the webject can read BLOB data.

Parameters:
is - The input stream.
contentType - The MIME content type associated with the stream.
name - The form variable name, if any, associated with the stream.
filename - The file name, if any, associated with the stream.
Throws:
java.io.IOException - if the input stream can not be set.

setInputStream

public void setInputStream(javax.servlet.ServletRequest request)
                    throws java.io.IOException
Sets the input stream from which the webject can read BLOB data. The input stream is obtained from a servlet request object.

Parameters:
request - The servlet request object from which the input stream will be obtained.
Throws:
java.io.IOException - if the input stream can not be set.

setInputStream

public void setInputStream(IeMultipartInputStream is)
Sets the input stream from which the webject can read BLOB data.

Parameters:
is - The Info*Engine multipart input stream from which the webject can read BLOB data.

getInputStream

public IeMultipartInputStream getInputStream()
Returns the input stream currently associated with the webject.

Returns:
The input stream currently associated with the webject.

setOutputStream

public void setOutputStream(java.io.OutputStream os)
Sets the output stream associated with this webject.

Parameters:
os - The new output stream.

setOutputStream

public void setOutputStream(java.io.Writer writer)
Sets the output stream associated with this webject. This method uses the WriterOutputStream class to wrap a writer so that it can be used as the output stream of the webject.

Parameters:
writer - The writer to be wrapped in an output stream.

getOutputStream

public java.io.OutputStream getOutputStream()
Returns the output stream currently associated with this webject.

Returns:
The webject's current output stream.

addParam

public void addParam(java.lang.String name,
                     java.lang.String value)
Adds a parameter with a specific name and value to the webject.

Parameters:
name - The name of the parameter.
value - The value of the parameter.

setParam

public void setParam(java.lang.String name,
                     java.lang.String value)
Sets a new value for a specific parameter of the webject. If the parameter already has one or more values, the old values are removed.

Parameters:
name - The name of the parameter.
value - The new value of the parameter.

invoke

public void invoke()
            throws IEException,
                   java.io.IOException
Invokes the webject in the server context. If the webject returns any output groups, they will be added to the collection maintained in the server context.

Throws:
IEException - if the webject is not executed successfully.
java.io.IOException

invoke

public void invoke(Task task)
            throws IEException,
                   java.io.IOException
Invokes the webject in the server context using a specified task object. If the webject returns any output groups, they will be added to the collection maintained in the server context.

Parameters:
task - The task associated with the webject.
Throws:
IEException - if the webject is not executed successfully.
java.io.IOException

getProcessorClassName

public static java.lang.String getProcessorClassName(java.lang.String type)
Determines the name of the subclass that processes webjects of a specified type.

Parameters:
type - The webject type
Returns:
The name of the webject processor class, or null if no processor class is defined for the type

getProcessor

public static Webject getProcessor(java.lang.String type)
                            throws java.lang.ClassNotFoundException,
                                   java.lang.InstantiationException,
                                   java.lang.IllegalAccessException
Create a webject processor instance of a specified webject type.

Parameters:
type - The webject type
Returns:
The webject processor instance, or null if no processor class is defined for the type
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

run

public static void run(java.util.Vector webjects)
                throws IEException
Runs a set of webjects, each in its own thread, and waits for all of them to complete. Each webject is executed in the server context. The output groups returned by all of the webjects are added to the collection maintained in the server context.

Parameters:
webjects - The set of webjects to be run.
Throws:
IEException - if the webject is not executed successfully.