aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1154519 - in /aries/trunk/transaction/transaction-manager/src/main: java/org/apache/aries/transaction/ resources/ resources/org/ resources/org/apache/ resources/org/apache/aries/ resources/org/apache/aries/transaction/
Date Sat, 06 Aug 2011 13:54:36 GMT
Author: not
Date: Sat Aug  6 13:54:36 2011
New Revision: 1154519

URL: http://svn.apache.org/viewvc?rev=1154519&view=rev
Log:
ARIES-467 NLS enable log and exception messages.

Added:
    aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/NLS.java
  (with props)
    aries/trunk/transaction/transaction-manager/src/main/resources/
    aries/trunk/transaction/transaction-manager/src/main/resources/org/
    aries/trunk/transaction/transaction-manager/src/main/resources/org/apache/
    aries/trunk/transaction/transaction-manager/src/main/resources/org/apache/aries/
    aries/trunk/transaction/transaction-manager/src/main/resources/org/apache/aries/transaction/
    aries/trunk/transaction/transaction-manager/src/main/resources/org/apache/aries/transaction/txManager.properties
  (with props)
Modified:
    aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/Activator.java
    aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/TransactionManagerService.java

Modified: aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/Activator.java?rev=1154519&r1=1154518&r2=1154519&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/Activator.java
(original)
+++ aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/Activator.java
Sat Aug  6 13:54:36 2011
@@ -83,7 +83,7 @@ public class Activator implements Bundle
         try {
             mgr.start();
         } catch (Exception e) {
-            log.error("Error starting transaction manager", e);
+            log.error(NLS.MESSAGES.getMessage("exception.tx.manager.start"), e);
         }
     }
 
@@ -93,7 +93,7 @@ public class Activator implements Bundle
             try {
                 mgr.close();
             } catch (Exception e) {
-                log.error("Error stopping transaction manager", e);
+                log.error(NLS.MESSAGES.getMessage("exception.tx.manager.stop"), e);
             }
         }
     }

