geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanhongf...@apache.org
Subject svn commit: r1156451 - in /geronimo/server/trunk/plugins/uddi: uddi-jetty/ uddi-jetty/src/main/plan/ uddi-tomcat/ uddi-tomcat/src/main/plan/ uddi-war-repackage/src/main/java/org/apache/juddi/config/ uddi-war-repackage/src/main/resources/WEB-INF/classes...
Date Thu, 11 Aug 2011 02:39:56 GMT
Author: hanhongfang
Date: Thu Aug 11 02:39:55 2011
New Revision: 1156451

URL: http://svn.apache.org/viewvc?rev=1156451&view=rev
Log:
GERONIMO-6109 Derby connection failure in uddi when PortOffset is not 0

Added:
    geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/java/org/apache/juddi/config/
    geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/java/org/apache/juddi/config/PersistenceManager.java
  (with props)
Modified:
    geronimo/server/trunk/plugins/uddi/uddi-jetty/pom.xml
    geronimo/server/trunk/plugins/uddi/uddi-jetty/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/uddi/uddi-tomcat/pom.xml
    geronimo/server/trunk/plugins/uddi/uddi-tomcat/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/resources/WEB-INF/classes/META-INF/persistence.xml

Modified: geronimo/server/trunk/plugins/uddi/uddi-jetty/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/uddi/uddi-jetty/pom.xml?rev=1156451&r1=1156450&r2=1156451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/uddi/uddi-jetty/pom.xml (original)
+++ geronimo/server/trunk/plugins/uddi/uddi-jetty/pom.xml Thu Aug 11 02:39:55 2011
@@ -146,6 +146,17 @@
                         <deploymentConfig>${jasperDeployer}</deploymentConfig>
                     </deploymentConfigs>
                     <category>Web Services</category>
+                    <instance>
+                        <plugin-artifact>
+                            <config-xml-content>
+                                <gbean name="DerbyProperties">
+                                	<attribute name="systemProperties">
+                                		openjpa.ConnectionURL=jdbc:derby://localhost:${DerbyPort
+ PortOffset}/UddiDatabase;create=false;
+                                	</attribute>
+                                </gbean>
+                            </config-xml-content>
+                        </plugin-artifact>
+                    </instance>
                     <module>
                         <groupId>org.apache.geronimo.plugins</groupId>
                         <artifactId>uddi-war-repackage</artifactId>

Modified: geronimo/server/trunk/plugins/uddi/uddi-jetty/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/uddi/uddi-jetty/src/main/plan/plan.xml?rev=1156451&r1=1156450&r2=1156451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/uddi/uddi-jetty/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/uddi/uddi-jetty/src/main/plan/plan.xml Thu Aug 11 02:39:55
2011
@@ -20,6 +20,12 @@
 
 <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/jetty-2.0.2">
   <context-root>/juddi</context-root>
+  <!-- System Properties -->
+ <gbean name="DerbyProperties" class="org.apache.geronimo.system.properties.SystemProperties">
+     <attribute name="systemProperties">
+          openjpa.ConnectionURL=jdbc:derby://localhost:${DerbyPort}/UddiDatabase;create=false;
+     </attribute>
+ </gbean>
   <!--<gbean name="UDDIResources" class="org.apache.geronimo.system.util.DirectoryInitializationGBean">-->
     <!-- copies uddi derby db files into specified location -->
     <!--<attribute name="prefix">META-INF/geronimo-uddi-db</attribute>-->

Modified: geronimo/server/trunk/plugins/uddi/uddi-tomcat/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/uddi/uddi-tomcat/pom.xml?rev=1156451&r1=1156450&r2=1156451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/uddi/uddi-tomcat/pom.xml (original)
+++ geronimo/server/trunk/plugins/uddi/uddi-tomcat/pom.xml Thu Aug 11 02:39:55 2011
@@ -189,6 +189,17 @@
                         <deploymentConfig>${jasperDeployer}</deploymentConfig>
                     </deploymentConfigs>
                     <category>Web Services</category>
+                    <instance>
+                        <plugin-artifact>
+                            <config-xml-content>
+                                <gbean name="DerbyProperties">
+                                	<attribute name="systemProperties">
+                                		openjpa.ConnectionURL=jdbc:derby://localhost:${DerbyPort
+ PortOffset}/UddiDatabase;create=false;
+                                	</attribute>
+                                </gbean>
+                            </config-xml-content>
+                        </plugin-artifact>
+                    </instance>
                     <module>
                         <groupId>org.apache.geronimo.plugins</groupId>
                         <artifactId>uddi-war-repackage</artifactId>

