[jboss-cvs] JBossAS SVN: r97466 - in projects/jboss-jca/trunk/deployers/src/main: java/org/jboss/jca/deployers/common/validator/rules/mcf and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 4 10:46:43 EST 2009


Author: jesper.pedersen
Date: 2009-12-04 10:46:42 -0500 (Fri, 04 Dec 2009)
New Revision: 97466

Added:
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Key.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/ValidateObject.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCF.java
Modified:
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Rule.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validator.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFEquals.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFHashCode.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
   projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties
Log:
[JBJCA-201] Validator - 2nd draft

Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Key.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Key.java	                        (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Key.java	2009-12-04 15:46:42 UTC (rev 97466)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.deployers.common.validator;
+
+/**
+ * Key
+ */
+public class Key
+{
+   /** Resource adapter */
+   public static final int RESOURCE_ADAPTER = 0;
+
+   /** Managed connection factory */
+   public static final int MANAGED_CONNECTION_FACTORY = 1;
+
+   /** Activation spec */
+   public static final int ACTIVATION_SPEC = 2;
+
+   /** Admin object */
+   public static final int ADMIN_OBJECT = 3;
+
+   /**
+    * Constructor
+    */
+   private Key()
+   {
+   }
+}

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Rule.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Rule.java	2009-12-04 15:38:52 UTC (rev 97465)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Rule.java	2009-12-04 15:46:42 UTC (rev 97466)
@@ -36,5 +36,5 @@
     * @param rb The resource bundle 
     * @return The list of failures found; <code>null</code> if none
     */
-   public List<Failure> validate(Object obj, ResourceBundle rb);
+   public List<Failure> validate(ValidateObject obj, ResourceBundle rb);
 }

Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/ValidateObject.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/ValidateObject.java	                        (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/ValidateObject.java	2009-12-04 15:46:42 UTC (rev 97466)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.deployers.common.validator;
+
+/**
+ * Object wrapper for objects that should be validated
+ */
+public class ValidateObject
+{
+   /** Key */
+   private int key;
+
+   /** Onject */
+   private Object object;
+
+   /**
+    * Constructor
+    * @param key The key
+    * @param object The key
+    */
+   public ValidateObject(int key,
+                         Object object)
+   {
+      if (object == null)
+         throw new IllegalArgumentException("Object is null");
+
+      this.key = key;
+      this.object = object;
+   }
+   
+   /**
+    * Get the key
+    * @return The key
+    */
+   public int getKey()
+   {
+      return key;
+   }
+
+   /**
+    * Get the object
+    * @return The object
+    */
+   public Object getObject()
+   {
+      return object;
+   }
+}

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validator.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validator.java	2009-12-04 15:38:52 UTC (rev 97465)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validator.java	2009-12-04 15:46:42 UTC (rev 97466)
@@ -22,7 +22,6 @@
 
 package org.jboss.jca.deployers.common.validator;
 
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
@@ -39,6 +38,7 @@
     * properties file
     */
    private static final String[] RULES = {
+      "org.jboss.jca.deployers.common.validator.rules.mcf.MCF",
       "org.jboss.jca.deployers.common.validator.rules.mcf.MCFHashCode",
       "org.jboss.jca.deployers.common.validator.rules.mcf.MCFEquals"
    };
@@ -61,24 +61,10 @@
 
    /**
     * Validate
-    * @param url The URL of the resource adapter archive
-    * @return The list of failures; <code>null</code> if no errors
-    */
-   public List<Failure> validate(URL url)
-   {
-      Object[] objects = null;
-
-      // TODO
-
-      return validate(objects);
-   }
-
-   /**
-    * Validate
     * @param objects Objects that should be validated
     * @return The list of failures; <code>null</code> if no errors
     */
-   public List<Failure> validate(Object[] objects)
+   public List<Failure> validate(ValidateObject[] objects)
    {
       if (objects == null || objects.length == 0)
          return null;
@@ -94,9 +80,9 @@
 
             rules.add(rule);
          }
-         catch (Exception e)
+         catch (Throwable t)
          {
-            e.printStackTrace();
+            t.printStackTrace();
          }
       }
 
