diff --git a/akka-spring/src/main/scala/CamelServiceBeanDefinitionParser.scala b/akka-spring/src/main/scala/CamelServiceBeanDefinitionParser.scala index 88c6d91230..f8234ec8c7 100644 --- a/akka-spring/src/main/scala/CamelServiceBeanDefinitionParser.scala +++ b/akka-spring/src/main/scala/CamelServiceBeanDefinitionParser.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2009-2010 Scalable Solutions AB + * Copyright (C) 2009-2010 Scalable Solutions AB */ 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 true. + */ override def shouldGenerateIdAsFallback = true } \ No newline at end of file diff --git a/akka-spring/src/main/scala/CamelServiceFactoryBean.scala b/akka-spring/src/main/scala/CamelServiceFactoryBean.scala index 3f8f1797ca..040473951e 100644 --- a/akka-spring/src/main/scala/CamelServiceFactoryBean.scala +++ b/akka-spring/src/main/scala/CamelServiceFactoryBean.scala @@ -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 camelService 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 }