geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r993568 - in /geronimo/server/trunk/plugins: openejb/openejb-deployer/src/main/plan/ openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/ openjpa2/geronimo-persistence-jpa20/ openjpa2/geronimo-p...
Date Wed, 08 Sep 2010 00:45:28 GMT
Author: vamsic007
Date: Wed Sep  8 00:45:27 2010
New Revision: 993568

URL: http://svn.apache.org/viewvc?rev=993568&view=rev
Log:
GERONIMO-5226 Pass container ValidationFactory to the persistance manager when creating an
entity manager.
  o Hook the BValModuleBuilderExtension to openejb deployer.
  o Add ValidatorFactoryGBean as a parameter to PersistenceUnitGBean constructor.

Modified:
    geronimo/server/trunk/plugins/openejb/openejb-deployer/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
    geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/pom.xml
    geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
    geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/src/test/java/org/apache/geronimo/persistence/PersistenceUnitGBeanTest.java

Modified: geronimo/server/trunk/plugins/openejb/openejb-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/openejb-deployer/src/main/plan/plan.xml?rev=993568&r1=993567&r2=993568&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/openejb-deployer/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/openejb/openejb-deployer/src/main/plan/plan.xml Wed Sep
 8 00:45:27 2010
@@ -45,6 +45,9 @@
             <pattern>
                 <name>SecurityBuilder</name>
             </pattern>
+            <pattern>
+                <name>BValModuleBuilderExtension</name>
+            </pattern>
         </references>
         <references name="ServiceBuilders">
             <pattern>

Modified: geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java?rev=993568&r1=993567&r2=993568&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
Wed Sep  8 00:45:27 2010
@@ -241,6 +241,7 @@ public class PersistenceUnitBuilder impl
             gbeanData.setReferencePattern("NonJtaDataSourceWrapper", defaultNonJtaDataSourceName);
         }
 
+        gbeanData.setAttribute("moduleName", module.getModuleName());
         gbeanData.setAttribute("mappingFileNames", new ArrayList<String>());
         gbeanData.setAttribute("excludeUnlistedClasses", false);
         gbeanData.setAttribute("managedClassNames", new ArrayList<String>());
@@ -251,6 +252,8 @@ public class PersistenceUnitBuilder impl
         AbstractNameQuery transactionManagerName = moduleContext.getTransactionManagerName();
         gbeanData.setReferencePattern("TransactionManager", transactionManagerName);
         gbeanData.setReferencePattern("EntityManagerRegistry", extendedEntityManagerRegistryName);
+        AbstractName validatorName = moduleContext.getNaming().createChildName(module.getModuleName(),
"ValidatorFactory", NameFactory.VALIDATOR_FACTORY);
+        gbeanData.setReferencePattern("ValidatorFactory", validatorName);
 
         setOverrideableProperties(persistenceUnit, gbeanData);
         return gbeanData;

Modified: geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/pom.xml?rev=993568&r1=993567&r2=993568&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/pom.xml (original)
+++ geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/pom.xml Wed Sep  8 00:45:27
2010
@@ -47,6 +47,12 @@
             <version>${project.version}</version>
             <scope>provided</scope>
         </dependency>
+            
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-bval</artifactId>
+            <version>${project.version}</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java?rev=993568&r1=993567&r2=993568&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
(original)
+++ geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
Wed Sep  8 00:45:27 2010
@@ -39,6 +39,7 @@ import javax.persistence.spi.Persistence
 import javax.persistence.spi.PersistenceUnitTransactionType;
 import javax.resource.ResourceException;
 import javax.sql.DataSource;
+import org.apache.geronimo.bval.ValidatorFactoryGBean; 
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.SingleElementCollection;
@@ -87,6 +88,7 @@ public class PersistenceUnitGBean implem
                                 @ParamAttribute(name = "persistenceXMLSchemaVersion") String
persistenceXMLSchemaVersion,
                                 @ParamAttribute(name = "sharedCacheMode") SharedCacheMode
sharedCacheMode,
                                 @ParamAttribute(name = "validationMode") ValidationMode validationMode,
+                                @ParamReference(name = "ValidatorFactory", namingType = NameFactory.VALIDATOR_FACTORY)
ValidatorFactoryGBean validatorFactory,
                                 @ParamSpecial(type = SpecialAttributeType.bundle) Bundle
bundle,
                                 @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader
classLoader) throws URISyntaxException, MalformedURLException, ResourceException {
         List<String> mappingFileNames = mappingFileNamesUntyped == null ? NO_STRINGS
: new ArrayList<String>(mappingFileNamesUntyped);
@@ -112,6 +114,8 @@ public class PersistenceUnitGBean implem
         if (properties == null) {
             properties = new Properties();
         }
+        // add the module validator factory instance 
+        properties.put("javax.persistence.validation.factory", validatorFactory.getFactory());
         PersistenceUnitTransactionType persistenceUnitTransactionType = persistenceUnitTransactionTypeString
== null ? PersistenceUnitTransactionType.JTA : PersistenceUnitTransactionType.valueOf(persistenceUnitTransactionTypeString);
 
         if (persistenceProviderClassName == null) persistenceProviderClassName = "org.apache.openjpa.persistence.PersistenceProviderImpl";

Modified: geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/src/test/java/org/apache/geronimo/persistence/PersistenceUnitGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/src/test/java/org/apache/geronimo/persistence/PersistenceUnitGBeanTest.java?rev=993568&r1=993567&r2=993568&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/src/test/java/org/apache/geronimo/persistence/PersistenceUnitGBeanTest.java
(original)
+++ geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20/src/test/java/org/apache/geronimo/persistence/PersistenceUnitGBeanTest.java
Wed Sep  8 00:45:27 2010
@@ -25,6 +25,7 @@ import javax.persistence.ValidationMode;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.kernel.osgi.MockBundle;
+import org.apache.geronimo.bval.ValidatorFactoryGBean; 
 
 /**
  * @version $Rev$ $Date$
@@ -52,6 +53,7 @@ public class PersistenceUnitGBeanTest ex
                 "2.0",
                 SharedCacheMode.NONE,
                 ValidationMode.AUTO,
+                new ValidatorFactoryGBean("Dummy", new MockBundle(getClass().getClassLoader(),
"", 0L), getClass().getClassLoader(), null), 
                 new MockBundle(getClass().getClassLoader(), "", 0L),
                 getClass().getClassLoader());
         assertNotNull(gbean.getManagedClassNames());



Mime
View raw message