# com.bea.control
ControlContext Interface

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\

Related Topics

``Context``

All Superinterfaces
  `Context`, `Serializable`

## Nested Class Summary

`public static interface` | `ControlContext.Callback` Provides a way for controls to receive callbacks from their environment.

Nested classes from interface weblogic.jws.control`.`Context``
``Context.Callback``

## Method Summary

`public void` | `cancelEvents`(`String` eventName) Cancels callback events that have the specified event name.
`public `Class`` | `getCallbackInterface`() Returns the java.lang.Class object for this component's callback interface.
`public `String`` | `getControlAttribute`(`String` tagName, `String` attrName) Returns the value for the specified control tag attribute.
`public `List`` | `getControlAttributes`(`String` tagName) Returns a list of the attributes and values for the specified property tag annotating a control instance.
`public `Class`` | `getControlInterface`() Returns the java.lang.Class object for the component call interface.
`public `Object`` | `getMethodArgument`(`String` argName) Returns the value for the specified method argument.
`public `String`[]` | `getMethodArgumentNames`() Returns the argument names associated with the current invocation context.
`public `String`` | `getMethodAttribute`(`String` tagName, `String` attrName) Returns the value for the specified method tag attribute.
`public `List`` | `getMethodAttributes`(`String` tagName) Returns a list of the attributes and values for the specified property tag annotating a control method.
`public `Object`` | `raiseEvent`() Forwards to this control's client a callback that the control has received.
`public void` | `scheduleEvent`(`String` eventName, `Object`[] eventArgs, long time, boolean ignoreIfFinished) Schedules a callback to occur on this control instance at a specified time.
`public `Object`` | `sendEvent`(`String` eventName, `Object`[] args) Sends a callback event that is declared as part of this control's callback interface.

Methods from interface `weblogic.jws.control.`Context``
``finishConversation`, `getCallerPrincipal`, `getCurrentAge`, `getCurrentIdleTime`, `getLogger`, `getMaxAge`, `getMaxIdleTime`, `getService`, `isCallerInRole`, `isFinished`, `resetIdleTime`, `setMaxAge`, `setMaxAge`, `setMaxIdleTime`, `setMaxIdleTime``

## Method Detail

### cancelEvents(String) Method

    public 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.

#### Exceptions

``SchedulerException``

### getCallbackInterface() Method

    public 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.

### getControlAttribute(String, String) Method

    public 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(String) Method

    public 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

### getControlInterface() Method

    public Class getControlInterface()

Returns the java.lang.Class object for the component call interface.

#### Returns

The Class object for the component call interface.

### getMethodArgument(String) Method

    public 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.

#### Exceptions

``IllegalArgumentException``
  If there is no argument whose name matches argName.

### getMethodArgumentNames() Method

    public 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.

### getMethodAttribute(String, String) Method

    public 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(String) Method

    public 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.

### raiseEvent() Method

    public 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.

#### Exceptions

``Exception``

### scheduleEvent(String, Object[], long, boolean) Method

    public 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.

#### Exceptions

``SchedulerException``

### sendEvent(String, Object[]) Method

    public 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.

#### Exceptions

``Exception``