User: schaefera
  Date: 01/09/14 20:06:50

  Added:       src/main/org/jboss/jmx/connector/notification
                        JMSClientNotificationListener.java
                        JMSListenerSet.java
  Log:
  Added some fixes, reorganized the packaging therefore that the Test Client
  is outside of RMI/EJB Connector and utilize both Connectors.
  NOTE that the Test Client as well as the Test Server (for RMI Connector)
  is not there to replace JUnit test cases but to allow to test the components
  outside of JBoss.
  
  Revision  Changes    Path
  1.1                  
jboss/src/main/org/jboss/jmx/connector/notification/JMSClientNotificationListener.java
  
  Index: JMSClientNotificationListener.java
  ===================================================================
  /*
  * JBoss, the OpenSource J2EE webOS
  *
  * Distributable under LGPL license.
  * See terms of license at gnu.org.
  */
  package org.jboss.jmx.connector.notification;
  
  import java.io.Serializable;
  
  import javax.jms.JMSException;
  import javax.jms.Message;
  import javax.jms.MessageListener;
  import javax.jms.ObjectMessage;
  /*
  import javax.jms.Queue;
  import javax.jms.QueueConnection;
  import javax.jms.QueueConnectionFactory;
  import javax.jms.QueueReceiver;
  import javax.jms.QueueSender;
  import javax.jms.QueueSession;
  import javax.jms.Session;
  */
  
  import javax.management.Notification;
  import javax.management.NotificationListener;
  
  /**
  * Local JMX Listener to receive the message and send to the listener
  **/
  public class JMSClientNotificationListener implements MessageListener {
  
     private NotificationListener         mLocalListener;
     private Object                       mHandback;
     
     public JMSClientNotificationListener(
        NotificationListener pLocalListener,
        Object pHandback
     ) {
        mLocalListener = pLocalListener;
        mHandback = pHandback;
     }
  
     public void onMessage( Message pMessage ) {
        try {
           Notification lNotification = (Notification) ( (ObjectMessage) pMessage 
).getObject();
           mLocalListener.handleNotification( lNotification, mHandback );
        }
        catch( JMSException je ) {
           je.printStackTrace();
        }
     }
  
     /** Redesign it (AS) **/
     public NotificationListener getLocalListener() {
        return mLocalListener;
     }
     /**
     * Test if this and the given Object are equal. This is true if the given
     * object both refer to the same local listener
     *
     * @param pTest                  Other object to test if equal
     *
     * @return                     True if both are of same type and
     *                           refer to the same local listener
     **/
     public boolean equals( Object pTest ) {
        if( pTest instanceof JMSClientNotificationListener ) {
           return mLocalListener.equals(
              ( (JMSClientNotificationListener) pTest).mLocalListener
           );
        }
        return false;
     }
     /**
     * @return                     Hashcode of the local listener
     **/
     public int hashCode() {
        return mLocalListener.hashCode();
     }
  }
  
  
  
  1.1                  
jboss/src/main/org/jboss/jmx/connector/notification/JMSListenerSet.java
  
  Index: JMSListenerSet.java
  ===================================================================
  /*
  * JBoss, the OpenSource J2EE webOS
  *
  * Distributable under LGPL license.
  * See terms of license at gnu.org.
  */
  package org.jboss.jmx.connector.notification;
  
  import javax.management.NotificationListener;
  import javax.management.ObjectName;
  
  /**
  * Container for a JMS Listener Set to find later on the
  * Remote Listener based on the Object Name it is register
  * on and the local Notification Listener
  **/
  public class JMSListenerSet {
     
     private ObjectName mName;
     private NotificationListener mListener;
     private JMSNotificationListener mRemoteListener;
     
     public JMSListenerSet(
        ObjectName pName,
        NotificationListener pListener,
        JMSNotificationListener pRemoteListener
     ) {
        mName = pName;
        mListener = pListener;
        mRemoteListener = pRemoteListener;
     }
     
     public NotificationListener getRemoteListener() {
        return mRemoteListener;
     }
     
     public boolean equals( Object pTest ) {
        if( pTest instanceof JMSListenerSet ) {
           JMSListenerSet lTest = (JMSListenerSet) pTest;
           return mName.equals( lTest.mName ) &&
              mListener.equals( lTest.mListener );
        }
        return false;
     }
  }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to