tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r508632 - in /incubator/openejb/trunk/openejb3: container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ container/openejb-core/src/main/java/org/apache/openejb/config/ server/openejb-server/src/main/java/org/apache/openej...
Date Fri, 16 Feb 2007 22:48:41 GMT
Author: dblevins
Date: Fri Feb 16 14:48:40 2007
New Revision: 508632

URL: http://svn.apache.org/viewvc?view=rev&rev=508632
Log:
Added flag to allow requiring ejb-jar.xml descriptors in classpath searching.
Improved logging of beans that are deployed

Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
    incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Server.java

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?view=diff&rev=508632&r1=508631&r2=508632
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
Fri Feb 16 14:48:40 2007
@@ -323,6 +323,8 @@
 
     public void createApplication(AppInfo appInfo, ClassLoader classLoader) throws OpenEJBException,
IOException, NamingException {
 
+        logger.info("Assembling app: "+appInfo.jarPath);
+        
         List<String> used = new ArrayList<String>();
         for (EjbJarInfo ejbJarInfo : appInfo.ejbJars) {
             for (EnterpriseBeanInfo beanInfo : ejbJarInfo.enterpriseBeans) {
@@ -387,6 +389,10 @@
                 for (EnterpriseBeanInfo beanInfo : ejbJar.enterpriseBeans) {
                     CoreDeploymentInfo deployment = (CoreDeploymentInfo) deployments.get(beanInfo.ejbDeploymentId);
                     applySecurityRoleReference(deployment, beanInfo, roleMapping);
+                }
+
+                for (EnterpriseBeanInfo beanInfo : ejbJar.enterpriseBeans) {
+                    logger.info("Created Ejb(deployment-id="+beanInfo.ejbDeploymentId+",
ejb-name="+beanInfo.ejbName+", container="+beanInfo.containerId+")");
                 }
             }
 

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java?view=diff&rev=508632&r1=508631&r2=508632
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
Fri Feb 16 14:48:40 2007
@@ -257,7 +257,6 @@
 
             appInfo = configureApplication(appModule);
 
-            logger.info("Loaded Module: " + appModule.getJarLocation());
 
         } catch (OpenEJBException e) {
             String message = messages.format("conf.0004", jarFile.getAbsolutePath(), e.getMessage());
@@ -284,6 +283,7 @@
     }
 
     public AppInfo configureApplication(AppModule appModule) throws OpenEJBException {
+        logger.info("Configuring app: "+appModule.getJarLocation());
         deployer.deploy(appModule);
 
         AppInfo appInfo = new AppInfo();
@@ -377,6 +377,7 @@
             }
         }
 
+        logger.info("Loaded Module: " + appInfo.jarPath);
         return appInfo;
     }
 

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?view=diff&rev=508632&r1=508631&r2=508632
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
Fri Feb 16 14:48:40 2007
@@ -67,7 +67,7 @@
 
         Class moduleClass = null;
         try {
-            moduleClass = discoverModuleType(baseUrl, classLoader);
+            moduleClass = discoverModuleType(baseUrl, classLoader, true);
         } catch (Exception e) {
             throw new OpenEJBException("Unable to determine module type for jar: " + baseUrl.toExternalForm(),
e);
         }