Added: aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/NLS.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/NLS.java?rev=1154519&view=auto
==============================================================================
--- aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/NLS.java
(added)
+++ aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/NLS.java
Sat Aug  6 13:54:36 2011
@@ -0,0 +1,26 @@
+/*
+ * 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 WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.transaction;
+
+import org.apache.aries.util.nls.MessageUtil;
+
+public class NLS
+{
+  public static final MessageUtil MESSAGES = MessageUtil.createMessageUtil(NLS.class, "org.apache.aries.transaction.txManager");
+}

Propchange: aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/NLS.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/TransactionManagerService.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/TransactionManagerService.java?rev=1154519&r1=1154518&r2=1154519&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/TransactionManagerService.java
(original)
+++ aries/trunk/transaction/transaction-manager/src/main/java/org/apache/aries/transaction/TransactionManagerService.java
Sat Aug  6 13:54:36 2011
@@ -81,7 +81,7 @@ public class TransactionManagerService {
         // Transaction timeout
         int transactionTimeout = getInt(TRANSACTION_TIMEOUT, DEFAULT_TRANSACTION_TIMEOUT);
         if (transactionTimeout <= 0) {
-            throw new ConfigurationException(TRANSACTION_TIMEOUT, "Property " + TRANSACTION_TIMEOUT
+ " must be > 0");
+            throw new ConfigurationException(TRANSACTION_TIMEOUT, NLS.MESSAGES.getMessage("tx.timeout.greaterthan.zero"));
         }
         // XID factory
         XidFactory xidFactory = new XidFactoryImpl(pid.getBytes());
@@ -90,7 +90,7 @@ public class TransactionManagerService {
             String bufferClassName = getString(HOWL_BUFFER_CLASS_NAME, "org.objectweb.howl.log.BlockLogBuffer");
             int bufferSizeKBytes = getInt(HOWL_BUFFER_SIZE, 32);
             if (bufferSizeKBytes < 1 || bufferSizeKBytes > 32) {
-                throw new ConfigurationException(HOWL_BUFFER_SIZE, "bufferSize must be between
1 and 32");
+                throw new ConfigurationException(HOWL_BUFFER_SIZE, NLS.MESSAGES.getMessage("buffer.size.between.one.and.thirtytwo"));
             }
             boolean checksumEnabled = getBool(HOWL_CHECKSUM_ENABLED, true);
             boolean adler32Checksum = getBool(HOWL_ADLER32_CHECKSUM, true);
@@ -101,16 +101,16 @@ public class TransactionManagerService {
             int maxLogFiles = getInt(HOWL_MAX_LOG_FILES, 2);
             int minBuffers = getInt(HOWL_MIN_BUFFERS, 4);
             if (minBuffers < 0) {
-                throw new ConfigurationException(HOWL_MIN_BUFFERS, "minBuffers must be >
0");
+                throw new ConfigurationException(HOWL_MIN_BUFFERS, NLS.MESSAGES.getMessage("min.buffers.greaterthan.zero"));
             }
             int maxBuffers = getInt(HOWL_MAX_BUFFERS, 0);
             if (maxBuffers > 0 && minBuffers < maxBuffers) {
-                throw new ConfigurationException(HOWL_MAX_BUFFERS, "minBuffers must be <=
maxBuffers");
+                throw new ConfigurationException(HOWL_MAX_BUFFERS, NLS.MESSAGES.getMessage("max.buffers.greaterthan.min.buffers"));
             }
             int threadsWaitingForceThreshold = getInt(HOWL_THREADS_WAITING_FORCE_THRESHOLD,
-1);
             String logFileDir = getString(HOWL_LOG_FILE_DIR, null);
             if (logFileDir == null || logFileDir.length() == 0 || !new File(logFileDir).isAbsolute())
{
-                throw new ConfigurationException(HOWL_LOG_FILE_DIR, "Property should be set
to an absolute directory");
+                throw new ConfigurationException(HOWL_LOG_FILE_DIR, NLS.MESSAGES.getMessage("log.file.dir"));
             }
             try {
                 transactionLog = new HOWLLog(bufferClassName,
@@ -147,7 +147,7 @@ public class TransactionManagerService {
                 transactionManager = new GeronimoTransactionManager(transactionTimeout, xidFactory,
transactionLog);
             }
         } catch (XAException e) {
-            throw new RuntimeException("Error recovering transaction log", e);
+            throw new RuntimeException(NLS.MESSAGES.getMessage("tx.recovery.error"), e);
         }
     }
 
@@ -188,7 +188,7 @@ public class TransactionManagerService {
             try {
                 return Integer.parseInt(value);
             } catch (Exception e) {
-                throw new ConfigurationException(property, "Error parsing " + property +
"(" + value + ") property as an integer", e);
+                throw new ConfigurationException(property, NLS.MESSAGES.getMessage("prop.value.not.int",
property, value), e);
             }
         }
         return dflt;
@@ -200,7 +200,7 @@ public class TransactionManagerService {
             try {
                 return Boolean.parseBoolean(value);
             } catch (Exception e) {
-                throw new ConfigurationException(property, "Error parsing " + property +
"(" + value + ") property as a boolean", e);
+                throw new ConfigurationException(property, NLS.MESSAGES.getMessage("prop.value.not.boolean",
property, value), e);
             }
         }
         return dflt;

Added: aries/trunk/transaction/transaction-manager/src/main/resources/org/apache/aries/transaction/txManager.properties
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-manager/src/main/resources/org/apache/aries/transaction/txManager.properties?rev=1154519&view=auto
==============================================================================
--- aries/trunk/transaction/transaction-manager/src/main/resources/org/apache/aries/transaction/txManager.properties
(added)
+++ aries/trunk/transaction/transaction-manager/src/main/resources/org/apache/aries/transaction/txManager.properties
Sat Aug  6 13:54:36 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.
+#
+
+exception.tx.manager.start=An exception occurred starting the transaction manager.
+exception.tx.manager.stop=An exception occurred stopping the transaction manager.
+tx.timeout.greaterthan.zero=The transaction timeout property must be greater than zero.
+buffer.size.between.one.and.thirtytwo=The buffer size must be between one and thirty-two.
+min.buffers.greaterthan.zero=The minimum number of buffers must be greater than zero.
+max.buffers.greaterthan.min.buffers=The maximum number of buffers must be greater than the
minimum number of buffers.
+log.file.dir=The log file directory must be set to an absolute directory.
+tx.recovery.error=An exception occurred during transaction recovery.
+# {0} The property name
+# {1} The property value
+prop.value.not.int=The property {0} should have an integer value, but the value {1} is not
an integer.
+# {0} The property name
+# {1} The property value
+prop.value.not.boolean=The property {0} should have an boolean value, but the value {1} is
not a boolean.
+
+
+

Propchange: aries/trunk/transaction/transaction-manager/src/main/resources/org/apache/aries/transaction/txManager.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message