com.infoengine.SAK
Class Webject

java.lang.Object
  extended bycom.infoengine.object.factory.Webject
      extended bycom.infoengine.SAK.Webject
All Implemented Interfaces:
Cloneable, Serializable
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.

See Also:
Serialized Form

Nested Class Summary
private  class Webject.WebjectRunner
           
 
Field Summary
protected  IeMultipartInputStream inputStream
           
protected  OutputStream outputStream
           
private static String RESOURCE
           
protected  IeService service
           
protected  Task task
           
private static Map webjectClassCache
           
protected  WebjectProcessor webjectProcessor
           
 
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(String name)
          Constructs a webject with a specific name but no type.
Webject(String name, String type)
          Constructs a webject with a specific name and type.
Webject(String name, String type, IeService service)
          Constructs a webject with a specific name, type, and server context.
 
Method Summary
 void addParam(String name, String value)
          Adds a parameter with a specific name and value to the webject.
protected  void copyOutputGroups(Task sourceTask)
          Copies the groups from a specified task to the service associated with this webject.
 IeMultipartInputStream getInputStream()
          Returns the input stream currently associated with the webject.
 OutputStream getOutputStream()
          Returns the output stream currently associated with this webject.
static Webject getProcessor(String type)
          Create a webject processor instance of a specified webject type.
static String getProcessorClassName(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.
protected  Webject getWebjectImpl()
          Returns an instance of the class that implements the operation identified by this webject.
protected  void initialize(Task task)
          Prepares the webject for execution.
 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.
protected  void logWebject()
          Logs the webject name, type, and parameters.
static void run(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(InputStream is, String contentType, String name, 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(OutputStream os)
          Sets the output stream associated with this webject.
 void setOutputStream(Writer writer)
          Sets the output stream associated with this webject.
 void setParam(String name, 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, getGroupInName, getGroupInNames, getGroupOutName, getGroupOutNames, getKey, getKeys, getMessages, getMetaValue, getName, getNode, getOutput, getParam, getParam, getParamNames, getParams, getParams, getPassword, getType, getUserName, getValue, getValues, getWebjects, newStructure, paramValue, paramValue, paramValues, printTree, removeAllWebjects, removeParam, removeParams, removeWebject, setClassName, setName, setNode, setParam, setPassword, setType, setUserName, setValue, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

webjectClassCache

private static Map webjectClassCache

inputStream

protected IeMultipartInputStream inputStream

outputStream

protected OutputStream outputStream

service

protected IeService service

task

protected Task task

webjectProcessor

protected WebjectProcessor webjectProcessor
Constructor Detail

Webject

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


Webject

public Webject(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(String name,
               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(String name,
               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(InputStream is,
                           String contentType,
                           String name,
                           String filename)
                    throws 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:
IOException - if the input stream can not be set.

setInputStream

public void setInputStream(javax.servlet.ServletRequest request)
                    throws 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:
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(OutputStream os)
Sets the output stream associated with this webject.

Parameters:
os - The new output stream.

setOutputStream

public void setOutputStream(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 OutputStream getOutputStream()
Returns the output stream currently associated with this webject.

Returns:
The webject's current output stream.

addParam

public void addParam(String name,
                     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(String name,
                     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.

initialize

protected void initialize(Task task)
                   throws IEException,
                          IOException
Prepares the webject for execution.

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

getWebjectImpl

protected Webject getWebjectImpl()
                          throws IEException
Returns an instance of the class that implements the operation identified by this webject.

Returns:
An instance of the implementation class.
Throws:
IEException

copyOutputGroups

protected void copyOutputGroups(Task sourceTask)
                         throws IEException
Copies the groups from a specified task to the service associated with this webject. Any group that does not have a name is assigned the name specified by this webject's GROUP_OUT parameter.

Parameters:
sourceTask - The task from which to get the groups
Throws:
IEException

logWebject

protected void logWebject()
Logs the webject name, type, and parameters.


invoke

public void invoke()
            throws IEException,
                   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.
IOException

invoke

public void invoke(Task task)
            throws IEException,
                   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.
IOException

getProcessorClassName

public static String getProcessorClassName(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(String type)
                            throws ClassNotFoundException,
                                   InstantiationException,
                                   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:
ClassNotFoundException
InstantiationException
IllegalAccessException

run

public static void run(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.