#2568 - Adding the ability to configure body conversions in the config file.

This commit is contained in:
Viktor Klang 2012-09-26 17:12:30 +02:00
parent 616f8be730
commit cd0c96ff9c
10 changed files with 97 additions and 56 deletions

View file

@ -1,6 +1,5 @@
package akka.camel.internal
import akka.actor.{ ActorRef, Props, ActorSystem }
import akka.camel.internal.component.{ DurationTypeConverter, ActorComponent }
import org.apache.camel.impl.DefaultCamelContext
import scala.Predef._
@ -16,6 +15,7 @@ import akka.util.Timeout
import akka.pattern.ask
import java.io.InputStream
import org.apache.camel.model.RouteDefinition
import akka.actor.{ ExtendedActorSystem, ActorRef, Props, ActorSystem }
/**
* For internal use only.
@ -26,7 +26,7 @@ import org.apache.camel.model.RouteDefinition
* In the typical scenario, when camel is used with akka extension, it is natural that camel reuses the actor system it extends.
* Also by not creating extra internal actor system we are conserving resources.
*/
private[camel] class DefaultCamel(val system: ActorSystem) extends Camel {
private[camel] class DefaultCamel(val system: ExtendedActorSystem) extends Camel {
val supervisor = system.actorOf(Props[CamelSupervisor], "camel-supervisor")
/**
* For internal use only.
@ -43,7 +43,7 @@ private[camel] class DefaultCamel(val system: ActorSystem) extends Camel {
ctx
}
val settings = new CamelSettings(system.settings.config)
val settings = new CamelSettings(system.settings.config, system.dynamicAccess)
lazy val template: ProducerTemplate = context.createProducerTemplate()
@ -99,19 +99,4 @@ private[camel] class DefaultCamel(val system: ActorSystem) extends Camel {
case EndpointDeActivated(`endpoint`) endpoint
case EndpointFailedToDeActivate(`endpoint`, cause) throw cause
})
}
/**
* For internal use only.
*/
private[camel] object Conversions {
//FIXME Add this to the configuration, and move this functionality to the Camel Extension.
private val bodyConversions = Map(
"file" -> classOf[InputStream])
def apply(scheme: String, routeDefinition: RouteDefinition): RouteDefinition = bodyConversions.get(scheme) match {
case Some(clazz) routeDefinition.convertBodyTo(clazz)
case None routeDefinition
}
}
}