[jboss-svn-commits] JBL Code SVN: r25294 - in labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq: src/main/java/org/jboss/soa/esb/oracle/aq and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Feb 16 22:38:10 EST 2009


Author: beve
Date: 2009-02-16 22:38:10 -0500 (Mon, 16 Feb 2009)
New Revision: 25294

Added:
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/org.jboss.soa.esb.oracle.aq-4.3.jar
Modified:
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/pom.xml
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQInitialContextFactory.java
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQUtil.java
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2411 "AQInitialContextFactory: Add support for a URL property to enable usage with RAC(Real Application Cluster)"


Added: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/org.jboss.soa.esb.oracle.aq-4.3.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/org.jboss.soa.esb.oracle.aq-4.3.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/pom.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/pom.xml	2009-02-17 03:14:37 UTC (rev 25293)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/pom.xml	2009-02-17 03:38:10 UTC (rev 25294)
@@ -2,7 +2,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.jboss.soa.esb</groupId>
   <artifactId>org.jboss.soa.esb.oracle.aq</artifactId>
-  <version>4.2</version>
+  <version>4.3</version>
   <description>Plugin to add JNDI capability to Oracle AQ</description>
   <build>
     <defaultGoal>package</defaultGoal>
@@ -69,6 +69,11 @@
       <version>1.2</version>
       <scope>provided</scope>
     </dependency>
+	<dependency>
+		<groupId>jboss</groupId>
+		<artifactId>jbossall-client</artifactId>
+		<version>4.2.2</version>
+	</dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
@@ -77,7 +82,7 @@
     <dependency>
       <groupId>mockejb</groupId>
       <artifactId>mockejb</artifactId>
-      <version>0.5</version>
+      <version>0.6-beta2</version>
     </dependency>
     <dependency>
       <groupId>cglib</groupId>
@@ -85,4 +90,4 @@
       <version>2.1_3</version>
     </dependency>
   </dependencies>
-</project>
\ No newline at end of file
+</project>

Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQInitialContextFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQInitialContextFactory.java	2009-02-17 03:14:37 UTC (rev 25293)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQInitialContextFactory.java	2009-02-17 03:38:10 UTC (rev 25294)
@@ -1,24 +1,24 @@
 /*
  * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated 
- * by the @authors tag. All rights reserved. 
+ * Copyright 2006, JBoss Inc., 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. 
+ * 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 
+ * 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, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2007,
  * @author David Fry <dfry at redhat.com>
  * @author Kurt Stam <kurt.stam at jboss.com>
- * 
+ *
  */
 package org.jboss.soa.esb.oracle.aq;
 
@@ -68,7 +68,7 @@
     public static final String CONNECTION_FACTORY          = "ConnectionFactory";
     /** The Oracle XA Connection factory name */
     public static final String XA_CONNECTION_FACTORY       = "XAConnectionFactory";
-    
+
     public static final String DB_DATASOURCE = "java.naming.oracle.aq.datasource";
     public static final String DB_USER       = "java.naming.oracle.aq.user";
     public static final String DB_PASSWD     = "java.naming.oracle.aq.password";
@@ -77,7 +77,8 @@
     public static final String DB_PORT       = "java.naming.oracle.aq.port";
     public static final String DB_SCHEMA     = "java.naming.oracle.aq.schema";
     public static final String DB_DRIVER     = "java.naming.oracle.aq.driver";
-    
+    public static final String DB_CONNECTION_URL     = "java.naming.oracle.aq.url";
+
     protected static Log log = LogFactory
             .getLog(AQInitialContextFactory.class);
 
@@ -99,7 +100,9 @@
 
     protected int aqServerPortNumber = 1521;
 
+    protected String aqConnectionUrl;
 
