You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by jf...@apache.org on 2004/07/23 02:28:39 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services Messenger.java

jford       2004/07/22 17:28:39

  Added:       src/java/org/apache/jetspeed/services Messenger.java
  Log:
  MessagingService implemenation
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/Messenger.java
  
  Index: Messenger.java
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.services;
  
  import javax.jms.Message;
  import javax.jms.MessageConsumer;
  import javax.jms.MessageListener;
  
  import org.apache.jetspeed.services.messaging.MessagingService;
  import org.apache.turbine.services.TurbineServices;
  
  /**
   * @author <a href="mailto:jford@apache.org">Jeremy Ford</a>
   * @version $Id: Messenger.java,v 1.1 2004/07/23 00:28:39 jford Exp $
   */
  public abstract class Messenger
  {
      /**
       * Commodity method for getting a reference to the service
       * singleton
       */
      private static MessagingService getService()
      {
          return (MessagingService)TurbineServices
                  .getInstance()
                  .getService(MessagingService.SERVICE_NAME);
      }
      
      public static void addMessageListener(MessageListener listener, String id, String destination)
      {
          getService().addMessageListener(listener, id, destination);
      }
      
      public static MessageConsumer createConsumer(String destination)
      {
          return getService().createConsumer(destination);
      }
      
      public static void removeMessageListener(String id)
      {
          getService().removeMessageListener(id);
      }
      
      public static void sendMessage(Message message, String destination)
      {
          getService().sendMessage(message, destination);
      }
      
      public static Message createMessage(int messageType)
      {
          return getService().createMessage(messageType);
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org