[jboss-cvs] JBossAS SVN: r108512 - in projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata: ds and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 11 16:39:40 EDT 2010
Author: maeste
Date: 2010-10-11 16:39:39 -0400 (Mon, 11 Oct 2010)
New Revision: 108512
Modified:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataParser.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParser.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/RaParser.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParser.java
Log:
adding a method parse(XMLStreamreader) for AS subsystem parser
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataParser.java 2010-10-11 17:55:14 UTC (rev 108511)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataParser.java 2010-10-11 20:39:39 UTC (rev 108512)
@@ -25,6 +25,8 @@
import java.io.InputStream;
+import javax.xml.stream.XMLStreamReader;
+
/**
*
* A MetadataParser.
@@ -45,4 +47,13 @@
*/
public T parse(InputStream xmlInputStream) throws Exception;
+ /**
+ * Parse the xml file and return the JCAMetaData for which the concrete parser is designed.
+ * Note that is responsibility of the client to open and close the stream
+ * @param reader an XMLStreamReader opened on the xml file to parse
+ * @return The metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ public T parse(XMLStreamReader reader) throws Exception;
+
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java 2010-10-11 17:55:14 UTC (rev 108511)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java 2010-10-11 20:39:39 UTC (rev 108512)
@@ -65,12 +65,20 @@
{
XMLStreamReader reader = null;
+
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ reader = inputFactory.createXMLStreamReader(xmlInputStream);
+ return parse(reader);
+ }
+
+ @Override
+ public DataSources parse(XMLStreamReader reader) throws Exception
+ {
+
DataSources dataSources = null;
try
{
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- reader = inputFactory.createXMLStreamReader(xmlInputStream);
//iterate over tags
int iterate;
@@ -346,11 +354,10 @@
if (DataSources.Tag.forName(reader.getLocalName()) == DataSources.Tag.DATASOURCE)
{
- return new DataSourceImpl(connectionUrl, driverClass, transactionIsolation,
- connectionProperties, timeOutSettings, securitySettings,
- statementSettings, validationSettings, urlDelimiter,
- urlSelectorStrategyClassName, newConnectionSql, useJavaContext,
- poolName, enabled, jndiName, pool);
+ return new DataSourceImpl(connectionUrl, driverClass, transactionIsolation, connectionProperties,
+ timeOutSettings, securitySettings, statementSettings, validationSettings,
+ urlDelimiter, urlSelectorStrategyClassName, newConnectionSql,
+ useJavaContext, poolName, enabled, jndiName, pool);
}
else
{
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParser.java 2010-10-11 17:55:14 UTC (rev 108511)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParser.java 2010-10-11 20:39:39 UTC (rev 108512)
@@ -56,13 +56,19 @@
{
XMLStreamReader reader = null;
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ reader = inputFactory.createXMLStreamReader(xmlInputStream);
+ return parse(reader);
+ }
+
+ @Override
+ public IronJacamar parse(XMLStreamReader reader) throws Exception
+ {
+
IronJacamar ironJacamar = null;
try
{
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- reader = inputFactory.createXMLStreamReader(xmlInputStream);
-
//iterate over tags
int iterate;
try
@@ -107,8 +113,6 @@
}
-
-
private IronJacamar parseIronJacamar(XMLStreamReader reader) throws XMLStreamException, ParserException
{
ArrayList<CommonConnDef> connectionDefinitions = null;
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/RaParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/RaParser.java 2010-10-11 17:55:14 UTC (rev 108511)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/RaParser.java 2010-10-11 20:39:39 UTC (rev 108512)
@@ -82,9 +82,6 @@
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-
-
/**
*
* A RaParser.
@@ -99,14 +96,19 @@
public Connector parse(InputStream xmlInputStream) throws Exception
{
XMLStreamReader reader = null;
+
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ reader = inputFactory.createXMLStreamReader(xmlInputStream);
+ return parse(reader);
+ }
+
+ @Override
+ public Connector parse(XMLStreamReader reader) throws Exception
+ {
Connector connector = null;
try
{
-
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- reader = inputFactory.createXMLStreamReader(xmlInputStream);
-
//iterate over tags
int iterate;
try
@@ -203,8 +205,8 @@
description.trimToSize();
//building and returning object
- return new Connector10Impl(moduleName, vendorName, eisType,
- resourceadapterVersion, license, resourceadapter, description, displayName, icon, id);
+ return new Connector10Impl(moduleName, vendorName, eisType, resourceadapterVersion, license,
+ resourceadapter, description, displayName, icon, id);
}
else
@@ -293,7 +295,7 @@
//building and returning object
return new Connector15Impl(vendorName, eisType, resourceadapterVersion, license, resourceadapter,
- description, displayName, icon, id);
+ description, displayName, icon, id);
}
else
@@ -353,7 +355,7 @@
private Connector parseConnector16(XMLStreamReader reader) throws XMLStreamException, ParserException
{
boolean metadataComplete = Boolean.valueOf(reader.getAttributeValue(null,
- Connector16.Attribute.METADATA_COMPLETE.getLocalName()));;
+ Connector16.Attribute.METADATA_COMPLETE.getLocalName()));;
LicenseType license = null;
String id = reader.getAttributeValue(null, Connector16.Attribute.ID.getLocalName());;
ArrayList<Icon> icon = new ArrayList<Icon>();
@@ -380,7 +382,8 @@
requiredWorkContext.trimToSize();
//building and returning object
return new Connector16Impl(moduleName, vendorName, eisType, resourceadapterVersion, license,
- resourceadapter, requiredWorkContext, metadataComplete, description, displayName, icon, id);
+ resourceadapter, requiredWorkContext, metadataComplete, description,
+ displayName, icon, id);
}
else
@@ -498,7 +501,8 @@
throw new ParserException("Reached end of xml document unexpectedly");
}
- private ResourceAdapter1516 parseResourceAdapter(XMLStreamReader reader) throws XMLStreamException, ParserException
+ private ResourceAdapter1516 parseResourceAdapter(XMLStreamReader reader) throws XMLStreamException,
+ ParserException
{
ArrayList<ConfigProperty> configProperty = new ArrayList<ConfigProperty>();
String resourceadapterClass = null;
@@ -521,7 +525,7 @@
//building and returning object
return new ResourceAdapter1516Impl(resourceadapterClass, configProperty, outboundResourceadapter,
- inboundResourceadapter, adminobject, securityPermission, id);
+ inboundResourceadapter, adminobject, securityPermission, id);
}
else
@@ -573,7 +577,8 @@
throw new ParserException("Reached end of xml document unexpectedly");
}
- private ResourceAdapter10 parseResourceAdapter10(XMLStreamReader reader) throws XMLStreamException, ParserException
+ private ResourceAdapter10 parseResourceAdapter10(XMLStreamReader reader) throws XMLStreamException,
+ ParserException
{
XsdString managedConnectionFactoryClass = NULL_XSDSTRING;
XsdString connectionFactoryInterface = NULL_XSDSTRING;
@@ -600,8 +605,9 @@
//building and returning object
return new ResourceAdapter10Impl(managedConnectionFactoryClass, connectionFactoryInterface,
- connectionFactoryImplClass, connectionInterface, connectionImplClass, transactionSupport,
- authenticationMechanism, configProperties, reauthenticationSupport, securityPermission, id);
+ connectionFactoryImplClass, connectionInterface,
+ connectionImplClass, transactionSupport, authenticationMechanism,
+ configProperties, reauthenticationSupport, securityPermission, id);
}
else
@@ -680,8 +686,7 @@
switch (reader.nextTag())
{
case END_ELEMENT : {
- if (ResourceAdapter1516.Tag.
- forName(reader.getLocalName()) == ResourceAdapter1516.Tag.INBOUND_RESOURCEADAPTER)
+ if (ResourceAdapter1516.Tag.forName(reader.getLocalName()) == ResourceAdapter1516.Tag.INBOUND_RESOURCEADAPTER)
{
//building and returning object
@@ -725,8 +730,7 @@
switch (reader.nextTag())
{
case END_ELEMENT : {
- if (InboundResourceAdapter.Tag.
- forName(reader.getLocalName()) == InboundResourceAdapter.Tag.MESSAGEADAPTER)
+ if (InboundResourceAdapter.Tag.forName(reader.getLocalName()) == InboundResourceAdapter.Tag.MESSAGEADAPTER)
{
//trimming collections
messagelistener.trimToSize();
@@ -948,8 +952,7 @@
switch (reader.nextTag())
{
case END_ELEMENT : {
- if (ResourceAdapter1516.Tag.
- forName(reader.getLocalName()) == ResourceAdapter1516.Tag.OUTBOUND_RESOURCEADAPTER)
+ if (ResourceAdapter1516.Tag.forName(reader.getLocalName()) == ResourceAdapter1516.Tag.OUTBOUND_RESOURCEADAPTER)
{
//trimming collections
@@ -958,8 +961,7 @@
//building and returning object
return new OutboundResourceAdapterImpl(connectionDefinition, transactionSupport,
- authenticationMechanism,
- reauthenticationSupport, id);
+ authenticationMechanism, reauthenticationSupport, id);
}
else
@@ -1017,8 +1019,7 @@
switch (reader.nextTag())
{
case END_ELEMENT : {
- if (OutboundResourceAdapter.Tag.
- forName(reader.getLocalName()) == OutboundResourceAdapter.Tag.CONNECTION_DEFINITION)
+ if (OutboundResourceAdapter.Tag.forName(reader.getLocalName()) == OutboundResourceAdapter.Tag.CONNECTION_DEFINITION)
{
//trimming collections
@@ -1026,8 +1027,8 @@
//building and returning object
return new ConnectionDefinitionImpl(managedconnectionfactoryClass, configProperty,
- connectionfactoryInterface, connectionfactoryImplClass, connectionInterface,
- connectionImplClass, id);
+ connectionfactoryInterface, connectionfactoryImplClass,
+ connectionInterface, connectionImplClass, id);
}
else
@@ -1091,8 +1092,7 @@
switch (reader.nextTag())
{
case END_ELEMENT : {
- if (OutboundResourceAdapter.Tag.
- forName(reader.getLocalName()) == OutboundResourceAdapter.Tag.AUTHENTICATION_MECHANISM)
+ if (OutboundResourceAdapter.Tag.forName(reader.getLocalName()) == OutboundResourceAdapter.Tag.AUTHENTICATION_MECHANISM)
{
//trimming collections
@@ -1100,8 +1100,8 @@
//building and returning object
- return new AuthenticationMechanismImpl(description, authenticationMechanismType, credentialInterface,
- id);
+ return new AuthenticationMechanismImpl(description, authenticationMechanismType,
+ credentialInterface, id);
}
else
@@ -1220,17 +1220,18 @@
//building and returning object
- if (configPropertyIgnore != null || configPropertySupportsDynamicUpdates != null
- || configPropertyConfidential != null)
+ if (configPropertyIgnore != null || configPropertySupportsDynamicUpdates != null ||
+ configPropertyConfidential != null)
{
return new ConfigProperty16Impl(description, configPropertyName, configPropertyType,
- configPropertyValue,
- configPropertyIgnore, configPropertySupportsDynamicUpdates, configPropertyConfidential, id);
+ configPropertyValue, configPropertyIgnore,
+ configPropertySupportsDynamicUpdates,
+ configPropertyConfidential, id);
}
else
{
return new ConfigPropertyImpl(description, configPropertyName, configPropertyType,
- configPropertyValue, id);
+ configPropertyValue, id);
}
}
@@ -1298,8 +1299,7 @@
switch (reader.nextTag())
{
case END_ELEMENT : {
- if (ResourceAdapter1516.Tag.
- forName(reader.getLocalName()) == ResourceAdapter1516.Tag.SECURITY_PERMISSION)
+ if (ResourceAdapter1516.Tag.forName(reader.getLocalName()) == ResourceAdapter1516.Tag.SECURITY_PERMISSION)
{
//trimming collections
description.trimToSize();
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-10-11 17:55:14 UTC (rev 108511)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParser.java 2010-10-11 20:39:39 UTC (rev 108512)
@@ -51,7 +51,6 @@
*/
public class ResourceAdapterParser extends CommonIronJacamarParser implements MetadataParser<ResourceAdapters>
{
-
@Override
public ResourceAdapters parse(InputStream xmlInputStream) throws Exception
{
@@ -59,10 +58,19 @@
XMLStreamReader reader = null;
ResourceAdapters adapters = null;
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ reader = inputFactory.createXMLStreamReader(xmlInputStream);
+ return parse(reader);
+ }
+
+ @Override
+ public ResourceAdapters parse(XMLStreamReader reader) throws Exception
+ {
+
+ ResourceAdapters adapters = null;
+
try
{
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- reader = inputFactory.createXMLStreamReader(xmlInputStream);
//iterate over tags
int iterate;
@@ -108,8 +116,7 @@
}
- private ResourceAdapters parseResourceAdapters(XMLStreamReader reader) throws XMLStreamException,
- ParserException
+ private ResourceAdapters parseResourceAdapters(XMLStreamReader reader) throws XMLStreamException, ParserException
{
ArrayList<ResourceAdapter> resourceAdapters = new ArrayList<ResourceAdapter>();
while (reader.hasNext())
More information about the jboss-cvs-commits
mailing list