[jboss-cvs] JBossAS SVN: r97682 - in projects/jboss-jca/trunk/deployers/src: main/java/org/jboss/jca/deployers/common/validator/rules and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Dec 10 03:34:57 EST 2009
Author: jeff.zhang
Date: 2009-12-10 03:34:56 -0500 (Thu, 10 Dec 2009)
New Revision: 97682
Added:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFNull.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFReferenceable.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFSerializable.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/package.html
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/BaseCciConnectionFactory.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
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/BaseManagedConnectionFactory.java
Log:
[JBJCA-201] add cci.ConnectionFactory rules
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-10 07:59:57 UTC (rev 97681)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validator.java 2009-12-10 08:34:56 UTC (rev 97682)
@@ -47,7 +47,10 @@
"org.jboss.jca.deployers.common.validator.rules.ra.RA",
"org.jboss.jca.deployers.common.validator.rules.ra.RAHashCode",
"org.jboss.jca.deployers.common.validator.rules.ra.RAEquals",
- "org.jboss.jca.deployers.common.validator.rules.ra.RAConfigProperties"
+ "org.jboss.jca.deployers.common.validator.rules.ra.RAConfigProperties",
+ "org.jboss.jca.deployers.common.validator.rules.cf.CFNull",
+ "org.jboss.jca.deployers.common.validator.rules.cf.CFSerializable",
+ "org.jboss.jca.deployers.common.validator.rules.cf.CFReferenceable"
};
/**
Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFNull.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFNull.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFNull.java 2009-12-10 08:34:56 UTC (rev 97682)
@@ -0,0 +1,77 @@
+/*
+ * 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.cf;
+
+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;
+
+/**
+ * ConnectionFactory must be implemented if present
+ */
+public class CFNull implements Rule
+{
+ /** Section */
+ private static final String SECTION = "17.5.1.1";
+
+ /**
+ * Constructor
+ */
+ public CFNull()
+ {
+ }
+
+ /**
+ * 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.CONNECTION_FACTORY == vo.getKey())
+ {
+ if (vo.getObject() == null)
+ {
+ List<Failure> failures = new ArrayList<Failure>(1);
+
+ Failure failure = new Failure(Severity.ERROR,
+ SECTION,
+ rb.getString("cf.CFNull"));
+ failures.add(failure);
+
+ return failures;
+ }
+ }
+
+ return null;
+ }
+}
+
Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFReferenceable.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFReferenceable.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFReferenceable.java 2009-12-10 08:34:56 UTC (rev 97682)
@@ -0,0 +1,82 @@
+/*
+ * 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.cf;
+
+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.Referenceable;
+
+
+/**
+ * Referenceable must be implemented if present
+ */
+public class CFReferenceable implements Rule
+{
+ /** Section */
+ private static final String SECTION = "17.5.1.1";
+
+ /**
+ * Constructor
+ */
+ public CFReferenceable()
+ {
+ }
+
+ /**
+ * 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.CONNECTION_FACTORY == vo.getKey())
+ {
+ if (vo.getObject() != null && !(vo.getObject() instanceof Referenceable))
+ {
+ List<Failure> failures = new ArrayList<Failure>(1);
+
+ Failure failure = new Failure(Severity.ERROR,
+ SECTION,
+ rb.getString("cf.CFReferenceable"),
+ vo.getObject().getClass().getName());
+ failures.add(failure);
+
+ return failures;
+ }
+ }
+
+ return null;
+ }
+}
+
+
Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFSerializable.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFSerializable.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFSerializable.java 2009-12-10 08:34:56 UTC (rev 97682)
@@ -0,0 +1,81 @@
+/*
+ * 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.cf;
+
+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.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+
+/**
+ * Serializable must be implemented if present
+ */
+public class CFSerializable implements Rule
+{
+ /** Section */
+ private static final String SECTION = "17.5.1.1";
+
+ /**
+ * Constructor
+ */
+ public CFSerializable()
+ {
+ }
+
+ /**
+ * 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.CONNECTION_FACTORY == vo.getKey())
+ {
+ if (vo.getObject() != null && !(vo.getObject() instanceof Serializable))
+ {
+ List<Failure> failures = new ArrayList<Failure>(1);
+
+ Failure failure = new Failure(Severity.ERROR,
+ SECTION,
+ rb.getString("cf.CFSerializable"),
+ vo.getObject().getClass().getName());
+ failures.add(failure);
+
+ return failures;
+ }
+ }
+
+ return null;
+ }
+}
+
+
Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/package.html
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/package.html (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/package.html 2009-12-10 08:34:56 UTC (rev 97682)
@@ -0,0 +1,3 @@
+<body>
+Validation rules for Connection Factory.
+</body>
Modified: projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties 2009-12-10 07:59:57 UTC (rev 97681)
+++ projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties 2009-12-10 08:34:56 UTC (rev 97682)
@@ -14,3 +14,6 @@
ra.RAHashCode=A ResourceAdapter must implement a "public int hashCode()" method.
ra.RAEquals=A ResourceAdapter must implement a "public boolean equals(Object)" method.
ra.RAConfigProperties=Invalid config-property-type for ResourceAdapter.
+cf.CFNull=ConnectionFactory must be a non-null value
+cf.CFSerializable=ConnectionFactory must implement java.io.Serializable
+cf.CFReferenceable=ConnectionFactory must implement javax.resource.Referenceable
Added: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/BaseCciConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/BaseCciConnectionFactory.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/BaseCciConnectionFactory.java 2009-12-10 08:34:56 UTC (rev 97682)
@@ -0,0 +1,104 @@
+/*
+ * 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.test.deployers.spec.rars;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.resource.ResourceException;
+import javax.resource.cci.Connection;
+import javax.resource.cci.ConnectionFactory;
+import javax.resource.cci.ConnectionSpec;
+import javax.resource.cci.RecordFactory;
+import javax.resource.cci.ResourceAdapterMetaData;
+
+
+/**
+ * BaseCciConnectionFactory
+ *
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>.
+ * @version $Revision: $
+ */
+public class BaseCciConnectionFactory implements ConnectionFactory
+{
+
+ /**
+ * serialVersionUID
+ */
+ private static final long serialVersionUID = 1L;
+
+ /* getConnection
+ * @see javax.resource.cci.ConnectionFactory#getConnection()
+ */
+ @Override
+ public Connection getConnection() throws ResourceException
+ {
+ return null;
+ }
+
+ /* getConnection
+ * @see javax.resource.cci.ConnectionFactory#getConnection(javax.resource.cci.ConnectionSpec)
+ */
+ @Override
+ public Connection getConnection(ConnectionSpec properties) throws ResourceException
+ {
+ return null;
+ }
+
+ /* getMetaData
+ * @see javax.resource.cci.ConnectionFactory#getMetaData()
+ */
+ @Override
+ public ResourceAdapterMetaData getMetaData() throws ResourceException
+ {
+ return null;
+ }
+
+ /* getRecordFactory
+ * @see javax.resource.cci.ConnectionFactory#getRecordFactory()
+ */
+ @Override
+ public RecordFactory getRecordFactory() throws ResourceException
+ {
+ return null;
+ }
+
+ /* getReference
+ * @see javax.naming.Referenceable#getReference()
+ */
+ @Override
+ public Reference getReference() throws NamingException
+ {
+ return null;
+ }
+
+ /* setReference
+ * @see javax.resource.Referenceable#setReference(javax.naming.Reference)
+ */
+ @Override
+ public void setReference(Reference reference)
+ {
+
+ }
+
+
+
+}
Modified: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/BaseManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/BaseManagedConnectionFactory.java 2009-12-10 07:59:57 UTC (rev 97681)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/BaseManagedConnectionFactory.java 2009-12-10 08:34:56 UTC (rev 97682)
@@ -55,7 +55,7 @@
public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
{
log.debug("call createConnectionFactory");
- return null;
+ return new BaseCciConnectionFactory();
}
/**
@@ -67,7 +67,7 @@
public Object createConnectionFactory() throws ResourceException
{
log.debug("call createConnectionFactory");
- return null;
+ return createConnectionFactory((ConnectionManager)null);
}
/**
More information about the jboss-cvs-commits
mailing list