Author: ningjiang
Date: Tue Jul 1 02:37:48 2008
New Revision: 673038
URL: http://svn.apache.org/viewvc?rev=673038&view=rev
Log:
Fixed the CS errors of last commit
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangeProperty.java
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/ConditionalExceptionProcessor.java
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionInterceptor.java
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangeProperty.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangeProperty.java?rev=673038&r1=673037&r2=673038&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangeProperty.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangeProperty.java
Tue Jul 1 02:37:48 2008
@@ -1,3 +1,19 @@
+/**
+ * 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.
+ */
package org.apache.camel;
import java.util.ArrayList;
@@ -35,23 +51,24 @@
* </pre>
*
* <b>Note:</b> that if ExchangeProperty instance get or set methods are used
then type checks
- * of property's value are performed and a runtime exception can be thrown if
type
+ * of property's value are performed and a runtime exception can be thrown if
type
* safety is violated.
*/
public class ExchangeProperty<T> {
- private final String literal;
- private final String name;
- private final Class<T> type;
- private static final List<ExchangeProperty<?>> values =
+ private static final List<ExchangeProperty<?>> VALUES =
new ArrayList<ExchangeProperty<?>>();
- private static final Map<String, ExchangeProperty<?>> literalMap =
+ private static final Map<String, ExchangeProperty<?>> LITERAL_MAP =
new HashMap<String, ExchangeProperty<?>>();
-
- private static final Map<String, ExchangeProperty<?>> nameMap =
+
+ private static final Map<String, ExchangeProperty<?>> NAME_MAP =
new HashMap<String, ExchangeProperty<?>>();
+ private final String literal;
+ private final String name;
+ private final Class<T> type;
+
public ExchangeProperty(String literal, String name, Class<T> type) {
this.literal = literal;
this.name = name;
@@ -76,11 +93,11 @@
}
public static ExchangeProperty<?> get(String literal) {
- return literalMap.get(literal);
+ return LITERAL_MAP.get(literal);
}
public static ExchangeProperty<?> getByName(String name) {
- return nameMap.get(name);
+ return NAME_MAP.get(name);
}
public T set(Exchange exchange, T value) {
@@ -101,35 +118,35 @@
}
public static synchronized void register(ExchangeProperty<?> property) {
- ExchangeProperty<?> existingProperty =
literalMap.get(property.literal());
+ ExchangeProperty<?> existingProperty =
LITERAL_MAP.get(property.literal());
if (existingProperty != null && existingProperty != property) {
- throw new RuntimeCamelException("An Exchange Property '" +
property.literal()
+ throw new RuntimeCamelException("An Exchange Property '" +
property.literal()
+ "' has already been registered; its traits are: " +
existingProperty.toString());
}
- values.add(property);
- literalMap.put(property.literal(), property);
- nameMap.put(property.name(), property);
+ VALUES.add(property);
+ LITERAL_MAP.put(property.literal(), property);
+ NAME_MAP.put(property.name(), property);
}
public static synchronized void deregister(ExchangeProperty<?> property) {
if (property != null) {
- values.remove(property);
- literalMap.remove(property.literal());
- nameMap.put(property.name(), property);
+ VALUES.remove(property);
+ LITERAL_MAP.remove(property.literal());
+ NAME_MAP.put(property.name(), property);
}
}
public static synchronized void deregister(String literal) {
- ExchangeProperty<?> property = literalMap.get(literal);
+ ExchangeProperty<?> property = LITERAL_MAP.get(literal);
if (property != null) {
- values.remove(property);
- literalMap.remove(property.literal());
- nameMap.put(property.name(), property);
+ VALUES.remove(property);
+ LITERAL_MAP.remove(property.literal());
+ NAME_MAP.put(property.name(), property);
}
}
public static synchronized ExchangeProperty<?>[] values() {
- return values.toArray(new ExchangeProperty[0]);
+ return VALUES.toArray(new ExchangeProperty[0]);
}
}
\ No newline at end of file
Modified:
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/ConditionalExceptionProcessor.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/ConditionalExceptionProcessor.java?rev=673038&r1=673037&r2=673038&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/ConditionalExceptionProcessor.java
(original)
+++
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/ConditionalExceptionProcessor.java
Tue Jul 1 02:37:48 2008
@@ -46,9 +46,9 @@
if (getCount() > maxCalls * 2) {
errorMsg = "Expected only " + maxCalls * 2 + " calls to process()
but encountered "
- + getCount() + ". There should be 1 for intentionally triggered
rollback, and 1 for redelivery for each call.";
+ + getCount() + ". There should be 1 for intentionally
triggered rollback, and 1 for redelivery for each call.";
}
-
+
// should be printed 2 times due to one re-delivery after one failure
LOG.info("Exchange[" + getCount() + "][" + ((getCount() % 2 != 0) ?
"Should rollback" : "Should succeed")
+ "] = " + exchange);
@@ -66,7 +66,7 @@
public int getCount() {
return count;
}
-
+
public String getErrorMessage() {
return errorMsg;
}
Modified:
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?rev=673038&r1=673037&r2=673038&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
(original)
+++
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
Tue Jul 1 02:37:48 2008
@@ -125,7 +125,7 @@
public void afterPropertiesSet() throws Exception {
// lets see if we can find a debugger to add
// TODO there should be a neater way to do this!
- Debugger debugger = getBeanForType(Debugger.class);
+ Debugger debugger = getBeanForType(Debugger.class);
if (debugger != null) {
getContext().addInterceptStrategy(debugger);
}
@@ -159,8 +159,8 @@
// lets force any lazy creation
getContext().addRouteDefinitions(routes);
- if (!isJmxEnabled() ||
- (camelJMXAgent != null && camelJMXAgent.isDisabled() != null
&& camelJMXAgent.isDisabled())) {
+ if (!isJmxEnabled()
+ || (camelJMXAgent != null && camelJMXAgent.isDisabled() !=
null && camelJMXAgent.isDisabled())) {
LOG.debug("JMXAgent disabled");
getContext().setLifecycleStrategy(new DefaultLifecycleStrategy());
} else if (camelJMXAgent != null) {
@@ -181,7 +181,7 @@
getContext().setLifecycleStrategy(new
InstrumentationLifecycleStrategy(agent));
}
-
+
if (LOG.isDebugEnabled()) {
LOG.debug("Found JAXB created routes: " + getRoutes());
}
@@ -311,10 +311,10 @@
}
/**
- * This method merely retrieves the value of the "useJmx" attribute and
does
- * not consider the "disabled" flag in jmxAgent element. The useJmx
+ * This method merely retrieves the value of the "useJmx" attribute and
does
+ * not consider the "disabled" flag in jmxAgent element. The useJmx
* attribute will be removed in 2.0. Please the jmxAgent element instead.
- *
+ *
* @deprecated Please the jmxAgent element instead. Will be removed in
Camel 2.0.
*/
public boolean isJmxEnabled() {
Modified:
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionInterceptor.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionInterceptor.java?rev=673038&r1=673037&r2=673038&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionInterceptor.java
(original)
+++
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionInterceptor.java
Tue Jul 1 02:37:48 2008
@@ -36,11 +36,12 @@
* @version $Revision$
*/
public class TransactionInterceptor extends DelegateProcessor {
+ public static final ExchangeProperty<Boolean> TRANSACTED =
+ new ExchangeProperty<Boolean>("transacted",
"org.apache.camel.transacted", Boolean.class);
private static final transient Log LOG =
LogFactory.getLog(TransactionInterceptor.class);
private final TransactionTemplate transactionTemplate;
- public static final ExchangeProperty<Boolean> TRANSACTED =
- new ExchangeProperty<Boolean>("transacted",
"org.apache.camel.transacted", Boolean.class);
+
public TransactionInterceptor(TransactionTemplate transactionTemplate) {
this.transactionTemplate = transactionTemplate;
@@ -91,7 +92,7 @@
// wrap if the exchange threw an exception
rce = new RuntimeCamelException(e);
}
-
+
// rehrow exception if the exchange failed
if (rce != null) {
if (activeTx) {
@@ -102,7 +103,7 @@
}
}
});
-
+
LOG.debug("Transaction commit");
}