All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.script.SCRComponent

java.lang.Object
   |
   +----com.ibm.beans.script.SCRComponent

public abstract class SCRComponent
extends Object
implements Serializable
This is the base scripting component class from which all scripting components should be derived.

See Also:
SCRIDEComponent

Variable Index

 o eventProc
Event processor object.
 o introspectionDepth
Depth of introspection.
 o lastGenerationTime
 o lastSaveTime
The last saving time for this scripting component.
 o name_handle_Registry
Design time mapping of object names and object handles.
 o registeredClasses
Vector of Java classes that are registered with the scripting component.
 o rtComponent
Run-time component.
 o scrClient
Scripting client.
 o scrEnv
Scripting environment object.

Constructor Index

 o SCRComponent()
Constructs the SCRComponent object.

Method Index

 o checkChanged(long)
Check if the script is changed after the last change time.
 o clientRequest(String, Object)
Processes a client request.
 o createEventProcessor()
Creates the event processor object.
 o createObjectHandle(String, Class)
Creates an object handle for a registered object.
 o createRegisteredClass(Class)
Creates an SCRRegisteredClass object.
 o createRTComponent(boolean)
Creates the run-time component.
 o deregisterClass(Class)
Deregisters a Java class.
 o deregisterObject(String)
Deregisters a named object from the scripting component and the event processor.
 o deregisterObjectHandle(SCRObjectHandle)
Deregisters an object handle from the scripting component and the event processor.
 o doIntrospection(SCRRegisteredClass, int)
Introspects a registered class.
 o editScript()
Starts IDE to edit the script.
 o editScriptNoFrame()
Edits the script.
 o exportScript(BufferedWriter)
Exports the script data to an output stream.
 o getObjectHandle(String)
Requests the object handle for a named object.
 o getObjectHandles()
Gets all registered object handles.
 o getOrCreateRTComponent(boolean)
Gets a run time only component.
 o getPackagingFiles(Vector, Vector)
Requests the list of extra class files that are generated by the scripting component.
 o getRegisteredClasses()
Gets all registered classes.
 o getRTComponent()
Requests the run-time component.
 o getScrClient()
Requests the scripting client object.
 o getScrEnv()
Requests the SCREnvironment object.
 o ideClosed()
Notifies the client that the IDE window closed.
 o importScript(BufferedReader)
Imports the script data from an input stream.
 o initialize(SCRClient, SCREnvironment)
Creates an event processor and a Vector for registered classes.
 o intRegisterClass(Class, int)
Registers a Java class.
 o isEmpty()
 o needRecreateRtComponent(boolean)
Checks if the run-time component needs to be recreated.
 o registerClass(Class)
Registers a Java class.
 o registerObject(Class, String)
Registers the object with the scripting component and the event processor.
 o registerObjectHandle(Class, SCRObjectHandle)
Registers the object handle with the scripting component and the event processor.
 o renameObject(String, String)
Renames a named object.
 o runRequest(boolean, boolean)
Requests that the client run the script.
 o stopEditingScript()
Stops script editing.
 o supportsRunRequest()
Checks if the client supports the run script request.
 o syncEditor()
Saves the contents of the current edit session in preparation for object streaming.
 o terminateRequest()
Requests the client to terminate the script.

Variables

 o introspectionDepth
 protected int introspectionDepth
Depth of introspection. Subclasses may change this. 0 indicates no intropspection; -1 indicates introspect all classes recursively.

See Also:
registerClass
 o scrEnv
 protected transient SCREnvironment scrEnv
Scripting environment object. This variable is set in the initialize() method.

See Also:
SCREnvironment, getScrEnv, initialize
 o scrClient
 protected transient SCRClient scrClient
Scripting client. This variable is set in the initialize() method. The scripting component calls the scripting client back when the IDE requests to run or terminate a script.

See Also:
SCRClient
 o eventProc
 protected SCREventProcessor eventProc
Event processor object. This variable is created in the initialize method by calling the createEventProcessor() method

See Also:
SCREventProcessor, createEventProcessor
 o registeredClasses
 protected transient Vector registeredClasses
Vector of Java classes that are registered with the scripting component.

 o name_handle_Registry
 protected Hashtable name_handle_Registry
Design time mapping of object names and object handles.

 o rtComponent
 protected SCRRTComponent rtComponent
Run-time component. This variable is created by calling the getOrCreateRTComponent() method.

See Also:
SCRRTComponent
 o lastSaveTime
 protected long lastSaveTime
