[jboss-cvs] JBossAS SVN: r108507 - in projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers: fungal and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 11 09:13:36 EDT 2010
Author: jesper.pedersen
Date: 2010-10-11 09:13:36 -0400 (Mon, 11 Oct 2010)
New Revision: 108507
Added:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/BeanValidation.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/JCATraversableResolver.java
Removed:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/JCATraversableResolver.java
Modified:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
Log:
Fix circular dependency
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2010-10-11 12:18:34 UTC (rev 108506)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2010-10-11 13:13:36 UTC (rev 108507)
@@ -45,7 +45,6 @@
import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
import org.jboss.jca.core.spi.mdr.AlreadyExistsException;
-import org.jboss.jca.deployers.fungal.BeanValidation;
import org.jboss.jca.validator.Failure;
import org.jboss.jca.validator.FailureHelper;
import org.jboss.jca.validator.Key;
Copied: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/BeanValidation.java (from rev 108499, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/BeanValidation.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/BeanValidation.java 2010-10-11 13:13:36 UTC (rev 108507)
@@ -0,0 +1,121 @@
+/*
+ * 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;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.validation.ConstraintViolationException;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.groups.Default;
+
+import org.jboss.logging.Logger;
+
+/**
+ *
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class BeanValidation
+{
+ private static Logger log = Logger.getLogger(BeanValidation.class);
+
+ private static boolean trace = log.isTraceEnabled();
+
+ /**
+ * Constructor
+ */
+ public BeanValidation()
+ {
+ }
+
+ /**
+ * Validate the object against the Bean Validation specification (JSR-303).
+ * The object must be fully initialized
+ * @param object The object that should be validated
+ * @param groupsClasses groups targeted for validation
+ * @exception ConstraintViolationException Thrown if the object can't be validated
+ */
+ @SuppressWarnings("unchecked")
+ public void validate(Object object, List<Class> groupsClasses) throws ConstraintViolationException
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException("Object is null");
+ }
+
+ Context context = null;
+ try
+ {
+ context = new InitialContext();
+
+ ValidatorFactory vf = (ValidatorFactory) context.lookup("java:/ValidatorFactory");
+ Validator v = vf.usingContext().traversableResolver(new JCATraversableResolver()).getValidator();
+
+ Set errors = null;
+ if (groupsClasses == null || groupsClasses.size() == 0)
+ {
+ if (trace)
+ log.trace("Validating: " + object + " against groups " + Default.class.getName());
+
+ errors = v.validate(object, Default.class);
+ }
+ else
+ {
+ Class[] vargs = groupsClasses.toArray(new Class[groupsClasses.size()]);
+
+ if (trace)
+ log.trace("Validating: " + object + " against groups " + Arrays.toString(vargs));
+
+ errors = v.validate(object, vargs);
+ }
+
+ if (errors != null && errors.size() > 0)
+ {
+ throw new ConstraintViolationException(errors);
+ }
+ }
+ catch (NamingException ne)
+ {
+ log.error(ne.getMessage(), ne);
+ }
+ finally
+ {
+ try
+ {
+ if (context != null)
+ context.close();
+ }
+ catch (NamingException ne)
+ {
+ // Ignore
+ }
+ }
+ }
+}
Copied: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/JCATraversableResolver.java (from rev 108499, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/JCATraversableResolver.java)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/JCATraversableResolver.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/JCATraversableResolver.java 2010-10-11 13:13:36 UTC (rev 108507)
@@ -0,0 +1,91 @@
+/*
+ * 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;
+
+import java.lang.annotation.ElementType;
+
+import javax.validation.Path;
+import javax.validation.TraversableResolver;
+
+/**
+ * JCATraversableResolver
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class JCATraversableResolver implements TraversableResolver
+{
+ /**
+ * Determine if Bean Validation is allowed to reach the property state
+ *
+ * @param traversableObject
+ * object hosting <code>traversableProperty</code> or null if
+ * validateValue is called
+ * @param traversableProperty
+ * the traversable property.
+ * @param rootBeanType
+ * type of the root object passed to the Validator.
+ * @param pathToTraversableObject
+ * path from the root object to <code>traversableObject</code>
+ * (using the path specification defined by Bean Validator).
+ * @param elementType
+ * either <code>FIELD</code> or <code>METHOD</code>.
+ *
+ * @return <code>true</code> if Bean Validation is allowed to reach the
+ * property state, <code>false</code> otherwise.
+ */
+ @Override
+ public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType,
+ Path pathToTraversableObject, ElementType elementType)
+ {
+ return true;
+ }
+
+ /**
+ * Determine if Bean Validation is allowed to cascade validation on the bean
+ * instance returned by the property value marked as <code>@Valid</code>.
+ * Note that this method is called only if isReachable returns true for the
+ * same set of arguments and if the property is marked as <code>@Valid</code>
+ *
+ * @param traversableObject
+ * object hosting <code>traversableProperty</code> or null if
+ * validateValue is called
+ * @param traversableProperty
+ * the traversable property.
+ * @param rootBeanType
+ * type of the root object passed to the Validator.
+ * @param pathToTraversableObject
+ * path from the root object to <code>traversableObject</code>
+ * (using the path specification defined by Bean Validator).
+ * @param elementType
+ * either <code>FIELD</code> or <code>METHOD</code>.
+ *
+ * @return <code>true</code> if Bean Validation is allowed to cascade
+ * validation, <code>false</code> otherwise.
+ */
+ @Override
+ public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType,
+ Path pathToTraversableObject, ElementType elementType)
+ {
+ return true;
+ }
+}
Deleted: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java 2010-10-11 12:18:34 UTC (rev 108506)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java 2010-10-11 13:13:36 UTC (rev 108507)
@@ -1,121 +0,0 @@
-/*
- * 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.fungal;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.validation.ConstraintViolationException;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-import javax.validation.groups.Default;
-
-import org.jboss.logging.Logger;
-
-/**
- *
- * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- * @version $Revision: $
- */
-public class BeanValidation
-{
- private static Logger log = Logger.getLogger(BeanValidation.class);
-
- private static boolean trace = log.isTraceEnabled();
-
- /**
- * Constructor
- */
- public BeanValidation()
- {
- }
-
- /**
- * Validate the object against the Bean Validation specification (JSR-303).
- * The object must be fully initialized
- * @param object The object that should be validated
- * @param groupsClasses groups targeted for validation
- * @exception ConstraintViolationException Thrown if the object can't be validated
- */
- @SuppressWarnings("unchecked")
- public void validate(Object object, List<Class> groupsClasses) throws ConstraintViolationException
- {
- if (object == null)
- {
- throw new IllegalArgumentException("Object is null");
- }
-
- Context context = null;
- try
- {
- context = new InitialContext();
-
- ValidatorFactory vf = (ValidatorFactory) context.lookup("java:/ValidatorFactory");
- Validator v = vf.usingContext().traversableResolver(new JCATraversableResolver()).getValidator();
-
- Set errors = null;
- if (groupsClasses == null || groupsClasses.size() == 0)
- {
- if (trace)
- log.trace("Validating: " + object + " against groups " + Default.class.getName());
-
- errors = v.validate(object, Default.class);
- }
- else
- {
- Class[] vargs = groupsClasses.toArray(new Class[groupsClasses.size()]);
-
- if (trace)
- log.trace("Validating: " + object + " against groups " + Arrays.toString(vargs));
-
- errors = v.validate(object, vargs);
- }
-
- if (errors != null && errors.size() > 0)
- {
- throw new ConstraintViolationException(errors);
- }
- }
- catch (NamingException ne)
- {
- log.error(ne.getMessage(), ne);
- }
- finally
- {
- try
- {
- if (context != null)
- context.close();
- }
- catch (NamingException ne)
- {
- // Ignore
- }
- }
- }
-}
Deleted: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/JCATraversableResolver.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/JCATraversableResolver.java 2010-10-11 12:18:34 UTC (rev 108506)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/JCATraversableResolver.java 2010-10-11 13:13:36 UTC (rev 108507)
@@ -1,91 +0,0 @@
-/*
- * 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.fungal;
-
-import java.lang.annotation.ElementType;
-
-import javax.validation.Path;
-import javax.validation.TraversableResolver;
-
-/**
- * JCATraversableResolver
- * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
- * @version $Revision: $
- */
-public class JCATraversableResolver implements TraversableResolver
-{
- /**
- * Determine if Bean Validation is allowed to reach the property state
- *
- * @param traversableObject
- * object hosting <code>traversableProperty</code> or null if
- * validateValue is called
- * @param traversableProperty
- * the traversable property.
- * @param rootBeanType
- * type of the root object passed to the Validator.
- * @param pathToTraversableObject
- * path from the root object to <code>traversableObject</code>
- * (using the path specification defined by Bean Validator).
- * @param elementType
- * either <code>FIELD</code> or <code>METHOD</code>.
- *
- * @return <code>true</code> if Bean Validation is allowed to reach the
- * property state, <code>false</code> otherwise.
- */
- @Override
- public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType,
- Path pathToTraversableObject, ElementType elementType)
- {
- return true;
- }
-
- /**
- * Determine if Bean Validation is allowed to cascade validation on the bean
- * instance returned by the property value marked as <code>@Valid</code>.
- * Note that this method is called only if isReachable returns true for the
- * same set of arguments and if the property is marked as <code>@Valid</code>
- *
- * @param traversableObject
- * object hosting <code>traversableProperty</code> or null if
- * validateValue is called
- * @param traversableProperty
- * the traversable property.
- * @param rootBeanType
- * type of the root object passed to the Validator.
- * @param pathToTraversableObject
- * path from the root object to <code>traversableObject</code>
- * (using the path specification defined by Bean Validator).
- * @param elementType
- * either <code>FIELD</code> or <code>METHOD</code>.
- *
- * @return <code>true</code> if Bean Validation is allowed to cascade
- * validation, <code>false</code> otherwise.
- */
- @Override
- public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class<?> rootBeanType,
- Path pathToTraversableObject, ElementType elementType)
- {
- return true;
- }
-}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java 2010-10-11 12:18:34 UTC (rev 108506)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java 2010-10-11 13:13:36 UTC (rev 108507)
@@ -41,6 +41,7 @@
import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.deployers.common.BeanValidation;
import org.jboss.jca.validator.Failure;
import org.jboss.jca.validator.Key;
import org.jboss.jca.validator.Severity;
More information about the jboss-cvs-commits
mailing list