@@ -106,7 +92,7 @@
 
       for (Rule rule : rules)
       {
-         for (Object obj : objects)
+         for (ValidateObject obj : objects)
          {
             List<Failure> failures = rule.validate(obj, resourceBundle);
 

Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCF.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCF.java	                        (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCF.java	2009-12-04 15:46:42 UTC (rev 97466)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.deployers.common.validator.rules.mcf;
+
+import org.jboss.jca.deployers.common.validator.Failure;
+import org.jboss.jca.deployers.common.validator.Key;
+import org.jboss.jca.deployers.common.validator.Rule;
+import org.jboss.jca.deployers.common.validator.Severity;
+import org.jboss.jca.deployers.common.validator.ValidateObject;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+import javax.resource.spi.ManagedConnectionFactory;
+
+/**
+ * ManagedConnectionFactory must be implemented
+ */
+public class MCF implements Rule
+{
+   /** Section */
+   private static final String SECTION = "6.5.3.2";
+
+   /**
+    * Constructor
+    */
+   public MCF()
+   {
+   }
+
+   /**
+    * Validate
+    * @param vo The validate object
+    * @param rb The resource bundle 
+    * @return The list of failures found; <code>null</code> if none
+    */
+   @SuppressWarnings("unchecked")
+   public List<Failure> validate(ValidateObject vo, ResourceBundle rb)
+   {
+      if (vo != null && Key.MANAGED_CONNECTION_FACTORY == vo.getKey())
+      {
+         if (!(vo.getObject() instanceof ManagedConnectionFactory))
+         {
+            List<Failure> failures = new ArrayList<Failure>(1);
+
+            Failure failure = new Failure(Severity.ERROR,
+                                          SECTION,
+                                          rb.getString("mcf.MCF"),
+                                          vo.getObject().getClass().getName());
+            failures.add(failure);
+
+            return failures;
+         }
+      }
+
+      return null;
+   }
+}

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFEquals.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFEquals.java	2009-12-04 15:38:52 UTC (rev 97465)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFEquals.java	2009-12-04 15:46:42 UTC (rev 97466)
@@ -23,8 +23,10 @@
 package org.jboss.jca.deployers.common.validator.rules.mcf;
 
 import org.jboss.jca.deployers.common.validator.Failure;
+import org.jboss.jca.deployers.common.validator.Key;
 import org.jboss.jca.deployers.common.validator.Rule;
 import org.jboss.jca.deployers.common.validator.Severity;
+import org.jboss.jca.deployers.common.validator.ValidateObject;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -50,17 +52,19 @@
 
    /**
     * Validate
-    * @param obj The object
+    * @param vo The validate object
     * @param rb The resource bundle 
     * @return The list of failures found; <code>null</code> if none
     */
    @SuppressWarnings("unchecked")
-   public List<Failure> validate(Object obj, ResourceBundle rb)
+   public List<Failure> validate(ValidateObject vo, ResourceBundle rb)
    {
-      if (obj != null && obj instanceof ManagedConnectionFactory)
+      if (vo != null && 
+          Key.MANAGED_CONNECTION_FACTORY == vo.getKey() &&
+          vo.getObject() instanceof ManagedConnectionFactory)
       {
          boolean error = true;
-         Class clz = obj.getClass();
+         Class clz = vo.getObject().getClass();
 
          while (error && !clz.equals(Object.class))
          {
@@ -70,7 +74,7 @@
                if (equals != null)
                   error = false;
             }
-            catch (Exception e)
+            catch (Throwable t)
             {
                clz = clz.getSuperclass();
             }
@@ -83,7 +87,7 @@
             Failure failure = new Failure(Severity.ERROR,
                                           SECTION,
                                           rb.getString("mcf.MCFEquals"),
-                                          obj.getClass().getName());
+                                          vo.getObject().getClass().getName());
             failures.add(failure);
 
             return failures;

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFHashCode.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFHashCode.java	2009-12-04 15:38:52 UTC (rev 97465)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFHashCode.java	2009-12-04 15:46:42 UTC (rev 97466)
@@ -23,8 +23,10 @@
 package org.jboss.jca.deployers.common.validator.rules.mcf;
 
 import org.jboss.jca.deployers.common.validator.Failure;
+import org.jboss.jca.deployers.common.validator.Key;
 import org.jboss.jca.deployers.common.validator.Rule;
 import org.jboss.jca.deployers.common.validator.Severity;
+import org.jboss.jca.deployers.common.validator.ValidateObject;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -50,17 +52,19 @@
 
    /**
     * Validate
-    * @param obj The object
+    * @param vo The validate object
     * @param rb The resource bundle 
     * @return The list of failures found; <code>null</code> if none
     */
    @SuppressWarnings("unchecked")
-   public List<Failure> validate(Object obj, ResourceBundle rb)
+   public List<Failure> validate(ValidateObject vo, ResourceBundle rb)
    {
-      if (obj != null && obj instanceof ManagedConnectionFactory)
+      if (vo != null && 
+          Key.MANAGED_CONNECTION_FACTORY == vo.getKey() &&
+          vo.getObject() instanceof ManagedConnectionFactory)
       {
          boolean error = true;
-         Class clz = obj.getClass();
+         Class clz = vo.getObject().getClass();
 
          while (error && !clz.equals(Object.class))
          {
@@ -70,7 +74,7 @@
                if (hashCode != null)
                   error = false;
             }
-            catch (Exception e)
+            catch (Throwable t)
             {
                clz = clz.getSuperclass();
             }
@@ -83,7 +87,7 @@
             Failure failure = new Failure(Severity.ERROR,
                                           SECTION,
                                           rb.getString("mcf.MCFHashCode"),
-                                          obj.getClass().getName());
+                                          vo.getObject().getClass().getName());
             failures.add(failure);
 
             return failures;

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java	2009-12-04 15:38:52 UTC (rev 97465)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java	2009-12-04 15:46:42 UTC (rev 97466)
@@ -24,7 +24,9 @@
 
 import org.jboss.jca.deployers.common.validator.Failure;
 import org.jboss.jca.deployers.common.validator.FailureHelper;
+import org.jboss.jca.deployers.common.validator.Key;
 import org.jboss.jca.deployers.common.validator.Severity;
+import org.jboss.jca.deployers.common.validator.ValidateObject;
 import org.jboss.jca.deployers.common.validator.Validator;
 import org.jboss.jca.fungal.deployers.CloneableDeployer;
 import org.jboss.jca.fungal.deployers.DeployException;
@@ -250,43 +252,47 @@
          // Merge metadata
          cmd = metadataHandler.merge(cmd, jrmd);
 
-         // Create objects
-         // And
-         // Inject values
-         List<Object> objects = new ArrayList<Object>();
+
+         List<ValidateObject> archiveValidationObjects = new ArrayList<ValidateObject>();
+         List<Object> beanValidationObjects = new ArrayList<Object>();
+
+         // Create objects and inject values
          if (cmd != null)
          {
             // ResourceAdapter
             if (cmd.getRa() != null && cmd.getRa().getRaClass() != null)
             {
-               initAndInject(cmd.getRa().getRaClass(), 
-                     cmd.getRa().getConfigProperty(), objects, cl);
+               Object o = initAndInject(cmd.getRa().getRaClass(), cmd.getRa().getConfigProperty(), cl);
+               archiveValidationObjects.add(new ValidateObject(Key.RESOURCE_ADAPTER, o));
+               beanValidationObjects.add(o);
             }
             
             // ManagedConnectionFactory
             if (cmd.getRa() != null &&
-               cmd.getRa().getOutboundRa() != null && 
-               cmd.getRa().getOutboundRa().getConDefs() != null)
+                cmd.getRa().getOutboundRa() != null && 
+                cmd.getRa().getOutboundRa().getConDefs() != null)
             {
                List<ConnectionDefinitionMetaData> cdMetas = cmd.getRa().getOutboundRa().getConDefs();
                if (cdMetas.size() > 0)
                {
-                  //mcfs = new ArrayList<Object>();
                   for (ConnectionDefinitionMetaData cdMeta : cdMetas)
                   {
                      if (cdMeta.getManagedConnectionFactoryClass() != null)
                      {
-                        initAndInject(cdMeta.getManagedConnectionFactoryClass(), 
-                           cdMeta.getConfigProps(), objects, cl);
+                        Object o = initAndInject(cdMeta.getManagedConnectionFactoryClass(), 
+                                                 cdMeta.getConfigProps(), cl);
+                        archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY, o));
+                        beanValidationObjects.add(o);
                      }
                   }
                }
             }
-            // activationspec
+
+            // ActivationSpec
             if (cmd.getRa() != null &&
-               cmd.getRa().getInboundRa() != null &&
-               cmd.getRa().getInboundRa().getMessageAdapter() != null &&
-               cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners() != null)
+                cmd.getRa().getInboundRa() != null &&
+                cmd.getRa().getInboundRa().getMessageAdapter() != null &&
+                cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners() != null)
             {
                List<MessageListenerMetaData> mlMetas = cmd.getRa().getInboundRa().
                   getMessageAdapter().getMessageListeners();
@@ -296,16 +302,18 @@
                   {
                      if (mlMeta.getActivationSpecType() != null && mlMeta.getActivationSpecType().getAsClass() != null)
                      {
-                        initAndInject(mlMeta.getActivationSpecType().getAsClass(), 
-                           mlMeta.getActivationSpecType().getConfigProps(), objects, cl);
+                        Object o = initAndInject(mlMeta.getActivationSpecType().getAsClass(), 
+                                                 mlMeta.getActivationSpecType().getConfigProps(), cl);
+                        archiveValidationObjects.add(new ValidateObject(Key.ACTIVATION_SPEC, o));
+                        beanValidationObjects.add(o);
                      }
                   }
                }
             }
 
-            //adminobject
+            // AdminObject
             if (cmd.getRa() != null &&
-               cmd.getRa().getAdminObjects() != null)
+                cmd.getRa().getAdminObjects() != null)
             {
                List<AdminObjectMetaData> aoMetas = cmd.getRa().getAdminObjects();
                if (aoMetas.size() > 0)
@@ -314,49 +322,22 @@
                   {
                      if (aoMeta.getAdminObjectImplementationClass() != null)
                      {
-                        initAndInject(aoMeta.getAdminObjectImplementationClass(), 
-                              aoMeta.getConfigProps(), objects, cl);
+                        Object o = initAndInject(aoMeta.getAdminObjectImplementationClass(), 
+                                                 aoMeta.getConfigProps(), cl);
+                        archiveValidationObjects.add(new ValidateObject(Key.ADMIN_OBJECT, o));
+                        beanValidationObjects.add(o);
                      }
                   }
                }
             }
          }
 