+
     private void addAQDestinationContext(Context context) throws NamingException {
 
         // lookup and cache the queues
@@ -114,11 +117,16 @@
             DataSource ds = null;
             XADataSource xaDs = null;
             try {
-                ds = AQUtil.getSQLDataSource(
-                        aqServerName, aqServerDBInst, aqServerPortNumber, aqDBDriver, dbuser,
-                        dbpass);
-                xaDs = AQUtil.getXASQLDataSource(aqServerName, aqServerDBInst, aqServerPortNumber, aqDBDriver, dbuser,
-                        dbpass);
+                if (aqConnectionUrl != null)
+                {
+                    ds = AQUtil.getSQLDataSource(aqConnectionUrl, dbuser, dbpass);
+                    xaDs = AQUtil.getXASQLDataSource(aqConnectionUrl, dbuser, dbpass);
+                }
+                else
+                {
+                    ds = AQUtil.getSQLDataSource( aqServerName, aqServerDBInst, aqServerPortNumber, aqDBDriver, dbuser, dbpass);
+                    xaDs = AQUtil.getXASQLDataSource(aqServerName, aqServerDBInst, aqServerPortNumber, aqDBDriver, dbuser, dbpass);
+                }
             } catch (SQLException e) {
                 throw new RuntimeException(e.getMessage());
             }
@@ -141,11 +149,11 @@
             // create the queue XA connection factory
             XAQueueConnectionFactory xaQueueConnectionFactory = AQjmsFactory.getXAQueueConnectionFactory(xaDs);
             context.rebind(XA_QUEUE_CONNECTION_FACTORY, xaQueueConnectionFactory);
-            
+
 //          create the topic XA connection factory
             XATopicConnectionFactory xaTopicConnectionFactory = AQjmsFactory.getXATopicConnectionFactory(xaDs);
             context.rebind(XA_TOPIC_CONNECTION_FACTORY, xaTopicConnectionFactory);
-            
+
             // create the topic connection factory
             topicFactory = AQjmsFactory.getTopicConnectionFactory(ds);
             context.rebind(TOPIC_CONNECTION_FACTORY, topicFactory);
@@ -201,18 +209,28 @@
     }
 
     public void init(Hashtable<?, ?> env) {
-
         dbuser = (String) env.get(AQInitialContextFactory.DB_USER);
         dbpass = (String) env.get(AQInitialContextFactory.DB_PASSWD);
-        aqServerName = (String) env.get(AQInitialContextFactory.DB_SERVER);
-        aqServerDBInst = (String) env.get(AQInitialContextFactory.DB_INSTANCE);
-        aqServerPort = (String) env.get(AQInitialContextFactory.DB_PORT);
-        aqDBDriver = (String) env.get(AQInitialContextFactory.DB_DRIVER);
-        aqSchemaName = (String) env.get(AQInitialContextFactory.DB_SCHEMA);
-        try {
-            aqServerPortNumber = Integer.parseInt(aqServerPort);
-        } catch (Exception e) {
-            log.error("caught exception converting port", e);
+        aqConnectionUrl = (String) env.get(AQInitialContextFactory.DB_CONNECTION_URL);
+
+        if (aqConnectionUrl == null )
+        {
+            aqServerName = (String) env.get(AQInitialContextFactory.DB_SERVER);
+            aqServerDBInst = (String) env.get(AQInitialContextFactory.DB_INSTANCE);
+            aqDBDriver = (String) env.get(AQInitialContextFactory.DB_DRIVER);
+            aqSchemaName = (String) env.get(AQInitialContextFactory.DB_SCHEMA);
+            aqServerPort = (String) env.get(AQInitialContextFactory.DB_PORT);
+            if (aqServerPort != null)
+            {
+                try
+                {
+                    aqServerPortNumber = Integer.parseInt(aqServerPort);
+                }
+                catch (NumberFormatException e)
+                {
+                    log.error("caught exception converting port", e);
+                }
+            }
         }
     }
 
@@ -260,4 +278,8 @@
         this.dbuser = dbuser;
     }
 
+    public void setAqConnectionUrl(String url) {
+        aqConnectionUrl = url;
+    }
+
 }
\ No newline at end of file

Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQUtil.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQUtil.java	2009-02-17 03:14:37 UTC (rev 25293)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQUtil.java	2009-02-17 03:38:10 UTC (rev 25294)
@@ -1,24 +1,24 @@
 /*
  * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated 
- * by the @authors tag. All rights reserved. 
+ * Copyright 2006, JBoss Inc., 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. 
+ * 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 
+ * 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, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2007,
  * @author David Fry <dfry at redhat.com>
  * @author Kurt Stam <kurt.stam at jboss.com>
- * 
+ *
  */
 package org.jboss.soa.esb.oracle.aq;
 
@@ -54,8 +54,8 @@
     private static final String GET_QUEUES_PSQL = "SELECT allq.OWNER as owner, allq.NAME as name, allq.QUEUE_TYPE as queue_type, allqt.RECIPIENTS as recipients" +
     " from SYS.ALL_QUEUES allq, SYS.ALL_QUEUE_TABLES allqt " +
     " where allq.QUEUE_TABLE = allqt.QUEUE_TABLE and upper(allq.OWNER) in (?) order by name asc";
-    
 
+
     public static DataSource getSQLDataSource(String serverName,
             String dbInstance, int portNo, String driverName)
             throws SQLException {
@@ -98,6 +98,15 @@
         return ds;
     }
 
+    public static DataSource getSQLDataSource(final String url, final String username, final String password)throws SQLException {
+
+        OracleDataSource ds = new OracleDataSource();
+        ds.setURL(url);
+        ds.setUser(username);
+        ds.setPassword(password);
+        return ds;
+    }
+
     public static XADataSource getXASQLDataSource(String serverName,
             String dbInstance, int portNo, String driverName,
             String username, String password)
@@ -114,6 +123,15 @@
         return ds;
     }
 
+    public static XADataSource getXASQLDataSource(final String url, final String username, final String password) throws SQLException {
+
+        OracleXADataSource ds = new OracleXADataSource();
+        ds.setURL(url);
+        ds.setUser(username);
+        ds.setPassword(password);
+        return ds;
+    }
+
     public static List<DestinationInfo> getDestinationInfoList(DataSource ds, String commaSeperatedQueueOwnerList) {
         ArrayList<DestinationInfo> list = new ArrayList<DestinationInfo>();
         Connection connection = null;




More information about the jboss-svn-commits mailing list