You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/11/23 15:38:22 UTC
svn commit: r478590 - in
/incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181:
JBIContext.java Jsr181ExchangeProcessor.java
Author: gnodet
Date: Thu Nov 23 06:38:21 2006
New Revision: 478590
URL: http://svn.apache.org/viewvc?view=rev&rev=478590
Log:
SM-753: Provide a way to retrieve the current MessageExchange from a pure POJO in jsr181
Added:
incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/JBIContext.java (with props)
Modified:
incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181ExchangeProcessor.java
Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/JBIContext.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/JBIContext.java?view=auto&rev=478590
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/JBIContext.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/JBIContext.java Thu Nov 23 06:38:21 2006
@@ -0,0 +1,43 @@
+/*
+ * 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.servicemix.jsr181;
+
+import javax.jbi.messaging.MessageExchange;
+
+/**
+ * A static method which provides access to some JBI informations
+ *
+ * @author gnodet
+ */
+public class JBIContext {
+
+ private static ThreadLocal exchanges = new ThreadLocal();
+
+ /**
+ * Retrieve the MessageExchange currently being handled
+ *
+ * @return the current MessageExchange or null
+ */
+ public static MessageExchange getMessageExchange() {
+ return (MessageExchange) exchanges.get();
+ }
+
+ protected static void setMessageExchange(MessageExchange exchange) {
+ exchanges.set(exchange);
+ }
+
+}
Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/JBIContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/JBIContext.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/JBIContext.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181ExchangeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181ExchangeProcessor.java?view=diff&rev=478590&r1=478589&r2=478590
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181ExchangeProcessor.java (original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181ExchangeProcessor.java Thu Nov 23 06:38:21 2006
@@ -104,7 +104,12 @@
}
msg.setAttachments(attachments);
}
- c.receive(ctx, msg);
+ JBIContext.setMessageExchange(exchange);
+ try {
+ c.receive(ctx, msg);
+ } finally {
+ JBIContext.setMessageExchange(null);
+ }
c.close();
// Set response or DONE status