-
-         // Bean validation
-         if (getBeanValidation())
-         {
-            JBossRA20Base jrmd20 = null;
-            List<Class> groupsClasses = null;
-            if (jrmd instanceof JBossRA20Base)
-            {
-               jrmd20 = (JBossRA20Base)jrmd;
-            }
-            if (jrmd20 != null && jrmd20.getBvGroupsList() != null && jrmd20.getBvGroupsList().size() > 0)
-            {
-               BvGroupMetaData bvGroups = jrmd20.getBvGroupsList().get(0);
-               groupsClasses = new ArrayList<Class>();
-               for (String group : bvGroups.getBvGroups())
-               {
-                  groupsClasses.add(Class.forName(group, true, cl));
-               }
-            }
-            
-            if (objects != null && objects.size() > 0)
-            {
-               BeanValidation beanValidator = new BeanValidation();
-               for (Object mcf : objects)
-               {
-                  beanValidator.validate(mcf, groupsClasses);
-               }
-            }
-         }
-         
          // Archive validation
          if (getArchiveValidation())
          {
             Validator validator = new Validator();
-            List<Failure> failures = validator.validate(objects.toArray(new Object[objects.size()]));
+            List<Failure> failures = validator.validate(archiveValidationObjects.toArray(
+               new ValidateObject[archiveValidationObjects.size()]));
 
             if (failures != null && failures.size() > 0)
             {
@@ -428,6 +409,35 @@
             }
          }
 
+         // Bean validation
+         if (getBeanValidation())
+         {
+            JBossRA20Base jrmd20 = null;
+            List<Class> groupsClasses = null;
+            if (jrmd instanceof JBossRA20Base)
+            {
+               jrmd20 = (JBossRA20Base)jrmd;
+            }
+            if (jrmd20 != null && jrmd20.getBvGroupsList() != null && jrmd20.getBvGroupsList().size() > 0)
+            {
+               BvGroupMetaData bvGroups = jrmd20.getBvGroupsList().get(0);
+               groupsClasses = new ArrayList<Class>();
+               for (String group : bvGroups.getBvGroups())
+               {
+                  groupsClasses.add(Class.forName(group, true, cl));
+               }
+            }
+            
+            if (beanValidationObjects.size() > 0)
+            {
+               BeanValidation beanValidator = new BeanValidation();
+               for (Object o : beanValidationObjects)
+               {
+                  beanValidator.validate(o, groupsClasses);
+               }
+            }
+         }
+         
          // Activate deployment
 
          log.info("Deployed: " + url.toExternalForm());
@@ -450,43 +460,38 @@
    }
 
    /**
-    * initAndInject
-    * @param mlMeta
-    * @param mcfs
-    * @param cl
-    * @throws DeployException
+    * Initialize and inject configuration properties
+    * @param className The fully qualified class name
+    * @param configs The configuration properties
+    * @param cl The class loader
+    * @return The object
+    * @throws DeployException Thrown if the object cant be initialized
     */
