[jboss-cvs] JBossAS SVN: r94782 - in projects/jboss-jca/trunk: core/src/main/java/org/jboss/jca/core/bv and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 13 14:35:10 EDT 2009
Author: jesper.pedersen
Date: 2009-10-13 14:35:10 -0400 (Tue, 13 Oct 2009)
New Revision: 94782
Added:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/BeanValidation.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/BeanValidationUtil.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/JCATraversableResolver.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/SerializableValidator.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/SerializableValidatorFactory.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/package.html
Modified:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RarTestCase.java
projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml
projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml
projects/jboss-jca/trunk/sjc/src/main/resources/jndi.properties
projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java
Log:
[JBJCA-191] Add bean validation as a core service
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/BeanValidation.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/BeanValidation.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/BeanValidation.java 2009-10-13 18:35:10 UTC (rev 94782)
@@ -0,0 +1,143 @@
+/*
+ * 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.core.bv;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.validation.Configuration;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Bean validation implementation backed by Hibernate Validator
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class BeanValidation
+{
+ /** The logger */
+ private static Logger log = Logger.getLogger(BeanValidation.class);
+
+ /** Validator factory */
+ private static final String VALIDATOR_FACTORY = "java:/ValidatorFactory";
+
+ /** Validator */
+ private static final String VALIDATOR = "java:/Validator";
+
+ /** The validator factory */
+ private ValidatorFactory validatorFactory;
+
+ /** The validator */
+ private Validator validator;
+
+ /**
+ * Constructor
+ */
+ public BeanValidation()
+ {
+ Configuration configuration = Validation.byDefaultProvider().configure();
+ Configuration<?> conf = configuration.traversableResolver(new JCATraversableResolver());
+
+ validatorFactory = conf.buildValidatorFactory();
+ validator = validatorFactory.getValidator();
+ }
+
+ /**
+ * Get the validator factory
+ * @return The factory
+ */
+ public ValidatorFactory getValidatorFactory()
+ {
+ return validatorFactory;
+ }
+
+ /**
+ * Get the validator
+ * @return The validator
+ */
+ public Validator getValidator()
+ {
+ return validator;
+ }
+
+ /**
+ * Start
+ * @exception Throwable If an error occurs
+ */
+ public void start() throws Throwable
+ {
+ Context context = null;
+ try
+ {
+ context = new InitialContext();
+
+ context.rebind(VALIDATOR_FACTORY, new SerializableValidatorFactory(validatorFactory));
+ context.rebind(VALIDATOR, new SerializableValidator(validator));
+ }
+ finally
+ {
+ try
+ {
+ if (context != null)
+ context.close();
+ }
+ catch (NamingException ne)
+ {
+ // Ignore
+ }
+ }
+ }
+
+ /**
+ * Stop
+ * @exception Throwable If an error occurs
+ */
+ public void stop() throws Throwable
+ {
+ Context context = null;
+ try
+ {
+ context = new InitialContext();
+
+ context.unbind(VALIDATOR);
+ context.unbind(VALIDATOR_FACTORY);
+ }
+ finally
+ {
+ try
+ {
+ if (context != null)
+ context.close();
+ }
+ catch (NamingException ne)
+ {
+ // Ignore
+ }
+ }
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/BeanValidationUtil.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/BeanValidationUtil.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/BeanValidationUtil.java 2009-10-13 18:35:10 UTC (rev 94782)
@@ -0,0 +1,72 @@
+/*
+ * 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.core.bv;
+
+import javax.validation.Configuration;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Bean validation utility
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class BeanValidationUtil
+{
+ /** The logger */
+ private static Logger log = Logger.getLogger(BeanValidationUtil.class);
+
+ /**
+ * Constructor
+ */
+ private BeanValidationUtil()
+ {
+ }
+
+ /**
+ * Create a validator factory
+ * @return The factory
+ */
+ public static ValidatorFactory createValidatorFactory()
+ {
+ Configuration configuration = Validation.byDefaultProvider().configure();
+ Configuration<?> conf = configuration.traversableResolver(new JCATraversableResolver());
+
+ return conf.buildValidatorFactory();
+ }
+
+ /**
+ * Create a validator
+ * @return The validator
+ */
+ public static Validator createValidator()
+ {
+ ValidatorFactory vf = createValidatorFactory();
+
+ return vf.getValidator();
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/JCATraversableResolver.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/JCATraversableResolver.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/JCATraversableResolver.java 2009-10-13 18:35:10 UTC (rev 94782)
@@ -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.core.bv;
+
+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.
+ */
+ 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.
+ */
+ public boolean isCascadable(Object traversableObject,
+ Path.Node traversableProperty, Class<?> rootBeanType,
+ Path pathToTraversableObject, ElementType elementType)
+ {
+ return true;
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/SerializableValidator.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/SerializableValidator.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/SerializableValidator.java 2009-10-13 18:35:10 UTC (rev 94782)
@@ -0,0 +1,149 @@
+/*
+ * 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.core.bv;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.metadata.BeanDescriptor;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Serializable validator
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class SerializableValidator implements Validator, Serializable
+{
+ /** Serial version uid */
+ private static final long serialVersionUID = 1L;
+
+ /** The logger */
+ private static Logger log = Logger.getLogger(SerializableValidator.class);
+
+ /** The validator */
+ private transient Validator validator;
+
+ /**
+ * Constructor
+ */
+ public SerializableValidator()
+ {
+ this(BeanValidationUtil.createValidator());
+ }
+
+ /**
+ * Constructor
+ * @param v The validator
+ */
+ public SerializableValidator(Validator v)
+ {
+ this.validator = v;
+ }
+
+ /**
+ * Get the constraints for a class
+ * @param clazz The class
+ * @return The bean descriptor
+ */
+ public BeanDescriptor getConstraintsForClass(Class<?> clazz)
+ {
+ return validator.getConstraintsForClass(clazz);
+ }
+
+ /**
+ * Validate
+ * @param object The object
+ * @param groups The groups
+ * @return The constraint violations
+ */
+ public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups)
+ {
+ return validator.validate(object, groups);
+ }
+
+ /**
+ * Validate property
+ * @param object The object
+ * @param propertyName The property name
+ * @param groups The groups
+ * @return The constraint violations
+ */
+ public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups)
+ {
+ return validator.validateProperty(object, propertyName, groups);
+ }
+
+ /**
+ * Validate value
+ * @param beanType The bean type
+ * @param propertyName The property name
+ * @param value The value
+ * @param groups The groups
+ * @return The constraint violations
+ */
+ public <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType,
+ String propertyName,
+ Object value,
+ Class<?>... groups)
+ {
+ return validator.validateValue(beanType, propertyName, value, groups);
+ }
+
+ /**
+ * Unwrap
+ * @param type The type
+ * @return The context
+ */
+ public <T> T unwrap(Class<T> type)
+ {
+ return validator.unwrap(type);
+ }
+
+ /**
+ * Write the object - Nothing is written as the validator factory is transient
+ * @param out The output stream
+ * @exception IOException Thrown if an error occurs
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException
+ {
+ }
+
+ /**
+ * Read the object - Nothing is read as the validator factory is transient.
+ * A new instance is created
+ * @param out The output stream
+ * @exception IOException Thrown if an error occurs
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ validator = BeanValidationUtil.createValidator();
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/SerializableValidatorFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/SerializableValidatorFactory.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/SerializableValidatorFactory.java 2009-10-13 18:35:10 UTC (rev 94782)
@@ -0,0 +1,127 @@
+/*
+ * 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.core.bv;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import javax.validation.MessageInterpolator;
+import javax.validation.Validator;
+import javax.validation.ValidatorContext;
+import javax.validation.ValidatorFactory;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Serializable validator factory
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class SerializableValidatorFactory implements ValidatorFactory, Serializable
+{
+ /** Serial version uid */
+ private static final long serialVersionUID = 1L;
+
+ /** The logger */
+ private static Logger log = Logger.getLogger(SerializableValidatorFactory.class);
+
+ /** The validator factory */
+ private transient ValidatorFactory validatorFactory;
+
+ /**
+ * Constructor
+ */
+ public SerializableValidatorFactory()
+ {
+ this(BeanValidationUtil.createValidatorFactory());
+ }
+
+ /**
+ * Constructor
+ * @param vf The validator factory
+ */
+ public SerializableValidatorFactory(ValidatorFactory vf)
+ {
+ this.validatorFactory = vf;
+ }
+
+ /**
+ * Get the message interpolator
+ * @return The interpolator
+ */
+ public MessageInterpolator getMessageInterpolator()
+ {
+ return validatorFactory.getMessageInterpolator();
+ }
+
+ /**
+ * Get the validator
+ * @return The validator
+ */
+ public Validator getValidator()
+ {
+ return validatorFactory.getValidator();
+ }
+
+ /**
+ * Get the validator context
+ * @return The context
+ */
+ public ValidatorContext usingContext()
+ {
+ return validatorFactory.usingContext();
+ }
+
+ /**
+ * Unwrap
+ * @param type The type
+ * @return The context
+ */
+ public <T> T unwrap(Class<T> type)
+ {
+ return validatorFactory.unwrap(type);
+ }
+
+ /**
+ * Write the object - Nothing is written as the validator factory is transient
+ * @param out The output stream
+ * @exception IOException Thrown if an error occurs
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException
+ {
+ }
+
+ /**
+ * Read the object - Nothing is read as the validator factory is transient.
+ * A new instance is created
+ * @param out The output stream
+ * @exception IOException Thrown if an error occurs
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ validatorFactory = BeanValidationUtil.createValidatorFactory();
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/package.html (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/bv/package.html 2009-10-13 18:35:10 UTC (rev 94782)
@@ -0,0 +1,3 @@
+<body>
+This package contains the bean validation service.
+</body>
Modified: 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 2009-10-13 17:57:08 UTC (rev 94781)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java 2009-10-13 18:35:10 UTC (rev 94782)
@@ -25,9 +25,10 @@
import java.util.List;
import java.util.Set;
-import javax.validation.Configuration;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.validation.ConstraintViolationException;
-import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
@@ -61,32 +62,52 @@
throw new IllegalArgumentException("Object is null");
}
- Configuration configuration = Validation.byDefaultProvider().configure();
- Configuration<?> conf = configuration.traversableResolver(new JCATraversableResolver());
- ValidatorFactory vf = conf.buildValidatorFactory();
- Validator v = vf.getValidator();
-
- if (trace)
+ Context context = null;
+ try
{
- log.trace("Validating: " + object + " against groups "
- + Default.class.getName());
- }
+ context = new InitialContext();
- Set errors = null;
- if (groupsClasses == null)
- {
- errors = v.validate(object, Default.class);
+ 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 " + vargs);
+
+ errors = v.validate(object, vargs);
+ }
+
+ if (errors != null && errors.size() > 0)
+ {
+ throw new ConstraintViolationException(errors);
+ }
}
- else
+ catch (NamingException ne)
{
- Class[] vargs = groupsClasses.toArray(new Class[groupsClasses.size()]);
- errors = v.validate(object, vargs);
+ log.error(ne.getMessage(), ne);
}
- if (errors != null && errors.size() > 0)
+ finally
{
- log.debug("Validated: " + errors.size() + " validate failing");
- throw new ConstraintViolationException(errors);
+ try
+ {
+ if (context != null)
+ context.close();
+ }
+ catch (NamingException ne)
+ {
+ // Ignore
+ }
}
}
-
}
Modified: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RarTestCase.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RarTestCase.java 2009-10-13 17:57:08 UTC (rev 94781)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RarTestCase.java 2009-10-13 18:35:10 UTC (rev 94782)
@@ -47,7 +47,7 @@
// Class Members ------------------------------------------------------------------||
// --------------------------------------------------------------------------------||
- private static final Logger LOG = Logger.getLogger(RarTestCase.class);
+ private static Logger log = Logger.getLogger(RarTestCase.class);
/*
* Embedded
@@ -73,6 +73,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -96,6 +97,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -119,6 +121,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -142,6 +145,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -165,6 +169,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -188,6 +193,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -211,6 +217,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -234,6 +241,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -257,6 +265,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -280,6 +289,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -303,6 +313,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -326,6 +337,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -349,6 +361,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -372,6 +385,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -395,6 +409,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -418,6 +433,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -441,6 +457,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -464,6 +481,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -487,6 +505,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
@@ -534,6 +553,7 @@
}
catch (Throwable t)
{
+ log.error(t.getMessage(), t);
fail(t.getMessage());
}
finally
Modified: projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml
===================================================================
--- projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml 2009-10-13 17:57:08 UTC (rev 94781)
+++ projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml 2009-10-13 18:35:10 UTC (rev 94782)
@@ -1,5 +1,10 @@
<deployment>
+ <!-- Bean Validation -->
+ <bean name="BeanValidation" class="org.jboss.jca.core.bv.BeanValidation">
+ <depends>NamingServer</depends>
+ </bean>
+
<!-- Work Manager thread pool -->
<bean name="WorkManagerThreadPool" interface="org.jboss.jca.common.threadpool.ThreadPool" class="org.jboss.jca.common.threadpool.ThreadPoolImpl">
<!-- The name that appears in thread names -->
@@ -30,6 +35,7 @@
<!-- RA deployer -->
<bean name="RADeployer" interface="org.jboss.jca.fungal.deployers.Deployer" class="org.jboss.jca.deployers.fungal.RADeployer">
+ <depends>BeanValidation</depends>
<depends>ConnectionManager</depends>
<depends>WorkManager</depends>
</bean>
Modified: projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml 2009-10-13 17:57:08 UTC (rev 94781)
+++ projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml 2009-10-13 18:35:10 UTC (rev 94782)
@@ -1,5 +1,10 @@
<deployment>
+ <!-- Bean Validation -->
+ <bean name="BeanValidation" class="org.jboss.jca.core.bv.BeanValidation">
+ <depends>NamingServer</depends>
+ </bean>
+
<!-- Work Manager thread pool -->
<bean name="WorkManagerThreadPool" interface="org.jboss.jca.common.threadpool.ThreadPool" class="org.jboss.jca.common.threadpool.ThreadPoolImpl">
<!-- The name that appears in thread names -->
@@ -30,6 +35,7 @@
<!-- RA deployer -->
<bean name="RADeployer" interface="org.jboss.jca.fungal.deployers.Deployer" class="org.jboss.jca.deployers.fungal.RADeployer">
+ <depends>BeanValidation</depends>
<depends>ConnectionManager</depends>
<depends>WorkManager</depends>
</bean>
Modified: projects/jboss-jca/trunk/sjc/src/main/resources/jndi.properties
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/resources/jndi.properties 2009-10-13 17:57:08 UTC (rev 94781)
+++ projects/jboss-jca/trunk/sjc/src/main/resources/jndi.properties 2009-10-13 18:35:10 UTC (rev 94782)
@@ -1,2 +1,2 @@
-java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Modified: projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java
===================================================================
--- projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java 2009-10-13 17:57:08 UTC (rev 94781)
+++ projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java 2009-10-13 18:35:10 UTC (rev 94782)
@@ -24,6 +24,8 @@
import java.io.File;
import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -36,9 +38,6 @@
import java.util.Map;
import java.util.Properties;
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-
/**
* The main class for JBoss JCA standalone
* @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
More information about the jboss-cvs-commits
mailing list