Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.wlai.client
Class EventContext

    java.lang.Object
      com.bea.wlai.client.EventContext

All Implemented Interfaces:
  Serializable

    public class EventContext

extends Object
implements Serializable

A frame of reference for generating/receiving events. This class is used by ApplicationView to manage the event delivery mechanics in methods such as postEvent, addEventListener, etc.

See Also:
  `ApplicationView`, Serialized Form

Field Summary
`static int` | `JMS_QUEUE`
`static int` | `JMS_TOPIC`

Constructor Summary
`EventContext(String sourceKey, String sourceType, Context context, String jmsDestName, int jmsDestType, String jmsConnectionFactoryJNDIName)` Get an EventContext object using the given JNDI context.
`EventContext(String sourceKey, String sourceType, Context context, String jmsDestName, int jmsDestType, String jmsConnectionFactoryJNDIName, boolean bTransaction)` Get an EventContext object using the given JNDI context.
`EventContext(String sourceKey, String sourceType, Hashtable jndiEnv, String jmsDestName, int jmsDestType, String jmsConnectionFactoryJNDIName)` Get an EventContext object using the given JNDI context.
`EventContext(String durableClientID, String sourceKey, String sourceType, Context context, String jmsDestName, String jmsConnectionFactoryJNDIName)` Get an EventContext object using the given JNDI context.
`EventContext(String durableClientID, String sourceKey, String sourceType, Hashtable jndiEnv, String jmsDestName, String jmsConnectionFactoryJNDIName)` Get an EventContext object using the given JNDI context.
`EventContext(Subject authUser, String sourceKey, String sourceType, Context context, String jmsDestName, int jmsDestType, String jmsConnectionFactoryJNDIName)` constructor for internal use

Method Summary
`void` | `addListener(String eventTypeName, EventListener eventListener)` Register a listener for all events of type eventTypeName.
`void` | `addListener(String eventTypeName, EventListener eventListener, String subscriberName)` Register a listener for all events of type eventTypeName.
`void` | `close()` Close JMS resources.
`boolean` | `containsListener(String eventTypeName, EventListener listener)` Has this EventContext already had EventListener given by listener register interest in events of type eventTypeName.
`boolean` | `equals(Object obj)`
`Context` | `getContext()` Get the JNDI context being used.
`IEventDefinition` | `getEventDefinition(String eventType)` Get IEventDefinition for the given event type.
`javax.jms.Queue` | `getJMSQueue()` Deprecated. This method is no longer used due to internal refactoring.
`javax.jms.Topic` | `getJMSTopic()` Deprecated. This method is no longer used due to internal refactoring.
`boolean` | `getNamespaceEnforcementEnabled()` Get an indication of whether namespace enforcement is enabled (true) or disabled (false).
`String` | `getSourceKey()`
`String` | `getSourceType()`
`void` | `postEvent(String eventType, IEvent event)` Post an event with the given type and represented by the given event to this EventContext.
`void` | `reinitialize()` Reinitialize JMS resources using stored environment properties, and JMS topic name.
`boolean` | `removeListener(String eventTypeName, EventListener listener)` Remove this listener from the list of listeners on events of type eventTypeName.
`void` | `setNamespaceEnforcementEnabled(ApplicationView appView, boolean newValue)` Enable/disable namespace enforcement for events coming from this context.
`String` | `toString()`
`static void` | `validateDurableClientID(String strDurableClientID)` Convenience method for validating if the argument is a valid durable client ID for an EventContext.

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### JMS_TOPIC

    public static final int JMS_TOPIC

See Also:
  Constant Field Values

### JMS_QUEUE

    public static final int JMS_QUEUE

See Also:
  Constant Field Values

Constructor Detail

### EventContext

    public EventContext(String sourceKey,
                        String sourceType,
                        Hashtable jndiEnv,
                        String jmsDestName,
                        int jmsDestType,
                        String jmsConnectionFactoryJNDIName)
                 throws NamingException,
                        EventContextException

  Get an EventContext object using the given JNDI context. This context will send messages to the JMS destination (queue or topic) given by the jmsDestName parameter. An instance constructed with this constructor does not support durable subscriptions.

  Parameters:
    `sourceKey` - - identifies the source of the events; cannot be null
    `sourceType` - - identifies the type of source; e.g. ApplicationView; cannot be null
    `jndiEnv` - - contains properties needed to establish an initial JNDI context to a J2EE application server.
    `jmsDestName` - - the JNDI context for the JMS destination for events
    `jmsConnectionFactoryJNDIName` - - The JNDI context for the JMS connection factory that will be used to obtain Queue/Topic connections.
    `jmsDestType` - - destination type: JMS_TOPIC or JMS_QUEUE
  Throws:
    `NamingException` - if an error occurs trying to connect to the J2EE application server using the supplied JNDI properties.
    `EventContextException` - if an error occurs while initializing the members of this instance.

