[jboss-cvs] JBossAS SVN: r101078 - in projects/jboss-jca/trunk: common/src/main/java/org/jboss/jca/common/util and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 17 11:00:07 EST 2010
Author: smarlow at redhat.com
Date: 2010-02-17 11:00:04 -0500 (Wed, 17 Feb 2010)
New Revision: 101078
Modified:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/ConnectionFactoryBuilder.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/util/LocalApplicationServerJNDIHandler.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/util/LocalConnectionFactoryBuilder.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
Log:
checkstyle fix
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/ConnectionFactoryBuilder.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/ConnectionFactoryBuilder.java 2010-02-17 15:49:58 UTC (rev 101077)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/ConnectionFactoryBuilder.java 2010-02-17 16:00:04 UTC (rev 101078)
@@ -33,11 +33,13 @@
*
* @author <a href="mailto:smarlow at redhat.com">Scott Marlow</a>
*/
-public interface ConnectionFactoryBuilder {
+public interface ConnectionFactoryBuilder
+{
/**
* Return the CF Reference. The ConnectionFactory can be obtained from the Reference.
- * @return The reference
+ * @return Reference
+ * @throws DeployException
*/
Reference getReference() throws DeployException;
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/util/LocalApplicationServerJNDIHandler.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/util/LocalApplicationServerJNDIHandler.java 2010-02-17 15:49:58 UTC (rev 101077)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/util/LocalApplicationServerJNDIHandler.java 2010-02-17 16:00:04 UTC (rev 101078)
@@ -25,12 +25,13 @@
import org.jboss.jca.common.api.ConnectionFactoryBuilder;
import org.jboss.jca.fungal.deployers.DeployException;
+import java.util.Hashtable;
+import java.util.concurrent.ConcurrentHashMap;
+
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;
-import java.util.Hashtable;
-import java.util.concurrent.ConcurrentHashMap;
/**
* Local only support for connection factory
@@ -39,11 +40,25 @@
* @author <a href="mailto:smarlow at redhat.com">Scott Marlow</a>
*/
-public class LocalApplicationServerJNDIHandler implements ObjectFactory {
+public class LocalApplicationServerJNDIHandler implements ObjectFactory
+{
- private static ConcurrentHashMap<String, ConnectionFactoryBuilder> connectionFactories = new ConcurrentHashMap();
+ private static ConcurrentHashMap<String, ConnectionFactoryBuilder> connectionFactories =
+ new ConcurrentHashMap<String, ConnectionFactoryBuilder>();
- public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception {
+ /**
+ * Obtain the connection factory
+ * @see ObjectFactory#getObjectInstance(Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)
+ * @param obj Is the Reference that we bound to JNDI
+ * @param name
+ * @param nameCtx
+ * @param environment
+ * @return the connection factory
+ * @throws Exception
+ */
+ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment)
+ throws Exception
+ {
Reference ref = (Reference)obj;
String className = (String)ref.get("class").getContent();
String cfname = (String)ref.get("name").getContent();
@@ -52,20 +67,23 @@
}
/**
- *
+ * Register a connection factory builder
* @param name
* @param className
* @param cfb
* @throws DeployException if already registered and therefore deployed
*/
- public static void register(String name, String className, ConnectionFactoryBuilder cfb) throws DeployException {
+ public static void register(String name, String className, ConnectionFactoryBuilder cfb) throws DeployException
+ {
- if(null != connectionFactories.putIfAbsent(qualifiedName(name, className), cfb)) {
- throw new DeployException("Deployment " + className + " failed, " + name +" is already deployed");
+ if (null != connectionFactories.putIfAbsent(qualifiedName(name, className), cfb))
+ {
+ throw new DeployException("Deployment " + className + " failed, " + name + " is already deployed");
}
}
- private static String qualifiedName(String name, String className) {
+ private static String qualifiedName(String name, String className)
+ {
return className + "#" + name;
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/util/LocalConnectionFactoryBuilder.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/util/LocalConnectionFactoryBuilder.java 2010-02-17 15:49:58 UTC (rev 101077)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/util/LocalConnectionFactoryBuilder.java 2010-02-17 16:00:04 UTC (rev 101078)
@@ -34,45 +34,80 @@
*
* @author <a href="mailto:smarlow at redhat.com">Scott Marlow</a>
*/
-public class LocalConnectionFactoryBuilder implements ConnectionFactoryBuilder {
+public class LocalConnectionFactoryBuilder implements ConnectionFactoryBuilder
+{
private ManagedConnectionFactory mcf;
private Object cf;
private String name;
- public ConnectionFactoryBuilder setName(String name) {
+ /**
+ * @see ConnectionFactoryBuilder#setName
+ * @param name
+ * @return this
+ */
+ public ConnectionFactoryBuilder setName(String name)
+ {
this.name = name;
return this;
}
- public Reference getReference() throws DeployException {
+ /**
+ * @see ConnectionFactoryBuilder#getReference
+ * @return Reference
+ * @throws DeployException
+ */
+ public Reference getReference() throws DeployException
+ {
String className = cf.getClass().getName();
String name = this.name;
Reference ref = new Reference(
cf.getClass().getName(),
- new StringRefAddr("class",className),
+ new StringRefAddr("class", className),
LocalApplicationServerJNDIHandler.class.getName(),
null);
- ref.add(new StringRefAddr("name", name ));
+ ref.add(new StringRefAddr("name", name));
LocalApplicationServerJNDIHandler.register(name, className, this);
return ref;
}
- public ConnectionFactoryBuilder setManagedConnectionFactory(ManagedConnectionFactory mcf) {
+ /**
+ * @see ConnectionFactoryBuilder#setManagedConnectionFactory
+ * @param mcf is the managed connection factory to be used by connection factory.
+ * @return this
+ */
+ public ConnectionFactoryBuilder setManagedConnectionFactory(ManagedConnectionFactory mcf)
+ {
this.mcf = mcf;
return this;
}
- public ManagedConnectionFactory getManagedConnectionFactory() {
+ /**
+ * @see ConnectionFactoryBuilder#getManagedConnectionFactory
+ * @return ManagedConnectionFactory
+ */
+ public ManagedConnectionFactory getManagedConnectionFactory()
+ {
return mcf;
}
- public ConnectionFactoryBuilder setConnectionFactory(Object cf) {
+ /**
+ * @see ConnectionFactoryBuilder#setConnectionFactory
+ * @param cf is the connection factory that will be returned
+ * @return this
+ */
+ public ConnectionFactoryBuilder setConnectionFactory(Object cf)
+ {
this.cf = cf;
return this;
}
- public Object getConnectionFactory() {
+ /**
+ * @see ConnectionFactoryBuilder#getConnectionFactory
+ * @return connection factory
+ */
+ public Object getConnectionFactory()
+ {
return cf;
}
}
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 2010-02-17 15:49:58 UTC (rev 101077)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-02-17 16:00:04 UTC (rev 101078)
@@ -611,7 +611,8 @@
}
}
- private ConnectionFactoryBuilder getConnectionFactoryBuilder() {
+ private ConnectionFactoryBuilder getConnectionFactoryBuilder()
+ {
return new LocalConnectionFactoryBuilder();
}
@@ -749,7 +750,8 @@
private void bindConnectionFactory(String name, Serializable cf, ConnectionFactoryBuilder cfb) throws Exception
{
Context context = new InitialContext();
- try {
+ try
+ {
Referenceable referenceable = (Referenceable)cf;
referenceable.setReference(cfb.getReference());
@@ -757,7 +759,8 @@
Util.bind(context, JNDI_PREFIX + name, cf);
}
- finally {
+ finally
+ {
context.close(); // release connection
}
}
More information about the jboss-cvs-commits
mailing list