WebLogic Integration


com.bea.wlai.client
Class EventContext

java.lang.Object
  |
  +--com.bea.wlai.client.EventContext

public class EventContext
extends java.lang.Object
implements java.io.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.

Author:
Copyright © 2000, 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
ApplicationView, Serialized Form

Field Summary
static int JMS_QUEUE
           
static int JMS_TOPIC
           
 
Constructor Summary
protected EventContext()
          Constructor for use by Java serialization framework.
  EventContext(java.lang.String sourceKey, java.lang.String sourceType, javax.naming.Context context, java.lang.String jmsDestName)
          Deprecated. This method is too ambiguous because this Class now supports a JMS queue or topic as a destination.
  EventContext(java.lang.String sourceKey, java.lang.String sourceType, javax.naming.Context context, java.lang.String jmsDestName, int jmsDestType, boolean bTransactedJMSSession)
          Get an EventContext object using the given JNDI context.
  EventContext(java.lang.String sourceKey, java.lang.String sourceType, javax.naming.Context context, javax.jms.Topic jmsTopic)
          Deprecated. This method leaves the object in an un-initialized state if it is serialized because there is no way to re-establish the JMS Topic. Callers should use the constructor that specifies the JMS Topic JNDI name and let this instance lookup the Topic directly.
  EventContext(java.lang.String sourceKey, java.lang.String sourceType, java.util.Hashtable env, java.lang.String jmsDestName)
          Deprecated. This method is too ambiguous because this Class now supports a JMS queue or topic as a destination.
  EventContext(java.lang.String sourceKey, java.lang.String sourceType, java.util.Hashtable env, java.lang.String jmsDestName, boolean connect)
          Deprecated. This method is too ambiguous because this Class now supports a JMS queue or topic as a destination.
  EventContext(java.lang.String sourceKey, java.lang.String sourceType, java.util.Hashtable env, java.lang.String jmsDestName, int jmsDestType, boolean bTransactedJMSSession)
          Get an EventContext object using the given JNDI context.
 
Method Summary
 void addListener(java.lang.String eventTypeName, EventListener eventListener)
          Register a listener for all events of type eventTypeName.
 void addListener(java.lang.String eventTypeName, EventListener eventListener, java.lang.String subscriberName)
          Register a listener for all events of type eventTypeName.
protected  void checkClosed()
           
 void close()
          Close JMS resources.
protected  void closeQueueResources()
           
protected  void closeTopicResources()
           
 boolean containsListener(java.lang.String eventTypeName, EventListener listener)
          Has this EventContext already had EventListener given by listener register interest in events of type eventTypeName.
protected  void finalize()
          Cleans up this EventContext instance when the garbage collector determines this object is no longer needed.
 javax.naming.Context getContext()
          Get the JNDI context being used.
 javax.jms.Queue getJMSQueue()
          Get the JMS queue being used; may be null depending on construction
 javax.jms.Topic getJMSTopic()
          Get the JMS topic being used; may be null depending on construction
 java.lang.String getSourceKey()
           
 java.lang.String getSourceType()
           
protected  void initialize()
          Initialize JMS.
protected  void initQueueSender()
           
