tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1079663 - in /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb: assembler/classic/ config/ config/rules/ util/
Date Wed, 09 Mar 2011 04:45:48 GMT
Author: dblevins
Date: Wed Mar  9 04:45:48 2011
New Revision: 1079663

URL: http://svn.apache.org/viewvc?rev=1079663&view=rev
Log:
Patch from Shawn Jiang, OPENEJB-1439: The link resolving code shouldn't be using the moduleId,
rather the path of the archive itself
Thanks, Shawn!  Excellent patch!

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EjbJarInfo.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EjbResolver.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ClientModule.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbModule.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/PersistenceModule.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/LinkResolver.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EjbJarInfo.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EjbJarInfo.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EjbJarInfo.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EjbJarInfo.java
Wed Mar  9 04:45:48 2011
@@ -26,6 +26,7 @@ public class EjbJarInfo extends InfoObje
     public final Properties properties = new Properties();
 
     public String moduleId;
+    public String modulePackageName;
     public String path;
     public final List<EnterpriseBeanInfo> enterpriseBeans = new ArrayList<EnterpriseBeanInfo>();
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EjbResolver.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EjbResolver.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EjbResolver.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EjbResolver.java
Wed Mar  9 04:45:48 2011
@@ -86,17 +86,17 @@ public class EjbResolver {
 
     private void add(EjbJarInfo ejbJarInfo) {
         for (EnterpriseBeanInfo bean : ejbJarInfo.enterpriseBeans) {
-            index(ejbJarInfo.moduleId, bean);
+            index(ejbJarInfo.modulePackageName, bean);
         }
     }
 
-    private void index(String moduleId, EnterpriseBeanInfo bean) {
+    private void index(String modulePackageName, EnterpriseBeanInfo bean) {
         // All deployments: deploymentId -> bean
 
         deployments.put(bean.ejbDeploymentId, bean);
 
         // add to the link resolver
-        resolver.add(moduleId, bean.ejbName, bean.ejbDeploymentId);
+        resolver.add(modulePackageName, bean.ejbName, bean.ejbDeploymentId);
 
         // Remote: Interfaces(home,object) -> deploymentId
         if (bean.remote != null) {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java
Wed Mar  9 04:45:48 2011
@@ -47,6 +47,7 @@ public class AppModule implements Deploy
     private EntityMappings cmpMappings;
     private final Map<String,Object> altDDs = new HashMap<String,Object>();
     private final String moduleId;
+    private final String modulePackageName;        
     private final Set<String> watchedResources = new TreeSet<String>();
     private final boolean standaloneModule;
 
@@ -77,21 +78,34 @@ public class AppModule implements Deploy
         this.classLoader = classLoader;
         this.jarLocation = jarLocation;
         this.application = application;
+        
+        String moduleId=null;
+        
+        if (jarLocation != null) {
+            File file = new File(jarLocation);
+            this.modulePackageName = file.getName();
+        } else {
+            this.modulePackageName = null;
+        }
+        
         if (application == null || application.getApplicationName() == null) {
-            String appId = null;
-            if (jarLocation != null) {
-                File file = new File(jarLocation);
-                appId = file.getName();
-                if (file.isFile() && appId.endsWith(".ear")) {
-                    appId = appId.substring(0, appId.length() - 4);
-                }
+            
+            if (modulePackageName != null && modulePackageName.endsWith(".unpacked"))
{
+                moduleId = modulePackageName.substring(0, modulePackageName.length() - ".unpacked".length());
+            } else if (modulePackageName != null && modulePackageName.endsWith(".ear"))
{
+                moduleId = modulePackageName.substring(0, modulePackageName.length() - 4);
+            } else {
+                moduleId = modulePackageName;
             }
-            this.moduleId = appId;
+
         } else {
-            this.moduleId = application.getApplicationName();
+            moduleId = application.getApplicationName();
         }
+        
         if (this.jarLocation == null) throw new IllegalArgumentException("jarLocation cannot
be null");
-        if (this.moduleId == null) throw new IllegalArgumentException("moduleId cannot be
null");
+        if (moduleId == null) throw new IllegalArgumentException("moduleId cannot be null");
+        
+        this.moduleId = moduleId;
 
         this.validation = new ValidationContext(AppModule.class, jarLocation);
         this.standaloneModule = standaloneModule;
@@ -179,6 +193,11 @@ public class AppModule implements Deploy
     public String getModuleId() {
         return moduleId;
     }
+    
+    @Override
+    public String getModulePackageName() {
+        return  modulePackageName; 
+    }    
 
     public Map<String, Object> getAltDDs() {
         return altDDs;
@@ -248,4 +267,6 @@ public class AppModule implements Deploy
                 "moduleId='" + moduleId + '\'' +
                 '}';
     }
+
+
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
Wed Mar  9 04:45:48 2011
@@ -165,7 +165,7 @@ public class AutoConfig implements Dynam
         }
 
         for (EjbModule ejbModule : appModule.getEjbModules()) {
-            URI moduleURI = URI.create(ejbModule.getModuleId());
+            URI moduleURI = URI.create(ejbModule.getModulePackageName());
 
             for (JndiConsumer component : ejbModule.getEjbJar().getEnterpriseBeans()) {
                 processPersistenceRefs(component, ejbModule, persistenceUnits, moduleURI);
@@ -408,22 +408,22 @@ public class AutoConfig implements Dynam
         for (EjbModule ejbModule : appModule.getEjbModules()) {
             AssemblyDescriptor assembly = ejbModule.getEjbJar().getAssemblyDescriptor();
             if (assembly != null) {
-                String moduleId = ejbModule.getModuleId();
+                String modulePackageName = ejbModule.getModulePackageName();
                 for (MessageDestination destination : assembly.getMessageDestination()) {
-                    destinationResolver.add(moduleId, destination.getMessageDestinationName(),
destination);
+                    destinationResolver.add(modulePackageName, destination.getMessageDestinationName(),
destination);
                 }
             }
         }
         for (ClientModule clientModule : appModule.getClientModules()) {
-            String moduleId = appModule.getModuleId();
+            String modulePackageName = appModule.getModulePackageName();
             for (MessageDestination destination : clientModule.getApplicationClient().getMessageDestination())
{
-                destinationResolver.add(moduleId, destination.getMessageDestinationName(),
destination);
+                destinationResolver.add(modulePackageName, destination.getMessageDestinationName(),
destination);
             }
         }
         for (WebModule webModule : appModule.getWebModules()) {
-            String moduleId = appModule.getModuleId();
+            String modulePackageName = appModule.getModulePackageName();
             for (MessageDestination destination : webModule.getWebApp().getMessageDestination())
{
-                destinationResolver.add(moduleId, destination.getMessageDestinationName(),
destination);
+                destinationResolver.add(modulePackageName, destination.getMessageDestinationName(),
destination);
             }
         }
 
@@ -438,7 +438,7 @@ public class AutoConfig implements Dynam
                 continue;
             }
 
-            URI moduleUri = URI.create(ejbModule.getModuleId());
+            URI moduleUri = URI.create(ejbModule.getModulePackageName());
             OpenejbJar openejbJar = ejbModule.getOpenejbJar();
 
             for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
@@ -495,7 +495,7 @@ public class AutoConfig implements Dynam
                 continue;
             }
 
-            URI moduleUri = URI.create(ejbModule.getModuleId());
+            URI moduleUri = URI.create(ejbModule.getModulePackageName());
             OpenejbJar openejbJar = ejbModule.getOpenejbJar();
 
             for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
@@ -522,7 +522,7 @@ public class AutoConfig implements Dynam
         }
 
         for (ClientModule clientModule : appModule.getClientModules()) {
-            URI moduleUri = URI.create(clientModule.getModuleId());
+            URI moduleUri = URI.create(clientModule.getModulePackageName());
             for (MessageDestinationRef ref : clientModule.getApplicationClient().getMessageDestinationRef())
{
                 String destinationId = resolveDestinationId(ref, moduleUri, destinationResolver,
destinationTypes);
                 if (destinationId != null) {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ClientModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ClientModule.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ClientModule.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ClientModule.java
Wed Mar  9 04:45:48 2011
@@ -42,6 +42,7 @@ public class ClientModule implements Dep
     private final Set<String> remoteClients = new HashSet<String>();
     private final Map<String,Object> altDDs = new HashMap<String,Object>();
     private final String moduleId;
+    private String modulePackageName;        
     private final Set<String> watchedResources = new TreeSet<String>();
 
     public ClientModule(ApplicationClient applicationClient, ClassLoader classLoader, String
jarLocation, String mainClass, String moduleId) {
@@ -49,6 +50,9 @@ public class ClientModule implements Dep
         this.classLoader = classLoader;
         this.jarLocation = jarLocation;
         this.mainClass = mainClass;
+        
+        File file = new File(jarLocation);
+        this.modulePackageName = file.getName();
 
         if (moduleId == null) {
             if (applicationClient != null && applicationClient.getModuleName() !=
null) {
@@ -56,8 +60,13 @@ public class ClientModule implements Dep
             } else if (applicationClient != null && applicationClient.getId() !=
null) {
                 moduleId = applicationClient.getId();
             } else {
-                File file = new File(jarLocation);
-                moduleId = file.getName();
+                if (modulePackageName != null && modulePackageName.endsWith(".unpacked"))
{
+                    moduleId = modulePackageName.substring(0, modulePackageName.length()
- ".unpacked".length());
+                } else if (modulePackageName != null && modulePackageName.endsWith(".jar"))
{
+                    moduleId = modulePackageName.substring(0, modulePackageName.length()
- ".jar".length());
+                } else {
+                    moduleId = modulePackageName;
+                }
             }
         }
 
@@ -92,6 +101,11 @@ public class ClientModule implements Dep
     public String getModuleId() {
         return moduleId;
     }
+    
+    @Override
+    public String getModulePackageName() {
+        return modulePackageName;
+    }    
 
     public Map<String, Object> getAltDDs() {
         return altDDs;
@@ -148,4 +162,6 @@ public class ClientModule implements Dep
                 ", mainClass='" + mainClass + '\'' +
                 '}';
     }
+
+
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java
Wed Mar  9 04:45:48 2011
@@ -38,9 +38,11 @@ public class ConnectorModule implements 
     private ClassLoader classLoader;
     private String jarLocation;
     private final String moduleId;
+    private String modulePackageName;    
     private final List<URL> libraries = new ArrayList<URL>();
     private final Set<String> watchedResources = new TreeSet<String>();
 
+
     public ConnectorModule(Connector connector) {
         this(connector, Thread.currentThread().getContextClassLoader(), null, null);
     }
@@ -49,6 +51,13 @@ public class ConnectorModule implements 
         this.connector = connector;
         this.classLoader = classLoader;
         this.jarLocation = jarLocation;
+        
+        if (jarLocation != null) {
+            File file = new File(jarLocation);
+            this.modulePackageName = file.getName();
+        } else {
+            this.modulePackageName = null;
+        }
 
         if (moduleId == null) {
             if (connector != null && connector.getModuleName() != null) {
@@ -56,13 +65,13 @@ public class ConnectorModule implements 
             } else if (connector != null && connector.getId() != null) { 
                 moduleId = connector.getId();
             } else {
-                File file = new File(jarLocation);
-                moduleId = file.getName();
-                if (moduleId.endsWith(".unpacked")) {
-                    moduleId = moduleId.substring(0, moduleId.length() - ".unpacked".length());
-                }
-                if (moduleId.endsWith(".rar")) {
-                    moduleId = moduleId.substring(0, moduleId.length() - ".rar".length());
+
+                if (modulePackageName != null && modulePackageName.endsWith(".unpacked"))
{
+                    moduleId = modulePackageName.substring(0, modulePackageName.length()
- ".unpacked".length());
+                } else if (modulePackageName != null && modulePackageName.endsWith(".jar"))
{
+                    moduleId = modulePackageName.substring(0, modulePackageName.length()
- ".jar".length());
+                } else {
+                    moduleId = modulePackageName;
                 }
             }
         }
@@ -78,6 +87,11 @@ public class ConnectorModule implements 
     public String getModuleId() {
         return moduleId;
     }
+    
+    @Override
+    public String getModulePackageName() {
+        return modulePackageName;
+    }    
 
     public Map<String, Object> getAltDDs() {
         return altDDs;
@@ -121,4 +135,6 @@ public class ConnectorModule implements 
                 "moduleId='" + moduleId + '\'' +
                 '}';
     }
+
+
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
Wed Mar  9 04:45:48 2011
@@ -24,6 +24,8 @@ import java.util.Set;
  */
 public interface DeploymentModule {
     String getModuleId();
+    
+    String getModulePackageName();
 
     ClassLoader getClassLoader();
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java
Wed Mar  9 04:45:48 2011
@@ -142,9 +142,17 @@ public class EjbJarInfoBuilder {
         EjbJarInfo ejbJar = new EjbJarInfo();
         ejbJar.path = jar.getJarLocation();
         ejbJar.moduleId = jar.getModuleId();
-        if (ejbJar.moduleId == null) {
-            ejbJar.moduleId = new File(ejbJar.path).getName().replaceFirst(".jar$","");
+        ejbJar.modulePackageName=jar.getModulePackageName();
+
+        
+        if (ejbJar.modulePackageName == null) {
+            ejbJar.modulePackageName = new File(ejbJar.path).getName();
         }
+        
+        if (ejbJar.moduleId == null) {
+            ejbJar.moduleId = ejbJar.modulePackageName.replaceFirst(".jar$","");
+        }        
+        
         ejbJar.watchedResources.addAll(jar.getWatchedResources());
 
         ejbJar.properties.putAll(jar.getOpenejbJar().getProperties());

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbModule.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbModule.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbModule.java
Wed Mar  9 04:45:48 2011
@@ -45,6 +45,11 @@ public class EjbModule implements WsModu
     private OpenejbJar openejbJar;
     private Webservices webservices;
     private String moduleId;
+    private String modulePackageName;
+
+
+
+
     private final AtomicReference<AbstractFinder> finder = new AtomicReference<AbstractFinder>();
     private final Map<String,Object> altDDs = new HashMap<String,Object>();
     private final Set<String> watchedResources = new TreeSet<String>();
@@ -78,22 +83,34 @@ public class EjbModule implements WsModu
             }
         }
         this.jarLocation = jarURI;
-
+        
+        if (jarLocation != null) {
+            File file = new File(jarLocation);
+            this.modulePackageName = file.getName();
+        } else {
+            this.modulePackageName = null;
+        }
+        
         if (moduleId == null) {
             if (ejbJar != null && ejbJar.getModuleName() != null) {
                 moduleId = ejbJar.getModuleName();
             } else if (ejbJar != null && ejbJar.getId() != null) {
                 moduleId = ejbJar.getId();
-            } else {
-                File file = new File(jarURI);
-                moduleId = file.getName();
-                if (moduleId == null) {
+            } else if (modulePackageName == null) {
                     moduleId = jarURI;
-                } else if (moduleId.endsWith(".jar")) {
-                    moduleId = moduleId.substring(0, moduleId.length() - ".jar".length()
);
+            } else {
+                
+                if (modulePackageName != null && modulePackageName.endsWith(".unpacked"))
{
+                    moduleId = modulePackageName.substring(0, modulePackageName.length()
- ".unpacked".length());
+                } else if (modulePackageName != null && modulePackageName.endsWith(".jar"))
{
+
+                    moduleId = modulePackageName.substring(0, modulePackageName.length()
- ".jar".length() );
+                }else {
+                    moduleId = modulePackageName; 
                 }
             }
         }
+        
         this.moduleId = moduleId;
         validation = new ValidationContext(EjbModule.class, jarLocation);
     }
@@ -169,6 +186,14 @@ public class EjbModule implements WsModu
     public void setModuleId(String moduleId) {
         this.moduleId = moduleId;
     }
+    
+    public String getModulePackageName() {
+        return modulePackageName;
+    }
+    
+    public void setModulePackageName(String modulePackageName) {
+        this.modulePackageName = modulePackageName;
+    }    
 
     public OpenejbJar getOpenejbJar() {
         return openejbJar;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/PersistenceModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/PersistenceModule.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/PersistenceModule.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/PersistenceModule.java
Wed Mar  9 04:45:48 2011
@@ -68,6 +68,11 @@ public class PersistenceModule implement
         return null;
     }
 
+    @Override
+    public String getModulePackageName() {
+        return null;
+    }
+
     public ValidationContext getValidation() {
         return null;
     }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
Wed Mar  9 04:45:48 2011
@@ -45,6 +45,7 @@ public class WebModule implements WsModu
     private ClassLoader classLoader;
     private String jarLocation;
     private final String moduleId;
+    private String modulePackageName;    
     private final List<TldTaglib> taglibs = new ArrayList<TldTaglib>();
     private final Set<String> watchedResources = new TreeSet<String>();
     // List of all faces configuration files found in this web module
@@ -69,27 +70,40 @@ public class WebModule implements WsModu
         this.contextRoot = contextRoot;
         this.classLoader = classLoader;
         this.jarLocation = jarLocation;
+        
+        if (jarLocation != null) {
+            File file = new File(jarLocation);
+            this.modulePackageName = file.getName();
+        } else {
+            this.modulePackageName = null;
+        }
 
         if (webApp != null) webApp.setContextRoot(contextRoot);
 
         if (moduleId == null) {
-            if (webApp != null && webApp.getModuleName() != null) {
-                moduleId = webApp.getModuleName();
-            } else if (webApp != null && webApp.getId() != null) {
-                moduleId = webApp.getId();
-            } else {
-                File file = new File(jarLocation);
-                moduleId = file.getName();
-                if (moduleId.endsWith(".unpacked")) {
-                    moduleId = moduleId.substring(0, moduleId.length() - ".unpacked".length());
-                }
-                if (moduleId.endsWith(".war")) {
-                    moduleId = moduleId.substring(0, moduleId.length() - ".war".length());
+            
+                if (webApp != null && webApp.getModuleName() != null) {
+                    moduleId = webApp.getModuleName();
+                } else if (webApp != null && webApp.getId() != null) {
+                    moduleId = webApp.getId();
+                } else {
+    
+                    if (modulePackageName != null && modulePackageName.endsWith(".unpacked"))
{
+                        moduleId = modulePackageName.substring(0, modulePackageName.length()
- ".unpacked".length());
+                    } else if (modulePackageName != null && modulePackageName.endsWith(".jar"))
{
+                        moduleId = modulePackageName.substring(0, modulePackageName.length()
- ".jar".length());
+                    } else {
+                        moduleId = modulePackageName;
+                    }
                 }
-            }
-        }
+            
+        } 
 
+        
+            
         this.moduleId = moduleId;
+       
+        
         validation = new ValidationContext(WebModule.class, jarLocation);
     }
 
@@ -116,6 +130,11 @@ public class WebModule implements WsModu
     public String getModuleId() {
         return moduleId;
     }
+    
+    @Override
+    public String getModulePackageName() {
+        return modulePackageName;
+    }    
 
     public Map<String, Object> getAltDDs() {
         return altDDs;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java
Wed Mar  9 04:45:48 2011
@@ -45,12 +45,12 @@ public class CheckDependsOn extends Vali
 
         for (EjbModule ejbModule : appModule.getEjbModules()) {
 
-            String moduleId = ejbModule.getModuleId();
+            String modulePackageName = ejbModule.getModulePackageName();
 
             URI moduleUri = null;
-            if (moduleId != null) {
+            if (modulePackageName != null) {
                 try {
-                    moduleUri = new URI(moduleId);
+                    moduleUri = new URI(modulePackageName);
                 } catch (URISyntaxException e) {
                     return;
                 }
@@ -61,9 +61,9 @@ public class CheckDependsOn extends Vali
             for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
                 Bean b = new Bean(bean, ejbModule, moduleUri, resolver);
 
-                resolver.module.add(ejbModule.getModuleId(), bean.getEjbName(), b);
+                resolver.module.add(ejbModule.getModulePackageName(), bean.getEjbName(),
b);
 
-                resolver.app.add(ejbModule.getModuleId(), bean.getEjbName(), b);
+                resolver.app.add(ejbModule.getModulePackageName(), bean.getEjbName(), b);
 
             }
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/LinkResolver.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/LinkResolver.java?rev=1079663&r1=1079662&r2=1079663&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/LinkResolver.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/LinkResolver.java
Wed Mar  9 04:45:48 2011
@@ -28,14 +28,14 @@ public class LinkResolver<E> {
     private final Map<String, E> byFullName = new TreeMap<String, E>();
     private final Map<String, Collection<E>> byShortName = new TreeMap<String,
Collection<E>>();
 
-    public boolean add(String moduleId, String name, E value) {
-        String fullName = moduleId + "#" + name;
+    public boolean add(String modulePackageName, String name, E value) {
+        String fullName = modulePackageName + "#" + name;
         if (byFullName.containsKey(fullName)) {
             // entry already exists
             return false;
         }
 
-        // Full name: moduleId#name -> value
+        // Full name: modulePackageName#name -> value
         byFullName.put(fullName, value);
 
         // Short name: name -> List(values)
@@ -58,8 +58,8 @@ public class LinkResolver<E> {
         return es != null? es: Collections.EMPTY_LIST;
     }
 
-    public E resolveLink(String link, String moduleId) {
-        URI moduleURI = URI.create(moduleId);
+    public E resolveLink(String link, String modulePackageName) {
+        URI moduleURI = URI.create(modulePackageName);
         return resolveLink(link, moduleURI);
     }
 



Mime
View raw message