[jboss-cvs] JBossAS SVN: r108036 - in projects/jboss-jca/trunk/common/src: main/java/org/jboss/jca/common/api/metadata/common and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Sep 8 07:25:28 EDT 2010
Author: maeste
Date: 2010-09-08 07:25:27 -0400 (Wed, 08 Sep 2010)
New Revision: 108036
Added:
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/CommonIronJacamar.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/api/metadata/ironjacamar/
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ironjacamar/IronJacamar.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ironjacamar/package.html
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/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/common/ConnectionDefinitionImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/
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/ironjacamar/package.html
projects/jboss-jca/trunk/common/src/main/resources/schema/ironjacamar_1_0.xsd
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/package.html
projects/jboss-jca/trunk/common/src/test/resources/ironjacamar/
projects/jboss-jca/trunk/common/src/test/resources/ironjacamar/ironjacamar-test1.xml
Removed:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/AdminObject.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/ConnectionDefinition.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/AdminObjectImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ConnectionDefinitionImpl.java
Modified:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/ResourceAdapter.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
Log:
JBJCA-414 xsd, metadata api, impl and parser. Generalization of some resource-adapter.xsd MD and parser to be reused and/or extended for ironjacamar.xsd stuffs
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/AdminObject.java (from rev 108033, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/AdminObject.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/AdminObject.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/AdminObject.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -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 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;
+ }
+
+ }
+}
Added: 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 (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonIronJacamar.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,82 @@
+/*
+ * 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.List;
+import java.util.Map;
+
+/**
+ *
+ * A CommonIronJacamar.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public interface CommonIronJacamar extends JCAMetadata
+{
+
+ /**
+ * Get the transactionSupport.
+ *
+ * @return the transactionSupport.
+ */
+ public TransactionSupportEnum getTransactionSupport();
+
+ /**
+ * Get the connectionFactories.
+ *
+ * @return the connectionFactories.
+ */
+ public List<ConnectionDefinition> getConnectionDefinitions();
+
+ /**
+ * Get the adminObjects.
+ *
+ * @return the adminObjects.
+ */
+ public List<AdminObject> getAdminObjects();
+
+ /**
+ * Get the configProperties.
+ *
+ * @return the configProperties.
+ */
+ public Map<String, String> getConfigProperties();
+
+ /**
+ * Get the beanValidationGroups.
+ *
+ * @return the beanValidationGroups.
+ */
+ public List<String> getBeanValidationGroups();
+
+ /**
+ * Get the bootstrapContext.
+ *
+ * @return the bootstrapContext.
+ */
+ public String getBootstrapContext();
+
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/ConnectionDefinition.java (from rev 108033, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/ConnectionDefinition.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/ConnectionDefinition.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/ConnectionDefinition.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -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 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();
+
+ /**
+ * Get the noTxSeparatePool.
+ *
+ * @return the noTxSeparatePool.
+ */
+
+ public boolean isNoTxSeparatePool();
+
+ /**
+ *
+ * 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"),
+ /**
+ * no-tx-separate-pool tag
+ */
+ NO_TX_SEPARATE_POOL("no-tx-separate-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;
+ }
+
+ }
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ironjacamar/IronJacamar.java (from rev 108033, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/ResourceAdapter.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ironjacamar/IronJacamar.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ironjacamar/IronJacamar.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,147 @@
+/*
+ * 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.ironjacamar;
+
+import org.jboss.jca.common.api.metadata.common.CommonIronJacamar;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A IronJacamar.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public interface IronJacamar extends CommonIronJacamar
+{
+
+ /**
+ *
+ * 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"),
+
+ /**
+ * bean-validation-groups tag
+ */
+ BEAN_VALIDATION_GROUPS("bean-validation-groups"),
+
+ /**
+ * bean-validation-group tag
+ */
+ BEAN_VALIDATION_GROUP("bean-validation-group"),
+
+ /**
+ * bootstrap-context tag
+ */
+ BOOTSTRAP_CONTEXT("bootstrap-context"),
+
+ /**
+ * transaction-support tag
+ */
+ TRANSACTION_SUPPORT("transaction-support"),
+ /**
+ * connection-definitions tag
+ */
+ CONNECTION_DEFINITIONS("connection-definitions"),
+ /**
+ * connection-definition tag
+ */
+ CONNECTION_DEFINITION("connection-definition"),
+
+ /**
+ * admin-objects tag
+ */
+ ADMIN_OBJECTS("admin-objects"),
+
+ /**
+ * admin-objects tag
+ */
+ ADMIN_OBJECT("admin-object");
+
+ 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 string
+ *
+ * @param localName a string 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;
+ }
+
+ }
+}
+
Added: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ironjacamar/package.html
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ironjacamar/package.html (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ironjacamar/package.html 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,3 @@
+<body>
+This package contains interfaces to define metadata api for ironjacamar_1.0.xml
+</body>
Deleted: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/AdminObject.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/AdminObject.java 2010-09-08 08:36:56 UTC (rev 108035)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/AdminObject.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -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.resourceadapter;
-
-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;
- }
-
- }
-}
Deleted: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/ConnectionDefinition.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/ConnectionDefinition.java 2010-09-08 08:36:56 UTC (rev 108035)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/ConnectionDefinition.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -1,270 +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.resourceadapter;
-
-import org.jboss.jca.common.api.metadata.JCAMetadata;
-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 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();
-
- /**
- * Get the noTxSeparatePool.
- *
- * @return the noTxSeparatePool.
- */
-
- public boolean isNoTxSeparatePool();
-
- /**
- *
- * 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"),
- /**
- * no-tx-separate-pool tag
- */
- NO_TX_SEPARATE_POOL("no-tx-separate-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/resourceadapter/ResourceAdapter.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/ResourceAdapter.java 2010-09-08 08:36:56 UTC (rev 108035)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/resourceadapter/ResourceAdapter.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -21,10 +21,10 @@
*/
package org.jboss.jca.common.api.metadata.resourceadapter;
-import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
+import org.jboss.jca.common.api.metadata.common.CommonIronJacamar;
+
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
/**
@@ -34,7 +34,7 @@
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
*
*/
-public interface ResourceAdapter
+public interface ResourceAdapter extends CommonIronJacamar
{
/**
@@ -45,48 +45,6 @@
public String getArchive();
/**
- * Get the transactionSupport.
- *
- * @return the transactionSupport.
- */
- public TransactionSupportEnum getTransactionSupport();
-
- /**
- * Get the connectionFactories.
- *
- * @return the connectionFactories.
- */
- public List<ConnectionDefinition> getConnectionDefinitions();
-
- /**
- * Get the adminObjects.
- *
- * @return the adminObjects.
- */
- public List<AdminObject> getAdminObjects();
-
- /**
- * Get the configProperties.
- *
- * @return the configProperties.
- */
- public Map<String, String> getConfigProperties();
-
- /**
- * Get the beanValidationGroups.
- *
- * @return the beanValidationGroups.
- */
- public List<String> getBeanValidationGroups();
-
- /**
- * Get the bootstrapContext.
- *
- * @return the bootstrapContext.
- */
- public String getBootstrapContext();
-
- /**
*
* A Tag.
*
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/AdminObjectImpl.java (from rev 108033, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/AdminObjectImpl.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/AdminObjectImpl.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/AdminObjectImpl.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -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.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/CommonIronJacamarImpl.java (from rev 108033, 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/common/CommonIronJacamarImpl.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarImpl.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,271 @@
+/*
+ * 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 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;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * A CommonIronJacamarImpl.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public abstract class CommonIronJacamarImpl implements CommonIronJacamar
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -7422976850056232511L;
+
+ /** transactionSupport **/
+ protected final TransactionSupportEnum transactionSupport;
+
+ /**
+ * configProperties
+ */
+ protected final HashMap<String, String> configProperties;
+
+ /**
+ * adminObjects
+ */
+ protected final ArrayList<AdminObject> adminObjects;
+
+ /**
+ * connectionDefinitions
+ */
+ protected final ArrayList<ConnectionDefinition> connectionDefinitions;
+
+ /**
+ * beanValidationGroups
+ */
+ protected final ArrayList<String> beanValidationGroups;
+
+ /** bootstrapContext **/
+ protected final String bootstrapContext;
+
+ /**
+ * Create a new CommonIronJacamarImpl.
+ *
+ * @param transactionSupport transactionSupport
+ * @param configProperties configProperties
+ * @param adminObjects adminObjects
+ * @param connectionDefinitions connectionDefinitions
+ * @param beanValidationGroups beanValidationGroups
+ * @param bootstrapContext bootstrapContext
+ */
+ protected CommonIronJacamarImpl(TransactionSupportEnum transactionSupport,
+ Map<String, String> configProperties, List<AdminObject> adminObjects,
+ List<ConnectionDefinition> connectionDefinitions, List<String> beanValidationGroups,
+ String bootstrapContext)
+ {
+ super();
+ this.transactionSupport = transactionSupport;
+ if (connectionDefinitions != null)
+ {
+ this.connectionDefinitions = new ArrayList<ConnectionDefinition>(connectionDefinitions.size());
+ this.connectionDefinitions.addAll(connectionDefinitions);
+ }
+ else
+ {
+ this.connectionDefinitions = new ArrayList<ConnectionDefinition>(0);
+ }
+
+ if (adminObjects != null)
+ {
+ this.adminObjects = new ArrayList<AdminObject>(adminObjects.size());
+ this.adminObjects.addAll(adminObjects);
+ }
+ else
+ {
+ this.adminObjects = new ArrayList<AdminObject>(0);
+ }
+ if (configProperties != null)
+ {
+ this.configProperties = new HashMap<String, String>(configProperties.size());
+ this.configProperties.putAll(configProperties);
+ }
+ else
+ {
+ this.configProperties = new HashMap<String, String>(0);
+ }
+ if (beanValidationGroups != null)
+ {
+ this.beanValidationGroups = new ArrayList<String>(beanValidationGroups.size());
+ this.beanValidationGroups.addAll(beanValidationGroups);
+ }
+ else
+ {
+ this.beanValidationGroups = new ArrayList<String>(0);
+ }
+ this.bootstrapContext = bootstrapContext;
+
+ }
+
+ /**
+ * Get the transactionSupport.
+ *
+ * @return the transactionSupport.
+ */
+ @Override
+ public final TransactionSupportEnum getTransactionSupport()
+ {
+ return transactionSupport;
+ }
+
+ /**
+ * Get the connectionFactories.
+ *
+ * @return the connectionFactories.
+ */
+ @Override
+ public final List<ConnectionDefinition> getConnectionDefinitions()
+ {
+ return Collections.unmodifiableList(connectionDefinitions);
+ }
+
+ /**
+ * Get the adminObjects.
+ *
+ * @return the adminObjects.
+ */
+ @Override
+ public final List<AdminObject> getAdminObjects()
+ {
+ return Collections.unmodifiableList(adminObjects);
+ }
+
+ /**
+ * Get the configProperties.
+ *
+ * @return the configProperties.
+ */
+ @Override
+ public Map<String, String> getConfigProperties()
+ {
+ return Collections.unmodifiableMap(configProperties);
+ }
+
+ /**
+ * Get the beanValidationGroups.
+ *
+ * @return the beanValidationGroups.
+ */
+ @Override
+ public final List<String> getBeanValidationGroups()
+ {
+ return Collections.unmodifiableList(beanValidationGroups);
+ }
+
+ /**
+ * Get the bootstrapContext.
+ *
+ * @return the bootstrapContext.
+ */
+ @Override
+ public final String getBootstrapContext()
+ {
+ return bootstrapContext;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((adminObjects == null) ? 0 : adminObjects.hashCode());
+ result = prime * result + ((beanValidationGroups == null) ? 0 : beanValidationGroups.hashCode());
+ result = prime * result + ((bootstrapContext == null) ? 0 : bootstrapContext.hashCode());
+ result = prime * result + ((configProperties == null) ? 0 : configProperties.hashCode());
+ result = prime * result + ((connectionDefinitions == null) ? 0 : connectionDefinitions.hashCode());
+ result = prime * result + ((transactionSupport == null) ? 0 : transactionSupport.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof CommonIronJacamarImpl))
+ return false;
+ CommonIronJacamarImpl other = (CommonIronJacamarImpl) obj;
+ if (adminObjects == null)
+ {
+ if (other.adminObjects != null)
+ return false;
+ }
+ else if (!adminObjects.equals(other.adminObjects))
+ return false;
+ if (beanValidationGroups == null)
+ {
+ if (other.beanValidationGroups != null)
+ return false;
+ }
+ else if (!beanValidationGroups.equals(other.beanValidationGroups))
+ return false;
+ if (bootstrapContext == null)
+ {
+ if (other.bootstrapContext != null)
+ return false;
+ }
+ else if (!bootstrapContext.equals(other.bootstrapContext))
+ return false;
+ if (configProperties == null)
+ {
+ if (other.configProperties != null)
+ return false;
+ }
+ else if (!configProperties.equals(other.configProperties))
+ return false;
+ if (connectionDefinitions == null)
+ {
+ if (other.connectionDefinitions != null)
+ return false;
+ }
+ else if (!connectionDefinitions.equals(other.connectionDefinitions))
+ return false;
+ if (transactionSupport != other.transactionSupport)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "CommonIronJacamarImpl [transactionSupport=" + transactionSupport + ", configProperties=" +
+ configProperties + ", adminObjects=" + adminObjects + ", connectionDefinitions=" +
+ connectionDefinitions + ", beanValidationGroups=" + beanValidationGroups + ", bootstrapContext=" +
+ bootstrapContext + "]";
+ }
+
+}
Added: 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 (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarParser.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,365 @@
+/*
+ * 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 org.jboss.jca.common.api.metadata.common.AdminObject.Attribute;
+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;
+
+import java.util.HashMap;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+/**
+ *
+ * A CommonIronJacamarParser.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public abstract class CommonIronJacamarParser extends AbstractParser
+{
+
+ /**
+ *
+ * parse a single connection-definition tag
+ *
+ * @param reader the reader
+ * @return the parse {@link ConnectionDefinition} object
+ * @throws XMLStreamException XMLStreamException
+ * @throws ParserException ParserException
+ */
+ protected ConnectionDefinition parseConnectionDefinitions(XMLStreamReader reader) throws XMLStreamException,
+ ParserException
+ {
+ HashMap<String, String> configProperties = new HashMap<String, String>();
+ CommonSecurity security = null;
+ CommonTimeOut timeOut = null;
+ CommonValidation validation = null;
+ boolean noTxSeparatePools = false;
+ CommonPool pool = null;
+
+ //attributes reading
+ boolean useJavaContext = false;
+ String className = null;
+ boolean enabled = true;
+ String jndiName = null;
+ String poolName = null;
+
+ for (ConnectionDefinition.Attribute attribute : ConnectionDefinition.Attribute.values())
+ {
+ switch (attribute)
+ {
+ case ENABLED : {
+ enabled = attributeAsBoolean(reader, attribute.getLocalName(), true);
+ break;
+ }
+ case JNDINAME : {
+ jndiName = attributeAsString(reader, attribute.getLocalName());
+ break;
+ }
+ case CLASS_NAME : {
+ className = attributeAsString(reader, attribute.getLocalName());
+ break;
+ }
+ case POOL_NAME : {
+ poolName = attributeAsString(reader, attribute.getLocalName());
+ break;
+ }
+ case USEJAVACONTEXT : {
+ useJavaContext = attributeAsBoolean(reader, attribute.getLocalName(), false);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected attribute:" + attribute.getLocalName() + "at " +
+ reader.getLocalName());
+ }
+ }
+
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (ResourceAdapter.Tag.forName(reader.getLocalName()) == ResourceAdapter.Tag.CONNECTION_DEFINITION)
+ {
+
+ return new ConnectionDefinitionImpl(configProperties, className, jndiName, poolName, enabled,
+ useJavaContext, pool, timeOut, validation, security,
+ noTxSeparatePools);
+ }
+ else
+ {
+ if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (ConnectionDefinition.Tag.forName(reader.getLocalName()))
+ {
+ case CONFIG_PROPERTY : {
+ configProperties.put(attributeAsString(reader, "name"), elementAsString(reader));
+ break;
+ }
+ case SECURITY : {
+ security = parseSecuritySettings(reader);
+ break;
+ }
+ case TIMEOUT : {
+ timeOut = parseTimeOut(reader);
+ break;
+ }
+ case VALIDATION : {
+ validation = parseValidation(reader);
+ break;
+ }
+ case NO_TX_SEPARATE_POOL : {
+ noTxSeparatePools = elementAsBoolean(reader);
+ break;
+ }
+ case POOL : {
+ pool = parsePool(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ private CommonValidation parseValidation(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ boolean useFastFail = false;
+ boolean backgroundValidation = false;
+ Long backgroundValidationMinutes = null;
+
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.VALIDATION)
+ {
+
+ return new CommonValidationImpl(backgroundValidation, backgroundValidationMinutes, useFastFail);
+ }
+ else
+ {
+ if (CommonValidation.Tag.forName(reader.getLocalName()) == CommonValidation.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (CommonValidation.Tag.forName(reader.getLocalName()))
+ {
+ case BACKGROUNDVALIDATIONMINUTES : {
+ backgroundValidationMinutes = elementAsLong(reader);
+ break;
+ }
+ case BACKGROUNDVALIDATION : {
+ backgroundValidation = elementAsBoolean(reader);
+ break;
+ }
+ case USEFASTFAIL : {
+ useFastFail = elementAsBoolean(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ private CommonTimeOut parseTimeOut(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ Long blockingTimeoutMillis = null;
+ Long allocationRetryWaitMillis = null;
+ Long idleTimeoutMinutes = null;
+ Long allocationRetry = null;
+ Long xaResourceTimeout = null;
+
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.TIMEOUT)
+ {
+
+ return new CommonTimeOutImpl(blockingTimeoutMillis, idleTimeoutMinutes, allocationRetry,
+ allocationRetryWaitMillis, xaResourceTimeout);
+ }
+ else
+ {
+ if (CommonTimeOut.Tag.forName(reader.getLocalName()) == CommonTimeOut.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (CommonTimeOut.Tag.forName(reader.getLocalName()))
+ {
+ case ALLOCATIONRETRYWAITMILLIS : {
+ allocationRetryWaitMillis = elementAsLong(reader);
+ break;
+ }
+ case ALLOCATIONRETRY : {
+ allocationRetry = elementAsLong(reader);
+ break;
+ }
+ case BLOCKINGTIMEOUTMILLIS : {
+ blockingTimeoutMillis = elementAsLong(reader);
+ break;
+ }
+ case IDLETIMEOUTMINUTES : {
+ idleTimeoutMinutes = elementAsLong(reader);
+ break;
+ }
+ case XARESOURCETIMEOUT : {
+ xaResourceTimeout = elementAsLong(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ /**
+ *
+ * parse a single admin-oject tag
+ *
+ * @param reader the reader
+ * @return the parsed {@link AdminObject}
+ * @throws XMLStreamException XMLStreamException
+ * @throws ParserException ParserException
+ */
+ protected AdminObject parseAdminObjects(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ HashMap<String, String> configProperties = new HashMap<String, String>();
+
+ //attributes reading
+ boolean useJavaContext = false;
+ String className = null;
+ boolean enabled = true;
+ String jndiName = null;
+ String poolName = null;
+
+ for (Attribute attribute : AdminObject.Attribute.values())
+ {
+ switch (attribute)
+ {
+ case ENABLED : {
+ enabled = attributeAsBoolean(reader, attribute.getLocalName(), true);
+ break;
+ }
+ case JNDINAME : {
+ jndiName = attributeAsString(reader, attribute.getLocalName());
+ break;
+ }
+ case CLASS_NAME : {
+ className = attributeAsString(reader, attribute.getLocalName());
+ break;
+ }
+ case USEJAVACONTEXT : {
+ useJavaContext = attributeAsBoolean(reader, attribute.getLocalName(), false);
+ break;
+ }
+ case POOL_NAME : {
+ poolName = attributeAsString(reader, attribute.getLocalName());
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected attribute:" + attribute.getLocalName() + "at " +
+ reader.getLocalName());
+ }
+ }
+
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (ResourceAdapter.Tag.forName(reader.getLocalName()) == ResourceAdapter.Tag.ADMIN_OBJECT)
+ {
+
+ return new AdminObjectImpl(configProperties, className, jndiName, poolName, enabled,
+ useJavaContext);
+ }
+ else
+ {
+ if (AdminObject.Tag.forName(reader.getLocalName()) == AdminObject.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (AdminObject.Tag.forName(reader.getLocalName()))
+ {
+ case CONFIG_PROPERTY : {
+ configProperties.put(attributeAsString(reader, "name"), elementAsString(reader));
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/ConnectionDefinitionImpl.java (from rev 108033, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ConnectionDefinitionImpl.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/ConnectionDefinitionImpl.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/ConnectionDefinitionImpl.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,333 @@
+/*
+ * 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.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;
+
+ private final boolean noTxSeparatePool;
+
+ /**
+ * 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
+ * @param noTxSeparatePool noTxSeparatePool
+ */
+ public ConnectionDefinitionImpl(Map<String, String> configProperties, String className, String jndiName,
+ String poolName, boolean enabled, boolean useJavaContext, CommonPool pool, CommonTimeOut timeOut,
+ CommonValidation validation, CommonSecurity security, boolean noTxSeparatePool)
+ {
+ 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;
+ this.noTxSeparatePool = noTxSeparatePool;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Get the noTxSeparatePool.
+ *
+ * @return the noTxSeparatePool.
+ */
+ @Override
+ public final boolean isNoTxSeparatePool()
+ {
+ return noTxSeparatePool;
+ }
+
+ @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 + (noTxSeparatePool ? 1231 : 1237);
+ 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 (noTxSeparatePool != other.noTxSeparatePool)
+ 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 + ", noTxSeparatePool=" + noTxSeparatePool + "]";
+ }
+
+}
Added: 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 (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarImpl.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,66 @@
+/*
+ * 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.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.TransactionSupportEnum;
+import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
+import org.jboss.jca.common.metadata.common.CommonIronJacamarImpl;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * A concrete IronJacamarImpl.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class IronJacamarImpl extends CommonIronJacamarImpl implements IronJacamar
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8994120864846088078L;
+
+ /**
+ *
+ * Create a new IronJacamarImpl.
+ *
+ * @param transactionSupport transactionSupport
+ * @param configProperties configProperties
+ * @param adminObjects adminObjects
+ * @param connectionDefinitions connectionDefinitions
+ * @param beanValidationGroups beanValidationGroups
+ * @param bootstrapContext bootstrapContext
+ */
+ public IronJacamarImpl(TransactionSupportEnum transactionSupport, Map<String, String> configProperties,
+ List<AdminObject> adminObjects, List<ConnectionDefinition> connectionDefinitions,
+ List<String> beanValidationGroups, String bootstrapContext)
+ {
+ super(transactionSupport, configProperties, adminObjects, connectionDefinitions, beanValidationGroups,
+ bootstrapContext);
+ }
+
+}
+
Added: 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 (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParser.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,255 @@
+/*
+ * 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.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.TransactionSupportEnum;
+import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
+import org.jboss.jca.common.metadata.MetadataParser;
+import org.jboss.jca.common.metadata.ParserException;
+import org.jboss.jca.common.metadata.common.CommonIronJacamarParser;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+/**
+ *
+ * A ResourceAdapterParserr.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class IronJacamarParser extends CommonIronJacamarParser implements MetadataParser<IronJacamar>
+{
+
+ @Override
+ public IronJacamar parse(InputStream xmlInputStream) throws Exception
+ {
+
+ XMLStreamReader reader = null;
+ IronJacamar ironJacamar = null;
+
+ try
+ {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ reader = inputFactory.createXMLStreamReader(xmlInputStream);
+
+ //iterate over tags
+ int iterate;
+ try
+ {
+ iterate = reader.nextTag();
+ }
+ catch (XMLStreamException e)
+ {
+ //founding a non tag..go on. Normally non-tag found at beginning are comments or DTD declaration
+ iterate = reader.nextTag();
+ }
+ switch (iterate)
+ {
+ case END_ELEMENT : {
+ // should mean we're done, so ignore it.
+ break;
+ }
+ case START_ELEMENT : {
+
+ switch (Tag.forName(reader.getLocalName()))
+ {
+ case IRONJACAMAR : {
+ ironJacamar = parseIronJacamar(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+
+ break;
+ }
+ default :
+ throw new IllegalStateException();
+ }
+ }
+ finally
+ {
+ if (reader != null)
+ reader.close();
+ }
+ return ironJacamar;
+
+ }
+
+
+
+ private IronJacamar parseIronJacamar(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ ArrayList<ConnectionDefinition> connectionDefinitions = new ArrayList<ConnectionDefinition>();
+ ArrayList<AdminObject> adminObjects = new ArrayList<AdminObject>();
+ ArrayList<String> beanValidationGroups = new ArrayList<String>();
+ String bootstrapContext = null;
+ TransactionSupportEnum transactionSupport = null;
+ HashMap<String, String> configProperties = new HashMap<String, String>();
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (Tag.forName(reader.getLocalName()) == Tag.IRONJACAMAR)
+ {
+ return new IronJacamarImpl(transactionSupport, configProperties, adminObjects,
+ connectionDefinitions, beanValidationGroups, bootstrapContext);
+ }
+ else
+ {
+ if (IronJacamar.Tag.forName(reader.getLocalName()) == IronJacamar.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (IronJacamar.Tag.forName(reader.getLocalName()))
+ {
+ case ADMIN_OBJECTS :
+ case CONNECTION_DEFINITIONS :
+ case BEAN_VALIDATION_GROUPS : {
+ //ignore it,we will parse bean-validation-group,admin_object and connection_definition directly
+ break;
+ }
+ case ADMIN_OBJECT : {
+ adminObjects.add(parseAdminObjects(reader));
+ break;
+ }
+
+ case CONNECTION_DEFINITION : {
+ connectionDefinitions.add(parseConnectionDefinitions(reader));
+ break;
+ }
+ case BEAN_VALIDATION_GROUP : {
+ beanValidationGroups.add(elementAsString(reader));
+ break;
+ }
+ case BOOTSTRAP_CONTEXT : {
+ bootstrapContext = elementAsString(reader);
+ break;
+ }
+ case CONFIG_PROPERTY : {
+ configProperties.put(attributeAsString(reader, "name"), elementAsString(reader));
+ break;
+
+ }
+ case TRANSACTION_SUPPORT : {
+ transactionSupport = TransactionSupportEnum.valueOf(elementAsString(reader));
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ /**
+ *
+ * A Tag.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+ public enum Tag
+ {
+ /** always first
+ *
+ */
+ UNKNOWN(null),
+
+ /** jboss-ra tag name
+ *
+ */
+ IRONJACAMAR("ironjacamar");
+
+ 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 string
+ *
+ * @param localName a string 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;
+ }
+
+ }
+
+}
Added: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/package.html
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/package.html (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/package.html 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,3 @@
+<body>
+This package contains metadatas for ironJacamar's extension xsd ironjacamar.xml
+</body>
Deleted: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/AdminObjectImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/AdminObjectImpl.java 2010-09-08 08:36:56 UTC (rev 108035)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/AdminObjectImpl.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -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.resourceadapter;
-
-import org.jboss.jca.common.api.metadata.resourceadapter.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;
- }
-}
Deleted: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ConnectionDefinitionImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ConnectionDefinitionImpl.java 2010-09-08 08:36:56 UTC (rev 108035)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ConnectionDefinitionImpl.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -1,333 +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.resourceadapter;
-
-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.resourceadapter.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;
-
- private final boolean noTxSeparatePool;
-
- /**
- * 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
- * @param noTxSeparatePool noTxSeparatePool
- */
- public ConnectionDefinitionImpl(Map<String, String> configProperties, String className, String jndiName,
- String poolName, boolean enabled, boolean useJavaContext, CommonPool pool, CommonTimeOut timeOut,
- CommonValidation validation, CommonSecurity security, boolean noTxSeparatePool)
- {
- 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;
- this.noTxSeparatePool = noTxSeparatePool;
- }
-
- /**
- * 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;
- }
-
- /**
- * Get the noTxSeparatePool.
- *
- * @return the noTxSeparatePool.
- */
- @Override
- public final boolean isNoTxSeparatePool()
- {
- return noTxSeparatePool;
- }
-
- @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 + (noTxSeparatePool ? 1231 : 1237);
- 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 (noTxSeparatePool != other.noTxSeparatePool)
- 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 + ", noTxSeparatePool=" + noTxSeparatePool + "]";
- }
-
-}
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-08 08:36:56 UTC (rev 108035)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterImpl.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -21,14 +21,12 @@
*/
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.TransactionSupportEnum;
-import org.jboss.jca.common.api.metadata.resourceadapter.AdminObject;
-import org.jboss.jca.common.api.metadata.resourceadapter.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.resourceadapter.ResourceAdapter;
+import org.jboss.jca.common.metadata.common.CommonIronJacamarImpl;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -39,23 +37,11 @@
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
*
*/
-public class ResourceAdapterImpl implements ResourceAdapter
+public class ResourceAdapterImpl extends CommonIronJacamarImpl implements ResourceAdapter
{
/** The serialVersionUID */
- private static final long serialVersionUID = -7422976850056232511L;
+ private static final long serialVersionUID = 7607776873201143875L;
private final String archive;
- private final TransactionSupportEnum transactionSupport;
-
- private final HashMap<String, String> configProperties;
-
- private final ArrayList<AdminObject> adminObjects;
-
- private final ArrayList<ConnectionDefinition> connectionDefinitions;
-
- private final ArrayList<String> beanValidationGroups;
-
- private final String bootstrapContext;
-
/**
*
* Create a new ResourceAdapterImpl.
@@ -72,48 +58,9 @@
List<ConnectionDefinition> connectionDefinitions, List<AdminObject> adminObjects,
Map<String, String> configProperties, List<String> beanValidationGroups, String bootstrapContext)
{
- super();
+ super(transactionSupport, configProperties, adminObjects, connectionDefinitions, beanValidationGroups,
+ bootstrapContext);
this.archive = archive;
- this.transactionSupport = transactionSupport;
- if (connectionDefinitions != null)
- {
- this.connectionDefinitions = new ArrayList<ConnectionDefinition>(connectionDefinitions.size());
- this.connectionDefinitions.addAll(connectionDefinitions);
- }
- else
- {
- this.connectionDefinitions = new ArrayList<ConnectionDefinition>(0);
- }
-
- if (adminObjects != null)
- {
- this.adminObjects = new ArrayList<AdminObject>(adminObjects.size());
- this.adminObjects.addAll(adminObjects);
- }
- else
- {
- this.adminObjects = new ArrayList<AdminObject>(0);
- }
- if (configProperties != null)
- {
- this.configProperties = new HashMap<String, String>(configProperties.size());
- this.configProperties.putAll(configProperties);
- }
- else
- {
- this.configProperties = new HashMap<String, String>(0);
- }
- if (beanValidationGroups != null)
- {
- this.beanValidationGroups = new ArrayList<String>(beanValidationGroups.size());
- this.beanValidationGroups.addAll(beanValidationGroups);
- }
- else
- {
- this.beanValidationGroups = new ArrayList<String>(0);
- }
- this.bootstrapContext = bootstrapContext;
-
}
/**
@@ -127,84 +74,12 @@
return archive;
}
- /**
- * Get the transactionSupport.
- *
- * @return the transactionSupport.
- */
@Override
- public final TransactionSupportEnum getTransactionSupport()
- {
- return transactionSupport;
- }
-
- /**
- * Get the connectionFactories.
- *
- * @return the connectionFactories.
- */
- @Override
- public final List<ConnectionDefinition> getConnectionDefinitions()
- {
- return Collections.unmodifiableList(connectionDefinitions);
- }
-
- /**
- * Get the adminObjects.
- *
- * @return the adminObjects.
- */
- @Override
- public final List<AdminObject> getAdminObjects()
- {
- return Collections.unmodifiableList(adminObjects);
- }
-
- /**
- * Get the configProperties.
- *
- * @return the configProperties.
- */
- @Override
- public Map<String, String> getConfigProperties()
- {
- return Collections.unmodifiableMap(configProperties);
- }
-
- /**
- * Get the beanValidationGroups.
- *
- * @return the beanValidationGroups.
- */
- @Override
- public final List<String> getBeanValidationGroups()
- {
- return Collections.unmodifiableList(beanValidationGroups);
- }
-
- /**
- * Get the bootstrapContext.
- *
- * @return the bootstrapContext.
- */
- @Override
- public final String getBootstrapContext()
- {
- return bootstrapContext;
- }
-
- @Override
public int hashCode()
{
final int prime = 31;
- int result = 1;
- result = prime * result + ((adminObjects == null) ? 0 : adminObjects.hashCode());
+ int result = super.hashCode();
result = prime * result + ((archive == null) ? 0 : archive.hashCode());
- result = prime * result + ((beanValidationGroups == null) ? 0 : beanValidationGroups.hashCode());
- result = prime * result + ((bootstrapContext == null) ? 0 : bootstrapContext.hashCode());
- result = prime * result + ((configProperties == null) ? 0 : configProperties.hashCode());
- result = prime * result + ((connectionDefinitions == null) ? 0 : connectionDefinitions.hashCode());
- result = prime * result + ((transactionSupport == null) ? 0 : transactionSupport.hashCode());
return result;
}
@@ -213,18 +88,11 @@
{
if (this == obj)
return true;
- if (obj == null)
+ if (!super.equals(obj))
return false;
if (!(obj instanceof ResourceAdapterImpl))
return false;
ResourceAdapterImpl other = (ResourceAdapterImpl) obj;
- if (adminObjects == null)
- {
- if (other.adminObjects != null)
- return false;
- }
- else if (!adminObjects.equals(other.adminObjects))
- return false;
if (archive == null)
{
if (other.archive != null)
@@ -232,36 +100,6 @@
}
else if (!archive.equals(other.archive))
return false;
- if (beanValidationGroups == null)
- {
- if (other.beanValidationGroups != null)
- return false;
- }
- else if (!beanValidationGroups.equals(other.beanValidationGroups))
- return false;
- if (bootstrapContext == null)
- {
- if (other.bootstrapContext != null)
- return false;
- }
- else if (!bootstrapContext.equals(other.bootstrapContext))
- return false;
- if (configProperties == null)
- {
- if (other.configProperties != null)
- return false;
- }
- else if (!configProperties.equals(other.configProperties))
- return false;
- if (connectionDefinitions == null)
- {
- if (other.connectionDefinitions != null)
- return false;
- }
- else if (!connectionDefinitions.equals(other.connectionDefinitions))
- return false;
- if (transactionSupport != other.transactionSupport)
- return false;
return true;
}
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-08 08:36:56 UTC (rev 108035)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParser.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -21,21 +21,14 @@
*/
package org.jboss.jca.common.metadata.resourceadapter;
-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.AdminObject;
+import org.jboss.jca.common.api.metadata.common.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
-import org.jboss.jca.common.api.metadata.resourceadapter.AdminObject;
-import org.jboss.jca.common.api.metadata.resourceadapter.AdminObject.Attribute;
-import org.jboss.jca.common.api.metadata.resourceadapter.ConnectionDefinition;
import org.jboss.jca.common.api.metadata.resourceadapter.ResourceAdapter;
import org.jboss.jca.common.api.metadata.resourceadapter.ResourceAdapters;
-import org.jboss.jca.common.metadata.AbstractParser;
import org.jboss.jca.common.metadata.MetadataParser;
import org.jboss.jca.common.metadata.ParserException;
-import org.jboss.jca.common.metadata.common.CommonTimeOutImpl;
-import org.jboss.jca.common.metadata.common.CommonValidationImpl;
+import org.jboss.jca.common.metadata.common.CommonIronJacamarParser;
import java.io.InputStream;
import java.util.ArrayList;
@@ -56,7 +49,7 @@
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
*
*/
-public class ResourceAdapterParser extends AbstractParser implements MetadataParser<ResourceAdapters>
+public class ResourceAdapterParser extends CommonIronJacamarParser implements MetadataParser<ResourceAdapters>
{
@Override
@@ -232,301 +225,6 @@
throw new ParserException("Reached end of xml document unexpectedly");
}
- private ConnectionDefinition parseConnectionDefinitions(XMLStreamReader reader) throws XMLStreamException,
- ParserException
- {
- HashMap<String, String> configProperties = new HashMap<String, String>();
- CommonSecurity security = null;
- CommonTimeOut timeOut = null;
- boolean prefill = false;
- CommonValidation validation = null;
- boolean noTxSeparatePools = false;
- CommonPool pool = null;
-
- //attributes reading
- boolean useJavaContext = false;
- String className = null;
- boolean enabled = true;
- String jndiName = null;
- String poolName = null;
-
- for (ConnectionDefinition.Attribute attribute : ConnectionDefinition.Attribute.values())
- {
- switch (attribute)
- {
- case ENABLED : {
- enabled = attributeAsBoolean(reader, attribute.getLocalName(), true);
- break;
- }
- case JNDINAME : {
- jndiName = attributeAsString(reader, attribute.getLocalName());
- break;
- }
- case CLASS_NAME : {
- className = attributeAsString(reader, attribute.getLocalName());
- break;
- }
- case POOL_NAME : {
- poolName = attributeAsString(reader, attribute.getLocalName());
- break;
- }
- case USEJAVACONTEXT : {
- useJavaContext = attributeAsBoolean(reader, attribute.getLocalName(), false);
- break;
- }
- default :
- throw new ParserException("Unexpected attribute:" + attribute.getLocalName() + "at " +
- reader.getLocalName());
- }
- }
-
- while (reader.hasNext())
- {
- switch (reader.nextTag())
- {
- case END_ELEMENT : {
- if (ResourceAdapter.Tag.forName(reader.getLocalName()) == ResourceAdapter.Tag.CONNECTION_DEFINITION)
- {
-
- return new ConnectionDefinitionImpl(configProperties, className, jndiName, poolName, enabled,
- useJavaContext, pool, timeOut, validation, security,
- noTxSeparatePools);
- }
- else
- {
- if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.UNKNOWN)
- {
- throw new ParserException("unexpected end tag" + reader.getLocalName());
- }
- }
- break;
- }
- case START_ELEMENT : {
- switch (ConnectionDefinition.Tag.forName(reader.getLocalName()))
- {
- case CONFIG_PROPERTY : {
- configProperties.put(attributeAsString(reader, "name"), elementAsString(reader));
- break;
- }
- case SECURITY : {
- security = parseSecuritySettings(reader);
- break;
- }
- case TIMEOUT : {
- timeOut = parseTimeOut(reader);
- break;
- }
- case VALIDATION : {
- validation = parseValidation(reader);
- break;
- }
- case NO_TX_SEPARATE_POOL : {
- noTxSeparatePools = elementAsBoolean(reader);
- break;
- }
- case POOL : {
- pool = parsePool(reader);
- break;
- }
- default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
- }
- break;
- }
- }
- }
- throw new ParserException("Reached end of xml document unexpectedly");
- }
-
- private CommonValidation parseValidation(XMLStreamReader reader) throws XMLStreamException, ParserException
- {
- boolean useFastFail = false;
- boolean backgroundValidation = false;
- Long backgroundValidationMinutes = null;
-
- while (reader.hasNext())
- {
- switch (reader.nextTag())
- {
- case END_ELEMENT : {
- if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.VALIDATION)
- {
-
- return new CommonValidationImpl(backgroundValidation, backgroundValidationMinutes, useFastFail);
- }
- else
- {
- if (CommonValidation.Tag.forName(reader.getLocalName()) == CommonValidation.Tag.UNKNOWN)
- {
- throw new ParserException("unexpected end tag" + reader.getLocalName());
- }
- }
- break;
- }
- case START_ELEMENT : {
- switch (CommonValidation.Tag.forName(reader.getLocalName()))
- {
- case BACKGROUNDVALIDATIONMINUTES : {
- backgroundValidationMinutes = elementAsLong(reader);
- break;
- }
- case BACKGROUNDVALIDATION : {
- backgroundValidation = elementAsBoolean(reader);
- break;
- }
- case USEFASTFAIL : {
- useFastFail = elementAsBoolean(reader);
- break;
- }
- default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
- }
- break;
- }
- }
- }
- throw new ParserException("Reached end of xml document unexpectedly");
- }
-
- private CommonTimeOut parseTimeOut(XMLStreamReader reader) throws XMLStreamException, ParserException
- {
- Long blockingTimeoutMillis = null;
- Long allocationRetryWaitMillis = null;
- Long idleTimeoutMinutes = null;
- Long allocationRetry = null;
- Long xaResourceTimeout = null;
-
- while (reader.hasNext())
- {
- switch (reader.nextTag())
- {
- case END_ELEMENT : {
- if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.TIMEOUT)
- {
-
- return new CommonTimeOutImpl(blockingTimeoutMillis, idleTimeoutMinutes, allocationRetry,
- allocationRetryWaitMillis, xaResourceTimeout);
- }
- else
- {
- if (CommonTimeOut.Tag.forName(reader.getLocalName()) == CommonTimeOut.Tag.UNKNOWN)
- {
- throw new ParserException("unexpected end tag" + reader.getLocalName());
- }
- }
- break;
- }
- case START_ELEMENT : {
- switch (CommonTimeOut.Tag.forName(reader.getLocalName()))
- {
- case ALLOCATIONRETRYWAITMILLIS : {
- allocationRetryWaitMillis = elementAsLong(reader);
- break;
- }
- case ALLOCATIONRETRY : {
- allocationRetry = elementAsLong(reader);
- break;
- }
- case BLOCKINGTIMEOUTMILLIS : {
- blockingTimeoutMillis = elementAsLong(reader);
- break;
- }
- case IDLETIMEOUTMINUTES : {
- idleTimeoutMinutes = elementAsLong(reader);
- break;
- }
- case XARESOURCETIMEOUT : {
- xaResourceTimeout = elementAsLong(reader);
- break;
- }
- default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
- }
- break;
- }
- }
- }
- throw new ParserException("Reached end of xml document unexpectedly");
- }
-
- private AdminObject parseAdminObjects(XMLStreamReader reader) throws XMLStreamException, ParserException
- {
- HashMap<String, String> configProperties = new HashMap<String, String>();
-
- //attributes reading
- boolean useJavaContext = false;
- String className = null;
- boolean enabled = true;
- String jndiName = null;
- String poolName = null;
-
- for (Attribute attribute : AdminObject.Attribute.values())
- {
- switch (attribute)
- {
- case ENABLED : {
- enabled = attributeAsBoolean(reader, attribute.getLocalName(), true);
- break;
- }
- case JNDINAME : {
- jndiName = attributeAsString(reader, attribute.getLocalName());
- break;
- }
- case CLASS_NAME : {
- className = attributeAsString(reader, attribute.getLocalName());
- break;
- }
- case USEJAVACONTEXT : {
- useJavaContext = attributeAsBoolean(reader, attribute.getLocalName(), false);
- break;
- }
- case POOL_NAME : {
- poolName = attributeAsString(reader, attribute.getLocalName());
- break;
- }
- default :
- throw new ParserException("Unexpected attribute:" + attribute.getLocalName() + "at " +
- reader.getLocalName());
- }
- }
-
- while (reader.hasNext())
- {
- switch (reader.nextTag())
- {
- case END_ELEMENT : {
- if (ResourceAdapter.Tag.forName(reader.getLocalName()) == ResourceAdapter.Tag.ADMIN_OBJECT)
- {
-
- return new AdminObjectImpl(configProperties, className, jndiName, poolName, enabled,
- useJavaContext);
- }
- else
- {
- if (AdminObject.Tag.forName(reader.getLocalName()) == AdminObject.Tag.UNKNOWN)
- {
- throw new ParserException("unexpected end tag" + reader.getLocalName());
- }
- }
- break;
- }
- case START_ELEMENT : {
- switch (AdminObject.Tag.forName(reader.getLocalName()))
- {
- case CONFIG_PROPERTY : {
- configProperties.put(attributeAsString(reader, "name"), elementAsString(reader));
- break;
- }
- default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
- }
- break;
- }
- }
- }
- throw new ParserException("Reached end of xml document unexpectedly");
- }
-
/**
*
* A Tag.
Added: projects/jboss-jca/trunk/common/src/main/resources/schema/ironjacamar_1_0.xsd
===================================================================
--- projects/jboss-jca/trunk/common/src/main/resources/schema/ironjacamar_1_0.xsd (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/resources/schema/ironjacamar_1_0.xsd 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:complexType name="boolean-presenceType"></xs:complexType>
+ <xs:complexType name="config-propertyType" mixed="true">
+ <xs:simpleContent>
+ <xs:extension base="xs:token">
+ <xs:attribute use="required" name="name" type="xs:token"></xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="ironjacamarType">
+ <xs:sequence>
+ <xs:element name="config-property" type="config-propertyType" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ The config-property specifies a mannaged connection factory property.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="bean-validation-groups" type="bean-validation-groupsType" minOccurs="0" maxOccurs="1"></xs:element>
+ <xs:element name="bootstrap-context" type="xs:token" minOccurs="0" maxOccurs="1"></xs:element>
+ <xs:element name="transaction-support" type="transaction-supportType" minOccurs="0"></xs:element>
+ <xs:element name="connection-definitions" type="connection-definitionsType" minOccurs="0" maxOccurs="1"></xs:element>
+ <xs:element name="admin-objects" type="admin-objectsType" minOccurs="0" maxOccurs="1"></xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="transaction-supportType">
+ <xs:annotation>
+ <xs:documentation> Define the typoe of transaction supported by this respurce adapter. It overrides/selects
+ connection manager one valid value are: NoTransaction, LocalTransaction, XA</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="NoTransaction" />
+ <xs:enumeration value="LocalTransaction" />
+ <xs:enumeration value="XATransaction" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:attributeGroup name="common-attribute">
+ <xs:attribute name="class-name" type="xs:token" use="optional"></xs:attribute>
+ <xs:attribute name="jndi-name" type="xs:token" use="required" />
+ <xs:attribute name="enabled" type="xs:boolean" default="true" form="unqualified" use="optional" />
+ <xs:attribute default="false" name="use-java-context" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ Setting this to false will bind the DataSource into global jndi
+ Ex:
+ <use-java-context>false</use-java-context>
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="pool-name" type="xs:token" use="optional"></xs:attribute>
+ </xs:attributeGroup>
+ <xs:complexType name="admin-objectType">
+ <xs:sequence>
+ <xs:element name="config-property" type="config-propertyType" minOccurs="0" maxOccurs="unbounded"></xs:element>
+ </xs:sequence>
+ <xs:attributeGroup ref="common-attribute"></xs:attributeGroup>
+ </xs:complexType>
+ <xs:complexType name="time-outType">
+ <xs:sequence>
+ <xs:element name="blocking-timeout-millis" type="xs:nonNegativeInteger" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ The blocking-timeout-millis element indicates the maximum time in
+ milliseconds to block while waiting for a connection before throwing an exception.
+ Note that this blocks only while waiting for a permit for a connection, and
+ will never throw an exception if creating a new connection takes an inordinately
+ long time. The default is 30000 (30 seconds).
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="idle-timeout-minutes" type="xs:nonNegativeInteger" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ The idle-timeout-minutes elements indicates the maximum time in minutes
+ a connection may be idle before being closed. The actual maximum time depends
+ also on the IdleRemover scan time, which is 1/2 the smallest idle-timeout-minutes
+ of any pool.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="allocation-retry" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ The allocation retry element indicates the number of times that allocating
+ a connection should be tried before throwing an exception. The default is
+ 0.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="allocation-retry-wait-millis" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ The allocation retry wait millis element indicates the time in milliseconds
+ to wait between retrying to allocate a connection. The default is 5000 (5
+ seconds).
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="xa-resource-timeout" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation><![CDATA[[
+ EXPRESSED IN SECONDS
+ Passed to XAResource.setTransactionTimeout()
+ Default is zero which does not invoke the setter
+ e.g. 5 minutes
+ <xa-resource-timeout>300</xa-resource-timeout>]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="validationType">
+ <xs:sequence>
+ <xs:element name="background-validation" type="xs:boolean" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ An element to specify that connections should be validated on a background
+ thread versus being validated prior to use
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="background-validation-minutes" type="xs:nonNegativeInteger" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ The background-validation-minutes element specifies the amount of
+ time, in minutes, that background validation will run.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="use-fast-fail" type="xs:boolean" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ Whether fail a connection allocation on the first connection if it
+ is invalid (true) or keep trying until the pool is exhausted of all potential
+ connections (false) default false. e.g. <use-fast-fail>true</use-fast-fail>
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="connection-definitionsType">
+ <xs:sequence>
+ <xs:element name="connection-definition" type="connection-defintionType" minOccurs="1" maxOccurs="unbounded"></xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="connection-defintionType">
+ <xs:sequence>
+ <xs:element name="config-property" type="config-propertyType" minOccurs="0" maxOccurs="unbounded"></xs:element>
+ <xs:element name="no-tx-separate-pools" type="boolean-presenceType" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ Whether to use separete pools for connection retrieved in a transaction
+ and those retieved outside a transaction e.g. <no-tx-separate-pools/>
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="pool" type="poolType" minOccurs="0" maxOccurs="1"></xs:element>
+ <xs:element name="security" type="securityType" minOccurs="0" maxOccurs="1"></xs:element>
+ <xs:element name="timeout" type="time-outType" minOccurs="0" maxOccurs="1"></xs:element>
+ <xs:element name="vaidation" type="validationType" minOccurs="0" maxOccurs="1"></xs:element>
+ </xs:sequence>
+ <xs:attributeGroup ref="common-attribute"></xs:attributeGroup>
+ </xs:complexType>
+ <xs:complexType name="poolType">
+ <xs:sequence>
+ <xs:element name="min-pool-size" type="xs:nonNegativeInteger" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ The min-pool-size element indicates the minimum number of connections
+ a pool should hold. These are not created until a Subject is known from a
+ request for a connection. This default to 0. Ex: <min-pool-size>1</min-pool-size>
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="max-pool-size" type="xs:nonNegativeInteger" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ The max-pool-size element indicates the maximum number of connections
+ for a pool. No more than MaxSize connections will be created in each sub-pool.
+ This defaults to 20.
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="prefill" type="xs:boolean" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ Whether to attempt to prefill the connection pool. Empty element denotes
+ a true value. e.g. <prefill>true</prefill>.
+ Default is true
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="use-strict-min" type="xs:boolean" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ Define if the min-pool-size should be considered a strictly.
+ Default false
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="securityType">
+ <xs:sequence>
+ <xs:element name="user-name" type="xs:token" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ Specify the default username used when creating a new connection.
+ Ex: <user-name>sa</user-name>
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="password" type="xs:token" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ Specify the default password used when creating a new connection.
+ Ex: <password>sa-pass</password>]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="admin-objectsType">
+ <xs:sequence>
+ <xs:element name="admin-object" type="admin-objectType" minOccurs="0" maxOccurs="unbounded"></xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="bean-validation-groupsType">
+ <xs:sequence>
+ <xs:element name="bean-validation-group" type="xs:token" minOccurs="1" maxOccurs="unbounded"></xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="ironjacamar" type="resource-adapterType"></xs:element>
+</xs:schema>
\ No newline at end of file
Added: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,77 @@
+/*
+ * 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.ironjacamar;
+
+import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.jboss.util.file.FilenamePrefixFilter;
+
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ *
+ * A IronJacamarParserTestCase.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class IronJacamarParserTestCase
+{
+ /**
+ * shouldParseAnyExample
+ * @throws Exception in case of error
+ */
+ @Test
+ public void shouldParseAnyExample() throws Exception
+ {
+ FileInputStream is = null;
+
+ //given
+ File directory = new File(Thread.currentThread().getContextClassLoader().getResource("ironjacamar").toURI());
+ for (File xmlFile : directory.listFiles(new FilenamePrefixFilter("ironjacamar-")))
+ {
+ System.out.println(xmlFile.getName());
+ try
+ {
+ is = new FileInputStream(xmlFile);
+ IronJacamarParser parser = new IronJacamarParser();
+ //when
+ IronJacamar ij = parser.parse(is);
+ //then
+ assertThat(ij.getConnectionDefinitions().size() >= 1, is(true));
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+ }
+ }
+
+}
Added: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/package.html
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/package.html (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/package.html 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,3 @@
+<body>
+This package contains ironjacamar parser tet cases
+</body>
Added: projects/jboss-jca/trunk/common/src/test/resources/ironjacamar/ironjacamar-test1.xml
===================================================================
--- projects/jboss-jca/trunk/common/src/test/resources/ironjacamar/ironjacamar-test1.xml (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/resources/ironjacamar/ironjacamar-test1.xml 2010-09-08 11:25:27 UTC (rev 108036)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ironjacamar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="../../../main/resources/schema/ironjacamar_1_0.xsd">
+ <transaction-support>NoTransaction</transaction-support>
+ <connection-definitions>
+ <connection-definition class-name="token" enabled="true" jndi-name="aSAPXcess" pool-name="aSAPXcess">
+ <config-property name="LogConfigFile">ASAP_SAP_1_0.xml</config-property>
+ <config-property name="RootLogContext">ASAP_SAP_1_0</config-property>
+ <config-property name="LogLevel">WARN</config-property>
+ <config-property name="MessageBundleBase">ASAP_SAP_1_0</config-property>
+ <config-property name="LanguageCode">en</config-property>
+ <config-property name="CountryCode">US</config-property>
+ <config-property name="UserName"></config-property>
+ <config-property name="Password"></config-property>
+ <config-property name="ClientNumber"></config-property>
+ <config-property name="ServerName"></config-property>
+ <config-property name="SystemNumber"></config-property>
+ <config-property name="GatewayServerName"></config-property>
+ <config-property name="GatewayServiceNumber"></config-property>
+ <config-property name="SystemName"></config-property>
+ <config-property name="MessageServerName"></config-property>
+ <config-property name="GroupName"></config-property>
+ <config-property name="ConnectionURL"></config-property>
+ <pool>
+ <min-pool-size>0</min-pool-size>
+ <max-pool-size>64</max-pool-size>
+ </pool>
+ <security>
+ <user-name>aaa</user-name>
+ <password>bbb</password>
+ </security>
+ <timeout>
+ <blocking-timeout-millis>5000</blocking-timeout-millis>
+ <idle-timeout-minutes>15</idle-timeout-minutes>
+ </timeout>
+ </connection-definition>
+ </connection-definitions>
+ <admin-objects>
+ <admin-object class-name="token" enabled="true" jndi-name="token" use-java-context="false">
+ <config-property name="token" />
+ </admin-object>
+ </admin-objects>
+</ironjacamar>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list