All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.script.comps.java.SCRJavaComponent

java.lang.Object
   |
   +----com.ibm.beans.script.SCRComponent
           |
           +----com.ibm.beans.script.ide.SCRIDEComponent
                   |
                   +----com.ibm.beans.script.comps.java.SCRJavaComponent

public class SCRJavaComponent
extends SCRIDEComponent
This class implements the Java scripting Java component. It is derived from SCRIDEComponent.

See Also:
SCRIDEComponent

Variable Index

 o generator
The Java code generator is created in the initialize method.
 o javaInstance
The system IDE instance.
 o scriptName
The name of the generated Java class.

Constructor Index

 o SCRJavaComponent()
Constructor for the SCRJavaComponent.

Method Index

 o checkChanged(long)
Check if the script is changed after the last change time.
 o createGenerator()
Creates the script generator object.
 o createJavaEditableObj(String, String, String, SCRJavaEventMethodInfo, SCRObjectHandle)
Creates a new Java editable object for the IDE.
 o createJavaEventMethodInfo(String)
Creates a new event method information object.
 o createObjectHandle(String, Class)
Creates an object handle for a registered Java object.
 o createRTComponent(boolean)
Creates the run-time component.
 o deregisterObjectHandle(SCRObjectHandle)
Overrides the deregisterObjectHandle method of the parent.
 o doIntrospection(SCRRegisteredClass, int)
Introspects a registered class and creates the class information tree.
 o exportScript(BufferedWriter)
Exports the script information.
 o getInitialCode()
Returns the initial code fragment for generated source code.
 o getMethodPrototype(String, String, int, Vector, Vector)
Gets method prototype.
 o getPackagingFiles(Vector, Vector)
Requests the list of extra class files that are generated by the scripting component.
 o getScriptName()
Gets the script name for the generated Java class.
 o getSysMethodTitle(String)
Gets the system method title.
 o getSystemInstance()
Gets or creates the system IDE instance.
 o importScript(BufferedReader)
Imports the script information.
 o initialize(SCRClient, SCREnvironment)
Creates an event processor and a vector for registered classes.
 o initObjectHandle(SCRIDEObjectHandle, Class)
Initializes an IDE object handle and adds SCRIDEEditableObjects into the IDE instance.
 o isEmpty()
 o needRecreateRtComponent(boolean)
Checks if the run-time component needs to be recreated.
 o renameObject(String, String)
Overrides the renameObject method of the parent.

Variables

 o generator
 protected transient SCRJavaGenerator generator
The Java code generator is created in the initialize method.

See Also:
SCRJavaGenerator
 o scriptName
 protected String scriptName
The name of the generated Java class.

 o javaInstance
 protected SCRJavaIDEInstance javaInstance
The system IDE instance. It is created by calling the getSystemInstance method. The javaInstance stores the initialize, terminate, script-specific imports, and any non-event related methods of the script.

Constructors

 o SCRJavaComponent
 public SCRJavaComponent()
Constructor for the SCRJavaComponent.

Methods

 o needRecreateRtComponent
 public boolean needRecreateRtComponent(boolean withDebug)
Checks if the run-time component needs to be recreated.

Parameters:
withDebug - The boolean that specifies if debug information is included. true, includes the debug information; false, does not include the debug information.
Returns:
true if new run-time component needs to be created again; false otherwise.
Overrides:
needRecreateRtComponent in class SCRComponent
See Also:
SCRRTComponent
 o createRTComponent
 public SCRRTComponent createRTComponent(boolean withDebug)
Creates the run-time component. This method generates and compiles the Java code, then creates the run-time component with the generated Java class.

Parameters:
withDebug - Boolean that specifies if debug information is included. true, includes the debug information; false, does not include the debug information.
Returns:
The created run-time component.
Overrides:
createRTComponent in class SCRComponent
See Also:
SCRRTComponent
 o checkChanged
 protected boolean checkChanged(long lastChange)
Check if the script is changed after the last change time.

Parameters:
lastChange - The last change time.
Returns:
true for changed; false for not changed.
Overrides:
checkChanged in class SCRComponent
 o initialize
 public void initialize(SCRClient scr_client,
                        SCREnvironment env)
Creates an event processor and a vector for registered classes. This method registers all existing object handles and adds itself as the scripting environment event listener.This method is called by the scripting environment.

Parameters:
scr_client -
The scripting client. The component will call the client when it request the client to run, terminate, or save the script.
env - The associated SCREnvironment object.
Overrides:
initialize in class SCRIDEComponent
See Also:
scrEnv
 o getSystemInstance
 public SCRIDEInstance getSystemInstance()
