You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by no...@apache.org on 2011/08/06 15:17:17 UTC
svn commit: r1154514 - in
/aries/trunk/transaction/transaction-blueprint/src/main:
java/org/apache/aries/transaction/ java/org/apache/aries/transaction/parsing/
resources/org/apache/aries/transaction/nls/
Author: not
Date: Sat Aug 6 13:17:16 2011
New Revision: 1154514
URL: http://svn.apache.org/viewvc?rev=1154514&view=rev
Log:
ARIES-467 NLS enable log and exception messages.
Added:
aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/nls/
aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/nls/blueprintTx.properties (with props)
Modified:
aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/BundleWideTxDataUtil.java
aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/Constants.java
aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TransactionAttribute.java
aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java
aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java
aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java
Modified: aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/BundleWideTxDataUtil.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/BundleWideTxDataUtil.java?rev=1154514&r1=1154513&r2=1154514&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/BundleWideTxDataUtil.java (original)
+++ aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/BundleWideTxDataUtil.java Sat Aug 6 13:17:16 2011
@@ -169,7 +169,7 @@ public class BundleWideTxDataUtil {
return bundleDataNoRestriction.get(0).getValue();
} else {
// cannot have more than 1 transaction element that has no method or bean attribute
- throw new IllegalStateException("More than 1 bundle wide transaction elements that have no method or bean attribute specified " + bundleDataNoRestriction);
+ throw new IllegalStateException(Constants.MESSAGES.getMessage("bundle.wide.tx", bundleDataNoRestriction));
}
}
@@ -199,7 +199,7 @@ public class BundleWideTxDataUtil {
return matchesMethod2.get(0).getValue();
} else {
// unable to find the best match!!
- throw new IllegalStateException("Unable to apply patterns: " + matchedTxData);
+ throw new IllegalStateException(Constants.MESSAGES.getMessage("unable.to.apply.patterns", matchedTxData));
}
}
}
@@ -224,7 +224,7 @@ public class BundleWideTxDataUtil {
return matchesBean2.get(0).getValue();
} else {
// unable to find the best match!!
- throw new IllegalStateException("Unable to apply patterns: " + matchedTxData);
+ throw new IllegalStateException(Constants.MESSAGES.getMessage("unable.to.apply.patterns", matchedTxData));
}
}
}
@@ -247,7 +247,7 @@ public class BundleWideTxDataUtil {
return matchesMethod2.get(0).getValue();
} else {
// unable to find the best match!!
- throw new IllegalStateException("Unable to apply patterns: " + matchedTxData);
+ throw new IllegalStateException(Constants.MESSAGES.getMessage("unable.to.apply.patterns", matchedTxData));
}
}
}
Modified: aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/Constants.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/Constants.java?rev=1154514&r1=1154513&r2=1154514&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/Constants.java (original)
+++ aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/Constants.java Sat Aug 6 13:17:16 2011
@@ -20,6 +20,8 @@ package org.apache.aries.transaction;
import java.util.regex.Pattern;
+import org.apache.aries.util.nls.MessageUtil;
+
public class Constants {
public static final Pattern WILDCARD = Pattern.compile("\\Q.*\\E");
public static final String BEAN = "bean";
@@ -28,6 +30,7 @@ public class Constants {
public static final String TX11_SCHEMA = "transactionv11.xsd";
public static final String TX10_SCHEMA = "transactionv10.xsd";
- public final static String TRANSACTION10URI = "http://aries.apache.org/xmlns/transactions/v1.0.0";
- public final static String TRANSACTION11URI = "http://aries.apache.org/xmlns/transactions/v1.1.0";
+ public final static String TRANSACTION10URI = "http://aries.apache.org/xmlns/transactions/v1.0.0";
+ public final static String TRANSACTION11URI = "http://aries.apache.org/xmlns/transactions/v1.1.0";
+ public static final MessageUtil MESSAGES = MessageUtil.createMessageUtil(Constants.class, "org.apache.aries.transaction.nls.blueprintTx");
}
Modified: aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TransactionAttribute.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TransactionAttribute.java?rev=1154514&r1=1154513&r2=1154514&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TransactionAttribute.java (original)
+++ aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TransactionAttribute.java Sat Aug 6 13:17:16 2011
@@ -34,7 +34,7 @@ public enum TransactionAttribute {
public TransactionToken begin(TransactionManager man) throws SystemException
{
if (man.getStatus() == Status.STATUS_NO_TRANSACTION) {
- throw new IllegalStateException("No transaction on the thread");
+ throw new IllegalStateException(Constants.MESSAGES.getMessage("tran.not.found"));
}
return new TransactionToken(man.getTransaction(), null, MANDATORY);
@@ -45,7 +45,7 @@ public enum TransactionAttribute {
public TransactionToken begin(TransactionManager man) throws SystemException
{
if (man.getStatus() == Status.STATUS_ACTIVE) {
- throw new IllegalStateException("Transaction on the thread");
+ throw new IllegalStateException(Constants.MESSAGES.getMessage("tran.found.never"));
}
return new TransactionToken(null, null, NEVER);
Modified: aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java?rev=1154514&r1=1154513&r2=1154514&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java (original)
+++ aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java Sat Aug 6 13:17:16 2011
@@ -83,7 +83,7 @@ public class TxComponentMetaDataHelperIm
txAttribute = map.get(matches.get(0));
}
else {
- throw new IllegalStateException("Unable to apply patterns: " + matches);
+ throw new IllegalStateException(Constants.MESSAGES.getMessage("unable.to.apply.patterns", matches));
}
}
}
Modified: aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java?rev=1154514&r1=1154513&r2=1154514&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java (original)
+++ aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java Sat Aug 6 13:17:16 2011
@@ -63,8 +63,7 @@ public class TxInterceptorImpl implement
catch (Exception e)
{
// we do not throw the exception since there already is one, but we need to log it
- LOGGER.warn("An exception occurred during transaction clean up, which will be discared in favour of an exception" +
- " already thrown.", e);
+ LOGGER.warn(Constants.MESSAGES.getMessage("exception.during.tx.cleanup"), e);
}
} else {
// TODO: what now?
@@ -88,7 +87,7 @@ public class TxInterceptorImpl implement
catch (Exception e)
{
// We are throwing an exception, so we don't error it out
- LOGGER.debug("An exception has occured.", e);
+ LOGGER.debug(Constants.MESSAGES.getMessage("exception.during.tx.finish"), e);
throw new TransactionRollbackException(e);
}
}
Modified: aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java?rev=1154514&r1=1154513&r2=1154514&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java (original)
+++ aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java Sat Aug 6 13:17:16 2011
@@ -144,12 +144,12 @@ public class TxElementHandler implements
id = props.getProperty(INTERCEPTOR_BLUEPRINT_ID);
}
} catch (IOException e) {
- LOGGER.error("IOException while loading provider properties. Using default provider", e);
+ LOGGER.error(Constants.MESSAGES.getMessage("unable.to.load.provider.props"), e);
} finally {
try {
is.close();
} catch (IOException e2) {
- LOGGER.error("Unexpected exception while closing stream", e2);
+ LOGGER.error(Constants.MESSAGES.getMessage("exception.closing.stream"), e2);
}
}
}
Added: aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/nls/blueprintTx.properties
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/nls/blueprintTx.properties?rev=1154514&view=auto
==============================================================================
--- aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/nls/blueprintTx.properties (added)
+++ aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/nls/blueprintTx.properties Sat Aug 6 13:17:16 2011
@@ -0,0 +1,36 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+unable.to.load.provider.props=An IOException occurred while loading the provider properties. Using the default provider.
+exception.closing.stream=An unexpected exception occurred while closing a stream.
+exception.during.tx.cleanup=An exception occurred during transaction clean up, which will be discarded in favour of an \
+ exception already thrown.
+exception.during.tx.finish=An exception has occurred when the transaction was being completed.
+# {0} The patterns that cannot be applied.
+unable.to.apply.patterns=Unable to apply patterns {0}.
+tran.not.found.mandatory=A call is being made on a method that mandates a transaction but there is no current transaction.
+tran.found.never=A call is being made on a method that forbids a transaction but there is a current transaction.
+# {0} transaction configuration
+bundle.wide.tx=There are more than one bundle wide transaction elements that have no method or bean attribute specified {0}.
+
+
+
+
+
+
Propchange: aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/nls/blueprintTx.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain