Documentation added.
This commit is contained in:
parent
e569b4f4bb
commit
87461dce94
2 changed files with 23 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
||||
*/
|
||||
package se.scalablesolutions.akka.spring
|
||||
|
||||
|
|
@ -12,9 +12,15 @@ import se.scalablesolutions.akka.spring.AkkaSpringConfigurationTags._
|
|||
|
||||
|
||||
/**
|
||||
* Parser for <camel-service> elements.
|
||||
*
|
||||
* @author Martin Krasser
|
||||
*/
|
||||
class CamelServiceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
/**
|
||||
* Parses the <camel-service> element. If a nested <camel-context> element
|
||||
* is defined then the referenced context is set on the {@link CamelServiceFactoryBean}.
|
||||
*/
|
||||
override def doParse(element: Element, parserContext: ParserContext, builder: BeanDefinitionBuilder) {
|
||||
val camelContextElement = DomUtils.getChildElementByTagName(element, CAMEL_CONTEXT_TAG);
|
||||
if (camelContextElement ne null) {
|
||||
|
|
@ -22,8 +28,14 @@ class CamelServiceBeanDefinitionParser extends AbstractSingleBeanDefinitionParse
|
|||
builder.addPropertyReference("camelContext", camelContextReference)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the class of {@link CamelServiceFactoryBean}
|
||||
*/
|
||||
override def getBeanClass(element: Element): Class[_] = classOf[CamelServiceFactoryBean]
|
||||
|
||||
/**
|
||||
* Returns <code>true</code>.
|
||||
*/
|
||||
override def shouldGenerateIdAsFallback = true
|
||||
}
|
||||
|
|
@ -8,6 +8,8 @@ import org.springframework.beans.factory.{DisposableBean, InitializingBean, Fact
|
|||
import se.scalablesolutions.akka.camel.{CamelContextManager, CamelService}
|
||||
|
||||
/**
|
||||
* Factory bean for a {@link CamelService}.
|
||||
*
|
||||
* @author Martin Krasser
|
||||
*/
|
||||
class CamelServiceFactoryBean extends FactoryBean[CamelService] with InitializingBean with DisposableBean {
|
||||
|
|
@ -21,6 +23,10 @@ class CamelServiceFactoryBean extends FactoryBean[CamelService] with Initializin
|
|||
|
||||
def getObject = instance
|
||||
|
||||
/**
|
||||
* Initializes the {@link CamelContextManager} with <code>camelService</code> if defined, then
|
||||
* creates and starts the {@link CamelService} singleton.
|
||||
*/
|
||||
def afterPropertiesSet = {
|
||||
if (camelContext ne null) {
|
||||
CamelContextManager.init(camelContext)
|
||||
|
|
@ -29,6 +35,9 @@ class CamelServiceFactoryBean extends FactoryBean[CamelService] with Initializin
|
|||
instance.load
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the {@link CamelService} singleton.
|
||||
*/
|
||||
def destroy = {
|
||||
instance.unload
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue