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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 22 02:41:07 EST 2010


Author: jeff.zhang
Date: 2010-02-22 02:41:07 -0500 (Mon, 22 Feb 2010)
New Revision: 101236

Added:
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ao/AOConstructor.java
Modified:
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validator.java
   projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties
Log:
[JBJCA-282] add AOConstructor rule

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	2010-02-22 07:28:28 UTC (rev 101235)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validator.java	2010-02-22 07:41:07 UTC (rev 101236)
@@ -57,6 +57,7 @@
       "org.jboss.jca.deployers.common.validator.rules.cf.CFReferenceable",
       "org.jboss.jca.deployers.common.validator.rules.as.ASConstructor",
       "org.jboss.jca.deployers.common.validator.rules.as.ASConfigProperties",
+      "org.jboss.jca.deployers.common.validator.rules.ao.AOConstructor",
       "org.jboss.jca.deployers.common.validator.rules.ao.AOConfigProperties"
    };
    

Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ao/AOConstructor.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ao/AOConstructor.java	                        (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ao/AOConstructor.java	2010-02-22 07:41:07 UTC (rev 101236)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2010, 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.ao;
+
+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.Validate;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+/**
+ * An AdminObject must have a default constructor
+ * 
+ * @author Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class AOConstructor implements Rule
+{
+   /** Section */
+   private static final String SECTION = "19.3";
+
+   /**
+    * Constructor
+    */
+   public AOConstructor()
+   {
+   }
+   
+   /**
+    * 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(Validate vo, ResourceBundle rb)
+   {
+      if (vo != null && 
+          Key.ADMIN_OBJECT == vo.getKey() &&
+          vo.getClazz() != null)
+      {
+         try
+         {
+            vo.getClazz().getConstructor((Class[])null);
+         }
+         catch (Throwable t)
+         {
+            List<Failure> failures = new ArrayList<Failure>(1);
+
+            Failure failure = new Failure(Severity.ERROR,
+                                          SECTION,
+                                          rb.getString("ao.AOConstructor"));
+            failures.add(failure);
+
+            return failures;
+         }
+      }
+
+      return null;
+   }
+}

Modified: projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties	2010-02-22 07:28:28 UTC (rev 101235)
+++ projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties	2010-02-22 07:41:07 UTC (rev 101236)
@@ -27,4 +27,5 @@
 as.ASConstructor=An ActivationSpec must have a default constructor
 as.ASConfigProperties=Invalid config-property-type for ActivationSpec.
 ao.cnfe=ClassNotFoundException during AdminObject creation
+ao.AOConstructor=An AdminObject must have a default constructor
 ao.AOConfigProperties=Invalid config-property-type for AdminObject.




More information about the jboss-cvs-commits mailing list