[jboss-svn-commits] JBL Code SVN: r33066 - labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue May 25 06:05:28 EDT 2010


Author: kevin.conner at jboss.com
Date: 2010-05-25 06:05:26 -0400 (Tue, 25 May 2010)
New Revision: 33066

Added:
   labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/DefaultProvider.java
   labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/JMSProvider.java
   labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/Provider.java
Modified:
   labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/AbstractJmsServiceFactory.java
Log:
Add our own default provider: JBESB-3317

Modified: labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/AbstractJmsServiceFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/AbstractJmsServiceFactory.java	2010-05-25 09:18:29 UTC (rev 33065)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/AbstractJmsServiceFactory.java	2010-05-25 10:05:26 UTC (rev 33066)
@@ -23,7 +23,6 @@
 import javax.naming.NamingException;
 
 import org.jboss.jms.jndi.JMSProviderAdapter;
-import org.jboss.jms.jndi.JNDIProviderAdapter;
 import org.jbpm.JbpmException;
 import org.jbpm.svc.ServiceFactory;
 
@@ -55,9 +54,9 @@
     private ConnectionFactory connectionFactory;
 
     /**
-     * The JMS provider adapter.
+     * The provider.
      */
-    private JMSProviderAdapter jmsProviderAdapter ;
+    private Provider provider ;
 
     /**
      * Get the commitEnabled flag.
@@ -76,8 +75,8 @@
      */
     protected Object lookup(String name) throws NamingException
     {
-      final JMSProviderAdapter adapter = getJMSProviderAdapter() ;
-      final Context initial = adapter.getInitialContext() ;
+      final Provider provider = getProvider() ;
+      final Context initial = provider.getInitialContext() ;
       try
       {
         return initial.lookup(name);
@@ -89,14 +88,14 @@
     }
 
     /**
-     * Get the JMS provider adapter.
-     * @return The JMS provider adapter.
+     * Get the provider.
+     * @return The provider.
      * @throws NamingException For errors locating the adapter within JNDI.
      */
-    protected JMSProviderAdapter getJMSProviderAdapter()
+    protected Provider getProvider()
       throws NamingException
     {
-      if (jmsProviderAdapter == null)
+      if (provider == null)
       {
         if (providerAdapterJNDI != null)
         {
@@ -120,21 +119,24 @@
           {
             initial.close();
           }
-          if ((adapter != null) && (adapter instanceof JMSProviderAdapter))
+          if (adapter != null)
           {
-            jmsProviderAdapter = (JMSProviderAdapter)adapter ;
+            if (adapter instanceof JMSProviderAdapter)
+            {
+              provider = new JMSProvider((JMSProviderAdapter)adapter) ;
+            }
+            else if (adapter instanceof Provider)
+            {
+              provider = (Provider)adapter ;
+            }
           }
-          else
-          {
-            jmsProviderAdapter = new JNDIProviderAdapter() ;
-          }
         }
-        else
-        {
-          jmsProviderAdapter = new JNDIProviderAdapter() ;
-        }
       }
-      return jmsProviderAdapter ;
+      if (provider == null)
+      {
+        provider = new DefaultProvider() ;
+      }
+      return provider ;
     }
     
     /**
@@ -147,16 +149,16 @@
       {
         try
         {
-          final JMSProviderAdapter adapter = getJMSProviderAdapter() ;
+          final Provider provider = getProvider() ;
           final String jndiName ;
-          final String adapterQueueFactory = adapter.getQueueFactoryRef() ;
+          final String adapterQueueFactory = provider.getQueueFactoryRef() ;
           if (adapterQueueFactory != null)
           {
               jndiName = adapterQueueFactory ;
           }
           else
           {
-              final String adapterFactory = adapter.getFactoryRef() ;
+              final String adapterFactory = provider.getFactoryRef() ;
               if (adapterFactory != null)
               {
                   jndiName = adapterFactory ;
@@ -181,7 +183,7 @@
      */
     public void close()
     {
-      jmsProviderAdapter = null;
+      provider = null;
       connectionFactory = null;
     }
 }

Added: labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/DefaultProvider.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/DefaultProvider.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/DefaultProvider.java	2010-05-25 10:05:26 UTC (rev 33066)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.soa.esb.services.jbpm.integration;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+
+/**
+ * The default provider
+ */
+class DefaultProvider implements Provider
+{
+    /**
+     * Get the queue factory reference.
+     * @return The queue factory reference or null if not specified.
+     */
+    public String getQueueFactoryRef()
+    {
+        return null ;
+    }
+
+    /**
+     * Get the default factory reference.
+     * @return The default factory reference or null if not specified.
+     */
+    public String getFactoryRef()
+    {
+        return null ;
+    }
+
+    /**
+     * Get the initial context.
+     * @return The JNDI initial context.
+     * @throws NamingException For exceptions creating the context.
+     */
+    public Context getInitialContext()
+        throws NamingException
+    {
+        return new InitialContext() ;
+    }
+}


Property changes on: labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/DefaultProvider.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/JMSProvider.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/JMSProvider.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/JMSProvider.java	2010-05-25 10:05:26 UTC (rev 33066)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.soa.esb.services.jbpm.integration;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.jms.jndi.JMSProviderAdapter;
+
+
+/**
+ * The JMS provider
+ */
+class JMSProvider implements Provider
+{
+    /**
+     * The JMS provider adapter.
+     */
+    private final JMSProviderAdapter providerAdapter ;
+    
+    /**
+     * Construct the JMS provider.
+     * @param providerAdapter The JMS provider adapter.
+     */
+    JMSProvider(final JMSProviderAdapter providerAdapter)
+    {
+        this.providerAdapter = providerAdapter ;
+    }
+    
+    /**
+     * Get the queue factory reference.
+     * @return The queue factory reference or null if not specified.
+     */
+    public String getQueueFactoryRef()
+    {
+        return providerAdapter.getQueueFactoryRef() ;
+    }
+
+    /**
+     * Get the default factory reference.
+     * @return The default factory reference or null if not specified.
+     */
+    public String getFactoryRef()
+    {
+        return providerAdapter.getFactoryRef() ;
+    }
+
+    /**
+     * Get the initial context.
+     * @return The JNDI initial context.
+     * @throws NamingException For exceptions creating the context.
+     */
+    public Context getInitialContext()
+        throws NamingException
+    {
+        return providerAdapter.getInitialContext() ;
+    }
+}


Property changes on: labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/JMSProvider.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/Provider.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/Provider.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/Provider.java	2010-05-25 10:05:26 UTC (rev 33066)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.soa.esb.services.jbpm.integration;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+
+/**
+ * Provider interface
+ */
+public interface Provider
+{
+    /**
+     * Get the queue factory reference.
+     * @return The queue factory reference or null if not specified.
+     */
+    public String getQueueFactoryRef();
+
+    /**
+     * Get the default factory reference.
+     * @return The default factory reference or null if not specified.
+     */
+    public String getFactoryRef();
+
+    /**
+     * Get the initial context.
+     * @return The JNDI initial context.
+     * @throws NamingException For exceptions creating the context.
+     */
+    public Context getInitialContext()
+        throws NamingException;
+}


Property changes on: labs/jbossesb/branches/JBESB_4_7_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/Provider.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native



More information about the jboss-svn-commits mailing list