Modified: geronimo/server/trunk/plugins/uddi/uddi-tomcat/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/uddi/uddi-tomcat/src/main/plan/plan.xml?rev=1156451&r1=1156450&r2=1156451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/uddi/uddi-tomcat/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/uddi/uddi-tomcat/src/main/plan/plan.xml Thu Aug 11 02:39:55
2011
@@ -40,7 +40,7 @@
 
   <context-root>/juddi</context-root>
   
-  <naming:resource-ref>
+    <naming:resource-ref>
         <naming:ref-name>jdbc/juddiDB</naming:ref-name>
         <naming:resource-link>jdbc/juddiDB</naming:resource-link>
     </naming:resource-ref>
@@ -48,4 +48,11 @@
         <naming:ref-name>jdbc/NoTxJuddiDB</naming:ref-name>
         <naming:resource-link>jdbc/NoTxJuddiDB</naming:resource-link>
     </naming:resource-ref>
+    
+   <!-- System Properties -->
+    <gbean name="DerbyProperties" class="org.apache.geronimo.system.properties.SystemProperties">
+        <attribute name="systemProperties">
+             openjpa.ConnectionURL=jdbc:derby://localhost:${DerbyPort}/UddiDatabase;create=false;
+        </attribute>
+    </gbean>
 </web-app>

Added: geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/java/org/apache/juddi/config/PersistenceManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/java/org/apache/juddi/config/PersistenceManager.java?rev=1156451&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/java/org/apache/juddi/config/PersistenceManager.java
(added)
+++ geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/java/org/apache/juddi/config/PersistenceManager.java
Thu Aug 11 02:39:55 2011
@@ -0,0 +1,46 @@
+package org.apache.juddi.config;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class PersistenceManager
+{
+  private static Log log = LogFactory.getLog(PersistenceManager.class);
+  public static final String PERSISTENCE_UNIT_NAME = "juddiDatabase";
+  private static EntityManagerFactory emf;
+
+  public static EntityManager getEntityManager()
+  {
+    try
+    {
+      if (emf == null)
+        AppConfig.getInstance();
+    }
+    catch (ConfigurationException e) {
+      log.error("Error initializing config in PersistenceManager", e);
+      throw new ExceptionInInitializerError(e);
+    }
+
+    return emf.createEntityManager();
+  }
+
+  public static void closeEntityManager() {
+    if (emf.isOpen())
+      emf.close();
+  }
+
+  protected static void initializeEntityManagerFactory(String persistenceUnitName) {
+    try {
+      if (emf == null)
+        emf = Persistence.createEntityManagerFactory(persistenceUnitName, System.getProperties());
+    }
+    catch (Throwable t) {
+      log.error("entityManagerFactory creation failed", t);
+      throw new ExceptionInInitializerError(t);
+    }
+  }
+}

Propchange: geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/java/org/apache/juddi/config/PersistenceManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/java/org/apache/juddi/config/PersistenceManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/java/org/apache/juddi/config/PersistenceManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/resources/WEB-INF/classes/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/resources/WEB-INF/classes/META-INF/persistence.xml?rev=1156451&r1=1156450&r2=1156451&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/resources/WEB-INF/classes/META-INF/persistence.xml
(original)
+++ geronimo/server/trunk/plugins/uddi/uddi-war-repackage/src/main/resources/WEB-INF/classes/META-INF/persistence.xml
Thu Aug 11 02:39:55 2011
@@ -65,7 +65,8 @@
       
       <!-- derby connection properties -->
       <property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.ClientDriver"/>
-      <property name="openjpa.ConnectionURL" value="jdbc:derby://localhost:1527/UddiDatabase;create=false;"/>
+      <!-- openjpa.ConnectionURL is set in plan.xml of uddi-tomcat to enable PortOffset-->

+      <!-- property name="openjpa.ConnectionURL" value="jdbc:derby://localhost:1527/UddiDatabase;create=false;"/-->
       <property name="openjpa.ConnectionUserName" value="app"/>
       <property name="openjpa.ConnectionPassword" value="app"/>
       



Mime
View raw message