[jboss-cvs] JBossAS SVN: r108140 - in projects/jboss-jca/trunk: common/src/main/java/org/jboss/jca/common/api/metadata/ra/ra10 and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 14 10:51:09 EDT 2010
Author: maeste
Date: 2010-09-14 10:51:08 -0400 (Tue, 14 Sep 2010)
New Revision: 108140
Added:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonAdminObject.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonConnDef.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonAdminObjectImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonConnDefImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/DefaultAdminObjectMatcher.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/DefaultConnectionDefinitionMatcher.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/ExtensionMatcher.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/Merger.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/package.html
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/AbstractResourceAdapetrImpl.java
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/MergerTestCase.java
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/package.html
Removed:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/AdminObject.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/ConnectionDefinition.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/AdminObjectImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/ConnectionDefinitionImpl.java
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/MetadataFactoryTestCase.java
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/package.html
Modified:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonIronJacamar.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ra/ra10/ResourceAdapter10.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataFactory.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarParser.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParser.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/AdminObjectImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ConnectionDefinitionImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/OutboundResourceAdapterImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ResourceAdapter1516Impl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/ra10/ResourceAdapter10Impl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParser.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
projects/jboss-jca/trunk/tools/findbugs/filter.xml
Log:
JBJCA-419: implementation done. We need a test suit for this stuffs
Deleted: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/AdminObject.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/AdminObject.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/AdminObject.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -1,210 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.common.api.metadata.common;
-
-import org.jboss.jca.common.api.metadata.JCAMetadata;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * A AdminObject.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
-public interface AdminObject extends JCAMetadata
-{
-
- /**
- * Get the configProperties.
- *
- * @return the configProperties.
- */
- public Map<String, String> getConfigProperties();
-
- /**
- * Get the className.
- *
- * @return the className.
- */
- public String getClassName();
-
- /**
- * Get the jndiName.
- *
- * @return the jndiName.
- */
- public String getJndiName();
-
- /**
- * Get the poolName.
- *
- * @return the poolName.
- */
- public String getPoolName();
-
- /**
- * Get the enabled.
- *
- * @return the enabled.
- */
- public boolean isEnabled();
-
- /**
- * Get the useJavaContext.
- *
- * @return the useJavaContext.
- */
- public boolean isUseJavaContext();
-
- /**
- *
- * A Tag.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
- public enum Tag
- {
- /** always first
- *
- */
- UNKNOWN(null),
-
- /**
- * config-property tag
- */
- CONFIG_PROPERTY("config-property");
-
- private final String name;
-
- /**
- *
- * Create a new Tag.
- *
- * @param name a name
- */
- Tag(final String name)
- {
- this.name = name;
- }
-
- /**
- * Get the local name of this element.
- *
- * @return the local name
- */
- public String getLocalName()
- {
- return name;
- }
-
- private static final Map<String, Tag> MAP;
-
- static
- {
- final Map<String, Tag> map = new HashMap<String, Tag>();
- for (Tag element : values())
- {
- final String name = element.getLocalName();
- if (name != null)
- map.put(name, element);
- }
- MAP = map;
- }
-
- /**
- *
- * Static method to get enum instance given localName XsdString
- *
- * @param localName a XsdString used as localname (typically tag name as defined in xsd)
- * @return the enum instance
- */
- public static Tag forName(String localName)
- {
- final Tag element = MAP.get(localName);
- return element == null ? UNKNOWN : element;
- }
-
- }
-
- /**
- *
- * A Attribute.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
- public enum Attribute
- {
-
- /** jndiName attribute
- *
- */
- JNDINAME("jndi-name"),
-
- /** class-name attribute
- *
- */
- CLASS_NAME("class-name"),
-
- /** pool-name attribute
- *
- */
- POOL_NAME("pool-name"),
-
- /** enabled attribute
- *
- */
- ENABLED("enabled"),
- /** use-java-context attribute
- *
- */
- USEJAVACONTEXT("use-java-context");
-
- private final String name;
-
- /**
- *
- * Create a new Tag.
- *
- * @param name a name
- */
- Attribute(final String name)
- {
- this.name = name;
- }
-
- /**
- * Get the local name of this element.
- *
- * @return the local name
- */
- public String getLocalName()
- {
- return name;
- }
-
- }
-}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonAdminObject.java (from rev 108139, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/AdminObject.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonAdminObject.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonAdminObject.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,210 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.api.metadata.common;
+
+import org.jboss.jca.common.api.metadata.JCAMetadata;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ * A AdminObject.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public interface CommonAdminObject extends JCAMetadata
+{
+
+ /**
+ * Get the configProperties.
+ *
+ * @return the configProperties.
+ */
+ public Map<String, String> getConfigProperties();
+
+ /**
+ * Get the className.
+ *
+ * @return the className.
+ */
+ public String getClassName();
+
+ /**
+ * Get the jndiName.
+ *
+ * @return the jndiName.
+ */
+ public String getJndiName();
+
+ /**
+ * Get the poolName.
+ *
+ * @return the poolName.
+ */
+ public String getPoolName();
+
+ /**
+ * Get the enabled.
+ *
+ * @return the enabled.
+ */
+ public boolean isEnabled();
+
+ /**
+ * Get the useJavaContext.
+ *
+ * @return the useJavaContext.
+ */
+ public boolean isUseJavaContext();
+
+ /**
+ *
+ * A Tag.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+ public enum Tag
+ {
+ /** always first
+ *
+ */
+ UNKNOWN(null),
+
+ /**
+ * config-property tag
+ */
+ CONFIG_PROPERTY("config-property");
+
+ private final String name;
+
+ /**
+ *
+ * Create a new Tag.
+ *
+ * @param name a name
+ */
+ Tag(final String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the local name of this element.
+ *
+ * @return the local name
+ */
+ public String getLocalName()
+ {
+ return name;
+ }
+
+ private static final Map<String, Tag> MAP;
+
+ static
+ {
+ final Map<String, Tag> map = new HashMap<String, Tag>();
+ for (Tag element : values())
+ {
+ final String name = element.getLocalName();
+ if (name != null)
+ map.put(name, element);
+ }
+ MAP = map;
+ }
+
+ /**
+ *
+ * Static method to get enum instance given localName XsdString
+ *
+ * @param localName a XsdString used as localname (typically tag name as defined in xsd)
+ * @return the enum instance
+ */
+ public static Tag forName(String localName)
+ {
+ final Tag element = MAP.get(localName);
+ return element == null ? UNKNOWN : element;
+ }
+
+ }
+
+ /**
+ *
+ * A Attribute.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+ public enum Attribute
+ {
+
+ /** jndiName attribute
+ *
+ */
+ JNDINAME("jndi-name"),
+
+ /** class-name attribute
+ *
+ */
+ CLASS_NAME("class-name"),
+
+ /** pool-name attribute
+ *
+ */
+ POOL_NAME("pool-name"),
+
+ /** enabled attribute
+ *
+ */
+ ENABLED("enabled"),
+ /** use-java-context attribute
+ *
+ */
+ USEJAVACONTEXT("use-java-context");
+
+ private final String name;
+
+ /**
+ *
+ * Create a new Tag.
+ *
+ * @param name a name
+ */
+ Attribute(final String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the local name of this element.
+ *
+ * @return the local name
+ */
+ public String getLocalName()
+ {
+ return name;
+ }
+
+ }
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonConnDef.java (from rev 108139, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/ConnectionDefinition.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonConnDef.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonConnDef.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,266 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.api.metadata.common;
+
+import org.jboss.jca.common.api.metadata.JCAMetadata;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ * A ConnectionDefinition.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public interface CommonConnDef extends JCAMetadata
+{
+
+ /**
+ * Get the configProperties.
+ *
+ * @return the configProperties.
+ */
+ public Map<String, String> getConfigProperties();
+
+ /**
+ * Get the className.
+ *
+ * @return the className.
+ */
+ public String getClassName();
+
+ /**
+ * Get the jndiName.
+ *
+ * @return the jndiName.
+ */
+ public String getJndiName();
+
+ /**
+ * Get the poolName.
+ *
+ * @return the poolName.
+ */
+ public String getPoolName();
+
+ /**
+ * Get the enabled.
+ *
+ * @return the enabled.
+ */
+ public boolean isEnabled();
+
+ /**
+ * Get the useJavaContext.
+ *
+ * @return the useJavaContext.
+ */
+ public boolean isUseJavaContext();
+
+ /**
+ * Get the pool.
+ *
+ * @return the pool.
+ */
+ public CommonPool getPool();
+
+ /**
+ * Get the timeOut.
+ *
+ * @return the timeOut.
+ */
+ public CommonTimeOut getTimeOut();
+
+ /**
+ * Get the validation.
+ *
+ * @return the validation.
+ */
+ public CommonValidation getValidation();
+
+ /**
+ * Get the security.
+ *
+ * @return the security.
+ */
+ public CommonSecurity getSecurity();
+
+ /**
+ * Return true if this connectionDefnition have defined an XaPool
+ *
+ * @return true if this connectionDefnition have defined an XaPool
+ */
+
+ public boolean isXa();
+
+ /**
+ *
+ * A Tag.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+ public enum Tag
+ {
+ /** always first
+ *
+ */
+ UNKNOWN(null),
+
+ /**
+ * config-property tag
+ */
+ CONFIG_PROPERTY("config-property"),
+ /**
+ * pool tag
+ */
+ XA_POOL("xa-pool"),
+ /**
+ * pool tag
+ */
+ POOL("pool"),
+ /**
+ * security tag
+ */
+ SECURITY("security"),
+ /**
+ * timeout tag
+ */
+ TIMEOUT("timeout"),
+ /**
+ * validation tag
+ */
+ VALIDATION("validation");
+
+ private final String name;
+
+ /**
+ *
+ * Create a new Tag.
+ *
+ * @param name a name
+ */
+ Tag(final String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the local name of this element.
+ *
+ * @return the local name
+ */
+ public String getLocalName()
+ {
+ return name;
+ }
+
+ private static final Map<String, Tag> MAP;
+
+ static
+ {
+ final Map<String, Tag> map = new HashMap<String, Tag>();
+ for (Tag element : values())
+ {
+ final String name = element.getLocalName();
+ if (name != null)
+ map.put(name, element);
+ }
+ MAP = map;
+ }
+
+ /**
+ *
+ * Static method to get enum instance given localName XsdString
+ *
+ * @param localName a XsdString used as localname (typically tag name as defined in xsd)
+ * @return the enum instance
+ */
+ public static Tag forName(String localName)
+ {
+ final Tag element = MAP.get(localName);
+ return element == null ? UNKNOWN : element;
+ }
+
+ }
+
+ /**
+ *
+ * A Attribute.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+ public enum Attribute
+ {
+
+ /** jndiName attribute
+ *
+ */
+ JNDINAME("jndi-name"),
+
+ /** class-name attribute
+ *
+ */
+ CLASS_NAME("class-name"),
+
+ /** pool-name attribute
+ *
+ */
+ POOL_NAME("pool-name"),
+
+ /** enabled attribute
+ *
+ */
+ ENABLED("enabled"),
+ /** use-java-context attribute
+ *
+ */
+ USEJAVACONTEXT("use-java-context");
+
+ private final String name;
+
+ /**
+ *
+ * Create a new Tag.
+ *
+ * @param name a name
+ */
+ Attribute(final String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the local name of this element.
+ *
+ * @return the local name
+ */
+ public String getLocalName()
+ {
+ return name;
+ }
+
+ }
+}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonIronJacamar.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonIronJacamar.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonIronJacamar.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -49,14 +49,14 @@
*
* @return the connectionFactories.
*/
- public List<ConnectionDefinition> getConnectionDefinitions();
+ public List<CommonConnDef> getConnectionDefinitions();
/**
* Get the adminObjects.
*
* @return the adminObjects.
*/
- public List<AdminObject> getAdminObjects();
+ public List<CommonAdminObject> getAdminObjects();
/**
* Get the configProperties.
Deleted: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/ConnectionDefinition.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/ConnectionDefinition.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/ConnectionDefinition.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -1,266 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.common.api.metadata.common;
-
-import org.jboss.jca.common.api.metadata.JCAMetadata;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * A ConnectionDefinition.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
-public interface ConnectionDefinition extends JCAMetadata
-{
-
- /**
- * Get the configProperties.
- *
- * @return the configProperties.
- */
- public Map<String, String> getConfigProperties();
-
- /**
- * Get the className.
- *
- * @return the className.
- */
- public String getClassName();
-
- /**
- * Get the jndiName.
- *
- * @return the jndiName.
- */
- public String getJndiName();
-
- /**
- * Get the poolName.
- *
- * @return the poolName.
- */
- public String getPoolName();
-
- /**
- * Get the enabled.
- *
- * @return the enabled.
- */
- public boolean isEnabled();
-
- /**
- * Get the useJavaContext.
- *
- * @return the useJavaContext.
- */
- public boolean isUseJavaContext();
-
- /**
- * Get the pool.
- *
- * @return the pool.
- */
- public CommonPool getPool();
-
- /**
- * Get the timeOut.
- *
- * @return the timeOut.
- */
- public CommonTimeOut getTimeOut();
-
- /**
- * Get the validation.
- *
- * @return the validation.
- */
- public CommonValidation getValidation();
-
- /**
- * Get the security.
- *
- * @return the security.
- */
- public CommonSecurity getSecurity();
-
- /**
- * Return true if this connectionDefnition have defined an XaPool
- *
- * @return true if this connectionDefnition have defined an XaPool
- */
-
- public boolean isXa();
-
- /**
- *
- * A Tag.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
- public enum Tag
- {
- /** always first
- *
- */
- UNKNOWN(null),
-
- /**
- * config-property tag
- */
- CONFIG_PROPERTY("config-property"),
- /**
- * pool tag
- */
- XA_POOL("xa-pool"),
- /**
- * pool tag
- */
- POOL("pool"),
- /**
- * security tag
- */
- SECURITY("security"),
- /**
- * timeout tag
- */
- TIMEOUT("timeout"),
- /**
- * validation tag
- */
- VALIDATION("validation");
-
- private final String name;
-
- /**
- *
- * Create a new Tag.
- *
- * @param name a name
- */
- Tag(final String name)
- {
- this.name = name;
- }
-
- /**
- * Get the local name of this element.
- *
- * @return the local name
- */
- public String getLocalName()
- {
- return name;
- }
-
- private static final Map<String, Tag> MAP;
-
- static
- {
- final Map<String, Tag> map = new HashMap<String, Tag>();
- for (Tag element : values())
- {
- final String name = element.getLocalName();
- if (name != null)
- map.put(name, element);
- }
- MAP = map;
- }
-
- /**
- *
- * Static method to get enum instance given localName XsdString
- *
- * @param localName a XsdString used as localname (typically tag name as defined in xsd)
- * @return the enum instance
- */
- public static Tag forName(String localName)
- {
- final Tag element = MAP.get(localName);
- return element == null ? UNKNOWN : element;
- }
-
- }
-
- /**
- *
- * A Attribute.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
- public enum Attribute
- {
-
- /** jndiName attribute
- *
- */
- JNDINAME("jndi-name"),
-
- /** class-name attribute
- *
- */
- CLASS_NAME("class-name"),
-
- /** pool-name attribute
- *
- */
- POOL_NAME("pool-name"),
-
- /** enabled attribute
- *
- */
- ENABLED("enabled"),
- /** use-java-context attribute
- *
- */
- USEJAVACONTEXT("use-java-context");
-
- private final String name;
-
- /**
- *
- * Create a new Tag.
- *
- * @param name a name
- */
- Attribute(final String name)
- {
- this.name = name;
- }
-
- /**
- * Get the local name of this element.
- *
- * @return the local name
- */
- public String getLocalName()
- {
- return name;
- }
-
- }
-}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ra/ra10/ResourceAdapter10.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ra/ra10/ResourceAdapter10.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ra/ra10/ResourceAdapter10.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -23,7 +23,6 @@
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
import org.jboss.jca.common.api.metadata.ra.AuthenticationMechanism;
-import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
import org.jboss.jca.common.api.metadata.ra.MergeableMetadata;
import org.jboss.jca.common.api.metadata.ra.ResourceAdapter;
import org.jboss.jca.common.api.metadata.ra.SecurityPermission;
@@ -93,13 +92,6 @@
*/
public abstract List<AuthenticationMechanism> getAuthenticationMechanisms();
- /**
- * Get the configProperties.
- *
- * @return the configProperties.
- */
- @Override
- public abstract List<ConfigProperty> getConfigProperties();
/**
* Get the reauthenticationSupport.
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataFactory.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataFactory.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataFactory.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -22,48 +22,14 @@
package org.jboss.jca.common.metadata;
-import org.jboss.jca.common.api.metadata.common.CommonSecurity;
-import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
-import org.jboss.jca.common.api.metadata.ds.CommonDataSource;
-import org.jboss.jca.common.api.metadata.ds.DataSource;
-import org.jboss.jca.common.api.metadata.ds.XaDataSource;
import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
-import org.jboss.jca.common.api.metadata.ra.AdminObject;
-import org.jboss.jca.common.api.metadata.ra.AuthenticationMechanism;
-import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
-import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.ra.Connector;
-import org.jboss.jca.common.api.metadata.ra.Connector.Version;
-import org.jboss.jca.common.api.metadata.ra.Icon;
-import org.jboss.jca.common.api.metadata.ra.InboundResourceAdapter;
-import org.jboss.jca.common.api.metadata.ra.LicenseType;
-import org.jboss.jca.common.api.metadata.ra.LocalizedXsdString;
-import org.jboss.jca.common.api.metadata.ra.OutboundResourceAdapter;
-import org.jboss.jca.common.api.metadata.ra.ResourceAdapter;
-import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
-import org.jboss.jca.common.api.metadata.ra.SecurityPermission;
-import org.jboss.jca.common.api.metadata.ra.XsdString;
-import org.jboss.jca.common.api.metadata.ra.ra16.ConfigProperty16;
import org.jboss.jca.common.metadata.ironjacamar.IronJacamarParser;
import org.jboss.jca.common.metadata.ra.RaParser;
-import org.jboss.jca.common.metadata.ra.common.ConfigPropertyImpl;
-import org.jboss.jca.common.metadata.ra.common.ConnectionDefinitionImpl;
-import org.jboss.jca.common.metadata.ra.common.OutboundResourceAdapterImpl;
-import org.jboss.jca.common.metadata.ra.common.ResourceAdapter1516Impl;
-import org.jboss.jca.common.metadata.ra.ra10.Connector10Impl;
-import org.jboss.jca.common.metadata.ra.ra10.ResourceAdapter10Impl;
-import org.jboss.jca.common.metadata.ra.ra15.Connector15Impl;
-import org.jboss.jca.common.metadata.ra.ra16.ConfigProperty16Impl;
-import org.jboss.jca.common.metadata.ra.ra16.Connector16Impl;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
import org.jboss.logging.Logger;
@@ -174,716 +140,6 @@
return result;
}
- /**
- *
- * Merge ironJacamar's properties with connector's one returning a List of COnnector's properties
- *
- * @param ijProperties ironjacamar's extension style properties
- * @param original standard connector's properties
- * @return merged standard connector's properties (ironjacamar's setting overwrite the standard's one.
- * No new property is added)
- */
- public List<ConfigProperty> mergeConfigProperties(Map<String, String> ijProperties,
- List<? extends ConfigProperty> original)
- {
- List<ConfigProperty> mergedProperties = new ArrayList<ConfigProperty>(original.size());
- for (ConfigProperty c : original)
- {
- if (ijProperties.containsKey(c.getConfigPropertyName().getValue()))
- {
- if (original instanceof ConfigProperty16)
- {
- ConfigProperty16 c16 = (ConfigProperty16) c;
- XsdString newValue = new XsdString(ijProperties.get(c.getConfigPropertyName().getValue()), c
- .getConfigPropertyName().getId());
- ConfigProperty16 newProp = new ConfigProperty16Impl(c.getDescriptions(), c.getConfigPropertyName(),
- c.getConfigPropertyName(), newValue,
- c16.getConfigPropertyIgnore(),
- c16.getConfigPropertySupportsDynamicUpdates(),
- c16.getConfigPropertyConfidential(), c.getId());
- mergedProperties.add(newProp);
- }
- else
- {
- XsdString newValue = new XsdString(ijProperties.get(c.getConfigPropertyName().getValue()), c
- .getConfigPropertyName().getId());
- ConfigProperty newProp = new ConfigPropertyImpl(c.getDescriptions(), c.getConfigPropertyName(),
- c.getConfigPropertyName(), newValue, c.getId());
- mergedProperties.add(newProp);
- }
- }
- else
- {
- mergedProperties.add(c);
- }
- }
- return mergedProperties;
- }
- /**
- *
- * Merge a connector with a DataSource metadata
- *
- * @param cds the datasource it is one of interface extending {@link CommonDataSource}.
- * IOW it can be both {@link DataSource} or {@link XaDataSource}
- * @param connector the connector to merge
- * @return the connector with mapped properties taken forn ds
- * @throws IllegalArgumentException if version is't 1.0, 1.5 or 1.6
- * @throws Exception in case of error
- */
- public Connector mergeConnectorAndDs(CommonDataSource cds, Connector connector)
- throws IllegalArgumentException, Exception
- {
- if (cds == null)
- {
- return null;
- }
- else
- {
- return mergeConnectorWithProperties(connector, createConfigProperties(cds, extractProperties(connector)),
- null);
- }
- }
-
- private Connector mergeConnectorWithProperties(Connector connector,
- List<ConfigProperty> connectioDefProperties, List<ConfigProperty> raConfigProperties)
- throws IllegalArgumentException, Exception
- {
-
- XsdString managedconnectionfactoryClass = null;
-
- String id = null;
-
- XsdString connectionfactoryImplClass = null;
- XsdString connectionfactoryInterface = null;
- XsdString connectionImplClass = null;
- XsdString connectionInterface = null;
- List<AuthenticationMechanism> authenticationMechanism = null;
- boolean reauthenticationSupport = false;
- List<SecurityPermission> securityPermissions = null;
-
- XsdString vendorName = null;
- List<LocalizedXsdString> description = null;
- XsdString resourceadapterVersion = null;
- String moduleName = null;
- XsdString eisType = null;
- LicenseType license = null;
- List<LocalizedXsdString> displayNames = null;
- List<Icon> icons = null;
- List<AdminObject> adminobjects = null;
- TransactionSupportEnum transactionSupport = null;
-
- if (connector.getVersion() == Version.V_10)
- {
- if (raConfigProperties != null)
- {
- if (connectioDefProperties == null)
- {
- connectioDefProperties = raConfigProperties;
- }
- else
- {
- connectioDefProperties.addAll(raConfigProperties);
- }
- }
- ResourceAdapter resourceadapter = new ResourceAdapter10Impl(managedconnectionfactoryClass,
- connectionfactoryInterface,
- connectionfactoryImplClass,
- connectionInterface, connectionImplClass,
- transactionSupport, authenticationMechanism,
- connectioDefProperties,
- reauthenticationSupport, securityPermissions,
- id);
-
- Connector newConnector = new Connector10Impl(moduleName, vendorName, eisType, resourceadapterVersion,
- license, resourceadapter, description, displayNames, icons,
- id);
-
- return newConnector.merge(connector);
- }
- else
- {
- List<ConnectionDefinition> connectionDefinitions = new ArrayList<ConnectionDefinition>(1);
- ConnectionDefinition connectionDefinition = new ConnectionDefinitionImpl(managedconnectionfactoryClass,
- connectioDefProperties,
- connectionfactoryInterface,
- connectionfactoryImplClass,
- connectionInterface,
- connectionImplClass, id);
- connectionDefinitions.add(connectionDefinition);
- OutboundResourceAdapter outboundResourceadapter = new OutboundResourceAdapterImpl(
- connectionDefinitions,
- transactionSupport,
- authenticationMechanism,
- reauthenticationSupport,
- id);
- String resourceadapterClass = null;
- InboundResourceAdapter inboundResourceadapter = null;
- ResourceAdapter1516 resourceadapter = new ResourceAdapter1516Impl(resourceadapterClass,
- raConfigProperties,
- outboundResourceadapter,
- inboundResourceadapter, adminobjects,
- securityPermissions, id);
-
- if (connector.getVersion() == Version.V_16)
- {
- List<String> requiredWorkContexts = null;
- boolean metadataComplete = false;
-
- Connector newConnector = new Connector16Impl(moduleName, vendorName, eisType, resourceadapterVersion,
- license, resourceadapter, requiredWorkContexts,
- metadataComplete, description, displayNames, icons, id);
-
- return newConnector.merge(connector);
- }
- else if (connector.getVersion() == Version.V_15)
- {
- Connector newConnector = new Connector15Impl(vendorName, eisType, resourceadapterVersion, license,
- resourceadapter, description, displayNames, icons, id);
-
- return newConnector.merge(connector);
- }
- else
- throw new IllegalArgumentException("version= " + connector.getVersion().name());
- }
-
- }
-
- private List<? extends ConfigProperty> extractProperties(Connector connector)
- {
- List<? extends ConfigProperty> originalProperties = null;
- if (connector.getVersion() == Version.V_10)
- {
- originalProperties = connector.getResourceadapter().getConfigProperties();
- }
- else
- {
-
- if (connector.getResourceadapter() != null &&
- connector.getResourceadapter() instanceof ResourceAdapter1516)
- {
- ResourceAdapter1516 ra1516 = ((ResourceAdapter1516) connector.getResourceadapter());
- if (ra1516.getOutboundResourceadapter() != null &&
- ra1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
- {
- originalProperties = ra1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
- .getConfigProperties();
- }
- }
- }
- return originalProperties;
- }
-
- private static List<ConfigProperty> createConfigProperties(CommonDataSource cds,
- List<? extends ConfigProperty> originalProperties)
- {
- DataSource ds = null;
- XaDataSource xads = null;
- if (cds instanceof DataSource)
- {
- ds = (DataSource) cds;
- }
- if (cds instanceof XaDataSource)
- {
- xads = (XaDataSource) cds;
- }
- if (originalProperties != null)
- {
- List<ConfigProperty> configProperties = new ArrayList<ConfigProperty>(originalProperties.size());
- for (ConfigProperty property : originalProperties)
- {
-
- ConfigPropertyFactory.Prototype prototype = ConfigPropertyFactory.Prototype.forName(property
- .getConfigPropertyName().getValue());
- switch (prototype)
- {
- case USERNAME : {
- if (ds != null)
- {
- CommonSecurity security = ds.getSecurity();
- if (security != null && security.getUserName() != null &&
- !security.getUserName().trim().equals(""))
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- security.getUserName()));
- }
- }
- break;
- }
-
- case PASSWORD : {
- if (ds != null)
- {
- CommonSecurity security = ds.getSecurity();
- if (security != null && security.getPassword() != null &&
- !security.getPassword().trim().equals(""))
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- security.getPassword()));
- }
- }
-
- break;
- }
-
- case XADATASOURCEPROPERTIES : {
- if (xads != null && xads.getXaDataSourceProperty() != null)
- {
- StringBuffer valueBuf = new StringBuffer();
- for (Entry<String, String> xaConfigProperty : xads.getXaDataSourceProperty().entrySet())
- {
- valueBuf.append(xaConfigProperty.getKey());
- valueBuf.append("=");
- valueBuf.append(xaConfigProperty.getValue());
- valueBuf.append(";");
- }
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- valueBuf.toString()));
-
- }
-
- break;
- }
-
- case URLDELIMITER : {
- if (ds != null && ds.getUrlDelimiter() != null && !ds.getUrlDelimiter().trim().equals(""))
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- ds.getUrlDelimiter()));
- }
-
- break;
- }
-
- case URLSELECTORSTRATEGYCLASSNAME : {
- if (ds != null && ds.getUrlSelectorStrategyClassName() != null &&
- !ds.getUrlSelectorStrategyClassName().trim().equals(""))
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- ds.getUrlSelectorStrategyClassName()));
- }
-
- break;
- }
-
- case XADATASOURCECLASS : {
- if (xads != null && xads.getXaDataSourceClass() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- xads.getXaDataSourceClass()));
- }
-
- break;
- }
-
- case TRANSACTIONISOLATION : {
- if (ds != null && ds.getTransactionIsolation() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds
- .getTransactionIsolation().name()));
- }
-
- break;
- }
-
- case PREPAREDSTATEMENTCACHESIZE : {
- if (ds != null && ds.getStatement() != null &&
- ds.getStatement().getPreparedStatementsCacheSize() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getStatement()
- .getPreparedStatementsCacheSize()));
- }
-
- break;
- }
-
- case SHAREPREPAREDSTATEMENTS : {
- if (ds != null && ds.getStatement() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- ds.getStatement() != null && ds.getStatement().isSharePreparedStatements()));
- }
-
- break;
- }
-
- case NEWCONNECTIONSQL : {
- if (ds != null && ds.getNewConnectionSql() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- ds.getNewConnectionSql()));
- }
-
- break;
- }
-
- case CHECKVALIDCONNECTIONSQL : {
- if (ds != null && ds.getValidation() != null &&
- ds.getValidation().getCheckValidConnectionSql() != null &&
- !ds.getValidation().getCheckValidConnectionSql().trim().equals(""))
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
- .getCheckValidConnectionSql()));
- }
-
- break;
- }
-
- case VALIDCONNECTIONCHECKERCLASSNAME : {
- if (ds != null && ds.getValidation() != null &&
- ds.getValidation().getCheckValidConnectionSql() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
- .getCheckValidConnectionSql()));
- }
-
- break;
- }
-
- case EXCEPTIONSORTERCLASSNAME : {
- if (ds != null && ds.getValidation() != null &&
- ds.getValidation().getExceptionSorterClassName() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
- .getExceptionSorterClassName()));
- }
-
- break;
- }
-
- case STALECONNECTIONCHECKERCLASSNAME : {
- if (ds != null && ds.getValidation() != null &&
- ds.getValidation().getStaleConnectionCheckerClassName() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
- .getStaleConnectionCheckerClassName()));
- }
-
- break;
- }
-
- case TRACKSTATEMENTS : {
- if (ds != null && ds.getStatement() != null && ds.getStatement().getTrackStatements() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getStatement()
- .getTrackStatements().name()));
- }
-
- break;
- }
-
- case VALIDATEONMATCH : {
- if (ds != null && ds.getValidation() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
- .isValidateOnMatch()));
- }
-
- break;
- }
-
- case TRANSACTIONQUERYTIMEOUT : {
- if (ds != null && ds.getTimeOut() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getTimeOut()
- .isSetTxQueryTimeout()));
- }
-
- break;
- }
-
- case QUERYTIMEOUT : {
- if (ds != null && ds.getTimeOut() != null && ds.getTimeOut().getQueryTimeout() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getTimeOut()
- .getQueryTimeout()));
- }
-
- break;
- }
-
- case USETRYLOCK : {
- if (ds != null && ds.getTimeOut() != null && ds.getTimeOut().getUseTryLock() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getTimeOut()
- .getUseTryLock()));
- }
-
- break;
- }
- case DRIVERCLASS : {
- if (ds != null && ds.getDriverClass() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- ds.getDriverClass()));
- }
- break;
- }
- case URLPROPERTY :
- case CONNECTIONPROPERTIES : {
- if (ds != null && ds.getConnectionProperties() != null)
- {
- StringBuffer valueBuf = new StringBuffer();
- for (Entry<String, String> connProperty : ds.getConnectionProperties().entrySet())
- {
- valueBuf.append(connProperty.getKey());
- valueBuf.append("=");
- valueBuf.append(connProperty.getValue());
- valueBuf.append(";");
- }
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- valueBuf.toString()));
-
- }
- break;
- }
- case CONNECTIONURL : {
- if (ds != null && ds.getConnectionUrl() != null)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- ds.getConnectionUrl()));
- }
- break;
- }
- default :
- break;
- }
- }
- if (ds != null)
- {
- for (Entry<String, String> connectionProperty : ds.getConnectionProperties().entrySet())
- {
- ConfigPropertyFactory.Prototype prototype = ConfigPropertyFactory.Prototype
- .forName(connectionProperty.getKey());
- if (prototype != ConfigPropertyFactory.Prototype.UNKNOWN)
- {
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- connectionProperty.getValue()));
- }
- }
- }
- return configProperties;
- }
- else
- {
- return null;
- }
- }
-
- /**
- *
- * A ConfigPropertyFactory.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
- protected static class ConfigPropertyFactory
- {
- /**
- *
- * create a config property from a prototype
- *
- * @param prototype prototype
- * @param value value
- * @return the property created
- */
- public static ConfigProperty createConfigProperty(Prototype prototype, String value)
- {
-
- return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(),
- prototype.getLocalType(), new XsdString(value, null), null);
- }
-
- /**
- *
- * create a config property from a prototype
- *
- * @param prototype prototype
- * @param value value
- * @return the property created
- */
- public static ConfigProperty createConfigProperty(Prototype prototype, boolean value)
- {
-
- return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(),
- prototype.getLocalType(), new XsdString(String.valueOf(value), null), null);
- }
-
- /**
- *
- * create a config property from a prototype
- *
- * @param prototype prototype
- * @param value value
- * @return the property created
- */
- public static ConfigProperty createConfigProperty(Prototype prototype, Number value)
- {
-
- return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(),
- prototype.getLocalType(), new XsdString(String.valueOf(value), null), null);
- }
-
- /**
- *
- * A Prototype.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
- enum Prototype
- {
- /** UNKNOWN **/
- UNKNOWN(null, null, null),
- /** DRIVERCLASS **/
- DRIVERCLASS("DriverClass", "java.lang.String", "The jdbc driver class."),
- /** CONNECTIONURL **/
- CONNECTIONURL("ConnectionURL", "java.lang.String", "The jdbc connection url class."),
- /** CONNECTIONPROPERTIES **/
- CONNECTIONPROPERTIES("ConnectionProperties", "java.lang.String",
- "Connection properties for the database."),
-
- /** USERNAME **/
- USERNAME("UserName", "java.lang.String", "The default user name used to create JDBC connections."),
- /** PASSWORD **/
- PASSWORD("Password", "java.lang.String", "The default password used to create JDBC connections."),
- /** XADATASOURCEPROPERTIES **/
- XADATASOURCEPROPERTIES("XADataSourceProperties", "java.lang.String",
- "The properties to set up the XA driver. These properties must be in the form "
- + "name1=value1;name2=value2;...namen=valuen"),
- /** URLDELIMITER **/
- URLDELIMITER("URLDelimiter", "java.lang.String", "The jdbc connection url delimeter."),
- /** URLPROPERTY **/
- URLPROPERTY("URLProperty", "java.lang.String", "The property that contains the list of URLs."),
- /** URLSELECTORSTRATEGYCLASSNAME **/
- URLSELECTORSTRATEGYCLASSNAME("UrlSelectorStrategyClassName", "java.lang.String",
- "The configurable URLSelectorStrategy class name."),
- /** XADATASOURCECLASS **/
- XADATASOURCECLASS("XADataSourceClass", "java.lang.String",
- "The class name of the JDBC XA driver that handlesthis JDBC URL."),
- /** TRANSACTIONISOLATION **/
- TRANSACTIONISOLATION("TransactionIsolation", "java.lang.String",
- "The transaction isolation for new connections. Not necessary: the driver default will be used "
- + "if ommitted."),
- /** PREPAREDSTATEMENTCACHESIZE **/
- PREPAREDSTATEMENTCACHESIZE("PreparedStatementCacheSize", "java.lang.Integer",
- "The number of cached prepared statements per connection."),
- /** SHAREPREPAREDSTATEMENTS **/
- SHAREPREPAREDSTATEMENTS("SharePreparedStatements", "java.lang.Boolean",
- "Whether to share prepared statements."),
- /** NEWCONNECTIONSQL **/
- NEWCONNECTIONSQL("NewConnectionSQL", "java.lang.String",
- "An SQL statement to be executed when a new connection is created as auxillary setup."),
- /** CHECKVALIDCONNECTIONSQL **/
- CHECKVALIDCONNECTIONSQL("CheckValidConnectionSQL", "java.lang.String",
- "An SQL statement that may be executed when a managed connection is taken out of the pool and is "
- + "about to be given to a client: the purpose is to verify that the connection still works."),
- /** VALIDCONNECTIONCHECKERCLASSNAME **/
- VALIDCONNECTIONCHECKERCLASSNAME("ValidConnectionCheckerClassName", "java.lang.String",
- "The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.ValidConnectionChecker"
- + " that can determine for a particular vender db when a connection is valid."),
- /** EXCEPTIONSORTERCLASSNAME **/
- EXCEPTIONSORTERCLASSNAME("ExceptionSorterClassName", "java.lang.String",
- "The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.ExceptionSorter that"
- + " can determine for a particular vender db which exceptions are "
- + "fatal and mean a connection should be discarded."),
- /** STALECONNECTIONCHECKERCLASSNAME **/
- STALECONNECTIONCHECKERCLASSNAME("StaleConnectionCheckerClassName", "java.lang.String",
- "The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.StaleConnectionChecker"
- + " that can determine for a particular vender db when a connection is stale."),
- /** TRACKSTATEMENTS **/
- TRACKSTATEMENTS("TrackStatements", "java.lang.String",
- "Whether to track unclosed statements - false/true/nowarn"),
- /** VALIDATEONMATCH **/
- VALIDATEONMATCH("ValidateOnMatch", "java.lang.Boolean",
- "Whether to validate the connection on the ManagedConnectionFactory.matchManagedConnection method"),
- /** TRANSACTIONQUERYTIMEOUT **/
- TRANSACTIONQUERYTIMEOUT("TransactionQueryTimeout", "java.lang.Boolean",
- "Whether to set the query timeout based on the transaction timeout"),
- /** QUERYTIMEOUT **/
- QUERYTIMEOUT("QueryTimeout", "java.lang.Integer", "A configured query timeout"),
- /** USETRYLOCK **/
- USETRYLOCK("UseTryLock", "java.lang.Integer", "Maximum wait for a lock");
-
- private final XsdString localName;
-
- private final XsdString localType;
-
- private final ArrayList<LocalizedXsdString> description = new ArrayList<LocalizedXsdString>(1);
-
- /**
- * Create a new Prototype.
- *
- * @param name name
- * @param type type
- * @param description description
- */
- private Prototype(String name, String type, String description)
- {
- this.localName = new XsdString(name, null);
- this.localType = new XsdString(type, null);;
- this.description.add(new LocalizedXsdString(description, null));
- }
-
- /**
- * Get the name.
- *
- * @return the name.
- */
- public final XsdString getLocalName()
- {
- return localName;
- }
-
- /**
- * Get the type.
- *
- * @return the type.
- */
- public final XsdString getLocalType()
- {
- return localType;
- }
-
- /**
- * Get the description.
- *
- * @return the description.
- */
- public final List<LocalizedXsdString> getDescription()
- {
- return description;
- }
-
- private static final Map<String, Prototype> MAP;
-
- static
- {
- final Map<String, Prototype> map = new HashMap<String, Prototype>();
- for (Prototype element : values())
- {
- final String name = element.getLocalName().getValue();
- if (name != null)
- map.put(name, element);
- }
- MAP = map;
- }
-
- /**
- *
- * Static method to get enum instance given localName XsdString
- *
- * @param localName a XsdString used as localname (typically tag name as defined in xsd)
- * @return the enum instance
- */
- public static Prototype forName(String localName)
- {
- final Prototype element = MAP.get(localName);
- return element == null ? UNKNOWN : element;
- }
- }
-
- }
-
}
Deleted: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/AdminObjectImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/AdminObjectImpl.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/AdminObjectImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -1,216 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.common.metadata.common;
-
-import org.jboss.jca.common.api.metadata.common.AdminObject;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * A AdminObjectImpl.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
-public class AdminObjectImpl implements AdminObject
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 8137442556861441967L;
-
- private final HashMap<String, String> configProperties;
-
- private final String className;
-
- private final String jndiName;
-
- private final String poolName;
-
- private final boolean enabled;
-
- private final boolean useJavaContext;
-
- /**
- * Create a new AdminObjectImpl.
- *
- * @param configProperties configProperties
- * @param className className
- * @param jndiName jndiName
- * @param poolName poolName
- * @param enabled enabled
- * @param useJavaContext useJavaContext
- */
- public AdminObjectImpl(Map<String, String> configProperties, String className, String jndiName,
- String poolName, boolean enabled, boolean useJavaContext)
- {
- super();
- if (configProperties != null)
- {
- this.configProperties = new HashMap<String, String>(configProperties.size());
- this.configProperties.putAll(configProperties);
- }
- else
- {
- this.configProperties = new HashMap<String, String>(0);
- }
- this.className = className;
- this.jndiName = jndiName;
- this.poolName = poolName;
- this.enabled = enabled;
- this.useJavaContext = useJavaContext;
- }
-
- /**
- * Get the configProperties.
- *
- * @return the configProperties.
- */
- @Override
- public final Map<String, String> getConfigProperties()
- {
- return Collections.unmodifiableMap(configProperties);
- }
-
- /**
- * Get the className.
- *
- * @return the className.
- */
- @Override
- public final String getClassName()
- {
- return className;
- }
-
- /**
- * Get the jndiName.
- *
- * @return the jndiName.
- */
- @Override
- public final String getJndiName()
- {
- return jndiName;
- }
-
- /**
- * Get the enabled.
- *
- * @return the enabled.
- */
- @Override
- public final boolean isEnabled()
- {
- return enabled;
- }
-
- /**
- * Get the useJavaContext.
- *
- * @return the useJavaContext.
- */
- @Override
- public final boolean isUseJavaContext()
- {
- return useJavaContext;
- }
-
- @Override
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((className == null) ? 0 : className.hashCode());
- result = prime * result + ((configProperties == null) ? 0 : configProperties.hashCode());
- result = prime * result + (enabled ? 1231 : 1237);
- result = prime * result + ((jndiName == null) ? 0 : jndiName.hashCode());
- result = prime * result + ((poolName == null) ? 0 : poolName.hashCode());
- result = prime * result + (useJavaContext ? 1231 : 1237);
- return result;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof AdminObjectImpl))
- return false;
- AdminObjectImpl other = (AdminObjectImpl) obj;
- if (className == null)
- {
- if (other.className != null)
- return false;
- }
- else if (!className.equals(other.className))
- return false;
- if (configProperties == null)
- {
- if (other.configProperties != null)
- return false;
- }
- else if (!configProperties.equals(other.configProperties))
- return false;
- if (enabled != other.enabled)
- return false;
- if (jndiName == null)
- {
- if (other.jndiName != null)
- return false;
- }
- else if (!jndiName.equals(other.jndiName))
- return false;
- if (poolName == null)
- {
- if (other.poolName != null)
- return false;
- }
- else if (!poolName.equals(other.poolName))
- return false;
- if (useJavaContext != other.useJavaContext)
- return false;
- return true;
- }
-
- @Override
- public String toString()
- {
- return "AdminObjectImpl [configProperties=" + configProperties + ", className=" + className + ", jndiName=" +
- jndiName + ", poolName=" + poolName + ", enabled=" + enabled + ", useJavaContext=" + useJavaContext +
- "]";
- }
-
- /**
- * Get the poolName.
- *
- * @return the poolName.
- */
- @Override
- public final String getPoolName()
- {
- return poolName;
- }
-}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonAdminObjectImpl.java (from rev 108139, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/AdminObjectImpl.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonAdminObjectImpl.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonAdminObjectImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,216 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.metadata.common;
+
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ * A AdminObjectImpl.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class CommonAdminObjectImpl implements CommonAdminObject
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 8137442556861441967L;
+
+ private final HashMap<String, String> configProperties;
+
+ private final String className;
+
+ private final String jndiName;
+
+ private final String poolName;
+
+ private final boolean enabled;
+
+ private final boolean useJavaContext;
+
+ /**
+ * Create a new AdminObjectImpl.
+ *
+ * @param configProperties configProperties
+ * @param className className
+ * @param jndiName jndiName
+ * @param poolName poolName
+ * @param enabled enabled
+ * @param useJavaContext useJavaContext
+ */
+ public CommonAdminObjectImpl(Map<String, String> configProperties, String className, String jndiName,
+ String poolName, boolean enabled, boolean useJavaContext)
+ {
+ super();
+ if (configProperties != null)
+ {
+ this.configProperties = new HashMap<String, String>(configProperties.size());
+ this.configProperties.putAll(configProperties);
+ }
+ else
+ {
+ this.configProperties = new HashMap<String, String>(0);
+ }
+ this.className = className;
+ this.jndiName = jndiName;
+ this.poolName = poolName;
+ this.enabled = enabled;
+ this.useJavaContext = useJavaContext;
+ }
+
+ /**
+ * Get the configProperties.
+ *
+ * @return the configProperties.
+ */
+ @Override
+ public final Map<String, String> getConfigProperties()
+ {
+ return Collections.unmodifiableMap(configProperties);
+ }
+
+ /**
+ * Get the className.
+ *
+ * @return the className.
+ */
+ @Override
+ public final String getClassName()
+ {
+ return className;
+ }
+
+ /**
+ * Get the jndiName.
+ *
+ * @return the jndiName.
+ */
+ @Override
+ public final String getJndiName()
+ {
+ return jndiName;
+ }
+
+ /**
+ * Get the enabled.
+ *
+ * @return the enabled.
+ */
+ @Override
+ public final boolean isEnabled()
+ {
+ return enabled;
+ }
+
+ /**
+ * Get the useJavaContext.
+ *
+ * @return the useJavaContext.
+ */
+ @Override
+ public final boolean isUseJavaContext()
+ {
+ return useJavaContext;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((className == null) ? 0 : className.hashCode());
+ result = prime * result + ((configProperties == null) ? 0 : configProperties.hashCode());
+ result = prime * result + (enabled ? 1231 : 1237);
+ result = prime * result + ((jndiName == null) ? 0 : jndiName.hashCode());
+ result = prime * result + ((poolName == null) ? 0 : poolName.hashCode());
+ result = prime * result + (useJavaContext ? 1231 : 1237);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof CommonAdminObjectImpl))
+ return false;
+ CommonAdminObjectImpl other = (CommonAdminObjectImpl) obj;
+ if (className == null)
+ {
+ if (other.className != null)
+ return false;
+ }
+ else if (!className.equals(other.className))
+ return false;
+ if (configProperties == null)
+ {
+ if (other.configProperties != null)
+ return false;
+ }
+ else if (!configProperties.equals(other.configProperties))
+ return false;
+ if (enabled != other.enabled)
+ return false;
+ if (jndiName == null)
+ {
+ if (other.jndiName != null)
+ return false;
+ }
+ else if (!jndiName.equals(other.jndiName))
+ return false;
+ if (poolName == null)
+ {
+ if (other.poolName != null)
+ return false;
+ }
+ else if (!poolName.equals(other.poolName))
+ return false;
+ if (useJavaContext != other.useJavaContext)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "AdminObjectImpl [configProperties=" + configProperties + ", className=" + className + ", jndiName=" +
+ jndiName + ", poolName=" + poolName + ", enabled=" + enabled + ", useJavaContext=" + useJavaContext +
+ "]";
+ }
+
+ /**
+ * Get the poolName.
+ *
+ * @return the poolName.
+ */
+ @Override
+ public final String getPoolName()
+ {
+ return poolName;
+ }
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonConnDefImpl.java (from rev 108139, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/ConnectionDefinitionImpl.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonConnDefImpl.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonConnDefImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,323 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.metadata.common;
+
+import org.jboss.jca.common.api.metadata.common.CommonConnDef;
+import org.jboss.jca.common.api.metadata.common.CommonPool;
+import org.jboss.jca.common.api.metadata.common.CommonSecurity;
+import org.jboss.jca.common.api.metadata.common.CommonTimeOut;
+import org.jboss.jca.common.api.metadata.common.CommonValidation;
+import org.jboss.jca.common.api.metadata.common.CommonXaPool;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ * A ConnectionDefinition.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class CommonConnDefImpl implements CommonConnDef
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -7109775624169563102L;
+
+ private final HashMap<String, String> configProperties;
+
+ private final String className;
+
+ private final String jndiName;
+
+ private final String poolName;
+
+ private final boolean enabled;
+
+ private final boolean useJavaContext;
+
+ private final CommonPool pool;
+
+ private final CommonTimeOut timeOut;
+
+ private final CommonValidation validation;
+
+ private final CommonSecurity security;
+
+ /**
+ * Create a new ConnectionDefinition.
+ *
+ * @param configProperties configProperties
+ * @param className className
+ * @param jndiName jndiName
+ * @param poolName poolName
+ * @param enabled enabled
+ * @param useJavaContext useJavaContext
+ * @param pool pool
+ * @param timeOut timeOut
+ * @param validation validation
+ * @param security security
+ */
+ public CommonConnDefImpl(Map<String, String> configProperties, String className, String jndiName,
+ String poolName, boolean enabled, boolean useJavaContext, CommonPool pool, CommonTimeOut timeOut,
+ CommonValidation validation, CommonSecurity security)
+ {
+ super();
+ if (configProperties != null)
+ {
+ this.configProperties = new HashMap<String, String>(configProperties.size());
+ this.configProperties.putAll(configProperties);
+ }
+ else
+ {
+ this.configProperties = new HashMap<String, String>(0);
+ }
+ this.className = className;
+ this.jndiName = jndiName;
+ this.poolName = poolName;
+ this.enabled = enabled;
+ this.useJavaContext = useJavaContext;
+ this.pool = pool;
+ this.timeOut = timeOut;
+ this.validation = validation;
+ this.security = security;
+
+ }
+
+ /**
+ * Get the configProperties.
+ *
+ * @return the configProperties.
+ */
+ @Override
+ public final Map<String, String> getConfigProperties()
+ {
+ return Collections.unmodifiableMap(configProperties);
+ }
+
+ /**
+ * Get the className.
+ *
+ * @return the className.
+ */
+ @Override
+ public final String getClassName()
+ {
+ return className;
+ }
+
+ /**
+ * Get the jndiName.
+ *
+ * @return the jndiName.
+ */
+ @Override
+ public final String getJndiName()
+ {
+ return jndiName;
+ }
+
+ /**
+ * Get the poolName.
+ *
+ * @return the poolName.
+ */
+ @Override
+ public final String getPoolName()
+ {
+ return poolName;
+ }
+
+ /**
+ * Get the enabled.
+ *
+ * @return the enabled.
+ */
+ @Override
+ public final boolean isEnabled()
+ {
+ return enabled;
+ }
+
+ /**
+ * Get the useJavaContext.
+ *
+ * @return the useJavaContext.
+ */
+ @Override
+ public final boolean isUseJavaContext()
+ {
+ return useJavaContext;
+ }
+
+ /**
+ * Get the pool.
+ *
+ * @return the pool.
+ */
+ @Override
+ public final CommonPool getPool()
+ {
+ return pool;
+ }
+
+ /**
+ * Get the timeOut.
+ *
+ * @return the timeOut.
+ */
+ @Override
+ public final CommonTimeOut getTimeOut()
+ {
+ return timeOut;
+ }
+
+ /**
+ * Get the validation.
+ *
+ * @return the validation.
+ */
+ @Override
+ public final CommonValidation getValidation()
+ {
+ return validation;
+ }
+
+ /**
+ * Get the security.
+ *
+ * @return the security.
+ */
+ @Override
+ public final CommonSecurity getSecurity()
+ {
+ return security;
+ }
+
+ @Override
+ public final boolean isXa()
+ {
+ return (pool instanceof CommonXaPool);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((className == null) ? 0 : className.hashCode());
+ result = prime * result + ((configProperties == null) ? 0 : configProperties.hashCode());
+ result = prime * result + (enabled ? 1231 : 1237);
+ result = prime * result + ((jndiName == null) ? 0 : jndiName.hashCode());
+ result = prime * result + ((pool == null) ? 0 : pool.hashCode());
+ result = prime * result + ((poolName == null) ? 0 : poolName.hashCode());
+ result = prime * result + ((security == null) ? 0 : security.hashCode());
+ result = prime * result + ((timeOut == null) ? 0 : timeOut.hashCode());
+ result = prime * result + (useJavaContext ? 1231 : 1237);
+ result = prime * result + ((validation == null) ? 0 : validation.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof CommonConnDefImpl))
+ return false;
+ CommonConnDefImpl other = (CommonConnDefImpl) obj;
+ if (className == null)
+ {
+ if (other.className != null)
+ return false;
+ }
+ else if (!className.equals(other.className))
+ return false;
+ if (configProperties == null)
+ {
+ if (other.configProperties != null)
+ return false;
+ }
+ else if (!configProperties.equals(other.configProperties))
+ return false;
+ if (enabled != other.enabled)
+ return false;
+ if (jndiName == null)
+ {
+ if (other.jndiName != null)
+ return false;
+ }
+ else if (!jndiName.equals(other.jndiName))
+ return false;
+ if (pool == null)
+ {
+ if (other.pool != null)
+ return false;
+ }
+ else if (!pool.equals(other.pool))
+ return false;
+ if (poolName == null)
+ {
+ if (other.poolName != null)
+ return false;
+ }
+ else if (!poolName.equals(other.poolName))
+ return false;
+ if (security == null)
+ {
+ if (other.security != null)
+ return false;
+ }
+ else if (!security.equals(other.security))
+ return false;
+ if (timeOut == null)
+ {
+ if (other.timeOut != null)
+ return false;
+ }
+ else if (!timeOut.equals(other.timeOut))
+ return false;
+ if (useJavaContext != other.useJavaContext)
+ return false;
+ if (validation == null)
+ {
+ if (other.validation != null)
+ return false;
+ }
+ else if (!validation.equals(other.validation))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ConnectionDefinitionImpl [configProperties=" + configProperties + ", className=" + className +
+ ", jndiName=" + jndiName + ", poolName=" + poolName + ", enabled=" + enabled + ", useJavaContext=" +
+ useJavaContext + ", pool=" + pool + ", timeOut=" + timeOut + ", validation=" + validation +
+ ", security=" + security + "]";
+ }
+
+}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarImpl.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -21,9 +21,9 @@
*/
package org.jboss.jca.common.metadata.common;
-import org.jboss.jca.common.api.metadata.common.AdminObject;
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
+import org.jboss.jca.common.api.metadata.common.CommonConnDef;
import org.jboss.jca.common.api.metadata.common.CommonIronJacamar;
-import org.jboss.jca.common.api.metadata.common.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
import java.util.ArrayList;
@@ -56,12 +56,12 @@
/**
* adminObjects
*/
- protected final ArrayList<AdminObject> adminObjects;
+ protected final ArrayList<CommonAdminObject> adminObjects;
/**
* connectionDefinitions
*/
- protected final ArrayList<ConnectionDefinition> connectionDefinitions;
+ protected final ArrayList<CommonConnDef> connectionDefinitions;
/**
* beanValidationGroups
@@ -82,30 +82,30 @@
* @param bootstrapContext bootstrapContext
*/
protected CommonIronJacamarImpl(TransactionSupportEnum transactionSupport,
- Map<String, String> configProperties, List<AdminObject> adminObjects,
- List<ConnectionDefinition> connectionDefinitions, List<String> beanValidationGroups,
+ Map<String, String> configProperties, List<CommonAdminObject> adminObjects,
+ List<CommonConnDef> connectionDefinitions, List<String> beanValidationGroups,
String bootstrapContext)
{
super();
this.transactionSupport = transactionSupport;
if (connectionDefinitions != null)
{
- this.connectionDefinitions = new ArrayList<ConnectionDefinition>(connectionDefinitions.size());
+ this.connectionDefinitions = new ArrayList<CommonConnDef>(connectionDefinitions.size());
this.connectionDefinitions.addAll(connectionDefinitions);
}
else
{
- this.connectionDefinitions = new ArrayList<ConnectionDefinition>(0);
+ this.connectionDefinitions = new ArrayList<CommonConnDef>(0);
}
if (adminObjects != null)
{
- this.adminObjects = new ArrayList<AdminObject>(adminObjects.size());
+ this.adminObjects = new ArrayList<CommonAdminObject>(adminObjects.size());
this.adminObjects.addAll(adminObjects);
}
else
{
- this.adminObjects = new ArrayList<AdminObject>(0);
+ this.adminObjects = new ArrayList<CommonAdminObject>(0);
}
if (configProperties != null)
{
@@ -146,7 +146,7 @@
* @return the connectionFactories.
*/
@Override
- public final List<ConnectionDefinition> getConnectionDefinitions()
+ public final List<CommonConnDef> getConnectionDefinitions()
{
return Collections.unmodifiableList(connectionDefinitions);
}
@@ -157,7 +157,7 @@
* @return the adminObjects.
*/
@Override
- public final List<AdminObject> getAdminObjects()
+ public final List<CommonAdminObject> getAdminObjects()
{
return Collections.unmodifiableList(adminObjects);
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarParser.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarParser.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -21,13 +21,13 @@
*/
package org.jboss.jca.common.metadata.common;
-import org.jboss.jca.common.api.metadata.common.AdminObject;
-import org.jboss.jca.common.api.metadata.common.AdminObject.Attribute;
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject.Attribute;
+import org.jboss.jca.common.api.metadata.common.CommonConnDef;
import org.jboss.jca.common.api.metadata.common.CommonPool;
import org.jboss.jca.common.api.metadata.common.CommonSecurity;
import org.jboss.jca.common.api.metadata.common.CommonTimeOut;
import org.jboss.jca.common.api.metadata.common.CommonValidation;
-import org.jboss.jca.common.api.metadata.common.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.resourceadapter.ResourceAdapter;
import org.jboss.jca.common.metadata.AbstractParser;
import org.jboss.jca.common.metadata.ParserException;
@@ -55,12 +55,12 @@
* parse a single connection-definition tag
*
* @param reader the reader
- * @return the parse {@link ConnectionDefinition} object
+ * @return the parse {@link CommonConnDef} object
* @throws XMLStreamException XMLStreamException
* @throws ParserException ParserException
*/
- protected ConnectionDefinition parseConnectionDefinitions(XMLStreamReader reader) throws XMLStreamException,
- ParserException
+ protected CommonConnDef parseConnectionDefinitions(XMLStreamReader reader)
+ throws XMLStreamException, ParserException
{
HashMap<String, String> configProperties = new HashMap<String, String>();
CommonSecurity security = null;
@@ -75,7 +75,7 @@
String jndiName = null;
String poolName = null;
- for (ConnectionDefinition.Attribute attribute : ConnectionDefinition.Attribute.values())
+ for (CommonConnDef.Attribute attribute : CommonConnDef.Attribute.values())
{
switch (attribute)
{
@@ -113,12 +113,13 @@
if (ResourceAdapter.Tag.forName(reader.getLocalName()) == ResourceAdapter.Tag.CONNECTION_DEFINITION)
{
- return new ConnectionDefinitionImpl(configProperties, className, jndiName, poolName, enabled,
- useJavaContext, pool, timeOut, validation, security);
+ return new CommonConnDefImpl(configProperties, className, jndiName, poolName,
+ enabled, useJavaContext, pool, timeOut, validation,
+ security);
}
else
{
- if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.UNKNOWN)
+ if (CommonConnDef.Tag.forName(reader.getLocalName()) == CommonConnDef.Tag.UNKNOWN)
{
throw new ParserException("unexpected end tag" + reader.getLocalName());
}
@@ -126,7 +127,7 @@
break;
}
case START_ELEMENT : {
- switch (ConnectionDefinition.Tag.forName(reader.getLocalName()))
+ switch (CommonConnDef.Tag.forName(reader.getLocalName()))
{
case CONFIG_PROPERTY : {
configProperties.put(attributeAsString(reader, "name"), elementAsString(reader));
@@ -179,7 +180,7 @@
switch (reader.nextTag())
{
case END_ELEMENT : {
- if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.VALIDATION)
+ if (CommonConnDef.Tag.forName(reader.getLocalName()) == CommonConnDef.Tag.VALIDATION)
{
return new CommonValidationImpl(backgroundValidation, backgroundValidationMinutes, useFastFail);
@@ -231,7 +232,7 @@
switch (reader.nextTag())
{
case END_ELEMENT : {
- if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.TIMEOUT)
+ if (CommonConnDef.Tag.forName(reader.getLocalName()) == CommonConnDef.Tag.TIMEOUT)
{
return new CommonTimeOutImpl(blockingTimeoutMillis, idleTimeoutMinutes, allocationRetry,
@@ -284,11 +285,12 @@
* parse a single admin-oject tag
*
* @param reader the reader
- * @return the parsed {@link AdminObject}
+ * @return the parsed {@link CommonAdminObject}
* @throws XMLStreamException XMLStreamException
* @throws ParserException ParserException
*/
- protected AdminObject parseAdminObjects(XMLStreamReader reader) throws XMLStreamException, ParserException
+ protected CommonAdminObject parseAdminObjects(XMLStreamReader reader) throws XMLStreamException,
+ ParserException
{
HashMap<String, String> configProperties = new HashMap<String, String>();
@@ -299,7 +301,7 @@
String jndiName = null;
String poolName = null;
- for (Attribute attribute : AdminObject.Attribute.values())
+ for (Attribute attribute : CommonAdminObject.Attribute.values())
{
switch (attribute)
{
@@ -337,12 +339,12 @@
if (ResourceAdapter.Tag.forName(reader.getLocalName()) == ResourceAdapter.Tag.ADMIN_OBJECT)
{
- return new AdminObjectImpl(configProperties, className, jndiName, poolName, enabled,
- useJavaContext);
+ return new CommonAdminObjectImpl(configProperties, className, jndiName, poolName, enabled,
+ useJavaContext);
}
else
{
- if (AdminObject.Tag.forName(reader.getLocalName()) == AdminObject.Tag.UNKNOWN)
+ if (CommonAdminObject.Tag.forName(reader.getLocalName()) == CommonAdminObject.Tag.UNKNOWN)
{
throw new ParserException("unexpected end tag" + reader.getLocalName());
}
@@ -350,7 +352,7 @@
break;
}
case START_ELEMENT : {
- switch (AdminObject.Tag.forName(reader.getLocalName()))
+ switch (CommonAdminObject.Tag.forName(reader.getLocalName()))
{
case CONFIG_PROPERTY : {
configProperties.put(attributeAsString(reader, "name"), elementAsString(reader));
Deleted: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/ConnectionDefinitionImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/ConnectionDefinitionImpl.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/ConnectionDefinitionImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -1,325 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.common.metadata.common;
-
-import org.jboss.jca.common.api.metadata.common.CommonPool;
-import org.jboss.jca.common.api.metadata.common.CommonSecurity;
-import org.jboss.jca.common.api.metadata.common.CommonTimeOut;
-import org.jboss.jca.common.api.metadata.common.CommonValidation;
-import org.jboss.jca.common.api.metadata.common.CommonXaPool;
-import org.jboss.jca.common.api.metadata.common.ConnectionDefinition;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * A ConnectionDefinition.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
-public class ConnectionDefinitionImpl implements ConnectionDefinition
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = -7109775624169563102L;
-
- private final HashMap<String, String> configProperties;
-
- private final String className;
-
- private final String jndiName;
-
- private final String poolName;
-
- private final boolean enabled;
-
- private final boolean useJavaContext;
-
- private final CommonPool pool;
-
- private final CommonTimeOut timeOut;
-
- private final CommonValidation validation;
-
- private final CommonSecurity security;
-
-
- /**
- * Create a new ConnectionDefinition.
- *
- * @param configProperties configProperties
- * @param className className
- * @param jndiName jndiName
- * @param poolName poolName
- * @param enabled enabled
- * @param useJavaContext useJavaContext
- * @param pool pool
- * @param timeOut timeOut
- * @param validation validation
- * @param security security
- */
- public ConnectionDefinitionImpl(Map<String, String> configProperties, String className, String jndiName,
- String poolName, boolean enabled, boolean useJavaContext, CommonPool pool, CommonTimeOut timeOut,
- CommonValidation validation, CommonSecurity security)
- {
- super();
- if (configProperties != null)
- {
- this.configProperties = new HashMap<String, String>(configProperties.size());
- this.configProperties.putAll(configProperties);
- }
- else
- {
- this.configProperties = new HashMap<String, String>(0);
- }
- this.className = className;
- this.jndiName = jndiName;
- this.poolName = poolName;
- this.enabled = enabled;
- this.useJavaContext = useJavaContext;
- this.pool = pool;
- this.timeOut = timeOut;
- this.validation = validation;
- this.security = security;
-
- }
-
- /**
- * Get the configProperties.
- *
- * @return the configProperties.
- */
- @Override
- public final Map<String, String> getConfigProperties()
- {
- return Collections.unmodifiableMap(configProperties);
- }
-
- /**
- * Get the className.
- *
- * @return the className.
- */
- @Override
- public final String getClassName()
- {
- return className;
- }
-
- /**
- * Get the jndiName.
- *
- * @return the jndiName.
- */
- @Override
- public final String getJndiName()
- {
- return jndiName;
- }
-
- /**
- * Get the poolName.
- *
- * @return the poolName.
- */
- @Override
- public final String getPoolName()
- {
- return poolName;
- }
-
- /**
- * Get the enabled.
- *
- * @return the enabled.
- */
- @Override
- public final boolean isEnabled()
- {
- return enabled;
- }
-
- /**
- * Get the useJavaContext.
- *
- * @return the useJavaContext.
- */
- @Override
- public final boolean isUseJavaContext()
- {
- return useJavaContext;
- }
-
- /**
- * Get the pool.
- *
- * @return the pool.
- */
- @Override
- public final CommonPool getPool()
- {
- return pool;
- }
-
- /**
- * Get the timeOut.
- *
- * @return the timeOut.
- */
- @Override
- public final CommonTimeOut getTimeOut()
- {
- return timeOut;
- }
-
- /**
- * Get the validation.
- *
- * @return the validation.
- */
- @Override
- public final CommonValidation getValidation()
- {
- return validation;
- }
-
- /**
- * Get the security.
- *
- * @return the security.
- */
- @Override
- public final CommonSecurity getSecurity()
- {
- return security;
- }
-
-
- @Override
- public final boolean isXa()
- {
- return (pool instanceof CommonXaPool);
- }
-
- @Override
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((className == null) ? 0 : className.hashCode());
- result = prime * result + ((configProperties == null) ? 0 : configProperties.hashCode());
- result = prime * result + (enabled ? 1231 : 1237);
- result = prime * result + ((jndiName == null) ? 0 : jndiName.hashCode());
- result = prime * result + ((pool == null) ? 0 : pool.hashCode());
- result = prime * result + ((poolName == null) ? 0 : poolName.hashCode());
- result = prime * result + ((security == null) ? 0 : security.hashCode());
- result = prime * result + ((timeOut == null) ? 0 : timeOut.hashCode());
- result = prime * result + (useJavaContext ? 1231 : 1237);
- result = prime * result + ((validation == null) ? 0 : validation.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof ConnectionDefinitionImpl))
- return false;
- ConnectionDefinitionImpl other = (ConnectionDefinitionImpl) obj;
- if (className == null)
- {
- if (other.className != null)
- return false;
- }
- else if (!className.equals(other.className))
- return false;
- if (configProperties == null)
- {
- if (other.configProperties != null)
- return false;
- }
- else if (!configProperties.equals(other.configProperties))
- return false;
- if (enabled != other.enabled)
- return false;
- if (jndiName == null)
- {
- if (other.jndiName != null)
- return false;
- }
- else if (!jndiName.equals(other.jndiName))
- return false;
- if (pool == null)
- {
- if (other.pool != null)
- return false;
- }
- else if (!pool.equals(other.pool))
- return false;
- if (poolName == null)
- {
- if (other.poolName != null)
- return false;
- }
- else if (!poolName.equals(other.poolName))
- return false;
- if (security == null)
- {
- if (other.security != null)
- return false;
- }
- else if (!security.equals(other.security))
- return false;
- if (timeOut == null)
- {
- if (other.timeOut != null)
- return false;
- }
- else if (!timeOut.equals(other.timeOut))
- return false;
- if (useJavaContext != other.useJavaContext)
- return false;
- if (validation == null)
- {
- if (other.validation != null)
- return false;
- }
- else if (!validation.equals(other.validation))
- return false;
- return true;
- }
-
- @Override
- public String toString()
- {
- return "ConnectionDefinitionImpl [configProperties=" + configProperties + ", className=" + className +
- ", jndiName=" + jndiName + ", poolName=" + poolName + ", enabled=" + enabled + ", useJavaContext=" +
- useJavaContext + ", pool=" + pool + ", timeOut=" + timeOut + ", validation=" + validation +
- ", security=" + security + "]";
- }
-
-}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarImpl.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -21,8 +21,8 @@
*/
package org.jboss.jca.common.metadata.ironjacamar;
-import org.jboss.jca.common.api.metadata.common.AdminObject;
-import org.jboss.jca.common.api.metadata.common.ConnectionDefinition;
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
+import org.jboss.jca.common.api.metadata.common.CommonConnDef;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
import org.jboss.jca.common.metadata.common.CommonIronJacamarImpl;
@@ -55,7 +55,7 @@
* @param bootstrapContext bootstrapContext
*/
public IronJacamarImpl(TransactionSupportEnum transactionSupport, Map<String, String> configProperties,
- List<AdminObject> adminObjects, List<ConnectionDefinition> connectionDefinitions,
+ List<CommonAdminObject> adminObjects, List<CommonConnDef> connectionDefinitions,
List<String> beanValidationGroups, String bootstrapContext)
{
super(transactionSupport, configProperties, adminObjects, connectionDefinitions, beanValidationGroups,
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParser.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParser.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -21,8 +21,8 @@
*/
package org.jboss.jca.common.metadata.ironjacamar;
-import org.jboss.jca.common.api.metadata.common.AdminObject;
-import org.jboss.jca.common.api.metadata.common.ConnectionDefinition;
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
+import org.jboss.jca.common.api.metadata.common.CommonConnDef;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
import org.jboss.jca.common.metadata.MetadataParser;
@@ -111,8 +111,8 @@
private IronJacamar parseIronJacamar(XMLStreamReader reader) throws XMLStreamException, ParserException
{
- ArrayList<ConnectionDefinition> connectionDefinitions = new ArrayList<ConnectionDefinition>();
- ArrayList<AdminObject> adminObjects = new ArrayList<AdminObject>();
+ ArrayList<CommonConnDef> connectionDefinitions = new ArrayList<CommonConnDef>();
+ ArrayList<CommonAdminObject> adminObjects = new ArrayList<CommonAdminObject>();
ArrayList<String> beanValidationGroups = new ArrayList<String>();
String bootstrapContext = null;
TransactionSupportEnum transactionSupport = null;
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/DefaultAdminObjectMatcher.java (from rev 108139, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonIronJacamar.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/DefaultAdminObjectMatcher.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/DefaultAdminObjectMatcher.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.metadata.merge;
+
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
+import org.jboss.jca.common.api.metadata.ra.AdminObject;
+import org.jboss.jca.common.api.metadata.ra.XsdString;
+
+/**
+ *
+ * A DefaultAdminObjectMatcher.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class DefaultAdminObjectMatcher implements ExtensionMatcher<AdminObject, CommonAdminObject>
+{
+
+ @Override
+ public boolean match(AdminObject left, CommonAdminObject right)
+ {
+ if (!XsdString.isNull(left.getAdminobjectClass()))
+ {
+ return left.getAdminobjectClass().getValue().trim().equals(right.getClassName().trim());
+ }
+ else
+ {
+ return right.getClassName() == null || right.getClassName().trim().equals("");
+ }
+ }
+
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/DefaultConnectionDefinitionMatcher.java (from rev 108139, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonIronJacamar.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/DefaultConnectionDefinitionMatcher.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/DefaultConnectionDefinitionMatcher.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.metadata.merge;
+
+import org.jboss.jca.common.api.metadata.common.CommonConnDef;
+import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
+import org.jboss.jca.common.api.metadata.ra.XsdString;
+
+/**
+ *
+ * A DefaultConnectionDefinitionMatcher.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class DefaultConnectionDefinitionMatcher
+ implements
+ ExtensionMatcher<ConnectionDefinition, CommonConnDef>
+{
+
+ @Override
+ public boolean match(ConnectionDefinition left, CommonConnDef right)
+ {
+ if (!XsdString.isNull(left.getConnectionImplClass()))
+ {
+ return left.getConnectionImplClass().getValue().trim().equals(right.getClassName().trim());
+ }
+ else
+ {
+ return right.getClassName() == null || right.getClassName().trim().equals("");
+ }
+ }
+
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/ExtensionMatcher.java (from rev 108139, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonIronJacamar.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/ExtensionMatcher.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/ExtensionMatcher.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.metadata.merge;
+
+/**
+ *
+ * A ExtensionMatcher.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ * @param <T> type one
+ * @param <S> type two
+ *
+ */
+public interface ExtensionMatcher<T, S>
+{
+ /**
+ *
+ * Match two Onject of give generics type as mergeable each other
+ *
+ * @param left an object of T type
+ * @param right an object of S type
+ * @return true if objects could be considered mergeable. IOW if they refer to same artifact
+ */
+ public boolean match(T left, S right);
+}
+
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/Merger.java (from rev 108139, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataFactory.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/Merger.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/Merger.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,951 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.metadata.merge;
+
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
+import org.jboss.jca.common.api.metadata.common.CommonConnDef;
+import org.jboss.jca.common.api.metadata.common.CommonIronJacamar;
+import org.jboss.jca.common.api.metadata.common.CommonSecurity;
+import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
+import org.jboss.jca.common.api.metadata.ds.CommonDataSource;
+import org.jboss.jca.common.api.metadata.ds.DataSource;
+import org.jboss.jca.common.api.metadata.ds.XaDataSource;
+import org.jboss.jca.common.api.metadata.ra.AdminObject;
+import org.jboss.jca.common.api.metadata.ra.AuthenticationMechanism;
+import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
+import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
+import org.jboss.jca.common.api.metadata.ra.Connector;
+import org.jboss.jca.common.api.metadata.ra.Connector.Version;
+import org.jboss.jca.common.api.metadata.ra.Icon;
+import org.jboss.jca.common.api.metadata.ra.InboundResourceAdapter;
+import org.jboss.jca.common.api.metadata.ra.LicenseType;
+import org.jboss.jca.common.api.metadata.ra.LocalizedXsdString;
+import org.jboss.jca.common.api.metadata.ra.OutboundResourceAdapter;
+import org.jboss.jca.common.api.metadata.ra.ResourceAdapter;
+import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
+import org.jboss.jca.common.api.metadata.ra.SecurityPermission;
+import org.jboss.jca.common.api.metadata.ra.XsdString;
+import org.jboss.jca.common.api.metadata.ra.ra16.ConfigProperty16;
+import org.jboss.jca.common.metadata.merge.Merger.ConfigPropertyFactory.Prototype;
+import org.jboss.jca.common.metadata.ra.common.AbstractResourceAdapetrImpl;
+import org.jboss.jca.common.metadata.ra.common.AdminObjectImpl;
+import org.jboss.jca.common.metadata.ra.common.ConfigPropertyImpl;
+import org.jboss.jca.common.metadata.ra.common.ConnectionDefinitionImpl;
+import org.jboss.jca.common.metadata.ra.common.OutboundResourceAdapterImpl;
+import org.jboss.jca.common.metadata.ra.common.ResourceAdapter1516Impl;
+import org.jboss.jca.common.metadata.ra.ra10.Connector10Impl;
+import org.jboss.jca.common.metadata.ra.ra10.ResourceAdapter10Impl;
+import org.jboss.jca.common.metadata.ra.ra15.Connector15Impl;
+import org.jboss.jca.common.metadata.ra.ra16.ConfigProperty16Impl;
+import org.jboss.jca.common.metadata.ra.ra16.Connector16Impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ *
+ * A Merger.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class Merger
+{
+ /**
+ *
+ * Merge ironJacamar's properties with connector's one returning a List of COnnector's properties
+ *
+ * @param ijProperties ironjacamar's extension style properties
+ * @param original standard connector's properties
+ * @return merged standard connector's properties (ironjacamar's setting overwrite the standard's one.
+ * No new property is added)
+ */
+ public List<ConfigProperty> mergeConfigProperties(Map<String, String> ijProperties,
+ List<? extends ConfigProperty> original)
+ {
+ List<ConfigProperty> mergedProperties = new ArrayList<ConfigProperty>(original.size());
+ for (ConfigProperty c : original)
+ {
+ if (ijProperties.containsKey(c.getConfigPropertyName().getValue()))
+ {
+ if (original instanceof ConfigProperty16)
+ {
+ ConfigProperty16 c16 = (ConfigProperty16) c;
+ XsdString newValue = new XsdString(ijProperties.get(c.getConfigPropertyName().getValue()), c
+ .getConfigPropertyName().getId());
+ ConfigProperty16 newProp = new ConfigProperty16Impl(c.getDescriptions(), c.getConfigPropertyName(),
+ c.getConfigPropertyName(), newValue,
+ c16.getConfigPropertyIgnore(),
+ c16.getConfigPropertySupportsDynamicUpdates(),
+ c16.getConfigPropertyConfidential(), c.getId());
+ mergedProperties.add(newProp);
+ }
+ else
+ {
+ XsdString newValue = new XsdString(ijProperties.get(c.getConfigPropertyName().getValue()), c
+ .getConfigPropertyName().getId());
+ ConfigProperty newProp = new ConfigPropertyImpl(c.getDescriptions(), c.getConfigPropertyName(),
+ c.getConfigPropertyName(), newValue, c.getId());
+ mergedProperties.add(newProp);
+ }
+
+ }
+ else
+ {
+ mergedProperties.add(c);
+ }
+ }
+ return mergedProperties;
+ }
+
+ /**
+ *
+ * Merge a {@link Connector} and a {@link CommonIronJacamar}
+ *
+ * @param ij the {@link CommonIronJacamar} object
+ * @param conn {@link Connector} object
+ * @return The merged {@link Connector}
+ */
+ public Connector mergeConnectorWithCommonIronJacamar(CommonIronJacamar ij, Connector conn)
+ {
+ return this.mergeConnectorWithCommonIronJacamar(ij, conn, null, null);
+ }
+
+ /**
+ *
+ * Merge a {@link Connector} and a {@link CommonIronJacamar} passing also Matcher to identify {@link AdminObject}
+ * and {@link ConnectionDefinition} to merge inside the passed objects
+ *
+ * @param ij the {@link CommonIronJacamar} object
+ * @param conn {@link Connector} object
+ * @param adminMatcher the matcher for {@link AdminObject} and {@link CommonAdminObject}
+ * if null {@link DefaultAdminObjectMatcher} is used
+ * @param connDefMatcher the matcher for {@link ConnectionDefinition} andf {@link CommonConnDef}.
+ * if null {@link DefaultConnectionDefinitionMatcher} is used
+ * @return The merged {@link Connector}
+ */
+ public Connector mergeConnectorWithCommonIronJacamar(CommonIronJacamar ij, Connector conn,
+ ExtensionMatcher<AdminObject, CommonAdminObject> adminMatcher,
+ ExtensionMatcher<ConnectionDefinition, CommonConnDef> connDefMatcher)
+ {
+
+ if (adminMatcher == null)
+ adminMatcher = new DefaultAdminObjectMatcher();
+
+ if (connDefMatcher == null)
+ connDefMatcher = new DefaultConnectionDefinitionMatcher();
+
+ //merge transactionSupport;
+ mergeTransactionSupport(ij, conn);
+
+ // merge RA onfigProperties;
+ List<? extends ConfigProperty> original = conn.getResourceadapter().getConfigProperties();
+ List<? extends ConfigProperty> newProperties = this
+ .mergeConfigProperties(ij.getConfigProperties(), original);
+
+ ((AbstractResourceAdapetrImpl) conn.getResourceadapter()).forceNewConfigPropertiesContent(newProperties);
+
+ if (conn.getVersion() != Version.V_10)
+ {
+ //merge adminObjects;
+
+ ResourceAdapter1516 ra1516 = (ResourceAdapter1516) conn.getResourceadapter();
+ if (ra1516 != null && ra1516.getAdminObjects() != null)
+ {
+ List<AdminObject> newAdminObjects = new ArrayList<AdminObject>(ra1516.getAdminObjects().size());
+ for (AdminObject adminObj : ra1516.getAdminObjects())
+ {
+ boolean found = false;
+ for (CommonAdminObject commonAdminObj : ij.getAdminObjects())
+ {
+ if (adminMatcher.match(adminObj, commonAdminObj))
+ {
+ found = true;
+ newAdminObjects.add(mergeAdminObject(commonAdminObj, adminObj));
+ }
+ }
+ if (!found)
+ {
+ newAdminObjects.add(adminObj);
+ }
+ }
+ ((ResourceAdapter1516Impl) ra1516).forceAdminObjectsContent(newAdminObjects);
+ }
+ //merge connectionDefinitions;
+ if (ra1516 != null && ra1516.getOutboundResourceadapter() != null &&
+ ra1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
+ {
+ List<ConnectionDefinition> newConDefs = new ArrayList<ConnectionDefinition>(ra1516
+ .getOutboundResourceadapter().getConnectionDefinitions().size());
+ for (ConnectionDefinition conDef : ra1516.getOutboundResourceadapter().getConnectionDefinitions())
+ {
+ boolean found = false;
+ for (CommonConnDef commonConDef : ij.getConnectionDefinitions())
+ {
+ if (connDefMatcher.match(conDef, commonConDef))
+ {
+ found = true;
+ newConDefs.add(mergeConDef(commonConDef, conDef));
+ }
+ }
+ if (!found)
+ {
+ newConDefs.add(conDef);
+ }
+ }
+ ((OutboundResourceAdapterImpl) ra1516.getOutboundResourceadapter())
+ .forceConnectionDefinitionsContent(newConDefs);
+ }
+
+ }
+
+ return null;
+ }
+
+ private ConnectionDefinition mergeConDef(CommonConnDef commonConDef, ConnectionDefinition conDef)
+ {
+ // merge ConnectionDefinition onfigProperties;
+ List<? extends ConfigProperty> original = conDef.getConfigProperties();
+ List<ConfigProperty> newProperties = this
+ .mergeConfigProperties(commonConDef.getConfigProperties(), original);
+
+ CommonSecurity security = commonConDef.getSecurity();
+ if (security != null && security.getUserName() != null && !security.getUserName().trim().equals(""))
+ {
+ newProperties.add(ConfigPropertyFactory.createConfigProperty(Prototype.USERNAME, security.getUserName()));
+ }
+
+ if (security != null && security.getPassword() != null && !security.getPassword().trim().equals(""))
+ {
+ newProperties.add(ConfigPropertyFactory.createConfigProperty(Prototype.PASSWORD, security.getPassword()));
+ }
+
+ ((ConnectionDefinitionImpl) conDef).forceNewConfigPropertiesContent(newProperties);
+
+ return conDef;
+ }
+
+ private AdminObject mergeAdminObject(CommonAdminObject commonAdminObj, AdminObject adminObj)
+ {
+ // merge AdminObject onfigProperties;
+ List<? extends ConfigProperty> original = adminObj.getConfigProperties();
+ List<? extends ConfigProperty> newProperties = this.mergeConfigProperties(
+ commonAdminObj.getConfigProperties(), original);
+
+ ((AdminObjectImpl) adminObj).forceNewConfigPropertiesContent(newProperties);
+ return adminObj;
+
+ }
+
+ private void mergeTransactionSupport(CommonIronJacamar ij, Connector conn)
+ {
+ if (ij.getTransactionSupport() != null)
+ {
+ if (conn.getVersion() == Version.V_10 && conn.getResourceadapter() != null)
+ {
+ ((ResourceAdapter10Impl) conn.getResourceadapter()).forceNewTrasactionSupport(ij
+ .getTransactionSupport());
+ }
+ else
+ {
+ if (conn.getResourceadapter() != null)
+ {
+ ResourceAdapter1516 ra1516 = (ResourceAdapter1516) conn.getResourceadapter();
+ if (ra1516.getOutboundResourceadapter() != null)
+ {
+ ((OutboundResourceAdapterImpl) ra1516.getOutboundResourceadapter()).forceNewTrasactionSupport(ij
+ .getTransactionSupport());
+ }
+ }
+ }
+ }
+
+ }
+
+ /**
+ *
+ * Merge a connector with a DataSource metadata
+ *
+ * @param cds the datasource it is one of interface extending {@link CommonDataSource}.
+ * IOW it can be both {@link DataSource} or {@link XaDataSource}
+ * @param connector the connector to merge
+ * @return the connector with mapped properties taken forn ds
+ * @throws IllegalArgumentException if version is't 1.0, 1.5 or 1.6
+ * @throws Exception in case of error
+ */
+ public Connector mergeConnectorAndDs(CommonDataSource cds, Connector connector)
+ throws IllegalArgumentException, Exception
+ {
+ if (cds == null)
+ {
+ return null;
+ }
+ else
+ {
+ return mergeConnectorWithProperties(connector, createConfigProperties(cds, extractProperties(connector)),
+ null);
+ }
+ }
+
+ private Connector mergeConnectorWithProperties(Connector connector,
+ List<ConfigProperty> connectioDefProperties, List<ConfigProperty> raConfigProperties)
+ throws IllegalArgumentException, Exception
+ {
+
+ XsdString managedconnectionfactoryClass = null;
+
+ String id = null;
+
+ XsdString connectionfactoryImplClass = null;
+ XsdString connectionfactoryInterface = null;
+ XsdString connectionImplClass = null;
+ XsdString connectionInterface = null;
+ List<AuthenticationMechanism> authenticationMechanism = null;
+ boolean reauthenticationSupport = false;
+ List<SecurityPermission> securityPermissions = null;
+
+ XsdString vendorName = null;
+ List<LocalizedXsdString> description = null;
+ XsdString resourceadapterVersion = null;
+ String moduleName = null;
+ XsdString eisType = null;
+ LicenseType license = null;
+ List<LocalizedXsdString> displayNames = null;
+ List<Icon> icons = null;
+ List<AdminObject> adminobjects = null;
+ TransactionSupportEnum transactionSupport = null;
+
+ if (connector.getVersion() == Version.V_10)
+ {
+ if (raConfigProperties != null)
+ {
+ if (connectioDefProperties == null)
+ {
+ connectioDefProperties = raConfigProperties;
+ }
+ else
+ {
+ connectioDefProperties.addAll(raConfigProperties);
+ }
+ }
+ ResourceAdapter resourceadapter = new ResourceAdapter10Impl(managedconnectionfactoryClass,
+ connectionfactoryInterface,
+ connectionfactoryImplClass,
+ connectionInterface, connectionImplClass,
+ transactionSupport, authenticationMechanism,
+ connectioDefProperties,
+ reauthenticationSupport, securityPermissions,
+ id);
+
+ Connector newConnector = new Connector10Impl(moduleName, vendorName, eisType, resourceadapterVersion,
+ license, resourceadapter, description, displayNames, icons,
+ id);
+
+ return newConnector.merge(connector);
+ }
+ else
+ {
+ List<ConnectionDefinition> connectionDefinitions = new ArrayList<ConnectionDefinition>(1);
+ ConnectionDefinition connectionDefinition = new ConnectionDefinitionImpl(managedconnectionfactoryClass,
+ connectioDefProperties,
+ connectionfactoryInterface,
+ connectionfactoryImplClass,
+ connectionInterface,
+ connectionImplClass, id);
+ connectionDefinitions.add(connectionDefinition);
+ OutboundResourceAdapter outboundResourceadapter = new OutboundResourceAdapterImpl(
+ connectionDefinitions,
+ transactionSupport,
+ authenticationMechanism,
+ reauthenticationSupport,
+ id);
+ String resourceadapterClass = null;
+ InboundResourceAdapter inboundResourceadapter = null;
+ ResourceAdapter1516 resourceadapter = new ResourceAdapter1516Impl(resourceadapterClass,
+ raConfigProperties,
+ outboundResourceadapter,
+ inboundResourceadapter, adminobjects,
+ securityPermissions, id);
+
+ if (connector.getVersion() == Version.V_16)
+ {
+ List<String> requiredWorkContexts = null;
+ boolean metadataComplete = false;
+
+ Connector newConnector = new Connector16Impl(moduleName, vendorName, eisType, resourceadapterVersion,
+ license, resourceadapter, requiredWorkContexts,
+ metadataComplete, description, displayNames, icons, id);
+
+ return newConnector.merge(connector);
+ }
+ else if (connector.getVersion() == Version.V_15)
+ {
+ Connector newConnector = new Connector15Impl(vendorName, eisType, resourceadapterVersion, license,
+ resourceadapter, description, displayNames, icons, id);
+
+ return newConnector.merge(connector);
+ }
+ else
+ throw new IllegalArgumentException("version= " + connector.getVersion().name());
+ }
+
+ }
+
+ private List<? extends ConfigProperty> extractProperties(Connector connector)
+ {
+ List<? extends ConfigProperty> originalProperties = null;
+ if (connector.getVersion() == Version.V_10)
+ {
+ originalProperties = connector.getResourceadapter().getConfigProperties();
+ }
+ else
+ {
+
+ if (connector.getResourceadapter() != null &&
+ connector.getResourceadapter() instanceof ResourceAdapter1516)
+ {
+ ResourceAdapter1516 ra1516 = ((ResourceAdapter1516) connector.getResourceadapter());
+ if (ra1516.getOutboundResourceadapter() != null &&
+ ra1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
+ {
+ originalProperties = ra1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getConfigProperties();
+ }
+ }
+ }
+ return originalProperties;
+ }
+
+ private static List<ConfigProperty> createConfigProperties(CommonDataSource cds,
+ List<? extends ConfigProperty> originalProperties)
+ {
+ DataSource ds = null;
+ XaDataSource xads = null;
+ if (cds instanceof DataSource)
+ {
+ ds = (DataSource) cds;
+ }
+ if (cds instanceof XaDataSource)
+ {
+ xads = (XaDataSource) cds;
+ }
+ if (originalProperties != null)
+ {
+ List<ConfigProperty> configProperties = new ArrayList<ConfigProperty>(originalProperties.size());
+ for (ConfigProperty property : originalProperties)
+ {
+
+ ConfigPropertyFactory.Prototype prototype = ConfigPropertyFactory.Prototype.forName(property
+ .getConfigPropertyName().getValue());
+ switch (prototype)
+ {
+ case USERNAME : {
+ if (ds != null)
+ {
+ CommonSecurity security = ds.getSecurity();
+ if (security != null && security.getUserName() != null &&
+ !security.getUserName().trim().equals(""))
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ security.getUserName()));
+ }
+ }
+ break;
+ }
+
+ case PASSWORD : {
+ if (ds != null)
+ {
+ CommonSecurity security = ds.getSecurity();
+ if (security != null && security.getPassword() != null &&
+ !security.getPassword().trim().equals(""))
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ security.getPassword()));
+ }
+ }
+
+ break;
+ }
+
+ case XADATASOURCEPROPERTIES : {
+ if (xads != null && xads.getXaDataSourceProperty() != null)
+ {
+ StringBuffer valueBuf = new StringBuffer();
+ for (Entry<String, String> xaConfigProperty : xads.getXaDataSourceProperty().entrySet())
+ {
+ valueBuf.append(xaConfigProperty.getKey());
+ valueBuf.append("=");
+ valueBuf.append(xaConfigProperty.getValue());
+ valueBuf.append(";");
+ }
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ valueBuf.toString()));
+
+ }
+
+ break;
+ }
+
+ case URLDELIMITER : {
+ if (ds != null && ds.getUrlDelimiter() != null && !ds.getUrlDelimiter().trim().equals(""))
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ ds.getUrlDelimiter()));
+ }
+
+ break;
+ }
+
+ case URLSELECTORSTRATEGYCLASSNAME : {
+ if (ds != null && ds.getUrlSelectorStrategyClassName() != null &&
+ !ds.getUrlSelectorStrategyClassName().trim().equals(""))
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ ds.getUrlSelectorStrategyClassName()));
+ }
+
+ break;
+ }
+
+ case XADATASOURCECLASS : {
+ if (xads != null && xads.getXaDataSourceClass() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ xads.getXaDataSourceClass()));
+ }
+
+ break;
+ }
+
+ case TRANSACTIONISOLATION : {
+ if (ds != null && ds.getTransactionIsolation() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds
+ .getTransactionIsolation().name()));
+ }
+
+ break;
+ }
+
+ case PREPAREDSTATEMENTCACHESIZE : {
+ if (ds != null && ds.getStatement() != null &&
+ ds.getStatement().getPreparedStatementsCacheSize() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getStatement()
+ .getPreparedStatementsCacheSize()));
+ }
+
+ break;
+ }
+
+ case SHAREPREPAREDSTATEMENTS : {
+ if (ds != null && ds.getStatement() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ ds.getStatement() != null && ds.getStatement().isSharePreparedStatements()));
+ }
+
+ break;
+ }
+
+ case NEWCONNECTIONSQL : {
+ if (ds != null && ds.getNewConnectionSql() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ ds.getNewConnectionSql()));
+ }
+
+ break;
+ }
+
+ case CHECKVALIDCONNECTIONSQL : {
+ if (ds != null && ds.getValidation() != null &&
+ ds.getValidation().getCheckValidConnectionSql() != null &&
+ !ds.getValidation().getCheckValidConnectionSql().trim().equals(""))
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
+ .getCheckValidConnectionSql()));
+ }
+
+ break;
+ }
+
+ case VALIDCONNECTIONCHECKERCLASSNAME : {
+ if (ds != null && ds.getValidation() != null &&
+ ds.getValidation().getCheckValidConnectionSql() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
+ .getCheckValidConnectionSql()));
+ }
+
+ break;
+ }
+
+ case EXCEPTIONSORTERCLASSNAME : {
+ if (ds != null && ds.getValidation() != null &&
+ ds.getValidation().getExceptionSorterClassName() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
+ .getExceptionSorterClassName()));
+ }
+
+ break;
+ }
+
+ case STALECONNECTIONCHECKERCLASSNAME : {
+ if (ds != null && ds.getValidation() != null &&
+ ds.getValidation().getStaleConnectionCheckerClassName() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
+ .getStaleConnectionCheckerClassName()));
+ }
+
+ break;
+ }
+
+ case TRACKSTATEMENTS : {
+ if (ds != null && ds.getStatement() != null && ds.getStatement().getTrackStatements() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getStatement()
+ .getTrackStatements().name()));
+ }
+
+ break;
+ }
+
+ case VALIDATEONMATCH : {
+ if (ds != null && ds.getValidation() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
+ .isValidateOnMatch()));
+ }
+
+ break;
+ }
+
+ case TRANSACTIONQUERYTIMEOUT : {
+ if (ds != null && ds.getTimeOut() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getTimeOut()
+ .isSetTxQueryTimeout()));
+ }
+
+ break;
+ }
+
+ case QUERYTIMEOUT : {
+ if (ds != null && ds.getTimeOut() != null && ds.getTimeOut().getQueryTimeout() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getTimeOut()
+ .getQueryTimeout()));
+ }
+
+ break;
+ }
+
+ case USETRYLOCK : {
+ if (ds != null && ds.getTimeOut() != null && ds.getTimeOut().getUseTryLock() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getTimeOut()
+ .getUseTryLock()));
+ }
+
+ break;
+ }
+ case DRIVERCLASS : {
+ if (ds != null && ds.getDriverClass() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ ds.getDriverClass()));
+ }
+ break;
+ }
+ case URLPROPERTY :
+ case CONNECTIONPROPERTIES : {
+ if (ds != null && ds.getConnectionProperties() != null)
+ {
+ StringBuffer valueBuf = new StringBuffer();
+ for (Entry<String, String> connProperty : ds.getConnectionProperties().entrySet())
+ {
+ valueBuf.append(connProperty.getKey());
+ valueBuf.append("=");
+ valueBuf.append(connProperty.getValue());
+ valueBuf.append(";");
+ }
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ valueBuf.toString()));
+
+ }
+ break;
+ }
+ case CONNECTIONURL : {
+ if (ds != null && ds.getConnectionUrl() != null)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ ds.getConnectionUrl()));
+ }
+ break;
+ }
+ default :
+ break;
+ }
+ }
+ if (ds != null)
+ {
+ for (Entry<String, String> connectionProperty : ds.getConnectionProperties().entrySet())
+ {
+ ConfigPropertyFactory.Prototype prototype = ConfigPropertyFactory.Prototype
+ .forName(connectionProperty.getKey());
+ if (prototype != ConfigPropertyFactory.Prototype.UNKNOWN)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ connectionProperty.getValue()));
+ }
+ }
+ }
+ return configProperties;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ *
+ * A ConfigPropertyFactory.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+ protected static class ConfigPropertyFactory
+ {
+ /**
+ *
+ * create a config property from a prototype
+ *
+ * @param prototype prototype
+ * @param value value
+ * @return the property created
+ */
+ public static ConfigProperty createConfigProperty(Prototype prototype, String value)
+ {
+
+ return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(),
+ prototype.getLocalType(), new XsdString(value, null), null);
+ }
+
+ /**
+ *
+ * create a config property from a prototype
+ *
+ * @param prototype prototype
+ * @param value value
+ * @return the property created
+ */
+ public static ConfigProperty createConfigProperty(Prototype prototype, boolean value)
+ {
+
+ return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(),
+ prototype.getLocalType(), new XsdString(String.valueOf(value), null), null);
+ }
+
+ /**
+ *
+ * create a config property from a prototype
+ *
+ * @param prototype prototype
+ * @param value value
+ * @return the property created
+ */
+ public static ConfigProperty createConfigProperty(Prototype prototype, Number value)
+ {
+
+ return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(),
+ prototype.getLocalType(), new XsdString(String.valueOf(value), null), null);
+ }
+
+ /**
+ *
+ * A Prototype.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+ enum Prototype
+ {
+ /** UNKNOWN **/
+ UNKNOWN(null, null, null),
+ /** DRIVERCLASS **/
+ DRIVERCLASS("DriverClass", "java.lang.String", "The jdbc driver class."),
+ /** CONNECTIONURL **/
+ CONNECTIONURL("ConnectionURL", "java.lang.String", "The jdbc connection url class."),
+ /** CONNECTIONPROPERTIES **/
+ CONNECTIONPROPERTIES("ConnectionProperties", "java.lang.String",
+ "Connection properties for the database."),
+
+ /** USERNAME **/
+ USERNAME("UserName", "java.lang.String", "The default user name used to create JDBC connections."),
+ /** PASSWORD **/
+ PASSWORD("Password", "java.lang.String", "The default password used to create JDBC connections."),
+ /** XADATASOURCEPROPERTIES **/
+ XADATASOURCEPROPERTIES("XADataSourceProperties", "java.lang.String",
+ "The properties to set up the XA driver. These properties must be in the form "
+ + "name1=value1;name2=value2;...namen=valuen"),
+ /** URLDELIMITER **/
+ URLDELIMITER("URLDelimiter", "java.lang.String", "The jdbc connection url delimeter."),
+ /** URLPROPERTY **/
+ URLPROPERTY("URLProperty", "java.lang.String", "The property that contains the list of URLs."),
+ /** URLSELECTORSTRATEGYCLASSNAME **/
+ URLSELECTORSTRATEGYCLASSNAME("UrlSelectorStrategyClassName", "java.lang.String",
+ "The configurable URLSelectorStrategy class name."),
+ /** XADATASOURCECLASS **/
+ XADATASOURCECLASS("XADataSourceClass", "java.lang.String",
+ "The class name of the JDBC XA driver that handlesthis JDBC URL."),
+ /** TRANSACTIONISOLATION **/
+ TRANSACTIONISOLATION("TransactionIsolation", "java.lang.String",
+ "The transaction isolation for new connections. Not necessary: the driver default will be used "
+ + "if ommitted."),
+ /** PREPAREDSTATEMENTCACHESIZE **/
+ PREPAREDSTATEMENTCACHESIZE("PreparedStatementCacheSize", "java.lang.Integer",
+ "The number of cached prepared statements per connection."),
+ /** SHAREPREPAREDSTATEMENTS **/
+ SHAREPREPAREDSTATEMENTS("SharePreparedStatements", "java.lang.Boolean",
+ "Whether to share prepared statements."),
+ /** NEWCONNECTIONSQL **/
+ NEWCONNECTIONSQL("NewConnectionSQL", "java.lang.String",
+ "An SQL statement to be executed when a new connection is created as auxillary setup."),
+ /** CHECKVALIDCONNECTIONSQL **/
+ CHECKVALIDCONNECTIONSQL("CheckValidConnectionSQL", "java.lang.String",
+ "An SQL statement that may be executed when a managed connection is taken out of the pool and is "
+ + "about to be given to a client: the purpose is to verify that the connection still works."),
+ /** VALIDCONNECTIONCHECKERCLASSNAME **/
+ VALIDCONNECTIONCHECKERCLASSNAME("ValidConnectionCheckerClassName", "java.lang.String",
+ "The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.ValidConnectionChecker"
+ + " that can determine for a particular vender db when a connection is valid."),
+ /** EXCEPTIONSORTERCLASSNAME **/
+ EXCEPTIONSORTERCLASSNAME("ExceptionSorterClassName", "java.lang.String",
+ "The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.ExceptionSorter that"
+ + " can determine for a particular vender db which exceptions are "
+ + "fatal and mean a connection should be discarded."),
+ /** STALECONNECTIONCHECKERCLASSNAME **/
+ STALECONNECTIONCHECKERCLASSNAME("StaleConnectionCheckerClassName", "java.lang.String",
+ "The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.StaleConnectionChecker"
+ + " that can determine for a particular vender db when a connection is stale."),
+ /** TRACKSTATEMENTS **/
+ TRACKSTATEMENTS("TrackStatements", "java.lang.String",
+ "Whether to track unclosed statements - false/true/nowarn"),
+ /** VALIDATEONMATCH **/
+ VALIDATEONMATCH("ValidateOnMatch", "java.lang.Boolean",
+ "Whether to validate the connection on the ManagedConnectionFactory.matchManagedConnection method"),
+ /** TRANSACTIONQUERYTIMEOUT **/
+ TRANSACTIONQUERYTIMEOUT("TransactionQueryTimeout", "java.lang.Boolean",
+ "Whether to set the query timeout based on the transaction timeout"),
+ /** QUERYTIMEOUT **/
+ QUERYTIMEOUT("QueryTimeout", "java.lang.Integer", "A configured query timeout"),
+ /** USETRYLOCK **/
+ USETRYLOCK("UseTryLock", "java.lang.Integer", "Maximum wait for a lock");
+
+ private final XsdString localName;
+
+ private final XsdString localType;
+
+ private final ArrayList<LocalizedXsdString> description = new ArrayList<LocalizedXsdString>(1);
+
+ /**
+ * Create a new Prototype.
+ *
+ * @param name name
+ * @param type type
+ * @param description description
+ */
+ private Prototype(String name, String type, String description)
+ {
+ this.localName = new XsdString(name, null);
+ this.localType = new XsdString(type, null);;
+ this.description.add(new LocalizedXsdString(description, null));
+ }
+
+ /**
+ * Get the name.
+ *
+ * @return the name.
+ */
+ public final XsdString getLocalName()
+ {
+ return localName;
+ }
+
+ /**
+ * Get the type.
+ *
+ * @return the type.
+ */
+ public final XsdString getLocalType()
+ {
+ return localType;
+ }
+
+ /**
+ * Get the description.
+ *
+ * @return the description.
+ */
+ public final List<LocalizedXsdString> getDescription()
+ {
+ return description;
+ }
+
+ private static final Map<String, Prototype> MAP;
+
+ static
+ {
+ final Map<String, Prototype> map = new HashMap<String, Prototype>();
+ for (Prototype element : values())
+ {
+ final String name = element.getLocalName().getValue();
+ if (name != null)
+ map.put(name, element);
+ }
+ MAP = map;
+ }
+
+ /**
+ *
+ * Static method to get enum instance given localName XsdString
+ *
+ * @param localName a XsdString used as localname (typically tag name as defined in xsd)
+ * @return the enum instance
+ */
+ public static Prototype forName(String localName)
+ {
+ final Prototype element = MAP.get(localName);
+ return element == null ? UNKNOWN : element;
+ }
+ }
+
+ }
+}
Added: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/package.html
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/package.html (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/package.html 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,3 @@
+<body>
+This package contains Merge util classes for metadatas
+</body>
Added: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/AbstractResourceAdapetrImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/AbstractResourceAdapetrImpl.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/AbstractResourceAdapetrImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.metadata.ra.common;
+
+import org.jboss.jca.common.api.metadata.CopyableMetaData;
+import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
+import org.jboss.jca.common.api.metadata.ra.ResourceAdapter;
+import org.jboss.jca.common.api.validator.ValidateException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * A AbstractResourceAdapetrImpl.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public abstract class AbstractResourceAdapetrImpl implements ResourceAdapter
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 6284653702718994497L;
+
+ /** configProperties **/
+ protected ArrayList<ConfigProperty> configProperties;
+
+ /**
+ * Get the configProperties.
+ *
+ * @return the configProperties.
+ */
+ @Override
+ public synchronized List<? extends ConfigProperty> getConfigProperties()
+ {
+ return configProperties;
+ }
+
+ /**
+ *
+ * force configProperties with new content.
+ * This method is thread safe
+ *
+ * @param newContents the list of new properties
+ */
+ public synchronized void forceNewConfigPropertiesContent(List<? extends ConfigProperty> newContents)
+ {
+ if (newContents != null)
+ {
+ this.configProperties = new ArrayList<ConfigProperty>(newContents.size());
+ this.configProperties.addAll(newContents);
+ }
+ else
+ {
+ this.configProperties = new ArrayList<ConfigProperty>(0);
+ }
+ }
+
+ @Override
+ public abstract String getId();
+
+ @Override
+ public abstract void validate() throws ValidateException;
+
+ @Override
+ public abstract CopyableMetaData copy();
+
+}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/AdminObjectImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/AdminObjectImpl.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/AdminObjectImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -21,7 +21,6 @@
*/
package org.jboss.jca.common.metadata.ra.common;
-
import org.jboss.jca.common.api.metadata.CopyUtil;
import org.jboss.jca.common.api.metadata.CopyableMetaData;
import org.jboss.jca.common.api.metadata.ra.AdminObject;
@@ -46,7 +45,7 @@
private final XsdString adminobjectClass;
- private final ArrayList<ConfigProperty> configProperty;
+ private ArrayList<ConfigProperty> configProperties;
private final String id;
@@ -57,19 +56,19 @@
* @param id xmlid
*/
public AdminObjectImpl(final XsdString adminobjectInterface, final XsdString adminobjectClass,
- final List<? extends ConfigProperty> configProperty, final String id)
+ final List<? extends ConfigProperty> configProperty, final String id)
{
super();
this.adminobjectInterface = adminobjectInterface;
this.adminobjectClass = adminobjectClass;
if (configProperty != null)
{
- this.configProperty = new ArrayList<ConfigProperty>(configProperty.size());
- this.configProperty.addAll(configProperty);
+ this.configProperties = new ArrayList<ConfigProperty>(configProperty.size());
+ this.configProperties.addAll(configProperty);
}
else
{
- this.configProperty = new ArrayList<ConfigProperty>(0);
+ this.configProperties = new ArrayList<ConfigProperty>(0);
}
this.id = id;
}
@@ -96,11 +95,30 @@
* @return configProperty
*/
@Override
- public List<? extends ConfigProperty> getConfigProperties()
+ public synchronized List<? extends ConfigProperty> getConfigProperties()
{
- return configProperty == null ? null : Collections.unmodifiableList(configProperty);
+ return configProperties == null ? null : Collections.unmodifiableList(configProperties);
}
+ /**
+ *
+ * force configProperties with new content.
+ * This method is thread safe
+ *
+ * @param newContents the list of new properties
+ */
+ public synchronized void forceNewConfigPropertiesContent(List<? extends ConfigProperty> newContents)
+ {
+ if (newContents != null)
+ {
+ this.configProperties = new ArrayList<ConfigProperty>(newContents.size());
+ this.configProperties.addAll(newContents);
+ }
+ else
+ {
+ this.configProperties = new ArrayList<ConfigProperty>(0);
+ }
+ }
@Override
public String getId()
@@ -115,7 +133,7 @@
int result = 1;
result = prime * result + ((adminobjectClass == null) ? 0 : adminobjectClass.hashCode());
result = prime * result + ((adminobjectInterface == null) ? 0 : adminobjectInterface.hashCode());
- result = prime * result + ((configProperty == null) ? 0 : configProperty.hashCode());
+ result = prime * result + ((configProperties == null) ? 0 : configProperties.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@@ -144,12 +162,12 @@
}
else if (!adminobjectInterface.equals(other.adminobjectInterface))
return false;
- if (configProperty == null)
+ if (configProperties == null)
{
- if (other.configProperty != null)
+ if (other.configProperties != null)
return false;
}
- else if (!configProperty.equals(other.configProperty))
+ else if (!configProperties.equals(other.configProperties))
return false;
if (id == null)
{
@@ -169,15 +187,15 @@
@Override
public String toString()
{
- return "Adminobject [adminobjectInterface=" + adminobjectInterface + ", adminobjectClass=" + adminobjectClass
- + ", configProperty=" + configProperty + ", id=" + id + "]";
+ return "Adminobject [adminobjectInterface=" + adminobjectInterface + ", adminobjectClass=" +
+ adminobjectClass + ", configProperty=" + configProperties + ", id=" + id + "]";
}
@Override
public CopyableMetaData copy()
{
return new AdminObjectImpl(CopyUtil.clone(adminobjectInterface), CopyUtil.clone(adminobjectClass),
- CopyUtil.cloneList(configProperty), CopyUtil.cloneString(id));
+ CopyUtil.cloneList(configProperties), CopyUtil.cloneString(id));
}
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ConnectionDefinitionImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ConnectionDefinitionImpl.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ConnectionDefinitionImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -21,7 +21,6 @@
*/
package org.jboss.jca.common.metadata.ra.common;
-
import org.jboss.jca.common.api.metadata.CopyUtil;
import org.jboss.jca.common.api.metadata.CopyableMetaData;
import org.jboss.jca.common.api.metadata.MergeUtil;
@@ -46,7 +45,7 @@
private final XsdString managedconnectionfactoryClass;
- private final ArrayList<ConfigProperty> configProperty;
+ private ArrayList<ConfigProperty> configProperties;
private final XsdString connectionfactoryInterface;
@@ -68,21 +67,20 @@
* @param id XML ID
*/
public ConnectionDefinitionImpl(XsdString managedconnectionfactoryClass,
- List<? extends ConfigProperty> configProperty,
- XsdString connectionfactoryInterface, XsdString connectionfactoryImplClass, XsdString connectionInterface,
- XsdString connectionImplClass, String id)
+ List<? extends ConfigProperty> configProperty, XsdString connectionfactoryInterface,
+ XsdString connectionfactoryImplClass, XsdString connectionInterface, XsdString connectionImplClass, String id)
{
super();
this.managedconnectionfactoryClass = managedconnectionfactoryClass;
if (configProperty != null)
{
- this.configProperty = new ArrayList<ConfigProperty>(configProperty.size());
- this.configProperty.addAll(configProperty);
+ this.configProperties = new ArrayList<ConfigProperty>(configProperty.size());
+ this.configProperties.addAll(configProperty);
}
else
{
- this.configProperty = new ArrayList<ConfigProperty>(0);
+ this.configProperties = new ArrayList<ConfigProperty>(0);
}
this.connectionfactoryInterface = connectionfactoryInterface;
this.connectionfactoryImplClass = connectionfactoryImplClass;
@@ -104,12 +102,32 @@
* @return configProperty
*/
@Override
- public List<? extends ConfigProperty> getConfigProperties()
+ public synchronized List<? extends ConfigProperty> getConfigProperties()
{
- return configProperty == null ? null : Collections.unmodifiableList(configProperty);
+ return configProperties == null ? null : Collections.unmodifiableList(configProperties);
}
/**
+ *
+ * force configProperties with new content.
+ * This method is thread safe
+ *
+ * @param newContents the list of new properties
+ */
+ public synchronized void forceNewConfigPropertiesContent(List<? extends ConfigProperty> newContents)
+ {
+ if (newContents != null)
+ {
+ this.configProperties = new ArrayList<ConfigProperty>(newContents.size());
+ this.configProperties.addAll(newContents);
+ }
+ else
+ {
+ this.configProperties = new ArrayList<ConfigProperty>(0);
+ }
+ }
+
+ /**
* @return connectionfactoryInterface
*/
@Override
@@ -145,7 +163,6 @@
return connectionImplClass;
}
-
@Override
public String getId()
{
@@ -162,14 +179,14 @@
{
final int prime = 31;
int result = 1;
- result = prime * result + ((configProperty == null) ? 0 : configProperty.hashCode());
+ result = prime * result + ((configProperties == null) ? 0 : configProperties.hashCode());
result = prime * result + ((connectionImplClass == null) ? 0 : connectionImplClass.hashCode());
result = prime * result + ((connectionInterface == null) ? 0 : connectionInterface.hashCode());
result = prime * result + ((connectionfactoryImplClass == null) ? 0 : connectionfactoryImplClass.hashCode());
result = prime * result + ((connectionfactoryInterface == null) ? 0 : connectionfactoryInterface.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result
- + ((managedconnectionfactoryClass == null) ? 0 : managedconnectionfactoryClass.hashCode());
+ result = prime * result +
+ ((managedconnectionfactoryClass == null) ? 0 : managedconnectionfactoryClass.hashCode());
return result;
}
@@ -194,14 +211,14 @@
return false;
}
ConnectionDefinitionImpl other = (ConnectionDefinitionImpl) obj;
- if (configProperty == null)
+ if (configProperties == null)
{
- if (other.configProperty != null)
+ if (other.configProperties != null)
{
return false;
}
}
- else if (!configProperty.equals(other.configProperty))
+ else if (!configProperties.equals(other.configProperties))
{
return false;
}
@@ -282,10 +299,11 @@
@Override
public String toString()
{
- return "ConnectionDefinition [managedconnectionfactoryClass=" + managedconnectionfactoryClass
- + ", configProperty=" + configProperty + ", connectionfactoryInterface=" + connectionfactoryInterface
- + ", connectionfactoryImplClass=" + connectionfactoryImplClass + ", connectionInterface="
- + connectionInterface + ", connectionImplClass=" + connectionImplClass + ", id=" + id + "]";
+ return "ConnectionDefinition [managedconnectionfactoryClass=" + managedconnectionfactoryClass +
+ ", configProperty=" + configProperties + ", connectionfactoryInterface=" +
+ connectionfactoryInterface + ", connectionfactoryImplClass=" + connectionfactoryImplClass +
+ ", connectionInterface=" + connectionInterface + ", connectionImplClass=" + connectionImplClass +
+ ", id=" + id + "]";
}
@Override
@@ -295,27 +313,27 @@
{
ConnectionDefinitionImpl input = (ConnectionDefinitionImpl) jmd;
- List<? extends ConfigProperty> newConfigProperty = MergeUtil.mergeConfigList(this.configProperty,
- input.configProperty);
+ List<? extends ConfigProperty> newConfigProperty = MergeUtil.mergeConfigList(this.configProperties,
+ input.configProperties);
XsdString newManagedconnectionfactoryClass = this.managedconnectionfactoryClass == null
- ? input.managedconnectionfactoryClass
- : this.managedconnectionfactoryClass;
+ ? input.managedconnectionfactoryClass
+ : this.managedconnectionfactoryClass;
XsdString newConnectionInterface = this.connectionInterface == null
- ? input.connectionInterface
- : this.connectionInterface;
+ ? input.connectionInterface
+ : this.connectionInterface;
XsdString newConnectionfactoryImplClass = this.connectionfactoryImplClass == null
- ? input.connectionfactoryImplClass
- : this.connectionfactoryImplClass;
+ ? input.connectionfactoryImplClass
+ : this.connectionfactoryImplClass;
XsdString newConnectionfactoryInterface = this.connectionfactoryInterface == null
- ? input.connectionfactoryInterface
- : this.connectionfactoryInterface;
+ ? input.connectionfactoryInterface
+ : this.connectionfactoryInterface;
String newId = this.id == null ? input.id : this.id;
XsdString newConnectionImplClass = this.connectionImplClass == null
- ? input.connectionImplClass
- : this.connectionImplClass;
+ ? input.connectionImplClass
+ : this.connectionImplClass;
return new ConnectionDefinitionImpl(newManagedconnectionfactoryClass, newConfigProperty,
- newConnectionfactoryInterface, newConnectionfactoryImplClass, newConnectionInterface,
- newConnectionImplClass, newId);
+ newConnectionfactoryInterface, newConnectionfactoryImplClass,
+ newConnectionInterface, newConnectionImplClass, newId);
}
else
{
@@ -327,8 +345,10 @@
public CopyableMetaData copy()
{
return new ConnectionDefinitionImpl(CopyUtil.clone(managedconnectionfactoryClass),
- CopyUtil.cloneList(configProperty), CopyUtil.clone(connectionfactoryInterface),
- CopyUtil.clone(connectionfactoryImplClass), CopyUtil.clone(connectionInterface),
- CopyUtil.clone(connectionImplClass), CopyUtil.cloneString(id));
+ CopyUtil.cloneList(configProperties),
+ CopyUtil.clone(connectionfactoryInterface),
+ CopyUtil.clone(connectionfactoryImplClass),
+ CopyUtil.clone(connectionInterface),
+ CopyUtil.clone(connectionImplClass), CopyUtil.cloneString(id));
}
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/OutboundResourceAdapterImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/OutboundResourceAdapterImpl.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/OutboundResourceAdapterImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -44,9 +44,9 @@
*/
private static final long serialVersionUID = 421345307326415666L;
- private final ArrayList<ConnectionDefinition> connectionDefinition;
+ private ArrayList<ConnectionDefinition> connectionDefinition;
- private final TransactionSupportEnum transactionSupport;
+ private TransactionSupportEnum transactionSupport;
private final ArrayList<AuthenticationMechanism> authenticationMechanism;
@@ -62,8 +62,8 @@
* @param id XML ID
*/
public OutboundResourceAdapterImpl(List<ConnectionDefinition> connectionDefinition,
- TransactionSupportEnum transactionSupport, List<AuthenticationMechanism> authenticationMechanism,
- boolean reauthenticationSupport, String id)
+ TransactionSupportEnum transactionSupport, List<AuthenticationMechanism> authenticationMechanism,
+ boolean reauthenticationSupport, String id)
{
super();
if (connectionDefinition != null)
@@ -93,21 +93,53 @@
* @return connectionDefinition
*/
@Override
- public List<ConnectionDefinition> getConnectionDefinitions()
+ public synchronized List<ConnectionDefinition> getConnectionDefinitions()
{
return connectionDefinition == null ? null : Collections.unmodifiableList(connectionDefinition);
}
/**
+ *
+ * force connectionDefinition with new content.
+ * This method is thread safe
+ *
+ * @param newContent the list of new properties
+ */
+ public synchronized void forceConnectionDefinitionsContent(List<ConnectionDefinition> newContent)
+ {
+ if (newContent != null)
+ {
+ this.connectionDefinition = new ArrayList<ConnectionDefinition>(newContent.size());
+ this.connectionDefinition.addAll(newContent);
+ }
+ else
+ {
+ this.connectionDefinition = new ArrayList<ConnectionDefinition>(0);
+ }
+ }
+
+ /**
* @return transactionSupport
*/
@Override
- public TransactionSupportEnum getTransactionSupport()
+ public synchronized TransactionSupportEnum getTransactionSupport()
{
return transactionSupport;
}
/**
+ *
+ * force transactionSupport to the new value
+ * This method is thread safe
+ *
+ * @param newTransactionSupport the new value
+ */
+ public synchronized void forceNewTrasactionSupport(TransactionSupportEnum newTransactionSupport)
+ {
+ this.transactionSupport = newTransactionSupport;
+ }
+
+ /**
* @return authenticationMechanism
*/
@Override
@@ -221,9 +253,9 @@
@Override
public String toString()
{
- return "OutboundResourceAdapter [connectionDefinition=" + connectionDefinition + ", transactionSupport="
- + transactionSupport + ", authenticationMechanism=" + authenticationMechanism
- + ", reauthenticationSupport=" + reauthenticationSupport + ", id=" + id + "]";
+ return "OutboundResourceAdapter [connectionDefinition=" + connectionDefinition + ", transactionSupport=" +
+ transactionSupport + ", authenticationMechanism=" + authenticationMechanism +
+ ", reauthenticationSupport=" + reauthenticationSupport + ", id=" + id + "]";
}
/**
@@ -238,9 +270,9 @@
if (this.getConnectionDefinitions() == null || this.getConnectionDefinitions().size() == 0)
return false;
ConnectionDefinition cdm = this.getConnectionDefinitions().get(0);
- if (cdm.getManagedConnectionFactoryClass() == null || cdm.getConnectionFactoryInterface() == null
- || cdm.getConnectionFactoryImplClass() == null || cdm.getConnectionInterface() == null
- || cdm.getConnectionImplClass() == null)
+ if (cdm.getManagedConnectionFactoryClass() == null || cdm.getConnectionFactoryInterface() == null ||
+ cdm.getConnectionFactoryImplClass() == null || cdm.getConnectionInterface() == null ||
+ cdm.getConnectionImplClass() == null)
return false;
return true;
@@ -255,36 +287,37 @@
String newId = this.id == null ? input.id : this.id;
- List<ConnectionDefinition> newConnectionDefinition = new ArrayList<ConnectionDefinition>(
- this.connectionDefinition.size());
+ List<ConnectionDefinition> newConnDef = new ArrayList<ConnectionDefinition>(
+ this.connectionDefinition
+ .size());
- newConnectionDefinition.addAll(this.connectionDefinition);
+ newConnDef.addAll(this.connectionDefinition);
for (ConnectionDefinition rcd : input.connectionDefinition)
{
boolean isNew = true;
for (ConnectionDefinition lcd : this.connectionDefinition)
{
- if (lcd.getManagedConnectionFactoryClass() == null
- || rcd.getManagedConnectionFactoryClass().equals(lcd.getManagedConnectionFactoryClass()))
+ if (lcd.getManagedConnectionFactoryClass() == null ||
+ rcd.getManagedConnectionFactoryClass().equals(lcd.getManagedConnectionFactoryClass()))
{
- newConnectionDefinition.remove(lcd);
- newConnectionDefinition.add(lcd.merge(rcd));
+ newConnDef.remove(lcd);
+ newConnDef.add(lcd.merge(rcd));
isNew = false;
}
}
- if (isNew) newConnectionDefinition.add(rcd);
+ if (isNew)
+ newConnDef.add(rcd);
}
TransactionSupportEnum newTransactionSupport = this.transactionSupport == null
- ? input.transactionSupport
- : this.transactionSupport;
+ ? input.transactionSupport
+ : this.transactionSupport;
boolean newReauthenticationSupport = this.reauthenticationSupport || input.reauthenticationSupport;
List<AuthenticationMechanism> newAuthenticationMechanism = MergeUtil.mergeList(
- this.authenticationMechanism,
- input.authenticationMechanism);
- return new OutboundResourceAdapterImpl(newConnectionDefinition, newTransactionSupport,
- newAuthenticationMechanism, newReauthenticationSupport, newId);
+ this.authenticationMechanism, input.authenticationMechanism);
+ return new OutboundResourceAdapterImpl(newConnDef, newTransactionSupport, newAuthenticationMechanism,
+ newReauthenticationSupport, newId);
}
else
{
@@ -296,6 +329,7 @@
public CopyableMetaData copy()
{
return new OutboundResourceAdapterImpl(CopyUtil.cloneList(connectionDefinition), transactionSupport,
- CopyUtil.cloneList(authenticationMechanism), reauthenticationSupport, CopyUtil.cloneString(id));
+ CopyUtil.cloneList(authenticationMechanism), reauthenticationSupport,
+ CopyUtil.cloneString(id));
}
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ResourceAdapter1516Impl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ResourceAdapter1516Impl.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ResourceAdapter1516Impl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -41,7 +41,7 @@
* @author <a href="mailto:stefano.maestri at jboss.org">Stefano Maestri</a>
*
*/
-public class ResourceAdapter1516Impl implements ResourceAdapter1516
+public class ResourceAdapter1516Impl extends AbstractResourceAdapetrImpl implements ResourceAdapter1516
{
/**
*/
@@ -49,13 +49,11 @@
private final String resourceadapterClass;
- private final ArrayList<ConfigProperty> configProperties;
-
private final OutboundResourceAdapter outboundResourceadapter;
private final InboundResourceAdapter inboundResourceadapter;
- private final ArrayList<AdminObject> adminobjects;
+ private ArrayList<AdminObject> adminobjects;
private final ArrayList<SecurityPermission> securityPermissions;
@@ -71,8 +69,8 @@
* @param id XML ID
*/
public ResourceAdapter1516Impl(String resourceadapterClass, List<? extends ConfigProperty> configProperties,
- OutboundResourceAdapter outboundResourceadapter, InboundResourceAdapter inboundResourceadapter,
- List<AdminObject> adminobjects, List<SecurityPermission> securityPermissions, String id)
+ OutboundResourceAdapter outboundResourceadapter, InboundResourceAdapter inboundResourceadapter,
+ List<AdminObject> adminobjects, List<SecurityPermission> securityPermissions, String id)
{
super();
this.resourceadapterClass = resourceadapterClass;
@@ -118,15 +116,6 @@
}
/**
- * @return configProperty
- */
- @Override
- public List<? extends ConfigProperty> getConfigProperties()
- {
- return configProperties == null ? null : Collections.unmodifiableList(configProperties);
- }
-
- /**
* @return outboundResourceadapter
*/
@Override
@@ -148,12 +137,32 @@
* @return adminobject
*/
@Override
- public List<AdminObject> getAdminObjects()
+ public synchronized List<AdminObject> getAdminObjects()
{
return adminobjects == null ? null : Collections.unmodifiableList(adminobjects);
}
/**
+ *
+ * force adminobjects with new content.
+ * This method is thread safe
+ *
+ * @param newContent the list of new properties
+ */
+ public synchronized void forceAdminObjectsContent(List<AdminObject> newContent)
+ {
+ if (newContent != null)
+ {
+ this.adminobjects = new ArrayList<AdminObject>(newContent.size());
+ this.adminobjects.addAll(adminobjects);
+ }
+ else
+ {
+ this.adminobjects = new ArrayList<AdminObject>(0);
+ }
+ }
+
+ /**
* @return securityPermission
*/
@Override
@@ -253,10 +262,10 @@
@Override
public String toString()
{
- return "ResourceAdapter [resourceadapterClass=" + resourceadapterClass + ", configProperties=" + configProperties
- + ", outboundResourceadapter=" + outboundResourceadapter + ", inboundResourceadapter="
- + inboundResourceadapter + ", adminobjects=" + adminobjects + ", securityPermission=" + securityPermissions
- + ", id=" + id + "]";
+ return "ResourceAdapter [resourceadapterClass=" + resourceadapterClass + ", configProperties=" +
+ configProperties + ", outboundResourceadapter=" + outboundResourceadapter +
+ ", inboundResourceadapter=" + inboundResourceadapter + ", adminobjects=" + adminobjects +
+ ", securityPermission=" + securityPermissions + ", id=" + id + "]";
}
@Override
@@ -265,8 +274,8 @@
boolean inboundOrOutbound = false;
if (this.getOutboundResourceadapter() != null && this.getOutboundResourceadapter().validationAsBoolean())
inboundOrOutbound = true;
- if (this.getInboundResourceadapter() != null && this.getInboundResourceadapter().validationAsBoolean()
- && this.getResourceadapterClass() != null)
+ if (this.getInboundResourceadapter() != null && this.getInboundResourceadapter().validationAsBoolean() &&
+ this.getResourceadapterClass() != null)
inboundOrOutbound = true;
if (!inboundOrOutbound)
throw new ValidateException("ResourceAdapter metadata should contains inbound or outbound at least");
@@ -281,26 +290,24 @@
ResourceAdapter1516Impl inputRA = (ResourceAdapter1516Impl) jmd;
InboundResourceAdapter newInboundResourceadapter = this.inboundResourceadapter == null
- ? inputRA.inboundResourceadapter
- : this.inboundResourceadapter
- .merge(inputRA.inboundResourceadapter);
+ ? inputRA.inboundResourceadapter
+ : this.inboundResourceadapter.merge(inputRA.inboundResourceadapter);
OutboundResourceAdapter newOutboundResourceadapter = this.outboundResourceadapter == null
- ? inputRA.outboundResourceadapter
- : this.outboundResourceadapter
- .merge(inputRA.outboundResourceadapter);
+ ? inputRA.outboundResourceadapter
+ : this.outboundResourceadapter.merge(inputRA.outboundResourceadapter);
List<SecurityPermission> newSecurityPermission = MergeUtil.mergeList(this.securityPermissions,
- inputRA.securityPermissions);
- List<? extends ConfigProperty> newConfigProperties = MergeUtil.mergeConfigList(
- this.configProperties,
- inputRA.configProperties);
+ inputRA.securityPermissions);
+ List<? extends ConfigProperty> newConfigProperties = MergeUtil.mergeConfigList(this.configProperties,
+ inputRA.configProperties);
List<AdminObject> newAdminobjects = MergeUtil.mergeList(this.adminobjects, inputRA.adminobjects);
String newId = this.id == null ? inputRA.id : this.id;
String newResourceadapterClass = this.resourceadapterClass == null
- ? inputRA.resourceadapterClass
- : this.resourceadapterClass;
- return new ResourceAdapter1516Impl(newResourceadapterClass, newConfigProperties, newOutboundResourceadapter,
- newInboundResourceadapter, newAdminobjects, newSecurityPermission, newId);
+ ? inputRA.resourceadapterClass
+ : this.resourceadapterClass;
+ return new ResourceAdapter1516Impl(newResourceadapterClass, newConfigProperties,
+ newOutboundResourceadapter, newInboundResourceadapter,
+ newAdminobjects, newSecurityPermission, newId);
}
else
{
@@ -312,9 +319,10 @@
public CopyableMetaData copy()
{
return new ResourceAdapter1516Impl(CopyUtil.cloneString(resourceadapterClass),
- CopyUtil.cloneList(configProperties), CopyUtil.clone(outboundResourceadapter),
- CopyUtil.clone(inboundResourceadapter), CopyUtil.cloneList(adminobjects),
- CopyUtil.cloneList(securityPermissions), CopyUtil.cloneString(id));
+ CopyUtil.cloneList(configProperties),
+ CopyUtil.clone(outboundResourceadapter),
+ CopyUtil.clone(inboundResourceadapter), CopyUtil.cloneList(adminobjects),
+ CopyUtil.cloneList(securityPermissions), CopyUtil.cloneString(id));
}
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/ra10/ResourceAdapter10Impl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/ra10/ResourceAdapter10Impl.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/ra10/ResourceAdapter10Impl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -32,6 +32,7 @@
import org.jboss.jca.common.api.metadata.ra.XsdString;
import org.jboss.jca.common.api.metadata.ra.ra10.ResourceAdapter10;
import org.jboss.jca.common.api.validator.ValidateException;
+import org.jboss.jca.common.metadata.ra.common.AbstractResourceAdapetrImpl;
import java.util.ArrayList;
import java.util.Collections;
@@ -41,7 +42,7 @@
* @author <a href="mailto:stefano.maestri at jboss.org">Stefano Maestri</a>
*
*/
-public class ResourceAdapter10Impl implements ResourceAdapter10
+public class ResourceAdapter10Impl extends AbstractResourceAdapetrImpl implements ResourceAdapter10
{
/** The serialVersionUID */
@@ -57,12 +58,10 @@
private final XsdString connectionImplClass;
- private final TransactionSupportEnum transactionSupport;
+ private TransactionSupportEnum transactionSupport;
private final ArrayList<AuthenticationMechanism> authenticationMechanism;
- private final ArrayList<ConfigProperty> configProperties;
-
private final Boolean reauthenticationSupport;
private final ArrayList<SecurityPermission> securityPermissions;
@@ -190,31 +189,32 @@
* @return the transactionSupport.
*/
@Override
- public TransactionSupportEnum getTransactionSupport()
+ public synchronized TransactionSupportEnum getTransactionSupport()
{
return transactionSupport;
}
/**
- * Get the authenticationMechanism.
*
- * @return the authenticationMechanism.
+ * force transactionSupport to the new value
+ * This method is thread safe
+ *
+ * @param newTransactionSupport the new value
*/
- @Override
- public List<AuthenticationMechanism> getAuthenticationMechanisms()
+ public synchronized void forceNewTrasactionSupport(TransactionSupportEnum newTransactionSupport)
{
- return authenticationMechanism == null ? null : Collections.unmodifiableList(authenticationMechanism);
+ this.transactionSupport = newTransactionSupport;
}
/**
- * Get the configProperties.
+ * Get the authenticationMechanism.
*
- * @return the configProperties.
+ * @return the authenticationMechanism.
*/
@Override
- public List<ConfigProperty> getConfigProperties()
+ public List<AuthenticationMechanism> getAuthenticationMechanisms()
{
- return configProperties;
+ return authenticationMechanism == null ? null : Collections.unmodifiableList(authenticationMechanism);
}
/**
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterImpl.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterImpl.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -21,8 +21,8 @@
*/
package org.jboss.jca.common.metadata.resourceadapter;
-import org.jboss.jca.common.api.metadata.common.AdminObject;
-import org.jboss.jca.common.api.metadata.common.ConnectionDefinition;
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
+import org.jboss.jca.common.api.metadata.common.CommonConnDef;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
import org.jboss.jca.common.api.metadata.resourceadapter.ResourceAdapter;
import org.jboss.jca.common.metadata.common.CommonIronJacamarImpl;
@@ -55,7 +55,7 @@
* @param bootstrapContext bootstrapContext
*/
public ResourceAdapterImpl(String archive, TransactionSupportEnum transactionSupport,
- List<ConnectionDefinition> connectionDefinitions, List<AdminObject> adminObjects,
+ List<CommonConnDef> connectionDefinitions, List<CommonAdminObject> adminObjects,
Map<String, String> configProperties, List<String> beanValidationGroups, String bootstrapContext)
{
super(transactionSupport, configProperties, adminObjects, connectionDefinitions, beanValidationGroups,
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParser.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParser.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -21,8 +21,8 @@
*/
package org.jboss.jca.common.metadata.resourceadapter;
-import org.jboss.jca.common.api.metadata.common.AdminObject;
-import org.jboss.jca.common.api.metadata.common.ConnectionDefinition;
+import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
+import org.jboss.jca.common.api.metadata.common.CommonConnDef;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
import org.jboss.jca.common.api.metadata.resourceadapter.ResourceAdapter;
import org.jboss.jca.common.api.metadata.resourceadapter.ResourceAdapters;
@@ -150,8 +150,8 @@
private ResourceAdapter parseResourceAdapter(XMLStreamReader reader) throws XMLStreamException, ParserException
{
- ArrayList<ConnectionDefinition> connectionDefinitions = new ArrayList<ConnectionDefinition>();
- ArrayList<AdminObject> adminObjects = new ArrayList<AdminObject>();
+ ArrayList<CommonConnDef> connectionDefinitions = new ArrayList<CommonConnDef>();
+ ArrayList<CommonAdminObject> adminObjects = new ArrayList<CommonAdminObject>();
ArrayList<String> beanValidationGroups = new ArrayList<String>();
String bootstrapContext = null;
String archive = null;
Deleted: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/MetadataFactoryTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/MetadataFactoryTestCase.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/MetadataFactoryTestCase.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -1,262 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.common.metadata;
-
-import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
-import org.jboss.jca.common.api.metadata.ds.DataSources;
-import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
-import org.jboss.jca.common.api.metadata.ra.Connector;
-import org.jboss.jca.common.api.metadata.ra.Connector.Version;
-import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
-import org.jboss.jca.common.api.metadata.ra.XsdString;
-import org.jboss.jca.common.api.metadata.ra.ra15.Connector15;
-import org.jboss.jca.common.metadata.ds.DsParser;
-import org.jboss.jca.common.metadata.ra.RaParser;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.List;
-
-import org.junit.Test;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.hamcrest.core.IsInstanceOf.instanceOf;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItem;
-
-/**
- *
- * A RaParserTestCase.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
-public class MetadataFactoryTestCase
-{
- /**
- * shouldMergeDsAndConnector
- * @throws Exception in case of error
- */
- @SuppressWarnings("unchecked")
- @Test
- public void shouldMergeDsAndConnector() throws Exception
- {
-
- FileInputStream is = null;
- try
- {
- //given
- File xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("adapters/ra.xml")
- .toURI());
- is = new FileInputStream(xmlFile);
- RaParser parser = new RaParser();
- Connector connector = parser.parse(is);
- is.close();
- xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("ds/postgres-ds.xml")
- .toURI());
- is = new FileInputStream(xmlFile);
- DsParser dsparser = new DsParser();
- //when
- DataSources ds = dsparser.parse(is);
-
- List<? extends ConfigProperty> properties = null;
- ResourceAdapter1516 resourceAdapter1516 = (ResourceAdapter1516) connector.getResourceadapter();
- if (connector.getResourceadapter() != null &&
- connector.getResourceadapter() instanceof ResourceAdapter1516 &&
- resourceAdapter1516.getOutboundResourceadapter() != null &&
- resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
- {
- properties = resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
- .getConfigProperties();
- }
-
- //verify pre-condition
- assertThat(resourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
- is(TransactionSupportEnum.LocalTransaction));
- assertThat(
- resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
- .getManagedConnectionFactoryClass(),
- equalTo(new XsdString("org.jboss.jca.adapters.jdbc.local." + "LocalManagedConnectionFactory", null)));
-
- //when
- MetadataFactory mf = new MetadataFactory();
- Connector merged = mf.mergeConnectorAndDs(ds.getDataSource().get(0), connector);
- //then
- assertThat(merged, instanceOf(Connector15.class));
- assertThat(merged.getVersion(), is(Version.V_15));
-
- List<? extends ConfigProperty> mergedProperties = null;
-
- ResourceAdapter1516 mergedResourceAdapter1516 = (ResourceAdapter1516) merged.getResourceadapter();
- if (connector.getResourceadapter() != null &&
- connector.getResourceadapter() instanceof ResourceAdapter1516 &&
- resourceAdapter1516.getOutboundResourceadapter() != null &&
- resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
- {
- mergedProperties = mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions()
- .get(0).getConfigProperties();
- }
- //then merged properties are presents
- assertThat((List<ConfigProperty>) mergedProperties,
- hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
- MetadataFactory.ConfigPropertyFactory.Prototype.USERNAME, "x")));
- assertThat((List<ConfigProperty>) mergedProperties,
- hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
- MetadataFactory.ConfigPropertyFactory.Prototype.PASSWORD, "y")));
- assertThat((List<ConfigProperty>) mergedProperties,
- hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
- MetadataFactory.ConfigPropertyFactory.Prototype.CONNECTIONURL,
- "jdbc:postgresql://[servername]:[port]/[database name]")));
- assertThat((List<ConfigProperty>) mergedProperties,
- hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
- MetadataFactory.ConfigPropertyFactory.Prototype.DRIVERCLASS, "org.postgresql.Driver")));
-
- //then metadata read from ra.xml still present (not deleted by merge)
- assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
- is(TransactionSupportEnum.LocalTransaction));
- assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
- .getManagedConnectionFactoryClass(),
- equalTo(new XsdString("org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory", null)));
-
- //then it have empty property for not set ones
- assertThat((List<ConfigProperty>) mergedProperties,
- not(hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
- MetadataFactory.ConfigPropertyFactory.Prototype.PREPAREDSTATEMENTCACHESIZE, ""))));
-
- //then it does not contain property not in ra.xml
- assertThat((List<ConfigProperty>) mergedProperties,
- not(hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
- MetadataFactory.ConfigPropertyFactory.Prototype.XADATASOURCEPROPERTIES, ""))));
-
- }
- finally
- {
- if (is != null)
- is.close();
- }
-
- }
-
- /**
- * shouldMergeXaDsAndConnector
- * @throws Exception in case of error
- */
- @SuppressWarnings("unchecked")
- @Test
- public void shouldMergeXaDsAndConnector() throws Exception
- {
-
- FileInputStream is = null;
- try
- {
- //given
- File xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("adapters/ra-xa.xml")
- .toURI());
- is = new FileInputStream(xmlFile);
- RaParser parser = new RaParser();
- Connector connector = parser.parse(is);
- is.close();
- xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("ds/postgres-xa-ds.xml")
- .toURI());
- is = new FileInputStream(xmlFile);
- DsParser dsparser = new DsParser();
- //when
- DataSources ds = dsparser.parse(is);
-
- List<? extends ConfigProperty> properties = null;
- ResourceAdapter1516 resourceAdapter1516 = (ResourceAdapter1516) connector.getResourceadapter();
- if (connector.getResourceadapter() != null &&
- connector.getResourceadapter() instanceof ResourceAdapter1516 &&
- resourceAdapter1516.getOutboundResourceadapter() != null &&
- resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
- {
- properties = resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
- .getConfigProperties();
- }
-
- //verify pre-condition
- assertThat(resourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
- is(TransactionSupportEnum.XATransaction));
- assertThat(resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
- .getManagedConnectionFactoryClass(),
- equalTo(new XsdString("org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory", null)));
-
- //when
- MetadataFactory mf = new MetadataFactory();
- Connector merged = mf.mergeConnectorAndDs(ds.getXaDataSource().get(0), connector);
- //then
- assertThat(merged, instanceOf(Connector15.class));
- assertThat(merged.getVersion(), is(Version.V_15));
-
- List<? extends ConfigProperty> mergedProperties = null;
-
- ResourceAdapter1516 mergedResourceAdapter1516 = (ResourceAdapter1516) merged.getResourceadapter();
- if (connector.getResourceadapter() != null &&
- connector.getResourceadapter() instanceof ResourceAdapter1516 &&
- resourceAdapter1516.getOutboundResourceadapter() != null &&
- resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
- {
- mergedProperties = mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions()
- .get(0).getConfigProperties();
- }
-
- //then merged properties are presents
-
- assertThat((List<ConfigProperty>) mergedProperties,
- hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
- MetadataFactory.ConfigPropertyFactory.Prototype.XADATASOURCEPROPERTIES,
- "DatabaseName=database_name;User=user;ServerName=server_name;PortNumber=5432;"
- + "Password=password;")));
-
- assertThat((List<ConfigProperty>) mergedProperties,
- hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
- MetadataFactory.ConfigPropertyFactory.Prototype.XADATASOURCECLASS,
- "org.postgresql.xa.PGXADataSource")));
-
- //then metadata read from ra.xml still present (not deleted by merge)
- assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
- is(TransactionSupportEnum.XATransaction));
- assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
- .getManagedConnectionFactoryClass(),
- equalTo(new XsdString("org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory", null)));
-
- //then it have empty property for not set ones
- assertThat((List<ConfigProperty>) mergedProperties,
- not(hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
- MetadataFactory.ConfigPropertyFactory.Prototype.PREPAREDSTATEMENTCACHESIZE, ""))));
-
- //then it does not contain property not in ra.xml
- assertThat((List<ConfigProperty>) mergedProperties,
- not(hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
- MetadataFactory.ConfigPropertyFactory.Prototype.CONNECTIONURL, ""))));
-
- }
- finally
- {
- if (is != null)
- is.close();
- }
-
- }
-}
Copied: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/MergerTestCase.java (from rev 108139, projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/MetadataFactoryTestCase.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/MergerTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/MergerTestCase.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,262 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.metadata.merge;
+
+import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
+import org.jboss.jca.common.api.metadata.ds.DataSources;
+import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
+import org.jboss.jca.common.api.metadata.ra.Connector;
+import org.jboss.jca.common.api.metadata.ra.Connector.Version;
+import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
+import org.jboss.jca.common.api.metadata.ra.XsdString;
+import org.jboss.jca.common.api.metadata.ra.ra15.Connector15;
+import org.jboss.jca.common.metadata.ds.DsParser;
+import org.jboss.jca.common.metadata.ra.RaParser;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.List;
+
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.assertThat;
+import static org.junit.matchers.JUnitMatchers.hasItem;
+
+/**
+ *
+ * A RaParserTestCase.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class MergerTestCase
+{
+ /**
+ * shouldMergeDsAndConnector
+ * @throws Exception in case of error
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public void shouldMergeDsAndConnector() throws Exception
+ {
+
+ FileInputStream is = null;
+ try
+ {
+ //given
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("adapters/ra.xml")
+ .toURI());
+ is = new FileInputStream(xmlFile);
+ RaParser parser = new RaParser();
+ Connector connector = parser.parse(is);
+ is.close();
+ xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("ds/postgres-ds.xml")
+ .toURI());
+ is = new FileInputStream(xmlFile);
+ DsParser dsparser = new DsParser();
+ //when
+ DataSources ds = dsparser.parse(is);
+
+ List<? extends ConfigProperty> properties = null;
+ ResourceAdapter1516 resourceAdapter1516 = (ResourceAdapter1516) connector.getResourceadapter();
+ if (connector.getResourceadapter() != null &&
+ connector.getResourceadapter() instanceof ResourceAdapter1516 &&
+ resourceAdapter1516.getOutboundResourceadapter() != null &&
+ resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
+ {
+ properties = resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getConfigProperties();
+ }
+
+ //verify pre-condition
+ assertThat(resourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
+ is(TransactionSupportEnum.LocalTransaction));
+ assertThat(
+ resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getManagedConnectionFactoryClass(),
+ equalTo(new XsdString("org.jboss.jca.adapters.jdbc.local." + "LocalManagedConnectionFactory", null)));
+
+ //when
+ Merger m = new Merger();
+ Connector merged = m.mergeConnectorAndDs(ds.getDataSource().get(0), connector);
+ //then
+ assertThat(merged, instanceOf(Connector15.class));
+ assertThat(merged.getVersion(), is(Version.V_15));
+
+ List<? extends ConfigProperty> mergedProperties = null;
+
+ ResourceAdapter1516 mergedResourceAdapter1516 = (ResourceAdapter1516) merged.getResourceadapter();
+ if (connector.getResourceadapter() != null &&
+ connector.getResourceadapter() instanceof ResourceAdapter1516 &&
+ resourceAdapter1516.getOutboundResourceadapter() != null &&
+ resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
+ {
+ mergedProperties = mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions()
+ .get(0).getConfigProperties();
+ }
+ //then merged properties are presents
+ assertThat((List<ConfigProperty>) mergedProperties,
+ hasItem(Merger.ConfigPropertyFactory.createConfigProperty(
+ Merger.ConfigPropertyFactory.Prototype.USERNAME, "x")));
+ assertThat((List<ConfigProperty>) mergedProperties,
+ hasItem(Merger.ConfigPropertyFactory.createConfigProperty(
+ Merger.ConfigPropertyFactory.Prototype.PASSWORD, "y")));
+ assertThat((List<ConfigProperty>) mergedProperties,
+ hasItem(Merger.ConfigPropertyFactory.createConfigProperty(
+ Merger.ConfigPropertyFactory.Prototype.CONNECTIONURL,
+ "jdbc:postgresql://[servername]:[port]/[database name]")));
+ assertThat((List<ConfigProperty>) mergedProperties,
+ hasItem(Merger.ConfigPropertyFactory.createConfigProperty(
+ Merger.ConfigPropertyFactory.Prototype.DRIVERCLASS, "org.postgresql.Driver")));
+
+ //then metadata read from ra.xml still present (not deleted by merge)
+ assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
+ is(TransactionSupportEnum.LocalTransaction));
+ assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getManagedConnectionFactoryClass(),
+ equalTo(new XsdString("org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory", null)));
+
+ //then it have empty property for not set ones
+ assertThat((List<ConfigProperty>) mergedProperties,
+ not(hasItem(Merger.ConfigPropertyFactory.createConfigProperty(
+ Merger.ConfigPropertyFactory.Prototype.PREPAREDSTATEMENTCACHESIZE, ""))));
+
+ //then it does not contain property not in ra.xml
+ assertThat((List<ConfigProperty>) mergedProperties,
+ not(hasItem(Merger.ConfigPropertyFactory.createConfigProperty(
+ Merger.ConfigPropertyFactory.Prototype.XADATASOURCEPROPERTIES, ""))));
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+
+ }
+
+ /**
+ * shouldMergeXaDsAndConnector
+ * @throws Exception in case of error
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public void shouldMergeXaDsAndConnector() throws Exception
+ {
+
+ FileInputStream is = null;
+ try
+ {
+ //given
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("adapters/ra-xa.xml")
+ .toURI());
+ is = new FileInputStream(xmlFile);
+ RaParser parser = new RaParser();
+ Connector connector = parser.parse(is);
+ is.close();
+ xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("ds/postgres-xa-ds.xml")
+ .toURI());
+ is = new FileInputStream(xmlFile);
+ DsParser dsparser = new DsParser();
+ //when
+ DataSources ds = dsparser.parse(is);
+
+ List<? extends ConfigProperty> properties = null;
+ ResourceAdapter1516 resourceAdapter1516 = (ResourceAdapter1516) connector.getResourceadapter();
+ if (connector.getResourceadapter() != null &&
+ connector.getResourceadapter() instanceof ResourceAdapter1516 &&
+ resourceAdapter1516.getOutboundResourceadapter() != null &&
+ resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
+ {
+ properties = resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getConfigProperties();
+ }
+
+ //verify pre-condition
+ assertThat(resourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
+ is(TransactionSupportEnum.XATransaction));
+ assertThat(resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getManagedConnectionFactoryClass(),
+ equalTo(new XsdString("org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory", null)));
+
+ //when
+ Merger mf = new Merger();
+ Connector merged = mf.mergeConnectorAndDs(ds.getXaDataSource().get(0), connector);
+ //then
+ assertThat(merged, instanceOf(Connector15.class));
+ assertThat(merged.getVersion(), is(Version.V_15));
+
+ List<? extends ConfigProperty> mergedProperties = null;
+
+ ResourceAdapter1516 mergedResourceAdapter1516 = (ResourceAdapter1516) merged.getResourceadapter();
+ if (connector.getResourceadapter() != null &&
+ connector.getResourceadapter() instanceof ResourceAdapter1516 &&
+ resourceAdapter1516.getOutboundResourceadapter() != null &&
+ resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
+ {
+ mergedProperties = mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions()
+ .get(0).getConfigProperties();
+ }
+
+ //then merged properties are presents
+
+ assertThat((List<ConfigProperty>) mergedProperties,
+ hasItem(Merger.ConfigPropertyFactory.createConfigProperty(
+ Merger.ConfigPropertyFactory.Prototype.XADATASOURCEPROPERTIES,
+ "DatabaseName=database_name;User=user;ServerName=server_name;PortNumber=5432;"
+ + "Password=password;")));
+
+ assertThat((List<ConfigProperty>) mergedProperties,
+ hasItem(Merger.ConfigPropertyFactory.createConfigProperty(
+ Merger.ConfigPropertyFactory.Prototype.XADATASOURCECLASS,
+ "org.postgresql.xa.PGXADataSource")));
+
+ //then metadata read from ra.xml still present (not deleted by merge)
+ assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
+ is(TransactionSupportEnum.XATransaction));
+ assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getManagedConnectionFactoryClass(),
+ equalTo(new XsdString("org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory", null)));
+
+ //then it have empty property for not set ones
+ assertThat((List<ConfigProperty>) mergedProperties,
+ not(hasItem(Merger.ConfigPropertyFactory.createConfigProperty(
+ Merger.ConfigPropertyFactory.Prototype.PREPAREDSTATEMENTCACHESIZE, ""))));
+
+ //then it does not contain property not in ra.xml
+ assertThat((List<ConfigProperty>) mergedProperties,
+ not(hasItem(Merger.ConfigPropertyFactory.createConfigProperty(
+ Merger.ConfigPropertyFactory.Prototype.CONNECTIONURL, ""))));
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+
+ }
+}
Added: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/package.html
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/package.html (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/package.html 2010-09-14 14:51:08 UTC (rev 108140)
@@ -0,0 +1,3 @@
+<body>
+This package contains Metadata's merging tet cases
+</body>
Deleted: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/package.html
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/package.html 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/package.html 2010-09-14 14:51:08 UTC (rev 108140)
@@ -1,3 +0,0 @@
-<body>
-This package contains Metadata general tet cases
-</body>
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -29,8 +29,8 @@
import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.ra.Connector;
import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
-import org.jboss.jca.common.metadata.MetadataFactory;
import org.jboss.jca.common.metadata.ds.DsParser;
+import org.jboss.jca.common.metadata.merge.Merger;
import org.jboss.jca.core.connectionmanager.ConnectionManager;
import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
import org.jboss.jca.core.connectionmanager.pool.api.Pool;
@@ -361,10 +361,10 @@
{
log.debug("DataSource=" + ds);
- MetadataFactory metaDataFactory = new MetadataFactory();
+ Merger merger = new Merger();
Connector md = mdr.getResourceAdapter(ra);
- md = metaDataFactory.mergeConnectorAndDs(ds, md);
+ md = merger.mergeConnectorAndDs(ds, md);
// Get the first connection definition as there is only one
ResourceAdapter1516 ra1516 = (ResourceAdapter1516)md.getResourceadapter();
@@ -436,10 +436,10 @@
{
log.debug("XaDataSource=" + ds);
- MetadataFactory metaDataFactory = new MetadataFactory();
+ Merger merger = new Merger();
Connector md = mdr.getResourceAdapter(ra);
- md = metaDataFactory.mergeConnectorAndDs(ds, md);
+ md = merger.mergeConnectorAndDs(ds, md);
// Get the first connection definition as there is only one
ResourceAdapter1516 ra1516 = (ResourceAdapter1516)md.getResourceadapter();
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-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java 2010-09-14 14:51:08 UTC (rev 108140)
@@ -452,7 +452,7 @@
if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
{
- org.jboss.jca.common.api.metadata.common.ConnectionDefinition cd =
+ org.jboss.jca.common.api.metadata.common.CommonConnDef cd =
findConnectionDefinition(mcf.getClass().getName(), raxml.getConnectionDefinitions());
String jndiName = cd.getJndiName();
@@ -483,7 +483,7 @@
{
org.jboss.jca.common.api.metadata.ra.ConnectionDefinition cdMeta = cdMetas.get(cdIndex);
- org.jboss.jca.common.api.metadata.common.ConnectionDefinition cdRaXml =
+ org.jboss.jca.common.api.metadata.common.CommonConnDef cdRaXml =
findConnectionDefinition(cdMeta.getManagedConnectionFactoryClass().getValue(),
raxml.getConnectionDefinitions());
@@ -784,8 +784,8 @@
* @param defs The connection definitions
* @return The JNDI name
*/
- private org.jboss.jca.common.api.metadata.common.ConnectionDefinition findConnectionDefinition(String clz,
- List<org.jboss.jca.common.api.metadata.common.ConnectionDefinition> defs)
+ private org.jboss.jca.common.api.metadata.common.CommonConnDef findConnectionDefinition(String clz,
+ List<org.jboss.jca.common.api.metadata.common.CommonConnDef> defs)
{
if (defs != null)
{
@@ -797,7 +797,7 @@
if (clz == null)
throw new IllegalArgumentException("ManagedConnectionFactory must be defined in class-name");
- for (org.jboss.jca.common.api.metadata.common.ConnectionDefinition cd : defs)
+ for (org.jboss.jca.common.api.metadata.common.CommonConnDef cd : defs)
{
if (clz.equals(cd.getClassName()))
return cd;
Modified: projects/jboss-jca/trunk/tools/findbugs/filter.xml
===================================================================
--- projects/jboss-jca/trunk/tools/findbugs/filter.xml 2010-09-14 14:24:15 UTC (rev 108139)
+++ projects/jboss-jca/trunk/tools/findbugs/filter.xml 2010-09-14 14:51:08 UTC (rev 108140)
@@ -28,12 +28,12 @@
<Bug code="Nm"/>
</Match>
<Match>
- <Class name="org.jboss.jca.common.metadata.MetadataFactory"/>
+ <Class name="org.jboss.jca.common.metadata.merge.Merger"/>
<Method name="mergeConnectorAndDs" />
<Bug code="NP"/>
</Match>
<Match>
- <Class name="org.jboss.jca.common.metadata.MetadataFactory"/>
+ <Class name="org.jboss.jca.common.metadata.merge.Merger"/>
<Method name="mergeConnectorWithProperties" />
<Bug code="NP"/>
</Match>
More information about the jboss-cvs-commits
mailing list