@@ -122,7 +122,7 @@
                         if (!entry.getKey().matches(".*\\.(jar|war|rar|ear)")) continue;
 
                         try {
-                            Class moduleType = discoverModuleType(entry.getValue(), tmpClassLoader);
+                            Class moduleType = discoverModuleType(entry.getValue(), tmpClassLoader,
true);
                             if (EjbModule.class.equals(moduleType)) {
                                 ejbModules.put(entry.getKey(), entry.getValue());
                             } else if (ClientModule.class.equals(moduleType)) {
@@ -295,7 +295,7 @@
     }
 
 
-    public static Class<? extends DeploymentModule> discoverModuleType(URL baseUrl,
ClassLoader classLoader) throws IOException, UnsupportedOperationException {
+    public static Class<? extends DeploymentModule> discoverModuleType(URL baseUrl,
ClassLoader classLoader, boolean searchForDescriptorlessApplications) throws IOException,
UnsupportedOperationException {
         ResourceFinder finder = new ResourceFinder("", classLoader, baseUrl);
 
         Map<String, URL> descriptors = finder.getResourcesMap("META-INF");
@@ -326,12 +326,14 @@
             }
         }
 
-        ClassFinder classFinder = new ClassFinder(classLoader, baseUrl);
+        if (searchForDescriptorlessApplications) {
+            ClassFinder classFinder = new ClassFinder(classLoader, baseUrl);
 
-        if (classFinder.isAnnotationPresent(Stateless.class) ||
-                classFinder.isAnnotationPresent(Stateful.class) ||
-                classFinder.isAnnotationPresent(javax.ejb.MessageDriven.class)) {
-            return EjbModule.class;
+            if (classFinder.isAnnotationPresent(Stateless.class) ||
+                    classFinder.isAnnotationPresent(Stateful.class) ||
+                    classFinder.isAnnotationPresent(javax.ejb.MessageDriven.class)) {
+                return EjbModule.class;
+            }
         }
 
         throw new UnsupportedOperationException("Unknown module type");

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java?view=diff&rev=508632&r1=508631&r2=508632
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentsResolver.java
Fri Feb 16 14:48:40 2007
@@ -37,6 +37,7 @@
 
     private static final String CLASSPATH_INCLUDE = "openejb.deployments.classpath.include";
     private static final String CLASSPATH_EXCLUDE = "openejb.deployments.classpath.exclude";
+    private static final String CLASSPATH_REQUIRE_DESCRIPTOR = "openejb.deployments.classpath.require.descriptor";
 
     private static void loadFrom(Deployments dep, FileUtils path, List jarList) {
 
@@ -168,6 +169,7 @@
 
         include = SystemInstance.get().getProperty(CLASSPATH_INCLUDE, "");
         exclude = SystemInstance.get().getProperty(CLASSPATH_EXCLUDE, ".*");
+        boolean requireDescriptors = SystemInstance.get().getProperty(CLASSPATH_REQUIRE_DESCRIPTOR,
"false").equalsIgnoreCase("true");
         try {
             UrlSet urlSet = new UrlSet(classLoader);
             UrlSet includes = urlSet.matching(include);
@@ -189,9 +191,9 @@
                 return;
             } else if (size < 10) {
                 DeploymentLoader.logger.debug("Inspecting classpath for applications: " +
urls.size() + " urls.");
-            } else if (size < 50) {
+            } else if (size < 50 && !requireDescriptors) {
                 DeploymentLoader.logger.info("Inspecting classpath for applications: " +
urls.size() + " urls. Consider adjusting your exclude/include.  Current settings: " + CLASSPATH_EXCLUDE
+ "='" + exclude + "', " + CLASSPATH_INCLUDE + "='" + include + "'");
-            } else {
+            } else if (!requireDescriptors) {
                 DeploymentLoader.logger.warning("Inspecting classpath for applications: "
+ urls.size() + " urls.");
                 DeploymentLoader.logger.warning("ADJUST THE EXCLUDE/INCLUDE!!!.  Current
settings: " + CLASSPATH_EXCLUDE + "='" + exclude + "', " + CLASSPATH_INCLUDE + "='" + include
+ "'");
             }
@@ -199,7 +201,7 @@
             long begin = System.currentTimeMillis();
             for (URL url : urls) {
                 try {
-                    Class moduleType = DeploymentLoader.discoverModuleType(url, classLoader);
+                    Class moduleType = DeploymentLoader.discoverModuleType(url, classLoader,
!requireDescriptors);
                     if (AppModule.class.isAssignableFrom(moduleType) || EjbModule.class.isAssignableFrom(moduleType))
{
                         deployment = new Deployments();
                         if (url.getProtocol().equals("jar")) {

Modified: incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Server.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Server.java?view=diff&rev=508632&r1=508631&r2=508632
==============================================================================
--- incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Server.java
(original)
+++ incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Server.java
Fri Feb 16 14:48:40 2007
@@ -57,6 +57,7 @@
         SystemInstance system = SystemInstance.get();
         File home = system.getHome().getDirectory();
         system.setProperty("openejb.deployments.classpath.include", ".*/"+home.getName()+"/lib/.*");
+        system.setProperty("openejb.deployments.classpath.require.descriptor", "true");
 
         OpenEJB.init(props, new ServerFederation());
 



Mime
View raw message