### EventContext

    public EventContext(String sourceKey,
                        String sourceType,
                        Context context,
                        String jmsDestName,
                        int jmsDestType,
                        String jmsConnectionFactoryJNDIName)
                 throws NamingException,
                        EventContextException

  Get an EventContext object using the given JNDI context. This context will send messages to the JMS destination (queue or topic) given by the jmsDestName parameter. An instance constructed with this constructor does not support durable subscriptions.

  Parameters:
    `sourceKey` - - identifies the source of the events; cannot be null
    `sourceType` - - identifies the type of source; e.g. ApplicationView; cannot be null
    `context` - - a JNDI context to a J2EE application server.
    `jmsDestName` - - the JNDI context for the JMS destination for events
    `jmsDestType` - - destination type: JMS_TOPIC or JMS_QUEUE
  Throws:
    `NamingException` - if an error occurs trying to connect to the J2EE application server using the supplied JNDI properties.
    `EventContextException` - if an error occurs while initializing the members of this instance.

### EventContext

    public EventContext(Subject authUser,
                        String sourceKey,
                        String sourceType,
                        Context context,
                        String jmsDestName,
                        int jmsDestType,
                        String jmsConnectionFactoryJNDIName)
                 throws NamingException,
                        EventContextException

  constructor for internal use

  Throws:
    `NamingException`
    `EventContextException`

### EventContext

    public EventContext(String sourceKey,
                        String sourceType,
                        Context context,
                        String jmsDestName,
                        int jmsDestType,
                        String jmsConnectionFactoryJNDIName,
                        boolean bTransaction)
                 throws NamingException,
                        EventContextException

  Get an EventContext object using the given JNDI context. This context will send messages to the JMS destination (queue or topic) given by the jmsDestName parameter. An instance constructed with this constructor does not support durable subscriptions.

  Parameters:
    `sourceKey` - - identifies the source of the events; cannot be null
    `sourceType` - - identifies the type of source; e.g. ApplicationView; cannot be null
    `context` - - a JNDI context to a J2EE application server.
    `jmsDestName` - - the JNDI context for the JMS destination for events
    `jmsDestType` - - destination type: JMS_TOPIC or JMS_QUEUE
    `bTransaction` - - not used
  Throws:
    `NamingException` - if an error occurs trying to connect to the J2EE application server using the supplied JNDI properties.
    `EventContextException` - if an error occurs while initializing the members of this instance.

### EventContext

    public EventContext(String durableClientID,
                        String sourceKey,
                        String sourceType,
                        Hashtable jndiEnv,
                        String jmsDestName,
                        String jmsConnectionFactoryJNDIName)
                 throws NamingException,
                        EventContextException

  Get an EventContext object using the given JNDI context. This context will send/receive messages to/from the JMS topic given by the jmsDestName parameter.

  Parameters:
    `durableClientID` - - an identifier of the client of this instance; this ID is used to obtain durable subscriptions for this JMS topic. The ID must be a valid Java identifier.
    `sourceKey` - - identifies the source of the events; cannot be null
    `sourceType` - - identifies the type of source; e.g. ApplicationView; cannot be null
    `jndiEnv` - - contains properties needed to establish an initial JNDI context to a J2EE application server.
    `jmsDestName` - - the JNDI context for the JMS topic for events this parameter is currently not used by this implementation.
  Throws:
    `NamingException` - if an error occurs trying to connect to the J2EE application server using the supplied JNDI properties.
    `EventContextException` - if an error occurs while initializing the members of this instance.