Gets or creates the system IDE instance.

Returns:
The system IDE instance.
Overrides:
getSystemInstance in class SCRIDEComponent
 o initObjectHandle
 public void initObjectHandle(SCRIDEObjectHandle obj_handle,
                              Class cls)
Initializes an IDE object handle and adds SCRIDEEditableObjects into the IDE instance.

Parameters:
obj_handle - The object handle to be initialized.
cls - The class of the object specified by the handle.
Overrides:
initObjectHandle in class SCRIDEComponent
 o doIntrospection
 public void doIntrospection(SCRRegisteredClass reg_cls,
                             int depth)
Introspects a registered class and creates the class information tree.

Parameters:
reg_cls - The registered class.
depth - The introspection depth.
Overrides:
doIntrospection in class SCRComponent
 o getScriptName
 public String getScriptName()
Gets the script name for the generated Java class. If the scriptName is null, creates a default name.

Returns:
The script name for the generated Java class.
 o createObjectHandle
 public SCRObjectHandle createObjectHandle(String name,
                                           Class cls)
Creates an object handle for a registered Java object. This method overrides the method defined in SCRComponent.

Parameters:
name - The unique object name.
cls - The Java class.
Returns:
The created object handle.
Overrides:
createObjectHandle in class SCRComponent
See Also:
SCRIDEObjectHandle, initObjectHandle
 o deregisterObjectHandle
 protected void deregisterObjectHandle(SCRObjectHandle handle)
Overrides the deregisterObjectHandle method of the parent. The method first calls the parent, then sets the changed flag to true.

Parameters:
handle - The object handle that needs to be deregistered.
Overrides:
deregisterObjectHandle in class SCRIDEComponent
 o renameObject
 public SCRObjectHandle renameObject(String old_name,
                                     String new_name)
Overrides the renameObject method of the parent. The method first calls the parent, then sets the changed flag to true.

Parameters:
old_name - The old name of the object.
new_name - The new name of the object.
Overrides:
renameObject in class SCRIDEComponent
 o exportScript
 public void exportScript(BufferedWriter out)
Exports the script information.

Parameters:
out - The output buffer to which the script information is exported.
Overrides:
exportScript in class SCRComponent
 o importScript
 public void importScript(BufferedReader in)
Imports the script information.

Parameters:
in - The input buffer from which the script information is imported.
Overrides:
importScript in class SCRComponent
 o createJavaEditableObj
 protected SCRJavaEditableObj createJavaEditableObj(String event_name,
                                                    String title,
                                                    String code,
                                                    SCRJavaEventMethodInfo evt_info,
                                                    SCRObjectHandle obj_handle)
Creates a new Java editable object for the IDE.

Parameters:
event_name - The event for which the object is created.
title - The title of the editable object.
code - The source code associated with the object.
evt_info - The event descriptor information.
obj_handle - The handle to the scriptable bean.
Returns:
The Java editable object.
 o getInitialCode
 protected String getInitialCode()
Returns the initial code fragment for generated source code.

Returns:
The code fragment string.
 o getSysMethodTitle
 protected String getSysMethodTitle(String method_name)
Gets the system method title.

Parameters:
method_name - The name of the syatem method.
Returns:
A string that represents the signature for the system method.
 o createGenerator
 protected void createGenerator()
Creates the script generator object.

Returns:
The Java generator object.
 o getMethodPrototype
 protected String getMethodPrototype(String name,
                                     String return_type,
                                     int modifier,
                                     Vector arg_names,
                                     Vector arg_types)
Gets method prototype.

Parameters:
name - The name of the method.
return_type - The data type of the return value.
modifier - The modifier value.
arg_names - The names of the formal parameters.
arg_types - The types of the formal parameters.
Returns:
The string that represents signature for a Java method.
 o createJavaEventMethodInfo
 protected SCRJavaEventMethodInfo createJavaEventMethodInfo(String title)
Creates a new event method information object.

Parameters:
title - The title of the event method information object.
Returns:
Java event method information object.
 o getPackagingFiles
 public void getPackagingFiles(Vector allNames,
                               Vector byteArrays)
Requests the list of extra class files that are generated by the scripting component. These class files include the compiled script and the listener classes generated by the event processor.

Parameters:
allNames - The fully-qualified class names of the classes.
byteArrays - The byte arrays representing the classes.
Overrides:
getPackagingFiles in class SCRComponent
 o isEmpty
 public boolean isEmpty()
Overrides:
isEmpty in class SCRComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index