protected  void initTopicPublisher()
           
 void postEvent(java.lang.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(java.lang.String eventTypeName, EventListener listener)
          Remove this listener from the list of listeners on events of type eventTypeName.
protected  void setContext(javax.naming.Context context)
          Set the JNDI context to use.
protected  void setJMSQueue(javax.jms.Queue queue)
          Set the JMS queue to use.
protected  void setJMSTopic(javax.jms.Topic topic)
          Set the JMS topic to use.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JMS_TOPIC

public static final int JMS_TOPIC

JMS_QUEUE

public static final int JMS_QUEUE
Constructor Detail

EventContext

protected EventContext()
Constructor for use by Java serialization framework.

EventContext

public EventContext(java.lang.String sourceKey,
                    java.lang.String sourceType,
                    java.util.Hashtable env,
                    java.lang.String jmsDestName)
             throws javax.naming.NamingException,
                    EventContextException
Deprecated. This method is too ambiguous because this Class now supports a JMS queue or topic as a destination.
Get an EventContext object using an initial JNDI context obtained using the properties set in env, and attached to the JMS Topic given by jmsDestName.

EventContext

public EventContext(java.lang.String sourceKey,
                    java.lang.String sourceType,
                    java.util.Hashtable env,
                    java.lang.String jmsDestName,
                    boolean connect)
             throws javax.naming.NamingException,
                    EventContextException
Deprecated. This method is too ambiguous because this Class now supports a JMS queue or topic as a destination.
Get an EventContext object using an initial JNDI context obtained using the properties set in env, and attached to the JMS topic given by jmsDestName. If connect is false, the actual initialization of the JMS layer is deferred. The usage of the connect parameter is not implemented at this time.

EventContext

public EventContext(java.lang.String sourceKey,
                    java.lang.String sourceType,
                    javax.naming.Context context,
                    java.lang.String jmsDestName)
             throws javax.naming.NamingException,
                    EventContextException
Deprecated. This method is too ambiguous because this Class now supports a JMS queue or topic as a destination.
Get an EventContext object using the given JNDI context. This context will send messages to the JMS topic given by the jmsDestName parameter. The JMS session is not transacted.

EventContext

public EventContext(java.lang.String sourceKey,
                    java.lang.String sourceType,
                    javax.naming.Context context,
                    javax.jms.Topic jmsTopic)
             throws javax.naming.NamingException,
                    EventContextException
Deprecated. This method leaves the object in an un-initialized state if it is serialized because there is no way to re-establish the JMS Topic. Callers should use the constructor that specifies the JMS Topic JNDI name and let this instance lookup the Topic directly.
Get an EventContext object using the given JNDI context, and attached to the given JMS topic.

EventContext

public EventContext(java.lang.String sourceKey,
                    java.lang.String sourceType,
                    java.util.Hashtable env,
                    java.lang.String jmsDestName,
                    int jmsDestType,
                    boolean bTransactedJMSSession)
             throws javax.naming.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.

EventContext

public EventContext(java.lang.String sourceKey,
                    java.lang.String sourceType,
                    javax.naming.Context context,
                    java.lang.String jmsDestName,
                    int jmsDestType,
                    boolean bTransactedJMSSession)
             throws javax.naming.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.
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Cleans up this EventContext instance when the garbage collector determines this object is no longer needed.

Overrides:
finalize in class java.lang.Object

getSourceKey

public java.lang.String getSourceKey()


getSourceType

public java.lang.String getSourceType()


initialize

protected void initialize()
                   throws javax.naming.NamingException,
                          EventContextException
Initialize JMS. JNDI context, JMS destination JNDI name and type must be set before calling this method.


initTopicPublisher

protected void initTopicPublisher()
                           throws javax.naming.NamingException,
                                  EventContextException


initQueueSender

protected void initQueueSender()
                        throws javax.naming.NamingException,
                               EventContextException


close

public void close()
Close JMS resources.


closeTopicResources

protected void closeTopicResources()


closeQueueResources

protected void closeQueueResources()


checkClosed

protected void checkClosed()
                    throws EventContextException


postEvent

public void postEvent(java.lang.String eventType,
                      IEvent event)
               throws DocumentException,
                      EventContextException
Post an event with the given type and represented by the given event to this EventContext.


addListener

public void addListener(java.lang.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.


addListener

public void addListener(java.lang.String eventTypeName,
                        EventListener eventListener,
                        java.lang.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(java.lang.String eventTypeName,
                                EventListener listener)
Has this EventContext already had EventListener given by listener register interest in events of type eventTypeName.


removeListener

public boolean removeListener(java.lang.String eventTypeName,
                              EventListener listener)
Remove this listener from the list of listeners on events of type eventTypeName.


setJMSTopic

protected void setJMSTopic(javax.jms.Topic topic)
Set the JMS topic to use.


setJMSQueue

protected void setJMSQueue(javax.jms.Queue queue)
Set the JMS queue to use.


setContext

protected void setContext(javax.naming.Context context)
Set the JNDI context to use.


getContext

public javax.naming.Context getContext()
Get the JNDI context being used.


getJMSTopic

public javax.jms.Topic getJMSTopic()
Get the JMS topic being used; may be null depending on construction


getJMSQueue

public javax.jms.Queue getJMSQueue()
Get the JMS queue being used; may be null depending on construction


reinitialize

public void reinitialize()
                  throws javax.naming.NamingException,
                         EventContextException
Reinitialize JMS resources using stored environment properties, and JMS topic name.


toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

WebLogic Integration

WebLogic Integration (WLI)