pekko/kernel/src/main/scala/config/ActiveObjectGuiceConfiguratorForJava.scala

82 lines
2.2 KiB
Scala
Raw Normal View History

2009-05-09 17:18:31 +02:00
/**
* Copyright (C) 2009 Scalable Solutions.
*/
package se.scalablesolutions.akka.kernel.config
import akka.kernel.config.JavaConfig._
import com.google.inject._
import com.google.inject.jsr250.ResourceProviderFactory
2009-05-18 08:19:30 +02:00
import java.util._
2009-05-09 17:18:31 +02:00
import org.apache.camel.impl.{JndiRegistry, DefaultCamelContext}
import org.apache.camel.{Endpoint, Routes}
/**
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
class ActiveObjectGuiceConfiguratorForJava {
private val INSTANCE = new ActiveObjectGuiceConfigurator
def getInstance = INSTANCE
2009-05-18 08:19:30 +02:00
2009-05-09 17:18:31 +02:00
/**
* Returns the active abject that has been put under supervision for the class specified.
*
* @param clazz the class for the active object
* @return the active object for the class
*/
2009-05-18 08:19:30 +02:00
def getActiveObject[T](clazz: Class[T]): T = INSTANCE.getActiveObject(clazz)
def configureActiveObjects(
restartStrategy: RestartStrategy, components: Array[Component]):
ActiveObjectGuiceConfiguratorForJava = {
INSTANCE.configureActiveObjects(
restartStrategy.transform,
components.toList.asInstanceOf[scala.List[Component]].map(_.transform))
this
2009-05-09 17:18:31 +02:00
}
2009-05-18 08:19:30 +02:00
def inject(): ActiveObjectGuiceConfiguratorForJava = {
INSTANCE.inject
2009-05-09 17:18:31 +02:00
this
}
2009-05-18 08:19:30 +02:00
def supervise: ActiveObjectGuiceConfiguratorForJava = {
INSTANCE.supervise
2009-05-09 17:18:31 +02:00
this
}
2009-05-18 08:19:30 +02:00
def addExternalGuiceModule(module: Module): ActiveObjectGuiceConfiguratorForJava = {
INSTANCE.addExternalGuiceModule(module)
2009-05-09 20:40:36 +02:00
this
2009-05-09 17:18:31 +02:00
}
2009-05-18 08:19:30 +02:00
def addRoutes(routes: Routes): ActiveObjectGuiceConfiguratorForJava = {
INSTANCE.addRoutes(routes)
2009-05-09 17:18:31 +02:00
this
}
2009-05-18 08:19:30 +02:00
def getComponentInterfaces: List[Class[_]] = {
val al = new ArrayList[Class[_]]
for (c <- INSTANCE.getComponentInterfaces) al.add(c)
al
2009-05-09 17:18:31 +02:00
}
2009-05-18 08:19:30 +02:00
def getExternalDependency[T](clazz: Class[T]): T = INSTANCE.getExternalDependency(clazz)
2009-05-09 17:18:31 +02:00
2009-05-18 08:19:30 +02:00
def getRoutingEndpoint(uri: String): Endpoint = INSTANCE.getRoutingEndpoint(uri)
2009-05-09 17:18:31 +02:00
2009-05-18 08:19:30 +02:00
def getRoutingEndpoints: java.util.Collection[Endpoint] = INSTANCE.getRoutingEndpoints
def getRoutingEndpoints(uri: String): java.util.Collection[Endpoint] = INSTANCE.getRoutingEndpoints(uri)
def getGuiceModules: List[Module] = INSTANCE.getGuiceModules
def reset = INSTANCE.reset
def stop = INSTANCE.stop
2009-05-09 17:18:31 +02:00
}