[jboss-cvs] joramtests/src/main/java/org/objectweb/jtests/jms/admin ...

Scott Stark scott.stark at jboss.com
Thu Mar 29 00:28:34 EDT 2007


  User: starksm 
  Date: 07/03/29 00:28:34

  Added:       src/main/java/org/objectweb/jtests/jms/admin   
                        AdminFactory.java Admin.java package.html
  Log:
  + covert to mvn
  + Drop the poor properties file setup logic and require that the properties be passed in
  
  Revision  Changes    Path
  1.1      date: 2007/03/29 04:28:34;  author: starksm;  state: Exp;joramtests/src/main/java/org/objectweb/jtests/jms/admin/AdminFactory.java
  
  Index: AdminFactory.java
  ===================================================================
  /*
   * JORAM: Java(TM) Open Reliable Asynchronous Messaging
   * Copyright (C) 2002 INRIA
   * Contact: joram-team at objectweb.org
   * 
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Lesser General Public
   * License as published by the Free Software Foundation; either
   * version 2.1 of the License, or any later version.
   * 
   * This library is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * Lesser General Public License for more details.
   * 
   * You should have received a copy of the GNU Lesser General Public
   * License along with this library; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
   * USA
   * 
   * Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
   * Contributor(s): ______________________________________.
   */
  
  package org.objectweb.jtests.jms.admin;
  
  import java.util.Properties;
  
  import org.jboss.util.NestedRuntimeException;
  
  public class AdminFactory
  {
     private static final String PROP_NAME = "jms.provider.admin.class";
  
     protected static String getAdminClassName(Properties props)
     {
        String adminClassName = props.getProperty(PROP_NAME);
        return adminClassName;
     }
  
     public static Admin getAdmin(Properties props)
     {
        String adminClassName = getAdminClassName(props);
        Admin admin = null;
        if (adminClassName == null)
        {
           throw new NestedRuntimeException("Property " + PROP_NAME + " has not been found in input props");
        }
        try
        {
           Class adminClass = Class.forName(adminClassName);
           admin = (Admin) adminClass.newInstance();
        }
        catch (ClassNotFoundException e)
        {
           throw new NestedRuntimeException("Class " + adminClassName + " not found.", e);
        }
        catch (Exception e)
        {
           throw new NestedRuntimeException(e);
        }
        return admin;
     }
  }
  
  
  
  1.1      date: 2007/03/29 04:28:34;  author: starksm;  state: Exp;joramtests/src/main/java/org/objectweb/jtests/jms/admin/Admin.java
  
  Index: Admin.java
  ===================================================================
  /*
   * JORAM: Java(TM) Open Reliable Asynchronous Messaging
   * Copyright (C) 2002 INRIA
   * Contact: joram-team at objectweb.org
   * 
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Lesser General Public
   * License as published by the Free Software Foundation; either
   * version 2.1 of the License, or any later version.
   * 
   * This library is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * Lesser General Public License for more details.
   * 
   * You should have received a copy of the GNU Lesser General Public
   * License along with this library; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
   * USA
   * 
   * Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
   * Contributor(s): ______________________________________.
   */
  
  package org.objectweb.jtests.jms.admin;
  
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  
  /**
   * Simple Administration interface.
   * <br />
   * JMS Provider has to implement this 
   * simple interface to be able to use the test suite.
   */
  public interface Admin
  {
  
     /**
      * Returns the name of the JMS Provider.
      *
      * @return name of the JMS Provider
      */
     public String getName();
  
     /** 
      * Returns an <code>InitialContext</code> with correct properties from
      * the JMS Provider.
      *
      * @return an <code>InitialContext</code> with correct properties from the JMS Provider.
      */
     public InitialContext createInitialContext() throws NamingException;
  
     /** 
      * Creates a <code>ConnectionFactory</code> and makes it available 
      *from JNDI with name <code>name</code>.
      *
      * @since JMS 1.1
      * @param name JNDI name of the <code>ConnectionFactory</code>
      */
     public void createConnectionFactory(String name);
  
     /** 
      * Creates a <code>QueueConnectionFactory</code> and makes it available 
      *from JNDI with name <code>name</code>.
      *
      * @param name JNDI name of the <code>QueueConnectionFactory</code>
      */
     public void createQueueConnectionFactory(String name);
  
     /** 
      * Creates a <code>TopicConnectionFactory</code> and makes it available 
      *from JNDI with name <code>name</code>.
      *
      * @param name JNDI name of the <code>TopicConnectionFactory</code>
      */
     public void createTopicConnectionFactory(String name);
  
     /** 
      * Creates a <code>Queue</code> and makes it available 
      *from JNDI with name <code>name</code>.
      *
      * @param name JNDI name of the <code>Queue</code>
      */
     public void createQueue(String name);
  
     /** 
      * Creates a <code>Topic</code> and makes it available 
      *from JNDI with name <code>name</code>.
      *
      * @param name JNDI name of the <code>Topic</code>
      */
     public void createTopic(String name);
  
     /** 
      * Removes the <code>Queue</code> of name <code>name</code> from JNDI and deletes it
      *
      * @param name JNDI name of the <code>Queue</code>
      */
     public void deleteQueue(String name);
  
     /** 
      * Removes the <code>Topic</code> of name <code>name</code> from JNDI and deletes it
      *
      * @param name JNDI name of the <code>Topic</code>
      */
     public void deleteTopic(String name);
  
     /** 
      * Removes the <code>ConnectionFactory</code> of name <code>name</code> from JNDI and deletes it
      *
      * @since JMS 1.1
      * @param name JNDI name of the <code>ConnectionFactory</code>
      */
     public void deleteConnectionFactory(String name);
  
     /** 
      * Removes the <code>QueueConnectionFactory</code> of name <code>name</code> from JNDI and deletes it
      *
      * @param name JNDI name of the <code>QueueConnectionFactory</code>
      */
     public void deleteQueueConnectionFactory(String name);
  
     /** 
      * Removes the <code>TopicConnectionFactory</code> of name <code>name</code> from JNDI and deletes it
      *
      * @param name JNDI name of the <code>TopicConnectionFactory</code>
      */
     public void deleteTopicConnectionFactory(String name);
  }
  
  
  
  1.1      date: 2007/03/29 04:28:34;  author: starksm;  state: Exp;joramtests/src/main/java/org/objectweb/jtests/jms/admin/package.html
  
  Index: package.html
  ===================================================================
    <body>
      Administration classes and interfaces used by the test suite to
      manageJMS administrated object in a provider-independent way. 
      <br />
      Each JMS Provider has to implement the very simple Admin interface to be able to
      use the test suite (see <a
        href="http://www.objectweb.org/joram/current/doc/tests/index.html">documentation</a>).
    </body>
  
  
  
  



More information about the jboss-cvs-commits mailing list