### EventContext

    public EventContext(String durableClientID,
                        String sourceKey,
                        String sourceType,
                        Context context,
                        String jmsDestName,
                        String jmsConnectionFactoryJNDIName)
                 throws NamingException,
                        EventContextException

  Get an EventContext object using the given JNDI context. This context will send/receive messages to/from the JMS topic given by the jmsDestName parameter.

  Parameters:
    `durableClientID` - - an identifier of the client of this instance; this ID is used to obtain durable subscriptions for this JMS topic. The ID must be a valid Java identifier.
    `sourceKey` - - identifies the source of the events; cannot be null
    `sourceType` - - identifies the type of source; e.g. ApplicationView; cannot be null
    `context` - - contains properties needed to establish an initial JNDI context to a J2EE application server.
    `jmsDestName` - - the JNDI context for the JMS topic for events this parameter is currently not used by this implementation.
  Throws:
    `NamingException` - if an error occurs trying to connect to the J2EE application server using the supplied JNDI properties.
    `EventContextException` - if an error occurs while initializing the members of this instance.

Method Detail

### validateDurableClientID

    public static final void validateDurableClientID(String strDurableClientID)
                                              throws IllegalArgumentException

  Convenience method for validating if the argument is a valid durable client ID for an EventContext.

  Throws:
    `IllegalArgumentException` - if the argument is not a valid durable client ID.

### getSourceKey

    public String getSourceKey()

  Returns:
    the source key for this instance; typically ApplicationView name

### getSourceType

    public String getSourceType()

  Returns:
    the source type for this instance, such as ApplicationView

### close

    public void close()

  Close JMS resources.

### postEvent

    public void postEvent(String eventType,
                          IEvent event)
                   throws DocumentException,
                          EventContextException

  Post an event with the given type and represented by the given event to this EventContext.

  Throws:
    `DocumentException`
    `EventContextException`

### setNamespaceEnforcementEnabled

    public void setNamespaceEnforcementEnabled(ApplicationView appView,
                                               boolean newValue)

  Enable/disable namespace enforcement for events coming from this context. This option will ensure that all events utilize the namespaces declared in their schemas, regardless of what the adapter produced in the XML. This option is costly, and should be enabled only when needed.

### getNamespaceEnforcementEnabled

    public boolean getNamespaceEnforcementEnabled()

  Get an indication of whether namespace enforcement is enabled (true) or disabled (false).

### getEventDefinition

    public IEventDefinition getEventDefinition(String eventType)
                                        throws ApplicationViewException,
                                               RemoteException

  Get IEventDefinition for the given event type. If the schema for the event type cannot be found, null is returned.

  Throws:
    `ApplicationViewException` - If the schema repository cannot be found; the attempt to transport or manipulate the event type's schema fails; the event type's schema text, as stored in the schema repository, cannot be parsed; or there is a read error while reading the event type's schema.
    `RemoteException` - If an RMI communication failure occurs.

### addListener

    public void addListener(String eventTypeName,
                            EventListener eventListener)
                     throws EventContextException

  Register a listener for all events of type eventTypeName. Passing eventTypeName=null means you want to be notified about all event types.

  Throws:
    `EventContextException`

### addListener

    public void addListener(String eventTypeName,
                            EventListener eventListener,
                            String subscriberName)
                     throws EventContextException

  Register a listener for all events of type eventTypeName. Passing eventTypeName=null means you want to be notified about all event types. If subscriberName is specified, the Listener will utilize a Durable Subscriber. If subscriberName is null or empty, a non-Durable Subscriber will be used.

  Parameters:
    `eventTypeName` -
    `eventListener` -
    `subscriberName` - unique name for a durable subscriber
  Throws:
    `EventContextException`

### containsListener

    public boolean containsListener(String eventTypeName,
                                    EventListener listener)

  Has this EventContext already had EventListener given by listener register interest in events of type eventTypeName.

### removeListener

    public boolean removeListener(String eventTypeName,
                                  EventListener listener)

  Remove this listener from the list of listeners on events of type eventTypeName.

### getContext

    public Context getContext()

  Get the JNDI context being used.

### getJMSTopic

    public javax.jms.Topic getJMSTopic()

  Deprecated. This method is no longer used due to internal refactoring.

  Get the JMS topic being used; may be null depending on construction

### getJMSQueue

    public javax.jms.Queue getJMSQueue()

  Deprecated. This method is no longer used due to internal refactoring.

  Get the JMS queue being used; may be null depending on construction

### reinitialize

    public void reinitialize()
                      throws NamingException,
                             EventContextException

  Reinitialize JMS resources using stored environment properties, and JMS topic name.

  Throws:
    `NamingException`
    `EventContextException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD