geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r522645 - /geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java
Date Mon, 26 Mar 2007 22:15:05 GMT
Author: djencks
Date: Mon Mar 26 15:15:04 2007
New Revision: 522645

URL: http://svn.apache.org/viewvc?view=rev&rev=522645
Log:
While investigating GERONIMO-3021 discovered that the app client was swallowing all info about
injection problems

Modified:
    geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java

Modified: geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java?view=diff&rev=522645&r1=522644&r2=522645
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java
Mon Mar 26 15:15:04 2007
@@ -21,7 +21,6 @@
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
@@ -51,7 +50,7 @@
  */
 public final class AppClientContainer implements GBeanLifecycle {
     private static final Class[] MAIN_ARGS = {String[].class};
-
+    
     private LoginContext loginContext;
 
     private final String mainClassName;
@@ -123,7 +122,6 @@
         ClassLoader oldClassLoader = thread.getContextClassLoader();
         Callers oldCallers = ContextManager.getCallers();
         Subject clientSubject = defaultSubject;
-//        LoginContext loginContext = null;
         try {
             thread.setContextClassLoader(classLoader);
             jndiContext.startClient(appClientModuleName, kernel, classLoader);
@@ -131,17 +129,6 @@
 
             if (callbackHandlerClass != null) {
                 callbackHandler = (CallbackHandler) holder.newInstance(callbackHandlerClass,
classLoader, componentContext);
-                //look for a constructor taking the args
-                /*
-                CallbackHandler callbackHandler;
-                try {
-                    Constructor cArgs = callbackHandlerClass.getConstructor(new Class[] {String[].class});
-                    callbackHandler = (CallbackHandler) cArgs.newInstance(new Object[] {args});
-                } catch (NoSuchMethodException e) {
-                    callbackHandler = (CallbackHandler) callbackHandlerClass.newInstance();
-                }
-                */
-                
                 loginContext = new LoginContext(realmName, callbackHandler);
                 try {
                     loginContext.login();
@@ -156,7 +143,6 @@
             objectRecipe.allow(Option.FIELD_INJECTION);
             objectRecipe.allow(Option.PRIVATE_PROPERTIES);
             objectRecipe.allow(Option.STATIC_PROPERTIES);
-            objectRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
             Class mainClass = classLoader.loadClass(mainClassName);
             List<Injection> injections = new ArrayList<Injection>();
             while (mainClass != null && mainClass != Object.class) {
@@ -167,6 +153,7 @@
                 mainClass = mainClass.getSuperclass();
             }
             if (injections != null) {
+                List<NamingException> problems = new ArrayList<NamingException>();
                 for (Injection injection : injections) {
                     try {
                         String jndiName = injection.getJndiName();
@@ -181,17 +168,14 @@
                             objectRecipe.setProperty(injection.getTargetName(), new StaticRecipe(object));
                         }
                     } catch (NamingException e) {
-//                        log.warn("could not look up ", e);
+                        problems.add(e);
                     }
                 }
-            }
-            Class clazz = objectRecipe.setStaticProperties(classLoader);
-            Map unsetProperties = objectRecipe.getUnsetProperties();
-            if (unsetProperties.size() > 0) {
-                for (Object property : unsetProperties.keySet()) {
-//                log.warning("Injection: No such property '"+property+"' in class "+_class.getName());
+                if (!problems.isEmpty()) {
+                    throw new Exception("Some object to be injected were not found in jndi:
" + problems.toArray());
                 }
             }
+            Class clazz = objectRecipe.setStaticProperties(classLoader);
             if (holder.getPostConstruct() != null) {
                 Holder.apply(null, clazz, holder.getPostConstruct());
             }
@@ -254,7 +238,6 @@
     static {
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(AppClientContainer.class,
NameFactory.APP_CLIENT);
 
-        infoFactory.addOperation("main", new Class[]{String[].class});
 
         infoFactory.addAttribute("mainClassName", String.class, true);
         infoFactory.addAttribute("appClientModuleName", AbstractName.class, true);



Mime
View raw message