camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r905598 - in /camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala: RichExchange.scala RichMessage.scala
Date Tue, 02 Feb 2010 12:11:34 GMT
Author: jstrachan
Date: Tue Feb  2 12:11:30 2010
New Revision: 905598

URL: http://svn.apache.org/viewvc?rev=905598&view=rev
Log:
added a RichMessage plus made RichExchange an Exchange implementation so it can be used in
the scalate endpoint

Added:
    camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichMessage.scala
Modified:
    camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichExchange.scala

Modified: camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichExchange.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichExchange.scala?rev=905598&r1=905597&r2=905598&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichExchange.scala
(original)
+++ camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichExchange.scala
Tue Feb  2 12:11:30 2010
@@ -16,13 +16,15 @@
  */
 package org.apache.camel.scala
 
-import org.apache.camel.Exchange
 import reflect.Manifest
+import org.apache.camel.spi.{UnitOfWork, Synchronization}
+import org.apache.camel.{ExchangePattern, Message, Endpoint, Exchange}
+import java.lang.{Exception, String, Class}
 
 /**
  * Rich wrapper for Camel's Exchange implementations
  */
-class RichExchange(val exchange : Exchange) {
+class RichExchange(val exchange : Exchange) extends Exchange {
 
   def in : Any = exchange.getIn().getBody()
   
@@ -38,4 +40,71 @@
 
   def out_=(message:Any) = exchange.getOut().setBody(message)
 
+
+  // Delegation methods
+  //-------------------------------------------------------------------------
+
+  def setUnitOfWork(unitOfWork: UnitOfWork) = exchange.setUnitOfWork(unitOfWork)
+
+  def setProperty(name: String, value: Any) = exchange.setProperty(name, value)
+
+  def setPattern(pattern: ExchangePattern) = exchange.setPattern(pattern)
+
+  def setOut(out: Message) = exchange.setOut(out)
+
+  def setIn(in: Message) = exchange.setIn(in)
+
+  def setFromEndpoint(fromEndpoint: Endpoint) = exchange.setFromEndpoint(fromEndpoint)
+
+  def setExchangeId(id: String) = exchange.setExchangeId(id)
+
+  def setException(e: Exception) = exchange.setException(e)
+
+  def removeProperty(name: String) = exchange.removeProperty(name)
+
+  def isTransacted = exchange.isTransacted
+
+  def isRollbackOnly = exchange.isRollbackOnly
+
+  def isFailed = exchange.isFailed
+
+  def hasProperties = exchange.hasProperties
+
+  def hasOut = exchange.hasOut
+
+  def getUnitOfWork = exchange.getUnitOfWork
+
+  def getProperty[T](name: String, propertyType : Class[T]) = exchange.getProperty(name,
propertyType)
+
+  def getProperty[T](name: String, defaultValue: Any, propertyType : Class[T]) = exchange.getProperty(name,
defaultValue, propertyType)
+
+  def getProperty(name: String, defaultValue: Any) = exchange.getProperty(name, defaultValue)
+
+  def getProperty(name: String) = exchange.getProperty(name)
+
+  def getProperties = exchange.getProperties
+
+  def getPattern = exchange.getPattern
+
+  def getOut[T](outType : Class[T]) = exchange.getOut(outType)
+
+  def getOut = exchange.getOut
+
+  def getIn[T](inType : Class[T]) = exchange.getIn(inType)
+
+  def getIn = exchange.getIn
+
+  def getFromEndpoint = exchange.getFromEndpoint
+
+  def getExchangeId = exchange.getExchangeId
+
+  def getException[T](exceptionType : Class[T]) = exchange.getException(exceptionType)
+
+  def getException = exchange.getException
+
+  def getContext = exchange.getContext
+
+  def copy = new RichExchange(exchange.copy)
+
+  def addOnCompletion(onCompletion: Synchronization) = exchange.addOnCompletion(onCompletion)
 }

Added: camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichMessage.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichMessage.scala?rev=905598&view=auto
==============================================================================
--- camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichMessage.scala
(added)
+++ camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/RichMessage.scala
Tue Feb  2 12:11:30 2010
@@ -0,0 +1,76 @@
+package org.apache.camel.scala
+
+import org.apache.camel.Message
+import java.util.Map
+import java.lang.{Class, String}
+import javax.activation.DataHandler
+
+/**
+ * @version $Revision: 1.1 $
+ */
+
+class RichMessage(val message: Message) extends Message {
+
+  // Delegate methods
+  //-------------------------------------------------------------------------
+
+  def setMessageId(messageId: String) = message.setMessageId(messageId)
+
+  def setHeaders(headers: Map[String, Object]) = message.setHeaders(headers)
+
+  def setHeader(name: String, value: Any) = message.setHeader(name, value)
+
+  def setFault(fault: Boolean) = message.setFault(fault)
+
+  def setBody[T](body: Any, bodyType : Class[T]) = message.setBody(body, bodyType)
+
+  def setBody(body: Any) = message.setBody()
+
+  def setAttachments(attachments: Map[String, DataHandler]) = message.setAttachments(attachments)
+
+  def removeHeader(name: String) = message.removeHeader(name)
+
+  def removeAttachment(id: String) = message.removeAttachment(id)
+
+  def isFault = message.isFault
+
+  def hasHeaders = message.hasHeaders
+
+  def hasAttachments = message.hasAttachments
+
+  def getMessageId = message.getMessageId
+
+  def getMandatoryBody[T](bodyType : Class[T]) = message.getMandatoryBody(bodyType)
+
+  def getMandatoryBody = message.getMandatoryBody
+
+  def getHeaders = message.getHeaders
+
+  def getHeader[T](name: String, headerType : Class[T]) = message.getHeader(name, headerType)
+
+  def getHeader[T](name: String, defaultValue: Any, headerType : Class[T]) = message.getHeader(name,
defaultValue, headerType)
+
+  def getHeader(name: String, defaultValue: Any) = message.getHeader(name, defaultValue)
+
+  def getHeader(name: String) = message.getHeader(name)
+
+  def getExchange = message.getExchange
+
+  def getBody[T](bodyType : Class[T]) = message.getBody(bodyType)
+
+  def getBody = message.getBody
+
+  def getAttachments = message.getAttachments
+
+  def getAttachmentNames = message.getAttachmentNames
+
+  def getAttachment(id: String) = message.getAttachment(id)
+
+  def createExchangeId = message.createExchangeId
+
+  def copyFrom(message: Message) = message.copyFrom(message)
+
+  def copy = new RichMessage(message.copy)
+
+  def addAttachment(id: String, content: DataHandler) = message.addAttachment(id, content)
+}
\ No newline at end of file



Mime
View raw message