commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet Main.java
Date Wed, 14 Aug 2002 14:36:12 GMT
jstrachan    2002/08/14 07:36:12

  Modified:    messenger/src/java/org/apache/commons/messagelet Main.java
  Added:       messenger/src/java/org/apache/commons/messagelet/model
                        package.html SubscriptionList.java
                        Subscription.java SubscriptionDigester.java
  Removed:     messenger/src/java/org/apache/commons/messagelet/impl
                        SubscriptionList.java Subscription.java
                        SubscriptionDigester.java
  Log:
  Moved the subscription model out into its own package. This model could be editted using
a UI of some kind, so I've moved it into its own package to make it more obvious.
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet/model/package.html
  
  Index: package.html
  ===================================================================
  <html>
  <head>
  </head>
  <body>
  
    <p>
    	This package represents the subscription model of a Messagelet engine.
    </p>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet/model/SubscriptionList.java
  
  Index: SubscriptionList.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   * 
   * $Id: SubscriptionList.java,v 1.1 2001/10/26 11:52:16 jstrachan Exp $
   */
  package org.apache.commons.messagelet.model;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  import javax.jms.JMSException;
  
  /** <p><code>SubscriptionList</code> a bean used by the digester to 
    * create a list of JMS subscriptions.</p>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class SubscriptionList {
  
      private List subscriptions = new ArrayList();
      
      public SubscriptionList() {
      }
      
  /*    
      public void subscribe(JmsConnector connector) throws JMSException {
          for ( Iterator iter = subscriptions.iterator(); iter.hasNext(); ) {
              Subscription subscription = (Subscription) iter.next();
              subscription.subscribe( connector );
          }
      }
  */
      
      public void addSubscription(Subscription subscription) {
          subscriptions.add( subscription );
      }
      
      public void removeSubscription(Subscription subscription) {
          subscriptions.remove( subscription );
      }
      
      public List getSubscriptions() {
          return subscriptions;
      }
      
      public void setSubscriptions(List subscriptions) {
          this.subscriptions = subscriptions;
      }
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet/model/Subscription.java
  
  Index: Subscription.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   * 
   * $Id: Subscription.java,v 1.2 2002/05/15 14:36:34 jstrachan Exp $
   */
  package org.apache.commons.messagelet.model;
  
  import javax.jms.Destination;
  import javax.jms.JMSException;
  import javax.jms.MessageListener;
  
  import org.apache.commons.messenger.Messenger;
  import org.apache.commons.messenger.MessengerManager;
  
  /** <p><code>SubscriptionList</code> a bean used by the digester to 
    * create a list of JMS subscriptions.</p>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.2 $
    */
  public class Subscription {
  
      /** Holds value of property connection. */
      private String connection;
      
      /** Holds value of property subject. */
      private String subject;
      
      /** Holds value of property selector. */
      private String selector;
      
      /** Holds value of property messageListener. */
      private MessageListener messageListener;
      
      /** Holds value of property servlet. */
      private String servlet;
      
      public Subscription() {
      }        
          
      /** Getter for property connection.
       * @return Value of property connection.
       */
      public String getConnection() {
          return connection;
      }
      
      /** Setter for property connection.
       * @param connection New value of property connection.
       */
      public void setConnection(String connection) {
          this.connection = connection;
      }
      
      /** Getter for property subject.
       * @return Value of property subject.
       */
      public String getSubject() {
          return subject;
      }
      
      /** Setter for property subject.
       * @param subject New value of property subject.
       */
      public void setSubject(String subject) {
          this.subject = subject;
      }
      
      /** Getter for property selector.
       * @return Value of property selector.
       */
      public String getSelector() {
          return selector;
      }
      
      /** Setter for property selector.
       * @param selector New value of property selector.
       */
      public void setSelector(String selector) {
          this.selector = selector;
      }
      
      /** Getter for property messageListener.
       * @return Value of property messageListener.
       */
      public MessageListener getMessageListener() {
          return messageListener;
      }
      
      /** Setter for property messageListener.
       * @param messageListener New value of property messageListener.
       */
      public void setMessageListener(MessageListener messageListener) {
          this.messageListener = messageListener;
      }
      
      
      /** Getter for property servlet.
       * @return Value of property servlet.
       */
      public String getServlet() {
          return servlet;
      }
      
      /** Setter for property servlet.
       * @param servlet New value of property servlet.
       */
      public void setServlet(String servlet) {
          this.servlet = servlet;
      }
      
      
      /** Outputs a debugging string */
      public String toString() {
          StringBuffer buffer = new StringBuffer( super.toString() );
          buffer.append( "[ connection: " );
          buffer.append( connection );
          buffer.append( " subject: " );
          buffer.append( subject );
          if ( selector != null ) {
              buffer.append( " selector: " );
              buffer.append( selector );
          }
          if ( servlet != null ) {
              buffer.append( " servlet: " );
              buffer.append( servlet );
          }
          else {
              buffer.append( " messageListener: " );
              buffer.append( messageListener );
          }
          return buffer.toString();
      }   
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet/model/SubscriptionDigester.java
  
  Index: SubscriptionDigester.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   * 
   * $Id: SubscriptionDigester.java,v 1.6 2002/07/09 11:53:35 jstrachan Exp $
   */
  package org.apache.commons.messagelet.model;
  
  import org.apache.commons.digester.Digester;
  
  /** <p><code>MessengerDigester</code> is a digester of Messenger objects
so 
    * that JMS Messengers can be created from an XML config file.</p>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.6 $
    */
  public class SubscriptionDigester extends Digester {
  
      // default implementation classes
      private String subscriptionsClass = "org.apache.commons.messagelet.model.SubscriptionList";
      private String subscriptionClass = "org.apache.commons.messagelet.model.Subscription";
      private String listenerClass = "org.apache.commons.messagelet.impl.MessageServletDispatcher";
      private String bridgeClass = "org.apache.commons.messagelet.BridgeMDO";
      private String distributeBridgeClass = "org.apache.commons.messagelet.DistributeBridgeMDO";
      private String stopWatchClass = "org.apache.commons.messenger.tool.StopWatchMessageListener";
      
      public SubscriptionDigester() {
      }
      
      // Implementation methods
      //-------------------------------------------------------------------------    
  
      /** Configure the parsing rules that will be used to process 
       * the cache config file
       */
      protected void configure() {
          if (configured) {
              return;
          }
          else {
              configured = true;
          }
          
          String path = "subscriptions";
          
          addObjectCreate( path, subscriptionsClass, "className" );
          addSetProperties( path );
      
          path = "subscriptions/subscription";
          addObjectCreate( path, subscriptionClass, "className" );
          addSetProperties( path );        
          addSetNext( path, "addSubscription",
             "org.apache.commons.messagelet.model.Subscription"
          );        
  
          addCallMethod( "subscriptions/subscription/servlet", "setServlet", 0);
          
          path = "subscriptions/subscription/listener";
          addObjectCreate( path, listenerClass, "className" );
          addSetProperties( path );
          addSetNext( path, "setMessageListener",
             "javax.jms.MessageListener"
          );
          
          path = "subscriptions/subscription/stopWatch";
          addObjectCreate( path, stopWatchClass, "className" );
          addSetProperties( path );
          addSetNext( path, "setMessageListener",
             "javax.jms.MessageListener"
          );
  
          
          path = "subscriptions/subscription/bridge";
          addObjectCreate( path, bridgeClass, "className" );
          addSetProperties( path );
          addSetNext( path, "setMessageListener",
             "javax.jms.MessageListener"
          );
          
          path = "subscriptions/subscription/distributeBridge";
          addObjectCreate( path, distributeBridgeClass, "className" );
          addSetProperties( path );
          addSetNext( path, "setMessageListener",
             "javax.jms.MessageListener"
          );
          
          addCallMethod("subscriptions/subscription/distributeBridge/subject", "addOutputSubject",
0);        
      }
  }
  
  
  
  1.4       +3 -3      jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet/Main.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Main.java	9 Jul 2002 11:53:34 -0000	1.3
  +++ Main.java	14 Aug 2002 14:36:12 -0000	1.4
  @@ -24,9 +24,9 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  -import org.apache.commons.messagelet.impl.Subscription;
  -import org.apache.commons.messagelet.impl.SubscriptionDigester;
  -import org.apache.commons.messagelet.impl.SubscriptionList;
  +import org.apache.commons.messagelet.model.Subscription;
  +import org.apache.commons.messagelet.model.SubscriptionDigester;
  +import org.apache.commons.messagelet.model.SubscriptionList;
   import org.apache.commons.messenger.Messenger;
   import org.apache.commons.messenger.MessengerManager;
   import org.apache.commons.messenger.tool.StopWatchMessageListener;
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message