[jboss-cvs] JBossAS SVN: r111526 - in projects/jboss-jca/trunk: common/src/main/java/org/jboss/jca/common/annotations and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jun 6 14:48:09 EDT 2011
Author: jesper.pedersen
Date: 2011-06-06 14:48:08 -0400 (Mon, 06 Jun 2011)
New Revision: 111526
Added:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/CommonBundle.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreBundle.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/DeployersBundle.java
Modified:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.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/CommonPoolImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonSecurityImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonTimeOutImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DriverImpl.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/ds/StatementImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/TimeOutImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/ValidationImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.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/ra/common/ConnectorAbstractmpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ResourceAdapter1516Impl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/ra10/ResourceAdapter10Impl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParser.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
Log:
[JBJCA-592] Message bundles for common and deployers
Added: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/CommonBundle.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/CommonBundle.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/CommonBundle.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -0,0 +1,242 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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;
+
+import org.jboss.logging.MessageBundle;
+import org.jboss.logging.Message;
+
+/**
+ * The common bundle.
+ *
+ * Message ids ranging from 05001 to 10000 inclusively.
+ */
+ at MessageBundle(projectCode = "IJ")
+public interface CommonBundle
+{
+ /**
+ * Annotation repository is null
+ * @return The value
+ */
+ @Message(id = 5005, value = "AnnotationRepository reference is null")
+ public String annotationRepositoryNull();
+
+ /**
+ * No @Connector defined
+ * @return The value
+ */
+ @Message(id = 5006, value = "No @Connector defined")
+ public String noConnectorDefined();
+
+ /**
+ * More than @Connector defined
+ * @return The value
+ */
+ @Message(id = 5007, value = "More than @Connector defined")
+ public String moreThanOneConnectorDefined();
+
+ /**
+ * More than one @ConnectionDefinitions defined
+ * @return The value
+ */
+ @Message(id = 5008, value = "More than one @ConnectionDefinitions defined")
+ public String moreThanOneConnectionDefinitionsDefined();
+
+ /**
+ * Unknown annotation
+ * @param annotation The annotation
+ * @return The value
+ */
+ @Message(id = 5009, value = "Unknown annotation: %s")
+ public String unknownAnnotation(Object annotation);
+
+ /**
+ * Element as boolean
+ * @param value The value
+ * @param element The element
+ * @return The value
+ */
+ @Message(id = 5010, value = "%s isn't a valid boolean for element %s. " +
+ "We accept only \"true\" or \"false\" as boolean value")
+ public String elementAsBoolean(String value, String element);
+
+ /**
+ * Attribute as boolean
+ * @param value The value
+ * @param element The element
+ * @return The value
+ */
+ @Message(id = 5011, value = "%s isn't a valid boolean for attribute %s. " +
+ "We accept only \"true\" or \"false\" as boolean value")
+ public String attributeAsBoolean(String value, String element);
+
+ /**
+ * Not a valid number
+ * @param value The value
+ * @param element The element
+ * @return The value
+ */
+ @Message(id = 5012, value = "%s isn't a valid number for element %s")
+ public String notValidNumber(String value, String element);
+
+ /**
+ * Not a valid flush strategy
+ * @param value The value
+ * @return The value
+ */
+ @Message(id = 5013, value = "%s isn't a valid flush strategy")
+ public String notValidFlushStrategy(String value);
+
+ /**
+ * Unexpected end tag
+ * @param value The value
+ * @return The value
+ */
+ @Message(id = 5014, value = "Unexpected end tag: %s")
+ public String unexpectedEndTag(String value);
+
+ /**
+ * Unexpected element
+ * @param value The value
+ * @return The value
+ */
+ @Message(id = 5015, value = "Unexpected element: %s")
+ public String unexpectedElement(String value);
+
+ /**
+ * Unexpected end of document
+ * @return The value
+ */
+ @Message(id = 5016, value = "Reached end of xml document unexpectedly")
+ public String unexpectedEndOfDocument();
+
+ /**
+ * Missing class name
+ * @param value The value
+ * @return The value
+ */
+ @Message(id = 5017, value = "Mandatory class-name attribute missing in: %s")
+ public String missingClassName(String value);
+
+ /**
+ * Unexpected attribute
+ * @param value The value
+ * @param location The location
+ * @return The value
+ */
+ @Message(id = 5018, value = "Unexpected attribute %s at %s")
+ public String unexpectedAttribute(String value, String location);
+
+ /**
+ * Missing jndi name
+ * @param value The value
+ * @return The value
+ */
+ @Message(id = 5019, value = "Missing jndi-name mandatory attribute: %s")
+ public String missingJndiName(String value);
+
+ /**
+ * Multiple pools
+ * @return The value
+ */
+ @Message(id = 5020, value = "You cannot define more than one pool or xa-pool in same connection-definition")
+ public String multiplePools();
+
+ /**
+ * Unsupported element
+ * @param value The value
+ * @return The value
+ */
+ @Message(id = 5021, value = "Element %s cannot be set without an xa-pool")
+ public String unsupportedElement(String value);
+
+ /**
+ * Required attribute
+ * @param attr The attribute
+ * @param tag The tag
+ * @return The value
+ */
+ @Message(id = 5022, value = "Missing required attribute %s in %s")
+ public String requiredAttributeMissing(String attr, String tag);
+
+ /**
+ * Required element
+ * @param element The element
+ * @param tag The tag
+ * @return The value
+ */
+ @Message(id = 5023, value = "Missing required element %s in %s")
+ public String requiredElementMissing(String element, String tag);
+
+ /**
+ * Invalid negative
+ * @param tag The tag
+ * @return The value
+ */
+ @Message(id = 5024, value = "Invalid negative value for %s")
+ public String invalidNegative(String tag);
+
+ /**
+ * Invalid tag
+ * @param tag The tag
+ * @return The value
+ */
+ @Message(id = 5025, value = "%s is not valid. See exception for more details")
+ public String invalidTag(String tag);
+
+ /**
+ * Null value
+ * @param tag The tag
+ * @return The value
+ */
+ @Message(id = 5026, value = "%s cannot be undefined")
+ public String nullValue(String tag);
+
+ /**
+ * Invalid security configuration
+ * @return The value
+ */
+ @Message(id = 5027, value = "Invalid <security> configuration")
+ public String invalidSecurityConfiguration();
+
+ /**
+ * Resource adapter not defined
+ * @return The value
+ */
+ @Message(id = 5028, value = "The resource adapter metadata must be defined")
+ public String noMetadataForResourceAdapter();
+
+ /**
+ * Invalid metadata for resource adapter
+ * @return The value
+ */
+ @Message(id = 5029, value = "The resource adapter metadata must contain either an outbound or inbound configuration")
+ public String invalidMetadataForResourceAdapter();
+
+ /**
+ * Missing value
+ * @param tag The tag
+ * @return The value
+ */
+ @Message(id = 5030, value = "%s must be defined")
+ public String missingValue(String tag);
+}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -22,6 +22,7 @@
package org.jboss.jca.common.annotations;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.CommonLogger;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
import org.jboss.jca.common.api.metadata.ra.AdminObject;
@@ -79,6 +80,7 @@
import javax.resource.spi.work.WorkContext;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
/**
* The annotation processor for JCA 1.6
@@ -87,6 +89,7 @@
*/
public class Annotations
{
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
private static CommonLogger log = Logger.getMessageLogger(CommonLogger.class, Annotations.class.getName());
private static boolean trace = log.isTraceEnabled();
@@ -157,7 +160,7 @@
throws Exception
{
if (annotationRepository == null)
- throw new ValidateException("AnnotationRepository reference is null");
+ throw new ValidateException(bundle.annotationRepositoryNull());
/* Process
-------
javax.resource.spi.Activation
@@ -248,7 +251,7 @@
if (xmlResourceAdapterClass == null || xmlResourceAdapterClass.equals(""))
{
log.noConnector();
- throw new ValidateException("No @Connector defined");
+ throw new ValidateException(bundle.noConnectorDefined());
}
}
else
@@ -257,7 +260,7 @@
if (xmlResourceAdapterClass == null || xmlResourceAdapterClass.equals(""))
{
log.moreThanOneConnector();
- throw new ValidateException("More than one @Connector defined");
+ throw new ValidateException(bundle.moreThanOneConnectorDefined());
}
}
}
@@ -474,7 +477,7 @@
configProperties);
}
else
- throw new ValidateException("More than one @ConnectionDefinitions defined");
+ throw new ValidateException(bundle.moreThanOneConnectionDefinitionsDefined());
}
return null;
@@ -945,7 +948,7 @@
}
}
- throw new IllegalArgumentException("Unknown annotation: " + annotation);
+ throw new IllegalArgumentException(bundle.unknownAnnotation(annotation));
}
/**
@@ -1020,6 +1023,6 @@
}
}
- throw new IllegalArgumentException("Unknown annotation: " + annotation);
+ throw new IllegalArgumentException(bundle.unknownAnnotation(annotation));
}
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.CommonLogger;
import org.jboss.jca.common.api.metadata.common.CommonPool;
import org.jboss.jca.common.api.metadata.common.CommonSecurity;
@@ -47,6 +48,7 @@
import javax.xml.stream.XMLStreamReader;
import org.jboss.logging.Logger;
+import org.jboss.logging.Messages;
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
@@ -63,6 +65,9 @@
/** The logger */
private static CommonLogger log = Logger.getMessageLogger(CommonLogger.class, AbstractParser.class.getName());
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
/**
* convert an xml element in boolean value. Empty elements results with true (tag presence is sufficient condition)
*
@@ -83,8 +88,7 @@
}
else
{
- throw new ParserException(elementtext + " isn't a valid boolean for element " + reader.getLocalName() +
- ". We accept only \"true\" or \"false\" as boolean value");
+ throw new ParserException(bundle.elementAsBoolean(elementtext, reader.getLocalName()));
}
}
@@ -113,11 +117,8 @@
}
else
{
- throw new ParserException(attributeString + " isn't a valid boolean for attribute " + attributeName +
- " of element " + reader.getLocalName() +
- ". We accept only \"true\" or \"false\" as boolean value");
+ throw new ParserException(bundle.attributeAsBoolean(attributeString, reader.getLocalName()));
}
-
}
/**
@@ -210,7 +211,7 @@
}
catch (NumberFormatException nfe)
{
- throw new ParserException(elementtext + " isn't a valid number for element " + reader.getLocalName());
+ throw new ParserException(bundle.notValidNumber(elementtext, reader.getLocalName()));
}
return integerValue;
}
@@ -235,7 +236,7 @@
}
catch (NumberFormatException nfe)
{
- throw new ParserException(elementtext + " isn't a valid number for element " + reader.getLocalName());
+ throw new ParserException(bundle.notValidNumber(elementtext, reader.getLocalName()));
}
return longValue;
@@ -257,7 +258,7 @@
if (result != FlushStrategy.UNKNOWN)
return result;
- throw new ParserException(elementtext + " isn't a valid flush strategy");
+ throw new ParserException(bundle.notValidFlushStrategy(elementtext));
}
/**
@@ -294,7 +295,7 @@
{
if (CommonPool.Tag.forName(reader.getLocalName()) == CommonPool.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -324,13 +325,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
/**
@@ -366,7 +367,7 @@
{
if (CommonSecurity.Tag.forName(reader.getLocalName()) == CommonSecurity.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -388,13 +389,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
/**
@@ -438,7 +439,7 @@
{
if (CommonXaPool.Tag.forName(reader.getLocalName()) == CommonXaPool.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -487,13 +488,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
/**
@@ -604,7 +605,7 @@
{
if (Credential.Tag.forName(reader.getLocalName()) == Credential.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -625,13 +626,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
@@ -679,7 +680,7 @@
{
if (Recovery.Tag.forName(reader.getLocalName()) == Recovery.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -697,13 +698,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
/**
@@ -747,8 +748,7 @@
{
if (className == null)
{
- throw new ParserException("mandatory class-name attribute missing in " +
- enclosingTag);
+ throw new ParserException(bundle.missingClassName(enclosingTag));
}
return new Extension(className, properties);
@@ -757,7 +757,7 @@
{
if (Extension.Tag.forName(reader.getLocalName()) == Extension.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -772,13 +772,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private static class SecurityActions
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarParser.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonIronJacamarParser.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.common;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
import org.jboss.jca.common.api.metadata.common.CommonConnDef;
import org.jboss.jca.common.api.metadata.common.CommonPool;
@@ -38,6 +39,8 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.jboss.logging.Messages;
+
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
@@ -50,6 +53,8 @@
*/
public abstract class CommonIronJacamarParser extends AbstractParser
{
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
/**
*
@@ -112,12 +117,11 @@
break;
}
default :
- throw new ParserException("Unexpected attribute:" + attribute.getLocalName() + "at " +
- reader.getLocalName());
+ throw new ParserException(bundle.unexpectedAttribute(attribute.getLocalName(), reader.getLocalName()));
}
}
if (jndiName == null || jndiName.trim().equals(""))
- throw new ParserException("Missing jndiName mandatory attribute");
+ throw new ParserException(bundle.missingJndiName(reader.getLocalName()));
while (reader.hasNext())
{
@@ -134,7 +138,7 @@
{
if (CommonConnDef.Tag.forName(reader.getLocalName()) == CommonConnDef.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -160,16 +164,14 @@
}
case XA_POOL : {
if (pool != null)
- throw new ParserException("You cannot define more than one pool or xa-poll in same"
- + " connection-definition");
+ throw new ParserException(bundle.multiplePools());
pool = parseXaPool(reader);
isXa = true;
break;
}
case POOL : {
if (pool != null)
- throw new ParserException("You cannot define more than one pool or xa-poll in same"
- + " connection-definition");
+ throw new ParserException(bundle.multiplePools());
pool = parsePool(reader);
break;
}
@@ -178,13 +180,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private CommonValidation parseValidation(XMLStreamReader reader) throws XMLStreamException, ParserException
@@ -207,7 +209,7 @@
{
if (CommonValidation.Tag.forName(reader.getLocalName()) == CommonValidation.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -228,13 +230,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private CommonTimeOut parseTimeOut(XMLStreamReader reader, boolean isXa) throws XMLStreamException,
@@ -261,7 +263,7 @@
{
if (CommonTimeOut.Tag.forName(reader.getLocalName()) == CommonTimeOut.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -287,19 +289,18 @@
}
case XARESOURCETIMEOUT : {
if (!isXa)
- throw new ParserException("Element:" + reader.getLocalName() +
- "cannot be set without an xa-pool");
+ throw new ParserException(bundle.unsupportedElement(reader.getLocalName()));
xaResourceTimeout = elementAsInteger(reader);
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
/**
@@ -352,12 +353,11 @@
break;
}
default :
- throw new ParserException("Unexpected attribute:" + attribute.getLocalName() + "at " +
- reader.getLocalName());
+ throw new ParserException(bundle.unexpectedAttribute(attribute.getLocalName(), reader.getLocalName()));
}
}
if (jndiName == null || jndiName.trim().equals(""))
- throw new ParserException("Missing jndiName mandatory attribute");
+ throw new ParserException(bundle.missingJndiName(reader.getLocalName()));
while (reader.hasNext())
{
@@ -374,7 +374,7 @@
{
if (CommonAdminObject.Tag.forName(reader.getLocalName()) == CommonAdminObject.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -387,13 +387,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonPoolImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonPoolImpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonPoolImpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,10 +21,13 @@
*/
package org.jboss.jca.common.metadata.common;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.CommonPool;
import org.jboss.jca.common.api.metadata.common.FlushStrategy;
import org.jboss.jca.common.api.validator.ValidateException;
+import org.jboss.logging.Messages;
+
/**
*
* A PoolImpl.
@@ -38,6 +41,9 @@
/** The serialVersionUID */
private static final long serialVersionUID = -8705723067326455982L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
/**
* minPoolSize
*/
@@ -145,10 +151,12 @@
public void validate() throws ValidateException
{
if (this.maxPoolSize != null && this.maxPoolSize < 0)
- throw new ValidateException("maxPoolSize (xml tag " + Tag.MAXPOOLSIZE + ") cannot be < 0");
+ throw new ValidateException(bundle.invalidNegative(Tag.MAXPOOLSIZE.getLocalName()));
+
if (this.minPoolSize != null && this.minPoolSize < 0)
- throw new ValidateException("minPoolSize (xml tag " + Tag.MIN_POOL_SIZE + ") cannot be < 0");
+ throw new ValidateException(bundle.invalidNegative(Tag.MIN_POOL_SIZE.getLocalName()));
+
if (this.flushStrategy == null)
- throw new ValidateException("flushStrategy (xml tag " + Tag.FLUSH_STRATEGY + ") cannot be null");
+ throw new ValidateException(bundle.nullValue(Tag.FLUSH_STRATEGY.getLocalName()));
}
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonSecurityImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonSecurityImpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonSecurityImpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,9 +21,11 @@
*/
package org.jboss.jca.common.metadata.common;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.CommonSecurity;
import org.jboss.jca.common.api.validator.ValidateException;
+import org.jboss.logging.Messages;
/**
*
@@ -34,10 +36,12 @@
*/
public class CommonSecurityImpl implements CommonSecurity
{
-
/** The serialVersionUID */
private static final long serialVersionUID = -5842402120520191086L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
private final String securityDomainManaged;
private final String securityDomainAndApplicationManaged;
@@ -152,15 +156,11 @@
{
if (securityDomainAndApplicationManaged != null && !securityDomainAndApplicationManaged.trim().equals(""))
{
- throw new ValidateException(
- "cannot construct a CommonSecurity having set both security-domain-managed "
- + "and security-domain-and-application-managed ");
+ throw new ValidateException(bundle.invalidSecurityConfiguration());
}
if (applicationManaged)
{
- throw new ValidateException(
- "cannot construct a CommonSecurity having set both security-domain-managed "
- + "and appliction-managed ");
+ throw new ValidateException(bundle.invalidSecurityConfiguration());
}
}
else
@@ -169,20 +169,14 @@
{
if (applicationManaged)
{
- throw new ValidateException(
- "cannot construct a CommonSecurity having set "
- + "both security-domain-and-application-managed "
- + "and appliction-managed ");
+ throw new ValidateException(bundle.invalidSecurityConfiguration());
}
}
else
{
if (!applicationManaged)
{
- throw new ValidateException(
- "cannot construct a CommonSecurity object with security-domain-managed "
- + "and security-domain-and-application-managed not set and "
- + "appliction-managed not set or false");
+ throw new ValidateException(bundle.invalidSecurityConfiguration());
}
}
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonTimeOutImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonTimeOutImpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonTimeOutImpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,9 +21,12 @@
*/
package org.jboss.jca.common.metadata.common;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.CommonTimeOut;
import org.jboss.jca.common.api.validator.ValidateException;
+import org.jboss.logging.Messages;
+
/**
*
* A TimeOutImpl.
@@ -33,10 +36,12 @@
*/
public class CommonTimeOutImpl implements CommonTimeOut
{
-
/** The serialVersionUID */
private static final long serialVersionUID = 7351813875143571341L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
/** blockingTimeoutMillis **/
protected final Long blockingTimeoutMillis;
@@ -202,19 +207,18 @@
private void partialCommonValidate() throws ValidateException
{
if (this.allocationRetry != null && this.allocationRetry < 0)
- throw new ValidateException("allocationRetry (xml attribure " + Tag.ALLOCATIONRETRY + ") cannot be < 0");
+ throw new ValidateException(bundle.invalidNegative(Tag.ALLOCATIONRETRY.getLocalName()));
+
if (this.blockingTimeoutMillis != null && this.blockingTimeoutMillis < 0)
- throw new ValidateException("blockingTimeoutMillis (xml attribure " + Tag.BLOCKINGTIMEOUTMILLIS +
- ") cannot be < 0");
+ throw new ValidateException(bundle.invalidNegative(Tag.BLOCKINGTIMEOUTMILLIS.getLocalName()));
+
if (this.allocationRetryWaitMillis != null && this.allocationRetryWaitMillis < 0)
- throw new ValidateException("allocationRetryWaitMillis (xml attribure " + Tag.ALLOCATIONRETRYWAITMILLIS +
- ") cannot be < 0");
+ throw new ValidateException(bundle.invalidNegative(Tag.ALLOCATIONRETRYWAITMILLIS.getLocalName()));
+
if (this.idleTimeoutMinutes != null && this.idleTimeoutMinutes < 0)
- throw new ValidateException("idleTimeoutMinutes (xml attribure " + Tag.IDLETIMEOUTMINUTES +
- ") cannot be < 0");
+ throw new ValidateException(bundle.invalidNegative(Tag.IDLETIMEOUTMINUTES.getLocalName()));
+
if (this.xaResourceTimeout != null && this.xaResourceTimeout < 0)
- throw new ValidateException("xaResourceTimeout (xml attribure " + Tag.XARESOURCETIMEOUT + ") cannot be < 0");
-
+ throw new ValidateException(bundle.invalidNegative(Tag.XARESOURCETIMEOUT.getLocalName()));
}
-
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.ds;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.ds.CommonDataSource;
import org.jboss.jca.common.api.metadata.ds.DataSource;
import org.jboss.jca.common.api.metadata.ds.DsSecurity;
@@ -30,6 +31,8 @@
import org.jboss.jca.common.api.metadata.ds.Validation;
import org.jboss.jca.common.api.validator.ValidateException;
+import org.jboss.logging.Messages;
+
/**
*
* A DataSourceAbstractImpl.
@@ -43,6 +46,9 @@
/** The serialVersionUID */
private static final long serialVersionUID = -5612846950298960159L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
/**
* transactionIsolation
*/
@@ -278,11 +284,11 @@
protected void partialCommonValidation() throws ValidateException
{
if (this.jndiName == null)
- throw new ValidateException("jndiName (xml attribure " + DataSource.Attribute.JNDINAME.getLocalName() +
- ") is required in " + this.getClass().getCanonicalName());
+ throw new ValidateException(bundle.requiredAttributeMissing(DataSource.Attribute.JNDINAME.getLocalName(),
+ this.getClass().getCanonicalName()));
if (this.poolName == null)
- throw new ValidateException("poolName (xml attribure " + DataSource.Attribute.POOL_NAME.getLocalName() +
- ") is required in " + this.getClass().getCanonicalName());
+ throw new ValidateException(bundle.requiredAttributeMissing(DataSource.Attribute.POOL_NAME.getLocalName(),
+ this.getClass().getCanonicalName()));
if (this.timeOut != null)
this.timeOut.validate();
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.ds;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.CommonPool;
import org.jboss.jca.common.api.metadata.ds.DataSource;
import org.jboss.jca.common.api.metadata.ds.DsSecurity;
@@ -34,6 +35,8 @@
import java.util.HashMap;
import java.util.Map;
+import org.jboss.logging.Messages;
+
/**
*
* A DataSourceImpl.
@@ -46,6 +49,9 @@
/** The serialVersionUID */
private static final long serialVersionUID = -5214100851560229431L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
private final boolean jta;
private final String connectionUrl;
@@ -301,14 +307,13 @@
public void validate() throws ValidateException
{
if (this.connectionUrl == null || this.connectionUrl.trim().length() == 0)
- throw new ValidateException("connectionUrl (xml tag " + Tag.CONNECTIONURL + ") is required in " +
- this.getClass().getCanonicalName());
+ throw new ValidateException(bundle.requiredElementMissing(Tag.CONNECTIONURL.getLocalName(),
+ this.getClass().getCanonicalName()));
+
if ((this.driverClass == null || this.driverClass.trim().length() == 0) &&
(this.driver == null || this.driver.trim().length() == 0))
- throw new ValidateException("driverClass (xml tag " + Tag.DRIVERCLASS + ") is required in " +
- this.getClass().getCanonicalName() + "if no driver (xml tag " + Tag.DRIVER +
- ") is not specified");
-
+ throw new ValidateException(bundle.requiredElementMissing(Tag.DRIVERCLASS.getLocalName(),
+ this.getClass().getCanonicalName()));
}
/**
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DriverImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DriverImpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DriverImpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,9 +21,12 @@
*/
package org.jboss.jca.common.metadata.ds;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.ds.Driver;
import org.jboss.jca.common.api.validator.ValidateException;
+import org.jboss.logging.Messages;
+
/**
*
* A DriverImpl.
@@ -33,10 +36,12 @@
*/
public class DriverImpl implements Driver
{
-
/** The serialVersionUID */
private static final long serialVersionUID = 6228505574424288182L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
private final String name;
private final Integer minorVersion;
@@ -129,8 +134,8 @@
public void validate() throws ValidateException
{
if (this.name == null || this.name.trim().length() == 0)
- throw new ValidateException("name (xml attribute " + Attribute.NAME + ") is required in " +
- this.getClass().getCanonicalName());
+ throw new ValidateException(bundle.requiredAttributeMissing(Attribute.NAME.getLocalName(),
+ this.getClass().getCanonicalName()));
}
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 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.ds;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.CommonPool;
import org.jboss.jca.common.api.metadata.common.CommonXaPool;
import org.jboss.jca.common.api.metadata.common.Extension;
@@ -50,6 +51,8 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.jboss.logging.Messages;
+
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
@@ -62,6 +65,8 @@
*/
public class DsParser extends AbstractParser implements MetadataParser<DataSources>
{
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
@Override
public DataSources parse(InputStream xmlInputStream) throws Exception
@@ -114,7 +119,7 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
@@ -148,7 +153,7 @@
{
if (DataSources.Tag.forName(reader.getLocalName()) == DataSources.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -169,20 +174,18 @@
break;
}
case DRIVER : {
-// if (!driversMatched)
-// throw new ParserException("Unexpected element:" + reader.getLocalName());
Driver driver = parseDriver(reader);
drivers.put(driver.getName(), driver);
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private Driver parseDriver(XMLStreamReader reader) throws XMLStreamException, ParserException,
@@ -240,7 +243,7 @@
{
if (Driver.Tag.forName(reader.getLocalName()) == Driver.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -257,13 +260,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private XaDataSource parseXADataSource(XMLStreamReader reader) throws XMLStreamException, ParserException,
@@ -345,7 +348,7 @@
{
if (XaDataSource.Tag.forName(reader.getLocalName()) == XaDataSource.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -406,13 +409,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private DsSecurity parseDsSecurity(XMLStreamReader reader) throws XMLStreamException, ParserException,
@@ -438,7 +441,7 @@
{
if (DsSecurity.Tag.forName(reader.getLocalName()) == DsSecurity.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -464,13 +467,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private DataSource parseDataSource(XMLStreamReader reader) throws XMLStreamException, ParserException,
@@ -555,7 +558,7 @@
{
if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -616,13 +619,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private Validation parseValidationSetting(XMLStreamReader reader) throws XMLStreamException, ParserException,
@@ -654,7 +657,7 @@
{
if (Validation.Tag.forName(reader.getLocalName()) == Validation.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -696,13 +699,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private TimeOut parseTimeOutSettings(XMLStreamReader reader) throws XMLStreamException, ParserException,
@@ -734,7 +737,7 @@
{
if (TimeOut.Tag.forName(reader.getLocalName()) == TimeOut.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -775,13 +778,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private Statement parseStatementSettings(XMLStreamReader reader) throws XMLStreamException, ParserException,
@@ -806,7 +809,7 @@
{
if (Statement.Tag.forName(reader.getLocalName()) == Statement.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -829,13 +832,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
/**
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/StatementImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/StatementImpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/StatementImpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,9 +21,12 @@
*/
package org.jboss.jca.common.metadata.ds;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.ds.Statement;
import org.jboss.jca.common.api.validator.ValidateException;
+import org.jboss.logging.Messages;
+
/**
*
* A StatementImpl.
@@ -33,10 +36,12 @@
*/
public class StatementImpl implements Statement
{
-
/** The serialVersionUID */
private static final long serialVersionUID = 3361665706947342366L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
private final Boolean sharePreparedStatements;
private final Long preparedStatementsCacheSize;
@@ -146,8 +151,7 @@
public void validate() throws ValidateException
{
if (this.preparedStatementsCacheSize != null && this.preparedStatementsCacheSize < 0)
- throw new ValidateException("preparedStatementsCacheSize (xml attribure " + Tag.PREPAREDSTATEMENTCACHESIZE +
- ") cannot be < 0");
+ throw new ValidateException(bundle.invalidNegative(Tag.PREPAREDSTATEMENTCACHESIZE.getLocalName()));
}
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/TimeOutImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/TimeOutImpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/TimeOutImpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,9 +21,12 @@
*/
package org.jboss.jca.common.metadata.ds;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.ds.TimeOut;
import org.jboss.jca.common.api.validator.ValidateException;
+import org.jboss.logging.Messages;
+
/**
*
* A TimeOutImpl.
@@ -36,6 +39,9 @@
/** The serialVersionUID */
private static final long serialVersionUID = -8797718258493768716L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
private final Boolean setTxQuertTimeout;
private final Long queryTimeout;
@@ -156,10 +162,9 @@
public void validate() throws ValidateException
{
if (this.queryTimeout != null && this.queryTimeout < 0)
- throw new ValidateException("queryTimeout (xml attribure " + TimeOut.Tag.QUERYTIMEOUT + ") cannot be < 0");
+ throw new ValidateException(bundle.invalidNegative(TimeOut.Tag.QUERYTIMEOUT.getLocalName()));
+
if (this.useTryLock != null && this.useTryLock < 0)
- throw new ValidateException("useTryLock (xml attribure " + TimeOut.Tag.USETRYLOCK + ") cannot be < 0");
-
+ throw new ValidateException(bundle.invalidNegative(TimeOut.Tag.USETRYLOCK.getLocalName()));
}
-
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/ValidationImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/ValidationImpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/ValidationImpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,10 +21,13 @@
*/
package org.jboss.jca.common.metadata.ds;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.Extension;
import org.jboss.jca.common.api.metadata.ds.Validation;
import org.jboss.jca.common.api.validator.ValidateException;
+import org.jboss.logging.Messages;
+
/**
*
* A ValidationImpl.
@@ -38,6 +41,9 @@
/** The serialVersionUID */
private static final long serialVersionUID = 7816717816552118419L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
private final Extension validConnectionChecker;
private final String checkValidConnectionSql;
@@ -140,8 +146,8 @@
public void validate() throws ValidateException
{
if (this.backgroundValidationMinutes != null && this.backgroundValidationMinutes < 0)
- throw new ValidateException("backgroundValidationMinutes (xml attribure " +
- Validation.Tag.BACKGROUNDVALIDATIONMINUTES + ") cannot be < 0");
+ throw new ValidateException(bundle.invalidNegative(Validation.Tag.BACKGROUNDVALIDATIONMINUTES.getLocalName()));
+
if (this.validConnectionChecker != null)
try
{
@@ -149,8 +155,7 @@
}
catch (ValidateException ve)
{
- throw new ValidateException("validCoonnectionChecker (xml tag" + Validation.Tag.VALIDCONNECTIONCHECKER +
- ") not valid. See the cause exception for more details", ve);
+ throw new ValidateException(bundle.invalidTag(Validation.Tag.VALIDCONNECTIONCHECKER.getLocalName()), ve);
}
if (this.exceptionSorter != null)
try
@@ -159,8 +164,7 @@
}
catch (ValidateException ve)
{
- throw new ValidateException("exceptionSorter (xml tag" + Validation.Tag.EXCEPTIONSORTER +
- ") not valid. See the cause exception for more details", ve);
+ throw new ValidateException(bundle.invalidTag(Validation.Tag.EXCEPTIONSORTER.getLocalName()), ve);
}
if (this.staleConnectionChecker != null)
try
@@ -169,8 +173,7 @@
}
catch (ValidateException ve)
{
- throw new ValidateException("staleConnectionChecker (xml tag" + Validation.Tag.STALECONNECTIONCHECKER +
- ") not valid. See the cause exception for more details", ve);
+ throw new ValidateException(bundle.invalidTag(Validation.Tag.STALECONNECTIONCHECKER.getLocalName()), ve);
}
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.ds;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.CommonXaPool;
import org.jboss.jca.common.api.metadata.common.Recovery;
import org.jboss.jca.common.api.metadata.ds.DsSecurity;
@@ -35,6 +36,8 @@
import java.util.HashMap;
import java.util.Map;
+import org.jboss.logging.Messages;
+
/**
*
* A DataSourceImpl.
@@ -47,6 +50,9 @@
/** The serialVersionUID */
private static final long serialVersionUID = -1401087499308709724L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
private final HashMap<String, String> xaDataSourceProperty;
private String xaDataSourceClass;
@@ -273,11 +279,12 @@
{
if ((this.xaDataSourceClass == null || this.xaDataSourceClass.trim().length() == 0) &&
(this.driver == null || this.driver.trim().length() == 0))
- throw new ValidateException("xaDataSourceClass (xml tag " + Tag.XADATASOURCECLASS + ") is required");
+ throw new ValidateException(bundle.requiredElementMissing(Tag.XADATASOURCECLASS.getLocalName(),
+ this.getClass().getCanonicalName()));
+
if (this.xaDataSourceProperty.isEmpty())
- throw new ValidateException("at least one xaDataSourceProperty (xml tag " + Tag.XADATASOURCEPROPERTY +
- ") is required ");
-
+ throw new ValidateException(bundle.requiredElementMissing(Tag.XADATASOURCEPROPERTY.getLocalName(),
+ this.getClass().getCanonicalName()));
}
@Override
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 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParser.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.ironjacamar;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
import org.jboss.jca.common.api.metadata.common.CommonConnDef;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
@@ -39,6 +40,8 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.jboss.logging.Messages;
+
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
@@ -51,6 +54,8 @@
*/
public class IronJacamarParser extends CommonIronJacamarParser implements MetadataParser<IronJacamar>
{
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
@Override
public IronJacamar parse(InputStream xmlInputStream) throws Exception
@@ -96,7 +101,7 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
@@ -138,7 +143,7 @@
{
if (IronJacamar.Tag.forName(reader.getLocalName()) == IronJacamar.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -187,13 +192,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
/**
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 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/RaParser.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.ra;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
import org.jboss.jca.common.api.metadata.ra.AdminObject;
import org.jboss.jca.common.api.metadata.ra.AuthenticationMechanism;
@@ -79,6 +80,8 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.jboss.logging.Messages;
+
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
@@ -91,6 +94,8 @@
*/
public class RaParser extends AbstractParser implements MetadataParser<Connector>
{
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
@Override
public Connector parse(InputStream xmlInputStream) throws Exception
@@ -136,7 +141,7 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
}
@@ -149,7 +154,7 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
}
else
@@ -161,7 +166,7 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
}
@@ -213,7 +218,7 @@
{
if (Connector10.Tag.forName(reader.getLocalName()) == Connector10.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -264,13 +269,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private Connector parseConnector15(XMLStreamReader reader) throws XMLStreamException, ParserException
@@ -302,7 +307,7 @@
{
if (Connector15.Tag.forName(reader.getLocalName()) == Connector15.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -343,13 +348,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private Connector parseConnector16(XMLStreamReader reader) throws XMLStreamException, ParserException
@@ -390,7 +395,7 @@
{
if (Connector16.Tag.forName(reader.getLocalName()) == Connector16.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -440,13 +445,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private Icon parseIcon(XMLStreamReader reader) throws XMLStreamException, ParserException
@@ -474,7 +479,7 @@
{
if (Icon.Tag.forName(reader.getLocalName()) == Icon.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -492,13 +497,13 @@
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private ResourceAdapter1516 parseResourceAdapter(XMLStreamReader reader) throws XMLStreamException,
@@ -532,7 +537,7 @@
{
if (ResourceAdapter1516.Tag.forName(reader.getLocalName()) == ResourceAdapter1516.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -568,13 +573,13 @@
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private ResourceAdapter10 parseResourceAdapter10(XMLStreamReader reader) throws XMLStreamException,
@@ -614,7 +619,7 @@
{
if (ResourceAdapter10.Tag.forName(reader.getLocalName()) == ResourceAdapter10.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -665,13 +670,13 @@
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private InboundResourceAdapter parseInboundResourceadapter(XMLStreamReader reader) throws XMLStreamException,
@@ -698,7 +703,7 @@
{
if (InboundResourceAdapter.Tag.forName(reader.getLocalName()) == InboundResourceAdapter.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -711,13 +716,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private Messageadapter parseMessageAdapter(XMLStreamReader reader) throws XMLStreamException, ParserException
@@ -745,7 +750,7 @@
{
if (Messageadapter.Tag.forName(reader.getLocalName()) == Messageadapter.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -758,13 +763,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private MessageListener parseMessageListener(XMLStreamReader reader) throws XMLStreamException, ParserException
@@ -793,7 +798,7 @@
{
if (MessageListener.Tag.forName(reader.getLocalName()) == MessageListener.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -810,13 +815,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private Activationspec15 parseActivationspec(XMLStreamReader reader) throws XMLStreamException, ParserException
@@ -855,7 +860,7 @@
{
if (Activationspec16.Tag.forName(reader.getLocalName()) == Activationspec16.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -876,13 +881,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private RequiredConfigProperty parseRequiredConfigProperty(XMLStreamReader reader) throws XMLStreamException,
@@ -913,7 +918,7 @@
{
if (RequiredConfigProperty.Tag.forName(reader.getLocalName()) == RequiredConfigProperty.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -930,13 +935,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private OutboundResourceAdapter parseOutboundResourceadapter(XMLStreamReader reader) throws XMLStreamException,
@@ -971,7 +976,7 @@
{
if (OutboundResourceAdapter.Tag.forName(reader.getLocalName()) == OutboundResourceAdapter.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -996,13 +1001,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private ConnectionDefinition parseConncetionDefinition(XMLStreamReader reader) throws XMLStreamException,
@@ -1039,7 +1044,7 @@
{
if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -1072,13 +1077,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private AuthenticationMechanism parseAuthenticationMechanism(XMLStreamReader reader) throws XMLStreamException,
@@ -1113,7 +1118,7 @@
{
if (AuthenticationMechanism.Tag.forName(reader.getLocalName()) == AuthenticationMechanism.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -1134,13 +1139,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private AdminObject parseAdminObject(XMLStreamReader reader) throws XMLStreamException, ParserException
@@ -1170,7 +1175,7 @@
{
if (AdminObject.Tag.forName(reader.getLocalName()) == AdminObject.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -1191,13 +1196,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private ConfigProperty parseConfigProperty(XMLStreamReader reader) throws XMLStreamException, ParserException
@@ -1244,7 +1249,7 @@
{
if (ConfigProperty16.Tag.forName(reader.getLocalName()) == ConfigProperty16.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -1281,13 +1286,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private SecurityPermission parseSecurityPermission(XMLStreamReader reader) throws XMLStreamException,
@@ -1318,7 +1323,7 @@
{
if (SecurityPermission.Tag.forName(reader.getLocalName()) == SecurityPermission.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -1335,13 +1340,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private LicenseType parseLicense(XMLStreamReader reader) throws XMLStreamException, ParserException
@@ -1365,7 +1370,7 @@
{
if (LicenseType.Tag.forName(reader.getLocalName()) == LicenseType.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -1382,13 +1387,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private XsdString elementAsXsdString(XMLStreamReader reader) throws XMLStreamException
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ConnectorAbstractmpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ConnectorAbstractmpl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ConnectorAbstractmpl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.ra.common;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.CopyableMetaData;
import org.jboss.jca.common.api.metadata.ra.Connector;
import org.jboss.jca.common.api.metadata.ra.Icon;
@@ -35,6 +36,8 @@
import java.util.Collections;
import java.util.List;
+import org.jboss.logging.Messages;
+
/**
*
* A Connector.
@@ -48,6 +51,9 @@
/** The serialVersionUID */
private static final long serialVersionUID = -2054156739973617322L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
/**
* vendor name
*/
@@ -300,7 +306,7 @@
//make sure all need metadata parsered and processed after annotation handle
if (ra == null)
- throw new ValidateException("ResourceAdapter metadata should be defined");
+ throw new ValidateException(bundle.noMetadataForResourceAdapter());
//make sure ra metadata contains inbound or outbound at least
ra.validate();
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ResourceAdapter1516Impl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ResourceAdapter1516Impl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/common/ResourceAdapter1516Impl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.ra.common;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.CopyUtil;
import org.jboss.jca.common.api.metadata.CopyableMetaData;
import org.jboss.jca.common.api.metadata.MergeUtil;
@@ -37,6 +38,8 @@
import java.util.Collections;
import java.util.List;
+import org.jboss.logging.Messages;
+
/**
* @author <a href="mailto:stefano.maestri at jboss.org">Stefano Maestri</a>
*
@@ -47,6 +50,9 @@
*/
private static final long serialVersionUID = 4841095296099713549L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
private final String resourceadapterClass;
private final OutboundResourceAdapter outboundResourceadapter;
@@ -272,14 +278,16 @@
public void validate() throws ValidateException
{
boolean inboundOrOutbound = false;
+
if (this.getOutboundResourceadapter() != null && this.getOutboundResourceadapter().validationAsBoolean())
inboundOrOutbound = true;
+
if (this.getInboundResourceadapter() != null && this.getInboundResourceadapter().validationAsBoolean() &&
this.getResourceadapterClass() != null)
inboundOrOutbound = true;
+
if (!inboundOrOutbound)
- throw new ValidateException("ResourceAdapter metadata should contains inbound or outbound at least");
-
+ throw new ValidateException(bundle.invalidMetadataForResourceAdapter());
}
@Override
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/ra10/ResourceAdapter10Impl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/ra10/ResourceAdapter10Impl.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/ra10/ResourceAdapter10Impl.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.ra.ra10;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.CopyUtil;
import org.jboss.jca.common.api.metadata.CopyableMetaData;
import org.jboss.jca.common.api.metadata.MergeUtil;
@@ -38,6 +39,8 @@
import java.util.Collections;
import java.util.List;
+import org.jboss.logging.Messages;
+
/**
* @author <a href="mailto:stefano.maestri at jboss.org">Stefano Maestri</a>
*
@@ -48,6 +51,9 @@
/** The serialVersionUID */
private static final long serialVersionUID = 6841574517370539456L;
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
private final XsdString managedConnectionFactoryClass;
private final XsdString connectionFactoryInterface;
@@ -373,7 +379,7 @@
|| this.getManagedConnectionFactoryClass().getValue().trim().equals(""))
{
- throw new ValidateException("ManagedConnectionFactoryClass should be defined");
+ throw new ValidateException(bundle.missingValue("managed-connection-factory-class"));
}
}
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 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParser.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -21,6 +21,7 @@
*/
package org.jboss.jca.common.metadata.resourceadapter;
+import org.jboss.jca.common.CommonBundle;
import org.jboss.jca.common.api.metadata.common.CommonAdminObject;
import org.jboss.jca.common.api.metadata.common.CommonConnDef;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
@@ -40,6 +41,8 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.jboss.logging.Messages;
+
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
@@ -52,6 +55,9 @@
*/
public class ResourceAdapterParser extends CommonIronJacamarParser implements MetadataParser<ResourceAdapters>
{
+ /** The bundle */
+ private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
+
@Override
public ResourceAdapters parse(InputStream xmlInputStream) throws Exception
{
@@ -104,7 +110,7 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
@@ -135,7 +141,7 @@
{
if (ResourceAdapters.Tag.forName(reader.getLocalName()) == ResourceAdapters.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -148,13 +154,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
private ResourceAdapter parseResourceAdapter(XMLStreamReader reader) throws XMLStreamException, ParserException,
@@ -181,7 +187,7 @@
{
if (ResourceAdapter.Tag.forName(reader.getLocalName()) == ResourceAdapter.Tag.UNKNOWN)
{
- throw new ParserException("unexpected end tag" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
@@ -234,13 +240,13 @@
break;
}
default :
- throw new ParserException("Unexpected element:" + reader.getLocalName());
+ throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
- throw new ParserException("Reached end of xml document unexpectedly");
+ throw new ParserException(bundle.unexpectedEndOfDocument());
}
/**
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreBundle.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreBundle.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreBundle.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.core;
+
+import org.jboss.logging.MessageBundle;
+import org.jboss.logging.Message;
+
+/**
+ * The core bundle.
+ *
+ * Message ids ranging from 00001 to 05000 inclusively.
+ */
+ at MessageBundle(projectCode = "IJ")
+public interface CoreBundle
+{
+}
Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/DeployersBundle.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/DeployersBundle.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/DeployersBundle.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.deployers;
+
+import org.jboss.logging.MessageBundle;
+import org.jboss.logging.Message;
+
+/**
+ * The deployers bundle.
+ *
+ * Message ids ranging from 10001 to 15000 inclusively.
+ */
+ at MessageBundle(projectCode = "IJ")
+public interface DeployersBundle
+{
+ /**
+ * Unable to start resource adapter
+ * @param clz The class name
+ * @return The value
+ */
+ @Message(id = 10008, value = "Unable to start %s")
+ public String unableToStartResourceAdapter(String clz);
+
+ /**
+ * Unable to associate
+ * @param clz The class name
+ * @return The value
+ */
+ @Message(id = 10009, value = "Unable to associate %s")
+ public String unableToAssociate(String clz);
+
+ /**
+ * Undefined managed connection factory
+ * @return The value
+ */
+ @Message(id = 10010, value = "ManagedConnectionFactory must be defined in class-name")
+ public String undefinedManagedConnectionFactory();
+
+ /**
+ * Undefined managed connection factory
+ * @return The value
+ */
+ @Message(id = 10011, value = "AdminObject must be defined in class-name")
+ public String undefinedAdminObject();
+
+ /**
+ * Failed to bind admin object
+ * @param clz The class name
+ * @return The value
+ */
+ @Message(id = 10012, value = "Failed to bind admin object %s")
+ public String failedToBindAdminObject(String clz);
+
+ /**
+ * Deployment failed
+ * @param url The url
+ * @return The value
+ */
+ @Message(id = 10013, value = "Deployment failed: %s")
+ public String deploymentFailed(String url);
+}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -52,6 +52,7 @@
import org.jboss.jca.core.spi.transaction.TransactionIntegration;
import org.jboss.jca.core.spi.transaction.recovery.XAResourceRecovery;
import org.jboss.jca.core.spi.transaction.recovery.XAResourceRecoveryRegistry;
+import org.jboss.jca.deployers.DeployersBundle;
import org.jboss.jca.deployers.DeployersLogger;
import java.lang.reflect.Method;
@@ -70,6 +71,7 @@
import javax.resource.spi.security.PasswordCredential;
import javax.security.auth.Subject;
+import org.jboss.logging.Messages;
import org.jboss.security.SecurityContext;
import org.jboss.security.SecurityContextAssociation;
import org.jboss.security.SecurityContextFactory;
@@ -83,6 +85,9 @@
*/
public abstract class AbstractDsDeployer
{
+ /** The bundle */
+ private static DeployersBundle bundle = Messages.getBundle(DeployersBundle.class);
+
/** log **/
protected DeployersLogger log;
@@ -326,7 +331,7 @@
}
catch (Throwable t)
{
- throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
+ throw new DeployException(bundle.deploymentFailed(url.toExternalForm()), t);
}
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-06-06 16:27:06 UTC (rev 111525)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-06-06 18:48:08 UTC (rev 111526)
@@ -57,6 +57,7 @@
import org.jboss.jca.core.spi.recovery.RecoveryPlugin;
import org.jboss.jca.core.spi.transaction.TransactionIntegration;
import org.jboss.jca.core.spi.transaction.recovery.XAResourceRecovery;
+import org.jboss.jca.deployers.DeployersBundle;
import org.jboss.jca.deployers.DeployersLogger;
import org.jboss.jca.validator.Failure;
import org.jboss.jca.validator.FailureHelper;
@@ -100,6 +101,7 @@
import javax.security.auth.Subject;
import javax.transaction.TransactionManager;
+import org.jboss.logging.Messages;
import org.jboss.security.SecurityContext;
import org.jboss.security.SecurityContextAssociation;
import org.jboss.security.SecurityContextFactory;
@@ -112,6 +114,9 @@
*/
public abstract class AbstractResourceAdapterDeployer
{
+ /** The bundle */
+ private static DeployersBundle bundle = Messages.getBundle(DeployersBundle.class);
+
/** the logger **/
protected final DeployersLogger log;
@@ -338,12 +343,12 @@
}
catch (InvocationTargetException ite)
{
- throw new DeployException("Unable to start " + resourceAdapter.getClass().getName(),
+ throw new DeployException(bundle.unableToStartResourceAdapter(resourceAdapter.getClass().getName()),
ite.getTargetException());
}
catch (Throwable t)
{
- throw new DeployException("Unable to start " + resourceAdapter.getClass().getName(), t);
+ throw new DeployException(bundle.unableToStartResourceAdapter(resourceAdapter.getClass().getName()), t);
}
}
@@ -370,7 +375,7 @@
}
catch (Throwable t)
{
- throw new DeployException("Unable to associate " + object.getClass().getName(), t);
+ throw new DeployException(bundle.unableToAssociate(object.getClass().getName()), t);
}
}
}
@@ -403,7 +408,7 @@
// If there are multiple definitions the MCF class name is mandatory
if (clz == null)
- throw new IllegalArgumentException("ManagedConnectionFactory must be defined in class-name");
+ throw new IllegalArgumentException(bundle.undefinedManagedConnectionFactory());
for (org.jboss.jca.common.api.metadata.common.CommonConnDef cd : defs)
{
@@ -442,7 +447,7 @@
// If there are multiple definitions the admin object class name is mandatory
if (clz == null)
- throw new IllegalArgumentException("AdminObject must be defined in class-name");
+ throw new IllegalArgumentException(bundle.undefinedAdminObject());
for (org.jboss.jca.common.api.metadata.common.CommonAdminObject cao : defs)
{
@@ -690,7 +695,7 @@
}
catch (Throwable t)
{
- throw new DeployException("Failed to bind admin object", t);
+ throw new DeployException(bundle.failedToBindAdminObject(ao.getClass().getName()), t);
}
}
}
@@ -1763,14 +1768,14 @@
if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
(getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
{
- throw new DeployException("Deployment " + url.toExternalForm() + " failed",
+ throw new DeployException(bundle.deploymentFailed(url.toExternalForm()),
new ValidatorException(printFailuresLog(url.getPath(), new Validator(),
failures, null), failures));
}
else
{
printFailuresLog(url.getPath(), new Validator(), failures, null);
- throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
+ throw new DeployException(bundle.deploymentFailed(url.toExternalForm()), t);
}
}
}
More information about the jboss-cvs-commits
mailing list