geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r539957 - in /geronimo/server/trunk/modules: geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ geronimo-persistence-jpa10-builder/src/main...
Date Sun, 20 May 2007 21:55:50 GMT
Author: djencks
Date: Sun May 20 14:55:49 2007
New Revision: 539957

URL: http://svn.apache.org/viewvc?view=rev&rev=539957
Log:
GERONIMO-3177 GERONIMO-3122 make exclude-unlisted-classes work.  Also make jpa work in standalone
ejb jars and wars

Modified:
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
    geronimo/server/trunk/modules/geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java?view=diff&rev=539957&r1=539956&r2=539957
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
Sun May 20 14:55:49 2007
@@ -45,6 +45,9 @@
     }
 
     public String getRelativePath(String path) {
+        if (isStandAlone()) {
+            return path;
+        }
         if (path.startsWith(getTargetPath())) {
             //in the war, remove war path and leading '/'
             path = path.substring(getTargetPath().length() + 1);

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?view=diff&rev=539957&r1=539956&r2=539957
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
Sun May 20 14:55:49 2007
@@ -154,7 +154,7 @@
     }
 
     public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
-        return createModule(plan, moduleFile, "ejb", null, null, null, naming, idBuilder);
+        return createModule(plan, moduleFile, "ejb.jar", null, null, null, naming, idBuilder);
     }
 
     public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl,
Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder
idBuilder) throws DeploymentException {
@@ -426,7 +426,7 @@
     public void initContext(EARContext earContext, Module module, ClassLoader classLoader)
throws DeploymentException {
         EjbModule ejbModule = (EjbModule) module;
         EarData earData = (EarData) earContext.getGeneralData().get(EarData.class);
-        
+
         EjbJarInfo ejbJarInfo = getEjbJarInfo(earContext, ejbModule, classLoader);
 
         ejbModule.setEjbJarInfo(ejbJarInfo);
@@ -488,10 +488,10 @@
     private EjbJarInfo getEjbJarInfo(EARContext earContext, EjbModule ejbModule, ClassLoader
classLoader) throws DeploymentException {
         EarData earData = (EarData) earContext.getGeneralData().get(EarData.class);
         if (earData.getEjbJars().isEmpty()) {
-            
-            // temporary classloader is used for processing ejb annotations and byte code
manipulation during ejb load 
+
+            // temporary classloader is used for processing ejb annotations and byte code
manipulation during ejb load
             TemporaryClassLoader temporaryClassLoader = new TemporaryClassLoader(new URL[0],
classLoader);
-            
+
             // create an openejb app module for the ear containing all ejb modules
             AppModule appModule = new AppModule(classLoader, ejbModule.getEjbModule().getModuleId());
             for (EjbModule module : earData.getEjbModuels()) {
@@ -580,6 +580,7 @@
                 persistenceUnit.setJtaDataSource("?name=SystemDatasource");
             }
             persistenceUnit.setNonJtaDataSource("?name=NoTxDatasource");
+            persistenceUnit.setExcludeUnlistedClasses(true);
 
             Persistence persistence = new Persistence();
             persistence.setVersion("1.0");

Modified: geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java?view=diff&rev=539957&r1=539956&r2=539957
==============================================================================
--- geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
Sun May 20 14:55:49 2007
@@ -242,30 +242,31 @@
         }
         gbeanData.setAttribute("mappingFileNames", mappingFileNames);
 
-        gbeanData.setAttribute("persistenceUnitRoot", persistenceModulePath);
+        boolean excludeUnlistedClasses = persistenceUnit.isSetExcludeUnlistedClasses() &&
persistenceUnit.getExcludeUnlistedClasses();
+        gbeanData.setAttribute("excludeUnlistedClasses", excludeUnlistedClasses);
+
 
-        List<String> jarFileUrls = new ArrayList<String>();
-        //add the artifact the persistence.xml is in
-        //TODO since we are setting the root url, this might not be needed.  On the other
hand,
-        //we might need to add all the manifest cp entries referenced from here.
-        jarFileUrls.add(persistenceModulePath);
-        //add the specified locations in the ear
-        String[] jarFileUrlStrings = persistenceUnit.getJarFileArray();
-        for (String jarFileUrlString : jarFileUrlStrings) {
-            jarFileUrls.add(jarFileUrlString.trim());
-        }
-        gbeanData.setAttribute("jarFileUrls", jarFileUrls);
+        gbeanData.setAttribute("persistenceUnitRoot", persistenceModulePath);
 
-        String[] managedClassNameStrings = persistenceUnit.getClass1Array();
-        List<String> managedClassNames = new ArrayList<String>();
-        for (String managedClassNameString : managedClassNameStrings) {
-            managedClassNames.add(managedClassNameString.trim());
-        }
-        gbeanData.setAttribute("managedClassNames", managedClassNames);
-        if (persistenceUnit.isSetExcludeUnlistedClasses()) {
-            gbeanData.setAttribute("excludeUnlistedClasses", persistenceUnit.getExcludeUnlistedClasses());
+        if (excludeUnlistedClasses) {
+            String[] managedClassNameStrings = persistenceUnit.getClass1Array();
+            List<String> managedClassNames = new ArrayList<String>();
+            for (String managedClassNameString : managedClassNameStrings) {
+                managedClassNames.add(managedClassNameString.trim());
+            }
+            gbeanData.setAttribute("managedClassNames", managedClassNames);
         } else {
-            gbeanData.setAttribute("excludeUnlistedClasses", false);
+            List<String> jarFileUrls = new ArrayList<String>();
+            //add the artifact the persistence.xml is in
+            //TODO since we are setting the root url, this might not be needed.  On the other
hand,
+            //we might need to add all the manifest cp entries referenced from here.
+//            jarFileUrls.add(persistenceModulePath);
+            //add the specified locations in the ear
+            String[] jarFileUrlStrings = persistenceUnit.getJarFileArray();
+            for (String jarFileUrlString : jarFileUrlStrings) {
+                jarFileUrls.add(jarFileUrlString.trim());
+            }
+            gbeanData.setAttribute("jarFileUrls", jarFileUrls);
         }
 
         Properties properties = new Properties();

Modified: geronimo/server/trunk/modules/geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java?view=diff&rev=539957&r1=539956&r2=539957
==============================================================================
--- geronimo/server/trunk/modules/geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
Sun May 20 14:55:49 2007
@@ -35,6 +35,7 @@
 import javax.persistence.spi.PersistenceUnitInfo;
 import javax.persistence.spi.PersistenceUnitTransactionType;
 import javax.sql.DataSource;
+import javax.resource.ResourceException;
 
 import org.apache.geronimo.connector.outbound.ConnectionFactorySource;
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -73,23 +74,26 @@
             List<String> mappingFileNamesUntyped,
             List<String> jarFileUrlsUntyped,
             String persistenceUnitRoot,
-            List<String> managedClassNamesUntyped,
+            List<String> managedClassNames,
             boolean excludeUnlistedClassesValue,
             Properties properties,
             TransactionManagerImpl transactionManager,
             Collection<ExtendedEntityManagerRegistry > entityManagerRegistry,
             URL configurationBaseURL,
-            ClassLoader classLoader) throws URISyntaxException, MalformedURLException {
+            ClassLoader classLoader) throws URISyntaxException, MalformedURLException, ResourceException
{
         List<String> mappingFileNames = mappingFileNamesUntyped == null? new ArrayList<String>():
new ArrayList<String>(mappingFileNamesUntyped);
         this.persistenceUnitRoot = persistenceUnitRoot;
         URI configurationBaseURI = configurationBaseURL.toURI();
-        URL rootURL = configurationBaseURI.resolve(persistenceUnitRoot).normalize().toURL();
-        List<URL> jarFileUrls = new ArrayList<URL>();
-        for (String urlString: jarFileUrlsUntyped) {
-            URL url = configurationBaseURI.resolve(urlString).normalize().toURL();
-            jarFileUrls.add(url);
+        URL rootURL = null;
+        List<URL> jarFileUrls = null;
+        if (!excludeUnlistedClassesValue) {
+            rootURL = configurationBaseURI.resolve(persistenceUnitRoot).normalize().toURL();
+            jarFileUrls = new ArrayList<URL>();
+            for (String urlString: jarFileUrlsUntyped) {
+                URL url = configurationBaseURI.resolve(urlString).normalize().toURL();
+                jarFileUrls.add(url);
+            }
         }
-        List<String> managedClassNames = managedClassNamesUntyped == null? new ArrayList<String>():
new ArrayList<String>(managedClassNamesUntyped);
         PersistenceUnitTransactionType persistenceUnitTransactionType = persistenceUnitTransactionTypeString
== null? PersistenceUnitTransactionType.JTA: PersistenceUnitTransactionType.valueOf(persistenceUnitTransactionTypeString);
 
         if (persistenceProviderClassName == null) persistenceProviderClassName = "org.apache.openjpa.persistence.PersistenceProviderImpl";



Mime
View raw message