com.bea.control
Interface ControlContext

All Superinterfaces:
Context, Serializable

public interface ControlContext
extends Context

The ControlContext interface defines the container services and events that controls can use at run time. For example, through methods of this interface, a Java control can access its own property attribute values, handle lifecycle events, send callbacks, and so on.

Note: The ControlContext interface is provided as part of the WebLogic Workshop Control Development Kit. The Control Development Kit is for users who are creating advanced controls. It is available in your BEA installation in the following directory: BEA_HOME\weblogic81\samples\workshop\ControlDevKit\

See Also:
Context

Nested Class Summary
static interface ControlContext.Callback
          Provides a way for controls to receive callbacks from their environment.
 
Method Summary
 void addCallbackListener(ControlContext.Callback listener)
          Registers a new Callback listener for events on this context
 void cancelEvents(String eventName)
          Cancels callback events that have the specified event name.
 Class getCallbackInterface()
          Returns the java.lang.Class object for this component's callback interface.
 String getControlAttribute(String tagName, String attrName)
          Returns the value for the specified control tag attribute.
 List getControlAttributes(String tagName)
          Returns a list of the attributes and values for the specified property tag annotating a control instance.
 Class getControlInterface()
          Returns the java.lang.Class object for the component call interface.
 Object getMethodArgument(String argName)
          Returns the value for the specified method argument.
 String[] getMethodArgumentNames()
          Returns the argument names associated with the current invocation context.
 String getMethodAttribute(String tagName, String attrName)
          Returns the value for the specified method tag attribute.
 List getMethodAttributes(String tagName)
          Returns a list of the attributes and values for the specified property tag annotating a control method.
 Object raiseEvent()
          Forwards to this control's client a callback that the control has received.
 void removeCallbackListener(ControlContext.Callback listener)
          Deregisters an existing Callback listener for events on this context.
 void scheduleEvent(String eventName, Object[] eventArgs, long time, boolean ignoreIfFinished)
          Schedules a callback to occur on this control instance at a specified time.
 Object sendEvent(String eventName, Object[] args)
          Sends a callback event that is declared as part of this control's callback interface.
 
Methods inherited from interface weblogic.jws.control.Context
finishConversation, getCallerPrincipal, getCurrentAge, getCurrentIdleTime, getLogger, getMaxAge, getMaxIdleTime, getService, isCallerInRole, isFinished, resetIdleTime, setMaxAge, setMaxAge, setMaxIdleTime, setMaxIdleTime
 

Method Detail

getControlInterface

Class getControlInterface()
Returns the java.lang.Class object for the component call interface.

Returns:
The Class object for the component call interface.

getCallbackInterface

Class getCallbackInterface()
Returns the java.lang.Class object for this component's callback interface. For example, for a Java control that is customizable by generating a JCX file, the callback interface can be defined in the JCX itself. In other words, it may not be known until design time, when a developer is customizing it. You can use this method to discover information about the interface.

Returns:
The Class object for the callback interface.

getMethodAttribute

String getMethodAttribute(String tagName,
                          String attrName)
Returns the value for the specified method tag attribute. Use this method to retrieve at run time the value of a property attribute set on a method. A method attribute is expressed through an annotation on a method declaration in a JCX file.

Note that while a property tag's XML file can define attributes as types other than String, the values are always returned at run time as a String. Your code should convert them to other types as needed.

Parameters:
tagName - The name of the property tag that exposes attrName.
attrName - The name of the attribute whose value should be retrieved.
Returns:
The attribute's value; null if the attribute is undefined.

getMethodAttributes

List getMethodAttributes(String tagName)
Returns a list of the attributes and values for the specified property tag annotating a control method. This method returns the attributes as a List of Map objects. Each entry in the list maps an attribute name to the attribute's current value (as a String) for a single occurrence of the tag.

Parameters:
tagName - The tag whose attributes should be returned.
Returns:
A list of Map objects in which keys are attribute names and values are attribute values.

getControlAttribute

String getControlAttribute(String tagName,
                           String attrName)
Returns the value for the specified control tag attribute. Use this method to retrieve at run time the value of a property attribute set for a control instance. For properties set on a control instance, property tags annotate the control's variable declaration or the control interface definition.

Note that while a property tag's XML file can define attributes as types other than String, the values are always returned at run time as a String. Your code should convert them to other types as needed.

Parameters:
tagName - The tag whose attribute should be returned.
attrName - The attribute whose value should be returned.
Returns:
The attribute value, or null if undefined.

getControlAttributes

List getControlAttributes(String tagName)
Returns a list of the attributes and values for the specified property tag annotating a control instance. This method returns the attributes as a List of Map objects. Each entry in the list maps an attribute name to the attribute's current value (as a String) for a single occurrence of the tag.

Parameters:
tagName - The tag whose attributes should be returned.
Returns:
A list of maps of attribute values

getMethodArgument

Object getMethodArgument(String argName)
                         throws IllegalArgumentException
Returns the value for the specified method argument. Use the getMethodArgumentNames method to retrieve a list of arguments for the current method.

Parameters:
argName - The name of the method argument to return.
Returns:
The value for the specified argument.
Throws:
IllegalArgumentException - If there is no argument whose name matches argName.

getMethodArgumentNames

String[] getMethodArgumentNames()
Returns the argument names associated with the current invocation context. The names are returned in order based on the order of declaration. Use the getMethodArgument method to retrieve the value for a particular argument.

Returns:
An array of the argument names.

sendEvent

Object sendEvent(String eventName,
                 Object[] args)
                 throws Exception
Sends a callback event that is declared as part of this control's callback interface.

Parameters:
eventName - The callback event to send.
args - An array of values to be used for the callback's arguments.
Returns:
The callback's return value.
Throws:
Exception

raiseEvent

Object raiseEvent()
                  throws Exception
Forwards to this control's client a callback that the control has received. Use this method when your control will intercept callbacks and send them on to its client unmodified.

Returns:
The callback's return value.
Throws:
Exception

scheduleEvent

void scheduleEvent(String eventName,
                   Object[] eventArgs,
                   long time,
                   boolean ignoreIfFinished)
                   throws SchedulerException
Schedules a callback to occur on this control instance at a specified time.

Parameters:
eventName - The name of the callback event to schedule.
eventArgs - An array of values to use as callback arguments.
time - The time at which the callback event should occur. The event is guaranteed to happen on or after this time.
ignoreIfFinished - true if no exception should be thrown if the callback is sent to a finished instance; false if an exception should be thrown.
Throws:
SchedulerException

cancelEvents

void cancelEvents(String eventName)
                  throws SchedulerException
Cancels callback events that have the specified event name. For example, if the eventName callbacks have been scheduled through the scheduleEvent method, this method removes them from the schedule.

Parameters:
eventName - The name of the callbacks to cancel.
Throws:
SchedulerException

addCallbackListener

void addCallbackListener(ControlContext.Callback listener)
                         throws TooManyListenersException
Registers a new Callback listener for events on this context

Parameters:
listener - The listener to receive context events
Throws:
TooManyListenersException - A listener has already been registered.

removeCallbackListener

void removeCallbackListener(ControlContext.Callback listener)
Deregisters an existing Callback listener for events on this context.