The last saving time for this scripting component.

 o lastGenerationTime
 protected long lastGenerationTime

Constructors

 o SCRComponent
 public SCRComponent()
Constructs the SCRComponent object. This constructor should be called by the constructor of the derived class.

Methods

 o getScrEnv
 public SCREnvironment getScrEnv()
Requests the SCREnvironment object.

Returns:
The associated SCREnvironment object.
See Also:
scrEnv
 o getScrClient
 public SCRClient getScrClient()
Requests the scripting client object.

Returns:
The associated scripting client object.
See Also:
scrClient
 o clientRequest
 public boolean clientRequest(String request_name,
                              Object request_para)
Processes a client request. The component implementation need to decide it handles what kind of client requests by override this method. This method always returns false.

Parameters:
request_name - The client request name.
request_para - The client request parameter.
 o initialize
 public void initialize(SCRClient scr_client,
                        SCREnvironment env)
Creates an event processor and a Vector for registered classes. This method is the initialization method and should be called by the scripting environment. This method registers all the existing object handles and adds itself as an event listener of the scripting environment.

Parameters:
scr_client - The client application of the scripting engine.
env - The associated SCREnvironment object.
See Also:
scrEnv
 o runRequest
 public boolean runRequest(boolean runDebug,
                           boolean compileDebug)
Requests that the client run the script. This method is called when the scripting component (or IDE) requests that the script be started.

Parameters:
runDebug - Specifies if the script is started with the debugger.
compileDebug - Specifies if the script is compiled with the debugging information.
Returns:
true if the client starts the script; false otherwise.
 o ideClosed
 public void ideClosed()
Notifies the client that the IDE window closed. This method calls the ideClosed() method of the client. To support this feature, the client should implement the SCRClientExt interface instead of the SCRClient interface.

See Also:
SCRClientExt
 o supportsRunRequest
 public boolean supportsRunRequest()
Checks if the client supports the run script request.

Returns:
true if the client supports run script request; false otherwise.
See Also:
SCRClientExt
 o terminateRequest
 public boolean terminateRequest()
Requests the client to terminate the script. This method is called when the scripting component(or IDE) wants to stop the script.

Returns:
true if the client stops the script; false otherwise.
 o createEventProcessor
 protected SCREventProcessor createEventProcessor()
Creates the event processor object. Subclasses may override this method to create their own event processor.

Returns:
The newly created event processor object.
See Also:
eventProc, SCREventProcessor
 o createObjectHandle
 public abstract SCRObjectHandle createObjectHandle(String name,
                                                    Class cls)
Creates an object handle for a registered object. This method is called by the scripting environment before registering the object. The subclasses of scripting component must override this method in order to create a scripting language specific object handle.

Parameters:
name - The unique object name.
cls - The Java class.
Returns:
The newly created object handle.
See Also:
SCRObjectHandle
 o editScript
 public abstract boolean editScript()
Starts IDE to edit the script. This method is called by the scripting environment. The component developer should implement this method.

Returns:
true if IDE can be started; false otherwise.
 o editScriptNoFrame
 public abstract Component editScriptNoFrame()
Edits the script. Invokes the IDE for the scripting environment. The IDE will not be created in a separate window.

Returns:
null if an IDE is not supported or the IDE was already created in a separate window using the editScript() method. This method does not determine if an IDE is supported. If the return value is non-null then the user can add the component into a java.awt.Container component.
 o stopEditingScript
 public abstract boolean stopEditingScript()
Stops script editing. This method is called by the scripting environment. The component developer should implement this method.

Returns:
true if IDE can be stopped; false otherwise.
 o syncEditor
 public abstract void syncEditor()
Saves the contents of the current edit session in preparation for object streaming.

 o createRegisteredClass
 public abstract SCRRegisteredClass createRegisteredClass(Class cls)
Creates an SCRRegisteredClass object. This method is called by the registerClass() method. The scripting component developer should implement this method.

Parameters:
cls - The associated Java class object.
Returns:
The newly created SCRRegisteredClass object. The object is used in class registration.
See Also:
registerClass, SCRRegisteredClass
 o isEmpty
 public abstract boolean isEmpty()
 o doIntrospection
 public abstract void doIntrospection(SCRRegisteredClass reg_cls,
                                      int depth)
Introspects a registered class. This method is called by the registerClass() method. The subclasses of scripting component must override this method in order to perform scripting language specific introspection.

