Permalink
Browse files

[maven-release-plugin] copy for tag camel-2.7.0

git-svn-id: https://svn.apache.org/repos/asf/camel/tags/camel-2.7.0@1082750 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
2 parents 1f3d688 + 7e9546f commit 27105d1ffda37943827d3da4534e7b4a22eee105 @hzbarcea hzbarcea committed Mar 17, 2011
Showing 9,775 changed files with 130 additions and 869,206 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
@@ -144,7 +144,6 @@ protected void processStrategyCommit(GenericFileProcessStrategy<T> processStrate
handleException(e);
}
-
}
/**
@@ -26,15 +26,17 @@
/**
* A default implementation of {@link ExceptionHandler} which uses a {@link org.apache.camel.processor.CamelLogger} to
- * log to an arbitrary {@link org.apache.commons.logging.Log Logger} with some {@link LoggingLevel}
+ * log the exception.
+ * <p/>
+ * This implementation will by default log the exception with stack trace at DEBUG level.
*
* @version
*/
public class LoggingExceptionHandler implements ExceptionHandler {
private final CamelLogger logger;
public LoggingExceptionHandler(Class<?> ownerType) {
- this(new CamelLogger(LoggerFactory.getLogger(ownerType), LoggingLevel.ERROR));
+ this(new CamelLogger(LoggerFactory.getLogger(ownerType), LoggingLevel.DEBUG));
}
public LoggingExceptionHandler(CamelLogger logger) {
@@ -16,14 +16,16 @@
*/
package org.apache.camel.impl;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.LinkedHashSet;
+import java.util.Properties;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.camel.Service;
import org.apache.camel.ServiceStatus;
import org.apache.camel.ShutdownableService;
-import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.ServiceHelper;
/**
@@ -305,17 +307,38 @@ protected boolean removeChildService(Object childService) {
* Returns the version of this service
*/
public synchronized String getVersion() {
- if (ObjectHelper.isNotEmpty(version)) {
+ if (version != null) {
return version;
}
-
- Package aPackage = getClass().getPackage();
- if (aPackage != null) {
- version = aPackage.getImplementationVersion();
- if (version == null) {
- version = aPackage.getSpecificationVersion();
+
+ // try to load from maven properties first
+ try {
+ Properties p = new Properties();
+ InputStream is = getClass().getResourceAsStream("/META-INF/maven/org.apache.camel/camel-core/pom.properties");
+ if (is != null) {
+ p.load(is);
+ version = p.getProperty("version", "");
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+
+ // fallback to using Java API
+ if (version == null) {
+ Package aPackage = getClass().getPackage();
+ if (aPackage != null) {
+ version = aPackage.getImplementationVersion();
+ if (version == null) {
+ version = aPackage.getSpecificationVersion();
+ }
}
}
- return version != null ? version : "";
+
+ if (version == null) {
+ // we could not compute the version so use a blank
+ version = "";
+ }
+
+ return version;
}
}
@@ -134,7 +134,7 @@ public boolean process(Exchange exchange, AsyncCallback callback) {
// are we exhausted by attempts?
if (maximumFailoverAttempts > -1 && attempts.get() > maximumFailoverAttempts) {
if (log.isDebugEnabled()) {
- log.debug("Braking out of failover after " + attempts + " failover attempts");
+ log.debug("Breaking out of failover after " + attempts + " failover attempts");
}
break;
}
@@ -154,7 +154,7 @@ public boolean process(Exchange exchange, AsyncCallback callback) {
counter.set(0);
} else {
// no more processors to try
- log.trace("Braking out of failover as we reach the end of endpoints to use for failover");
+ log.trace("Breaking out of failover as we reached the end of endpoints to use for failover");
break;
}
}
@@ -257,7 +257,7 @@ public void done(boolean doneSync) {
// are we exhausted by attempts?
if (maximumFailoverAttempts > -1 && attempts.get() > maximumFailoverAttempts) {
if (log.isTraceEnabled()) {
- log.trace("Braking out of failover after " + attempts + " failover attempts");
+ log.trace("Breaking out of failover after " + attempts + " failover attempts");
}
break;
}
@@ -273,7 +273,7 @@ public void done(boolean doneSync) {
counter.set(0);
} else {
// no more processors to try
- log.trace("Braking out of failover as we reach the end of endpoints to use for failover");
+ log.trace("Breaking out of failover as we reached the end of endpoints to use for failover");
break;
}
}
@@ -72,4 +72,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-</project>
+</project>
@@ -83,4 +83,4 @@
</dependencies>
-</project>
+</project>
@@ -15,7 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -17,6 +17,8 @@
package org.apache.camel.component.jetty;
import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -45,12 +47,14 @@
private static final long serialVersionUID = 1L;
// jetty will by default use 30000 millis as default timeout
private Long continuationTimeout;
+ // we must remember expired exchanges as Jetty will initiate a new continuation when we send
+ // back the error when timeout occurred, and thus in the async callback we cannot check the
+ // continuation if it was previously expired. So that's why we have our own map for that
+ private final Map<String, String> expiredExchanges = new ConcurrentHashMap<String, String>();
@Override
- protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- if (log.isTraceEnabled()) {
- log.trace("Service: " + request);
- }
+ protected void service(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+ log.trace("Service: {}", request);
// is there a consumer registered for the request.
HttpConsumer consumer = resolve(request);
@@ -63,7 +67,8 @@ protected void service(HttpServletRequest request, HttpServletResponse response)
if (result == null) {
// no asynchronous result so leverage continuation
final Continuation continuation = ContinuationSupport.getContinuation(request);
- if (continuationTimeout != null) {
+ if (continuation.isInitial() && continuationTimeout != null) {
+ // set timeout on initial
continuation.setTimeout(continuationTimeout);
}
@@ -75,7 +80,9 @@ protected void service(HttpServletRequest request, HttpServletResponse response)
if (continuation.isExpired()) {
String id = (String) continuation.getAttribute(EXCHANGE_ATTRIBUTE_ID);
- log.warn("Continuation expired of exchangeId: " + id);
+ // remember this id as expired
+ expiredExchanges.put(id, id);
+ log.warn("Continuation expired of exchangeId: {}", id);
response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
return;
}
@@ -92,25 +99,25 @@ protected void service(HttpServletRequest request, HttpServletResponse response)
HttpHelper.setCharsetFromContentType(request.getContentType(), exchange);
exchange.setIn(new HttpMessage(exchange, request, response));
- if (log.isTraceEnabled()) {
- log.trace("Suspending continuation of exchangeId: " + exchange.getExchangeId());
- }
+ log.trace("Suspending continuation of exchangeId: {}", exchange.getExchangeId());
continuation.setAttribute(EXCHANGE_ATTRIBUTE_ID, exchange.getExchangeId());
// must suspend before we process the exchange
continuation.suspend();
- if (log.isTraceEnabled()) {
- log.trace("Processing request for exchangeId: " + exchange.getExchangeId());
- }
+ log.trace("Processing request for exchangeId: {}", exchange.getExchangeId());
// use the asynchronous API to process the exchange
consumer.getAsyncProcessor().process(exchange, new AsyncCallback() {
public void done(boolean doneSync) {
- if (log.isTraceEnabled()) {
- log.trace("Resuming continuation of exchangeId: " + exchange.getExchangeId());
+ // check if the exchange id is already expired
+ boolean expired = expiredExchanges.remove(exchange.getExchangeId()) != null;
+ if (!expired) {
+ log.trace("Resuming continuation of exchangeId: {}", exchange.getExchangeId());
+ // resume processing after both, sync and async callbacks
+ continuation.setAttribute(EXCHANGE_ATTRIBUTE_NAME, exchange);
+ continuation.resume();
+ } else {
+ log.warn("Cannot resume expired continuation of exchangeId: {}", exchange.getExchangeId());
}
- // resume processing after both, sync and async callbacks
- continuation.setAttribute(EXCHANGE_ATTRIBUTE_NAME, exchange);
- continuation.resume();
}
});
@@ -120,9 +127,7 @@ public void done(boolean doneSync) {
}
try {
- if (log.isTraceEnabled()) {
- log.trace("Resumed continuation and writing response for exchangeId: " + result.getExchangeId());
- }
+ log.trace("Resumed continuation and writing response for exchangeId: {}", result.getExchangeId());
// now lets output to the response
consumer.getBinding().writeResponse(result, response);
} catch (IOException e) {
@@ -141,4 +146,11 @@ public Long getContinuationTimeout() {
public void setContinuationTimeout(Long continuationTimeout) {
this.continuationTimeout = continuationTimeout;
}
+
+ @Override
+ public void destroy() {
+ expiredExchanges.clear();
+ super.destroy();
+ }
+
}
@@ -118,4 +118,4 @@
</plugins>
</build>
-</project>
+</project>
@@ -259,9 +259,10 @@ public Message makeJmsMessage(Exchange exchange, org.apache.camel.Message camelM
Message answer = null;
boolean alwaysCopy = endpoint != null && endpoint.getConfiguration().isAlwaysCopyMessage();
+ boolean force = endpoint != null && endpoint.getConfiguration().isForceSendOriginalMessage();
if (!alwaysCopy && camelMessage instanceof JmsMessage) {
JmsMessage jmsMessage = (JmsMessage)camelMessage;
- if (!jmsMessage.shouldCreateNewMessage()) {
+ if (!jmsMessage.shouldCreateNewMessage() || force) {
answer = jmsMessage.getJmsMessage();
}
}
@@ -296,7 +297,7 @@ public void appendJmsProperties(Message jmsMessage, Exchange exchange) throws JM
* Appends the JMS headers from the Camel {@link JmsMessage}
*/
public void appendJmsProperties(Message jmsMessage, Exchange exchange, org.apache.camel.Message in) throws JMSException {
- Set<Map.Entry<String, Object>> entries = in.getHeaders().entrySet();
+ Set<Map.Entry<String, Object>> entries = in.getHeaders().entrySet();
for (Map.Entry<String, Object> entry : entries) {
String headerName = entry.getKey();
Object headerValue = entry.getValue();
@@ -301,6 +301,10 @@ public void setTestConnectionOnStartup(boolean testConnectionOnStartup) {
getConfiguration().setTestConnectionOnStartup(testConnectionOnStartup);
}
+ public void setForceSendOriginalMessage(boolean forceSendOriginalMessage) {
+ getConfiguration().setForceSendOriginalMessage(forceSendOriginalMessage);
+ }
+
public void setRequestTimeout(long requestTimeout) {
getConfiguration().setRequestTimeout(requestTimeout);
}
@@ -113,6 +113,9 @@
private boolean transferExchange;
private boolean transferException;
private boolean testConnectionOnStartup;
+ // if the message is a JmsMessage and mapJmsMessage=false, force the
+ // producer to send the javax.jms.Message body to the next JMS destination
+ private boolean forceSendOriginalMessage;
public JmsConfiguration() {
}
@@ -1075,4 +1078,13 @@ public boolean isTestConnectionOnStartup() {
public void setTestConnectionOnStartup(boolean testConnectionOnStartup) {
this.testConnectionOnStartup = testConnectionOnStartup;
}
+
+ public void setForceSendOriginalMessage(boolean forceSendOriginalMessage) {
+ this.forceSendOriginalMessage = forceSendOriginalMessage;
+ }
+
+ public boolean isForceSendOriginalMessage() {
+ return forceSendOriginalMessage;
+ }
+
}
@@ -926,6 +926,16 @@ public void setTestConnectionOnStartup(boolean testConnectionOnStartup) {
configuration.setTestConnectionOnStartup(testConnectionOnStartup);
}
+ @ManagedAttribute
+ public boolean isForceSendOriginalMessage() {
+ return configuration.isForceSendOriginalMessage();
+ }
+
+ @ManagedAttribute
+ public void setForceSendOriginalMessage(boolean forceSendOriginalMessage) {
+ configuration.setForceSendOriginalMessage(forceSendOriginalMessage);
+ }
+
@ManagedAttribute(description = "Camel id")
public String getCamelId() {
return getCamelContext().getName();
@@ -108,4 +108,4 @@
</plugin>
</plugins>
</build>
-</project>
+</project>
@@ -97,4 +97,4 @@
</dependency>
</dependencies>
-</project>
+</project>
@@ -122,4 +122,4 @@
</plugins>
</reporting>
-</project>
+</project>
View
@@ -37,7 +37,7 @@
<!-- Note that activemq dependency is only used for testing! -->
<activemq-version>5.4.2</activemq-version>
<apacheds-version>1.5.7</apacheds-version>
- <aries-blueprint-version>0.2-incubating</aries-blueprint-version>
+ <aries-blueprint-version>0.3</aries-blueprint-version>
<axiom-version>1.2.8</axiom-version>
<bouncycastle-version>140</bouncycastle-version>
<castor-bundle-version>1.3.1_1</castor-bundle-version>
@@ -71,7 +71,7 @@
<geronimo-jsp-spec-version>1.0.1</geronimo-jsp-spec-version>
<geronimo-jta-spec-version>1.1.1</geronimo-jta-spec-version>
<geronimo-servlet-spec-version>1.1.1</geronimo-servlet-spec-version>
- <groovy-version>1.7.8</groovy-version>
+ <groovy-version>1.7.9</groovy-version>
<guiceyfruit-version>2.0</guiceyfruit-version>
<h2-version>1.2.144</h2-version>
<hamcrest-version>1.2-dev1</hamcrest-version>
@@ -112,7 +112,7 @@
<ognl-version>2.7.3_3</ognl-version>
<openjpa-version>1.2.2</openjpa-version>
<osgi-version>4.1.0</osgi-version>
- <pax-exam-version>1.2.3</pax-exam-version>
+ <pax-exam-version>1.2.4</pax-exam-version>
<pax-tiny-bundle-version>1.2.0</pax-tiny-bundle-version>
<pax-logging-version>1.5.3</pax-logging-version>
<protobuf-version>2.3.0</protobuf-version>
Oops, something went wrong.

0 comments on commit 27105d1

Please sign in to comment.