-   private void initAndInject(String className, List<ConfigPropertyMetaData> cpMetas,
-                              List<Object> mcfs, URLClassLoader cl) throws DeployException
+   private Object initAndInject(String className, 
+                                List<ConfigPropertyMetaData> configs,
+                                ClassLoader cl)
+      throws DeployException
    {
-      Object mcf = null;
       try 
       {
-         Class mcfClass = Class.forName(className, true, cl);
-         mcf = mcfClass.newInstance();
-         mcfs.add(mcf);
+         Class clz = Class.forName(className, true, cl);
+         Object o = clz.newInstance();
          
-         if (mcf != null)
+         if (configs != null)
          {
-            if (cpMetas != null)
+            Injection injector = new Injection();
+            for (ConfigPropertyMetaData cpmd : configs)
             {
-               Injection injector = new Injection();
-               for (ConfigPropertyMetaData cpmd : cpMetas)
-               {
-                  injector.inject(cpmd.getType(), cpmd.getName(), cpmd.getValue(), mcf);
-               }
+               injector.inject(cpmd.getType(), cpmd.getName(), cpmd.getValue(), o);
             }
          }
-      } 
-      catch (ClassNotFoundException e)
-      {
-         log.trace("can't constractor " + className + " class");
+
+         return o;
       }
       catch (Throwable t)
       {
          throw new DeployException("Deployment " + className + " failed", t);
       }
-
    }
 
    /**

Modified: projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties	2009-12-04 15:38:52 UTC (rev 97465)
+++ projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties	2009-12-04 15:46:42 UTC (rev 97466)
@@ -4,5 +4,6 @@
 section=Section
 description=Description
 code=Code
+mcf.MCF=The class must implement the javax.resource.spi.ManagedConnectionFactory interface.
 mcf.MCFHashCode=A ManagedConnectionFactory must implement a "public int hashCode()" method.
 mcf.MCFEquals=A ManagedConnectionFactory must implement a "public boolean equals(Object)" method.




More information about the jboss-cvs-commits mailing list