Parameters:
reg_cls - The registered class object that provides the Java class object.
depth - The recursive depth for introspection.
 o registerObject
 public SCRObjectHandle registerObject(Class cls,
                                       String name)
Registers the object with the scripting component and the event processor.

Parameters:
cls - The class of the object that is registered.
name - The name of the object that is registered.
Returns:
The object handle of the registered object.
 o registerObjectHandle
 protected void registerObjectHandle(Class cls,
                                     SCRObjectHandle handle)
Registers the object handle with the scripting component and the event processor.

Parameters:
cls - The class of the object that is specified by the object handle.
handle - The object handle that needs to be registered.
 o deregisterObject
 public SCRObjectHandle deregisterObject(String name)
Deregisters a named object from the scripting component and the event processor. The scripting component developer may need to override this method to deregister the object with IDE.

Parameters:
name - The name of the object that needs to be deregistered.
 o deregisterObjectHandle
 protected void deregisterObjectHandle(SCRObjectHandle handle)
Deregisters an object handle from the scripting component and the event processor. The scripting component developer may need to override this method in order to deregister the object with IDE.

Parameters:
handle - The handle of the object that needs to be deregistered.
 o renameObject
 public SCRObjectHandle renameObject(String oldName,
                                     String newName)
Renames a named object. The scripting component developer may need to override this method in order to rename the object with IDE.

Parameters:
oldName - The original object name.
newName - The new object name.
 o registerClass
 public SCRRegisteredClass registerClass(Class cls)
Registers a Java class. This method should be called by the scripting environment. This method calls the intRegisterClass() method to do the class registration.

Parameters:
cls - The Java class object to be registered.
Returns:
The registered SCRRegisteredClass object.
See Also:
SCRRegisteredClass
 o deregisterClass
 public void deregisterClass(Class cls)
Deregisters a Java class. This method takes the deregistered class name out of the persistent class name list.

Parameters:
cls - The Java class object to be deregistered.
 o intRegisterClass
 protected SCRRegisteredClass intRegisterClass(Class cls,
                                               int depth)
Registers a Java class. If the class has been registered before, it finds the SCRRegisteredClass object and returns it; otherwise a new SCRRegisteredClass object is created and added to the registered class list. Introspection is performed on the registered class.

Parameters:
cls - The Java class object will be registered.
depth - The recursive depth for introspection.
Returns:
The registered SCRRegisteredClass object.
See Also:
SCRRegisteredClass
 o getRTComponent
 public SCRRTComponent getRTComponent()
Requests the run-time component.

Returns:
The run-time component.
See Also:
SCRRTComponent
 o getOrCreateRTComponent
 public SCRRTComponent getOrCreateRTComponent(boolean withDebug)
Gets a run time only component. This method creates the run-time component when rtComponent is null or needs to be recreated.

Parameters:
withDebug - Specifies if debug information is included.
Returns:
The current SCRRTComponent object.
See Also:
SCRRTComponent
 o needRecreateRtComponent
 protected abstract boolean needRecreateRtComponent(boolean withDebug)
Checks if the run-time component needs to be recreated. Subclass needs to implement this method.

Parameters:
withDebug - Specifies if debug information is included.
Returns:
true if the run-time component needs to be recreated; false otherwise.
See Also:
SCRRTComponent
 o checkChanged
 protected abstract 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.
 o createRTComponent
 public abstract SCRRTComponent createRTComponent(boolean withDebug)
Creates the run-time component. Subclass needs to implement this method.

Parameters:
withDebug - Specifies if debug information is included.
Returns:
The created run-time component.
See Also:
SCRRTComponent
 o getRegisteredClasses
 public Class[] getRegisteredClasses()
Gets all registered classes.

Returns:
The array of registered classes.
 o getObjectHandles
 public SCRObjectHandle[] getObjectHandles()
Gets all registered object handles.

Returns:
An array of registered object handles.
 o getObjectHandle
 public SCRObjectHandle getObjectHandle(String name)
Requests the object handle for a named object.

Parameters:
name - The name of the object for which the handle is being requested.
Returns:
The handle of the registered object.
 o exportScript
 public abstract void exportScript(BufferedWriter out)
Exports the script data to an output stream.

Parameters:
out - The buffer to which the script is written.
 o importScript
 public abstract void importScript(BufferedReader in)
Imports the script data from an input stream.

Parameters:
in - The buffer from which the script is read.
 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.

All Packages  Class Hierarchy  This Package  Previous  Next  Index