Repository: apache/servicemix Branch: master Commit: efaa40471643 Files: 406 Total size: 1.2 MB Directory structure: gitextract_eceba452/ ├── .gitignore ├── BUILDING ├── LICENSE ├── NOTICE ├── README ├── RELEASE-NOTES ├── activemq/ │ ├── activemq-camel/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main/ │ │ ├── java/ │ │ │ └── org/ │ │ │ └── apache/ │ │ │ └── servicemix/ │ │ │ └── activemq/ │ │ │ └── camel/ │ │ │ ├── ActiveMQComponent.java │ │ │ └── ActiveMQComponentResolver.java │ │ └── resources/ │ │ └── OSGI-INF/ │ │ └── blueprint/ │ │ └── activemq-camel.xml │ ├── activemq-service/ │ │ ├── README.md │ │ ├── pom.xml │ │ └── src/ │ │ └── main/ │ │ └── resources/ │ │ ├── OSGI-INF/ │ │ │ └── blueprint/ │ │ │ └── activemq-service.xml │ │ └── org.apache.servicemix.activemq.service.cfg │ └── pom.xml ├── activiti/ │ ├── activiti-config/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── activiti/ │ │ │ │ └── config/ │ │ │ │ └── CamelAwareELResolver.java │ │ │ └── resources/ │ │ │ └── OSGI-INF/ │ │ │ └── blueprint/ │ │ │ └── activiti-config.xml │ │ └── test/ │ │ ├── java/ │ │ │ └── org/ │ │ │ └── apache/ │ │ │ └── servicemix/ │ │ │ └── activiti/ │ │ │ └── config/ │ │ │ └── CamelAwareELResolverTest.java │ │ └── resources/ │ │ └── log4j.properties │ └── pom.xml ├── assemblies/ │ ├── apache-servicemix/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main/ │ │ ├── descriptors/ │ │ │ ├── unix-bin.xml │ │ │ └── unix-src.xml │ │ ├── filtered-resources/ │ │ │ └── etc/ │ │ │ ├── org.apache.karaf.features.cfg │ │ │ └── overrides.properties │ │ └── resources/ │ │ ├── common-unix-bin.xml │ │ ├── etc/ │ │ │ ├── custom.properties │ │ │ ├── jre.properties │ │ │ ├── org.apache.activemq.webconsole.cfg │ │ │ ├── org.apache.aries.transaction.cfg │ │ │ ├── org.apache.cxf.wsn.cfg │ │ │ ├── org.ops4j.pax.logging.cfg │ │ │ ├── org.ops4j.pax.url.mvn.cfg │ │ │ ├── org.ops4j.pax.web.cfg.empty.stub │ │ │ ├── system.properties │ │ │ └── users.properties │ │ ├── licenses/ │ │ │ ├── asm.txt │ │ │ ├── bsd.txt │ │ │ ├── cddl-1.0.txt │ │ │ ├── cpl-1.0.txt │ │ │ ├── epl-1.0.txt │ │ │ └── slf4j-mit.txt │ │ ├── setenv-unix │ │ └── setenv-win │ ├── apache-servicemix-examples/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main/ │ │ └── filtered-resources/ │ │ └── pom.xml │ ├── features/ │ │ ├── pom.xml │ │ ├── servicemix-examples/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ └── feature/ │ │ │ └── feature.xml │ │ ├── servicemix-features/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ └── feature/ │ │ │ └── feature.xml │ │ └── servicemix-kie/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main/ │ │ └── feature/ │ │ └── feature.xml │ └── pom.xml ├── branding/ │ ├── pom.xml │ └── src/ │ └── main/ │ └── resources/ │ └── org/ │ └── apache/ │ └── karaf/ │ └── branding/ │ └── branding.properties ├── etc/ │ └── appended-resources/ │ └── supplemental-models.xml ├── examples/ │ ├── README.txt │ ├── activemq/ │ │ ├── activemq-camel-blueprint/ │ │ │ ├── README.txt │ │ │ ├── org.apache.servicemix.examples.cfg │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── activemq/ │ │ │ │ └── MyTransform.java │ │ │ └── resources/ │ │ │ └── OSGI-INF/ │ │ │ └── blueprint/ │ │ │ └── blueprint.xml │ │ └── pom.xml │ ├── activiti/ │ │ ├── activiti-camel/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── activiti/ │ │ │ │ └── ActivitiRouteBuilder.java │ │ │ └── resources/ │ │ │ └── OSGI-INF/ │ │ │ ├── activiti/ │ │ │ │ └── OrderProcess.bpmn20.xml │ │ │ └── blueprint/ │ │ │ └── activiti-camel.xml │ │ └── pom.xml │ ├── akka/ │ │ ├── akka-camel/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ ├── main/ │ │ │ │ ├── resources/ │ │ │ │ │ └── application.conf │ │ │ │ └── scala/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── akka/ │ │ │ │ ├── Application.scala │ │ │ │ ├── CamelBridge.scala │ │ │ │ ├── RouteBuilder.scala │ │ │ │ └── Stats.scala │ │ │ └── test/ │ │ │ ├── resources/ │ │ │ │ ├── application.conf │ │ │ │ ├── generate_test_data.rb │ │ │ │ ├── log4j.properties │ │ │ │ └── samples/ │ │ │ │ ├── file1.csv │ │ │ │ ├── file2.csv │ │ │ │ ├── file3.csv │ │ │ │ ├── file4.csv │ │ │ │ └── file5.csv │ │ │ └── scala/ │ │ │ └── org/ │ │ │ └── apache/ │ │ │ └── servicemix/ │ │ │ └── examples/ │ │ │ └── akka/ │ │ │ ├── RouteBuilderTest.scala │ │ │ └── StatsTest.scala │ │ └── pom.xml │ ├── camel/ │ │ ├── camel-blueprint/ │ │ │ ├── README.txt │ │ │ ├── org.apache.servicemix.examples.cfg │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── camel/ │ │ │ │ └── MyTransform.java │ │ │ └── resources/ │ │ │ └── OSGI-INF/ │ │ │ └── blueprint/ │ │ │ └── blueprint.xml │ │ ├── camel-cxf-rest/ │ │ │ ├── README.txt │ │ │ ├── camel-cxf-rest-client/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ └── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── camel/ │ │ │ │ └── rest/ │ │ │ │ └── client/ │ │ │ │ └── Client.java │ │ │ ├── camel-cxf-rest-route/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── camel/ │ │ │ │ │ └── rest/ │ │ │ │ │ └── PersonService.java │ │ │ │ └── resources/ │ │ │ │ └── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ ├── camel-cxf-rest-service/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── camel/ │ │ │ │ │ └── rest/ │ │ │ │ │ ├── ServiceHandler.java │ │ │ │ │ └── model/ │ │ │ │ │ └── Person.java │ │ │ │ └── resources/ │ │ │ │ └── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ └── pom.xml │ │ ├── camel-cxf-soap/ │ │ │ ├── README.txt │ │ │ ├── camel-cxf-soap-client/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ └── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── camel/ │ │ │ │ └── soap/ │ │ │ │ └── client/ │ │ │ │ └── Client.java │ │ │ ├── camel-cxf-soap-route/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── camel/ │ │ │ │ │ └── soap/ │ │ │ │ │ └── PersonService.java │ │ │ │ └── resources/ │ │ │ │ └── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ ├── camel-cxf-soap-service/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── camel/ │ │ │ │ │ └── soap/ │ │ │ │ │ ├── ServiceHandler.java │ │ │ │ │ └── model/ │ │ │ │ │ ├── Person.java │ │ │ │ │ └── PersonException.java │ │ │ │ └── resources/ │ │ │ │ └── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ └── pom.xml │ │ ├── camel-drools/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── camel/ │ │ │ │ ├── Drinks.java │ │ │ │ ├── DroolsCommandHelper.java │ │ │ │ ├── Person.java │ │ │ │ ├── PersonHelper.java │ │ │ │ └── Sex.java │ │ │ └── resources/ │ │ │ ├── META-INF/ │ │ │ │ └── spring/ │ │ │ │ └── camel-context.xml │ │ │ ├── log4j.properties │ │ │ └── testSpring.drl │ │ ├── camel-drools-blueprint/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── camel/ │ │ │ │ ├── Drinks.java │ │ │ │ ├── DroolsBlueprintBean.java │ │ │ │ ├── DroolsCommandHelper.java │ │ │ │ ├── Person.java │ │ │ │ ├── PersonHelper.java │ │ │ │ └── Sex.java │ │ │ └── resources/ │ │ │ ├── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ ├── log4j.properties │ │ │ └── testSpring.drl │ │ ├── camel-osgi/ │ │ │ ├── README.txt │ │ │ ├── org.apache.servicemix.examples.cfg │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── camel/ │ │ │ │ ├── MyRouteBuilder.java │ │ │ │ └── MyTransform.java │ │ │ └── resources/ │ │ │ └── META-INF/ │ │ │ └── spring/ │ │ │ └── beans.xml │ │ ├── camel-sql/ │ │ │ ├── README.txt │ │ │ ├── camel-sql-datasource-derby/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── camel/ │ │ │ │ │ └── sql/ │ │ │ │ │ └── DatabaseBeanDerby.java │ │ │ │ └── resources/ │ │ │ │ └── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ ├── camel-sql-datasource-h2/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── camel/ │ │ │ │ │ └── sql/ │ │ │ │ │ └── DatabaseBeanH2.java │ │ │ │ └── resources/ │ │ │ │ └── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ ├── camel-sql-datasource-pgsql/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── camel/ │ │ │ │ │ └── sql/ │ │ │ │ │ └── DatabaseBeanPgSQL.java │ │ │ │ └── resources/ │ │ │ │ └── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ ├── camel-sql-orders/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── camel/ │ │ │ │ │ └── sql/ │ │ │ │ │ ├── ListenerBean.java │ │ │ │ │ └── OrderBean.java │ │ │ │ └── resources/ │ │ │ │ ├── OSGI-INF/ │ │ │ │ │ └── blueprint/ │ │ │ │ │ └── blueprint.xml │ │ │ │ └── sql.properties │ │ │ └── pom.xml │ │ └── pom.xml │ ├── cxf/ │ │ ├── cxf-jaxrs/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── cxf/ │ │ │ │ └── jaxrs/ │ │ │ │ ├── Customer.java │ │ │ │ ├── CustomerService.java │ │ │ │ ├── Order.java │ │ │ │ ├── Product.java │ │ │ │ └── client/ │ │ │ │ └── Client.java │ │ │ └── resources/ │ │ │ ├── META-INF/ │ │ │ │ └── spring/ │ │ │ │ └── beans.xml │ │ │ └── org/ │ │ │ └── apache/ │ │ │ └── servicemix/ │ │ │ └── examples/ │ │ │ └── cxf/ │ │ │ └── jaxrs/ │ │ │ └── client/ │ │ │ ├── add_customer.xml │ │ │ └── update_customer.xml │ │ ├── cxf-jaxrs-blueprint/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── cxf/ │ │ │ │ └── jaxrs/ │ │ │ │ ├── Customer.java │ │ │ │ ├── CustomerService.java │ │ │ │ ├── Order.java │ │ │ │ ├── Product.java │ │ │ │ └── client/ │ │ │ │ └── Client.java │ │ │ └── resources/ │ │ │ ├── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ └── org/ │ │ │ └── apache/ │ │ │ └── servicemix/ │ │ │ └── examples/ │ │ │ └── cxf/ │ │ │ └── jaxrs/ │ │ │ └── client/ │ │ │ ├── add_customer.xml │ │ │ └── update_customer.xml │ │ ├── cxf-jaxws-blueprint/ │ │ │ ├── README.txt │ │ │ ├── client.html │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ ├── examples/ │ │ │ │ │ └── cxf/ │ │ │ │ │ ├── EnableCORSInterceptor.java │ │ │ │ │ ├── HelloWorld.java │ │ │ │ │ └── HelloWorldImpl.java │ │ │ │ └── samples/ │ │ │ │ └── cxf_osgi/ │ │ │ │ └── Client.java │ │ │ └── resources/ │ │ │ ├── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ └── org/ │ │ │ └── apache/ │ │ │ └── servicemix/ │ │ │ └── samples/ │ │ │ └── cxf_osgi/ │ │ │ └── request.xml │ │ ├── cxf-osgi/ │ │ │ ├── README.txt │ │ │ ├── client.html │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ ├── examples/ │ │ │ │ │ └── cxf/ │ │ │ │ │ ├── EnableCORSInterceptor.java │ │ │ │ │ ├── HelloWorld.java │ │ │ │ │ └── HelloWorldImpl.java │ │ │ │ └── samples/ │ │ │ │ └── cxf_osgi/ │ │ │ │ └── Client.java │ │ │ └── resources/ │ │ │ ├── META-INF/ │ │ │ │ └── spring/ │ │ │ │ └── beans.xml │ │ │ └── org/ │ │ │ └── apache/ │ │ │ └── servicemix/ │ │ │ └── samples/ │ │ │ └── cxf_osgi/ │ │ │ └── request.xml │ │ ├── cxf-ws-addressing/ │ │ │ ├── README.txt │ │ │ ├── client.html │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── cxf/ │ │ │ │ ├── EnableCORSInterceptor.java │ │ │ │ └── wsaddressing/ │ │ │ │ ├── Client.java │ │ │ │ └── GreeterImpl.java │ │ │ └── resources/ │ │ │ ├── META-INF/ │ │ │ │ └── spring/ │ │ │ │ └── beans.xml │ │ │ ├── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── cxf/ │ │ │ │ └── wsaddressing/ │ │ │ │ └── request.xml │ │ │ └── wsdl/ │ │ │ └── hello_world_addr.wsdl │ │ ├── cxf-ws-rm/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ ├── examples/ │ │ │ │ │ └── cxf/ │ │ │ │ │ ├── HelloWorld.java │ │ │ │ │ └── HelloWorldImpl.java │ │ │ │ └── samples/ │ │ │ │ └── cxf_ws_rm/ │ │ │ │ ├── Client.java │ │ │ │ └── MessageLossSimulator.java │ │ │ └── resources/ │ │ │ ├── HelloWorld.wsdl │ │ │ ├── META-INF/ │ │ │ │ └── spring/ │ │ │ │ └── beans.xml │ │ │ └── org/ │ │ │ └── apache/ │ │ │ └── servicemix/ │ │ │ └── samples/ │ │ │ └── cxf_ws_rm/ │ │ │ └── ws_rm.xml │ │ ├── cxf-ws-security-blueprint/ │ │ │ ├── README.txt │ │ │ ├── client.html │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── cxf/ │ │ │ │ ├── Client.java │ │ │ │ ├── ClientPasswordCallback.java │ │ │ │ ├── CustomerSecurityInterceptor.java │ │ │ │ ├── EnableCORSInterceptor.java │ │ │ │ ├── HelloWorld.java │ │ │ │ └── HelloWorldImpl.java │ │ │ └── resources/ │ │ │ ├── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ └── log4j.properties │ │ ├── cxf-ws-security-osgi/ │ │ │ ├── README.txt │ │ │ ├── client.html │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── cxf/ │ │ │ │ ├── Client.java │ │ │ │ ├── ClientPasswordCallback.java │ │ │ │ ├── CustomerSecurityInterceptor.java │ │ │ │ ├── EnableCORSInterceptor.java │ │ │ │ ├── HelloWorld.java │ │ │ │ └── HelloWorldImpl.java │ │ │ └── resources/ │ │ │ ├── META-INF/ │ │ │ │ └── spring/ │ │ │ │ └── beans.xml │ │ │ └── log4j.properties │ │ ├── cxf-ws-security-signature/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── cxf/ │ │ │ │ ├── Client.java │ │ │ │ ├── HelloWorld.java │ │ │ │ ├── HelloWorldImpl.java │ │ │ │ └── ServerPasswordCallback.java │ │ │ └── resources/ │ │ │ ├── META-INF/ │ │ │ │ └── spring/ │ │ │ │ └── beans.xml │ │ │ ├── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── cxf/ │ │ │ │ └── request.xml │ │ │ └── server-truststore.jks │ │ ├── cxf-wsn/ │ │ │ ├── README.txt │ │ │ ├── cxf-wsn-base/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── cxf/ │ │ │ │ │ └── base/ │ │ │ │ │ ├── Email.java │ │ │ │ │ └── package-info.java │ │ │ │ └── resources/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── cxf/ │ │ │ │ └── base/ │ │ │ │ └── jaxb.index │ │ │ ├── cxf-wsn-client/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ └── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── cxf/ │ │ │ │ └── client/ │ │ │ │ └── Client.java │ │ │ ├── cxf-wsn-notifier/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── cxf/ │ │ │ │ │ └── notifier/ │ │ │ │ │ ├── Notifier.java │ │ │ │ │ └── SpamGenerator.java │ │ │ │ └── resources/ │ │ │ │ └── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ ├── cxf-wsn-receive/ │ │ │ │ ├── pom.xml │ │ │ │ └── src/ │ │ │ │ └── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── cxf/ │ │ │ │ │ └── receive/ │ │ │ │ │ └── Subscriber.java │ │ │ │ └── resources/ │ │ │ │ └── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ └── blueprint.xml │ │ │ └── pom.xml │ │ └── pom.xml │ ├── drools/ │ │ ├── drools-camel-blueprint/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── drools/ │ │ │ │ └── camel/ │ │ │ │ └── blueprint/ │ │ │ │ ├── model/ │ │ │ │ │ ├── Customer.java │ │ │ │ │ └── CustomerType.java │ │ │ │ └── osgi/ │ │ │ │ ├── DebugAgendaEventListener.java │ │ │ │ ├── DebugRuleRuntimeEventListener.java │ │ │ │ └── Utils.java │ │ │ └── resources/ │ │ │ ├── OSGI-INF/ │ │ │ │ └── blueprint/ │ │ │ │ ├── camel-context.xml │ │ │ │ └── kmodule-blueprint.xml │ │ │ └── rule/ │ │ │ └── customer-score.drl │ │ ├── drools-camel-cxf-server/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ ├── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── drools/ │ │ │ │ │ └── camel/ │ │ │ │ │ └── cxf/ │ │ │ │ │ └── server/ │ │ │ │ │ ├── model/ │ │ │ │ │ │ ├── Customer.java │ │ │ │ │ │ └── CustomerType.java │ │ │ │ │ └── osgi/ │ │ │ │ │ ├── CommandMessageBodyRW.java │ │ │ │ │ ├── DebugAgendaEventListener.java │ │ │ │ │ ├── DebugRuleRuntimeEventListener.java │ │ │ │ │ └── Utils.java │ │ │ │ └── resources/ │ │ │ │ ├── OSGI-INF/ │ │ │ │ │ └── blueprint/ │ │ │ │ │ ├── camel-client.xml │ │ │ │ │ ├── camel-server.xml │ │ │ │ │ └── kmodule-blueprint.xml │ │ │ │ └── rule/ │ │ │ │ └── customer-score.drl │ │ │ └── test/ │ │ │ └── resources/ │ │ │ ├── batch-test-request.xml │ │ │ └── test-request.xml │ │ ├── drools-simple/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ ├── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── org/ │ │ │ │ │ └── apache/ │ │ │ │ │ └── servicemix/ │ │ │ │ │ └── examples/ │ │ │ │ │ └── drools/ │ │ │ │ │ └── simple/ │ │ │ │ │ ├── model/ │ │ │ │ │ │ ├── Customer.java │ │ │ │ │ │ └── CustomerType.java │ │ │ │ │ └── osgi/ │ │ │ │ │ ├── SimpleRuleActivator.java │ │ │ │ │ └── Utils.java │ │ │ │ └── resources/ │ │ │ │ ├── META-INF/ │ │ │ │ │ └── kmodule.xml │ │ │ │ └── rule/ │ │ │ │ └── simple.drl │ │ │ └── test/ │ │ │ └── java/ │ │ │ └── org/ │ │ │ └── apache/ │ │ │ └── servicemix/ │ │ │ └── examples/ │ │ │ └── drools/ │ │ │ └── test/ │ │ │ ├── ActivatorTest.java │ │ │ └── SimpleTest.java │ │ ├── drools-spring/ │ │ │ ├── README.txt │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── examples/ │ │ │ │ └── drools/ │ │ │ │ └── spring/ │ │ │ │ ├── model/ │ │ │ │ │ ├── Customer.java │ │ │ │ │ └── CustomerType.java │ │ │ │ └── osgi/ │ │ │ │ ├── DebugAgendaEventListener.java │ │ │ │ ├── DebugRuleRuntimeEventListener.java │ │ │ │ ├── SimpleRuleBean.java │ │ │ │ └── Utils.java │ │ │ └── resources/ │ │ │ ├── META-INF/ │ │ │ │ └── spring/ │ │ │ │ └── simple-spring.xml │ │ │ └── rule/ │ │ │ └── customer-score.drl │ │ └── pom.xml │ └── pom.xml ├── itests/ │ ├── pom.xml │ └── src/ │ └── test/ │ ├── java/ │ │ └── org/ │ │ └── apache/ │ │ └── servicemix/ │ │ └── itests/ │ │ ├── BasicDistroTest.java │ │ ├── ExamplesCXFTest.java │ │ ├── ExamplesCamelTest.java │ │ ├── ExamplesDrools6Test.java │ │ ├── ExamplesTest.java │ │ └── base/ │ │ ├── Features.java │ │ ├── LogCollector.java │ │ └── ServiceMixDistroTest.java │ └── resources/ │ └── log4j.properties ├── logging/ │ ├── jms-appender/ │ │ ├── README.txt │ │ ├── pom.xml │ │ └── src/ │ │ ├── main/ │ │ │ ├── java/ │ │ │ │ └── org/ │ │ │ │ └── apache/ │ │ │ │ └── servicemix/ │ │ │ │ └── logging/ │ │ │ │ └── jms/ │ │ │ │ ├── DefaultLoggingEventFormat.java │ │ │ │ ├── JMSAppender.java │ │ │ │ ├── LoggingEventFormat.java │ │ │ │ └── LogstashEventFormat.java │ │ │ └── resources/ │ │ │ └── OSGI-INF/ │ │ │ └── blueprint/ │ │ │ └── config.xml │ │ └── test/ │ │ ├── java/ │ │ │ └── org/ │ │ │ └── apache/ │ │ │ └── servicemix/ │ │ │ └── logging/ │ │ │ └── jms/ │ │ │ ├── JMSAppenderTest.java │ │ │ ├── LogstashEventFormatTest.java │ │ │ └── MockEvents.java │ │ └── resources/ │ │ └── log4j.properties │ └── pom.xml ├── manual/ │ ├── README.txt │ ├── pom.xml │ └── src/ │ └── main/ │ ├── asciidoc/ │ │ ├── activemq-guide/ │ │ │ ├── _activemq-camel-example.adoc │ │ │ ├── _activemq-guide.adoc │ │ │ ├── _introduction.adoc │ │ │ └── activemq-guide.adoc │ │ ├── activiti-guide/ │ │ │ ├── _activiti-camel-example.adoc │ │ │ ├── _activiti-guide.adoc │ │ │ ├── _introduction.adoc │ │ │ └── activiti-guide.adoc │ │ ├── camel-guide/ │ │ │ ├── _camel-guide.adoc │ │ │ ├── _deployment.adoc │ │ │ ├── _installing-components.adoc │ │ │ ├── _introduction.adoc │ │ │ ├── _osgi-bundle-blueprint.adoc │ │ │ ├── _osgi-bundle-spring.adoc │ │ │ ├── _plain-blueprint.adoc │ │ │ ├── _plain-spring.adoc │ │ │ ├── _troubleshooting.adoc │ │ │ ├── camel-guide.adoc │ │ │ ├── plain-blueprint-template.xml │ │ │ ├── plain-blueprint.xml │ │ │ ├── plain-spring-template.xml │ │ │ └── plain-spring.xml │ │ ├── contribute.adoc │ │ ├── docinfo-footer.html │ │ ├── docinfo.html │ │ ├── documentation.adoc │ │ ├── index.adoc │ │ ├── quickstart/ │ │ │ ├── _activemq.adoc │ │ │ ├── _camel.adoc │ │ │ ├── _console.adoc │ │ │ ├── _features.adoc │ │ │ ├── _installation.adoc │ │ │ ├── _introduction.adoc │ │ │ ├── _quickstart.adoc │ │ │ ├── _summary.adoc │ │ │ └── quickstart.adoc │ │ ├── resources/ │ │ │ ├── _resources.adoc │ │ │ └── resources.adoc │ │ └── user-guide/ │ │ ├── _introduction.adoc │ │ ├── _technology-selection.adoc │ │ ├── _user-guide.adoc │ │ ├── _what-is-servicemix.adoc │ │ └── user-guide.adoc │ └── groovy/ │ └── CreateKarafCommandsAdocFile.groovy ├── parent/ │ ├── assemblies-parent/ │ │ └── pom.xml │ ├── features-parent/ │ │ └── pom.xml │ └── pom.xml ├── pom.xml └── tooling/ ├── archetypes/ │ ├── pom.xml │ ├── servicemix-cxf-code-first-osgi-bundle/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main/ │ │ └── resources/ │ │ ├── META-INF/ │ │ │ └── maven/ │ │ │ └── archetype.xml │ │ └── archetype-resources/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main/ │ │ ├── java/ │ │ │ ├── Person.java │ │ │ ├── PersonImpl.java │ │ │ ├── UnknownPersonFault.java │ │ │ ├── client/ │ │ │ │ └── Client.java │ │ │ └── types/ │ │ │ ├── GetPerson.java │ │ │ ├── GetPersonResponse.java │ │ │ ├── ObjectFactory.java │ │ │ ├── UnknownPersonFault.java │ │ │ └── package-info.java │ │ └── resources/ │ │ └── META-INF/ │ │ └── spring/ │ │ └── beans.xml │ ├── servicemix-cxf-wsdl-first-osgi-bundle/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main/ │ │ └── resources/ │ │ ├── META-INF/ │ │ │ └── maven/ │ │ │ └── archetype.xml │ │ └── archetype-resources/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main/ │ │ ├── java/ │ │ │ └── PersonImpl.java │ │ └── resources/ │ │ ├── META-INF/ │ │ │ └── spring/ │ │ │ └── beans.xml │ │ └── wsdl/ │ │ └── person.wsdl │ └── servicemix-osgi-bundle/ │ ├── pom.xml │ └── src/ │ └── main/ │ └── resources/ │ ├── META-INF/ │ │ └── maven/ │ │ └── archetype.xml │ └── archetype-resources/ │ └── pom.xml └── pom.xml ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ generated-docs-karaf .settings .classpath .project target .idea .vscode *.i?? velocity.log .DS_Store ================================================ FILE: BUILDING ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Building Apache ServiceMix 6 ============================ Initial Setup ------------- 1) Install J2SE 8.0 SDK, which can be downloaded from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Use latest version. 2) Make sure that your JAVA_HOME environment variable is set to the newly installed JDK location, and that your PATH includes %JAVA_HOME%\bin (windows) or $JAVA_HOME$/bin (unix). 3) Install Maven 3.2.5, which can be downloaded from http://maven.apache.org/download.html. Make sure that your PATH includes the MVN_HOME/bin directory. Building -------- 1) Change to the top level directory of Apache ServiceMix source distribution. 2) Run $> mvn This will compile Apache ServiceMix and run all of the tests in the Apache ServiceMix Kernel source distribution. Alternatively, you can run $> mvn -Pfastinstall This will compile Apache ServiceMix without running the tests and takes less time to build. Depending on the load of remote Maven repositories, you may have to run "mvn" several times until the required dependencies are all located in your local maven repository. It usually takes some time for maven to download required dependencies in the first build. 3) The distributions will be available under "assembly/target" directory. ================================================ FILE: LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: NOTICE ================================================ ========================================================================= == NOTICE file for use with the Apache License, Version 2.0, == == in this case for the Apache ServiceMix distribution. == ========================================================================= This product contains software developed by The Apache Software Foundation (http://www.apache.org/). This product contains software developed by Open Participation Software for Java (http://www.ops4j.org/). This software contains unmodified binary redistributions for H2 database engine (http://www.h2database.com/), which is dual licensed and available under a modified version of the MPL 1.1 (Mozilla Public License) or under the (unmodified) EPL 1.0 (Eclipse Public License). An original copy of the license agreement can be found at: http://www.h2database.com/html/license.html This software contains unmodified binary redistributions for StAX-Ex library (https://stax-ex.java.net/), which is dual licensed and available under the (unmodified) CDDL 1.1 (Common Development and Distribution License) or under the (unmodified) GPL v2 (GNU General Public License). An original copy of the license agreement can be found at: http://glassfish.java.net/public/CDDL+GPL_1_1.html ================================================ FILE: README ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Welcome to Apache ServiceMix 7 ============================== Apache ServiceMix is a flexible, open-source integration container that unifies the features and functionality of Apache ActiveMQ, Camel, CXF, and Karaf into a powerful runtime platform you can use to build your own integrations solutions. It provides a complete, enterprise ready ESB exclusively powered by OSGi. It is being released under Apache License. The main features are: - reliable messaging with Apache ActiveMQ - messaging, routing and Enterprise Integration Patterns with Apache Camel - WS-* and RESTful web services with Apache CXF - OSGi-based server runtime powered by Apache Karaf Getting Started =============== For an Apache ServiceMix 7 source distribution, please read BUILDING for instructions on building Apache ServiceMix 6. For an Apache ServiceMix 7 binary distribution, please read RELEASE-NOTES for installation instructions and list of supported and unsupported features. Alternatively, you can also find out how to get started here: http://servicemix.apache.org/docs/7.x/ If you need more help try talking to us on our mailing lists http://servicemix.apache.org/community/mailing-lists.html If you find any issues with ServiceMix 7, please submit reports with JIRA here: http://issues.apache.org/jira/browse/SM We welcome contributions, and encourage you to get involved in the ServiceMix community. If you'd like to learn more about how you can contribute, please see: http://servicemix.apache.org/community/contributing.html Many thanks for using Apache ServiceMix. The ServiceMix Team http://servicemix.apache.org/community/team.html ================================================ FILE: RELEASE-NOTES ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Apache ServiceMix 7.0.1 ================================ Overview -------- Apache ServiceMix is a flexible, open-source integration container that unifies the features and functionality of Apache ActiveMQ, Camel, CXF, and Karaf into a powerful runtime platform you can use to build your own integrations solutions. Apache ServiceMix 7.0.1 is a new patch release, which includes a few bug fixes and a new version of Apache Camel, Apache CXF, Apache ActiveMQ and Apache Karaf. This release includes: - Apache ActiveMQ 5.14.5 (http://activemq.apache.org) - Apache Camel 2.16.5 (http://camel.apache.org) - Apache CXF 3.1.9 (http://cxf.apache.org) - Apache Karaf 4.0.9 (http://karaf.apache.org) Changelog --------- ** Bug * [SM-3225] - Examples compile error * [SM-3264] - Upgrade to Apache Karaf 4.0.9 ** Improvement * [SM-3303] - Expose proces configuration to cfg file ** Task * [SM-3222] - ServiceMix should not use non-free json.org * [SM-3226] - Release Apache ServiceMix 7.0.1 * [SM-3228] - Upgrade to Apache Camel 2.16.5 and Apache CXF 3.1.9 * [SM-3268] - Upgrade to Apache ActiveMQ 5.14.5 * [SM-3357] - Upgrade to depends-maven-plugin 1.4.0 * [SM-3358] - Upgrade to maven-bundle-plugin 3.3.0 * [SM-3359] - Upgrade maven plugin versions and parent pom Apache ServiceMix 7.0.0 ================================ Overview -------- Apache ServiceMix is a flexible, open-source integration container that unifies the features and functionality of Apache ActiveMQ, Camel, CXF, and Karaf into a powerful runtime platform you can use to build your own integrations solutions. Apache ServiceMix 7.0.0 is the first production ready release based on Karaf 4.0.x, which includes numerous new features, improvements, and bug fixes. Apache ServiceMix 7.0.0 includes: - Apache ActiveMQ 5.14.3 (http://activemq.apache.org) - Apache Camel 2.16.4 (http://camel.apache.org) - Apache CXF 3.1.5 (http://cxf.apache.org) - Apache Karaf 4.0.8 (http://karaf.apache.org) Changelog --------- ** Sub-task * [SM-3223] - Add notice about usage of non-free json library ** Bug * [SM-3170] - Small bug in example feature file ** Task * [SM-3025] - Release Apache ServiceMix 7.0.0 * [SM-3177] - Upgrade to Apache ActiveMQ 5.14.3 * [SM-3213] - Upgrade to Apache karaf 4.0.8 Apache ServiceMix 7.0.0.M3 ================================ Overview -------- !! This is a technology preview release of Apache ServiceMix, and should NOT be considered production ready !! Apache ServiceMix is a flexible, open-source integration container that unifies the features and functionality of Apache ActiveMQ, Camel, CXF, and Karaf into a powerful runtime platform you can use to build your own integrations solutions. Apache ServiceMix 7.0.0 will be the first release based on Karaf 4.0.x, which includes numerous new features. We ask that users provide the community with their feed back so that the full Apache ServiceMix 7.0.0 release can be as feature complete and stable as possible. Apache ServiceMix 7.0.0.M3 is a new preview release of the project, which includes: - Apache ActiveMQ 5.14.1 (http://activemq.apache.org) - Apache Camel 2.16.4 (http://camel.apache.org) - Apache CXF 3.1.5 (http://cxf.apache.org) - Apache Karaf 4.0.7 (http://karaf.apache.org) Changelog --------- ** Bug * [SM-3040] - Multiple staging repositories while releasing ServiceMix * [SM-3045] - Assembly descriptor contains a *nix-specific root-relative-reference * [SM-3093] - Examples compile error * [SM-3106] - exec-maven-plugin.version is not set in examples pom.xml ** Task * [SM-3067] - Upgrade to Apache ActiveMQ 5.13.4 * [SM-3081] - Upgrade to Apache Karaf 4.0.6 * [SM-3082] - Update Exec Maven Plugin to version 1.5.0 * [SM-3083] - Upgrade to Apache ActiveMQ 5.14.x * [SM-3103] - Upgrade to Apache Karaf 4.0.7 * [SM-3110] - Upgrade to Apache Camel 2.16.4 * [SM-3123] - Use values from system.properties in several ActiveMQ configurartion files * [SM-3167] - Release Apache ServiceMix 7.0.0.M3 Apache ServiceMix 7.0.0.M2 ================================ Overview -------- !! This is a technology preview release of Apache ServiceMix, and should NOT be considered production ready !! Apache ServiceMix is a flexible, open-source integration container that unifies the features and functionality of Apache ActiveMQ, Camel, CXF, and Karaf into a powerful runtime platform you can use to build your own integrations solutions. Apache ServiceMix 7.0.0 will be the first release based on Karaf 4.0.x, which includes numerous new features. We ask that users provide the community with their feed back so that the full Apache ServiceMix 7.0.0 release can be as feature complete and stable as possible. Apache ServiceMix 7.0.0.M2 is a new preview release of the project, which includes: - Apache ActiveMQ 5.13.3 (http://activemq.apache.org) - Apache Camel 2.16.3 (http://camel.apache.org) - Apache CXF 3.1.5 (http://cxf.apache.org) - Apache Karaf 4.0.5 (http://karaf.apache.org) Changelog --------- ** Bug * [SM-2850] - JMSAppenderTest.testReconnectToBroker fails * [SM-2863] - Test failure when building examples * [SM-2864] - Update example README.txt files for new Karaf commands * [SM-2867] - Intermittent test failures in ActivitiExamplesTest * [SM-2883] - Intermittent test failures in CamelDrools5ExamplesTest * [SM-2976] - stax-ex-1.7.6.jar is under CDDL+GPL license * [SM-2978] - Jackson 2.7.0 in ServiceMix 7.0.0.M1 throws java.lang.NoSuchMethodError * [SM-2984] - Correct the shutdown command in branding.properties * [SM-2991] - ServiceMix doesn't start in offline environment ** Improvement * [SM-2395] - Download pages should correctly refer the documentation pages ** Task * [SM-2852] - Upgrade to Apache ActiveMQ 5.13.1 * [SM-2866] - Release Apache ServiceMix 7.0.0.M2 * [SM-2895] - Upgrade to Apache ActiveMQ 5.13.2 * [SM-2931] - Upgrade to Apache Karaf 4.0.5 * [SM-2934] - Upgrade to Apache Camel 2.16.3 and Apache CXF 3.1.5 * [SM-2937] - Upgrade Xalan bundle to 2.7.2_3 * [SM-2946] - Upgrade to Pax Exam 4.9.0 * [SM-2947] - Migrate itests to Java * [SM-2953] - Upgrade to Pax Exam 4.9.1 * [SM-2955] - Upgrade to Apache ActiveMQ 5.13.3 * [SM-2989] - Upgrade maven-remote-resources-plugin configuration * [SM-2990] - Update maven plugins Apache ServiceMix 7.0.0.M1 ================================ Overview -------- !! This is a technology preview release of Apache ServiceMix, and should NOT be considered production ready !! Apache ServiceMix is a flexible, open-source integration container that unifies the features and functionality of Apache ActiveMQ, Camel, CXF, and Karaf into a powerful runtime platform you can use to build your own integrations solutions. Apache ServiceMix 7.0.0 will be the first release based on Karaf 4.0.x, which includes numerous new features. We ask that users provide the community with their feed back so that the full Apache ServiceMix 7.0.0 release can be as feature complete and stable as possible. Apache ServiceMix 7.0.0.M1 is a new preview release of the project, which includes: - Apache ActiveMQ 5.13.0 (http://activemq.apache.org) - Apache Camel 2.16.2 (http://camel.apache.org) - Apache CXF 3.1.4 (http://cxf.apache.org) - Apache Karaf 4.0.4 (http://karaf.apache.org) Changelog --------- ** Bug * [SM-2251] - Intermittent test failure in JMSAppenderTest * [SM-2698] - ActiveMQ web console fails on J8 * [SM-2786] - Drools 5 examples fail due to missing Eclipse JDT * [SM-2787] - Test failures in CxfWsnExamplesTest * [SM-2813] - Drools6CamelServiceExamplesTest fails with error * [SM-2814] - Drools6ExamplesTest fails with error * [SM-2818] - ServiceMix installs randomly spring 3.1.4.RELEASE feature * [SM-2823] - ActivitiExamplesTest fails accidentally * [SM-2824] - Missing dependencies in system folder * [SM-2825] - Installation of CXF WSN sample fails * [SM-2845] - Installation of the cxf-wsn feature fails accidentally * [SM-2848] - cxf-wsn-client client fails due to wrong slf4j version * [SM-2851] - Some itests fail accidentally with NPE * [SM-2854] - Doclint for Javadoc fails on JDK 8 ** Task * [SM-2355] - Remove the workaround jaxrs-api feature * [SM-2759] - Upgrade to Apache ActiveMQ 5.13.0 * [SM-2763] - Upgrade to Activiti 5.19.0.1 * [SM-2768] - Upgrade to Apache Karaf 4 * [SM-2778] - Upgrade to Apache ActiveMQ 5.12.2 * [SM-2803] - Refactor the assembly creation * [SM-2806] - Ensure ServiceMix uses Apache Commons Collections 3.2.2 * [SM-2807] - Upgrade to Apache POM 17 * [SM-2808] - Avoid warnings about 'parent.relativePath' during the maven build * [SM-2819] - Upgrade to Pax Exam 4.8.0 * [SM-2820] - Upgrade to Apache Karaf 4.0.4 * [SM-2821] - Upgrade to Apache Camel 2.16.2 * [SM-2822] - Upgrade Maven-bundle-plugin to version 3.0.1 * [SM-2826] - Upgrade to ServiceMix Specs 2.6.0 * [SM-2844] - Upgrade to Activiti 5.19.0.2 * [SM-2846] - Upgrade maven-compiler-plugin to 3.3 * [SM-2847] - Upgrade maven-eclipse-plugin to 2.10 * [SM-2849] - Upgrade to Jackson 2.6.3 * [SM-2853] - Release Apache ServiceMix 7.0.0.M1 See the README file for more general information about ServiceMix 7. Thanks you for downloading ServiceMix. Enjoy ! The ServiceMix Team http://servicemix.apache.org/community/team.html ================================================ FILE: activemq/activemq-camel/pom.xml ================================================ 4.0.0 activemq org.apache.servicemix 7.1.0-SNAPSHOT org.apache.servicemix.activemq org.apache.servicemix.activemq.camel bundle Apache ServiceMix :: ActiveMQ :: Camel org.apache.activemq activemq-camel provided org.apache.felix maven-bundle-plugin ${project.artifactId} org.apache.camel.spi; provide:=true, * !* ${project.description} ================================================ FILE: activemq/activemq-camel/src/main/java/org/apache/servicemix/activemq/camel/ActiveMQComponent.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.activemq.camel; import javax.jms.ConnectionFactory; import org.apache.camel.CamelContext; import org.apache.camel.component.jms.JmsConfiguration; /** * A Camel component for ServiceMix which uses the * {@link org.apache.activemq.ActiveMQConnectionFactory} service for connecting to the correct * broker. */ public class ActiveMQComponent extends org.apache.activemq.camel.component.ActiveMQComponent { public static final String NAME = "activemq"; public ActiveMQComponent(CamelContext camelContext, ConnectionFactory connectionFactory) { super(camelContext); setConfiguration(new JmsConfiguration(connectionFactory)); } } ================================================ FILE: activemq/activemq-camel/src/main/java/org/apache/servicemix/activemq/camel/ActiveMQComponentResolver.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.activemq.camel; import javax.jms.ConnectionFactory; import org.apache.camel.CamelContext; import org.apache.camel.Component; import org.apache.camel.spi.ComponentResolver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A {@link org.apache.camel.spi.ComponentResolver} for the {@link org.apache.servicemix.activemq.camel.ActiveMQComponent} */ public class ActiveMQComponentResolver implements ComponentResolver { Logger LOGGER = LoggerFactory.getLogger(ActiveMQComponentResolver.class); private ConnectionFactory connectionFactory; public Component resolveComponent(String name, CamelContext camelContext) throws Exception { if (name.equals(ActiveMQComponent.NAME)) { LOGGER.info("Creating an instance of the ActiveMQComponent (" + name + ":)"); return new ActiveMQComponent(camelContext, connectionFactory); } return null; } public ConnectionFactory getConnectionFactory() { return connectionFactory; } public void setConnectionFactory(ConnectionFactory connectionFactory) { this.connectionFactory = connectionFactory; } } ================================================ FILE: activemq/activemq-camel/src/main/resources/OSGI-INF/blueprint/activemq-camel.xml ================================================ ================================================ FILE: activemq/activemq-service/README.md ================================================ ActiveMQ Service ================ This bundle provides default connection factories which let you connect with the ActiveMQ broker deployed in ServiceMix.This connection factories are used at least by the `activemq` Camel component registered by the `org.apache.servicemix.activemq.camel` bundle. You can get the reference for the connection factory using following blueprint snippet ```xml ``` In case you need the transacted connection factory you should use following snippet ```xml ``` ## Configuring the broker The connection factories are associated the default broker installed by the `activemq-broker` bundle - `amq-broker`. Assume, there are more brokers deployed in ServiceMix or you have changed the name of the default broker. ``` karaf@root> activemq:list brokerName = amq-broker brokerName = local-broker ``` If you want to change the broker associated with the connection factories (or you have changed the name of the default broker) you should change the `broker-name` property using Config Admin ``` karaf@root>config:edit org.apache.servicemix.activemq.service karaf@root>property-set broker-name local-broker karaf@root>config:update ``` ================================================ FILE: activemq/activemq-service/pom.xml ================================================ 4.0.0 org.apache.servicemix activemq 7.1.0-SNAPSHOT org.apache.servicemix.activemq org.apache.servicemix.activemq.service bundle Apache ServiceMix :: ActiveMQ :: Service org.apache.activemq activemq-camel provided org.apache.felix maven-bundle-plugin ${project.artifactId} * ${project.description} org.codehaus.mojo build-helper-maven-plugin attach-artifacts package false attach-artifact ${project.build.outputDirectory}/org.apache.servicemix.activemq.service.cfg cfg activemq-service ================================================ FILE: activemq/activemq-service/src/main/resources/OSGI-INF/blueprint/activemq-service.xml ================================================ ================================================ FILE: activemq/activemq-service/src/main/resources/org.apache.servicemix.activemq.service.cfg ================================================ ## --------------------------------------------------------------------------- ## Licensed to the Apache Software Foundation (ASF) under one or more ## contributor license agreements. See the NOTICE file distributed with ## this work for additional information regarding copyright ownership. ## The ASF licenses this file to You under the Apache License, Version 2.0 ## (the "License"); you may not use this file except in compliance with ## the License. You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable law or agreed to in writing, software ## distributed under the License is distributed on an "AS IS" BASIS, ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- broker-name = amq-broker ================================================ FILE: activemq/pom.xml ================================================ 4.0.0 org.apache.servicemix.parent features-parent 7.1.0-SNAPSHOT ../parent/features-parent/pom.xml org.apache.servicemix activemq pom Apache ServiceMix :: ActiveMQ activemq-service activemq-camel ================================================ FILE: activiti/activiti-config/pom.xml ================================================ 4.0.0 activiti org.apache.servicemix.activiti 7.1.0-SNAPSHOT org.apache.servicemix.activiti.config bundle Apache ServiceMix :: Activiti Support :: Activiti Configuration org.activiti activiti-camel org.activiti activiti-engine org.activiti activiti-osgi junit junit test org.easymock easymock test org.apache.felix maven-bundle-plugin ${project.artifactId} * org.apache.servicemix.activiti.config.* ${project.description} ================================================ FILE: activiti/activiti-config/src/main/java/org/apache/servicemix/activiti/config/CamelAwareELResolver.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.activiti.config; import org.activiti.camel.CamelBehaviour; import org.activiti.camel.ContextProvider; import org.activiti.osgi.blueprint.BlueprintELResolver; import java.util.LinkedList; import java.util.List; /** * Custom EL resolver that allows Activiti to interact with routes that have been defined in CamelContexts * for which a ContextProvider has been registered in the service registry. * * All these CamelContext instances will be available through a single CamelBehaviour bean that you can access * with the EL expression ${camel} in your business process definitions. */ public class CamelAwareELResolver extends BlueprintELResolver { public static final String CAMEL_PROPERTY_NAME = "camel"; private final List providers = new LinkedList(); private final CamelBehaviour camelBehaviour = new CamelBehaviour(providers); @Override public Object getValue(org.activiti.engine.impl.javax.el.ELContext context, Object base, Object property) { if (base == null && property != null && property instanceof String) { String key = (String) property; if (CAMEL_PROPERTY_NAME.endsWith(key)) { context.setPropertyResolved(true); return camelBehaviour; } } return super.getValue(context, base, property); } /** * Add a context provider to the global ${camel} variable * * @param provider the context provider */ public void addContextProvider(ContextProvider provider) { providers.add(provider); } /** * Remove a context provider from the global ${camel} variable * * @param provider the context provider */ public void removeContextProvider(ContextProvider provider) { providers.remove(provider); } /** * Access the {@link CamelBehaviour} instance that is being returned * * @return the {@link CamelBehaviour} instance */ protected CamelBehaviour getCamelBehaviour() { return camelBehaviour; } } ================================================ FILE: activiti/activiti-config/src/main/resources/OSGI-INF/blueprint/activiti-config.xml ================================================ ================================================ FILE: activiti/activiti-config/src/test/java/org/apache/servicemix/activiti/config/CamelAwareELResolverTest.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.activiti.config; import org.activiti.engine.impl.javax.el.ELContext; import org.junit.Test; import static org.apache.servicemix.activiti.config.CamelAwareELResolver.CAMEL_PROPERTY_NAME; import static org.easymock.EasyMock.*; import static org.junit.Assert.*; /** * Tests for {@link CamelAwareELResolver} */ public class CamelAwareELResolverTest { private final CamelAwareELResolver resolver = new CamelAwareELResolver(); @Test public void testGetValue() { assertNull(resolver.getValue(null, null, null)); assertNull(resolver.getValue(null, null, "NonCamelProperty")); ELContext context = expectELContextResolved(); assertSame(resolver.getCamelBehaviour(), resolver.getValue(context, null, CAMEL_PROPERTY_NAME)); } /* * Set up a mock ELContext that expects the property to get resolved */ private ELContext expectELContextResolved() { ELContext context = createMock(ELContext.class); context.setPropertyResolved(true); replay(context); return context; } } ================================================ FILE: activiti/activiti-config/src/test/resources/log4j.properties ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # The logging properties used # log4j.rootLogger=INFO, out # uncomment the following line to turn on Camel debugging #log4j.logger.org.apache.camel=DEBUG log4j.logger.org.springframework=WARN # CONSOLE appender not used by default log4j.appender.out=org.apache.log4j.ConsoleAppender log4j.appender.out.layout=org.apache.log4j.PatternLayout log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n #log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer ================================================ FILE: activiti/pom.xml ================================================ 4.0.0 org.apache.servicemix.parent features-parent 7.1.0-SNAPSHOT ../parent/features-parent/pom.xml org.apache.servicemix.activiti activiti pom Apache ServiceMix :: Activiti Support activiti-config ================================================ FILE: assemblies/apache-servicemix/pom.xml ================================================ 4.0.0 assemblies org.apache.servicemix.assemblies 7.1.0-SNAPSHOT org.apache.servicemix apache-servicemix pom Apache ServiceMix :: Assemblies :: Default Distribution ../../examples org.apache.karaf.features framework kar org.apache.karaf.features standard features xml org.apache.karaf.features spring features xml runtime org.apache.karaf.features enterprise features xml runtime org.apache.camel.karaf apache-camel xml features runtime org.apache.cxf.karaf apache-cxf xml features runtime org.apache.activemq activemq-karaf xml features runtime org.apache.servicemix.features servicemix-features ${project.version} features xml runtime org.apache.servicemix.features servicemix-examples ${project.version} features xml runtime org.apache.servicemix.features servicemix-kie ${project.version} features xml runtime org.apache.servicemix org.apache.servicemix.branding ${project.version} provided org.apache.servicemix apache-servicemix-examples ${project.version} provided com.springsource.repository.bundles.release SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases https://repository.springsource.com/maven/bundles/release true false src/main/resources false **/* src/main/filtered-resources true **/* ${project.basedir}/../.. false README RELEASE* LICENSE NOTICE ${project.build.directory}/dependencies false **/*.i?? **/.target **/.classpath org.apache.karaf.tooling karaf-maven-plugin ${karaf.version} install-kar compile assembly wrapper eventadmin standard camel camel-blueprint camel-jms camel-xstream camel-cxf activemq-camel activemq-broker-noweb activemq-blueprint cxf servicemix-messaging war mvn:joda-time/joda-time/${jodatime2.bundle.version} mvn:com.fasterxml.jackson.core/jackson-core/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.core/jackson-databind/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.core/jackson-annotations/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.module/jackson-module-scala_2.11/${fasterxml.jackson.version} xerces-${xerces.version}.jar;url:="wrap:mvn:xerces/xercesImpl/${xerces.version}$Export-Package=org.apache.*;version=${xerces.version}";type:=endorsed;export:=true;delegate:=true mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxp-api-1.4/${servicemix.specs.version};type:=endorsed;export:=true mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.2/${servicemix.specs.version};type:=endorsed;export:=true mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxws-api-2.2/${servicemix.specs.version};type:=endorsed;export:=true mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.saaj-api-1.3/${servicemix.specs.version};type:=endorsed;export:=true mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/${servicemix.specs.version};type:=endorsed;export:=true mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.stax-api-1.2/${servicemix.specs.version};type:=endorsed;export:=true mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan/${xalan.bundle.version};type:=endorsed;export:=true mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan-serializer/${xalan-serializer.bundle.version};type:=endorsed;export:=true mvn:javax.annotation/javax.annotation-api/1.2;type:=endorsed;export:=true mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activator/${servicemix.specs.version};type:=default;export:=true mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.locator/${servicemix.specs.version};type:=default;export:=true org.apache.maven.plugins maven-dependency-plugin unpack process-resources unpack org.apache.servicemix apache-servicemix-examples ${project.version} ${project.build.directory}/dependencies/examples org.apache.karaf demos ${karaf.version} ${project.build.directory}/dependencies/examples/karaf copy copy org.apache.servicemix org.apache.servicemix.branding ${project.version} ${project.build.directory}/dependencies/lib servicemix-version.jar org.apache.maven.plugins maven-resources-plugin process-resources resources org.apache.maven.plugins maven-remote-resources-plugin true org.apache.maven.plugins maven-antrun-plugin increase-perm-mem prepare-package run copy-karaf-to-servicemix prepare-package run org.apache.maven.plugins maven-assembly-plugin unix-bin package single src/main/descriptors/unix-bin.xml ${project.artifactId}-${project.version} gnu false release org.apache.maven.plugins maven-assembly-plugin unix-src package single src/main/descriptors/unix-src.xml false ================================================ FILE: assemblies/apache-servicemix/src/main/descriptors/unix-bin.xml ================================================ apache-servicemix zip ${project.build.outputDirectory}/common-unix-bin.xml ================================================ FILE: assemblies/apache-servicemix/src/main/descriptors/unix-src.xml ================================================ src zip ${basedir}/../.. / BUILDING README RELEASE* LICENSE NOTICE unix ${basedir}/../.. src **/*.jpeg **/*.jpg **/*.gif **/*.png **/*.exe **/*.dll **/*.jar **/*.so **/*.ks **/*.ts **/*.keystore **/*.bin **/*.jnilib **/*.cert **/*.jks **/eclipse-classes/** **/target/** ${basedir}/../.. src **/* **/*.jpeg **/*.jpg **/*.gif **/*.png **/*.exe **/*.dll **/*.jar **/*.so **/*.ks **/*.ts **/*.keystore **/*.bin **/*.jnilib **/*.cert **/target/** **/build/** activemq-data/** */activemq-data/** **/eclipse-classes/** **/.* **/.*/** **/surefire* **/svn-commit* **/*.iml **/*.ipr **/*.iws **/*.jks **/cobertura.ser unix ================================================ FILE: assemblies/apache-servicemix/src/main/filtered-resources/etc/org.apache.karaf.features.cfg ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ # # Comma separated list of features repositories to register by default # featuresRepositories = \ mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features, \ mvn:org.apache.karaf.features/framework/${karaf.version}/xml/features, \ mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features, \ mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features, \ mvn:org.apache.activemq/activemq-karaf/${activemq.version}/xml/features, \ mvn:org.apache.camel.karaf/apache-camel/${camel.version}/xml/features, \ mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features, \ mvn:org.apache.servicemix.features/servicemix-features/${project.version}/xml/features, \ mvn:org.apache.servicemix.features/servicemix-examples/${project.version}/xml/features, \ mvn:org.apache.servicemix.features/servicemix-kie/${project.version}/xml/features # # Comma separated list of features to install at startup # featuresBoot = \ aries-blueprint, \ bundle, \ config, \ deployer, \ diagnostic, \ feature, \ instance, \ jaas, \ kar, \ log, \ management, \ package, \ service, \ shell, \ shell-compat, \ ssh, \ system, \ wrap, \ war, \ camel, \ camel-blueprint, \ camel-jms, \ camel-xstream, \ camel-cxf, \ activemq-camel, \ activemq-broker-noweb, \ activemq-blueprint, \ cxf, \ servicemix-messaging # # Resource repositories (OBR) that the features resolver can use # to resolve requirements/capabilities # # The format of the resourceRepositories is # resourceRepositories=[xml:url|json:url],... # for Instance: # #resourceRepositories=xml:http://host/path/to/index.xml # or #resourceRepositories=json:http://host/path/to/index.json # # # Defines if the boot features are started in asynchronous mode (in a dedicated thread) # featuresBootAsynchronous=false # # Service requirements enforcement # # By default, the feature resolver checks the service requirements/capabilities of # bundles for new features (xml schema >= 1.3.0) in order to automatically installs # the required bundles. # The following flag can have those values: # - disable: service requirements are completely ignored # - default: service requirements are ignored for old features # - enforce: service requirements are always verified # #serviceRequirements=default # # Store cfg file for config element in feature # #configCfgStore=true ================================================ FILE: assemblies/apache-servicemix/src/main/filtered-resources/etc/overrides.properties ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # workaround for SM-2469 # # some standard features install the version 2.2 of joda-time bundle ans bundles which depend on joda-time # wire to this bundle. Later installation of activiti fails, because it needs higher version of joda-time # and activiti tries to resolve this bundle via multiple paths. We want to force all features installing # joda-time/joda-time bundle with range [2,3) to use exactly the version given below to make sure only one # version of joda-time is installed in the system. mvn:joda-time/joda-time/${jodatime2.bundle.version};range="[2,3)" # workaround for SM-2727 # Camel 2.16.x includes jackson in version 2.6.x but ActiveMQ and CXF still use the version 2.4.x. It makes # problems while resolving some bundles (see the issue for details). We should force usage of 2.6.x until # ActiveMQ and CXF upgrade to 2.6.x mvn:com.fasterxml.jackson.core/jackson-core/${fasterxml.jackson.version};range="[2,3)" mvn:com.fasterxml.jackson.core/jackson-databind/${fasterxml.jackson.version};range="[2,3)" mvn:com.fasterxml.jackson.core/jackson-annotations/${fasterxml.jackson.version};range="[2,3)" mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${fasterxml.jackson.version};range="[2,3)" mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${fasterxml.jackson.version};range="[2,3)" mvn:com.fasterxml.jackson.module/jackson-module-scala_2.11/${fasterxml.jackson.version};range="[2,3)" ================================================ FILE: assemblies/apache-servicemix/src/main/resources/common-unix-bin.xml ================================================ ${project.build.directory}/assembly ${file.separator} bin/** setenv-* *-unix-bin.xml 0644 0775 ${project.build.directory}/assembly ${file.separator} bin/* unix 0755 ${project.build.directory}/assembly ${file.separator} bin/* dos 0755 ================================================ FILE: assemblies/apache-servicemix/src/main/resources/etc/custom.properties ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ # # You can place any customized configuration here. # All the values specified here will override the default value. # karaf.systemBundlesStartLevel=50 # # Delay console startup until bundles have been properly started # karaf.delay.console=true karaf.startup.message=Please wait while Apache ServiceMix is starting... ================================================ FILE: assemblies/apache-servicemix/src/main/resources/etc/jre.properties ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ # # Java platform package export properties. # # Standard package set. Note that: # - javax.transaction* is exported with a mandatory attribute jre-1.6= \ javax.accessibility, \ javax.activation;version="1.1", \ javax.activity, \ javax.annotation;version="1.0", \ javax.annotation.processing;version="1.0", \ javax.crypto, \ javax.crypto.interfaces, \ javax.crypto.spec, \ javax.imageio, \ javax.imageio.event, \ javax.imageio.metadata, \ javax.imageio.plugins.bmp, \ javax.imageio.plugins.jpeg, \ javax.imageio.spi, \ javax.imageio.stream, \ javax.jws;version="2.0", \ javax.jws.soap;version="2.0", \ javax.lang.model, \ javax.lang.model.element, \ javax.lang.model.type, \ javax.lang.model.util, \ javax.management, \ javax.management.loading, \ javax.management.modelmbean, \ javax.management.monitor, \ javax.management.openmbean, \ javax.management.relation, \ javax.management.remote, \ javax.management.remote.rmi, \ javax.management.timer, \ javax.naming, \ javax.naming.directory, \ javax.naming.event, \ javax.naming.ldap, \ javax.naming.spi, \ javax.net, \ javax.net.ssl, \ javax.print, \ javax.print.attribute, \ javax.print.attribute.standard, \ javax.print.event, \ javax.rmi, \ javax.rmi.CORBA, \ javax.rmi.ssl, \ javax.script, \ javax.security.auth, \ javax.security.auth.callback, \ javax.security.auth.kerberos, \ javax.security.auth.login, \ javax.security.auth.spi, \ javax.security.auth.x500, \ javax.security.cert, \ javax.security.sasl, \ javax.sound.midi, \ javax.sound.midi.spi, \ javax.sound.sampled, \ javax.sound.sampled.spi, \ javax.sql, \ javax.sql.rowset, \ javax.sql.rowset.serial, \ javax.sql.rowset.spi, \ javax.swing, \ javax.swing.border, \ javax.swing.colorchooser, \ javax.swing.event, \ javax.swing.filechooser, \ javax.swing.plaf, \ javax.swing.plaf.basic, \ javax.swing.plaf.metal, \ javax.swing.plaf.multi, \ javax.swing.plaf.synth, \ javax.swing.table, \ javax.swing.text, \ javax.swing.text.html, \ javax.swing.text.html.parser, \ javax.swing.text.rtf, \ javax.swing.tree, \ javax.swing.undo, \ javax.tools, \ javax.transaction; javax.transaction.xa; partial=true; mandatory:=partial, \ javax.xml, \ javax.xml.bind;version="2.2.1", \ javax.xml.bind.annotation;version="2.2.1", \ javax.xml.bind.annotation.adapters;version="2.2.1", \ javax.xml.bind.attachment;version="2.2.1", \ javax.xml.bind.helpers;version="2.2.1", \ javax.xml.bind.util;version="2.2.1", \ javax.xml.crypto, \ javax.xml.crypto.dom, \ javax.xml.crypto.dsig, \ javax.xml.crypto.dsig.dom, \ javax.xml.crypto.dsig.keyinfo, \ javax.xml.crypto.dsig.spec, \ javax.xml.datatype, \ javax.xml.namespace, \ javax.xml.parsers, \ javax.xml.soap;version="1.3", \ javax.xml.stream;version="1.2", \ javax.xml.stream.events;version="1.2", \ javax.xml.stream.util;version="1.2", \ javax.xml.transform, \ javax.xml.transform.dom, \ javax.xml.transform.sax, \ javax.xml.transform.stax, \ javax.xml.transform.stream, \ javax.xml.validation, \ javax.xml.ws;version="2.2", \ javax.xml.ws.handler;version="2.2", \ javax.xml.ws.handler.soap;version="2.2", \ javax.xml.ws.http;version="2.2", \ javax.xml.ws.soap;version="2.2", \ javax.xml.ws.spi;version="2.2", \ javax.xml.ws.wsaddressing;version="2.2", \ javax.xml.ws.spi.http;version="2.2", \ javax.xml.xpath, \ org.ietf.jgss, \ org.omg.CORBA, \ org.omg.CORBA_2_3, \ org.omg.CORBA_2_3.portable, \ org.omg.CORBA.DynAnyPackage, \ org.omg.CORBA.ORBPackage, \ org.omg.CORBA.portable, \ org.omg.CORBA.TypeCodePackage, \ org.omg.CosNaming, \ org.omg.CosNaming.NamingContextExtPackage, \ org.omg.CosNaming.NamingContextPackage, \ org.omg.Dynamic, \ org.omg.DynamicAny, \ org.omg.DynamicAny.DynAnyFactoryPackage, \ org.omg.DynamicAny.DynAnyPackage, \ org.omg.IOP, \ org.omg.IOP.CodecFactoryPackage, \ org.omg.IOP.CodecPackage, \ org.omg.Messaging, \ org.omg.PortableInterceptor, \ org.omg.PortableInterceptor.ORBInitInfoPackage, \ org.omg.PortableServer, \ org.omg.PortableServer.CurrentPackage, \ org.omg.PortableServer.POAManagerPackage, \ org.omg.PortableServer.POAPackage, \ org.omg.PortableServer.portable, \ org.omg.PortableServer.ServantLocatorPackage, \ org.omg.SendingContext, \ org.omg.stub.java.rmi, \ org.omg.stub.javax.management.remote.rmi, \ org.w3c.dom, \ org.w3c.dom.bootstrap, \ org.w3c.dom.css, \ org.w3c.dom.events, \ org.w3c.dom.html, \ org.w3c.dom.ls, \ org.w3c.dom.ranges, \ org.w3c.dom.stylesheets, \ org.w3c.dom.traversal, \ org.w3c.dom.views, \ org.w3c.dom.xpath, \ org.xml.sax, \ org.xml.sax.ext, \ org.xml.sax.helpers # Standard package set. Note that: # - javax.transaction* is exported with a mandatory attribute jre-1.7= \ javax.accessibility, \ javax.activation;version="1.1", \ javax.activity, \ javax.annotation;version="1.0", \ javax.annotation.processing;version="1.0", \ javax.crypto, \ javax.crypto.interfaces, \ javax.crypto.spec, \ javax.imageio, \ javax.imageio.event, \ javax.imageio.metadata, \ javax.imageio.plugins.bmp, \ javax.imageio.plugins.jpeg, \ javax.imageio.spi, \ javax.imageio.stream, \ javax.jws;version="2.0", \ javax.jws.soap;version="2.0", \ javax.lang.model, \ javax.lang.model.element, \ javax.lang.model.type, \ javax.lang.model.util, \ javax.management, \ javax.management.loading, \ javax.management.modelmbean, \ javax.management.monitor, \ javax.management.openmbean, \ javax.management.relation, \ javax.management.remote, \ javax.management.remote.rmi, \ javax.management.timer, \ javax.naming, \ javax.naming.directory, \ javax.naming.event, \ javax.naming.ldap, \ javax.naming.spi, \ javax.net, \ javax.net.ssl, \ javax.print, \ javax.print.attribute, \ javax.print.attribute.standard, \ javax.print.event, \ javax.rmi, \ javax.rmi.CORBA, \ javax.rmi.ssl, \ javax.script, \ javax.security.auth, \ javax.security.auth.callback, \ javax.security.auth.kerberos, \ javax.security.auth.login, \ javax.security.auth.spi, \ javax.security.auth.x500, \ javax.security.cert, \ javax.security.sasl, \ javax.sound.midi, \ javax.sound.midi.spi, \ javax.sound.sampled, \ javax.sound.sampled.spi, \ javax.sql, \ javax.sql.rowset, \ javax.sql.rowset.serial, \ javax.sql.rowset.spi, \ javax.swing, \ javax.swing.border, \ javax.swing.colorchooser, \ javax.swing.event, \ javax.swing.filechooser, \ javax.swing.plaf, \ javax.swing.plaf.basic, \ javax.swing.plaf.metal, \ javax.swing.plaf.multi, \ javax.swing.plaf.synth, \ javax.swing.table, \ javax.swing.text, \ javax.swing.text.html, \ javax.swing.text.html.parser, \ javax.swing.text.rtf, \ javax.swing.tree, \ javax.swing.undo, \ javax.tools, \ javax.transaction; javax.transaction.xa; partial=true; mandatory:=partial, \ javax.xml, \ javax.xml.bind;version="2.2.1", \ javax.xml.bind.annotation;version="2.2.1", \ javax.xml.bind.annotation.adapters;version="2.2.1", \ javax.xml.bind.attachment;version="2.2.1", \ javax.xml.bind.helpers;version="2.2.1", \ javax.xml.bind.util;version="2.2.1", \ javax.xml.crypto, \ javax.xml.crypto.dom, \ javax.xml.crypto.dsig, \ javax.xml.crypto.dsig.dom, \ javax.xml.crypto.dsig.keyinfo, \ javax.xml.crypto.dsig.spec, \ javax.xml.datatype, \ javax.xml.namespace, \ javax.xml.parsers, \ javax.xml.soap;version="1.3", \ javax.xml.stream;version="1.2", \ javax.xml.stream.events;version="1.2", \ javax.xml.stream.util;version="1.2", \ javax.xml.transform, \ javax.xml.transform.dom, \ javax.xml.transform.sax, \ javax.xml.transform.stax, \ javax.xml.transform.stream, \ javax.xml.validation, \ javax.xml.ws;version="2.2", \ javax.xml.ws.handler;version="2.2", \ javax.xml.ws.handler.soap;version="2.2", \ javax.xml.ws.http;version="2.2", \ javax.xml.ws.soap;version="2.2", \ javax.xml.ws.spi;version="2.2", \ javax.xml.ws.wsaddressing;version="2.2", \ javax.xml.ws.spi.http;version="2.2", \ javax.xml.xpath, \ org.ietf.jgss, \ org.omg.CORBA, \ org.omg.CORBA_2_3, \ org.omg.CORBA_2_3.portable, \ org.omg.CORBA.DynAnyPackage, \ org.omg.CORBA.ORBPackage, \ org.omg.CORBA.portable, \ org.omg.CORBA.TypeCodePackage, \ org.omg.CosNaming, \ org.omg.CosNaming.NamingContextExtPackage, \ org.omg.CosNaming.NamingContextPackage, \ org.omg.Dynamic, \ org.omg.DynamicAny, \ org.omg.DynamicAny.DynAnyFactoryPackage, \ org.omg.DynamicAny.DynAnyPackage, \ org.omg.IOP, \ org.omg.IOP.CodecFactoryPackage, \ org.omg.IOP.CodecPackage, \ org.omg.Messaging, \ org.omg.PortableInterceptor, \ org.omg.PortableInterceptor.ORBInitInfoPackage, \ org.omg.PortableServer, \ org.omg.PortableServer.CurrentPackage, \ org.omg.PortableServer.POAManagerPackage, \ org.omg.PortableServer.POAPackage, \ org.omg.PortableServer.portable, \ org.omg.PortableServer.ServantLocatorPackage, \ org.omg.SendingContext, \ org.omg.stub.java.rmi, \ org.omg.stub.javax.management.remote.rmi, \ org.w3c.dom, \ org.w3c.dom.bootstrap, \ org.w3c.dom.css, \ org.w3c.dom.events, \ org.w3c.dom.html, \ org.w3c.dom.ls, \ org.w3c.dom.ranges, \ org.w3c.dom.stylesheets, \ org.w3c.dom.traversal, \ org.w3c.dom.views, \ org.w3c.dom.xpath, \ org.xml.sax, \ org.xml.sax.ext, \ org.xml.sax.helpers, \ com.sun.nio.sctp jre-1.8= \ javax.accessibility, \ javax.activation;version="1.1", \ javax.activity, \ javax.annotation;version="1.0", \ javax.annotation.processing;version="1.0", \ javax.crypto, \ javax.crypto.interfaces, \ javax.crypto.spec, \ javax.imageio, \ javax.imageio.event, \ javax.imageio.metadata, \ javax.imageio.plugins.bmp, \ javax.imageio.plugins.jpeg, \ javax.imageio.spi, \ javax.imageio.stream, \ javax.jws;version="2.0", \ javax.jws.soap;version="2.0", \ javax.lang.model, \ javax.lang.model.element, \ javax.lang.model.type, \ javax.lang.model.util, \ javax.management, \ javax.management.loading, \ javax.management.modelmbean, \ javax.management.monitor, \ javax.management.openmbean, \ javax.management.relation, \ javax.management.remote, \ javax.management.remote.rmi, \ javax.management.timer, \ javax.naming, \ javax.naming.directory, \ javax.naming.event, \ javax.naming.ldap, \ javax.naming.spi, \ javax.net, \ javax.net.ssl, \ javax.print, \ javax.print.attribute, \ javax.print.attribute.standard, \ javax.print.event, \ javax.rmi, \ javax.rmi.CORBA, \ javax.rmi.ssl, \ javax.script, \ javax.security.auth, \ javax.security.auth.callback, \ javax.security.auth.kerberos, \ javax.security.auth.login, \ javax.security.auth.spi, \ javax.security.auth.x500, \ javax.security.cert, \ javax.security.sasl, \ javax.sound.midi, \ javax.sound.midi.spi, \ javax.sound.sampled, \ javax.sound.sampled.spi, \ javax.sql, \ javax.sql.rowset, \ javax.sql.rowset.serial, \ javax.sql.rowset.spi, \ javax.swing, \ javax.swing.border, \ javax.swing.colorchooser, \ javax.swing.event, \ javax.swing.filechooser, \ javax.swing.plaf, \ javax.swing.plaf.basic, \ javax.swing.plaf.metal, \ javax.swing.plaf.multi, \ javax.swing.plaf.synth, \ javax.swing.table, \ javax.swing.text, \ javax.swing.text.html, \ javax.swing.text.html.parser, \ javax.swing.text.rtf, \ javax.swing.tree, \ javax.swing.undo, \ javax.tools, \ javax.transaction; javax.transaction.xa; partial=true; mandatory:=partial, \ javax.xml, \ javax.xml.bind;version="2.2.1", \ javax.xml.bind.annotation;version="2.2.1", \ javax.xml.bind.annotation.adapters;version="2.2.1", \ javax.xml.bind.attachment;version="2.2.1", \ javax.xml.bind.helpers;version="2.2.1", \ javax.xml.bind.util;version="2.2.1", \ javax.xml.crypto, \ javax.xml.crypto.dom, \ javax.xml.crypto.dsig, \ javax.xml.crypto.dsig.dom, \ javax.xml.crypto.dsig.keyinfo, \ javax.xml.crypto.dsig.spec, \ javax.xml.datatype, \ javax.xml.namespace, \ javax.xml.parsers, \ javax.xml.soap;version="1.3", \ javax.xml.stream;version="1.2", \ javax.xml.stream.events;version="1.2", \ javax.xml.stream.util;version="1.2", \ javax.xml.transform, \ javax.xml.transform.dom, \ javax.xml.transform.sax, \ javax.xml.transform.stax, \ javax.xml.transform.stream, \ javax.xml.validation, \ javax.xml.ws;version="2.2", \ javax.xml.ws.handler;version="2.2", \ javax.xml.ws.handler.soap;version="2.2", \ javax.xml.ws.http;version="2.2", \ javax.xml.ws.soap;version="2.2", \ javax.xml.ws.spi;version="2.2", \ javax.xml.ws.wsaddressing;version="2.2", \ javax.xml.ws.spi.http;version="2.2", \ javax.xml.xpath, \ javafx.animation, \ javafx.application, \ javafx.beans, \ javafx.beans.binding, \ javafx.beans.property, \ javafx.beans.property.adapter, \ javafx.beans.value, \ javafx.collections, \ javafx.collections.transformation, \ javafx.concurrent, \ javafx.css, \ javafx.embed.swing, \ javafx.embed.swt, \ javafx.event, \ javafx.fxml, \ javafx.geometry, \ javafx.print, \ javafx.scene, \ javafx.scene.canvas, \ javafx.scene.chart, \ javafx.scene.control, \ javafx.scene.control.cell, \ javafx.scene.effect, \ javafx.scene.image, \ javafx.scene.input, \ javafx.scene.layout, \ javafx.scene.media, \ javafx.scene.paint, \ javafx.scene.shape, \ javafx.scene.text, \ javafx.scene.transform, \ javafx.scene.web, \ javafx.stage, \ javafx.util, \ javafx.util.converter, \ netscape.javascript, \ org.ietf.jgss, \ org.omg.CORBA, \ org.omg.CORBA_2_3, \ org.omg.CORBA_2_3.portable, \ org.omg.CORBA.DynAnyPackage, \ org.omg.CORBA.ORBPackage, \ org.omg.CORBA.portable, \ org.omg.CORBA.TypeCodePackage, \ org.omg.CosNaming, \ org.omg.CosNaming.NamingContextExtPackage, \ org.omg.CosNaming.NamingContextPackage, \ org.omg.Dynamic, \ org.omg.DynamicAny, \ org.omg.DynamicAny.DynAnyFactoryPackage, \ org.omg.DynamicAny.DynAnyPackage, \ org.omg.IOP, \ org.omg.IOP.CodecFactoryPackage, \ org.omg.IOP.CodecPackage, \ org.omg.Messaging, \ org.omg.PortableInterceptor, \ org.omg.PortableInterceptor.ORBInitInfoPackage, \ org.omg.PortableServer, \ org.omg.PortableServer.CurrentPackage, \ org.omg.PortableServer.POAManagerPackage, \ org.omg.PortableServer.POAPackage, \ org.omg.PortableServer.portable, \ org.omg.PortableServer.ServantLocatorPackage, \ org.omg.SendingContext, \ org.omg.stub.java.rmi, \ org.omg.stub.javax.management.remote.rmi, \ org.w3c.dom, \ org.w3c.dom.bootstrap, \ org.w3c.dom.css, \ org.w3c.dom.events, \ org.w3c.dom.html, \ org.w3c.dom.ls, \ org.w3c.dom.ranges, \ org.w3c.dom.stylesheets, \ org.w3c.dom.traversal, \ org.w3c.dom.views, \ org.w3c.dom.xpath, \ org.xml.sax, \ org.xml.sax.ext, \ org.xml.sax.helpers, \ com.sun.nio.sctp ================================================ FILE: assemblies/apache-servicemix/src/main/resources/etc/org.apache.activemq.webconsole.cfg ================================================ ## --------------------------------------------------------------------------- ## Licensed to the Apache Software Foundation (ASF) under one or more ## contributor license agreements. See the NOTICE file distributed with ## this work for additional information regarding copyright ownership. ## The ASF licenses this file to You under the Apache License, Version 2.0 ## (the "License"); you may not use this file except in compliance with ## the License. You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable law or agreed to in writing, software ## distributed under the License is distributed on an "AS IS" BASIS, ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- webconsole.jms.url=${activemq.url} webconsole.jmx.url=service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-${karaf.name} webconsole.jmx.user=${activemq.jmx.user} webconsole.jmx.password=${activemq.jmx.password} webconsole.jms.user=${activemq.jms.user} webconsole.jms.password=${activemq.jms.password} ================================================ FILE: assemblies/apache-servicemix/src/main/resources/etc/org.apache.aries.transaction.cfg ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. # # aries.transaction.timeout=600 aries.transaction.howl.logFileDir=${karaf.data}/txlog/ aries.transaction.recoverable=true ================================================ FILE: assemblies/apache-servicemix/src/main/resources/etc/org.apache.cxf.wsn.cfg ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. # # cxf.wsn.activemq = ${activemq.url.vm} cxf.wsn.rootUrl = http://0.0.0.0:8182 cxf.wsn.context = /wsn cxf.wsn.activemq.username=${activemq.jms.user} cxf.wsn.activemq.password=${activemq.jms.password} ================================================ FILE: assemblies/apache-servicemix/src/main/resources/etc/org.ops4j.pax.logging.cfg ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ # Root logger log4j.rootLogger=INFO, out, osgi:VmLogAppender log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer # To avoid flooding the log when using DEBUG level on an ssh connection and doing log:tail log4j.logger.org.apache.sshd.server.channel.ChannelSession = INFO # Avoid extensive logging log4j.logger.org.apache.aries.spifly.dynamic.bundle=WARN # Security audit logger log4j.logger.org.apache.karaf.jaas.modules.audit=INFO, audit log4j.additivity.org.apache.karaf.jaas.modules.audit=false # CONSOLE appender not used by default log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n # use this for source code lines enabled in the logs (beware it impacts performance) #log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n # File appender log4j.appender.out=org.apache.log4j.RollingFileAppender log4j.appender.out.layout=org.apache.log4j.PatternLayout log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n # use this for source code lines enabled in the logs (beware it impacts performance) #log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n log4j.appender.out.file=${karaf.data}/log/servicemix.log log4j.appender.out.append=true log4j.appender.out.maxFileSize=1MB log4j.appender.out.maxBackupIndex=10 # Audit appender log4j.appender.audit=org.apache.log4j.RollingFileAppender log4j.appender.audit.layout=org.apache.log4j.PatternLayout log4j.appender.audit.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n # use this for source code lines enabled in the logs (beware it impacts performance) #log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n log4j.appender.audit.file=${karaf.data}/security/audit.log log4j.appender.audit.append=true log4j.appender.audit.maxFileSize=1MB log4j.appender.audit.maxBackupIndex=10 # Sift appender log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender log4j.appender.sift.key=bundle.name log4j.appender.sift.default=servicemix log4j.appender.sift.appender=org.apache.log4j.FileAppender log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout log4j.appender.sift.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %m%n # use this for source code lines enabled in the logs (beware it impacts performance) #log4j.appender.sift.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log log4j.appender.sift.appender.append=true # help with identification of maven-related problems with pax-url-aether #log4j.logger.shaded.org.eclipse.aether = TRACE #log4j.logger.shaded.org.apache.http.headers = DEBUG #log4j.logger.org.ops4j.pax.url.mvn = TRACE ================================================ FILE: assemblies/apache-servicemix/src/main/resources/etc/org.ops4j.pax.url.mvn.cfg ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ # # see: https://ops4j1.jira.com/wiki/display/paxurl/Aether+Configuration # # # If set to true, the following property will not allow any certificate to be used # when accessing Maven repositories through SSL # org.ops4j.pax.url.mvn.certificateCheck=true # # Path to the local Maven settings file. # The repositories defined in this file will be automatically added to the list # of default repositories if the 'org.ops4j.pax.url.mvn.repositories' property # below is not set. # The following locations are checked for the existence of the settings.xml file # * 1. looks for the specified url # * 2. if not found looks for ${user.home}/.m2/settings.xml # * 3. if not found looks for ${maven.home}/conf/settings.xml # * 4. if not found looks for ${M2_HOME}/conf/settings.xml # # Properties prefixed with "org.ops4j.pax.url.mvn." have # higher priority except element. HTTP proxies should be configured in # settings file #org.ops4j.pax.url.mvn.settings= # # Path to the local Maven repository which is used to avoid downloading # artifacts when they already exist locally. # The value of this property will be extracted from the settings.xml file # above, or defaulted to: # System.getProperty( "user.home" ) + "/.m2/repository" # # leaving this option commented makes the system dependent on external # configuration, which is not always desired # "localRepository" is the target location for artifacts downloaded from # "remote repositories" #org.ops4j.pax.url.mvn.localRepository= # # Default this to false. It's just weird to use undocumented repos # "false" means that http://repo1.maven.org/maven2@id=central won't be # implicitly used as remote repository # org.ops4j.pax.url.mvn.useFallbackRepositories=false # # Comma separated list of repositories scanned when resolving an artifact. # list of repositories searched in the first place, should contain # ${runtime.home}/${karaf.default.repository}. # if "org.ops4j.pax.url.mvn.localRepository" is defined and it's not # ~/.m2/repository, it's recommended (at least for dev purposes) to add # ~/.m2/repository to defaultRepositories # each of these repositories is checked by aether as "local repository". if # artifact isn't found, "repositories" are searched next # # Those repositories will be checked before iterating through the # below list of repositories and even before the local repository # A repository url can be appended with zero or more of the following flags: # @snapshots : the repository contains snaphots # @noreleases : the repository does not contain any released artifacts # # The following property value will add the system folder as a repo. # org.ops4j.pax.url.mvn.defaultRepositories=\ file:${karaf.home}/${karaf.default.repository}@id=system.repository@snapshots,\ file:${karaf.data}/kar@id=kar.repository@multi@snapshots,\ file:${karaf.base}/${karaf.default.repository}@id=child.system.repository@snapshots,\ file:${karaf.home}/local-repo@snapshots@id=system.local-repo # # if "defaultLocalRepoAsRemote" is set do *any* value, localRepository will be # added to the list of remote repositories being searched for artifacts # #org.ops4j.pax.url.mvn.defaultLocalRepoAsRemote = true # # Comma separated list of repositories scanned when resolving an artifact. # list of repositories searched after resolution fails for "defaultRepositories" # These are true remote repositories accessed using maven/aether/wagon # mechanisms. If any repository contains required artifact, it is then written # to "localRepository" # # if this list is _prepended_ with '+' sign, all repositories from active # profiles defined in effective settings.xml file will be _appended_ to this # list # The default list includes the following repositories: # http://repo1.maven.org/maven2@id=central # http://repository.springsource.com/maven/bundles/release@id=spring.ebr # http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external # http://zodiac.springsource.com/maven/bundles/release@id=gemini # http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases # https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@noreleases # https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases # To add repositories to the default ones, prepend '+' to the list of repositories # to add. # A repository url can be appended with zero or more of the following flags: # @snapshots : the repository contains snapshots # @noreleases : the repository does not contain any released artifacts # @id=repository.id : the id for the repository, just like in the # settings.xml this is optional but recommended # org.ops4j.pax.url.mvn.repositories= \ http://repo1.maven.org/maven2@id=central, \ http://repository.springsource.com/maven/bundles/release@id=spring.ebr.release, \ http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external, \ http://zodiac.springsource.com/maven/bundles/release@id=gemini, \ http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases, \ https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@noreleases, \ https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases # # Global policies override repository-specific settings (@checksum=..., @update=..., @releasesUpdate=..., ...) # #org.ops4j.pax.url.mvn.globalUpdatePolicy = daily #org.ops4j.pax.url.mvn.globalChecksumPolicy = warn # # socket and connection configuration (pax-url-aether 2.5.0) # # default value for connection and read timeouts, when socket.readTimeout and socket.connectionTimeout # are not specified org.ops4j.pax.url.mvn.timeout = 5000 # timeout in ms when establishing http connection during artifact resolution org.ops4j.pax.url.mvn.socket.connectionTimeout = 5000 # timeout in ms when reading data after connecting to remote repository org.ops4j.pax.url.mvn.socket.readTimeout = 30000 # SO_KEEPALIVE option for sockets, defaults to false org.ops4j.pax.url.mvn.socket.keepAlive = false # SO_LINGER option for sockets, defaults to -1 org.ops4j.pax.url.mvn.socket.linger = -1 # SO_REUSEADDR option for sockets, defaults to false org.ops4j.pax.url.mvn.socket.reuseAddress = false # TCP_NODELAY option for sockets, defaults to true org.ops4j.pax.url.mvn.socket.tcpNoDelay = true # Configure buffer size for HTTP connections (output and input buffers), defaults to 8192 bytes org.ops4j.pax.url.mvn.connection.bufferSize = 8192 # Number of connection retries after failure is detected in http client. httpclient uses default value "3" org.ops4j.pax.url.mvn.connection.retryCount = 3 ================================================ FILE: assemblies/apache-servicemix/src/main/resources/etc/org.ops4j.pax.web.cfg.empty.stub ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################# ################################################################################# # # This is a stub configuration file for pax-web ssl configuration. # More details please refer to # http://wiki.ops4j.org/display/paxweb/SSL+Configuration # Important Notes: If file named org.ops4j.pax.web.cfg in etc folder, # Pax Web will always try to read configuration from this file, so any org.ops4j.pax.web configuration in http feature get ignored, that's why we name this file as org.ops4j.pax.web.empty.stub. If you need this configuration file, rename it to org.ops4j.pax.web before use it. ################################################################################# #org.osgi.service.http.secure.enabled=true #org.ops4j.pax.web.ssl.keystore=etc/servicemix.jks #org.ops4j.pax.web.ssl.password=password #org.ops4j.pax.web.ssl.keypassword=password #org.osgi.service.http.port.secure=8443 org.ops4j.pax.web.config.file=etc/jetty.xml org.osgi.service.http.port=8181 javax.servlet.context.tempdir=data/pax-web-jsp ================================================ FILE: assemblies/apache-servicemix/src/main/resources/etc/system.properties ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ # # The properties defined in this file will be made available through system # properties at the very beginning of the Karaf's boot process. # # Log level when the pax-logging service is not available # This level will only be used while the pax-logging service bundle # is not fully available. # To change log levels, please refer to the org.ops4j.pax.logging.cfg file # instead. org.ops4j.pax.logging.DefaultServiceLog.level = ERROR # # Name of this Karaf instance. # karaf.name = root # # Default repository where bundles will be loaded from before using # other Maven repositories. For the full Maven configuration, see # the org.ops4j.pax.url.mvn.cfg file. # karaf.default.repository = system # # Location of a shell script that will be run when starting a shell # session. This script can be used to create aliases and define # additional commands. # karaf.shell.init.script = ${karaf.etc}/shell.init.script # # Sets the maximum size of the shell command history. If not set, # defaults to 500 entries. Setting to 0 will disable history. # # karaf.shell.history.maxSize = 0 # # Deletes the entire karaf.data directory at every start # karaf.clean.all = false # # Deletes the karaf.data/cache directory at every start # karaf.clean.cache = false # # User name for the Karaf local console # karaf.local.user = karaf # # Roles to use when for the default user in the local Karaf console. # # The syntax is the following: # [classname:]principal # where classname is the class name of the principal object # (defaults to org.apache.karaf.jaas.modules.RolePrincipal) # and principal is the name of the principal of that class # (defaults to instance). # karaf.local.roles = admin,manager,viewer,systembundles # # Set this empty property to avoid errors when validating xml documents. # xml.catalog.files = # # Suppress the bell in the console when hitting backspace too many times # for example # jline.nobell = true # # ServiceMix specs options # org.apache.servicemix.specs.debug = false org.apache.servicemix.specs.timeout = 0 # # Settings for the OSGi 4.3 Weaving # By default, we will not weave any classes. Change this setting to include classes # that you application needs to have woven. # org.apache.aries.proxy.weaving.enabled = none # Classes not to weave - Aries default + Xerces which is known to have issues. org.apache.aries.proxy.weaving.disabled = org.objectweb.asm.*,org.slf4j.*,org.apache.log4j.*,javax.*,org.apache.xerces.* # # By default, only Karaf shell commands are secured, but additional services can be # secured by expanding this filter # karaf.secured.services = (&(osgi.command.scope=*)(osgi.command.function=*)) # # By default, if there's no ACL policy for a certain karaf command, this command is allowed to access # without the RBAC. We can change this behavior by enable the following property, which means # if a karaf command has no corresponding ACL then access it must have one of the karaf.secured.command.compulsory.roles # #karaf.secured.command.compulsory.roles=admin # # Security properties # # To enable OSGi security, uncomment the properties below, # install the framework-security feature and restart. # #java.security.policy=${karaf.etc}/all.policy #org.osgi.framework.security=osgi #org.osgi.framework.trust.repositories=${karaf.etc}/trustStore.ks # # HA/Lock configuration # # Karaf uses a lock mechanism to know which instance is the master (HA) # The lock can be on the filesystem (default) or on a database. # # See http://karaf.apache.org/manual/latest/users-guide/failover.html for details. # # Even using a single instance, Karaf creates the lock file # You can specify the location of the lock file using the # karaf.lock.dir=/path/to/the/directory/containing/the/lock # # By default, the slave instances start but are passive. # If you want to prevent the slave instances startup, you can use # the karaf.lock.slave.block property (false by default): # karaf.lock.slave.block=true # # Default port for the OSGI HTTP Service # org.osgi.service.http.port=8181 # # Allow usage of ${servicemix.home} as an alias for ${karaf.home} # servicemix.home=${karaf.home} # # Activemq configuration # activemq.broker.name = amq-broker activemq.port = 61616 activemq.host = localhost activemq.url = tcp://${activemq.host}:${activemq.port} activemq.url.vm = vm://${activemq.broker.name}?create=false&waitForStart=10000 activemq.jms.user = smx activemq.jms.password = smx # # Activemq JMX configuration # activemq.jmx.url = service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-${karaf.name} activemq.jmx.user = ${activemq.jms.user} activemq.jmx.password = ${activemq.jms.password} javax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl javax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl # # CXF Log configuration # org.apache.cxf.Logger=org.apache.cxf.common.logging.Slf4jLogger ================================================ FILE: assemblies/apache-servicemix/src/main/resources/etc/users.properties ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ # # This file contains the users, groups, and roles. # Each line has to be of the format: # # USER=PASSWORD,ROLE1,ROLE2,... # USER=PASSWORD,_g_:GROUP,... # _g_\:GROUP=ROLE1,ROLE2,... # # All users, grousp, and roles entered in this file are available after Karaf startup # and modifiable via the JAAS command group. These users reside in a JAAS domain # with the name "karaf". # smx = smx,_g_:admingroup _g_\:admingroup = group,admin,manager,viewer,webconsole,systembundles # Workaround for SM-2267: sometimes, the webconsole configuration first hands out a ConnectionFactory # that uses karaf/karaf as the credentials before picking up the settings in system.properties karaf = karaf,_g_:admingroup ================================================ FILE: assemblies/apache-servicemix/src/main/resources/licenses/asm.txt ================================================ Copyright (c) 2000-2005 INRIA, France Telecom All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: assemblies/apache-servicemix/src/main/resources/licenses/bsd.txt ================================================ The BSD License Copyright (c) , All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: assemblies/apache-servicemix/src/main/resources/licenses/cddl-1.0.txt ================================================ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 1. Definitions. 1.1. ÒContributorÓ means each individual or entity that creates or contributes to the creation of Modifications. 1.2. ÒContributor VersionÓ means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor. 1.3. ÒCovered SoftwareÓ means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof. 1.4. ÒExecutableÓ means the Covered Software in any form other than Source Code. 1.5. ÒInitial DeveloperÓ means the individual or entity that first makes Original Software available under this License. 1.6. ÒLarger WorkÓ means a work which combines Covered Software or portions thereof with code not governed by the terms of this License. 1.7. ÒLicenseÓ means this document. 1.8. ÒLicensableÓ means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 1.9. ÒModificationsÓ means the Source Code and Executable form of any of the following: A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications; B. Any new file that contains any part of the Original Software or previous Modification; or C. Any new file that is contributed or otherwise made available under the terms of this License. 1.10. ÒOriginal SoftwareÓ means the Source Code and Executable form of computer software code that is originally released under this License. 1.11. ÒPatent ClaimsÓ means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 1.12. ÒSource CodeÓ means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code. 1.13. ÒYouÓ (or ÒYourÓ) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, ÒYouÓ includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, ÒcontrolÓ means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants. 2.1. The Initial Developer Grant. Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof). (c) The licenses granted in Sections 2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License. (d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for code that You delete from the Original Software, or (2) for infringements caused by: (i) the modification of the Original Software, or (ii) the combination of the Original Software with other software or devices. 2.2. Contributor Grant. Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1) Modifications made by that Contributor (or portions thereof); and (2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party. (d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for any code that Contributor has deleted from the Contributor Version; (2) for infringements caused by: (i) third party modifications of Contributor Version, or (ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3) under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor. 3. Distribution Obligations. 3.1. Availability of Source Code. Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange. 3.2. Modifications. The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License. 3.3. Required Notices. You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer. 3.4. Application of Additional Terms. You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipientsÕ rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 3.5. Distribution of Executable Versions. You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipientÕs rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. 3.6. Larger Works. You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software. 4. Versions of the License. 4.1. New Versions. Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License. 4.2. Effect of New Versions. You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward. 4.3. Modified Versions. When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a) rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b) otherwise make it clear that the license contains terms which differ from this License. 5. DISCLAIMER OF WARRANTY. COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN ÒAS ISÓ BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 6. TERMINATION. 6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as ÒParticipantÓ) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant. 6.3. In the event of termination under Sections 6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination. 7. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTYÕS NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 8. U.S. GOVERNMENT END USERS. The Covered Software is a Òcommercial item,Ó as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of Òcommercial computer softwareÓ (as that term is defined at 48 C.F.R. ¤ 252.227-7014(a)(1)) and Òcommercial computer software documentationÓ as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License. 9. MISCELLANEOUS. This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdictionÕs conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneysÕ fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software. 10. RESPONSIBILITY FOR CLAIMS. As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. ================================================ FILE: assemblies/apache-servicemix/src/main/resources/licenses/cpl-1.0.txt ================================================ Common Public License Version 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. ================================================ FILE: assemblies/apache-servicemix/src/main/resources/licenses/epl-1.0.txt ================================================ Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. ================================================ FILE: assemblies/apache-servicemix/src/main/resources/licenses/slf4j-mit.txt ================================================ Copyright (c) 2004-2011 QOS.ch All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: assemblies/apache-servicemix/src/main/resources/setenv-unix ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # export JAVA_MAX_PERM_MEM=256M ================================================ FILE: assemblies/apache-servicemix/src/main/resources/setenv-win ================================================ rem rem Licensed to the Apache Software Foundation (ASF) under one or more rem contributor license agreements. See the NOTICE file distributed with rem this work for additional information regarding copyright ownership. rem The ASF licenses this file to You under the Apache License, Version 2.0 rem (the "License"); you may not use this file except in compliance with rem the License. You may obtain a copy of the License at rem rem http://www.apache.org/licenses/LICENSE-2.0 rem rem Unless required by applicable law or agreed to in writing, software rem distributed under the License is distributed on an "AS IS" BASIS, rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. rem See the License for the specific language governing permissions and rem limitations under the License. rem set JAVA_MAX_PERM_MEM=256M ================================================ FILE: assemblies/apache-servicemix-examples/pom.xml ================================================ 4.0.0 org.apache.servicemix.parent features-parent 7.1.0-SNAPSHOT ../../parent/features-parent/pom.xml org.apache.servicemix apache-servicemix-examples jar Apache ServiceMix :: Assemblies :: ServiceMix Examples ${project.basedir}/../../examples false **/target/** **/.project **/.classpath **/.settings/** **/*.iws **/*.iwl pom.xml ${project.basedir}/../../examples true **/README.txt src/main/filtered-resources true **/* ================================================ FILE: assemblies/apache-servicemix-examples/src/main/filtered-resources/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples examples pom ${project.version} Apache ServiceMix :: Examples ${akka.version} ${cxf.version} ${drools.version} ${drools6.version} ${jaxb.api.version} ${karaf.version} ${scala.version} ${slf4j.version} ${swagger.version} ${xerces.version} ${cxf.codegen-plugin.version} ${exec-maven-plugin.version} ${maven-scala-plugin.version} org.apache.camel camel-parent ${camel.version} pom import org.apache.cxf cxf-rt-transports-http ${cxf.version} org.apache.cxf cxf-rt-ws-security ${cxf.version} org.apache.karaf karaf ${karaf.version} pom import org.apache.servicemix.specs org.apache.servicemix.specs.jsr339-api-2.0 ${servicemix.specs.version} commons-io commons-io ${commons-io.version} org.apache.servicemix.specs org.apache.servicemix.specs.jaxb-api-${jaxb.api.version} ${servicemix.specs.version} org.apache.cxf cxf-rt-frontend-jaxws ${cxf.version} org.apache.cxf cxf-core ${cxf.version} org.apache.cxf cxf-rt-transports-http-jetty ${cxf.version} org.apache.cxf cxf-rt-ws-rm ${cxf.version} org.apache.cxf cxf-rt-ws-addr ${cxf.version} org.apache.cxf cxf-rt-ws-policy ${cxf.version} org.apache.cxf.services.wsn cxf-services-wsn-core ${cxf.version} org.activiti activiti-camel ${activiti.version} org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec ${geronimo-ws-metadata.version} org.apache.servicemix.bundles org.apache.servicemix.bundles.commons-httpclient ${commons-httpclient.bundle.version} com.wordnik swagger-jaxrs_2.11 ${swagger.version} org.apache.felix maven-bundle-plugin ${maven-bundle-plugin.version} true org.codehaus.mojo exec-maven-plugin ${exec-maven-plugin.version} org.scala-tools maven-scala-plugin ${maven-scala-plugin.version} org.apache.cxf cxf-codegen-plugin ${cxf.codegen-plugin.version} xerces xercesImpl ${xerces.version} activemq activiti akka camel cxf drools karaf apache.snapshots Apache Snapshot Repository https://repository.apache.org/snapshots false ================================================ FILE: assemblies/features/pom.xml ================================================ 4.0.0 org.apache.servicemix.parent features-parent 7.1.0-SNAPSHOT ../../parent/features-parent/pom.xml org.apache.servicemix.assemblies.features features pom Apache ServiceMix :: Assemblies :: Features servicemix-features servicemix-kie servicemix-examples ================================================ FILE: assemblies/features/servicemix-examples/pom.xml ================================================ 4.0.0 features org.apache.servicemix.assemblies.features 7.1.0-SNAPSHOT org.apache.servicemix.features servicemix-examples feature Apache ServiceMix :: Assemblies :: Features :: ServiceMix Examples org.apache.karaf.tooling karaf-maven-plugin compile compile features-generate-descriptor false ================================================ FILE: assemblies/features/servicemix-examples/src/main/feature/feature.xml ================================================ activemq-broker-noweb camel-jms camel-blueprint mvn:org.apache.servicemix.examples/activemq-camel-blueprint/${project.version} cxf mvn:commons-io/commons-io/${commons-io.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/${spring.version} mvn:org.apache.servicemix.examples/cxf-osgi/${project.version} cxf mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/${spring.version} mvn:commons-codec/commons-codec/${commons-codec.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/${commons-httpclient.bundle.version} mvn:org.apache.servicemix.examples/cxf-jaxrs/${project.version} cxf swagger-2.11 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/${spring.version} mvn:commons-codec/commons-codec/${commons-codec.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/${commons-httpclient.bundle.version} mvn:org.apache.servicemix.examples/cxf-jaxrs-blueprint/${project.version} cxf mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/${spring.version} mvn:commons-codec/commons-codec/${commons-codec.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/${commons-httpclient.bundle.version} mvn:org.apache.servicemix.examples/cxf-jaxws-blueprint/${project.version} camel-sql mvn:commons-dbcp/commons-dbcp/${commons-dbcp.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.derby/${derby.bundle.version} mvn:org.apache.servicemix.examples/camel-sql-datasource-derby/${version} mvn:org.apache.servicemix.examples/camel-sql-orders/${project.version} camel-sql mvn:commons-dbcp/commons-dbcp/${commons-dbcp.version} wrap:mvn:postgresql/postgresql/${postgresql.version}.jdbc4 mvn:org.apache.servicemix.examples/camel-sql-datasource-pgsql/${version} mvn:org.apache.servicemix.examples/camel-sql-orders/${project.version} camel-sql mvn:commons-dbcp/commons-dbcp/${commons-dbcp.version} mvn:org.osgi/osgi.cmpn/${osgi.version} mvn:com.h2database/h2/${h2.version} mvn:org.apache.servicemix.examples/camel-sql-datasource-h2/${version} mvn:org.apache.servicemix.examples/camel-sql-orders/${project.version} camel mvn:org.apache.servicemix.examples/camel-osgi/${project.version} camel-blueprint mvn:org.apache.servicemix.examples/camel-blueprint/${project.version} camel-jms drools mvn:org.apache.servicemix.examples/camel-drools/${project.version} camel-jms drools mvn:org.apache.servicemix.examples/camel-drools-blueprint/${project.version} mvn:org.apache.servicemix.examples/camel-cxf-rest-service/${project.version} mvn:org.apache.servicemix.examples/camel-cxf-rest-route/${project.version} camel-jaxb mvn:org.apache.servicemix.examples/camel-cxf-soap-service/${project.version} mvn:org.apache.servicemix.examples/camel-cxf-soap-route/${project.version} cxf-core mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/${spring.version} mvn:commons-io/commons-io/${commons-io.version} mvn:org.apache.servicemix.examples/cxf-ws-addressing/${project.version} cxf-core cxf-ws-security mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/${spring.version} mvn:org.apache.servicemix.examples/cxf-ws-security-osgi/${project.version} cxf-core cxf-ws-security mvn:org.apache.servicemix.examples/cxf-ws-security-blueprint/${project.version} cxf-core cxf-ws-security cxf-ws-rm mvn:org.apache.cxf/cxf-bundle-compatible/${cxf.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-beans/${spring.version} mvn:commons-io/commons-io/${commons-io.version} mvn:org.apache.servicemix.examples/cxf-ws-security-signature/${project.version} cxf-core cxf-ws-rm mvn:org.apache.servicemix.examples/cxf-ws-rm/${project.version} camel-jetty9 camel-jms camel-jaxb cxf-wsn mvn:org.apache.servicemix.examples/cxf-wsn-base/${project.version} mvn:org.apache.servicemix.examples/cxf-wsn-receive/${project.version} examples-cxf-wsn-receive mvn:org.apache.servicemix.examples/cxf-wsn-notifier/${project.version} camel-core activiti mvn:org.apache.servicemix.examples/activiti-camel/${project.version} akka camel-scala mvn:org.apache.servicemix.examples/akka-camel/${project.version} drools6-module mvn:org.apache.servicemix.examples/drools-simple/${project.version} kie-camel kie-aries-blueprint mvn:org.apache.servicemix.examples/drools-camel-blueprint/${project.version} kie-spring mvn:org.apache.servicemix.examples/drools-spring/${project.version} kie-aries-blueprint kie-camel camel-xstream mvn:org.apache.servicemix.examples/drools-camel-cxf-server/${project.version} ================================================ FILE: assemblies/features/servicemix-features/pom.xml ================================================ 4.0.0 features org.apache.servicemix.assemblies.features 7.1.0-SNAPSHOT org.apache.servicemix.features servicemix-features feature Apache ServiceMix :: Assemblies :: Features :: ServiceMix Features org.apache.karaf.tooling karaf-maven-plugin compile compile features-generate-descriptor false ================================================ FILE: assemblies/features/servicemix-features/src/main/feature/feature.xml ================================================ activemq-broker-noweb mvn:org.apache.servicemix.logging/jms-appender/${project.version} activemq-broker-noweb activemq-camel mvn:org.apache.servicemix.activemq/org.apache.servicemix.activemq.service/${project.version} mvn:org.apache.servicemix.activemq/org.apache.servicemix.activemq.camel/${project.version} mvn:org.apache.servicemix.activemq/org.apache.servicemix.activemq.service/${project.version}/cfg/activemq-service jpa cxf-specs transaction camel spring-orm drools mvn:joda-time/joda-time/${jodatime2.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.wsdl4j/${wsdl4j.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.json4s/${json4s.bundle.version} mvn:org.mybatis/mybatis/${mybatis.version} mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.scripting-api-1.0/${servicemix.specs.version} mvn:org.apache.commons/commons-lang3/${commons-lang3.version} mvn:com.h2database/h2/${h2.version} mvn:org.mvel/mvel2/${mvel2.version} mvn:com.fasterxml.jackson.core/jackson-core/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.core/jackson-annotations/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.core/jackson-databind/${fasterxml.jackson.version} mvn:org.activiti/activiti-engine/${activiti.version} mvn:org.activiti/activiti-bpmn-converter/${activiti.version} mvn:org.activiti/activiti-spring/${activiti.version} mvn:org.activiti/activiti-bpmn-model/${activiti.version} mvn:org.activiti/activiti-osgi/${activiti.version} mvn:org.activiti/activiti-process-validation/${activiti.version} mvn:org.activiti/activiti-camel/${activiti.version} mvn:org.activiti/activiti-image-generator/${activiti.version} mvn:org.activiti/activiti-ldap/${activiti.version} mvn:org.activiti/activiti-jmx/${activiti.version} mvn:org.apache.servicemix.activiti/org.apache.servicemix.activiti.config/${project.version} mvn:org.scala-lang/scala-library/${scala.version} mvn:com.typesafe/config/${typesafe-config.version} mvn:com.typesafe.akka/akka-actor_2.11/${akka.version} mvn:com.typesafe.akka/akka-osgi_2.11/${akka.version} mvn:com.typesafe.akka/akka-camel_2.11/${akka.version} mvn:org.scala-lang/scala-library/${scala-2.10.version} mvn:org.scala-lang/scala-reflect/${scala-2.10.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javassist/${javassist.bundle.version} mvn:com.google.guava/guava/${google.guava.version} mvn:com.fasterxml.jackson.core/jackson-core/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.core/jackson-databind/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.core/jackson-annotations/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.module/jackson-module-scala_2.10/${fasterxml.jackson.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.swagger-annotations/${swagger.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.swagger-core/${swagger.core.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.swagger-jaxrs/${swagger.bundle.version} mvn:com.thoughtworks.paranamer/paranamer/${thoughtworks.paranamer.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.json4s/${json4s.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections/${reflections.bundle.version} mvn:org.scala-lang/scala-library/${scala.version} mvn:org.scala-lang/scala-reflect/${scala.version} mvn:org.scala-lang.modules/scala-xml_2.11/${scala-xml.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javassist/${javassist.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/${javax-inject.bundle.version} mvn:com.google.guava/guava/${google.guava.version} mvn:com.fasterxml.jackson.core/jackson-core/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.core/jackson-databind/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.core/jackson-annotations/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.module/jackson-module-paranamer/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.module/jackson-module-scala_2.11/${fasterxml.jackson.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.swagger-annotations/${swagger.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.swagger-core_2.11/${swagger.core.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.swagger-jaxrs_2.11/${swagger.bundle.version} mvn:com.thoughtworks.paranamer/paranamer/${thoughtworks.paranamer.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.json4s_2.11/${json4s.bundle.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections/${reflections.bundle.version} mvn:org.eclipse.jdt.core.compiler/ecj/${eclipse.jdt.version} mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools/${drools.bundle.version} webconsole camel-groovy camel-script-groovy mvn:commons-io/commons-io/${commons-io.version} mvn:commons-fileupload/commons-fileupload/${commons-fileupload.version} mvn:org.apache.felix/org.apache.felix.webconsole.plugins.scriptconsole/${felix.webconsole.plugins.scriptconsole.version} ================================================ FILE: assemblies/features/servicemix-kie/pom.xml ================================================ 4.0.0 features org.apache.servicemix.assemblies.features 7.1.0-SNAPSHOT org.apache.servicemix.features servicemix-kie feature Apache ServiceMix :: Assemblies :: Features :: ServiceMix KIE org.apache.karaf.tooling karaf-maven-plugin compile compile features-generate-descriptor false ================================================ FILE: assemblies/features/servicemix-kie/src/main/feature/feature.xml ================================================ pax-cdi mvn:org.mvel/mvel2/2.2.4.Final mvn:com.google.protobuf/protobuf-java/2.5.0 mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/3.5_1 mvn:org.kie/kie-api/${drools6.version} mvn:org.kie/kie-internal/${drools6.version} mvn:org.drools/drools-core/${drools6.version} mvn:org.drools/drools-compiler/${drools6.version} mvn:org.drools/drools-osgi-integration/${drools6.version} drools6-module jpa mvn:org.drools/drools-persistence-jpa/${drools6.version} drools6-module drools6-jpa mvn:org.jboss.spec.javax.security.jacc/jboss-jacc-api_1.5_spec/1.0.0.Final mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.quartz/1.8.6_1 mvn:org.codehaus.jackson/jackson-core-asl/1.9.13 mvn:org.jbpm/jbpm-human-task-core/${drools6.version} mvn:org.jbpm/jbpm-human-task-workitems/${drools6.version} mvn:org.jbpm/jbpm-human-task-jpa/${drools6.version} mvn:org.jbpm/jbpm-human-task-audit/${drools6.version} mvn:org.jbpm/jbpm-flow-builder/${drools6.version} mvn:org.jbpm/jbpm-flow/${drools6.version} mvn:org.jbpm/jbpm-bpmn2/${drools6.version} mvn:org.jbpm/jbpm-audit/${drools6.version} mvn:org.jbpm/jbpm-runtime-manager/${drools6.version} mvn:org.jbpm/jbpm-persistence-jpa/${drools6.version} jbpm mvn:org.kie/kie-aries-blueprint/${drools6.version} jbpm spring spring-orm mvn:org.kie/kie-spring/${drools6.version} kie-spring jbpm camel-core camel-spring camel-cxf cxf-specs cxf-core cxf-jaxrs mvn:org.kie/kie-camel/${drools6.version} ================================================ FILE: assemblies/pom.xml ================================================ 4.0.0 org.apache.servicemix.parent assemblies-parent 7.1.0-SNAPSHOT ../parent/assemblies-parent/pom.xml org.apache.servicemix.assemblies assemblies pom Apache ServiceMix :: Assemblies features apache-servicemix-examples apache-servicemix ================================================ FILE: branding/pom.xml ================================================ 4.0.0 org.apache.servicemix.parent assemblies-parent 7.1.0-SNAPSHOT ../parent/assemblies-parent/pom.xml org.apache.servicemix org.apache.servicemix.branding bundle Apache ServiceMix :: Branding Support Branding for Apache ServiceMix ${project.basedir}/src/main/resources true **/* org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} * !* org.apache.karaf.branding *;publish-context:=false ================================================ FILE: branding/src/main/resources/org/apache/karaf/branding/branding.properties ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ welcome = \ \u001B[36m ____ _ __ __ _ \u001B[0m\n\ \u001B[36m/ ___| ___ _ ____ _(_) ___ ___| \\/ (_)_ __\u001B[0m\n\ \u001B[36m\\___ \\ / _ \\ '__\\ \\ / / |/ __/ _ \\ |\\/| | \\ \\/ /\u001B[0m\n\ \u001B[36m ___) | __/ | \\ V /| | (_| __/ | | | |> < \u001B[0m\n\ \u001B[36m|____/ \\___|_| \\_/ |_|\\___\\___|_| |_|_/_/\\_\\\u001B[0m\n\ \n\ \u001B[1m Apache ServiceMix\u001B[0m (${pom.version})\n\ \n\ Hit '\u001B[1m\u001B[0m' for a list of available commands\n\ and '\u001B[1m[cmd] --help\u001B[0m' for help on a specific command.\n\ Hit '' or 'system:shutdown' to shutdown ServiceMix.\n prompt = \u001B[1m${USER}@${APPLICATION}\u001B[0m> ================================================ FILE: etc/appended-resources/supplemental-models.xml ================================================ com.sun.xml.bind jaxb-impl Sun JAXB Reference Implementation Runtime Sun Microsystems http://www.sun.com/ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.sun.com/cddl/cddl.html com.sun.xml.bind jaxb-xjc Sun JAXB Reference Implementation Tools Sun Microsystems http://www.sun.com/ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.sun.com/cddl/cddl.html com.sun.xml.messaging.saaj saaj-impl Sun SAAJ Reference Implementation Sun Microsystems http://www.sun.com/ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.sun.com/cddl/cddl.html javax.xml.soap saaj-api Sun SAAJ API Sun Microsystems http://www.sun.com/ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.sun.com/cddl/cddl.html org.apache.neethi neethi Neethi The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt javax.xml.ws jaxws-api Java API for XML-Based Web Services (JAX-WS API) Sun Microsystems http://www.sun.com/ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.sun.com/cddl/cddl.html javax.xml.bind jaxb-api Java Architecture for XML Binding (JAXB API) Sun Microsystems http://www.sun.com/ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.sun.com/cddl/cddl.html javax.xml jaxb-api Java Architecture for XML Binding (JAXB API) Sun Microsystems http://www.sun.com/ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.sun.com/cddl/cddl.html xalan xalan Apache Xalan-Java The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt net.java.dev.stax-utils stax-utils StAX Utilities wss4j wss4j Apache WSS4J The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt jdom jdom JDOM jdom.org http://www.jdom.org Modified Apache Software License licenses/jdom.txt xml-security xmlsec XML Security The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt xml-apis xml-apis XML APIs The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt bouncycastle bcprov-jdk14 Bouncy Castle Crypto APIs for Java The Legion of the Bouncy Castle http://www.bouncycastle.org Bouncy Castle License http://www.bouncycastle.org/licence.html ant ant Apache Ant The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt ant ant-nodeps Apache Ant (nodeps) The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.codehaus.jettison jettison Jettison Envoi Solutions LLC http://www.envoisolutions.com The Apache Software License, Version 2.0 http://jettison.codehaus.org/License commons-codec commons-codec Apache Commons Codec The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt commons-collections commons-collections Apache Commons Collections The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt commons-dbcp commons-dbcp Apache Commons DBCP The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt commons-jexl commons-jexl Apache Commons JEXL The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt commons-logging commons-logging Apache Commons Logging http://commons.apache.org/logging The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt commons-logging commons-logging-api Apache Commons Logging Api http://commons.apache.org/logging The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt commons-pool commons-pool Apache Commons Pool http://commons.apache.org/pool The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt commons-vfs commons-vfs Apache Commons VFS The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt commons-codec commons-codec Apache Commons Codec The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.apache.aries.blueprint org.apache.aries.blueprint Apache Aries Blueprint The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.apache.activemq activemq-core ActiveMQ :: Core The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.apache.camel camel-core Camel :: Core The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.apache.xbean xbean-classloader XBean :: Classloader The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.apache.xbean xbean-finder XBean :: Classpath Resource Finder The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.apache.xbean xbean-naming XBean :: Naming The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.apache.xbean xbean-reflect XBean :: Reflect The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.apache.xbean xbean-spring XBean :: Spring The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.slf4j slf4j-api SLF4J API Module QOS.ch http://www.qos.ch MIT style http://www.slf4j.org/license.html org.slf4j slf4j-jdk14 SLF4J JDK14 Binding QOS.ch http://www.qos.ch MIT style http://www.slf4j.org/license.html log4j log4j Log4j The Apache Software Foundation http://www.apache.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.apache.geronimo.components geronimo-connector Apache Geronimo TxManager :: Connector The Apache Software Foundation http://www.apache.org/ org.apache.geronimo.components geronimo-transaction Apache Geronimo TxManager :: Transaction The Apache Software Foundation http://www.apache.org/ org.springframework.osgi spring-osgi-core Spring OSGi Core http://www.springframework.org/osgi/ Spring Framework http://www.springframework.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.springframework.osgi spring-osgi-extender Spring OSGi Extender http://www.springframework.org/osgi/ Spring Framework http://www.springframework.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.springframework.osgi spring-osgi-io Spring OSGi IO http://www.springframework.org/osgi/ Spring Framework http://www.springframework.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.springframework.osgi spring-osgi-annotation Spring OSGi Annotations http://www.springframework.org/osgi/ Spring Framework http://www.springframework.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.objectweb.howl howl Howl Logger http://howl.objectweb.org/ ObjectWeb http://www.objectweb.org/ The BSD License http://howl.objectweb.org/license.html org.codehaus.plexus plexus-classworlds Plexus Classworlds http://plexus.codehaus.org/plexus-classworlds/ Codehaus http://www.codehaus.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt com.thoughtworks.xstream xstream XStream Core http://xstream.codehaus.org/ Codehaus http://www.codehaus.org/ The BSD License http://xstream.codehaus.com/license.html org.apache.servicemix.specs org.apache.servicemix.specs.activation-api-1.1 Apache ServiceMix Specs :: Activation 1.1 The Apache Software Foundation http://www.apache.org/ org.apache.geronimo.specs geronimo-j2ee-connector_1.5_spec Apache Geronimo Specs :: J2EE Connector 1.5 The Apache Software Foundation http://www.apache.org/ org.apache.geronimo.specs geronimo-j2ee-management_1.1_spec Apache Geronimo Specs :: J2EE Management 1.1 The Apache Software Foundation http://www.apache.org/ org.apache.geronimo.specs geronimo-javamail_1.4_spec Apache Geronimo Specs :: JavaMail 1.4 The Apache Software Foundation http://www.apache.org/ org.apache.geronimo.specs geronimo-jms_1.1_spec Apache Geronimo Specs :: JMS 1.1 The Apache Software Foundation http://www.apache.org/ org.apache.geronimo.specs geronimo-jta_1.1_spec Apache Geronimo Specs :: JTA 1.1 The Apache Software Foundation http://www.apache.org/ org.apache.geronimo.specs geronimo-saaj_1.3_spec Apache Geronimo Specs :: SAAJ 1.3 The Apache Software Foundation http://www.apache.org/ org.apache.geronimo.specs geronimo-servlet_2.5_spec Apache Geronimo Specs :: Servlet 2.5 The Apache Software Foundation http://www.apache.org/ org.apache.geronimo.specs geronimo-stax-api_1.0_spec Apache Geronimo Specs :: Stax API 1.0 The Apache Software Foundation http://www.apache.org/ jline jline JLine http://jline.sourceforge.net JLine http://jline.sourceforge.net The BSD License http://jline.sourceforge.net/license.html org.mortbay.jetty jetty Jetty Server http://jetty.mortbay.org/ Mort Bay Consulting http://www.mortbay.com The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.mortbay.jetty jetty-util Jetty Utilities http://jetty.mortbay.org/ Mort Bay Consulting http://www.mortbay.com The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.base ops4j-base-lang OPS4J Base - Lang http://www.ops4j.org/projects/base/ops4j-base-lang OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.base ops4j-base-util-collections OPS4J Base - Util - Collections http://www.ops4j.org/projects/base/ops4j-base-util-collections OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.base ops4j-base-util-xml OPS4J Base - Util - XML http://www.ops4j.org/projects/base/ops4j-base-util-xml OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.pax.logging pax-logging-api OPS4J - Pax Logging API http://www.ops4j.org/projects/pax/logging/pax-logging-api OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.pax.logging pax-logging-service OPS4J - Pax Logging Service http://www.ops4j.org/projects/pax/logging/pax-logging-service OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.pax.url pax-url-mvn OPS4J Pax Url - mvn: http://www.ops4j.org/projects/pax/url/pax-url-mvn OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.pax.url pax-url-war OPS4J Pax Url - war: http://www.ops4j.org/projects/pax/url/pax-url-war OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.pax.web pax-web-bundle OPS4J Pax Web - Web Container http://www.ops4j.org/projects/pax/web/pax-web-bundle OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.pax.web pax-web-jsp OPS4J Pax Web - JSP http://www.ops4j.org/projects/pax/web/pax-web-jsp OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.pax.web-extender pax-web-ex-war OPS4J Pax Web Extender - WAR http://www.ops4j.org/projects/pax/web-extender/pax-web-ex-war OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.ops4j.pax.web-extender pax-web-ex-whiteboard OPS4J Pax Web Extender - Whiteboard http://www.ops4j.org/projects/pax/web-extender/pax-web-ex-whiteboard OPS4J - Open Participation Software for Java http://www.ops4j.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.osgi org.osgi.impl.bundle.jmx JMX management for OSGi (RI snapshot) OSGi Alliance http://www.osgi.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.fusesource.jansi jansi jansi FUSE Source http://www.fusesource.org/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt org.eclipse osgi Equinox Framework Eclipse Foundation http://www.eclipse.org/ Eclipse Public License, Version 1.0 http://www.eclipse.org/legal/epl-v10.html xmlpull xmlpull XML Pull Parsing API Eclipse Foundation http://www.eclipse.org/ Public Domain http://www.xmlpull.org/v1/download/unpacked/LICENSE.txt aopalliance aopalliance XML Pull Parsing API AOP Alliance http://aopalliance.sourceforge.net/ Public Domain ================================================ FILE: examples/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ WELCOME TO THE SERVICEMIX EXAMPLES ================================== Camel Examples ============== - camel-osgi Deploys a Camel EIP route as an OSGi bundle. Configuration makes use of the OSGi Configuration Admin service and Spring property placeholders, and the example demonstrates how to deploy the properties file from the ServiceMix console. - camel-blueprint Deploys a Camel EIP route as an OSGi bundle. Configuration makes use of the OSGi Configuration Admin service and uses a Blueprint XML file to start the Camel routes. CXF examples ============ - cxf-jaxrs Creates a RESTful JAX-RS web service using CXF and exposes it using the OSGi HTTP service. - cxf-osgi Creates a web service using CXF and Spring-DM, and exposes it through the OSGi HTTP service. - cxf-ws-addressing Uses CXF to create a web service enabled for WS-Addressing, and exposes it through the OSGi HTTP service. - cxf-ws-rm Uses CXF to create a web service enabled for WS-ReliableMessaging, and exposes it through the OSGi HTTP service. - cxf-ws-security Uses CXF to create a web service enabled for WS-Security, and exposes it through the OSGi HTTP service. It includes a custom CallbackHandler implementation to show you how to implement your own authentication logic. ActiveMQ Examples ================= - activemq-camel-blueprint Deploys Camel EIP routes as an OSGi bundle using Blueprint. These routes make use of an ActiveMQ queue hosted on the local broker deployed in ServiceMix. Karaf examples ============== - branding Builds the artifacts that allow you to re-brand Apache Karaf (as e.g. we did in Apache ServiceMix). - dump Demo that deploys a simple service into the OSGi Service Registry using a Blueprint XML file. - web Embeds Apache Karaf in a web application. Prerequisites for Running the Examples ========================================= Java Development Kit (JDK) -------------------------- You must have JDK 1.6 or higher installed on your machine to run the ServiceMix examples. Apache Maven ------------ The examples use Apache Maven for building code. You must install Maven 2.2.1 or higher and add the Maven bin/ directory to your PATH if you want to build any of the examples. If you have not used Maven before, the first time you use it to build one of the examples, it downloads a lot of JARs to a local repository on your machine. The next time you run Maven it uses the locally stored JARs where possible. To download and find out more about Maven, visit: http://maven.apache.org ServiceMix Container -------------------- You must have ServiceMix up and running. To start the ServiceMix container, run the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) ServiceMix Features Facility ============================ Several of the examples make use of the ServiceMix features facility. A feature is a named, versioned collection of OSGi bundles that work together to provide some functionality. The details of what makes up a feature are contained in a features definition file. The ServiceMix console includes a features subshell that provides commands to enable you to add and remove features, and to point to feature repositories. If you add a feature, ServiceMix uses the details provided in the features definition file to load and activate all of the required bundles that are not already present in the container. ServiceMix includes a number of features that make the running of the examples quick and easy. Each feature enables you to use a single command to install the example bundle and any bundles that the example depends on. To view a list of the features that are already installed, enter the following command in the ServiceMix console: features:list To view a list of the features that are used by the examples, enter the following command in the ServiceMix console: features:list | grep examples To view the repository URLs currently associated with the features facility, enter the following command in the ServiceMix console: features:listUrl To view the contents of the features definition file that includes definitions for each of the features used by the examples, enter the following command in the ServiceMix console: cat mvn:org.apache.servicemix/apache-servicemix/${version}/xml/features For more information about the features facility, see the ServiceMix documentation. ================================================ FILE: examples/activemq/activemq-camel-blueprint/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ActiveMQ & Camel in Blueprint Example ===================================== Purpose ------- Deploys Camel EIP routes as an OSGi bundle using Blueprint. These routes make use of an ActiveMQ queue hosted on the local broker deployed in ServiceMix. Configuration makes use of the OSGi Configuration Admin service and Blueprint property placeholders, and the example demonstrates how to deploy the properties file from the ServiceMix console. Explanation ----------- The Camel routes are defined in a Blueprint XML file, blueprint.xml, which can be found in the src/main/resources/OSGI-INF/blueprint directory of this example. The first route is defined in the first element and can be explained as follows: 1. A timer endpoint generates a heartbeat event every 2000ms. 2. A callout is made to a transformer bean that transforms each heartbeat message to the current date and time. 3. The message is sent to the LOG.ME queue on the ActiveMQ broker. and the second route can be explained as follows: 1. The message is consumed from the LOG.ME queue on the ActiveMQ broker. 2. A log endpoint sends the transformed message to the Jakarta commons logger. The blueprint.xml file also contains the following elements: - A and element that setup the ActiveMQ component to use the ConnectionFactory from the local ActiveMQ broker deployed in ServiceMix. - A element that instantiates the transformer bean using standard Blueprint configuration syntax and specifies a prefix value using a property placeholder. - An element which allows you to specify placeholder values using the OSGi Configuration Admin service. In this case, the property is also given the default value of "MyTransform". The routes and configuration are deployed in an OSGi bundle. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher (for building) For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running quickly. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-activemq-camel-blueprint This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events are routed to the transform method of the MyTransform class and you should see output similar to the following being logged to your console screen: >>>> ActiveMQ-Blueprint-Example set body: Wed Nov 30 15:37:36 NST 2011 >>>> ActiveMQ-Blueprint-Example set body: Wed Nov 30 15:37:38 NST 2011 >>>> ActiveMQ-Blueprint-Example set body: Wed Nov 30 15:37:40 NST 2011 Updating and Redeploying the Properties File from the Console ------------------------------------------------------------- You can update and redeploy the properties file that is used by the properties placeholder in the blueprint.xml from console as follows: 1. Edit the org.apache.servicemix.examples.cfg file, located in the same folder as this README, by changing the value of the "prefix" key to whatever you want (for example, YourTransform). 2. Copy the updated configuration file to your /etc directory. You can do this from the ServiceMix console by typing: copy $YOUR_SERVICEMIX_HOME/examples/activemq/activemq-camel-blueprint/org.apache.servicemix.examples.cfg $YOUR_SERVICEMIX_HOME/etc On Windows you need to replace / in the path with \\. Note, the text you are typing might intermingle with the output being logged. This is nothing to worry about. 3. Restart the example bundle: (i) First you must know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command in the ServiceMix console: bundle:list At the end of the listing, you should see an entry similar to the following: [158] [Active ] [Started ] [ 60] Apache ServiceMix Example :: ActiveMQ Camel Blueprint (4.4.0) In this case, the bundle ID is 158. (ii) Enter the following command in the ServiceMix console to restart the bundle: bundle:restart The prefix of the output should change, and the output should look similar to the following: >>>> YourTransform set body: Wed Nov 30 15:37:36 NST 2011 >>>> YourTransform set body: Wed Nov 30 15:37:38 NST 2011 >>>> YourTransform set body: Wed Nov 30 15:37:40 NST 2011 For information on how to stop and/or uninstall the example, see "Stopping and Uninstalling the Example" below. B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-camel-osgi feature by entering the following command in the ServiceMix console: feature:uninstall examples-activemq-camel-blueprint 2. Build the example by opening a command prompt, changing directory to examples/activemq/activemq-camel-blueprint (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-activemq-camel-blueprint It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events are routed to the transform method of the MyTransform class and you should see output similar to the following being logged to your console screen: >>>> ActiveMQ-Blueprint-Example set body: Wed Nov 30 15:37:36 NST 2011 >>>> ActiveMQ-Blueprint-Example set body: Wed Nov 30 15:37:38 NST 2011 >>>> ActiveMQ-Blueprint-Example set body: Wed Nov 30 15:37:40 NST 2011 Now, if you have not already done so, try updating and redeploying, from the console, the properties file that is used by the properties placeholder in the blueprint.xml file. For details on how to do this, see the "Updating and Redeploying the Properties File from the Console" section above. Stopping and Uninstalling the Example ------------------------------------- To stop the example, enter the following command in the ServiceMix console: bundle:stop For information on how to find the bundle_id assigned to the example, see step 3 in the "Updating and Redeploying the Properties File from the Console" section above. To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-activemq-camel-blueprint or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/activemq/activemq-camel-blueprint/org.apache.servicemix.examples.cfg ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. # # prefix=YourTransform ================================================ FILE: examples/activemq/activemq-camel-blueprint/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples activemq-examples 7.1.0-SNAPSHOT activemq-camel-blueprint bundle Apache ServiceMix :: Examples :: ActiveMQ Camel Blueprint Camel Example using blueprint for configuration and ActiveMQ for JMS messaging org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} *,org.apache.camel.osgi org.apache.servicemix.examples.activemq ================================================ FILE: examples/activemq/activemq-camel-blueprint/src/main/java/org/apache/servicemix/examples/activemq/MyTransform.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.activemq; import java.util.Date; import java.util.logging.Logger; public class MyTransform { private static final transient Logger logger = Logger.getLogger(MyTransform.class.getName()); private boolean verbose = true; private String prefix = "MyTransform"; public Object transform(Object body) { String answer = prefix + " set body: " + new Date(); if (verbose) { System.out.println(">>>> " + answer); } logger.info(">>>> " + answer); return answer; } public boolean isVerbose() { return verbose; } public void setVerbose(boolean verbose) { this.verbose = verbose; } public String getPrefix() { return prefix; } public void setPrefix(String prefix) { this.prefix = prefix; } } ================================================ FILE: examples/activemq/activemq-camel-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/activemq/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples examples 7.1.0-SNAPSHOT org.apache.servicemix.examples activemq-examples pom Apache ServiceMix :: Examples :: ActiveMQ activemq-camel-blueprint ================================================ FILE: examples/activiti/activiti-camel/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Activiti and Camel Example ========================== Purpose ------- This example will show you how to use Activiti inside Apache ServiceMix and how interact with your Activiti processes from within you Camel routes. In our example, we define a simple order process, that process the incoming orders and subsequently waits for its delivery. Once the delivery notification has been received, another bit of processing occurs before the business process ends. We use Camel routes to start new process instances and notify running processes about deliveries. We also use Camel routes to implement the order and delivery processing itself. Explanation ----------- In the Blueprint XML file (activiti-camel.xml), we are: 1. setting up our Camel context with our Camel routes 2. setting up the ActivitiComponent that will allow us to interact between our business process and our Camel routes 3. registering a ContextProvider instance to make your CamelContext available through the ${camel} expression in your business process definitions files The OrderProcess.bpmn20.xml business process definition defines the BPMN definition for our process. This process is automatically deployed as soon as bundle is started: start --> processOrder --> waitForDelivery --> processDelivery --> end The ActivitRouteBuilder class defines 4 routes: 1. The first route will process files in the var/activiti-camel/order and for every file, a new business process instance will be started. The Camel route will also assign a business key to the new process (the file name) and add a few extra variables to the process. 2. The second route will process files in the var/activiti-camel/delivery and once again uses the file name to notify running processes about order deliveries. 3. The third route will be triggered by the BPMN process when it executes its 'processOrder' service task. 4. The fourth route will be triggered by the BPMN process when it executes its 'processDelivery' service task. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 3.0.2 or higher (for building) For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. Before being able to run this example, you have to install some additional features into the container first to add support for the Activiti. feature:install activiti 2. Build the example by opening a command prompt, changing directory to examples/activiti/activiti-camel (this example) and entering the following Maven command: mvn clean install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: bundle:install mvn:org.apache.servicemix.examples/activiti-camel/${project.version} 4. Once the bundle has been started, you will see a var/activiti-camel/order directory under your ServiceMix installation directory. If you create files in that directory, you will see output like this appearing in the log file. Processing order 1508 created on 2012-06-26 11:50:19 original message: Process to handle incoming order file has been started (process instance id 14808) At that point, you have a running process instance for order 1508 that is waiting for delivery. 5. To notify the process about the delivery, you have to create a file with the same name in the var/activiti-camel/delivery directory. For example, to signal the delivery of order 1508, create a file named var/activiti-camel/delivery/1508. As soon as the Camel route picks up the file, you will see more output from the business process: Notifying process about delivery for order 1508 Processing delivery for order 1508 created on 2012-06-26 11:50:19 original message: Stopping and Uninstalling the Example ------------------------------------- First, find the bundle id for the deployed example bundle by doing bundle:list and looking for a line that looks like this one [ 317] [Active ] [Created ] [ ] [ 80] Apache ServiceMix :: Examples :: Activiti :: Activiti Camel (${project.version}) In the above case, the bundle id would be 317 To stop the example, enter the following command in the ServiceMix console: bundle:stop To uninstall the example, enter one of the following commands in the ServiceMix console: bundle:uninstall ================================================ FILE: examples/activiti/activiti-camel/pom.xml ================================================ 4.0.0 activiti-examples org.apache.servicemix.examples 7.1.0-SNAPSHOT activiti-camel bundle Apache ServiceMix :: Examples :: Activiti :: Activiti Camel org.apache.camel camel-core org.activiti activiti-camel org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} * org.apache.servicemix.examples.activiti ================================================ FILE: examples/activiti/activiti-camel/src/main/java/org/apache/servicemix/examples/activiti/ActivitiRouteBuilder.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.activiti; import org.apache.camel.Body; import org.apache.camel.Exchange; import org.apache.camel.Handler; import org.apache.camel.Header; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.language.Simple; import java.util.HashMap; import java.util.Map; import static org.activiti.camel.ActivitiProducer.PROCESS_KEY_PROPERTY; /** * Camel routes that interact with the business process defined in the * OSGI-INF/activiti/OrderProcess.bpmn20.xml file */ public class ActivitiRouteBuilder extends RouteBuilder { private final Helper helper = new Helper(); @Override public void configure() throws Exception { /* * This route will start a new OrderProcess instance. Using the PROCESS_KEY_PROPERTY, we are assigning a * business key to our process to allow for easier correlation in later processing steps. We are also * sending a Map containing additional variables to add to the process instance. */ from("file:var/activiti-camel/order") .setBody(bean(helper)) .setProperty(PROCESS_KEY_PROPERTY, simple("file:name")) .to("activiti:OrderProcess") .log("Process to handle incoming order file has been started (process instance id ${body})"); /* * This route will notify a running OrderProcess of an order delivery event. Here too, we are setting the * PROCESS_KEY_PROPERTY to correlate the delivery message with right order process instance. */ from("file:var/activiti-camel/delivery") .log("Notifying process about delivery for order ${file:name}") .setBody(bean(helper)) .setProperty(PROCESS_KEY_PROPERTY, simple("file:name")) .to("activiti:OrderProcess:receiveDelivery"); /* * The BPMN process can also trigger Camel routes as part of the process. In these routes, the variables that * you added to the process are available as Exchange properties. The next two routes will be triggered while * processing the order and the order delivery. */ from("activiti:OrderProcess:processOrder?copyVariablesToProperties=true") .log("Processing order ${property.orderid} created on ${property.timestamp}") .log(" original message: ${property.message}"); from("activiti:OrderProcess:processDelivery?copyVariablesToProperties=true") .log("Processing delivery for order ${property.orderid} created on ${property.timestamp}") .log(" original message: ${property.message}"); } /* * A few helper methods used for routing */ public static final class Helper { /* * This method will extract information from the Exchange (using Camel annotations) and put them in a * Map that will be used for setting up the process' variables. */ @Handler public Map getProcessVariables(@Body String body, @Header(Exchange.FILE_NAME) String filename, @Simple("${date:now:yyyy-MM-dd kk:mm:ss}") String timestamp) { Map variables = new HashMap(); variables.put("message", body); variables.put("orderid", filename); variables.put("timestamp", timestamp); return variables; } } } ================================================ FILE: examples/activiti/activiti-camel/src/main/resources/OSGI-INF/activiti/OrderProcess.bpmn20.xml ================================================ ================================================ FILE: examples/activiti/activiti-camel/src/main/resources/OSGI-INF/blueprint/activiti-camel.xml ================================================ org.apache.servicemix.examples.activiti ================================================ FILE: examples/activiti/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples examples 7.1.0-SNAPSHOT org.apache.servicemix.examples activiti-examples pom Apache ServiceMix :: Examples :: Activiti activiti-camel ================================================ FILE: examples/akka/akka-camel/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Akka and Camel Example ====================== Purpose ------- This example will show you how to use Akka inside Apache ServiceMix and how interact with your Akka actors from within you Camel routes. Our example contains a route that copies files with scores for countries from one directory to the other. It also wiretaps this information into a statistics actor, which will do some number-crunching to calculate some basic descriptive statistics about these scores. Once every 30 seconds, a summary report will be generated with the statistical summary per country. Explanation ----------- The Akka project provides the ActorSystemActivator abstract class for running Akka in an OSGi Container. We implement this activator in the Application class and configure that class as the bundle activator in the POM. We also use the Application class to set up our actual actors as well as the Camel route we're using. The Camel route builder defines two distinct routes: 1. The first route will process files in var/akka-camel/input directory and move them to the var/akka-camel/output directory. It will also send a copy of the file contents to the 'direct:stats' endpoint for Akka to work with. 2. The second route will receive messages from the 'direct:reports' endpoint and write those message to files in the var/akka/reports directory And finally, we have a set of actors calculating descriptive statistics and two additional actors to bridge between the statistics system and the Camel routes: 1. One of these actors acts as a consumer and receives messages on the 'direct:stats' endpoint to send them into the statistics actor. 2. The other actor acts as a producer and is set up to regularly (every 30 seconds) send a summary report to the 'direct:reports' endpoint. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 3.0.2 or higher (for building) For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. Before being able to run this example, you have to install some additional features into the container first to add support for the Camel Scala DSL and for Akka itself. feature:install camel-scala feature:install akka 2. Build the example by opening a command prompt, changing directory to examples/akka/akka-camel (this example) and entering the following Maven command: mvn clean install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: bundle:install mvn:org.apache.servicemix.examples/akka-camel/${project.version} 4. Once the bundle has been started, you will see a var/akka-camel/input directory under your ServiceMix installation directory. There are some sample files available in this example's src/test/resources/samples directory. If you copy these files to the input directory mentioned before, they will be moved to var/akka-camel/output directory. 5. After a short while, you will also see summary reports appearing in the var/akka-camel/reports directory, containing the score count, average and standard deviation per country. These calculations are being doing asynchronously by the Akka actor system. Stopping and Uninstalling the Example ------------------------------------- First, find the bundle id for the deployed example bundle by doing bundle:list and looking for a line that looks like this one [ 263] [Active ] [Created ] [ ] [ 60] Apache ServiceMix :: Examples :: Akka :: Akka Camel (${project.version}) In the above case, the bundle id would be 263 To stop the example, enter the following command in the ServiceMix console: bundle:stop To uninstall the example, enter one of the following commands in the ServiceMix console: bundle:uninstall ================================================ FILE: examples/akka/akka-camel/pom.xml ================================================ akka-examples org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 org.apache.servicemix.examples akka-camel Apache ServiceMix :: Examples :: Akka :: Akka Camel bundle org.scala-lang scala-library ${scala.version} com.typesafe.akka akka-actor_2.11 ${akka.version} com.typesafe.akka akka-osgi_2.11 ${akka.version} com.typesafe.akka akka-camel_2.11 ${akka.version} org.osgi org.osgi.core org.apache.camel camel-scala org.apache.camel camel-test test org.slf4j slf4j-log4j12 junit junit test com.typesafe.akka akka-slf4j_2.11 ${akka.version} test src/main/scala src/test/scala org.scala-tools maven-scala-plugin compile testCompile ${scala.version} org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} org.osgi.framework,akka.event,* org.apache.servicemix.examples.akka com.typesafe.akka.camel org.apache.servicemix.examples.akka.Application ================================================ FILE: examples/akka/akka-camel/src/main/resources/application.conf ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ akka { actor.deployment { # there's no extra configuration here at the moment, but you could # configure routers, log levels, ... or whatever settings you need # for your own application } # This is a copy of the akka-camel reference.conf # TODO: work out a better solution (extender to load configs from reference.conf into the OSGi Service Registry) camel { # Whether JMX should be enabled or disabled for the Camel Context jmx = off # enable/disable streaming cache on the Camel Context streamingCache = on consumer { # Configured setting which determines whether one-way communications # between an endpoint and this consumer actor # should be auto-acknowledged or application-acknowledged. # This flag has only effect when exchange is in-only. auto-ack = on # When endpoint is out-capable (can produce responses) reply-timeout is the # maximum time the endpoint can take to send the response before the message # exchange fails. This setting is used for out-capable, in-only, # manually acknowledged communication reply-timeout = 1m # The duration of time to await activation of an endpoint. activation-timeout = 10s } #Scheme to FQCN mappings for CamelMessage body conversions conversions { "file" = "java.io.InputStream" } } } ================================================ FILE: examples/akka/akka-camel/src/main/scala/org/apache/servicemix/examples/akka/Application.scala ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.akka import akka.actor.{ActorRef, ActorSystem} import org.apache.camel.scala.dsl.builder.{RouteBuilder, RouteBuilderSupport} import akka.osgi.ActorSystemActivator import org.osgi.framework.BundleContext /** * The Akka project provides the ActorSystemActivator for running Akka in an OSGi container. * We extend this Activator and use the configure() method to set up our own application. */ class Application extends ActorSystemActivator { def configure(context: BundleContext, system: ActorSystem) = Application(system) } /** * Application bootstrap class. This class will start the necessary actors on * the actor system for our application to work. */ object Application extends RouteBuilderSupport { def apply(system: ActorSystem, builder: RouteBuilder) : ActorRef = { val stats = Stats(system) val camel = CamelBridge(system, stats) camel.context.addRoutes(builder) stats } def apply(system: ActorSystem) : ActorRef = apply(system, new RouteBuilderImpl()) } ================================================ FILE: examples/akka/akka-camel/src/main/scala/org/apache/servicemix/examples/akka/CamelBridge.scala ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.akka import akka.actor.{Props, Actor, ActorRef, ActorSystem} import akka.camel._ import io.Source import org.apache.servicemix.examples.akka.Stats.{Input, Report} import scala.concurrent.duration._ /** * Sets up the actors that bridge between the Camel routes and the * Akka actors. */ object CamelBridge { val STATS_ENDPOINT = "direct:stats" val REPORTS_ENDPOINT = "direct:reports" def apply(system: ActorSystem, stats: ActorRef) = { val camel = CamelExtension(system) system.actorOf(Props(new CamelConsumer(stats)), "camel.consumer") val producer = system.actorOf(Props[CamelProducer]) import system.dispatcher system.scheduler.schedule(5 seconds, 30 seconds) { stats.tell(Report(), producer) } camel } } /** * This akka-camel consumer endpoint will receive messages from the endpointUri and * sends the data for each line in the String body that corresponds to , * to the stats actor * * @param stats the stats engine entry actor */ class CamelConsumer(val stats: ActorRef) extends Actor with Consumer { def endpointUri = "direct:stats" def receive = { case CamelMessage(body: String, _) => Source.fromString(body).getLines().foreach(line => line.split(",") match { case Array(key, value) => try { stats ! Input(key, value.toInt) } catch { case e: NumberFormatException => //second element is not a number, skipping stats for it } } ) } } /** * This is an akka-camel producer endpoint. Message being received by this endpoint will be forwarded * to the endpointUri defined. */ class CamelProducer extends Actor with Producer with Oneway { def endpointUri = CamelBridge.REPORTS_ENDPOINT } ================================================ FILE: examples/akka/akka-camel/src/main/scala/org/apache/servicemix/examples/akka/RouteBuilder.scala ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.akka import org.apache.camel.scala.dsl.builder.RouteBuilder import org.apache.camel.Exchange import CamelBridge.{REPORTS_ENDPOINT, STATS_ENDPOINT} /** * Abstract RouteBuilder implementation with the basic route definitions, * but with placeholders for the endpoints to be used to allow for testing. */ abstract class AbstractRouteBuilder extends RouteBuilder { def start: String def end: String def reports: String start ==> { wireTap(STATS_ENDPOINT, exchange => exchange.getIn.getBody(classOf[String])) to(end) } REPORTS_ENDPOINT ==> { setHeader(Exchange.FILE_NAME, simple("summary-${date:now:yyyyMMdd-HHmmss}.txt")) to(reports) } } /** * Runtime endpoint definitions for our route builder */ class RouteBuilderImpl extends AbstractRouteBuilder { def start = "file:var/akka-camel/input" def end = "file:var/akka-camel/output" def reports = "file:var/akka-camel/reports" } ================================================ FILE: examples/akka/akka-camel/src/main/scala/org/apache/servicemix/examples/akka/Stats.scala ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.akka import akka.actor.{ActorRef, Actor, Props, ActorSystem} import akka.pattern._ import akka.util.Timeout import scala.concurrent.duration._ import collection.mutable.Map import collection.SortedSet import org.apache.servicemix.examples.akka.Stats.Metric import java.util.concurrent.atomic.AtomicBoolean import java.util.Locale /** * A statistics engine that generates basic descriptive statistics (count, average and standard deviation) for a * stream of key,value pairs. Use Stats() to start the engine and return an actor that you can interact * with using these two messages: * - Input(key, value) to submit another value for calculation * - Report() to request an overall report for all scores */ object Stats { case class Report() case class Input(val key: String, val value: Int) case class Metric[T](val metric: String, val key: String, val result: T) def apply(system: ActorSystem) : ActorRef = system.actorOf(Props[Stats], name = "stats") } class Stats extends Actor { import Stats._ val average = context.actorOf(Props[Average], "average") val stddev = context.actorOf(Props(new StdDev(average)), "stddev") val batcher = context.actorOf(Props(new Batcher(Seq(average, stddev))), "batcher") val metrics = Map.empty[String, Map[String, Any]].withDefaultValue(Map.empty[String, Any]) val changes = new AtomicBoolean(false) def receive = { case Input(key, value) => batcher ! (key, value); case Metric(metric, key, result) => { metrics(key) = metrics(key) + (metric -> result) changes.set(true) } case Report() => { if (changes.getAndSet(false)) { val results = SortedSet(metrics.keys.toArray:_*).map { key => val results = metrics(key) "%s,%d,%.4f,%.4f".formatLocal(Locale.ENGLISH, key, results.getOrElse("count", 0), results.getOrElse("avg", Double.NaN), results.getOrElse("stddev", Double.NaN)) } sender ! ("key,count,average,stddev" +: results.toSeq).mkString(sys.props("line.separator")) } } } } class Batcher(val stats: Seq[ActorRef]) extends Actor { val batches = Map.empty[String, Seq[Int]].withDefaultValue(Seq()) def receive = { case (key: String, value: Int) => { val batch = value +: batches(key) batches(key) = batch for (stat <- stats) stat.tell((key, batch), sender) sender ! Metric("count", key, batch.size) } } } class Average extends Actor { def receive = { case (key: String, items: Seq[Int]) => sender ! Metric("avg", key, avg(items)) case items: Seq[Int] => sender ! avg(items) } def avg(items: scala.Seq[Int]): Double = { items.foldLeft(0)(_ + _).toDouble / items.size } } class StdDev(val average: ActorRef) extends Actor { val sum_of_squares = context.actorOf(Props[SumOfSquares], "sum_of_squares") implicit val timeout = Timeout(1 seconds) def receive = { case (key: String, items: Seq[Int]) if items.size > 1 => val original = sender import context.dispatcher ask(average, items).onSuccess { case avg : Double => { ask(sum_of_squares, (items, avg)).onSuccess { case ss : Double => { original ! Metric("stddev", key, math.sqrt(ss / items.size - 1)) } } } } } } class SumOfSquares extends Actor { def receive = { case (items: Seq[Int], avg: Double) => sender ! items.map(item => math.pow(item.toDouble - avg, 2)).foldLeft(0d)(_ + _) } } ================================================ FILE: examples/akka/akka-camel/src/test/resources/application.conf ================================================ ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ akka { actor.deployment { # there's no extra configuration here at the moment, but you could # configure routers, log levels, ... or whatever settings you need # for your own application } # This is a copy of the akka-camel reference.conf # TODO: work out a better solution (extender to load configs from reference.conf into the OSGi Service Registry) camel { # Whether JMX should be enabled or disabled for the Camel Context jmx = off # enable/disable streaming cache on the Camel Context streamingCache = on consumer { # Configured setting which determines whether one-way communications # between an endpoint and this consumer actor # should be auto-acknowledged or application-acknowledged. # This flag has only effect when exchange is in-only. auto-ack = on # When endpoint is out-capable (can produce responses) reply-timeout is the # maximum time the endpoint can take to send the response before the message # exchange fails. This setting is used for out-capable, in-only, # manually acknowledged communication reply-timeout = 1m # The duration of time to await activation of an endpoint. activation-timeout = 10s } #Scheme to FQCN mappings for CamelMessage body conversions conversions { "file" = "java.io.InputStream" } } loggers = ["akka.event.slf4j.Slf4jLogger"] loglevel = DEBUG debug { lifecyle = on event-stream = on } } ================================================ FILE: examples/akka/akka-camel/src/test/resources/generate_test_data.rb ================================================ #!/usr/bin/ruby # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with this # work for additional information regarding copyright ownership. The ASF # licenses this file to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. countries = ['AUS', 'BEL', 'CAN', 'CHN', 'FRA', 'GBR', 'GER', 'GRC', 'GRL', 'IRL', 'NLD', 'NOR', 'SJM', 'SWE', 'TTO', 'TZA', 'USA', 'ZMB'] 200.times { country = countries[rand(countries.length)] score = 1 + rand(1000) puts "#{country},#{score}" } ================================================ FILE: examples/akka/akka-camel/src/test/resources/log4j.properties ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # The logging properties used during tests.. # log4j.rootLogger=DEBUG, out # CONSOLE appender not used by default log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n # File appender log4j.appender.out=org.apache.log4j.FileAppender log4j.appender.out.layout=org.apache.log4j.PatternLayout log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n log4j.appender.out.file=target/akka-camel.log log4j.appender.out.append=true ================================================ FILE: examples/akka/akka-camel/src/test/resources/samples/file1.csv ================================================ BEL,911 TT0,934 BEL,496 GRL,228 GRL,515 TT0,664 TT0,578 GBR,488 AUS,686 GRC,943 TT0,980 GRL,458 CHN,735 SWE,939 USA,984 CHN,671 CAN,435 ZMB,693 GBR,77 NLD,279 AUS,232 USA,857 GBR,161 GBR,950 ZMB,560 IRL,682 TZA,949 IRL,100 CHN,610 BEL,274 GER,64 USA,938 FRA,288 IRL,231 USA,292 IRL,343 SJM,55 GRC,31 TT0,69 GER,472 CAN,312 CHN,789 GER,498 USA,339 FRA,830 GBR,101 AUS,276 CAN,242 FRA,321 CHN,772 USA,309 CAN,302 GBR,82 GBR,349 USA,83 CHN,965 IRL,961 GRL,523 SWE,232 GRL,706 AUS,581 IRL,942 NOR,299 CHN,458 GBR,86 ZMB,123 ZMB,101 GBR,654 IRL,229 TT0,172 GER,841 SWE,892 CAN,668 TT0,213 CAN,42 FRA,710 USA,270 GER,59 CAN,680 TZA,313 ZMB,581 SJM,143 FRA,661 NOR,152 SWE,101 TZA,595 GRL,390 AUS,788 GBR,27 NLD,968 TT0,711 SWE,731 CAN,758 BEL,727 TZA,94 SJM,743 SWE,254 BEL,256 IRL,912 NLD,386 CHN,802 CAN,310 BEL,725 CAN,231 GER,377 GRC,379 GBR,677 IRL,178 NOR,629 TZA,505 SWE,580 USA,617 NOR,604 AUS,994 NLD,124 TT0,908 BEL,432 NOR,660 SJM,446 GRL,249 FRA,167 CHN,261 GRL,644 BEL,534 GBR,622 FRA,144 NOR,677 NOR,916 NOR,724 ZMB,807 CAN,282 TT0,227 GRL,178 NLD,612 IRL,108 CHN,664 CAN,530 TT0,344 USA,756 USA,502 IRL,472 GRC,651 GRC,589 USA,648 IRL,326 IRL,493 AUS,941 CAN,55 NOR,415 NOR,97 TZA,69 CHN,124 AUS,881 GER,239 CAN,380 CHN,416 NOR,739 NOR,921 ZMB,917 BEL,504 TZA,280 BEL,394 GRL,233 SWE,105 GRL,823 SWE,774 GBR,410 IRL,970 GER,550 IRL,857 SWE,49 IRL,406 BEL,62 ZMB,373 FRA,524 SWE,919 GRC,462 GBR,71 USA,365 TT0,508 USA,291 GER,227 TT0,869 CHN,511 ZMB,651 TZA,318 USA,854 IRL,387 GRC,249 SJM,52 AUS,784 GER,668 SWE,632 AUS,572 GBR,533 NOR,625 BEL,643 AUS,673 SJM,958 USA,215 ================================================ FILE: examples/akka/akka-camel/src/test/resources/samples/file2.csv ================================================ GRL,473 TT0,491 IRL,981 USA,594 BEL,339 TT0,504 NLD,421 BEL,85 GRC,410 IRL,394 BEL,783 SWE,551 TT0,547 IRL,923 ZMB,50 GRC,971 GRL,343 ZMB,805 GBR,809 ZMB,530 SJM,894 IRL,926 GBR,240 NOR,244 IRL,674 AUS,333 GRL,907 BEL,395 TZA,580 BEL,186 GBR,138 BEL,175 CHN,676 TT0,478 TT0,706 SWE,218 CAN,590 TT0,793 ZMB,756 GRC,595 SWE,303 SJM,573 GER,78 GBR,464 NLD,369 TZA,751 BEL,731 AUS,910 SJM,161 BEL,362 USA,379 AUS,227 SJM,430 NLD,181 TT0,514 SJM,93 GRC,418 GRL,901 GRC,342 TZA,101 GRL,825 FRA,580 IRL,90 GER,250 CAN,278 CAN,489 GER,388 IRL,5 GBR,898 BEL,399 ZMB,233 CAN,872 BEL,618 IRL,719 TZA,385 SJM,260 TZA,729 SJM,394 GER,973 TZA,118 CAN,271 AUS,302 GRC,45 CAN,961 SWE,627 SWE,623 GRC,569 GRC,188 SJM,38 BEL,907 AUS,592 TT0,388 SJM,984 GRL,722 BEL,216 IRL,845 CAN,665 TT0,746 GRC,319 TZA,119 CHN,734 CAN,929 CHN,626 TZA,275 GER,982 CAN,957 CHN,13 SJM,656 FRA,807 TZA,134 FRA,673 CAN,995 NOR,470 TT0,72 NOR,387 CHN,769 NOR,977 GER,295 SWE,829 SWE,283 FRA,60 NOR,635 SWE,278 CHN,269 USA,292 CAN,752 CAN,262 TZA,276 SWE,771 TT0,807 TT0,178 NOR,682 NLD,91 CHN,394 GRC,217 BEL,427 GRL,509 NLD,624 IRL,941 CAN,213 SJM,685 FRA,83 NOR,757 GBR,712 NLD,568 NLD,816 NOR,987 CAN,995 CAN,914 FRA,347 NOR,916 TT0,156 USA,267 CHN,707 NLD,57 GRL,875 NLD,834 GER,673 GER,91 GER,911 ZMB,207 TT0,537 ZMB,984 IRL,168 NLD,435 GBR,658 CHN,365 GER,599 GRL,94 ZMB,440 USA,993 GBR,351 GRL,64 GER,213 IRL,214 USA,623 SJM,242 CAN,644 SWE,399 FRA,441 SJM,943 GRC,585 FRA,398 CHN,220 BEL,780 GER,564 NOR,134 CAN,466 SJM,401 SWE,378 TT0,33 GRL,195 USA,95 ZMB,958 CHN,235 GER,525 GRL,325 AUS,100 GRC,52 IRL,766 ================================================ FILE: examples/akka/akka-camel/src/test/resources/samples/file3.csv ================================================ FRA,672 USA,491 GER,503 SWE,730 NLD,242 ZMB,259 NOR,565 GBR,38 AUS,333 SWE,922 USA,983 IRL,953 GRC,780 IRL,446 GRC,889 USA,625 NLD,407 AUS,1000 AUS,29 TT0,715 SWE,319 TT0,311 GER,359 GER,430 CAN,814 CAN,306 CHN,25 NOR,159 FRA,510 AUS,244 CAN,344 AUS,688 IRL,966 NOR,988 SWE,747 GBR,3 NOR,752 IRL,474 USA,761 AUS,226 GRL,877 SWE,38 NLD,410 BEL,250 SJM,430 NLD,616 NLD,695 FRA,551 ZMB,35 CHN,247 CAN,330 GBR,265 GRL,745 GRL,918 GBR,947 NOR,498 CHN,649 BEL,456 GBR,445 CHN,847 NLD,238 CAN,648 GRL,263 NLD,419 GRC,994 NLD,879 NOR,271 TT0,786 ZMB,159 GRL,509 BEL,614 TZA,610 TT0,340 NLD,420 NLD,166 NOR,70 IRL,126 GRL,843 GRC,694 TT0,892 BEL,351 GRL,604 GER,512 AUS,6 CAN,277 GER,401 SWE,705 CAN,882 IRL,817 NOR,715 GER,227 SJM,582 TZA,963 GER,913 CHN,679 TZA,89 AUS,587 TZA,799 SJM,729 GBR,325 USA,377 FRA,937 GRC,660 GER,79 CHN,302 SWE,224 USA,724 SJM,872 GRL,466 BEL,568 ZMB,850 GRC,199 GER,110 FRA,57 NLD,543 CHN,761 BEL,447 USA,61 AUS,175 ZMB,18 ZMB,260 USA,473 SWE,792 GRC,722 TT0,450 FRA,970 TZA,470 SJM,428 GRC,45 SJM,733 GRL,951 FRA,140 GRL,849 USA,397 ZMB,830 GBR,942 TT0,248 TT0,752 TZA,224 CAN,424 SJM,359 GRC,322 GRC,234 NOR,243 GBR,625 CHN,584 SJM,559 NOR,887 CAN,190 AUS,61 FRA,536 USA,219 CAN,583 GRC,449 NOR,236 CAN,104 GER,996 AUS,252 ZMB,931 NLD,424 AUS,786 SWE,662 GER,267 NOR,209 SJM,919 TT0,49 IRL,29 SWE,84 GRC,525 NOR,417 GRC,716 SWE,576 IRL,86 GBR,525 GER,332 GRL,867 FRA,510 GBR,558 GRL,727 AUS,959 TT0,248 TZA,176 TZA,643 NOR,432 FRA,4 GRC,75 CAN,821 NOR,245 ZMB,839 GER,210 SWE,111 ZMB,879 NOR,304 BEL,889 IRL,127 ZMB,334 TT0,829 GRC,700 NLD,681 SWE,381 ================================================ FILE: examples/akka/akka-camel/src/test/resources/samples/file4.csv ================================================ USA,741 FRA,291 GBR,383 AUS,250 NLD,561 TT0,70 GRC,942 CAN,107 NLD,618 ZMB,130 FRA,927 GRL,890 CHN,510 FRA,966 GBR,98 FRA,420 GBR,573 USA,396 CAN,811 GER,70 GRL,451 BEL,75 TZA,332 GRC,885 FRA,983 TZA,591 GBR,661 AUS,658 BEL,83 ZMB,82 NLD,480 SWE,249 IRL,576 NOR,758 IRL,249 GRC,714 IRL,560 BEL,691 SWE,778 SWE,437 NLD,405 TZA,697 SWE,239 GER,266 CAN,762 SWE,692 IRL,68 GER,244 CHN,98 GER,210 GRL,960 IRL,7 TZA,870 SWE,635 USA,90 NOR,588 SJM,89 GRL,399 NLD,296 SWE,365 USA,922 BEL,774 GER,540 NOR,623 AUS,658 AUS,980 NLD,139 USA,925 TZA,941 GER,226 GER,957 CAN,889 NOR,418 CAN,984 GRC,885 TT0,532 IRL,199 CHN,153 IRL,111 GRC,280 AUS,1000 TZA,911 SJM,974 FRA,470 NOR,749 ZMB,243 GBR,456 ZMB,460 BEL,804 SWE,567 GRC,18 NLD,402 GBR,942 ZMB,206 CHN,977 ZMB,391 CHN,692 ZMB,43 GRL,571 CHN,825 NOR,195 IRL,257 GER,648 AUS,302 NOR,518 FRA,310 CHN,274 IRL,868 NLD,802 GRC,28 CHN,140 GRC,949 USA,261 FRA,287 GER,727 SJM,350 TT0,239 TZA,791 ZMB,78 SWE,542 TZA,6 GER,337 GBR,819 GER,997 USA,89 SJM,104 CAN,869 SWE,637 GBR,764 SJM,797 TZA,71 ZMB,526 AUS,111 GER,997 SWE,574 BEL,751 CAN,905 GRL,91 BEL,511 IRL,338 CHN,140 IRL,572 GRL,297 GER,64 TZA,87 USA,107 GER,841 GER,396 NLD,118 CAN,619 CAN,325 NLD,805 AUS,309 CHN,383 FRA,819 IRL,89 NOR,748 TT0,133 ZMB,265 IRL,443 NOR,677 FRA,226 BEL,327 GRL,808 SJM,442 TZA,425 IRL,678 USA,218 USA,812 TZA,420 TT0,803 FRA,766 GRL,562 BEL,212 CAN,163 IRL,339 FRA,741 GRC,677 FRA,609 GER,754 BEL,349 SJM,186 SJM,126 CAN,136 TZA,729 GRC,636 USA,667 ZMB,650 USA,686 GRC,706 USA,200 IRL,472 AUS,971 SWE,691 CAN,715 CHN,399 SJM,456 GRC,195 CAN,793 USA,832 ================================================ FILE: examples/akka/akka-camel/src/test/resources/samples/file5.csv ================================================ GRC,360 NOR,151 FRA,138 GBR,559 AUS,222 NOR,899 GER,733 TZA,535 GER,214 TZA,154 GRC,464 SWE,426 IRL,158 AUS,417 BEL,848 SWE,488 GBR,756 SWE,677 NLD,461 GRL,744 SWE,399 BEL,745 GBR,338 FRA,635 GRL,607 GRL,21 GER,448 FRA,938 ZMB,197 SWE,391 GRC,385 BEL,856 TZA,678 ZMB,307 NLD,132 SJM,542 BEL,152 ZMB,517 TZA,128 NOR,354 SWE,359 SJM,179 TZA,136 NOR,829 SWE,304 NOR,670 GER,634 NLD,81 NLD,316 GER,952 GER,624 SWE,62 IRL,633 AUS,760 SWE,753 TZA,77 CHN,201 NLD,469 SWE,899 GRL,151 CHN,108 BEL,334 AUS,527 TZA,118 ZMB,349 AUS,868 TT0,718 GER,59 TT0,119 FRA,118 CHN,397 USA,75 IRL,920 NLD,180 USA,535 NLD,321 ZMB,157 BEL,704 SJM,500 NLD,233 FRA,612 NOR,965 IRL,13 CAN,305 GER,610 NOR,444 GRC,865 ZMB,533 NLD,621 TZA,285 USA,528 FRA,896 TZA,734 GRC,53 BEL,790 CAN,399 GER,414 TZA,458 SJM,911 CHN,466 CAN,957 TT0,833 NOR,404 FRA,774 GER,339 IRL,454 TZA,83 BEL,828 AUS,714 CHN,727 GBR,664 SJM,738 GRC,58 GRL,57 USA,155 BEL,452 SWE,299 FRA,502 SJM,476 USA,366 BEL,451 CAN,162 SJM,806 ZMB,401 SWE,485 TT0,377 CHN,425 USA,4 GRC,222 FRA,417 BEL,224 GBR,30 FRA,853 GRL,249 GER,998 NOR,93 GBR,476 IRL,77 BEL,367 GER,988 IRL,244 SJM,802 IRL,98 CHN,60 SJM,445 CAN,243 GER,833 CHN,823 GER,241 NLD,777 NLD,99 CHN,184 GRL,527 GBR,725 GER,190 ZMB,903 AUS,611 NLD,285 SJM,959 TZA,498 GER,224 BEL,243 NOR,236 FRA,839 USA,915 NOR,561 BEL,586 GRC,873 TZA,254 NLD,192 USA,972 CAN,655 FRA,452 CHN,850 TT0,493 TZA,540 CAN,431 GRL,823 GRC,69 GBR,107 GBR,511 TT0,565 CAN,239 TZA,103 TZA,824 AUS,652 GBR,804 NLD,330 TZA,165 TT0,809 GRL,733 ZMB,990 TZA,371 GBR,972 GER,144 GRL,418 SWE,144 SJM,620 TT0,314 GBR,963 ================================================ FILE: examples/akka/akka-camel/src/test/scala/org/apache/servicemix/examples/akka/RouteBuilderTest.scala ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.akka import org.apache.camel.test.junit4.CamelTestSupport import org.apache.camel.scala.dsl.builder.RouteBuilderSupport import akka.actor.ActorSystem import org.junit.Test import akka.camel.CamelExtension /** * Test case for the {{AbstractRouteBuilder}} */ class RouteBuilderTest extends CamelTestSupport with RouteBuilderSupport { val MOCK_END = "mock:end" val MOCK_REPORTS = "mock:reports" val system = ActorSystem("RouteBuilderTest") // let's start the actual application here Application(system, new AbstractRouteBuilder { def start = "file:src/test/resources/samples?noop=true" def end = MOCK_END def reports = MOCK_REPORTS }) @Test def testRoute { // we expect our 5 files to be transferred through the route getMockEndpoint(MOCK_END).expectedMessageCount(5) // we expect at least on statistical report within the time required to finish the route getMockEndpoint(MOCK_REPORTS).expectedMinimumMessageCount(1) assertMockEndpointsSatisfied() } // override this to allow using the CamelTestSupport convenience methods for our akka-camel CamelContext instance override def createCamelContext()= CamelExtension(system).context } ================================================ FILE: examples/akka/akka-camel/src/test/scala/org/apache/servicemix/examples/akka/StatsTest.scala ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.akka import org.junit.Test import org.junit.Assert.fail import akka.actor.ActorSystem import akka.pattern._ import akka.util.Timeout import scala.concurrent.duration._ import scala.concurrent.Await import org.apache.servicemix.examples.akka.Stats.{Input, Report} import org.slf4j.LoggerFactory import java.util.concurrent.TimeoutException /** * Test case for the stats actor */ class StatsTest { val ITEM1 = "ITEM1" val MAX_ATTEMPTS = 10 val LOGGER = LoggerFactory.getLogger(classOf[StatsTest]) val system = ActorSystem("TestSystem") val stats = Stats(system) implicit val timeout = Timeout(100 millis) // needed for `?` below @Test def testCountAverageAndStddev() { stats ! Input(ITEM1, 10) stats ! Input(ITEM1, 20) // we expect ITEM1's count, average and standard deviation to be in the report expectReport("ITEM1,2,15.0000,4.8990") } /* * Wait for report to contain expected output */ def expectReport(expectation: String) : Unit = expectReport(expectation, MAX_ATTEMPTS) def expectReport(expectation: String, remaining: Int) : Unit = getReport.contains(expectation) match { case true => // do nothing here, we received our report case false if (remaining <= 0) => fail("Did not receive reporting containing " + expectation) case false => expectReport(expectation, remaining - 1) } /* * Get the stats engine report - if no report is available yet, this method will return a blank sheet */ def getReport : String = { try { val result = Await.result(stats ? Report(), 100 millis).toString LOGGER.debug("Report() message returned '{}'", result) result } catch { //Report() only sends back a response if it actually has something to tell case e: TimeoutException => LOGGER.debug("Report() message returned no response"); "" } } } ================================================ FILE: examples/akka/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples examples 7.1.0-SNAPSHOT org.apache.servicemix.examples akka-examples pom Apache ServiceMix :: Examples :: Akka akka-camel ================================================ FILE: examples/camel/camel-blueprint/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CAMEL OSGI EXAMPLE ================== Purpose ------- Deploys a Camel EIP route as an OSGi bundle using Blueprint. Configuration makes use of the OSGi Configuration Admin service and Blueprint property placeholders, and the example demonstrates how to deploy the properties file from the ServiceMix console. Explanation ----------- The Camel route is defined in a Blueprint XML file, blueprint.xml, which can be found in the src/main/resources/OSGI-INF/blueprint directory of this example. The route is defined in the element and can be explained as follows: 1. A timer endpoint generates a heartbeat event every 2000ms. 2. A callout is made to a transformer bean that transforms each heartbeat message to the current date and time. 3. A log endpoint sends the transformed message to the Jakarta commons logger. The blueprint.xml file also contains the following elements: - A element that instantiates the transformer bean using standard Blueprint configuration syntax and specifies a prefix value using a property placeholder. - An element which allows you to specify placeholder values using the OSGi Configuration Admin service. In this case, the property is also given the default value of "MyTransform". The route and configuration are deployed in an OSGi bundle. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher (for building) For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running quickly. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-camel-blueprint This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events are routed to the transform method of the MyTransform class and you should see output similar to the following being logged to your console screen: >>>> Blueprint-Example set body: Tue Jan 04 10:23:39 CET 2011 >>>> Blueprint-Example set body: Tue Jan 04 10:23:41 CET 2011 >>>> Blueprint-Example set body: Tue Jan 04 10:23:43 CET 2011 Updating and Redeploying the Properties File from the Console ------------------------------------------------------------- You can update and redeploy the properties file that is used by the properties placeholder in the blueprint.xml from console as follows: 1. Edit the org.apache.servicemix.examples.cfg file, located in the same folder as this README, by changing the value of the "prefix" key to whatever you want (for example, YourTransform). 2. Copy the updated configuration file to your /etc directory. You can do this from the ServiceMix console by typing: copy $YOUR_SERVICEMIX_HOME/examples/camel/camel-blueprint/org.apache.servicemix.examples.cfg $YOUR_SERVICEMIX_HOME/etc On Windows you need to replace / in the path with \\. Note, the text you are typing might intermingle with the output being logged. This is nothing to worry about. 3. Restart the example bundle: (i) First you must know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command in the ServiceMix console: bundle:list At the end of the listing, you should see an entry similar to the following: [158] [Active ] [Started ] [ 60] Apache ServiceMix Example :: Camel OSGi (4.1.0) In this case, the bundle ID is 158. (ii) Enter the following command in the ServiceMix console to restart the bundle: bundle:restart The prefix of the output should change, and the output should look similar to the following: >>>> YourTransform set body: Tue Aug 11 17:14:12 BST 2009 >>>> YourTransform set body: Tue Aug 11 17:14:14 BST 2009 >>>> YourTransform set body: Tue Aug 11 17:14:16 BST 2009 For information on how to stop and/or uninstall the example, see "Stopping and Uninstalling the Example" below. B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-camel-blueprint feature by entering the following command in the ServiceMix console: feature:uninstall examples-camel-blueprint 2. Build the example by opening a command prompt, changing directory to examples/camel/camel-blueprint (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-camel-blueprint It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events are routed to the transform method of the MyTransform class and you should see output similar to the following being logged to your console screen: >>>> Blueprint-Example set body: Tue Jan 04 10:23:39 CET 2011 >>>> Blueprint-Example set body: Tue Jan 04 10:23:41 CET 2011 >>>> Blueprint-Example set body: Tue Jan 04 10:23:43 CET 2011 Now, if you have not already done so, try updating and redeploying, from the console, the properties file that is used by the properties placeholder in the blueprint.xml file. For details on how to do this, see the "Updating and Redeploying the Properties File from the Console" section above. Stopping and Uninstalling the Example ------------------------------------- To stop the example, enter the following command in the ServiceMix console: bundle:stop For information on how to find the bundle_id assigned to the example, see step 3 in the "Updating and Redeploying the Properties File from the Console" section above. To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-camel-blueprint or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/camel/camel-blueprint/org.apache.servicemix.examples.cfg ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. # # prefix=YourTransform ================================================ FILE: examples/camel/camel-blueprint/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples camel-examples 7.1.0-SNAPSHOT camel-blueprint bundle Apache ServiceMix :: Examples :: Camel Blueprint Camel Example using blueprint for configuration org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} *,org.apache.camel.osgi org.apache.servicemix.examples.camel ================================================ FILE: examples/camel/camel-blueprint/src/main/java/org/apache/servicemix/examples/camel/MyTransform.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import java.util.Date; import java.util.logging.Logger; public class MyTransform { private static final transient Logger logger = Logger.getLogger(MyTransform.class.getName()); private boolean verbose = true; private String prefix = "MyTransform"; public Object transform(Object body) { String answer = prefix + " set body: " + new Date(); if (verbose) { System.out.println(">>>> " + answer); } logger.info(">>>> " + answer); return answer; } public boolean isVerbose() { return verbose; } public void setVerbose(boolean verbose) { this.verbose = verbose; } public String getPrefix() { return prefix; } public void setPrefix(String prefix) { this.prefix = prefix; } } ================================================ FILE: examples/camel/camel-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/camel/camel-cxf-rest/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CAMEL CXF REST EXAMPLE ====================== Purpose ------- Create a RESTful JAX-RS web service using CXF and handle it using the Camel-cxfrs SimpleConsumer Explanation ----------- The web service functions are defined in the PersonService.java file, which is located in the camel-cxf-rest-route/src/main/java/org/apache/ servicemix/examples/camel/rest directory of this example. It contains annotations indicating what URIs and HTTP methods to use when accessing the resource. For information on how to write RESTful web services, please refer to the Apache CXF documentation. The blueprint.xml file located in the camel-cxf-rest-route/src/main/ resources/OSGI-INF/blueprint folder: 1. Configures the rsServer: 2. Initializes the Camel route PersinServiceRoute wich routes each REST method call to a seperate endpoint: direct-vm:${header.operationName} The blueprint.xml file located in the camel-cxf-rest-service/src/main/ resources/OSGI-INF/blueprint folder: 1. Initializes the ServiceHandler bean implemented in the ServiceHandler.java file, located in the camel-cxf-rest-service/ src/main/java/org/apache/servicemix/examples/camel/rest 2. Defines severeal routes to consume the Rest method endpoints using the ServiceHandler bean. The Client.java file located in the camel-cxf-rest-client/src/main/ java/org/apache/servicemix/examples/camel/rest/client folder provades a small test client that calls each provided REST method and displays the result. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-camel-cxf-rest This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Running the Client ------------------ To run the java code client: 1. Change to the /examples/camel/camel-cxf-rest/camel-cxf-rest-client directory. 2. Run the following command: mvn compile exec:java B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-camel-cxf-rest feature by entering the following command in the ServiceMix console: feature:uninstall examples-camel-cxf-rest 2. Build the example by opening a command prompt, changing directory to examples/camel/camel-cxf-rest (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-camel-cxf-rest It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. See "Running the Client" above for information on how to make invocations on the web service. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle IDs that ServiceMix has assigned to the example bundels. To get the bundle IDs, enter the following command in the ServiceMix console (Note, the text you are typing will intermingle with the output being logged. This is nothing to worry about.): bundle:list At the end of the listing, you should see an entry similar to the following: [ 173] [Active ] [Created ] [ ] [ 80] Apache ServiceMix :: Examples :: Camel CXF REST :: Service (5.0.0.SNAPSHOT) [ 175] [Active ] [Created ] [ ] [ 80] Apache ServiceMix :: Examples :: Camel CXF REST :: Route (5.0.0.SNAPSHOT) In this case, the bundle IDs are 173 and 175. To stop a bundle, enter the following command in the ServiceMix console: bundle:stop For example: bundle:stop 173 To uninstall the example, enter one of the following commands at the ServiceMix console: feature:uninstall examples-camel-cxf-rest or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/camel/camel-cxf-rest/camel-cxf-rest-client/pom.xml ================================================ camel-cxf-rest org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 camel-cxf-rest-client Apache ServiceMix :: Examples :: Camel CXF REST :: Client jar org.apache.servicemix.examples camel-cxf-rest-service ${project.version} javax.xml.bind jaxb-api 2.2.7 org.codehaus.mojo exec-maven-plugin org.apache.servicemix.examples.camel.rest.client.Client false ================================================ FILE: examples/camel/camel-cxf-rest/camel-cxf-rest-client/src/main/java/org/apache/servicemix/examples/camel/rest/client/Client.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.rest.client; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import org.apache.cxf.helpers.IOUtils; import org.apache.servicemix.examples.camel.rest.model.Person; public class Client { private static final String PERSON_SERVICE_URL = "http://localhost:8989/rest/personservice/"; public static void main(String[] args) { Client client = new Client(); try { client.postPerson(new Person(1, "John Smith", 21)); client.getPerson(1); client.deletePerson(1); } catch (Exception e) { e.printStackTrace(); } } public void postPerson(Person person) throws Exception{ System.out.println("\n### POST PERSON -> "); HttpURLConnection connection = connect(PERSON_SERVICE_URL + "person/post/"); connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "application/xml"); JAXBContext jaxbContext = JAXBContext.newInstance(Person.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); // pretty xml output jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(person, System.out); jaxbMarshaller.marshal(person, connection.getOutputStream()); System.out.println("\n### POST PERSON RESPONSE"); System.out.println("Status: " + connection.getResponseCode() + " " + connection.getResponseMessage()); System.out.println("Location: " + connection.getHeaderField("Location")); } public void getPerson(int id) throws Exception{ String url = PERSON_SERVICE_URL + "person/get/" + id; System.out.println("\n### GET PERSON WITH ID " + id + " FROM URL " + url); HttpURLConnection connection = connect(url); connection.setDoInput(true); InputStream stream = connection.getResponseCode() / 100 == 2 ? connection.getInputStream() : connection.getErrorStream(); System.out.println("Status: " + connection.getResponseCode() + " " + connection.getResponseMessage()); System.out.println(IOUtils.toString(stream)); } public void deletePerson(int id) throws Exception{ String url = PERSON_SERVICE_URL+"person/delete/"+id; System.out.println("\n### DELETE PERSON WITH ID "+id+" FROM URL "+url); HttpURLConnection connection = (HttpURLConnection) connect(url); connection.setRequestMethod("DELETE"); connection.setDoInput(true); System.out.println("Status: " + connection.getResponseCode() + " " + connection.getResponseMessage()); if (connection.getResponseCode() / 100 != 2) { System.out.println(IOUtils.toString(connection.getErrorStream())); } } private HttpURLConnection connect(String url) throws Exception{ HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); return connection; } } ================================================ FILE: examples/camel/camel-cxf-rest/camel-cxf-rest-route/pom.xml ================================================ camel-cxf-rest org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 camel-cxf-rest-route Apache ServiceMix :: Examples :: Camel CXF REST :: Route bundle org.apache.camel camel-cxf org.apache.servicemix.examples camel-cxf-rest-service ${project.version} org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} *;resolution:=optional org.apache.servicemix.examples.camel.rest ================================================ FILE: examples/camel/camel-cxf-rest/camel-cxf-rest-route/src/main/java/org/apache/servicemix/examples/camel/rest/PersonService.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.rest; import org.apache.servicemix.examples.camel.rest.model.Person; import javax.ws.rs.*; import javax.ws.rs.core.Response; // This could be an interface if CAMEL-6014 is fixed. @Path("/personservice/") public class PersonService { @GET @Path("/person/get/{id}/") @Produces("application/xml") public Person getPerson(@PathParam("id") String id) { return null; } @POST @Path("/person/post") public Response putPerson(Person person) { return null; } @DELETE @Path("/person/delete/{id}") public void deletePerson(@PathParam("id") String id) { } } ================================================ FILE: examples/camel/camel-cxf-rest/camel-cxf-rest-route/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ direct-vm:${header.operationName} ================================================ FILE: examples/camel/camel-cxf-rest/camel-cxf-rest-service/pom.xml ================================================ camel-cxf-rest org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 camel-cxf-rest-service Apache ServiceMix :: Examples :: Camel CXF REST :: Service bundle org.apache.camel camel-cxf org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} *;resolution:=optional org.apache.servicemix.examples.camel.rest org.apache.servicemix.examples.camel.rest.model ================================================ FILE: examples/camel/camel-cxf-rest/camel-cxf-rest-service/src/main/java/org/apache/servicemix/examples/camel/rest/ServiceHandler.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.rest; import java.net.URI; import java.util.HashMap; import java.util.Map; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; import javax.ws.rs.core.Response.Status; import org.apache.servicemix.examples.camel.rest.model.Person; public class ServiceHandler { private Map persons = new HashMap(); public void init(){ add(new Person(0, "Test Person", 100)); } private Response add(Person person){ persons.put(person.getId(), person); return Response.created(URI.create("/personservice/person/get/" + person.getId())).build(); } private Person get(int id){ Person person = persons.get(id); if (person == null) { ResponseBuilder builder = Response.status(Status.NOT_FOUND); builder.entity("Person with ID " + id + " not found."); throw new WebApplicationException(builder.build()); } return person; } private void delete(int id){ if (persons.remove(id) == null) { ResponseBuilder builder = Response.status(Status.NOT_FOUND); builder.entity("Person with ID " + id + " not found."); throw new WebApplicationException(builder.build()); } } public Person getPerson(String id){ return get(Integer.parseInt(id)); } public Response putPerson(Person person){ return add(person); } public void deletePerson(int id){ delete(id); } } ================================================ FILE: examples/camel/camel-cxf-rest/camel-cxf-rest-service/src/main/java/org/apache/servicemix/examples/camel/rest/model/Person.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.rest.model; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Person { private String name; private int age; private int id; public Person(int id, String name, int age) { this.name = name; this.age = age; this.id = id; } public Person() { } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Person person = (Person) o; if (id != person.id) return false; return true; } } ================================================ FILE: examples/camel/camel-cxf-rest/camel-cxf-rest-service/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ${header.id} ${header.id} ================================================ FILE: examples/camel/camel-cxf-rest/pom.xml ================================================ camel-examples org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 camel-cxf-rest Apache ServiceMix :: Examples :: Camel CXF REST pom camel-cxf-rest-route camel-cxf-rest-service camel-cxf-rest-client ================================================ FILE: examples/camel/camel-cxf-soap/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CAMEL CXF SOAP EXAMPLE ====================== Purpose ------- Create a SOAP JAX-WS web service using CXF and handle it using the Camel-Cxf component consumer. Explanation ----------- The web service functions are defined in the PersonService.java file, which is located in the camel-cxf-soap-route/src/main/java/org/apache/ servicemix/examples/camel/soap directory of this example. It contains annotations indicating what URI, parameters and actions to use when accessing the resource. For information on how to write SOAP web services, please refer to the Apache CXF documentation. The blueprint.xml file located in the camel-cxf-soap-route/src/main/ resources/OSGI-INF/blueprint folder: 1. Configures the cxf endpoint: 2. Initializes the Camel route PersonServiceRoute wich routes each SOAP method call to a seperate endpoint: direct-vm:${header.operationName} The blueprint.xml file located in the camel-cxf-soap-service/src/main/ resources/OSGI-INF/blueprint folder: 1. Initializes the ServiceHandler bean implemented in the ServiceHandler.java file, located in the camel-cxf-soap-service/ src/main/java/org/apache/servicemix/examples/camel/soap 2. Defines several routes to consume the SOAP method endpoints using the ServiceHandler bean. The Client.java file located in the camel-cxf-soap-client/src/main/ java/org/apache/servicemix/examples/camel/soap/client folder provides a small test client that calls each provided SOAP method and displays the result. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-camel-cxf-soap This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Running the Client ------------------ To run the java code client: 1. Change to the /examples/camel/camel-cxf-soap/camel-cxf-soap-client directory. 2. Run the following command: mvn compile exec:java B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-camel-cxf-soap feature by entering the following command in the ServiceMix console: feature:uninstall examples-camel-cxf-soap 2. Build the example by opening a command prompt, changing directory to examples/camel/camel-cxf-soap (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-camel-cxf-soap It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. See "Running the Client" above for information on how to make invocations on the web service. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle IDs that ServiceMix has assigned to the example bundels. To get the bundle IDs, enter the following command in the ServiceMix console (Note, the text you are typing will intermingle with the output being logged. This is nothing to worry about.): bundle:list At the end of the listing, you should see an entry similar to the following: [ 173] [Active ] [Created ] [ ] [ 80] Apache ServiceMix :: Examples :: Camel CXF SOAP :: Route (5.0.1.SNAPSHOT) [ 175] [Active ] [Created ] [ ] [ 80] Apache ServiceMix :: Examples :: Camel CXF SOAP :: Service (5.0.1.SNAPSHOT) In this case, the bundle IDs are 173 and 175. To stop a bundle, enter the following command in the ServiceMix console: bundle:stop For example: bundle:stop 173 To uninstall the example, enter one of the following commands at the ServiceMix console: feature:uninstall examples-camel-cxf-soap or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/camel/camel-cxf-soap/camel-cxf-soap-client/pom.xml ================================================ org.apache.servicemix.examples camel-cxf-soap 7.1.0-SNAPSHOT 4.0.0 camel-cxf-soap-client Apache ServiceMix :: Examples :: Camel CXF SOAP :: Client jar org.apache.servicemix.examples camel-cxf-soap-service ${project.version} com.sun.xml.bind jaxb-impl org.apache.servicemix.examples camel-cxf-soap-route ${project.version} org.codehaus.mojo exec-maven-plugin org.apache.servicemix.examples.camel.soap.client.Client true ================================================ FILE: examples/camel/camel-cxf-soap/camel-cxf-soap-client/src/main/java/org/apache/servicemix/examples/camel/soap/client/Client.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.soap.client; import org.apache.servicemix.examples.camel.soap.PersonService; import org.apache.servicemix.examples.camel.soap.model.Person; import javax.xml.ws.Service; import javax.xml.ws.soap.SOAPBinding; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.namespace.QName; import java.net.MalformedURLException; import java.net.URL; public class Client { public static void main(String[] args) throws MalformedURLException { Client client = new Client(); try { client.postPerson(new Person(1,"John Smith",21)); client.getPerson(1); client.deletePerson(1); } catch (Exception e) { e.printStackTrace(); } System.out.println(); } private PersonService personService; private static final QName SERVICE_NAME = new QName("http://soap.camel.examples.servicemix.apache.org/", "PersonService"); private static final String wsdlLocation = "http://localhost:8989/soap/?wsdl"; public Client() throws MalformedURLException { URL wsdlURL = new URL(wsdlLocation); Service service = Service.create(wsdlURL,SERVICE_NAME); personService = service.getPort(PersonService.class); } public void postPerson(Person person) throws Exception{ System.out.println("\n### PUT PERSON -> "); printPerson(person); Person result = personService.putPerson(person); System.out.println("\n### PUT PERSON RESPONSE "); printPerson(result); } public void getPerson(int id) throws Exception{ System.out.println("\n### GET PERSON WITH ID "+id); Person result = personService.getPerson(id); System.out.println("\n### GET PERSON RESPONSE"); printPerson(result); } public void deletePerson(int id) throws Exception{ System.out.println("\n### DELETE PERSON WITH ID "+id); Person result = personService.deletePerson(id); System.out.println("\n### DELETE PERSON RESPONSE"); printPerson(result); } private void printPerson(Person person){ try { JAXBContext jaxbContext = JAXBContext.newInstance(Person.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); // pretty xml output jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(person, System.out); } catch (JAXBException e) { System.err.print(e); } } } ================================================ FILE: examples/camel/camel-cxf-soap/camel-cxf-soap-route/pom.xml ================================================ org.apache.servicemix.examples camel-cxf-soap 7.1.0-SNAPSHOT 4.0.0 camel-cxf-soap-route Apache ServiceMix :: Examples :: Camel CXF SOAP :: Route bundle org.apache.servicemix.examples camel-cxf-soap-service ${project.version} org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} *;resolution:=optional org.apache.servicemix.examples.camel.soap ================================================ FILE: examples/camel/camel-cxf-soap/camel-cxf-soap-route/src/main/java/org/apache/servicemix/examples/camel/soap/PersonService.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.soap; import org.apache.servicemix.examples.camel.soap.model.Person; import org.apache.servicemix.examples.camel.soap.model.PersonException; import javax.jws.WebParam; import javax.jws.WebService; @WebService(serviceName = "PersonService") public interface PersonService { Person getPerson(@WebParam(name="id")int id) throws PersonException; Person putPerson(Person person); Person deletePerson(@WebParam(name="id")int id) throws PersonException; } ================================================ FILE: examples/camel/camel-cxf-soap/camel-cxf-soap-route/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ direct-vm:${header.operationName} ================================================ FILE: examples/camel/camel-cxf-soap/camel-cxf-soap-service/pom.xml ================================================ org.apache.servicemix.examples camel-cxf-soap 7.1.0-SNAPSHOT 4.0.0 camel-cxf-soap-service Apache ServiceMix :: Examples :: Camel CXF SOAP :: Service bundle org.apache.camel camel-core org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} *;resolution:=optional org.apache.servicemix.examples.camel.soap org.apache.servicemix.examples.camel.soap.model ================================================ FILE: examples/camel/camel-cxf-soap/camel-cxf-soap-service/src/main/java/org/apache/servicemix/examples/camel/soap/ServiceHandler.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.soap; import org.apache.camel.Body; import org.apache.camel.Exchange; import org.apache.servicemix.examples.camel.soap.model.Person; import org.apache.servicemix.examples.camel.soap.model.PersonException; import java.util.HashMap; import java.util.Map; public class ServiceHandler { public static final String ERR_PERSON_X_NOT_FOUND = "Person %s not found"; Map persons = new HashMap(); public void init(){ Person person = new Person(0,"test",100); persons.put(person.getId(), person); } public void getPerson(@Body String id,Exchange exchange){ Person result = persons.get(Integer.parseInt(id)); checkResult(id, exchange, result); } public Person putPerson(Person person){ persons.put(person.getId(), person); return person; } public void deletePerson(@Body String id,Exchange exchange){ Person result = persons.remove(Integer.parseInt(id)); checkResult(id, exchange, result); } private void checkResult(String id, Exchange exchange, Person result) { if (result == null){ exchange.getOut().setFault(true); exchange.getOut().setBody(new PersonException(String.format(ERR_PERSON_X_NOT_FOUND, id), id)); }else{ exchange.getOut().setBody(result); } } } ================================================ FILE: examples/camel/camel-cxf-soap/camel-cxf-soap-service/src/main/java/org/apache/servicemix/examples/camel/soap/model/Person.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.soap.model; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Person { private String name; private int age; private int id; public Person(int id, String name, int age) { this.name = name; this.age = age; this.id = id; } public Person() { } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Person person = (Person) o; if (id != person.id) return false; return true; } } ================================================ FILE: examples/camel/camel-cxf-soap/camel-cxf-soap-service/src/main/java/org/apache/servicemix/examples/camel/soap/model/PersonException.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.soap.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.ws.WebFault; @WebFault(name="PersonException") @XmlAccessorType(XmlAccessType.FIELD) public class PersonException extends RuntimeException { private final String personid; public PersonException(String message, String personId){ super(message); this.personid = personId; } public String getPersonid(){ return this.personid; } } ================================================ FILE: examples/camel/camel-cxf-soap/camel-cxf-soap-service/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/camel/camel-cxf-soap/pom.xml ================================================ org.apache.servicemix.examples camel-examples 7.1.0-SNAPSHOT 4.0.0 camel-cxf-soap Apache ServiceMix :: Examples :: Camel CXF SOAP pom camel-cxf-soap-route camel-cxf-soap-service camel-cxf-soap-client ================================================ FILE: examples/camel/camel-drools/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CAMEL DROOLS EXAMPLE ==================== Purpose ------- Deploys a Camel route which allows a Drools rules file to evaluate messages and deliver each of them to a appropriate destination. Explanation ----------- The Camel route is defined in a Spring XML file, camel-context.xml, which can be found in the src/main/resources/META-INF/spring directory of this example. The route is defined in the element and can be explained as follows: 1. A timer endpoint generates a person every second 2. A the Person object is send to a Drools grid-node which is connected to the Drools knowledge base 3. After the object is evaluated, It's Vip-property is inspected 4. Based on this value, one of the two log-messages is chosen to display the result. The camel-context.xml file also contains the following elements: - A element as a reference to the Drools ruleset. - A element for the configuration of the knowledge base and the link to the DRL-rules file - A element which creates a session for the Drools evaluation - A personHelper bean to generate random Person objects - the Drools camel component bean for our camel route. - An illustrative definition of a route which shows an example of passing (inserting) the Body of the message as a POJO to Drools for execution. - An illustrative definition of a route which shows an example of creating a Drools Command wrapping the Body of the message with the help of the custom DroolsCommandHelperBean (included in this project), and passing this Drools Command to the ruleset for execution. The route and configuration are deployed in an OSGi bundle. Embedded rules --------------- rule "humans need water" Every person gets water rule "boys go for Cola Zero" Males older than 8 get Cola Zero rule "girls go for Cola Light" Girls older than 8 get Cola Light rule "can you drink?" A person older than 21 can drink alcohol rule "woman go for wine" Woman who are allowed to drink, take wine rule "men go for beer" Men who are allowed to drink, take beer rule "Vip in the house!" Rich people are VIPs rule "Vip woman drink bubbles" Female VIPs drink champagne rule "Vip men drink scotch" Male VIPs drink scotch Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher (for building) For more information, see the README in the top-level examples directory. 2. This example requires some additional configuration to allow the JVM to use more PermGen memory: export JAVA_MAX_PERM_MEM=128m (on UNIX) set JAVA_MAX_PERM_MEM=128m (on Windows) 3. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running quickly. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-camel-drools This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events trigger the generation of a Person object and his evaluation. An object can either end up in the VIP log message or in a regular log message >>>> | ServeDrink | ... | Serve this old man a pint of beer >>>> | ServeDrink VIP | ... | This old rich woman is a VIP! Give a bottle of champagne from the house B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-camel-drools feature by entering the following command in the ServiceMix console: feature:uninstall examples-camel-drools 2. Build the example by opening a command prompt, changing directory to examples/camel/camel-drools (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-camel-drools It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events trigger the generation of a Person object and his evaluation. An object can either end up in the VIP log message or in a regular log message >>>> | ServeDrink | ... | Serve this old man a pint of beer >>>> | ServeDrink VIP | ... | This old rich woman is a VIP! Give a bottle of champagne from the house Stopping and Uninstalling the Example ------------------------------------- To stop the example, enter the following command in the ServiceMix console: bundle:stop For information on how to find the bundle_id assigned to the example, see step 3 in the "Updating and Redeploying the Properties File from the Console" section above. To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-camel-drools or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/camel/camel-drools/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples camel-examples 7.1.0-SNAPSHOT camel-drools bundle Apache ServiceMix :: Examples :: Camel Drools Camel Example using Drools org.apache.felix maven-bundle-plugin true * org.apache.servicemix.examples.camel org.apache.camel camel-core org.drools drools-core ${drools.version} org.drools drools-spring ${drools.version} spring-core org.springframework spring-beans org.springframework spring-context org.springframework org.drools drools-camel ${drools.version} spring-core org.springframework spring-aop org.springframework cxf-rt-frontend-jaxws org.apache.cxf camel-cxf org.apache.camel org.apache.camel camel-test ================================================ FILE: examples/camel/camel-drools/src/main/java/org/apache/servicemix/examples/camel/Drinks.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; public enum Drinks { WATER("glass of water"), COLA_ZERO("bottle of Cola Zero"), COLA_LIGHT("bottle of Cola Light with a straw"), WINE("glass of wine"), BEER("pint of beer"), SCOTCH("good old scotch"), CHAMPAGNE("bottle of champagne"); private String description; private Drinks(String description) { this.description = description; } public String getDescription() { return description; } } ================================================ FILE: examples/camel/camel-drools/src/main/java/org/apache/servicemix/examples/camel/DroolsCommandHelper.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.drools.command.impl.GenericCommand; import org.drools.command.runtime.BatchExecutionCommandImpl; import org.drools.command.runtime.rule.FireAllRulesCommand; import org.drools.command.runtime.rule.InsertObjectCommand; import java.util.List; /** * Class to help create wrapper Drools Expert Command for use with * org.drools/drools-camel component. */ public class DroolsCommandHelper { public void insertAndFireAll(Exchange exchange) { final Message in = exchange.getIn(); final Object body = in.getBody(); // TODO: add type checking to handle arrays of objects BatchExecutionCommandImpl command = new BatchExecutionCommandImpl(); final List> commands = command.getCommands(); commands.add(new InsertObjectCommand(body, "obj1")); commands.add(new FireAllRulesCommand()); in.setBody(command); } // TODO: add other command handler methods (e.g. getGlobalObject, etc.) } ================================================ FILE: examples/camel/camel-drools/src/main/java/org/apache/servicemix/examples/camel/Person.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import org.drools.definition.type.PropertyReactive; @PropertyReactive public class Person { private int age; private boolean canDrink = false; private Sex sex; private int income; private boolean isVip = false; private Drinks drink; public int getAge() { return age; } public void setAge(int age) { this.age = age; } public int getIncome() { return income; } public void setIncome(int income) { this.income = income; } public Sex getSex() { return sex; } public void setSex(Sex sex) { this.sex = sex; } public boolean isCanDrink() { return canDrink; } public void setCanDrink(boolean canDrink) { this.canDrink = canDrink; } public boolean isVip() { return isVip; } public void setVip(boolean vip) { isVip = vip; } public Drinks getDrink() { return drink; } public void setDrink(Drinks drink) { this.drink = drink; } public boolean isRich(){ return getIncome() >= 80000; } public String getName() { StringBuilder name = new StringBuilder(); // Age if (getAge()>=21){ name.append("old"); }else{ name.append("young"); } //Income if (isRich()){ name.append(" rich"); } //Sex if (getSex() == Sex.MALE){ name.append(" man"); }else{ name.append(" woman"); } return name.toString(); } @Override public String toString() { return "Person{" + "age=" + age + ", canDrink=" + canDrink + ", sex=" + sex + ", income=" + getIncome() + ", isRich=" + isRich() + ", isVip=" + isVip + ", drink=" + drink + '}'; } } ================================================ FILE: examples/camel/camel-drools/src/main/java/org/apache/servicemix/examples/camel/PersonHelper.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import java.util.Random; public class PersonHelper { private final Random random = new Random(); public Person createTestPerson() { Person person = new Person(); // Age person.setAge(random.nextInt(70)); // Sex if (random.nextBoolean()) { person.setSex(Sex.MALE); } else { person.setSex(Sex.FEMALE); } // Income person.setIncome(random.nextInt(100000)); return person; } } ================================================ FILE: examples/camel/camel-drools/src/main/java/org/apache/servicemix/examples/camel/Sex.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; public enum Sex { MALE, FEMALE } ================================================ FILE: examples/camel/camel-drools/src/main/resources/META-INF/spring/camel-context.xml ================================================ Example route that will regularly create a random Person and choose an appropriate drink based on the drools rules file. After processing, it divides the people into VIPs and regular clients based on the drools result. valid 'action' values are: 'execute' that takes a 'Command' object (default) 'insertBody' that inserts the Exchange.in.body, and executes rules 'insertMessage' that inserts the Exchange.in (type org.apache.camel.Message), and executes rules 'insertExchange' that inserts the Exchange (type org.apache.camel.Exchange), and executes rules ${body.isVip} This route shows an example of passing (inserting) the Body of the message as a POJO to Drools for execution valid 'action' values are: 'execute' that takes a 'Command' object (default) 'insertBody' that inserts the Exchange.in.body, and executes rules 'insertMessage' that inserts the Exchange.in (type org.apache.camel.Message), and executes rules 'insertExchange' that inserts the Exchange (type org.apache.camel.Exchange), and executes rules This route shows an example of creating a Drools Command wrapping the Body of the message with the help of the custom DroolsCommandHelperBean (included in this project), and passing this Drools Command to the ruleset for execution. valid 'action' values are: 'execute' that takes a 'Command' object (default) 'insertBody' that inserts the Exchange.in.body, and executes rules 'insertMessage' that inserts the Exchange.in (type org.apache.camel.Message), and executes rules 'insertExchange' that inserts the Exchange (type org.apache.camel.Exchange), and executes rules ================================================ FILE: examples/camel/camel-drools/src/main/resources/log4j.properties ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # The logging properties used # log4j.rootLogger=INFO, out # uncomment the following line to turn on Camel debugging #log4j.logger.org.apache.camel=DEBUG log4j.logger.org.springframework=WARN # CONSOLE appender not used by default log4j.appender.out=org.apache.log4j.ConsoleAppender log4j.appender.out.layout=org.apache.log4j.PatternLayout log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n #log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer ================================================ FILE: examples/camel/camel-drools/src/main/resources/testSpring.drl ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import org.apache.servicemix.examples.camel.Person; import org.apache.servicemix.examples.camel.Sex; import org.apache.servicemix.examples.camel.Drinks; rule "humans need water" salience 2 when p : Person() then modify(p) {setDrink(Drinks.WATER)}; end rule "boys go for Cola Zero" salience 1 when p : Person(age >= 8 && sex == Sex.MALE) then modify(p) {setDrink(Drinks.COLA_ZERO)}; end rule "girls go for Cola Light" salience 1 when p : Person(age >= 8 && sex == Sex.FEMALE) then modify(p) {setDrink(Drinks.COLA_LIGHT)}; end rule "can you drink?" when p : Person( age >= 21 && !canDrink) then modify(p) {setCanDrink(true)}; end rule "woman go for wine" when p : Person(sex == Sex.FEMALE && canDrink ) then modify(p) {setDrink(Drinks.WINE)}; end rule "men go for beer" when p : Person(sex == Sex.MALE && canDrink ) then modify(p) {setDrink(Drinks.BEER)}; end rule "Vip in the house!" salience -1 when p : Person( rich && !Vip) then modify(p) {setVip(true)}; end rule "Vip woman drink bubbles" when p : Person(Vip && sex == Sex.FEMALE && canDrink) then modify(p) {setDrink(Drinks.CHAMPAGNE)}; end rule "Vip men drink Scotch" when p : Person(Vip && sex == Sex.MALE && canDrink) then modify(p) {setDrink(Drinks.SCOTCH)}; end ================================================ FILE: examples/camel/camel-drools-blueprint/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CAMEL DROOLS BLUEPRINT EXAMPLE ============================== Purpose ------- Deploys a Camel route in blueprint which allows a Drools rules file to evaluate messages and deliver each of them to a appropriate destination. Explanation ----------- The Camel route is defined in a Blueprint XML file, blueprint.xml, which can be found in the src/main/resources/OSGI-INF/blueprint directory of this example. The route is defined in the element and can be explained as follows: 1. A timer endpoint generates a person every second 2. A the Person object is send to a Drools grid-node which is connected to the Drools knowledge base 3. After the object is evaluated, It's Vip-property is inspected 4. Based on this value, one of the two log-messages is chosen to display the result. The camel-context.xml file also contains the following elements: - A call to the bean factory method createGridNode which replaces the implementation of the drools namespace handler for spring. This factory acts as a reference to the Drools ruleset. - A call to the bean factory method createKnowledgeBase which replaces the implementation of the drools namespace handler for spring. This factory creates an element for the configuration of the knowledge base and the link to the DRL-rules file. - A call to the bean factory method createKnowledgeSession which replaces the implementation of the drools namespace handler for spring. This factory creates en element which constructs a session for the Drools evaluation. - A personHelper bean to generate random Person objects - the Drools camel component bean for our camel route. The route and configuration are deployed in an OSGi bundle. Embedded rules --------------- rule "humans need water" Every person gets water rule "boys go for Cola Zero" Males older than 8 get Cola Zero rule "girls go for Cola Light" Girls older than 8 get Cola Light rule "can you drink?" A person older than 21 can drink alcohol rule "woman go for wine" Woman who are allowed to drink, take wine rule "men go for beer" Men who are allowed to drink, take beer rule "Vip in the house!" Rich people are VIPs rule "Vip woman drink bubbles" Female VIPs drink champagne rule "Vip men drink scotch" Male VIPs drink scotch Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher (for building) For more information, see the README in the top-level examples directory. 2. This example requires some additional configuration to allow the JVM to use more PermGen memory: export JAVA_MAX_PERM_MEM=128m (on UNIX) set JAVA_MAX_PERM_MEM=128m (on Windows) 3. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running quickly. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-camel-drools-blueprint This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events trigger the generation of a Person object and his evaluation. An object can either end up in the VIP log message or in a regular log message >>>> | ServeDrink | ... | Serve this old man a pint of beer >>>> | ServeDrink VIP | ... | This old rich woman is a VIP! Give a bottle of champagne from the house B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-camel-drools-blueprint feature by entering the following command in the ServiceMix console: feature:uninstall examples-camel-drools-blueprint 2. Build the example by opening a command prompt, changing directory to examples/camel/camel-drools-blueprint (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-camel-drools-blueprint It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events trigger the generation of a Person object and his evaluation. An object can either end up in the VIP log message or in a regular log message >>>> | ServeDrink | ... | Serve this old man a pint of beer >>>> | ServeDrink VIP | ... | This old rich woman is a VIP! Give a bottle of champagne from the house Stopping and Uninstalling the Example ------------------------------------- To stop the example, enter the following command in the ServiceMix console: bundle:stop For information on how to find the bundle_id assigned to the example, see step 3 in the "Updating and Redeploying the Properties File from the Console" section above. To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-camel-drools-blueprint or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/camel/camel-drools-blueprint/pom.xml ================================================ camel-examples org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 camel-drools-blueprint bundle Apache ServiceMix :: Examples :: Camel Drools Blueprint Camel Example using Drools and Blueprint org.apache.felix maven-bundle-plugin true * org.apache.servicemix.examples.camel org.apache.camel camel-core org.drools drools-core ${drools.version} org.drools drools-spring ${drools.version} spring-core org.springframework spring-beans org.springframework spring-context org.springframework org.drools drools-camel ${drools.version} spring-core org.springframework spring-aop org.springframework cxf-rt-frontend-jaxws org.apache.cxf camel-cxf org.apache.camel org.apache.camel camel-test ================================================ FILE: examples/camel/camel-drools-blueprint/src/main/java/org/apache/servicemix/examples/camel/Drinks.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; public enum Drinks { WATER("glass of water"), COLA_ZERO("bottle of Cola Zero"), COLA_LIGHT("bottle of Cola Light with a straw"), WINE("glass of wine"), BEER("pint of beer"), SCOTCH("good old scotch"), CHAMPAGNE("bottle of champagne"); private String description; private Drinks(String description) { this.description = description; } public String getDescription() { return description; } } ================================================ FILE: examples/camel/camel-drools-blueprint/src/main/java/org/apache/servicemix/examples/camel/DroolsBlueprintBean.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import org.drools.*; import org.drools.builder.KnowledgeBuilder; import org.drools.builder.KnowledgeBuilderErrors; import org.drools.builder.KnowledgeBuilderFactory; import org.drools.builder.KnowledgeBuilderFactoryService; import org.drools.compiler.PackageBuilderConfiguration; import org.drools.grid.Grid; import org.drools.grid.GridNode; import org.drools.grid.impl.GridImpl; import org.drools.grid.impl.GridNodeImpl; import org.drools.io.ResourceFactory; import org.drools.io.Resource; import org.drools.builder.ResourceType; import org.drools.runtime.CommandExecutor; import java.util.HashMap; public class DroolsBlueprintBean { public static GridNode createGridNode(String id){ Grid grid = new GridImpl( new HashMap() ); return grid.createGridNode( id ); } public static KnowledgeBase createKnowledgeBase(GridNode node,String resource,String resourcetype){ if ( node == null ) { node = new GridNodeImpl(); } //kbase configuration PackageBuilderConfiguration kconf = (PackageBuilderConfiguration) KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,DroolsBlueprintBean.class.getClassLoader()); //kbuilder KnowledgeBuilder kbuilder = node.get( KnowledgeBuilderFactoryService.class ).newKnowledgeBuilder( kconf); kbuilder.add(parseResource(resource),ResourceType.getResourceType(resourcetype)); // error handling KnowledgeBuilderErrors errors = kbuilder.getErrors(); if ( !errors.isEmpty() ) { throw new RuntimeException( errors.toString() ); } //KnowledgeBase KnowledgeBaseConfiguration kbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null, DroolsBlueprintBean.class.getClassLoader()); KnowledgeBase kbase = node.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase(kbaseConfig); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); return kbase; } public static CommandExecutor createKnowledgeSession(KnowledgeBase kbase,GridNode node,String type,String name){ CommandExecutor ksession; if (type.equals("stateful")) { //Adding a configuration forces drools to use the current classloader (see issue SM-2316) ksession = kbase.newStatefulKnowledgeSession(new SessionConfiguration(), null); }else { //Adding a configuration forces drools to use the current classloader (see issue SM-2316) ksession = kbase.newStatelessKnowledgeSession(new SessionConfiguration()); } node.set(name,ksession); return ksession; } private static Resource parseResource(String resource) { if ( resource.trim().startsWith( "classpath:" ) ) { return ResourceFactory.newClassPathResource(resource.substring( resource.indexOf( ':' ) + 1 ),DroolsBlueprintBean.class); } else { return ResourceFactory.newUrlResource( resource ); } } } ================================================ FILE: examples/camel/camel-drools-blueprint/src/main/java/org/apache/servicemix/examples/camel/DroolsCommandHelper.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.drools.command.impl.GenericCommand; import org.drools.command.runtime.BatchExecutionCommandImpl; import org.drools.command.runtime.rule.FireAllRulesCommand; import org.drools.command.runtime.rule.InsertObjectCommand; import java.util.List; /** * Class to help create wrapper Drools Expert Command for use with * org.drools/drools-camel component. */ public class DroolsCommandHelper { public void insertAndFireAll(Exchange exchange) { final Message in = exchange.getIn(); final Object body = in.getBody(); // TODO: add type checking to handle arrays of objects BatchExecutionCommandImpl command = new BatchExecutionCommandImpl(); final List> commands = command.getCommands(); commands.add(new InsertObjectCommand(body, "obj1")); commands.add(new FireAllRulesCommand()); in.setBody(command); } // TODO: add other command handler methods (e.g. getGlobalObject, etc.) } ================================================ FILE: examples/camel/camel-drools-blueprint/src/main/java/org/apache/servicemix/examples/camel/Person.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import org.drools.definition.type.PropertyReactive; @PropertyReactive public class Person { private int age; private boolean canDrink = false; private Sex sex; private int income; private boolean isVip = false; private Drinks drink; public int getAge() { return age; } public void setAge(int age) { this.age = age; } public int getIncome() { return income; } public void setIncome(int income) { this.income = income; } public Sex getSex() { return sex; } public void setSex(Sex sex) { this.sex = sex; } public boolean isCanDrink() { return canDrink; } public void setCanDrink(boolean canDrink) { this.canDrink = canDrink; } public boolean isVip() { return isVip; } public void setVip(boolean vip) { isVip = vip; } public Drinks getDrink() { return drink; } public void setDrink(Drinks drink) { this.drink = drink; } public boolean isRich(){ return getIncome() >= 80000; } public String getName() { StringBuilder name = new StringBuilder(); // Age if (getAge()>=21){ name.append("old"); }else{ name.append("young"); } //Income if (isRich()){ name.append(" rich"); } //Sex if (getSex() == Sex.MALE){ name.append(" man"); }else{ name.append(" woman"); } return name.toString(); } @Override public String toString() { return "Person{" + "age=" + age + ", canDrink=" + canDrink + ", sex=" + sex + ", income=" + getIncome() + ", isRich=" + isRich() + ", isVip=" + isVip + ", drink=" + drink + '}'; } } ================================================ FILE: examples/camel/camel-drools-blueprint/src/main/java/org/apache/servicemix/examples/camel/PersonHelper.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import java.util.Random; public class PersonHelper { private final Random random = new Random(); public Person createTestPerson() { Person person = new Person(); // Age person.setAge(random.nextInt(70)); // Sex if (random.nextBoolean()) { person.setSex(Sex.MALE); } else { person.setSex(Sex.FEMALE); } // Income person.setIncome(random.nextInt(100000)); return person; } } ================================================ FILE: examples/camel/camel-drools-blueprint/src/main/java/org/apache/servicemix/examples/camel/Sex.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; public enum Sex { MALE, FEMALE } ================================================ FILE: examples/camel/camel-drools-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ Example route that will regularly create a random Person and choose an appropriate drink based on the drools rules file. After processing, it divides the people into VIPs and regular clients based on the drools result. valid 'action' values are: 'execute' that takes a 'Command' object (default) 'insertBody' that inserts the Exchange.in.body, and executes rules 'insertMessage' that inserts the Exchange.in (type org.apache.camel.Message), and executes rules 'insertExchange' that inserts the Exchange (type org.apache.camel.Exchange), and executes rules ${body.isVip} ================================================ FILE: examples/camel/camel-drools-blueprint/src/main/resources/log4j.properties ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # The logging properties used # log4j.rootLogger=INFO, out # uncomment the following line to turn on Camel debugging #log4j.logger.org.apache.camel=DEBUG log4j.logger.org.springframework=WARN # CONSOLE appender not used by default log4j.appender.out=org.apache.log4j.ConsoleAppender log4j.appender.out.layout=org.apache.log4j.PatternLayout log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n #log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer ================================================ FILE: examples/camel/camel-drools-blueprint/src/main/resources/testSpring.drl ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import org.apache.servicemix.examples.camel.Person; import org.apache.servicemix.examples.camel.Sex; import org.apache.servicemix.examples.camel.Drinks; rule "humans need water" salience 2 when p : Person() then modify(p) {setDrink(Drinks.WATER)}; end rule "boys go for Cola Zero" salience 1 when p : Person(age >= 8 && sex == Sex.MALE) then modify(p) {setDrink(Drinks.COLA_ZERO)}; end rule "girls go for Cola Light" salience 1 when p : Person(age >= 8 && sex == Sex.FEMALE) then modify(p) {setDrink(Drinks.COLA_LIGHT)}; end rule "can you drink?" when p : Person( age >= 21 && !canDrink) then modify(p) {setCanDrink(true)}; end rule "woman go for wine" when p : Person(sex == Sex.FEMALE && canDrink ) then modify(p) {setDrink(Drinks.WINE)}; end rule "men go for beer" when p : Person(sex == Sex.MALE && canDrink ) then modify(p) {setDrink(Drinks.BEER)}; end rule "Vip in the house!" salience -1 when p : Person( rich && !Vip) then modify(p) {setVip(true)}; end rule "Vip woman drink bubbles" when p : Person(Vip && sex == Sex.FEMALE && canDrink) then modify(p) {setDrink(Drinks.CHAMPAGNE)}; end rule "Vip men drink Scotch" when p : Person(Vip && sex == Sex.MALE && canDrink) then modify(p) {setDrink(Drinks.SCOTCH)}; end ================================================ FILE: examples/camel/camel-osgi/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CAMEL OSGI EXAMPLE ================== Purpose ------- Deploys a Camel EIP route as an OSGi bundle. Configuration makes use of the OSGi Configuration Admin service and Spring property placeholders, and the example demonstrates how to deploy the properties file from the ServiceMix console. Explanation ----------- This example provides two Camel routes: - A XML route - A Java route XML Route --------- The Camel route is defined in a Spring XML file, beans.xml, which can be found in the src/main/resources/META-INF/spring directory of this example. The route is defined in the element and can be explained as follows: 1. A timer endpoint generates a heartbeat event every 2000ms. 2. A callout is made to a transformer bean that transforms each heartbeat message to the current date and time. 3. A log endpoint sends the transformed message to the Jakarta commons logger. The beans.xml file also contains the following elements: - A element that instantiates the transformer bean using standard Spring configuration syntax and specifies a prefix value using a property placeholder. - An element which allows you to specify placeholder values using the OSGi Configuration Admin service. In this case, the property is also given the default value of "MyTransform". The route and configuration are deployed in an OSGi bundle. Java Route --------- The Java Camel route is defined in a Java soure file, MyRouteBuilder, which can be found in the src/main/java/org/apache/servicemix/examples/camel directory of this example. The route is similar to the XML route which is explained above. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher (for building) For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running quickly. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-camel-osgi This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events are routed to the transform method of the MyTransform class and you should see output on your console screen. The output should be from both the XML and Java Camel routes. Updating and Redeploying the Properties File from the Console ------------------------------------------------------------- You can update and redeploy the properties file that is used by the properties placeholder in the beans.xml from console as follows: 1. Edit the org.apache.servicemix.examples.cfg file, located in the same folder as this README, by changing the value of the "prefix" key to whatever you want (for example, YourTransform). 2. Copy the updated configuration file to your /etc directory. You can do this from the ServiceMix console by typing: copy $YOUR_SERVICEMIX_HOME/examples/camel/camel-osgi/org.apache.servicemix.examples.cfg $YOUR_SERVICEMIX_HOME/etc On Windows you need to replace / in the path with \\. Note, the text you are typing might intermingle with the output being logged. This is nothing to worry about. 3. Restart the example bundle: (i) First you must know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command in the ServiceMix console: bundle:list At the end of the listing, you should see an entry similar to the following: [158] [Active ] [Started ] [ 60] Apache ServiceMix Example :: Camel OSGi (4.1.0) In this case, the bundle ID is 158. (ii) Enter the following command in the ServiceMix console to restart the bundle: bundle:restart The prefix of the output should change, and the output on the console should be updated accordingly. For information on how to stop and/or uninstall the example, see "Stopping and Uninstalling the Example" below. B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-camel-osgi feature by entering the following command in the ServiceMix console: feature:uninstall examples-camel-osgi 2. Build the example by opening a command prompt, changing directory to examples/camel/camel-osgi (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-camel-osgi It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events are routed to the transform method of the MyTransform class and you should see output on your console screen. Now, if you have not already done so, try updating and redeploying, from the console, the properties file that is used by the properties placeholder in the beans.xml file. For details on how to do this, see the "Updating and Redeploying the Properties File from the Console" section above. Stopping and Uninstalling the Example ------------------------------------- To stop the example, enter the following command in the ServiceMix console: bundle:stop For information on how to find the bundle_id assigned to the example, see step 3 in the "Updating and Redeploying the Properties File from the Console" section above. To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-camel-osgi or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/camel/camel-osgi/org.apache.servicemix.examples.cfg ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. # # prefix=YourTransform ================================================ FILE: examples/camel/camel-osgi/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples camel-examples 7.1.0-SNAPSHOT camel-osgi bundle Apache ServiceMix :: Examples :: Camel OSGi Camel example using OSGi instead of JBI org.slf4j slf4j-api provided org.apache.camel camel-spring org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} * org.apache.servicemix.examples.camel ================================================ FILE: examples/camel/camel-osgi/src/main/java/org/apache/servicemix/examples/camel/MyRouteBuilder.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.spring.Main; /** * A simple example router to show how to define the route with Java DSL * * @version $Revision$ */ public class MyRouteBuilder extends RouteBuilder { /** * Allow this route to be run as an application * * @param args */ public static void main(String[] args) throws Exception{ new Main().run(args); } public void configure() { // set up the transform bean MyTransform transform = new MyTransform(); transform.setPrefix("JavaDSL"); from("timer://javaTimer?fixedRate=true&period=2000") .bean(transform, "transform") .to("log:ExampleRouter"); } } ================================================ FILE: examples/camel/camel-osgi/src/main/java/org/apache/servicemix/examples/camel/MyTransform.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Date; /** * @version $Revision: 640450 $ */ public class MyTransform { private static final transient Logger LOG = LoggerFactory.getLogger(MyTransform.class); private boolean verbose = true; private String prefix = "MyTransform"; public Object transform(Object body) { String answer = prefix + " set body: " + new Date(); if (verbose) { System.out.println(">>>> " + answer); } LOG.info(">>>> " + answer); return answer; } public boolean isVerbose() { return verbose; } public void setVerbose(boolean verbose) { this.verbose = verbose; } public String getPrefix() { return prefix; } public void setPrefix(String prefix) { this.prefix = prefix; } } ================================================ FILE: examples/camel/camel-osgi/src/main/resources/META-INF/spring/beans.xml ================================================ org.apache.servicemix.examples.camel MyTransform ================================================ FILE: examples/camel/camel-sql/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CAMEL SQL EXAMPLE ================= Purpose ------- Deploys a Camel EIP route that uses a database to store messages after receiving. A second route illustrates how to read messages from the database in order to process them. Explanation ----------- The example exists of several modules: - camel-sql-Orders The Orders module has two Camel routes defined in a Blueprint XML file. Both routes use the camel-sql feature and some predefined queries which are located in the sql.properties file. The datasource is referenced from the service we exposed in the first module. The first route periodically creates a random order using the OrderBean and submits it to the database. The route also logs every oder to the Servicemix log. It displays the item-name from the order, for example: | Inserted new order of Gummi bears The second route consumes the unconsumed orders from the database and processes them using the OrderBean. The result is logged to the Servicemix log. For example: | {ID=10, ITEM=Gummi bears, AMOUNT=46, CONSUMED=false, description=The red ones are the cutest [PROCESSED], processed=true} - camel-sql-datasource-derby This module creates an in-memory Derby database utilizing a DatabaseBeanDerby bean. The Database bean takes care of the table creation and the graceful shutdown of the database connection. The datasource is exposed as a OSGI service so it can be referenced in other OSGI bundles. - camel-sql-datasource-pgsql This module creates an Postgre SQL table utilizing a DatabaseBeanPgSQL bean. The Database bean takes care of the table creation and the graceful shutdown of the database connection. The datasource is exposed as a OSGI service so it can be referenced in other OSGI bundles. - camel-sql-datasource-h2 This module creates an in-memory h2 database utilizing a DatabaseBeanH2 bean. The Database bean takes care of the table creation and the graceful shutdown of the database connection. The datasource is exposed as a OSGI service so it can be referenced in other OSGI bundles. All modules are deployed in an OSGi bundle. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher (for building) For more information, see the README in the top-level examples directory. 2. This example requires some additional configuration to allow the JVM to use more PermGen memory: export JAVA_MAX_PERM_MEM=128m (on UNIX) set JAVA_MAX_PERM_MEM=128m (on Windows) 3. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Preparing the databases ----------------------- According to the example you would like to run, you have to prepare the Derby, H2 or PgSQL database. - Derby You can find a downloadable bin-distribution of Derby for your OS on http://db.apache.org/derby/derby_downloads.html Extract the downloaded package and run the network server /bin/startNetworkServer (on UNIX) \bin\startNetworkServer.bat (on Windows) - H2 You can find a downloadable distribution of H2 for your OS on http://www.h2database.com/html/download.html To install the H2 database server, run the installer or extract the package. Now start the database server: /bin/h2.sh (on UNIX) \bin\h2.bat (on Windows) - PgSQL You can find a downloadable distribution of pgSQL for your OS on http://www.postgresql.org/download/ Follow the installation and execution instructions for your OS on the download website. To prepare the database server you can use the command line tool psql or the GUI tool PgAdmin (http://pgadmin.org/). - Create a new database orderdb - Execute the following SQL code: CREATE ROLE camelsql LOGIN ENCRYPTED PASSWORD 'md5fcac28063087cf28e72241706e98c001' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION; ALTER DATABASE orderdb OWNER TO camelsql; Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running quickly. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-camel-sql-derby or feature:install examples-camel-sql-h2 or feature:install examples-camel-sql-pgsql This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events are routed to the generateOrder-route which crates routes en sends them to the database. The processOrder-route picks those orders from the database and processes them. You should see a similar log output: | Inserted a new order of Cookies | {ID=8, ITEM=Cookies, AMOUNT=35, CONSUMED=false, description=Grandma's recipe and fresh from the bakery! [PROCESSED], processed=true} B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples feature by entering the following command in the ServiceMix console: feature:uninstall examples-camel-sql-derby or feature:uninstall examples-camel-sql-h2 or feature:uninstall examples-camel-sql-pgsql 2. Build the example by opening a command prompt, changing directory to examples/camel/camel-sql (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-camel-sql-derby or feature:install examples-camel-sql-h2 or feature:install examples-camel-sql-pgsql It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Once the example is running, periodic events are routed to the generateOrder-route which crates routes en sends them to the database. The processOrder-route picks those orders from the database and processes them. You should see a similar log output: | Inserted a new order of Cookies | {ID=8, ITEM=Cookies, AMOUNT=35, CONSUMED=false, description=Grandma's recipe and fresh from the bakery! [PROCESSED], processed=true} Stopping and Uninstalling the Example ------------------------------------- To stop the example, enter the following command in the ServiceMix console: bundle:stop For information on how to find the bundle_id assigned to the example, see step 3 in the "Updating and Redeploying the Properties File from the Console" section above. To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-camel-sql-derby or feature:uninstall examples-camel-sql-h2 or feature:uninstall examples-camel-sql-pgsql or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/camel/camel-sql/camel-sql-datasource-derby/pom.xml ================================================ camel-sql org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 camel-sql-datasource-derby bundle Apache ServiceMix :: Examples :: Camel SQL :: Datasource Derby Camel Example using sql org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} * org.apache.servicemix.examples.camel.sql org.slf4j slf4j-api ${slf4j.version} ================================================ FILE: examples/camel/camel-sql/camel-sql-datasource-derby/src/main/java/org/apache/servicemix/examples/camel/sql/DatabaseBeanDerby.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.sql; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.sql.DataSource; import java.sql.SQLException; import java.sql.Statement; public class DatabaseBeanDerby { private DataSource dataSource; private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseBeanDerby.class); public DatabaseBeanDerby(){} public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } public void create() throws SQLException{ try (Statement sta = dataSource.getConnection().createStatement()) { sta.executeUpdate( "CREATE TABLE orders (id INT generated by default as identity, item VARCHAR(50), amount INT, description VARCHAR(300), processed BOOLEAN, consumed BOOLEAN)"); } catch (SQLException e) { LOGGER.info("Table orders already exists"); } } public void destroy() throws SQLException { dataSource.getConnection().close(); } } ================================================ FILE: examples/camel/camel-sql/camel-sql-datasource-derby/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/camel/camel-sql/camel-sql-datasource-h2/pom.xml ================================================ camel-sql org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 camel-sql-datasource-h2 bundle Apache ServiceMix :: Examples :: Camel SQL :: Datasource H2 Camel Example using sql org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} * org.apache.servicemix.examples.camel.sql org.slf4j slf4j-api ${slf4j.version} ================================================ FILE: examples/camel/camel-sql/camel-sql-datasource-h2/src/main/java/org/apache/servicemix/examples/camel/sql/DatabaseBeanH2.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.sql; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.sql.DataSource; import java.sql.SQLException; import java.sql.Statement; public class DatabaseBeanH2 { private DataSource dataSource; private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseBeanH2.class); public DatabaseBeanH2(){} public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } public void create() throws SQLException{ try (Statement sta = dataSource.getConnection().createStatement()) { sta.executeUpdate("CREATE TABLE orders ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, item VARCHAR(50), amount INT, description VARCHAR(300), processed BOOLEAN, consumed BOOLEAN);"); } catch (SQLException e) { LOGGER.info("Table orders already exists"); } } public void destroy() throws SQLException { dataSource.getConnection().close(); } } ================================================ FILE: examples/camel/camel-sql/camel-sql-datasource-h2/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/camel/camel-sql/camel-sql-datasource-pgsql/pom.xml ================================================ camel-sql org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 camel-sql-datasource-pgsql bundle Apache ServiceMix :: Examples :: Camel SQL :: Datasource PgSql Camel Example using sql org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} org.postgresql.jdbc4,* org.apache.servicemix.examples.camel.sql org.slf4j slf4j-api ${slf4j.version} ================================================ FILE: examples/camel/camel-sql/camel-sql-datasource-pgsql/src/main/java/org/apache/servicemix/examples/camel/sql/DatabaseBeanPgSQL.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.sql; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.sql.DataSource; import java.sql.SQLException; import java.sql.Statement; public class DatabaseBeanPgSQL { private DataSource dataSource; private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseBeanPgSQL.class); public DatabaseBeanPgSQL(){} public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } public void create() throws SQLException { try (Statement sta = dataSource.getConnection().createStatement()) { sta.executeUpdate("CREATE SEQUENCE order_id_seq;"); sta.executeUpdate("CREATE TABLE orders ( id INT NOT NULL PRIMARY KEY DEFAULT nextval('order_id_seq'), item VARCHAR(50), amount INT, description VARCHAR(300), processed BOOLEAN, consumed BOOLEAN);"); } catch (SQLException e) { LOGGER.info("Table orders already exists"); } } public void destroy() throws SQLException { dataSource.getConnection().close(); } } ================================================ FILE: examples/camel/camel-sql/camel-sql-datasource-pgsql/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/camel/camel-sql/camel-sql-orders/pom.xml ================================================ camel-sql org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 camel-sql-orders bundle Apache ServiceMix :: Examples :: Camel SQL :: Orders Camel Example using sql org.slf4j slf4j-api ${slf4j.version} org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} * org.apache.servicemix.examples.camel.sql ================================================ FILE: examples/camel/camel-sql/camel-sql-orders/src/main/java/org/apache/servicemix/examples/camel/sql/ListenerBean.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.sql; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Map; public class ListenerBean { private static final Logger LOGGER = LoggerFactory.getLogger(ListenerBean.class); public void onBind(Object service, Map properties){ LOGGER.info("Binding to "+ properties.get("datasource.type")); } public void onUnbind(Object service, Map properties){ LOGGER.info("Unbinding from "+ properties.get("datasource.type")); } } ================================================ FILE: examples/camel/camel-sql/camel-sql-orders/src/main/java/org/apache/servicemix/examples/camel/sql/OrderBean.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.camel.sql; import java.util.*; public class OrderBean { private Random random; private static int itemnumber = 0; private List> orders; public OrderBean() { random = new Random(); } public Map generateRandomOrder(){ return orders.get(random.nextInt(orders.size()-1)); } private static int getNextItemNumber(){ return OrderBean.itemnumber++; } public void processOrder(Map order){ order.put("description",order.get("description")+" [PROCESSED]"); order.put("processed",true); } public void init(){ orders = new ArrayList>(); orders.add(createOrder("Cookies","Grandma's recipe and fresh from the bakery!",random.nextInt(50))); orders.add(createOrder("Lollipops","Mix of different colors and flavours",random.nextInt(10))); orders.add(createOrder("Gummi bears","The red ones are the cutest",random.nextInt(100))); orders.add(createOrder("Skittles","Everybody loves rainbows",random.nextInt(800))); } private Map createOrder(String item, String description, int amount){ Map order = new HashMap(); order.put("item",item); order.put("description",description); order.put("amount",amount); return order; } } ================================================ FILE: examples/camel/camel-sql/camel-sql-orders/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/camel/camel-sql/camel-sql-orders/src/main/resources/sql.properties ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. # # ## notice we use named parameters in the queries, eg :#name. A named query parameter must start with :# ## sql that insert new orders sql.insertOrder=insert into orders (item, amount, description, processed, consumed) values (:#item, :#amount, :#description, false, false) ## sql that select all unprocessed orders sql.selectOrder=select * from orders where consumed = false ## sql that update the order as being processed sql.markOrder=update orders set consumed = true where id = :#id ================================================ FILE: examples/camel/camel-sql/pom.xml ================================================ camel-examples org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 camel-sql Apache ServiceMix :: Examples :: Camel SQL pom camel-sql-datasource-derby camel-sql-orders camel-sql-datasource-pgsql camel-sql-datasource-h2 ================================================ FILE: examples/camel/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples examples 7.1.0-SNAPSHOT org.apache.servicemix.examples camel-examples pom Apache ServiceMix :: Examples :: Camel camel-blueprint camel-osgi camel-drools camel-drools-blueprint camel-sql camel-cxf-rest camel-cxf-soap ================================================ FILE: examples/cxf/cxf-jaxrs/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CXF JAX-RS EXAMPLE ================== Purpose ------- Create a RESTful JAX-RS web service using CXF and expose it with the OSGi HTTP Service. Explanation ----------- The web service is implemented in the CustomerService.java file, which is located in the src/main/java/org/apache/servicemix/examples/cxf/jaxrs directory of this example. It contains annotations indicating what URIs and HTTP methods to use when accessing the resource. For information on how to write RESTful web services, please refer to the Apache CXF documentation. The beans.xml file, located in the src/main/resources/META-INF/ spring directory: 1. Imports the configuration files needed to enable CXF to support JAX-RS and to use the OSGi HTTP service. 2. Configures the web service, as follows: Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-cxf-jaxrs This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Running a Client ---------------- You can browse WADL at: http://localhost:8181/cxf/crm/customerservice?_wadl&_type=xml or http://localhost:8181/cxf/crm?_wadl&_type=xml The latter URI can be used to see the desription of multiple root resource classes. You can see the services listing at http://localhost:8181/cxf. You can make invocations on the web service in several ways, including using a web client, using a Java client and using a command-line utility such a curl or Wget. See below for more details. (a) To run a web client: ------------------- Open a browser and go to the following URL: http://localhost:8181/cxf/crm/customerservice/customers/123 It should display an XML representation for customer 123. Note, if you use Safari, right click the window and select 'Show Source'. (b) To run a Java client: -------------------- - Change to the /examples/cxf/cxf-jaxrs directory. - Run the following command: mvn compile exec:java It makes a sequence of RESTful invocations and displays the results. (c) To run a command-line utility: ----------------------------- You can use a command-line utility, such as curl or Wget, to make the invocations. For example, try using curl as follows: - Open a command prompt and change directory to /examples/cxf/cxf-jaxrs. - Run the following curl commands: # Create a customer # # curl -X POST -T src/main/resources/org/apache/servicemix/examples/cxf/jaxrs/client/add_customer.xml -H "Content-Type: text/xml" http://localhost:8181/cxf/crm/customerservice/customers # Retrieve the customer instance with id 123 # curl http://localhost:8181/cxf/crm/customerservice/customers/123 # Update the customer instance with id 123 # curl -X PUT -T src/main/resources/org/apache/servicemix/examples/cxf/jaxrs/client/update_customer.xml -H "Content-Type: text/xml" http://localhost:8181/cxf/crm/customerservice/customers # Delete the customer instance with id 123 # curl -X DELETE http://localhost:8181/cxf/crm/customerservice/customers/123 Changing /cxf servlet alias --------------------------- By default CXF Servlet is assigned a '/cxf' alias. You can change it in a couple of ways a. Add org.apache.cxf.osgi.cfg to the /etc directory and set the 'org.apache.cxf.servlet.context' property, for example: org.apache.cxf.servlet.context=/custom b. Use shell config commands, for example: config:edit org.apache.cxf.osgi config:property-set org.apache.cxf.servlet.context /super config:update B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-cxf-jaxrs feature by entering the following command in the ServiceMix console: feature:uninstall examples-cxf-jaxrs 2. Build the example by opening a command prompt, changing directory to examples/cxf-jaxrs (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-cxf-jaxrs It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. See "Running a Client" above for information on how to make invocations on the web service. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command in the ServiceMix console (Note, the text you are typing will intermingle with the output being logged. This is nothing to worry about.): bundle:list At the end of the listing, you should see an entry similar to the following: [159] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF JAX-RS OSGI (4.1.0) In this case, the bundle ID is 159. To stop the example, enter the following command in the ServiceMix console: bundle:stop For example: bundle:stop 159 To uninstall the example, enter one of the following commands at the ServiceMix console: feature:uninstall examples-cxf-jaxrs or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/cxf/cxf-jaxrs/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples cxf 7.1.0-SNAPSHOT cxf-jaxrs bundle Apache ServiceMix :: Examples :: CXF JAX-RS OSGI CXF Example using JAX-RS org.apache.servicemix.specs org.apache.servicemix.specs.jsr339-api-2.0 org.apache.servicemix.specs org.apache.servicemix.specs.jaxb-api-${jaxb.api.version} org.apache.servicemix.bundles org.apache.servicemix.bundles.commons-httpclient org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} javax.wsdl, javax.xml.bind, javax.xml.bind.annotation, javax.ws.rs, javax.ws.rs.core, org.springframework.beans.factory.config, org.apache.commons.httpclient, org.apache.commons.httpclient.methods org.apache.servicemix.examples.cxf.jaxrs org.codehaus.mojo exec-maven-plugin org.apache.servicemix.examples.cxf.jaxrs.client.Client false ================================================ FILE: examples/cxf/cxf-jaxrs/src/main/java/org/apache/servicemix/examples/cxf/jaxrs/Customer.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.jaxrs; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "Customer") public class Customer { private long id; private String name; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } ================================================ FILE: examples/cxf/cxf-jaxrs/src/main/java/org/apache/servicemix/examples/cxf/jaxrs/CustomerService.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.jaxrs; import java.util.HashMap; import java.util.Map; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; @Path("/customerservice/") public class CustomerService { long currentId = 123; Map customers = new HashMap(); Map orders = new HashMap(); public CustomerService() { init(); } @GET @Path("/customers/{id}/") @Produces("application/xml") public Customer getCustomer(@PathParam("id") String id) { System.out.println("----invoking getCustomer, Customer id is: " + id); long idNumber = Long.parseLong(id); Customer c = customers.get(idNumber); return c; } @PUT @Path("/customers/") public Response updateCustomer(Customer customer) { System.out.println("----invoking updateCustomer, Customer name is: " + customer.getName()); Customer c = customers.get(customer.getId()); Response r; if (c != null) { customers.put(customer.getId(), customer); r = Response.ok().build(); } else { r = Response.notModified().build(); } return r; } @POST @Path("/customers/") public Response addCustomer(Customer customer) { System.out.println("----invoking addCustomer, Customer name is: " + customer.getName()); customer.setId(++currentId); customers.put(customer.getId(), customer); return Response.ok().type("application/xml").entity(customer).build(); } @DELETE @Path("/customers/{id}/") public Response deleteCustomer(@PathParam("id") String id) { System.out.println("----invoking deleteCustomer, Customer id is: " + id); long idNumber = Long.parseLong(id); Customer c = customers.get(idNumber); Response r; if (c != null) { r = Response.ok().build(); customers.remove(idNumber); } else { r = Response.notModified().build(); } return r; } @Path("/orders/{orderId}/") public Order getOrder(@PathParam("orderId") String orderId) { System.out.println("----invoking getOrder, Order id is: " + orderId); long idNumber = Long.parseLong(orderId); Order c = orders.get(idNumber); return c; } final void init() { Customer c = new Customer(); c.setName("John"); c.setId(123); customers.put(c.getId(), c); Order o = new Order(); o.setDescription("order 223"); o.setId(223); orders.put(o.getId(), o); } } ================================================ FILE: examples/cxf/cxf-jaxrs/src/main/java/org/apache/servicemix/examples/cxf/jaxrs/Order.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.jaxrs; import java.util.HashMap; import java.util.Map; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "Order") public class Order { private long id; private String description; private Map products = new HashMap(); public Order() { init(); } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String d) { this.description = d; } @GET @Path("products/{productId}/") @Produces("application/xml") public Product getProduct(@PathParam("productId")int productId) { System.out.println("----invoking getProduct with id: " + productId); Product p = products.get(new Long(productId)); return p; } final void init() { Product p = new Product(); p.setId(323); p.setDescription("product 323"); products.put(p.getId(), p); } } ================================================ FILE: examples/cxf/cxf-jaxrs/src/main/java/org/apache/servicemix/examples/cxf/jaxrs/Product.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.jaxrs; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "Product") public class Product { private long id; private String description; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String d) { this.description = d; } } ================================================ FILE: examples/cxf/cxf-jaxrs/src/main/java/org/apache/servicemix/examples/cxf/jaxrs/client/Client.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.jaxrs.client; import java.io.File; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.net.URL; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.FileRequestEntity; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.RequestEntity; public final class Client { private Client() { } public static void main(String args[]) throws Exception { // Sent HTTP GET request to query all customer info // Sent HTTP GET request to query customer info System.out.println("Sent HTTP GET request to query customer info"); URL url = new URL("http://localhost:8181/cxf/crm/customerservice/customers/123"); InputStream in = url.openStream(); System.out.println(getStringFromInputStream(in)); // Sent HTTP GET request to query sub resource product info System.out.println("\n"); System.out.println("Sent HTTP GET request to query sub resource product info"); url = new URL("http://localhost:8181/cxf/crm/customerservice/orders/223/products/323"); in = url.openStream(); System.out.println(getStringFromInputStream(in)); // Sent HTTP PUT request to update customer info System.out.println("\n"); System.out.println("Sent HTTP PUT request to update customer info"); Client client = new Client(); String inputFile = client.getClass().getResource("update_customer.xml").getFile(); File input = new File(inputFile); PutMethod put = new PutMethod("http://localhost:8181/cxf/crm/customerservice/customers"); RequestEntity entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1"); put.setRequestEntity(entity); HttpClient httpclient = new HttpClient(); try { int result = httpclient.executeMethod(put); System.out.println("Response status code: " + result); System.out.println("Response body: "); System.out.println(put.getResponseBodyAsString()); } finally { // Release current connection to the connection pool once you are // done put.releaseConnection(); } // Sent HTTP POST request to add customer System.out.println("\n"); System.out.println("Sent HTTP POST request to add customer"); inputFile = client.getClass().getResource("add_customer.xml").getFile(); input = new File(inputFile); PostMethod post = new PostMethod("http://localhost:8181/cxf/crm/customerservice/customers"); post.addRequestHeader("Accept" , "text/xml"); entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1"); post.setRequestEntity(entity); httpclient = new HttpClient(); try { int result = httpclient.executeMethod(post); System.out.println("Response status code: " + result); System.out.println("Response body: "); System.out.println(post.getResponseBodyAsString()); } finally { // Release current connection to the connection pool once you are // done post.releaseConnection(); } System.out.println("\n"); System.exit(0); } private static String getStringFromInputStream(InputStream in) throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); int c = 0; while ((c = in.read()) != -1) { bos.write(c); } in.close(); bos.close(); return bos.toString(); } } ================================================ FILE: examples/cxf/cxf-jaxrs/src/main/resources/META-INF/spring/beans.xml ================================================ ================================================ FILE: examples/cxf/cxf-jaxrs/src/main/resources/org/apache/servicemix/examples/cxf/jaxrs/client/add_customer.xml ================================================ Jack ================================================ FILE: examples/cxf/cxf-jaxrs/src/main/resources/org/apache/servicemix/examples/cxf/jaxrs/client/update_customer.xml ================================================ Mary 123 ================================================ FILE: examples/cxf/cxf-jaxrs-blueprint/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CXF JAX-RS Blueprint EXAMPLE ============================ Purpose ------- Create a RESTful JAX-RS web service using CXF and expose it with the OSGi HTTP Service. Explanation ----------- The web service is implemented in the CustomerService.java file, which is located in the src/main/java/org/apache/servicemix/examples/cxf/jaxrs directory of this example. It contains annotations indicating what URIs and HTTP methods to use when accessing the resource. For information on how to write RESTful web services, please refer to the Apache CXF documentation. The beans.xml file, located in the src/main/resources/META-INF/ spring directory: 1. Imports the configuration files needed to enable CXF to support JAX-RS and to use the OSGi HTTP service. 2. Configures the web service, as follows: Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-cxf-jaxrs This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Running a Client ---------------- You can browse WADL at: http://localhost:8181/cxf/crm/customerservice?_wadl&_type=xml or http://localhost:8181/cxf/crm?_wadl&_type=xml The latter URI can be used to see the desription of multiple root resource classes. You can see the services listing at http://localhost:8181/cxf. You can make invocations on the web service in several ways, including using a web client, using a Java client and using a command-line utility such a curl or Wget. See below for more details. (a) To run a web client: ------------------- Open a browser and go to the following URL: http://localhost:8181/cxf/crm/customerservice/customers/123 It should display an XML representation for customer 123. Note, if you use Safari, right click the window and select 'Show Source'. (b) To run a Java client: -------------------- - Change to the /examples/cxf/cxf-jaxrs directory. - Run the following command: mvn compile exec:java It makes a sequence of RESTful invocations and displays the results. (c) To run a command-line utility: ----------------------------- You can use a command-line utility, such as curl or Wget, to make the invocations. For example, try using curl as follows: - Open a command prompt and change directory to /examples/cxf/cxf-jaxrs. - Run the following curl commands: # Create a customer # # curl -X POST -T src/main/resources/org/apache/servicemix/examples/cxf/jaxrs/client/add_customer.xml -H "Content-Type: text/xml" http://localhost:8181/cxf/crm/customerservice/customers # Retrieve the customer instance with id 123 # curl http://localhost:8181/cxf/crm/customerservice/customers/123 # Update the customer instance with id 123 # curl -X PUT -T src/main/resources/org/apache/servicemix/examples/cxf/jaxrs/client/update_customer.xml -H "Content-Type: text/xml" http://localhost:8181/cxf/crm/customerservice/customers # Delete the customer instance with id 123 # curl -X DELETE http://localhost:8181/cxf/crm/customerservice/customers/123 Changing /cxf servlet alias --------------------------- By default CXF Servlet is assigned a '/cxf' alias. You can change it in a couple of ways a. Add org.apache.cxf.osgi.cfg to the /etc directory and set the 'org.apache.cxf.servlet.context' property, for example: org.apache.cxf.servlet.context=/custom b. Use shell config commands, for example: config:edit org.apache.cxf.osgi config:propset org.apache.cxf.servlet.context /super config:update B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-cxf-jaxrs feature by entering the following command in the ServiceMix console: feature:uninstall examples-cxf-jaxrs 2. Build the example by opening a command prompt, changing directory to examples/cxf-jaxrs (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-cxf-jaxrs It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. See "Running a Client" above for information on how to make invocations on the web service. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command in the ServiceMix console (Note, the text you are typing will intermingle with the output being logged. This is nothing to worry about.): bundle:list At the end of the listing, you should see an entry similar to the following: [159] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF JAX-RS OSGI (4.1.0) In this case, the bundle ID is 159. To stop the example, enter the following command in the ServiceMix console: bundle:stop For example: bundle:stop 159 To uninstall the example, enter one of the following commands at the ServiceMix console: feature:uninstall examples-cxf-jaxrs or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/cxf/cxf-jaxrs-blueprint/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples cxf 7.1.0-SNAPSHOT cxf-jaxrs-blueprint bundle Apache ServiceMix :: Examples :: CXF JAX-RS OSGI Blueprint CXF Example using JAX-RS and Blueprint org.apache.servicemix.specs org.apache.servicemix.specs.jsr339-api-2.0 org.apache.servicemix.bundles org.apache.servicemix.bundles.commons-httpclient com.wordnik swagger-jaxrs_2.11 org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} javax.wsdl, javax.xml.bind, javax.xml.bind.annotation, javax.ws.rs, javax.ws.rs.core, org.apache.commons.httpclient, org.apache.commons.httpclient.methods, org.osgi.service.blueprint, com.wordnik.swagger.jaxrs.config, com.wordnik.swagger.jaxrs.listing, com.wordnik.swagger.annotations, com.fasterxml.jackson.annotation, com.fasterxml.jackson.core, com.fasterxml.jackson.databind, com.fasterxml.jackson.jaxrs.json, javax.ws.rs.ext org.apache.servicemix.examples.cxf.jaxrs org.codehaus.mojo exec-maven-plugin org.apache.servicemix.examples.cxf.jaxrs.client.Client false ================================================ FILE: examples/cxf/cxf-jaxrs-blueprint/src/main/java/org/apache/servicemix/examples/cxf/jaxrs/Customer.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.jaxrs; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "Customer") public class Customer { private long id; private String name; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } ================================================ FILE: examples/cxf/cxf-jaxrs-blueprint/src/main/java/org/apache/servicemix/examples/cxf/jaxrs/CustomerService.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.jaxrs; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiParam; import com.wordnik.swagger.annotations.ApiResponses; import com.wordnik.swagger.annotations.ApiResponse; import java.util.HashMap; import java.util.Map; /** * This Java class with be hosted in the URI path defined by the @Path annotation. @Path annotations on the methods * of this class always refer to a path relative to the path defined at the class level. *

* For example, with 'http://localhost:8181/cxf' as the default CXF servlet path and '/crm' as the JAX-RS server path, * this class will be hosted in 'http://localhost:8181/cxf/crm/customerservice'. An @Path("/customers") annotation on * one of the methods would result in 'http://localhost:8181/cxf/crm/customerservice/customers'. */ @Path("/customerservice") @Api(value = "/customerservice", description = "Operations about customerservice") public class CustomerService { long currentId = 123; Map customers = new HashMap(); Map orders = new HashMap(); public CustomerService() { init(); } /** * This method is mapped to an HTTP GET of 'http://localhost:8181/cxf/crm/customerservice/customers/{id}'. The value for * {id} will be passed to this message as a parameter, using the @PathParam annotation. *

* The method returns a Customer object - for creating the HTTP response, this object is marshaled into XML using JAXB. *

* For example: surfing to 'http://localhost:8181/cxf/crm/customerservice/customers/123' will show you the information of * customer 123 in XML format. */ @GET @Path("/customers/{id}/") @Produces("application/xml") @ApiOperation(value = "Find Customer by ID", notes = "More notes about this method", response = Customer.class) @ApiResponses(value = { @ApiResponse(code = 500, message = "Invalid ID supplied"), @ApiResponse(code = 204, message = "Customer not found") }) public Customer getCustomer(@ApiParam(value = "ID of Customer to fetch", required = true) @PathParam("id") String id) { System.out.println("----invoking getCustomer, Customer id is: " + id); long idNumber = Long.parseLong(id); Customer c = customers.get(idNumber); return c; } /** * Using HTTP PUT, we can can upload the XML representation of a customer object. This operation will be mapped * to the method below and the XML representation will get unmarshaled into a real Customer object using JAXB. *

* The method itself just updates the customer object in our local data map and afterwards uses the Reponse class to * build the appropriate HTTP response: either OK if the update succeeded (translates to HTTP Status 200/OK) or not * modified if the method failed to update a customer object (translates to HTTP Status 304/Not Modified). *

* Note how this method is using the same @Path value as our next method - the HTTP method used will determine which * method is being invoked. */ @PUT @Path("/customers/") @ApiOperation(value = "Update an existing Customer") @ApiResponses(value = { @ApiResponse(code = 500, message = "Invalid ID supplied"), @ApiResponse(code = 204, message = "Customer not found") }) public Response updateCustomer(@ApiParam(value = "Customer object that needs to be updated", required = true) Customer customer) { System.out.println("----invoking updateCustomer, Customer name is: " + customer.getName()); Customer c = customers.get(customer.getId()); Response r; if (c != null) { customers.put(customer.getId(), customer); r = Response.ok().build(); } else { r = Response.notModified().build(); } return r; } /** * Using HTTP POST, we can add a new customer to the system by uploading the XML representation for the customer. * This operation will be mapped to the method below and the XML representation will get unmarshaled into a real * Customer object. *

* After the method has added the customer to the local data map, it will use the Response class to build the HTTP reponse, * sending back the inserted customer object together with a HTTP Status 200/OK. This allows us to send back the * new id for the customer object to the client application along with any other data that might have been updated in * the process. *

* Note how this method is using the same @Path value as our previous method - the HTTP method used will determine which * method is being invoked. */ @POST @Path("/customers/") @ApiOperation(value = "Add a new Customer") @ApiResponses(value = { @ApiResponse(code = 500, message = "Invalid ID supplied")}) public Response addCustomer(@ApiParam(value = "Customer object that needs to be updated", required = true) Customer customer) { System.out.println("----invoking addCustomer, Customer name is: " + customer.getName()); customer.setId(++currentId); customers.put(customer.getId(), customer); return Response.ok().type("application/xml").entity(customer).build(); } /** * This method is mapped to an HTTP DELETE of 'http://localhost:8181/cxf/crm/customerservice/customers/{id}'. The value for * {id} will be passed to this message as a parameter, using the @PathParam annotation. *

* The method uses the Response class to create the HTTP response: either HTTP Status 200/OK if the customer object was * successfully removed from the local data map or a HTTP Status 304/Not Modified if it failed to remove the object. */ @DELETE @Path("/customers/{id}/") @ApiOperation(value = "Delete Customer") @ApiResponses(value = { @ApiResponse(code = 500, message = "Invalid ID supplied"), @ApiResponse(code = 204, message = "Customer not found") }) public Response deleteCustomer(@ApiParam(value = "ID of Customer to delete", required = true) @PathParam("id") String id) { System.out.println("----invoking deleteCustomer, Customer id is: " + id); long idNumber = Long.parseLong(id); Customer c = customers.get(idNumber); Response r; if (c != null) { r = Response.ok().build(); customers.remove(idNumber); } else { r = Response.notModified().build(); } return r; } /** * This method is mapped to an HTTP GET of 'http://localhost:8181/cxf/crm/customerservice/orders/{id}'. The value for * {id} will be passed to this message as a parameter, using the @PathParam annotation. *

* The method returns an Order object - the class for that object includes a few more JAX-RS annotations, allowing it to * display one of these two outputs, depending on the actual URI path being used: * - display the order information itself in XML format * - display details about a product in the order in XML format in a path relative to the URI defined here */ @Path("/orders/{orderId}/") public Order getOrder(@PathParam("orderId") String orderId) { System.out.println("----invoking getOrder, Order id is: " + orderId); long idNumber = Long.parseLong(orderId); Order c = orders.get(idNumber); return c; } /** * The init method is used by the constructor to insert a Customer and Order object into the local data map * for testing purposes. */ final void init() { Customer c = new Customer(); c.setName("John"); c.setId(123); customers.put(c.getId(), c); Order o = new Order(); o.setDescription("order 223"); o.setId(223); orders.put(o.getId(), o); } } ================================================ FILE: examples/cxf/cxf-jaxrs-blueprint/src/main/java/org/apache/servicemix/examples/cxf/jaxrs/Order.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.jaxrs; import java.util.HashMap; import java.util.Map; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "Order") public class Order { private long id; private String description; private Map products = new HashMap(); public Order() { init(); } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String d) { this.description = d; } @GET @Path("products/{productId}/") @Produces("application/xml") public Product getProduct(@PathParam("productId")int productId) { System.out.println("----invoking getProduct with id: " + productId); Product p = products.get(new Long(productId)); return p; } final void init() { Product p = new Product(); p.setId(323); p.setDescription("product 323"); products.put(p.getId(), p); } } ================================================ FILE: examples/cxf/cxf-jaxrs-blueprint/src/main/java/org/apache/servicemix/examples/cxf/jaxrs/Product.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.jaxrs; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "Product") public class Product { private long id; private String description; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String d) { this.description = d; } } ================================================ FILE: examples/cxf/cxf-jaxrs-blueprint/src/main/java/org/apache/servicemix/examples/cxf/jaxrs/client/Client.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.jaxrs.client; import java.io.File; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.net.URL; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.FileRequestEntity; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.RequestEntity; public final class Client { private Client() { } public static void main(String args[]) throws Exception { // Sent HTTP GET request to query all customer info // Sent HTTP GET request to query customer info System.out.println("Sent HTTP GET request to query customer info"); URL url = new URL("http://localhost:8181/cxf/crm/customerservice/customers/123"); InputStream in = url.openStream(); System.out.println(getStringFromInputStream(in)); // Sent HTTP GET request to query sub resource product info System.out.println("\n"); System.out.println("Sent HTTP GET request to query sub resource product info"); url = new URL("http://localhost:8181/cxf/crm/customerservice/orders/223/products/323"); in = url.openStream(); System.out.println(getStringFromInputStream(in)); // Sent HTTP PUT request to update customer info System.out.println("\n"); System.out.println("Sent HTTP PUT request to update customer info"); Client client = new Client(); String inputFile = client.getClass().getResource("update_customer.xml").getFile(); File input = new File(inputFile); PutMethod put = new PutMethod("http://localhost:8181/cxf/crm/customerservice/customers"); RequestEntity entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1"); put.setRequestEntity(entity); HttpClient httpclient = new HttpClient(); try { int result = httpclient.executeMethod(put); System.out.println("Response status code: " + result); System.out.println("Response body: "); System.out.println(put.getResponseBodyAsString()); } finally { // Release current connection to the connection pool once you are // done put.releaseConnection(); } // Sent HTTP POST request to add customer System.out.println("\n"); System.out.println("Sent HTTP POST request to add customer"); inputFile = client.getClass().getResource("add_customer.xml").getFile(); input = new File(inputFile); PostMethod post = new PostMethod("http://localhost:8181/cxf/crm/customerservice/customers"); post.addRequestHeader("Accept" , "text/xml"); entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1"); post.setRequestEntity(entity); httpclient = new HttpClient(); try { int result = httpclient.executeMethod(post); System.out.println("Response status code: " + result); System.out.println("Response body: "); System.out.println(post.getResponseBodyAsString()); } finally { // Release current connection to the connection pool once you are // done post.releaseConnection(); } System.out.println("\n"); System.exit(0); } private static String getStringFromInputStream(InputStream in) throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); int c = 0; while ((c = in.read()) != -1) { bos.write(c); } in.close(); bos.close(); return bos.toString(); } } ================================================ FILE: examples/cxf/cxf-jaxrs-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/cxf/cxf-jaxrs-blueprint/src/main/resources/org/apache/servicemix/examples/cxf/jaxrs/client/add_customer.xml ================================================ Jack ================================================ FILE: examples/cxf/cxf-jaxrs-blueprint/src/main/resources/org/apache/servicemix/examples/cxf/jaxrs/client/update_customer.xml ================================================ Mary 123 ================================================ FILE: examples/cxf/cxf-jaxws-blueprint/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CXF OSGi HTTP WEB SERVICE ========================= Purpose ------- Create a web service with CXF and expose it through the OSGi HTTP Service. Explanation ----------- The web service is a simple JAX-WS web service called HelloWorld. The interface and the implementation are located in the src/main/java/org/ apache/servicemix/examples/cxf directory of this example. The beans.xml file, located in the src/main/resources/META-INF/spring directory: 1. Imports the configuration files needed to enable CXF and OSGi work together. 2. Configures the web service endpoint as follows: Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-cxf-osgi This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/HelloWorld?wsdl Note, if you use Safari, right click the window and select 'Show Source'. Running a Client ---------------- To run the web client: 1. Open the client.html, which is located in the same directory as this README file, in your favorite browser. 2. Click the Send button to send a request. Once the request has been successfully sent, a response similar to the following should appear in the right-hand panel of the web page: STATUS: 200 Hello John Doe To run the java code client: 1. Change to the /examples/cxf/cxf-osgi directory. 2. Run the following command: mvn compile exec:java If the client request is successful, a response similar to the following should appear in the ServiceMix console: Hello John Doe Changing /cxf servlet alias --------------------------- By default CXF Servlet is assigned a '/cxf' alias. You can change it in a couple of ways a. Add org.apache.cxf.osgi.cfg to the /etc directory and set the 'org.apache.cxf.servlet.context' property, for example: org.apache.cxf.servlet.context=/custom b. Use shell config commands, for example : config:edit org.apache.cxf.osgi config:property-set org.apache.cxf.servlet.context /super config:update B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-cxf-osgi feature by entering the following command in the ServiceMix console: feature:uninstall examples-cxf-osgi 2. Build the example by opening a command prompt, changing directory to examples/cxf-osgi (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-cxf-osgi It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/HelloWorld?wsdl Note, if you use Safari, right click the window and select 'Show Source'. You can try running a client against your service by following the instructions in the "Running a Client" section above. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command at the ServiceMix console: bundle:list At the end of the listing, you should see an entry similar to the following: [170] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF OSGi (4.2.0.0) In this case, the bundle ID is 170. To stop the example, enter the following command at the ServiceMix console: bundle:stop For example: bundle:stop 170 To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-cxf-osgi or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/cxf/cxf-jaxws-blueprint/client.html ================================================ ServiceMix 4 CXF-OSGi Example

ServiceMix 4 CXF-OSGi Example

Welcome to the CXF-OSGi example for ServiceMix 4

Perform a POST into the HTTP binding. This requires JavaScript.

Target: .

================================================ FILE: examples/cxf/cxf-jaxws-blueprint/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples cxf 7.1.0-SNAPSHOT cxf-jaxws-blueprint bundle Apache ServiceMix :: Examples :: CXF JAXWS Blueprint CXF JAXWS example using OSGi and Blueprint org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec org.apache.cxf cxf-core org.apache.cxf cxf-rt-transports-http org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} javax.jws, javax.wsdl, javax.xml.namespace, org.apache.cxf.helpers, org.osgi.service.blueprint, * org.apache.servicemix.examples.cxf org.codehaus.mojo exec-maven-plugin org.apache.servicemix.samples.cxf_osgi.Client false ================================================ FILE: examples/cxf/cxf-jaxws-blueprint/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import java.util.Arrays; import java.util.List; import java.util.Map; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.transport.http.Headers; public class EnableCORSInterceptor extends AbstractPhaseInterceptor { public EnableCORSInterceptor() { super(Phase.PRE_PROTOCOL); } @Override public void handleMessage(Message message) throws Fault { Map> headers = Headers.getSetProtocolHeaders(message); try { //Access-Control-Allow-Origin:* Access-Control-Allow-Methods:POST,GET headers.put("Access-Control-Allow-Origin", Arrays.asList("*")); headers.put("Access-Control-Allow-Methods", Arrays.asList("POST", "GET")); } catch (Exception ce) { throw new Fault(ce); } } } ================================================ FILE: examples/cxf/cxf-jaxws-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // START SNIPPET: service package org.apache.servicemix.examples.cxf; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } // END SNIPPET: service ================================================ FILE: examples/cxf/cxf-jaxws-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // START SNIPPET: service package org.apache.servicemix.examples.cxf; import javax.jws.WebService; @WebService(endpointInterface = "org.apache.servicemix.examples.cxf.HelloWorld") public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return "Hello " + text; } } // END SNIPPET: service ================================================ FILE: examples/cxf/cxf-jaxws-blueprint/src/main/java/org/apache/servicemix/samples/cxf_osgi/Client.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.samples.cxf_osgi; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import org.apache.cxf.helpers.IOUtils; public class Client{ public static void main(String[] args) { try { new Client().sendRequest(); } catch (Exception e) { e.printStackTrace(); } } public void sendRequest() throws Exception { URLConnection connection = new URL("http://localhost:8181/cxf/HelloWorld") .openConnection(); connection.setDoInput(true); connection.setDoOutput(true); OutputStream os = connection.getOutputStream(); // Post the request file. InputStream fis = getClass().getClassLoader().getResourceAsStream("org/apache/servicemix/samples/cxf_osgi/request.xml"); IOUtils.copy(fis, os); // Read the response. InputStream is = connection.getInputStream(); System.out.println("the response is ====> "); System.out.println(IOUtils.toString(is)); } } ================================================ FILE: examples/cxf/cxf-jaxws-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/cxf/cxf-jaxws-blueprint/src/main/resources/org/apache/servicemix/samples/cxf_osgi/request.xml ================================================ John Doe ================================================ FILE: examples/cxf/cxf-osgi/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CXF OSGi HTTP WEB SERVICE ========================= Purpose ------- Create a web service with CXF and expose it through the OSGi HTTP Service. Explanation ----------- The web service is a simple JAX-WS web service called HelloWorld. The interface and the implementation are located in the src/main/java/org/ apache/servicemix/examples/cxf directory of this example. The beans.xml file, located in the src/main/resources/META-INF/spring directory: 1. Imports the configuration files needed to enable CXF and OSGi work together. 2. Configures the web service endpoint as follows: Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: features:install examples-cxf-osgi This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/HelloWorld?wsdl Note, if you use Safari, right click the window and select 'Show Source'. Running a Client ---------------- To run the web client: 1. Open the client.html, which is located in the same directory as this README file, in your favorite browser. 2. Click the Send button to send a request. Once the request has been successfully sent, a response similar to the following should appear in the right-hand panel of the web page: STATUS: 200 Hello John Doe To run the java code client: 1. Change to the /examples/cxf/cxf-osgi directory. 2. Run the following command: mvn compile exec:java If the client request is successful, a response similar to the following should appear in the ServiceMix console: Hello John Doe Changing /cxf servlet alias --------------------------- By default CXF Servlet is assigned a '/cxf' alias. You can change it in a couple of ways a. Add org.apache.cxf.osgi.cfg to the /etc directory and set the 'org.apache.cxf.servlet.context' property, for example: org.apache.cxf.servlet.context=/custom b. Use shell config commands, for example : config:edit org.apache.cxf.osgi config:propset org.apache.cxf.servlet.context /super config:update B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-cxf-osgi feature by entering the following command in the ServiceMix console: features:uninstall examples-cxf-osgi 2. Build the example by opening a command prompt, changing directory to examples/cxf-osgi (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: features:install examples-cxf-osgi It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/HelloWorld?wsdl Note, if you use Safari, right click the window and select 'Show Source'. You can try running a client against your service by following the instructions in the "Running a Client" section above. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command at the ServiceMix console: osgi:list At the end of the listing, you should see an entry similar to the following: [170] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF OSGi (4.2.0.0) In this case, the bundle ID is 170. To stop the example, enter the following command at the ServiceMix console: osgi:stop For example: osgi:stop 170 To uninstall the example, enter one of the following commands in the ServiceMix console: features:uninstall examples-cxf-osgi or osgi:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/cxf/cxf-osgi/client.html ================================================ ServiceMix 4 CXF-OSGi Example

ServiceMix 4 CXF-OSGi Example

Welcome to the CXF-OSGi example for ServiceMix 4

Perform a POST into the HTTP binding. This requires JavaScript.

Target: .

================================================ FILE: examples/cxf/cxf-osgi/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples cxf 7.1.0-SNAPSHOT cxf-osgi bundle Apache ServiceMix :: Examples :: CXF OSGi CXF example using OSGi instead of JBI org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec org.apache.cxf cxf-rt-transports-http commons-io commons-io org.apache.cxf cxf-rt-ws-security org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} javax.jws, javax.wsdl, javax.xml.namespace, org.springframework.beans.factory.config, * org.apache.servicemix.examples.cxf org.codehaus.mojo exec-maven-plugin org.apache.servicemix.samples.cxf_osgi.Client false ================================================ FILE: examples/cxf/cxf-osgi/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import java.util.Arrays; import java.util.List; import java.util.Map; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.transport.http.Headers; public class EnableCORSInterceptor extends AbstractPhaseInterceptor { public EnableCORSInterceptor() { super(Phase.PRE_PROTOCOL); } @Override public void handleMessage(Message message) throws Fault { Map> headers = Headers.getSetProtocolHeaders(message); try { //Access-Control-Allow-Origin:* Access-Control-Allow-Methods:POST,GET headers.put("Access-Control-Allow-Origin", Arrays.asList("*")); headers.put("Access-Control-Allow-Methods", Arrays.asList("POST", "GET")); } catch (Exception ce) { throw new Fault(ce); } } } ================================================ FILE: examples/cxf/cxf-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // START SNIPPET: service package org.apache.servicemix.examples.cxf; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } // END SNIPPET: service ================================================ FILE: examples/cxf/cxf-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // START SNIPPET: service package org.apache.servicemix.examples.cxf; import javax.jws.WebService; @WebService(endpointInterface = "org.apache.servicemix.examples.cxf.HelloWorld") public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return "Hello " + text; } } // END SNIPPET: service ================================================ FILE: examples/cxf/cxf-osgi/src/main/java/org/apache/servicemix/samples/cxf_osgi/Client.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.samples.cxf_osgi; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; import org.apache.commons.io.IOUtils; public class Client{ public static void main(String[] args) { try { new Client().sendRequest(); } catch (Exception e) { e.printStackTrace(); } } public void sendRequest() throws Exception { URLConnection connection = new URL("http://localhost:8181/cxf/HelloWorld") .openConnection(); connection.setDoInput(true); connection.setDoOutput(true); OutputStream os = connection.getOutputStream(); // Post the request file. InputStream fis = getClass().getClassLoader().getResourceAsStream("org/apache/servicemix/samples/cxf_osgi/request.xml"); IOUtils.copy(fis, os); // Read the response. InputStream is = connection.getInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); IOUtils.copy(is, baos); System.out.println("the response is =====>"); System.out.println(baos.toString()); } } ================================================ FILE: examples/cxf/cxf-osgi/src/main/resources/META-INF/spring/beans.xml ================================================ ================================================ FILE: examples/cxf/cxf-osgi/src/main/resources/org/apache/servicemix/samples/cxf_osgi/request.xml ================================================ John Doe ================================================ FILE: examples/cxf/cxf-ws-addressing/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CXF WS-Addressing Example ========================= Purpose ------- Use CXF to create a web service enabled for WS-Addressing and expose it through the OSGi HTTP Service. Explanation ----------- This example is based on the WS-Addressing sample in Apache CXF (http://cxf.apache.org/). There is a more complete explanation of WS-Addressing in that sample's README. The WS-Addressing functionality is implemented as interceptors. It is configured in the beans.xml file, which is located in the src/main/resources/META-INF/spring directory of this example. The configuration can be explained as follows: 1. The following entry adds the addressing interceptors (org.apache. cxf.ws.addressing.MAPAggregator and org.apache.cxf.ws.addressing. soap.MAPCodec) to the inbound and outbound interceptor chains. The interceptors add the appropriate WS-Addressing headers to the SOAP messages and remove them at the service end. 2. The following entry enables WS-Addressing for all services on the bus: In addition, the service WSDL, hello_world_addr.wsdl, includes WS-Addressing configuration as shown below: The WSDL file is located in the src/main/resources/wsdl directory of this example. The various clients send the request.xml file, located in src/main/ resources/org/apache/servicemix/examples/cxf/wsaddressing. It contains SOAP request with some WS-Addressing headers set in it. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: features:install examples-cxf-ws-addressing This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/SoapContext/SoapPort?wsdl Note, if you use Safari, right click the window and select 'Show Source'. Running a Client ---------------- To run the web client: 1. Open the client.html, which is located in the same directory as this README file, in your favorite browser. 2. Click the Send button to send a request. Once the request has been successfully sent, you should receive a SOAP message similar to the following as a response. It should appear in the right-hand panel of the web page: STATUS: 200 http://apache.org/hello_world_soap_http/Greeter/sayHiResponse urn:uuid:4352861b-3451-4ae8-b97f-11f7e2535807 http://www.w3.org/2005/08/addressing/anonymous urn:uuid:10fb2ee6-43db-4d88-a3e5-6316f1763669 Bonjour To run the java code client: 1. Change to the /examples/cxf/cxf-ws-addressing directory. 2. Run the following command: mvn compile exec:java It makes an invocation with WS-Addressing headers and displays, in the ServiceMix console, a response similar to that shown in the web client (see above). Changing /cxf servlet alias --------------------------- By default CXF Servlet is assigned a '/cxf' alias. You can change it in a couple of ways: a. Add org.apache.cxf.osgi.cfg to the /etc directory and set the 'org.apache.cxf.servlet.context' property, for example: org.apache.cxf.servlet.context=/custom b. Use shell config commands, for example: config:edit org.apache.cxf.osgi config:property-set org.apache.cxf.servlet.context /super config:update B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-cxf-ws-addressing feature by entering the following command in the ServiceMix console: feature:uninstall examples-cxf-ws-addressing 2. Build the example by opening a command prompt, changing directory to examples/cxf-ws-addressing (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-cxf-ws-addressing It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/SoapContext/SoapPort?wsdl Note, if you use Safari, right click the window and select 'Show Source'. You can try running a client against your service by following the instructions in the "Running a Client" section above. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command in the ServiceMix console (Note, the text you are typing will intermingle with the output being logged. This is nothing to worry about.): bundle:list At the end of the listing, you should see an entry similar to the following: [171] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF WS-ADDRESSING OSGI (4.2.0) In this case, the bundle ID is 171. To stop the example, enter the following command in the ServiceMix console: bundle:stop For example: bundle:stop 171 To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-cxf-ws-addressing or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/cxf/cxf-ws-addressing/client.html ================================================ ServiceMix 4 CXF-OSGi Example

ServiceMix 4 CXF WS-Addressing Example

Welcome to the CXF WS-Addressing example for ServiceMix 4

Perform a POST into the HTTP binding. This requires JavaScript.

Target: .

================================================ FILE: examples/cxf/cxf-ws-addressing/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples cxf 7.1.0-SNAPSHOT cxf-ws-addressing bundle Apache ServiceMix :: Examples :: CXF WS-Addressing OSGI CXF example using WS-Addressing org.apache.cxf cxf-rt-frontend-jaxws provided org.apache.cxf cxf-rt-transports-http org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec commons-io commons-io org.apache.cxf cxf-codegen-plugin generate-test-sources generate-sources ${project.build.directory}/generated/src/main/java ${basedir}/src/main/resources/wsdl/hello_world_addr.wsdl wsdl2java org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} javax.jws, javax.wsdl, javax.xml.bind, javax.xml.bind.annotation, javax.xml.namespace, javax.xml.soap, javax.xml.transform, javax.xml.ws, javax.xml.ws.handler, javax.xml.ws.handler.soap, META-INF.cxf, org.apache.cxf.bus, org.apache.cxf.bus.spring, org.apache.cxf.bus.resource, org.apache.cxf.configuration.spring, org.apache.cxf.resource, org.apache.cxf.transport.http, org.apache.cxf.feature, org.apache.cxf.interceptor, org.apache.cxf.ws.addressing, org.apache.cxf.ws.addressing.soap, org.apache.cxf.message, org.apache.cxf.phase, org.springframework.beans.factory.config, * org.apache.servicemix.examples.cxf.wsaddressing, org.apache.hello_world_soap_http, org.apache.hello_world_soap_http.types org.codehaus.mojo exec-maven-plugin org.apache.servicemix.examples.cxf.wsaddressing.Client false ================================================ FILE: examples/cxf/cxf-ws-addressing/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import java.util.Arrays; import java.util.List; import java.util.Map; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.transport.http.Headers; public class EnableCORSInterceptor extends AbstractPhaseInterceptor { public EnableCORSInterceptor() { super(Phase.PRE_PROTOCOL); } @Override public void handleMessage(Message message) throws Fault { Map> headers = Headers.getSetProtocolHeaders(message); try { //Access-Control-Allow-Origin:* Access-Control-Allow-Methods:POST,GET headers.put("Access-Control-Allow-Origin", Arrays.asList("*")); headers.put("Access-Control-Allow-Methods", Arrays.asList("POST", "GET")); } catch (Exception ce) { throw new Fault(ce); } } } ================================================ FILE: examples/cxf/cxf-ws-addressing/src/main/java/org/apache/servicemix/examples/cxf/wsaddressing/Client.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.cxf.wsaddressing; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; import org.apache.commons.io.IOUtils; public class Client{ public static void main(String[] args) { try { new Client().sendRequest(); } catch (Exception e) { e.printStackTrace(); } } public void sendRequest() throws Exception { URLConnection connection = new URL("http://localhost:8181/cxf/SoapContext/SoapPort") .openConnection(); connection.setDoInput(true); connection.setDoOutput(true); OutputStream os = connection.getOutputStream(); // Post the request file. InputStream fis = getClass().getClassLoader().getResourceAsStream("org/apache/servicemix/examples/cxf/wsaddressing/request.xml"); IOUtils.copy(fis, os); // Read the response. InputStream is = connection.getInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); IOUtils.copy(is, baos); System.out.println("the response is =====>"); System.out.println(baos.toString()); } } ================================================ FILE: examples/cxf/cxf-ws-addressing/src/main/java/org/apache/servicemix/examples/cxf/wsaddressing/GreeterImpl.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf.wsaddressing; import java.util.logging.Logger; import javax.jws.WebService; import org.apache.hello_world_soap_http.Greeter; import org.apache.hello_world_soap_http.PingMeFault; import org.apache.hello_world_soap_http.types.FaultDetail; @WebService(name = "SoapPort", portName = "SoapPort", serviceName = "SOAPService", targetNamespace = "http://apache.org/hello_world_soap_http", wsdlLocation = "wsdl/hello_world_addr.wsdl") public class GreeterImpl implements Greeter { private static final Logger LOG = Logger.getLogger(GreeterImpl.class.getPackage().getName()); /* (non-Javadoc) * @see org.apache.hello_world_soap_http.Greeter#greetMe(java.lang.String) */ public String greetMe(String me) { LOG.info("Executing operation greetMe"); System.out.println("Executing operation greetMe"); System.out.println("Message received: " + me + "\n"); return "Hello " + me; } /* (non-Javadoc) * @see org.apache.hello_world_soap_http.Greeter#greetMeOneWay(java.lang.String) */ public void greetMeOneWay(String me) { LOG.info("Executing operation greetMeOneWay"); System.out.println("Executing operation greetMeOneWay\n"); System.out.println("Hello there " + me); } /* (non-Javadoc) * @see org.apache.hello_world_soap_http.Greeter#sayHi() */ public String sayHi() { LOG.info("Executing operation sayHi"); System.out.println("Executing operation sayHi\n"); return "Bonjour"; } public void pingMe() throws PingMeFault { FaultDetail faultDetail = new FaultDetail(); faultDetail.setMajor((short)2); faultDetail.setMinor((short)1); LOG.info("Executing operation pingMe, throwing PingMeFault exception"); System.out.println("Executing operation pingMe, throwing PingMeFault exception\n"); throw new PingMeFault("PingMeFault raised by server", faultDetail); } } ================================================ FILE: examples/cxf/cxf-ws-addressing/src/main/resources/META-INF/spring/beans.xml ================================================ ================================================ FILE: examples/cxf/cxf-ws-addressing/src/main/resources/org/apache/servicemix/examples/cxf/wsaddressing/request.xml ================================================ urn:uuid:123456789 http://localhost:8080/SoapContext/SoapPort
http://www.w3.org/2005/08/addressing/anonymous
http://www.w3.org/2005/08/addressing/anonymous
http://apache.org/hello_world_soap_http/Greeter/sayHiRequest
================================================ FILE: examples/cxf/cxf-ws-addressing/src/main/resources/wsdl/hello_world_addr.wsdl ================================================ ================================================ FILE: examples/cxf/cxf-ws-rm/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CXF OSGi HTTP WEB SERVICE ========================= Purpose ------- Create a web service with CXF and ws_rm feature enabled. Explanation ----------- The client and server both apply the reliableMessaging feature to the bus. This ensures installation of the WS-RM interceptors, comprising logical interceptors (RMInInterceptor/RMOutInterceptor) responsible for managing the reliability properties of the current message, and a protocol interceptor (RMSoapInterceptor) responsible for encoding/decoding these properties as SOAP Headers. As WS-RM is dependent on WS-Addressing, the demo uses the same approach as the ws_addressing sample to enable this functionality. However, you may notice that the WS-Addressing namespace URI is different in this case (i.e. http://schemas.xmlsoap.org/ws/2004/08/addressing as opposed to http://www.w3.org/2005/08/addressing). This is because the WS-RM specification is still based on an older version of WS-Addressing. The logging feature is used to log the inbound and outbound SOAP messages and display these to the console. Notice the usage of out-of-band RM protocol messages (CreateSequence and CreateSequenceResponse) and the WS-RM headers in application-level messages (Sequence, SequenceAcknowledgement, AckRequested etc.) Finally, the MessageLossSimulator interceptor is installed on the client-side to simulate message loss by discarding every second application level message. This simulated unreliability allows the retransmission of unacknowledged messages to be observed. This demo also illustrates usage of the decoupled HTTP transport, whereby a separate server->client HTTP connection is used to deliver responses to (application or RM protocol) requests and server side originated standalone acknowledgments. The "partial response" referred to in the log output is the payload of the HTTP 202 Accepted response sent on the back-channel of the original client->server connection. The beans.xml file, located in the src/main/resources/META-INF/spring directory: 1. Imports the configuration files needed to enable CXF and OSGi work together. 2. Configures the web service endpoint as follows: Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-cxf-ws-rm This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Running a Client ---------------- To run the java code client: 1. Change to the /examples/cxf/cxf-ws-rm directory. 2. Run the following command: mvn compile exec:java B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-cxf-ws-rm feature by entering the following command in the ServiceMix console: feature:uninstall examples-cxf-ws-rm 2. Build the example by opening a command prompt, changing directory to examples/cxf-ws-rm (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-cxf-ws-rm It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. You can try running a client against your service by following the instructions in the "Running a Client" section above. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command at the ServiceMix console: bundle:list At the end of the listing, you should see an entry similar to the following: [170] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF WS-RM (4.2.0.0) In this case, the bundle ID is 170. To stop the example, enter the following command at the ServiceMix console: bundle:stop For example: bundle:stop 170 To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-cxf-ws-rm or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/cxf/cxf-ws-rm/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples cxf 7.1.0-SNAPSHOT cxf-ws-rm bundle Apache ServiceMix :: Examples :: CXF WS-RM OSGi CXF example using WS-RM org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec org.apache.cxf cxf-rt-frontend-jaxws org.apache.cxf cxf-rt-transports-http org.apache.cxf cxf-rt-transports-http-jetty org.apache.cxf cxf-rt-ws-rm org.apache.cxf cxf-rt-ws-addr org.apache.cxf cxf-rt-ws-policy org.apache.cxf cxf-core org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} javax.jws, javax.wsdl, javax.xml.ws, javax.xml.namespace, org.apache.cxf, org.apache.cxf.bus.spring, org.apache.cxf.interceptor, org.apache.cxf.io, org.apache.cxf.message, org.apache.cxf.phase, org.apache.cxf.ws.addressing, org.apache.cxf.ws.rm, org.apache.cxf.ws.rm.v200702, org.springframework.beans.factory.config org.apache.servicemix.examples.cxf org.codehaus.mojo exec-maven-plugin org.apache.servicemix.samples.cxf_ws_rm.Client false ================================================ FILE: examples/cxf/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // START SNIPPET: service package org.apache.servicemix.examples.cxf; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } // END SNIPPET: service ================================================ FILE: examples/cxf/cxf-ws-rm/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // START SNIPPET: service package org.apache.servicemix.examples.cxf; import javax.jws.WebService; @WebService(endpointInterface = "org.apache.servicemix.examples.cxf.HelloWorld") public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return "Hello " + text; } } // END SNIPPET: service ================================================ FILE: examples/cxf/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/Client.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.samples.cxf_ws_rm; import java.lang.reflect.UndeclaredThrowableException; import java.net.URL; import java.io.File; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.soap.SOAPBinding; import org.apache.cxf.Bus; import org.apache.cxf.bus.spring.SpringBusFactory; import org.apache.servicemix.examples.cxf.HelloWorld; public final class Client { private static final String USER_NAME = System.getProperty("user.name"); private static final QName SERVICE_NAME = new QName("http://cxf.examples.servicemix.apache.org/", "HelloWorldImplService"); private static final QName PORT_NAME = new QName("http://cxf.examples.servicemix.apache.org/", "HelloWorldImplPort"); private Client() { } public static void main(String args[]) throws Exception { try { SpringBusFactory bf = new SpringBusFactory(); URL busFile = Client.class.getResource("ws_rm.xml"); Bus bus = bf.createBus(busFile.toString()); bf.setDefaultBus(bus); bus.getOutInterceptors().add(new MessageLossSimulator()); // Endpoint Address Service service = Service.create(Client.class.getResource("/HelloWorld.wsdl"), SERVICE_NAME); String endpointAddress = "http://localhost:8181/cxf/HelloWorld"; // Add a port to the Service service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress); HelloWorld hw = service.getPort(HelloWorld.class); String[] names = new String[] {"Anne", "Bill", "Chris", "Daisy"}; // make a sequence of 4 invocations for (int i = 0; i < 4; i++) { System.out.println("Calling HelloWorld service"); System.out.println(hw.sayHi(names[i])); } // allow aynchronous resends to occur Thread.sleep(60 * 1000); bus.shutdown(true); } catch (Exception ex) { ex.printStackTrace(); } finally { System.exit(0); } } } ================================================ FILE: examples/cxf/cxf-ws-rm/src/main/java/org/apache/servicemix/samples/cxf_ws_rm/MessageLossSimulator.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.samples.cxf_ws_rm; import java.io.IOException; import java.io.OutputStream; import java.math.BigInteger; import java.util.ListIterator; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.interceptor.InterceptorChain; import org.apache.cxf.interceptor.MessageSenderInterceptor; import org.apache.cxf.io.AbstractWrappedOutputStream; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.phase.PhaseInterceptor; import org.apache.cxf.ws.addressing.AddressingProperties; import org.apache.cxf.ws.rm.RMContextUtils; /** * */ public class MessageLossSimulator extends AbstractPhaseInterceptor { private static final Logger LOG = Logger.getLogger(MessageLossSimulator.class.getName()); private int appMessageCount; public MessageLossSimulator() { super(Phase.PREPARE_SEND); addBefore(MessageSenderInterceptor.class.getName()); } public void handleMessage(Message message) throws Fault { AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, true); String action = null; if (maps != null && null != maps.getAction()) { action = maps.getAction().getValue(); } if (RMContextUtils.isRMProtocolMessage(action)) { return; } appMessageCount++; // do not discard odd-numbered messages if (0 != (appMessageCount % 2)) { return; } // discard even-numbered message InterceptorChain chain = message.getInterceptorChain(); ListIterator it = chain.getIterator(); while (it.hasNext()) { PhaseInterceptor pi = (PhaseInterceptor)it.next(); if (MessageSenderInterceptor.class.getName().equals(pi.getId())) { chain.remove(pi); LOG.fine("Removed MessageSenderInterceptor from interceptor chain."); break; } } message.setContent(OutputStream.class, new WrappedOutputStream(message)); message.getInterceptorChain().add(new AbstractPhaseInterceptor(Phase.PREPARE_SEND_ENDING) { public void handleMessage(Message message) throws Fault { try { message.getContent(OutputStream.class).close(); } catch (IOException e) { throw new Fault(e); } } }); } private class WrappedOutputStream extends AbstractWrappedOutputStream { private Message outMessage; public WrappedOutputStream(Message m) { this.outMessage = m; } @Override protected void onFirstWrite() throws IOException { if (LOG.isLoggable(Level.FINE)) { Long nr = RMContextUtils.retrieveRMProperties(outMessage, true) .getSequence().getMessageNumber(); LOG.fine("Losing message " + nr); } wrappedStream = new DummyOutputStream(); } } private class DummyOutputStream extends OutputStream { @Override public void write(int b) throws IOException { // TODO Auto-generated method stub } } } ================================================ FILE: examples/cxf/cxf-ws-rm/src/main/resources/HelloWorld.wsdl ================================================ ================================================ FILE: examples/cxf/cxf-ws-rm/src/main/resources/META-INF/spring/beans.xml ================================================ ================================================ FILE: examples/cxf/cxf-ws-rm/src/main/resources/org/apache/servicemix/samples/cxf_ws_rm/ws_rm.xml ================================================ ================================================ FILE: examples/cxf/cxf-ws-security-blueprint/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CXF WS-SECURITY OSGi HTTP WEB SERVICE ========================= Purpose ------- Create a web service with CXF using WS-SECURITY and blueprint configuration, and expose it through the OSGi HTTP Service, then it will leverage cxf JAASLoginInterceptor to authenticate against karaf default jaas configuration. Explanation ----------- The web service is a simple JAX-WS web service with ws-security UsernameToken action called HelloWorldSecurity. The interface and the implementation are located in the src/main/java/org/ apache/servicemix/examples/cxf directory of this example. The blueprint.xml file, located in the src/main/resources/OSGI-INF/blueprint directory: 1. Configures the web service endpoint as follows: This will leverage cxf JAASLoginInterceptor to authenticate against karaf default jaas configuration through property contextName, which store username/password/role in SMX_HOME/etc/users.properties. Users can easily change to use other jaas context(JDBC,LDAP etc) as described from http://karaf.apache.org/manual/2.2.4/developers-guide/security-framework.html. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: features:install examples-cxf-ws-security-blueprint This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/HelloWorldSecurity?wsdl Note, if you use Safari, right click the window and select 'Show Source'. Running a Client ---------------- To run the web client: 1. Open the client.html, which is located in the same directory as this README file, in your favorite browser. 2. Click the Send button to send a request. Once the request has been successfully sent, a response similar to the following should appear in the right-hand panel of the web page: STATUS: 200 Hello John Doe To run the java code client: 1. Change to the /examples/cxf/cxf-ws-security-blueprint directory. 2. Run the following command: mvn compile exec:java If the client request is successful, it will print out Hello ffang Changing /cxf servlet alias --------------------------- By default CXF Servlet is assigned a '/cxf' alias. You can change it in a couple of ways a. Add org.apache.cxf.osgi.cfg to the /etc directory and set the 'org.apache.cxf.servlet.context' property, for example: org.apache.cxf.servlet.context=/custom b. Use shell config commands, for example : config:edit org.apache.cxf.osgi config:property-set org.apache.cxf.servlet.context /super config:update B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-cxf-ws-security-blueprint feature by entering the following command in the ServiceMix console: feature:uninstall examples-cxf-ws-security-blueprint 2. Build the example by opening a command prompt, changing directory to examples/cxf-ws-security-blueprint (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-cxf-ws-security-blueprint It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/HelloWorldSecurity?wsdl Note, if you use Safari, right click the window and select 'Show Source'. You can try running a client against your service by following the instructions in the "Running a Client" section above. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command at the ServiceMix console: bundle:list At the end of the listing, you should see an entry similar to the following: [170] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF WS SECURITY OSGI (4.2.0.0) In this case, the bundle ID is 170. To stop the example, enter the following command at the ServiceMix console: bundle:stop For example: bundle:stop 170 To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-cxf-ws-security-blueprint or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/cxf/cxf-ws-security-blueprint/client.html ================================================ ServiceMix 4 CXF-WS-SECURITY-OSGi Example

ServiceMix 4 CXF-WS-SECURITY-OSGi Example

Welcome to the CXF-WS-SECURITY-OSGi example for ServiceMix 4

Perform a POST into the HTTP binding. This requires JavaScript.

Target: .

================================================ FILE: examples/cxf/cxf-ws-security-blueprint/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples cxf 7.1.0-SNAPSHOT cxf-ws-security-blueprint bundle Apache ServiceMix :: Examples :: CXF WS-Security Blueprint CXF example using WS-Security with Blueprint org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec org.apache.cxf cxf-rt-transports-http org.apache.cxf cxf-rt-ws-security org.apache.cxf cxf-rt-frontend-jaxws org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} javax.jws, javax.xml.bind.annotation, javax.wsdl, org.osgi.service.blueprint, org.apache.cxf.ws.security.wss4j, javax.security.auth.callback, org.apache.wss4j.common.ext, org.apache.cxf.interceptor.security, org.apache.cxf.transport.http, org.apache.cxf, org.apache.cxf.endpoint, org.apache.cxf.frontend, org.apache.cxf.interceptor, org.apache.cxf.jaxws, org.apache.cxf.message, org.apache.cxf.phase org.apache.servicemix.examples.cxf org.codehaus.mojo exec-maven-plugin org.apache.servicemix.examples.cxf.Client false ================================================ FILE: examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/Client.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.cxf; import java.util.HashMap; import java.util.Map; import org.apache.cxf.frontend.ClientProxy; import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; public class Client{ public static void main(String[] args) { try { new Client().sendRequest(); } catch (Exception e) { e.printStackTrace(); } } public void sendRequest() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(HelloWorld.class); factory.setAddress("http://localhost:8181/cxf/HelloWorldSecurity"); HelloWorld client = (HelloWorld) factory.create(); Map outProps = new HashMap(); outProps.put("action", "UsernameToken"); //add a CustomerSecurityInterceptor for client side to init wss4j staff //retrieve and set user/password, users can easily add this interceptor //through spring configuration also ClientProxy.getClient(client).getOutInterceptors().add(new CustomerSecurityInterceptor()); ClientProxy.getClient(client).getOutInterceptors().add(new WSS4JOutInterceptor()); String ret = client.sayHi("ffang"); System.out.println(ret); } } ================================================ FILE: examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/ClientPasswordCallback.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import org.apache.wss4j.common.ext.WSPasswordCallback; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; public class ClientPasswordCallback implements CallbackHandler { public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; if (pc.getIdentifier().equals("smx")) { pc.setPassword("smx"); } } } ================================================ FILE: examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/CustomerSecurityInterceptor.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import java.util.HashMap; import java.util.Map; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; public class CustomerSecurityInterceptor extends AbstractPhaseInterceptor { public CustomerSecurityInterceptor() { super(Phase.SETUP); } public void handleMessage(Message message) throws Fault { Map outProps = new HashMap(); outProps.put("action", "UsernameToken"); outProps.put("passwordType", "PasswordText"); outProps.put("user", "smx"); outProps.put("passwordCallbackClass", "org.apache.servicemix.examples.cxf.ClientPasswordCallback"); for (Interceptor inteceptor : message.getInterceptorChain()) { //set properties for WSS4JOutInterceptor if (inteceptor.getClass().getName().equals("org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor")) { ((WSS4JOutInterceptor)inteceptor).setProperties(outProps); } } } } ================================================ FILE: examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import java.util.Arrays; import java.util.List; import java.util.Map; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.transport.http.Headers; public class EnableCORSInterceptor extends AbstractPhaseInterceptor { public EnableCORSInterceptor() { super(Phase.PRE_PROTOCOL); } @Override public void handleMessage(Message message) throws Fault { Map> headers = Headers.getSetProtocolHeaders(message); try { //Access-Control-Allow-Origin:* Access-Control-Allow-Methods:POST,GET headers.put("Access-Control-Allow-Origin", Arrays.asList("*")); headers.put("Access-Control-Allow-Methods", Arrays.asList("POST", "GET")); } catch (Exception ce) { throw new Fault(ce); } } } ================================================ FILE: examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // START SNIPPET: service package org.apache.servicemix.examples.cxf; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } // END SNIPPET: service ================================================ FILE: examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // START SNIPPET: service package org.apache.servicemix.examples.cxf; import javax.jws.WebService; @WebService(endpointInterface = "org.apache.servicemix.examples.cxf.HelloWorld") public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return "Hello " + text; } } // END SNIPPET: service ================================================ FILE: examples/cxf/cxf-ws-security-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/cxf/cxf-ws-security-blueprint/src/main/resources/log4j.properties ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Root logger option log4j.rootLogger=INFO, stdout # Direct log messages to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n ================================================ FILE: examples/cxf/cxf-ws-security-osgi/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CXF WS-SECURITY OSGi HTTP WEB SERVICE ========================= Purpose ------- Create a web service with CXF using WS-SECURITY and expose it through the OSGi HTTP Service, then it will leverage cxf JAASLoginInterceptor to authenticate against karaf default jaas configuration. Explanation ----------- The web service is a simple JAX-WS web service with ws-security UsernameToken action called HelloWorldSecurity. The interface and the implementation are located in the src/main/java/org/ apache/servicemix/examples/cxf directory of this example. The beans.xml file, located in the src/main/resources/META-INF/spring directory: 1. Configures the web service endpoint as follows: This will leverage cxf JAASLoginInterceptor to authenticate against karaf default jaas configuration through property contextName, which store username/password/role in SMX_HOME/etc/users.properties. Users can easily change to use other jaas context(JDBC,LDAP etc) as described from http://karaf.apache.org/manual/2.2.4/developers-guide/security-framework.html. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: feature:install examples-cxf-ws-security-osgi This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/HelloWorldSecurity?wsdl Note, if you use Safari, right click the window and select 'Show Source'. Running a Client ---------------- To run the web client: 1. Open the client.html, which is located in the same directory as this README file, in your favorite browser. 2. Click the Send button to send a request. Once the request has been successfully sent, a response similar to the following should appear in the right-hand panel of the web page: STATUS: 200 Hello John Doe To run the java code client: 1. Change to the /examples/cxf/cxf-ws-security-osgi directory. 2. Run the following command: mvn compile exec:java If the client request is successful, it will print out Hello ffang Changing /cxf servlet alias --------------------------- By default CXF Servlet is assigned a '/cxf' alias. You can change it in a couple of ways a. Add org.apache.cxf.osgi.cfg to the /etc directory and set the 'org.apache.cxf.servlet.context' property, for example: org.apache.cxf.servlet.context=/custom b. Use shell config commands, for example : config:edit org.apache.cxf.osgi config:property-set org.apache.cxf.servlet.context /super config:update B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-cxf-ws-security-osgi feature by entering the following command in the ServiceMix console: feature:uninstall examples-cxf-ws-security-osgi 2. Build the example by opening a command prompt, changing directory to examples/cxf-ws-security-osgi (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-cxf-ws-security-osgi It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/HelloWorldSecurity?wsdl Note, if you use Safari, right click the window and select 'Show Source'. You can try running a client against your service by following the instructions in the "Running a Client" section above. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command at the ServiceMix console: bundle:list At the end of the listing, you should see an entry similar to the following: [170] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF WS SECURITY OSGI (4.2.0.0) In this case, the bundle ID is 170. To stop the example, enter the following command at the ServiceMix console: bundle:stop For example: bundle:stop 170 To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-cxf-ws-security-osgi or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/cxf/cxf-ws-security-osgi/client.html ================================================ ServiceMix 4 CXF-WS-SECURITY-OSGi Example

ServiceMix 4 CXF-WS-SECURITY-OSGi Example

Welcome to the CXF-WS-SECURITY-OSGi example for ServiceMix 4

Perform a POST into the HTTP binding. This requires JavaScript.

Target: .

================================================ FILE: examples/cxf/cxf-ws-security-osgi/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples cxf 7.1.0-SNAPSHOT cxf-ws-security-osgi bundle Apache ServiceMix :: Examples :: CXF WS-Security OSGi CXF example using WS-Security org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec org.apache.cxf cxf-rt-transports-http org.apache.cxf cxf-rt-ws-security org.apache.cxf cxf-rt-frontend-jaxws org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} javax.jws, javax.xml.bind.annotation, javax.wsdl, org.apache.cxf.ws.security.wss4j, org.springframework.beans.factory.config, javax.security.auth.callback, org.apache.wss4j.common.ext, org.apache.cxf.interceptor.security, org.apache.cxf.transport.http, org.apache.cxf, org.apache.cxf.endpoint, org.apache.cxf.frontend, org.apache.cxf.interceptor, org.apache.cxf.jaxws, org.apache.cxf.message, org.apache.cxf.phase org.apache.servicemix.examples.cxf org.codehaus.mojo exec-maven-plugin org.apache.servicemix.examples.cxf.Client false ================================================ FILE: examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/Client.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.cxf; import java.util.HashMap; import java.util.Map; import org.apache.cxf.frontend.ClientProxy; import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; public class Client{ public static void main(String[] args) { try { new Client().sendRequest(); } catch (Exception e) { e.printStackTrace(); } } public void sendRequest() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(HelloWorld.class); factory.setAddress("http://localhost:8181/cxf/HelloWorldSecurity"); HelloWorld client = (HelloWorld) factory.create(); Map outProps = new HashMap(); outProps.put("action", "UsernameToken"); //add a CustomerSecurityInterceptor for client side to init wss4j staff //retrieve and set user/password, users can easily add this interceptor //through spring configuration also ClientProxy.getClient(client).getOutInterceptors().add(new CustomerSecurityInterceptor()); ClientProxy.getClient(client).getOutInterceptors().add(new WSS4JOutInterceptor()); String ret = client.sayHi("ffang"); System.out.println(ret); } } ================================================ FILE: examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/ClientPasswordCallback.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import org.apache.wss4j.common.ext.WSPasswordCallback; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; public class ClientPasswordCallback implements CallbackHandler { public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; if (pc.getIdentifier().equals("smx")) { pc.setPassword("smx"); } } } ================================================ FILE: examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/CustomerSecurityInterceptor.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import java.util.HashMap; import java.util.Map; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; public class CustomerSecurityInterceptor extends AbstractPhaseInterceptor { public CustomerSecurityInterceptor() { super(Phase.SETUP); } public void handleMessage(Message message) throws Fault { Map outProps = new HashMap(); outProps.put("action", "UsernameToken"); outProps.put("passwordType", "PasswordText"); outProps.put("user", "smx"); outProps.put("passwordCallbackClass", "org.apache.servicemix.examples.cxf.ClientPasswordCallback"); for (Interceptor inteceptor : message.getInterceptorChain()) { //set properties for WSS4JOutInterceptor if (inteceptor.getClass().getName().equals("org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor")) { ((WSS4JOutInterceptor)inteceptor).setProperties(outProps); } } } } ================================================ FILE: examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import java.util.Arrays; import java.util.List; import java.util.Map; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.transport.http.Headers; public class EnableCORSInterceptor extends AbstractPhaseInterceptor { public EnableCORSInterceptor() { super(Phase.PRE_PROTOCOL); } @Override public void handleMessage(Message message) throws Fault { Map> headers = Headers.getSetProtocolHeaders(message); try { //Access-Control-Allow-Origin:* Access-Control-Allow-Methods:POST,GET headers.put("Access-Control-Allow-Origin", Arrays.asList("*")); headers.put("Access-Control-Allow-Methods", Arrays.asList("POST", "GET")); } catch (Exception ce) { throw new Fault(ce); } } } ================================================ FILE: examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // START SNIPPET: service package org.apache.servicemix.examples.cxf; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } // END SNIPPET: service ================================================ FILE: examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // START SNIPPET: service package org.apache.servicemix.examples.cxf; import javax.jws.WebService; @WebService(endpointInterface = "org.apache.servicemix.examples.cxf.HelloWorld") public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return "Hello " + text; } } // END SNIPPET: service ================================================ FILE: examples/cxf/cxf-ws-security-osgi/src/main/resources/META-INF/spring/beans.xml ================================================ ================================================ FILE: examples/cxf/cxf-ws-security-osgi/src/main/resources/log4j.properties ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Root logger option log4j.rootLogger=INFO, stdout # Direct log messages to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n ================================================ FILE: examples/cxf/cxf-ws-security-signature/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CXF WS-SECURITY OSGi HTTP WEB SERVICE ========================= Purpose ------- Create a web service with CXF using WS-SECURITY Signature action and expose it through the OSGi HTTP Service, the main purpose is to demonstrate how to use signaturePropRefId WSS4J configuration in OSGi container. Explanation ----------- The web service is a simple JAX-WS web service with ws-security Signature and UsernameToken action called HelloWorldSecurity. The interface and the implementation are located in the src/main/java/org/ apache/servicemix/examples/cxf directory of this example. The beans.xml file, located in the src/main/resources/META-INF/spring directory: 1. Configures the web service endpoint as follows: org.apache.ws.security.components.crypto.Merlin jks storepassword server-truststore.jks Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, enter the following command in the ServiceMix console: features:install examples-cxf-ws-security-signature This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/HelloWorldSecurity?wsdl Note, if you use Safari, right click the window and select 'Show Source'. Running a Client ---------------- To run the java code client: 1. Change to the /examples/cxf/cxf-ws-security-signature directory. 2. Run the following command: mvn compile exec:java If the client request is successful, it will print out Hello CXF Changing /cxf servlet alias --------------------------- By default CXF Servlet is assigned a '/cxf' alias. You can change it in a couple of ways a. Add org.apache.cxf.osgi.cfg to the /etc directory and set the 'org.apache.cxf.servlet.context' property, for example: org.apache.cxf.servlet.context=/custom b. Use shell config commands, for example : config:edit org.apache.cxf.osgi config:property-set org.apache.cxf.servlet.context /super config:update B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the examples-cxf-ws-security-signature feature by entering the following command in the ServiceMix console: feature:uninstall examples-cxf-ws-security-signature 2. Build the example by opening a command prompt, changing directory to examples/cxf-ws-security-signature (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: feature:install examples-cxf-ws-security-signature It makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. To view the service WSDL, open your browser and go to the following URL: http://localhost:8181/cxf/HelloWorldSecurity?wsdl Note, if you use Safari, right click the window and select 'Show Source'. You can try running a client against your service by following the instructions in the "Running a Client" section above. Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle ID that ServiceMix has assigned to it. To get the bundle ID, enter the following command at the ServiceMix console: bundle:list At the end of the listing, you should see an entry similar to the following: [170] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF WS SECURITY OSGI (4.2.0.0) In this case, the bundle ID is 170. To stop the example, enter the following command at the ServiceMix console: bundle:stop For example: bundle:stop 170 To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-cxf-ws-security-signature or bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/cxf/cxf-ws-security-signature/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples cxf 7.1.0-SNAPSHOT cxf-ws-security-signature bundle Apache ServiceMix :: Examples :: CXF WS-Security Signature OSGi CXF example using WS-Security Signature Action org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec commons-io commons-io org.apache.cxf cxf-rt-ws-security org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} javax.jws, javax.xml.bind.annotation, javax.xml.namespace, javax.wsdl, org.apache.cxf.bus, org.apache.cxf.bus.spring, org.apache.cxf.bus.resource, org.apache.cxf.configuration.spring, org.apache.cxf.resource, org.apache.cxf.transport.http, org.apache.cxf.ws.security.wss4j, org.springframework.beans.factory.config, javax.security.auth.callback, org.apache.wss4j.common.ext, org.apache.cxf.binding.soap.saaj, org.apache.commons.io org.apache.servicemix.examples.cxf org.codehaus.mojo exec-maven-plugin org.apache.servicemix.examples.cxf.Client false ================================================ FILE: examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/Client.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.cxf; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; import org.apache.commons.io.IOUtils; public class Client{ public static void main(String[] args) { try { new Client().sendRequest(); } catch (Exception e) { e.printStackTrace(); } } public void sendRequest() throws Exception { URLConnection connection = new URL("http://localhost:8181/cxf/HelloWorldSecurity") .openConnection(); connection.setDoInput(true); connection.setDoOutput(true); OutputStream os = connection.getOutputStream(); // Post the request file. InputStream fis = getClass().getClassLoader().getResourceAsStream("org/apache/servicemix/examples/cxf/request.xml"); IOUtils.copy(fis, os); // Read the response. InputStream is = connection.getInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); IOUtils.copy(is, baos); System.out.println("the response is =====>"); System.out.println(baos.toString()); } } ================================================ FILE: examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; @WebService(name = "HelloWorld", targetNamespace = "http://cxf.apache.org/wsse/handler/helloworld") public interface HelloWorld { @WebMethod String sayHello(@WebParam(name = "toWhom") String to); } ================================================ FILE: examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; @WebService(name = "HelloWorld", targetNamespace = "http://cxf.apache.org/wsse/handler/helloworld", endpointInterface = "org.apache.servicemix.examples.cxf.HelloWorld") public class HelloWorldImpl implements HelloWorld { @WebMethod public String sayHello(@WebParam(name = "toWhom") String toWhom) { return "Hello " + toWhom; } } ================================================ FILE: examples/cxf/cxf-ws-security-signature/src/main/java/org/apache/servicemix/examples/cxf/ServerPasswordCallback.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.servicemix.examples.cxf; import org.apache.wss4j.common.ext.WSPasswordCallback; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; public class ServerPasswordCallback implements CallbackHandler { public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; if (pc.getIdentifier().equals("clientx509v1")) { pc.setPassword("storepassword"); } } } ================================================ FILE: examples/cxf/cxf-ws-security-signature/src/main/resources/META-INF/spring/beans.xml ================================================ org.apache.ws.security.components.crypto.Merlin jks storepassword server-truststore.jks ================================================ FILE: examples/cxf/cxf-ws-security-signature/src/main/resources/org/apache/servicemix/examples/cxf/request.xml ================================================ MIICNjCCAZ8CBEo1POgwDQYJKoZIhvcNAQEEBQAwYjELMAkGA1UEBhMCSU4xCzAJBgNVBAgTAk1QMQ8wDQYDVQQHEwZJTkRPUkUxDzANBgNVBAoTBkFwYWNoZTEMMAoGA1UECxMDRGV2MRYwFAYDVQQDEw1NYXlhbmsgTWlzaHJhMB4XDTA5MDYxNDE4MDk0NFoXDTE5MDYxMjE4MDk0NFowYjELMAkGA1UEBhMCSU4xCzAJBgNVBAgTAk1QMQ8wDQYDVQQHEwZJTkRPUkUxDzANBgNVBAoTBkFwYWNoZTEMMAoGA1UECxMDRGV2MRYwFAYDVQQDEw1NYXlhbmsgTWlzaHJhMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdPhcimx7/CFX4H8isKEKCbRK6Kr+qeCMCby9I/Q/NY1bNqy6nsD+Y5BxSc2yCUnyLsRdmAHIxUwRQ9X5s8FP9+T1nwuoPzBvjcoZqWgDhe9RvydkijuzsFan/PY4oemd5EIoQu80ZpcFqb00xyDY3DkPgymXNsZ2uAM1ccsx90QIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAGXIE7pFNInlyjHnq89zgvHJfZNE44El6Cd5V55JvL+LZUnynU2Y8WaUwD2Qvc1QTr9R7u6nhZ8abyB7TSx3idiN6KUSNtBHOeWUTmfGbAJqO/J6R2A9J20KCvss28D05rRI3z52VQHnMBzgirL6M5ClWBZfl2Q3bNKnOImjoNhKkK3EYmWcAMgQmq0d+yhzRuG4Myg=H0MlO30M1NNQ1M8h1CYvRxWpCKYH9qTkRDpsIZCIdAkjW5lQlWNQ7svUCKpZZzo+dFlS/JeU1dHIXVp7JxB+dLiRBMuuJ4Z4ONwzsBA03Kx+/jNYc3aScLRwW85DMTaVnTqHLIPoO4uhJyUfKicOF3/BHp1A+Ctj5zeBb0LmIN8=clientx509v1storepasswordCXF ================================================ FILE: examples/cxf/cxf-wsn/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ CXF WSN ======= Purpose ------- Deploying a web service notification service using cxf-wsn and a push subscription client. Explanation ----------- The example uses the notification broker provided by the cxf-wsn bundle. In this case, e-mail messages received by the broker, will be send to the consumers who subscribed to this service. The example exists of four main modules: - CXF-WSN-BASE: this module provides the Email class and some files for the JAXB (un)marshall actions. - CXF-WSN-CLIENT: here you can find a standalone client with a subscription and a notify feature. - CXF-WSN-RECEIVER: this camel route subscribes to the corresponding topic and logs all mail messages. - CXF-WSN-NOTIFIER: The notifier contains a camel route which sends a random spam message to the notification broker every 5 seconds. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 2.2.1 or higher For more information, see the README in the top-level examples directory. 2. This example requires some additional configuration to allow the JVM to use more PermGen memory: export JAVA_MAX_PERM_MEM=128m (on UNIX) set JAVA_MAX_PERM_MEM=128m (on Windows) 3. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- You can run the example in two ways: - A. Using a Prebuilt Deployment Bundle: Quick and Easy This option is useful if you want to see the example up and running as quickly as possible. - B. Building the Example Bundle Yourself This option is useful if you want to change the example in any way. It tells you how to build and deploy the example. This option might be slower than option A because, if you do not already have the required bundles in your local Maven repository, Maven will have to download the bundles it needs. A. Using a Prebuilt Deployment Bundle: Quick and Easy ----------------------------------------------------- To install and run a prebuilt version of this example, create the following config file: /etc/org.apache.cxf.wsn.cfg With the following lines: cxf.wsn.activemq.username=smx cxf.wsn.activemq.password=smx Head back to the ServiceMix console and enter the following commands: feature:install examples-cxf-wsn-receive This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. Running the standalone Client ----------------------------- To run the java code client: 1. Change to the /examples/cxf/cxf-wsn/cxf-wsn-client/ directory. 2. Run the following command: mvn compile exec:java If the client request is successful, you will see the following output: From: standalone@client.com To: you@gotmail.com Subject: This is the standalone client speaking Body: This thing works! Running the notifier -------------------- 1. To run the notifier head back to the ServiceMix console and enter the following commands: feature:install examples-cxf-wsn-notifier This command makes use of the ServiceMix features facility. For more information about the features facility, see the README.txt file in the examples parent directory. 2. The notifier sends a spam message every 5 seconds. You can view the messages in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display 3. If the installation of the notifier is successful, you will see the random spam messages in the log output. For example: ### YOU GOT MAIL #### From: gold@theshinymarket.com To: you@mail.com Subject: Buy cheap gold now!? Please send us your credit card number and receive gold at very cheap prices! B. Building the Example Bundle Yourself --------------------------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. If you have already run the example using the prebuilt version as described above, you must first uninstall the previous features by entering the following command in the ServiceMix console: feature:uninstall examples-cxf-wsn-receive feature:uninstall examples-cxf-wsn-notifier 2. Build the example by opening a command prompt, changing directory to examples/cxf/cxf-wsn (this example) and entering the following Maven command: mvn install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. To install the example, follow the 'Using a Prebuilt Deployment Bundle' instructions Stopping and Uninstalling the Example ------------------------------------- To stop the example, you must first know the bundle IDs that ServiceMix has assigned to it. To get the bundle IDs, enter the following command at the ServiceMix console: bundle:list At the end of the listing, you should see an entry similar to the following: [ 172] [Active ] [ ] [ ] [ 80] cxf-wsn-base (5.0.0.SNAPSHOT) [ 173] [Active ] [Created ] [ ] [ 80] cxf-wsn-receive (5.0.0.SNAPSHOT) [ 174] [Active ] [Created ] [ ] [ 80] cxf-wsn-notifier (5.0.0.SNAPSHOT) In this case, the bundle IDs are 172,173 and 174. To stop the example, enter the following command for every bundle at the ServiceMix console: bundle:stop For example: bundle:stop 172 bundle:stop 173 bundle:stop 174 To uninstall the example, enter one of the following commands in the ServiceMix console: feature:uninstall examples-cxf-wsn-receive feature:uninstall examples-cxf-wsn-notifier or for every bundle: bundle:uninstall Viewing the Log Entries ----------------------- You can view the entries in the log file in the data/log directory of your ServiceMix installation, or by typing the following command in the ServiceMix console: log:display ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-base/pom.xml ================================================ cxf-wsn org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 cxf-wsn-base Apache ServiceMix :: Examples :: CXF WSN :: Base bundle org.apache.felix maven-bundle-plugin org.apache.servicemix.examples.cxf.base ${project.artifactId} ${project.description} ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-base/src/main/java/org/apache/servicemix/examples/cxf/base/Email.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.cxf.base; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name ="email", namespace = "urn:org.apache.servicemix:wsn") public class Email { private String from,to,subject,body; public Email() { } public Email(String from, String to, String subject, String body) { this.body = body; this.from = from; this.to = to; this.subject = subject; } public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } public String getTo() { return to; } public void setTo(String to) { this.to = to; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } @Override public String toString() { return "Email{" + "from='" + from + '\'' + ", to='" + to + '\'' + ", subject='" + subject + '\'' + ", body='" + body + '\'' + '}'; } } ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-base/src/main/java/org/apache/servicemix/examples/cxf/base/package-info.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @XmlSchema( namespace = "urn:org.apache.servicemix:wsn", elementFormDefault = XmlNsForm.QUALIFIED) package org.apache.servicemix.examples.cxf.base; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlSchema; ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-base/src/main/resources/org/apache/servicemix/examples/cxf/base/jaxb.index ================================================ # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with this # work for additional information regarding copyright ownership. The ASF # licenses this file to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. Email ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-client/pom.xml ================================================ cxf-wsn org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 cxf-wsn-client Apache ServiceMix :: Examples :: CXF WSN :: Client org.apache.cxf cxf-rt-frontend-jaxws org.apache.cxf cxf-rt-transports-http org.apache.cxf cxf-rt-transports-http-jetty org.apache.cxf cxf-rt-ws-addr org.apache.cxf cxf-rt-ws-policy org.apache.cxf.services.wsn cxf-services-wsn-core org.apache.servicemix.examples cxf-wsn-base ${project.version} org.codehaus.mojo exec-maven-plugin org.apache.servicemix.examples.cxf.client.Client true org.slf4j slf4j-api ${slf4j.version} org.slf4j slf4j-jdk14 ${slf4j.version} ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-client/src/main/java/org/apache/servicemix/examples/cxf/client/Client.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.cxf.client; import org.apache.servicemix.examples.cxf.base.Email; import org.w3c.dom.Element; import org.apache.cxf.wsn.client.Consumer; import org.apache.cxf.wsn.client.NotificationBroker; import org.apache.cxf.wsn.client.Subscription; import org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType; public final class Client { private Client() { //not constructed } /** * @param args */ public static void main(String[] args) throws Exception { final String topic = "MyTopic"; final String mailNs = "urn:org.apache.servicemix:wsn"; String wsnPort = "8182"; if (args.length > 0) { wsnPort = args[0]; } // Start a consumer that will listen for notification messages // We'll print the email fields out. Consumer consumer = new Consumer(new Consumer.Callback() { public void notify(NotificationMessageHolderType message) { Object o = message.getMessage().getAny(); if (o instanceof Element) { Element e = (Element)o; System.out.println(); System.out.println("From: "+e.getElementsByTagNameNS(mailNs,"from").item(0).getTextContent()); System.out.println("To: "+e.getElementsByTagNameNS(mailNs,"to").item(0).getTextContent()); System.out.println("Subject: "+e.getElementsByTagNameNS(mailNs,"subject").item(0).getTextContent()); System.out.println("Body: "+e.getElementsByTagNameNS(mailNs,"body").item(0).getTextContent()); System.out.println(); }else { System.out.println(o); } } }, "http://localhost:9001/MyConsumer"); // Create a subscription for a Topic on the broker NotificationBroker notificationBroker = new NotificationBroker("http://localhost:" + wsnPort + "/wsn/NotificationBroker",Email.class); Subscription subscription = notificationBroker.subscribe(consumer, topic); // Create new email object to send Email mail = new Email("standalone@client.com","you@gotmail.com","This is the standalone client speaking","This thing works!"); // Send a notification on the Topic notificationBroker.notify(topic,mail); // Just sleep for a bit to make sure the notification gets delivered Thread.sleep(5000); // Cleanup and exit subscription.unsubscribe(); consumer.stop(); System.exit(0); } } ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-notifier/pom.xml ================================================ cxf-wsn org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 cxf-wsn-notifier Apache ServiceMix :: Examples :: CXF WSN :: Notifier bundle org.apache.felix maven-bundle-plugin org.apache.servicemix.examples.cxf.base,* ${project.artifactId} ${project.description} org.apache.cxf.services.wsn cxf-services-wsn-core ${cxf-version} org.osgi org.osgi.core org.apache.servicemix.examples cxf-wsn-base ${project.version} ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-notifier/src/main/java/org/apache/servicemix/examples/cxf/notifier/Notifier.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.cxf.notifier; import org.apache.cxf.wsn.client.NotificationBroker; import org.apache.servicemix.examples.cxf.base.Email; import org.osgi.framework.ServiceReference; public class Notifier { private NotificationBroker notificationBroker; private String topic; public void setTopic(String topic) { this.topic = topic; } public void setNotificationBroker(ServiceReference reference) { this.notificationBroker = new NotificationBroker((String)reference.getProperty("address"),Email.class); } public void emailNotify(Email email){ notificationBroker.notify(topic,email); } } ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-notifier/src/main/java/org/apache/servicemix/examples/cxf/notifier/SpamGenerator.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.cxf.notifier; import org.apache.servicemix.examples.cxf.base.Email; import java.util.Random; public class SpamGenerator { private Email[] spam; private Random random; public void init(){ random = new Random(); spam = new Email[3]; String youradress = "you@mail.com"; spam[0] = new Email("free@cookieman.com",youradress,"Free Cookies!","Send us 10 dollar for a FREE basket full of delicious cookies!"); spam[1] = new Email("youwon@lottery.com",youradress,"You are a WINNER!","You won the jackpot 100.000.000, please claim your price at our HQ in Atlantis."); spam[2] = new Email("gold@theshinymarket.com",youradress,"Buy cheap gold now!","Please send us your credit card number and receive gold at very cheap prices!"); } public Email spamMessage(){ return spam[random.nextInt(spam.length)]; } } ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-notifier/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-receive/pom.xml ================================================ cxf-wsn org.apache.servicemix.examples 7.1.0-SNAPSHOT 4.0.0 cxf-wsn-receive Apache ServiceMix :: Examples :: CXF WSN :: Receive bundle org.apache.felix maven-bundle-plugin ${project.artifactId} ${project.description} org.apache.servicemix.examples.cxf.base,* org.apache.cxf.services.wsn cxf-services-wsn-core ${cxf-version} org.osgi org.osgi.core ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-receive/src/main/java/org/apache/servicemix/examples/cxf/receive/Subscriber.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.cxf.receive; import org.apache.cxf.wsn.client.NotificationBroker; import org.apache.cxf.wsn.client.Subscription; import org.osgi.framework.ServiceReference; import javax.xml.transform.dom.DOMSource; public class Subscriber { private String endPoint; private Subscription subscription; private NotificationBroker notificationBroker; private String topic; private DOMSource lala; public Subscriber() { } public void setEndPoint(String endPoint) { this.endPoint = endPoint; } public void setNotificationBroker(ServiceReference reference) { this.notificationBroker = new NotificationBroker((String)reference.getProperty("address")); } public void setTopic(String topic) { this.topic = topic; } public void init() throws Exception { subscription = notificationBroker.subscribe(new Subscription(endPoint),topic); } public void destroy() throws Exception { subscription.unsubscribe(); } } ================================================ FILE: examples/cxf/cxf-wsn/cxf-wsn-receive/src/main/resources/OSGI-INF/blueprint/blueprint.xml ================================================ //emailns:email ================================================ FILE: examples/cxf/cxf-wsn/pom.xml ================================================ 4.0.0 cxf-wsn-client cxf-wsn-receive cxf-wsn-notifier cxf-wsn-base org.apache.servicemix.examples cxf 7.1.0-SNAPSHOT cxf-wsn pom Apache ServiceMix :: Examples :: CXF WSN CXF example using WSN ${cxf.version} ================================================ FILE: examples/cxf/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples examples 7.1.0-SNAPSHOT org.apache.servicemix.examples cxf pom Apache ServiceMix :: Examples :: CXF cxf-osgi cxf-jaxrs cxf-jaxws-blueprint cxf-jaxrs-blueprint cxf-ws-addressing cxf-ws-security-osgi cxf-ws-security-blueprint cxf-ws-rm cxf-ws-security-signature cxf-wsn ================================================ FILE: examples/drools/drools-camel-blueprint/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Drools 6 Camel Example ========================== Purpose ------- This example will show you how to use Drools 6 inside Apache ServiceMix and how to use blueprint with camel routes. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 3.0.2 or higher (for building) For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. Before being able to run this example, you have to install some additional features into the container first to add support for the Drools 6. feature:install kie-camel feature:install kie-aries-blueprint 2. Build the example by opening a command prompt, changing directory to examples/drools/drools-simple (this example) and entering the following Maven command: mvn clean install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: bundle:install -s mvn:org.apache.servicemix.examples/drools-camel/${project.version} 4. Once the bundle has been started, you will see on server logs events from rule engine. Timer on camel route periodically create random facts and fire rule engine. Rules engine operation can be seen in the server log file. ==>[ActivationCreatedEvent: getActivation()=[[ Customer NORMAL active=false ] [ [fact 0 :1:1761378644:1761378644:1:DEFAULT:NON_TRAIT:Customer [salary=5796, type=null]] ] ], getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl@675f2d51] ==>[BeforeActivationFiredEvent: getActivation()=[[ Customer NORMAL active=false ] [ [f act 0:1:1761378644:1761378644:1:DEFAULT:NON_TRAIT:Customer [salary=5796, type=null]] ] ], getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl@675f2d51] ==>[ObjectUpdatedEventImpl: getFactHandle()=[fact 0:1:1761378644:17613786 44:2:DEFAULT:NON_TRAIT:Customer [salary=5796, type=NORMAL]], getObject()=Customer [salary=5796, type=NORMAL], getOldObject()=Customer [salary=5796, type=NORMAL], getKnowledgeRuntime()=org.drools.core.impl.Stateful KnowledgeSessionImpl@675f2d51, getPropagationContext()=PhreakPropagationContext [entryPoint=EntryPoint::DEFAULT, factHandle=[fact 0:1:1761378644:1761378644:2:DEFAULT:NON_TRAIT:Customer [salary=5796, type=NORMAL]], leftTuple=[[ Customer NORMAL active=false ] [ [fact 0:1:1761378644:1761378644:2:DEFAULT:NON_TRAIT:Customer [salary=5796, type=NORMAL]] ] ], originOffset=-1, propagationNumber=3, rule=[Rule name=Customer NORMAL, agendaGroup=MAIN, salience=0, no-loop=false], type=2]] Stopping and Uninstalling the Example ------------------------------------- First, find the bundle id for the deployed example bundle by doing bundle:list and looking for a line that looks like this one 229 | Active | 80 | | Apache ServiceMix :: Examples :: Drools :: Camel In the above case, the bundle id would be 229 To stop the example, enter the following command in the ServiceMix console: bundle:stop To uninstall the example, enter one of the following commands in the ServiceMix console: bundle:uninstall ================================================ FILE: examples/drools/drools-camel-blueprint/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples drools 7.1.0-SNAPSHOT drools-camel-blueprint Apache ServiceMix :: Examples :: Drools :: Camel Blueprint bundle org.apache.servicemix.examples.drools.camel.blueprint.osgi, org.apache.servicemix.examples.drools.camel.blueprint.model org.slf4j;version="[1.6,2)", org.apache.camel;version="[2.16,2.17)", org.kie.api.*;version="[6.0,7)", org.kie.aries.blueprint.factorybeans;version="[6.0,7)", org.kie.internal.command;version="[6.0,7)", org.drools.core.command.runtime.rule;version="[6.0,7)", org.drools.core.impl;version="[6.0,7)", org.osgi.service.blueprint, org.kie kie-api org.drools drools-core org.drools drools-compiler org.drools drools-osgi-integration org.apache.felix org.apache.felix.framework org.apache.camel camel-core org.apache.felix maven-bundle-plugin ================================================ FILE: examples/drools/drools-camel-blueprint/src/main/java/org/apache/servicemix/examples/drools/camel/blueprint/model/Customer.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.blueprint.model; public class Customer { /** * Salary */ private int salary; /** * IS VIP. */ private CustomerType type; /** * Create customer with salary. * * @param salary */ public Customer(int salary) { this.salary = salary; } /** * @return the salary */ public int getSalary() { return salary; } /** * @return the type */ public CustomerType getType() { return type; } /** * @param salary the salary to set */ public void setSalary(int salary) { this.salary = salary; } /** * @param type the type to set */ public void setType(CustomerType type) { this.type = type; } /** * @see Object#toString() */ @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Customer [salary=").append(salary).append(", type=") .append(type).append("]"); return builder.toString(); } } ================================================ FILE: examples/drools/drools-camel-blueprint/src/main/java/org/apache/servicemix/examples/drools/camel/blueprint/model/CustomerType.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.blueprint.model; public enum CustomerType { POOR, NORMAL, VIP; } ================================================ FILE: examples/drools/drools-camel-blueprint/src/main/java/org/apache/servicemix/examples/drools/camel/blueprint/osgi/DebugAgendaEventListener.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.blueprint.osgi; import org.kie.api.event.rule.AfterMatchFiredEvent; import org.kie.api.event.rule.AgendaEventListener; import org.kie.api.event.rule.AgendaGroupPoppedEvent; import org.kie.api.event.rule.AgendaGroupPushedEvent; import org.kie.api.event.rule.BeforeMatchFiredEvent; import org.kie.api.event.rule.MatchCancelledEvent; import org.kie.api.event.rule.MatchCreatedEvent; import org.kie.api.event.rule.RuleFlowGroupActivatedEvent; import org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Drools 6 Rule Engine events logger. */ public class DebugAgendaEventListener implements AgendaEventListener { /** * Logger. */ private static final Logger log = LoggerFactory .getLogger(DebugAgendaEventListener.class); /** * @see AgendaEventListener#matchCreated(org.kie.api.event.rule.MatchCreatedEvent) */ @Override public void matchCreated(MatchCreatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#matchCancelled(org.kie.api.event.rule.MatchCancelledEvent) */ @Override public void matchCancelled(MatchCancelledEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeMatchFired(org.kie.api.event.rule.BeforeMatchFiredEvent) */ @Override public void beforeMatchFired(BeforeMatchFiredEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#afterMatchFired(org.kie.api.event.rule.AfterMatchFiredEvent) */ @Override public void afterMatchFired(AfterMatchFiredEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#agendaGroupPopped(org.kie.api.event.rule.AgendaGroupPoppedEvent) */ @Override public void agendaGroupPopped(AgendaGroupPoppedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#agendaGroupPushed(org.kie.api.event.rule.AgendaGroupPushedEvent) */ @Override public void agendaGroupPushed(AgendaGroupPushedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeRuleFlowGroupActivated(org.kie.api.event.rule.RuleFlowGroupActivatedEvent) */ @Override public void beforeRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#afterRuleFlowGroupActivated(org.kie.api.event.rule.RuleFlowGroupActivatedEvent) */ @Override public void afterRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeRuleFlowGroupDeactivated(org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent) */ @Override public void beforeRuleFlowGroupDeactivated( RuleFlowGroupDeactivatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeRuleFlowGroupDeactivated(org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent) */ @Override public void afterRuleFlowGroupDeactivated( RuleFlowGroupDeactivatedEvent event) { log.info("{}", event); } } ================================================ FILE: examples/drools/drools-camel-blueprint/src/main/java/org/apache/servicemix/examples/drools/camel/blueprint/osgi/DebugRuleRuntimeEventListener.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.blueprint.osgi; import org.kie.api.event.rule.ObjectDeletedEvent; import org.kie.api.event.rule.ObjectInsertedEvent; import org.kie.api.event.rule.ObjectUpdatedEvent; import org.kie.api.event.rule.RuleRuntimeEventListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Drools 6 Working memory events. */ public class DebugRuleRuntimeEventListener implements RuleRuntimeEventListener { /** * Logger. */ private static final Logger log = LoggerFactory .getLogger(DebugRuleRuntimeEventListener.class); /** * @see RuleRuntimeEventListener#objectInserted(ObjectInsertedEvent) */ @Override public void objectInserted(ObjectInsertedEvent event) { log.info("objectInserted {}", event); } /** * @see RuleRuntimeEventListener#objectUpdated(org.kie.api.event.rule.ObjectUpdatedEvent) */ @Override public void objectUpdated(ObjectUpdatedEvent event) { log.info("objectUpdated {}", event); } /** * @see RuleRuntimeEventListener#objectDeleted(org.kie.api.event.rule.ObjectDeletedEvent) */ @Override public void objectDeleted(ObjectDeletedEvent event) { log.info("objectDeleted {}", event); } } ================================================ FILE: examples/drools/drools-camel-blueprint/src/main/java/org/apache/servicemix/examples/drools/camel/blueprint/osgi/Utils.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.blueprint.osgi; import java.util.ArrayList; import java.util.List; import java.util.Random; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.servicemix.examples.drools.camel.blueprint.model.Customer; import org.kie.api.command.Command; import org.kie.internal.command.CommandFactory; public class Utils { private static final Random rand = new Random(12345); public Customer customer() { return new Customer(rand.nextInt(9999)); } public void insertAndFireAll(Exchange exchange) { final Message in = exchange.getIn(); final Object body = in.getBody(); final List> commands = new ArrayList>(2); commands.add(CommandFactory.newInsert(body)); commands.add(CommandFactory.newFireAllRules()); Command batch = CommandFactory.newBatchExecution(commands); in.setBody(batch); } } ================================================ FILE: examples/drools/drools-camel-blueprint/src/main/resources/OSGI-INF/blueprint/camel-context.xml ================================================ ================================================ FILE: examples/drools/drools-camel-blueprint/src/main/resources/OSGI-INF/blueprint/kmodule-blueprint.xml ================================================ ================================================ FILE: examples/drools/drools-camel-blueprint/src/main/resources/rule/customer-score.drl ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package rule; import org.apache.servicemix.examples.drools.camel.blueprint.model.Customer; import org.apache.servicemix.examples.drools.camel.blueprint.model.CustomerType; rule "Customer poor" when $c : Customer( salary <= 1000, type == null) then modify( $c ) { setType(CustomerType.POOR) }; end rule "Customer NORMAL" when $c : Customer( salary > 1000, salary <= 9000, type == null ) then modify( $c ) { setType(CustomerType.NORMAL) }; end rule "Customer VIP" when $c : Customer( salary > 9000, type == null) then modify( $c ) { setType(CustomerType.VIP) }; end ================================================ FILE: examples/drools/drools-camel-cxf-server/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Drools 6 Simple Example ========================== Purpose ------- This example will show you how to use Drools 6 inside Apache ServiceMix and how to use rule engine in low level. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 3.0.2 or higher (for building) For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. Before being able to run this example, you have to install some additional features into the container first to add support for the Drools 6. feature:install kie-aries-blueprint feature:install kie-camel feature:install camel-xstream 2. Build the example by opening a command prompt, changing directory to examples/drools/drools-simple (this example) and entering the following Maven command: mvn clean install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: bundle:install -s mvn:org.apache.servicemix.examples/drools-camel-cxf-server/${project.version} 4. Once the bundle has been started, you will see on console logs from rule engine. drools-camel-cxf-server - 6.0.0.SNAPSHOT | objectInserted ==>[ObjectInsertedEventImpl: getFactHandle()=[fact 0:1:109283499:109283499:1:DEFAULT:NON_TRAIT: Customer [salary=3955, type=null]], getObject()=Customer [salary=3955, type=null], getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl@45a5e94a, getPropagationContext()=PhreakPropagationContext [entryPoint=EntryPoint::DEFAULT, factHandle=[fact 0:1:109283499:109283499:1:DEFAULT:NON_TRAIT:Customer [salary=3955, type=null]], leftTuple=null, originOffset=-1, propagationNumber=2, rule=null, type=0]] DroolsRestResult Exchange[ExchangePattern: InOut, BodyType: String, Body: 3955 NORMAL ] Timer on camel route call rest client procedure. Via rest service facts it's inserted to work memory and in logs you can saw drools engine activity 5. You can use a command-line utility, such as curl or Wget, to make the invocations. For example, try using curl as follows: # # Single fact execution: # curl -X POST -T src/test/resources/test-request.xml -H "Content-Type: text/plain" http://localhost:8181/cxf/rest/execute # # Batch execution (multi facts insert): # curl -X POST -T src/test/resources/batch-test-request.xml -H "Content-Type: text/plain" http://localhost:8181/cxf/rest/execute Stopping and Uninstalling the Example ------------------------------------- First, find the bundle id for the deployed example bundle by doing bundle:list and looking for a line that looks like this one 229 | Active | 80 | | Apache ServiceMix :: Examples :: Drools :: Camel CXF Server In the above case, the bundle id would be 229 To stop the example, enter the following command in the ServiceMix console: bundle:stop To uninstall the example, enter one of the following commands in the ServiceMix console: bundle:uninstall ================================================ FILE: examples/drools/drools-camel-cxf-server/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples drools 7.1.0-SNAPSHOT drools-camel-cxf-server Apache ServiceMix :: Examples :: Drools :: Camel CXF Server bundle org.apache.servicemix.examples.drools.camel.cxf.server.osgi, org.apache.servicemix.examples.drools.camel.cxf.server.model org.osgi.service.blueprint, org.slf4j;version="[1.6,2)", org.kie.jax.rs;version="[6.0,7.0)", org.kie.camel.component;version="[6.0,7.0)", org.kie.api.event.rule;version="[6.0,7.0)", org.kie.api.command;version="[6.0,7.0)", org.kie.aries.blueprint.factorybeans;version="[6.0,7.0)", org.apache.camel;version="[2.16,2.17)", org.kie.internal.command;version="[6.0,7)", org.kie.internal.runtime.helper;version="[6.0,7)", org.drools.core.runtime.impl;version="[6.0,7)", org.drools.core.runtime.rule.impl;version="[6.0,7)", org.drools.core.command.runtime.process;version="[6.0,7)", org.drools.core.common;version="[6.0,7)", org.drools.core.command.runtime;version="[6.0,7)", org.drools.core.command.runtime.rule;version="[6.0,7)", org.drools.core.impl;version="[6.0,7)", org.drools.core.runtime.help.impl;version="[6.0,7)", com.thoughtworks.xstream;version="1.4", javax.ws.rs.ext, javax.ws.rs.core, javax.ws.rs org.kie kie-api org.kie kie-camel org.drools drools-compiler org.apache.camel camel-core org.apache.camel camel-cxf org.apache.felix maven-bundle-plugin ================================================ FILE: examples/drools/drools-camel-cxf-server/src/main/java/org/apache/servicemix/examples/drools/camel/cxf/server/model/Customer.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.cxf.server.model; public class Customer { /** * Salary */ private int salary; /** * IS VIP. */ private CustomerType type; /** * Create customer with salary. * * @param salary */ public Customer(int salary) { this.salary = salary; } /** * @return the salary */ public int getSalary() { return salary; } /** * @return the type */ public CustomerType getType() { return type; } /** * @param salary the salary to set */ public void setSalary(int salary) { this.salary = salary; } /** * @param type the type to set */ public void setType(CustomerType type) { this.type = type; } /** * @see Object#toString() */ @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Customer [salary=").append(salary).append(", type=") .append(type).append("]"); return builder.toString(); } } ================================================ FILE: examples/drools/drools-camel-cxf-server/src/main/java/org/apache/servicemix/examples/drools/camel/cxf/server/model/CustomerType.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.cxf.server.model; public enum CustomerType { POOR, NORMAL, VIP; } ================================================ FILE: examples/drools/drools-camel-cxf-server/src/main/java/org/apache/servicemix/examples/drools/camel/cxf/server/osgi/CommandMessageBodyRW.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.cxf.server.osgi; import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import org.drools.core.runtime.help.impl.BatchExecutionHelperProviderImpl; import org.kie.api.command.Command; import org.kie.internal.runtime.helper.BatchExecutionHelperProvider; @Consumes("text/plain") @Provider public class CommandMessageBodyRW implements MessageBodyWriter> { /** * provider */ private BatchExecutionHelperProvider provider = new BatchExecutionHelperProviderImpl(); /** * getSize */ @Override public long getSize(Command arg0, Class arg1, Type arg2, Annotation[] arg3, MediaType arg4) { return -1; } /** * isWriteable */ @Override public boolean isWriteable(Class type, Type genericType, Annotation[] arg2, MediaType arg3) { return Command.class.isAssignableFrom(type); } /** * writeTo */ @Override public void writeTo(Command obj, Class arg1, Type arg2, Annotation[] arg3, MediaType arg4, MultivaluedMap arg5, OutputStream out) throws IOException, WebApplicationException { provider.newXStreamMarshaller().toXML(obj, out); } } ================================================ FILE: examples/drools/drools-camel-cxf-server/src/main/java/org/apache/servicemix/examples/drools/camel/cxf/server/osgi/DebugAgendaEventListener.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.cxf.server.osgi; import org.kie.api.event.rule.AfterMatchFiredEvent; import org.kie.api.event.rule.AgendaEventListener; import org.kie.api.event.rule.AgendaGroupPoppedEvent; import org.kie.api.event.rule.AgendaGroupPushedEvent; import org.kie.api.event.rule.BeforeMatchFiredEvent; import org.kie.api.event.rule.MatchCancelledEvent; import org.kie.api.event.rule.MatchCreatedEvent; import org.kie.api.event.rule.RuleFlowGroupActivatedEvent; import org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Drools 6 Rule Engine events logger. */ public class DebugAgendaEventListener implements AgendaEventListener { /** * Logger. */ private static final Logger log = LoggerFactory .getLogger(DebugAgendaEventListener.class); /** * @see AgendaEventListener#matchCreated(org.kie.api.event.rule.MatchCreatedEvent) */ @Override public void matchCreated(MatchCreatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#matchCancelled(org.kie.api.event.rule.MatchCancelledEvent) */ @Override public void matchCancelled(MatchCancelledEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeMatchFired(org.kie.api.event.rule.BeforeMatchFiredEvent) */ @Override public void beforeMatchFired(BeforeMatchFiredEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#afterMatchFired(org.kie.api.event.rule.AfterMatchFiredEvent) */ @Override public void afterMatchFired(AfterMatchFiredEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#agendaGroupPopped(org.kie.api.event.rule.AgendaGroupPoppedEvent) */ @Override public void agendaGroupPopped(AgendaGroupPoppedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#agendaGroupPushed(org.kie.api.event.rule.AgendaGroupPushedEvent) */ @Override public void agendaGroupPushed(AgendaGroupPushedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeRuleFlowGroupActivated(org.kie.api.event.rule.RuleFlowGroupActivatedEvent) */ @Override public void beforeRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#afterRuleFlowGroupActivated(org.kie.api.event.rule.RuleFlowGroupActivatedEvent) */ @Override public void afterRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeRuleFlowGroupDeactivated(org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent) */ @Override public void beforeRuleFlowGroupDeactivated( RuleFlowGroupDeactivatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeRuleFlowGroupDeactivated(org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent) */ @Override public void afterRuleFlowGroupDeactivated( RuleFlowGroupDeactivatedEvent event) { log.info("{}", event); } } ================================================ FILE: examples/drools/drools-camel-cxf-server/src/main/java/org/apache/servicemix/examples/drools/camel/cxf/server/osgi/DebugRuleRuntimeEventListener.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.cxf.server.osgi; import org.kie.api.event.rule.ObjectDeletedEvent; import org.kie.api.event.rule.ObjectInsertedEvent; import org.kie.api.event.rule.ObjectUpdatedEvent; import org.kie.api.event.rule.RuleRuntimeEventListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Drools 6 Working memory events. */ public class DebugRuleRuntimeEventListener implements RuleRuntimeEventListener { /** * Logger. */ private static final Logger log = LoggerFactory .getLogger(DebugRuleRuntimeEventListener.class); /** * @see RuleRuntimeEventListener#objectInserted(ObjectInsertedEvent) */ @Override public void objectInserted(ObjectInsertedEvent event) { log.info("objectInserted {}", event); } /** * @see RuleRuntimeEventListener#objectUpdated(org.kie.api.event.rule.ObjectUpdatedEvent) */ @Override public void objectUpdated(ObjectUpdatedEvent event) { log.info("objectUpdated {}", event); } /** * @see RuleRuntimeEventListener#objectDeleted(org.kie.api.event.rule.ObjectDeletedEvent) */ @Override public void objectDeleted(ObjectDeletedEvent event) { log.info("objectDeleted {}", event); } } ================================================ FILE: examples/drools/drools-camel-cxf-server/src/main/java/org/apache/servicemix/examples/drools/camel/cxf/server/osgi/Utils.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.camel.cxf.server.osgi; import java.util.Arrays; import java.util.Random; import org.apache.servicemix.examples.drools.camel.cxf.server.model.Customer; import org.kie.api.command.Command; import org.kie.api.runtime.ExecutionResults; import org.kie.internal.command.CommandFactory; public class Utils { /** * Random */ private static Random rand = new Random(12345); /** * Generate random customer * * @return */ public Customer customer() { return new Customer(rand.nextInt(9999)); } /** * Create commands for Drools engine. * * @param body {@link org.apache.camel.Exchange} */ public Command insertAndFireAll(final Customer body) { Command insert = CommandFactory.newInsert(body, "customer"); @SuppressWarnings("unchecked") Command batch = CommandFactory .newBatchExecution(Arrays.asList(insert)); return batch; } } ================================================ FILE: examples/drools/drools-camel-cxf-server/src/main/resources/OSGI-INF/blueprint/camel-client.xml ================================================ ================================================ FILE: examples/drools/drools-camel-cxf-server/src/main/resources/OSGI-INF/blueprint/camel-server.xml ================================================ ================================================ FILE: examples/drools/drools-camel-cxf-server/src/main/resources/OSGI-INF/blueprint/kmodule-blueprint.xml ================================================ ================================================ FILE: examples/drools/drools-camel-cxf-server/src/main/resources/rule/customer-score.drl ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package rule; import org.apache.servicemix.examples.drools.camel.cxf.server.model.Customer; import org.apache.servicemix.examples.drools.camel.cxf.server.model.CustomerType; rule "Customer poor" when $c : Customer( salary <= 1000, type == null) then modify( $c ) { setType(CustomerType.POOR) }; end rule "Customer NORMAL" when $c : Customer( salary > 1000, salary <= 9000, type == null ) then modify( $c ) { setType(CustomerType.NORMAL) }; end rule "Customer VIP" when $c : Customer( salary > 9000, type == null) then modify( $c ) { setType(CustomerType.VIP) }; end ================================================ FILE: examples/drools/drools-camel-cxf-server/src/test/resources/batch-test-request.xml ================================================ 9000 1000 ================================================ FILE: examples/drools/drools-camel-cxf-server/src/test/resources/test-request.xml ================================================ 9000 ================================================ FILE: examples/drools/drools-simple/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Drools 6 Simple Example ========================== Purpose ------- This example will show you how to use Drools 6 inside Apache ServiceMix and how to use rule engine in low level. We use OSGi activator to create theKIE Session, insert facts to rule engine and print the result to server log. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 3.0.2 or higher (for building) For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. Before being able to run this example, you have to install some additional features into the container first to add support for the Drools 6. feature:install drools6-module 2. Build the example by opening a command prompt, changing directory to examples/drools/drools-simple (this example) and entering the following Maven command: mvn clean install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: bundle:install -s mvn:org.apache.servicemix.examples/drools-simple/${project.version} 4. Once the bundle has been started, you will see on console logs from rule engine. ==>[AfterActivationFiredEvent: getActivation()=[[ Customer VIP active=false ] [ [fact 0:3:115401058:115401058:6:DEFAULT:NON_TRAIT:Customer [salary=9001, type=VIP]] ] ], getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl@7631375e] and in server logs KieSession fireAllRules. Customer [salary=9001, type=null] After rule Customer [salary=9001, type=VIP] Stopping and Uninstalling the Example ------------------------------------- First, find the bundle id for the deployed example bundle by doing bundle:list and looking for a line that looks like this one 229 | Active | 80 | | Apache ServiceMix :: Examples :: Drools :: Simple In the above case, the bundle id would be 229 To stop the example, enter the following command in the ServiceMix console: bundle:stop To uninstall the example, enter one of the following commands in the ServiceMix console: bundle:uninstall ================================================ FILE: examples/drools/drools-simple/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples drools 7.1.0-SNAPSHOT drools-simple Apache ServiceMix :: Examples :: Drools :: Simple bundle org.apache.servicemix.examples.drools.simple.osgi org.apache.servicemix.examples.drools.simple.osgi.SimpleRuleActivator org.apache.servicemix.examples.drools.simple.model org.osgi.framework;version="[1.5,2)", org.slf4j;version="[1.6,2)", org.kie.api.*;version="[6.0,7)", org.kie kie-api org.drools drools-core org.drools drools-compiler org.drools drools-osgi-integration org.apache.felix org.apache.felix.framework org.slf4j slf4j-api junit junit test org.slf4j slf4j-simple test org.apache.felix maven-bundle-plugin ================================================ FILE: examples/drools/drools-simple/src/main/java/org/apache/servicemix/examples/drools/simple/model/Customer.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.simple.model; public class Customer { /** * Salary */ private int salary; /** * IS VIP. */ private CustomerType type; /** * Create customer with salary. * * @param salary */ public Customer(int salary) { this.salary = salary; } /** * @return the salary */ public int getSalary() { return salary; } /** * @return the type */ public CustomerType getType() { return type; } /** * @param salary * the salary to set */ public void setSalary(int salary) { this.salary = salary; } /** * @param type * the type to set */ public void setType(CustomerType type) { this.type = type; } /** * * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Customer [salary=").append(salary).append(", type=") .append(type).append("]"); return builder.toString(); } } ================================================ FILE: examples/drools/drools-simple/src/main/java/org/apache/servicemix/examples/drools/simple/model/CustomerType.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.simple.model; public enum CustomerType { POOR, NORMAL, VIP; } ================================================ FILE: examples/drools/drools-simple/src/main/java/org/apache/servicemix/examples/drools/simple/osgi/SimpleRuleActivator.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.simple.osgi; import static org.apache.servicemix.examples.drools.simple.osgi.Utils.customerPoor; import static org.apache.servicemix.examples.drools.simple.osgi.Utils.customerNormal; import static org.apache.servicemix.examples.drools.simple.osgi.Utils.customerVip; import org.apache.servicemix.examples.drools.simple.model.Customer; import org.kie.api.KieBase; import org.kie.api.KieServices; import org.kie.api.event.rule.DebugAgendaEventListener; import org.kie.api.event.rule.DebugRuleRuntimeEventListener; import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SimpleRuleActivator implements BundleActivator { /** * LOGGER. */ private static final Logger logger = LoggerFactory .getLogger(SimpleRuleActivator.class); /** * KieSession. */ private KieSession ksession; @Override public void start(BundleContext context) throws Exception { KieServices ks = KieServices.Factory.get(); KieContainer kcont = ks.newKieClasspathContainer(getClass() .getClassLoader()); KieBase kbase = kcont.getKieBase("SimpleRuleKBase"); logger.info("KieSession newKieSession."); ksession = kbase.newKieSession(); ksession.addEventListener(new DebugAgendaEventListener()); ksession.addEventListener(new DebugRuleRuntimeEventListener()); Customer customer = customerPoor(); logger.info("KieSession fireAllRules. {}", customer); FactHandle fh = ksession.insert(customer); ksession.fireAllRules(); ksession.delete(fh); logger.info("After rule {}", customer); customer = customerNormal(); logger.info("KieSession fireAllRules. {}", customer); fh = ksession.insert(customer); ksession.fireAllRules(); ksession.delete(fh); logger.info("After rule {}", customer); customer = customerVip(); logger.info("KieSession fireAllRules. {}", customer); fh = ksession.insert(customer); ksession.fireAllRules(); ksession.delete(fh); logger.info("After rule {}", customer); } /** * Dispose ksession */ @Override public void stop(BundleContext context) throws Exception { if (ksession != null) { ksession.dispose(); logger.debug("KieSession disposed."); } } } ================================================ FILE: examples/drools/drools-simple/src/main/java/org/apache/servicemix/examples/drools/simple/osgi/Utils.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.simple.osgi; import org.apache.servicemix.examples.drools.simple.model.Customer; public final class Utils { public static Customer customerPoor() { return new Customer(1000); } public static Customer customerNormal() { return new Customer(5000); } public static Customer customerVip() { return new Customer(9001); } } ================================================ FILE: examples/drools/drools-simple/src/main/resources/META-INF/kmodule.xml ================================================ ================================================ FILE: examples/drools/drools-simple/src/main/resources/rule/simple.drl ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package rule; import org.apache.servicemix.examples.drools.simple.model.Customer; import org.apache.servicemix.examples.drools.simple.model.CustomerType; rule "Customer poor" when $c : Customer( salary <= 1000, type == null) then modify( $c ) { setType(CustomerType.POOR) }; end rule "Customer NORMAL" when $c : Customer( salary > 1000, salary <= 9000, type == null ) then modify( $c ) { setType(CustomerType.NORMAL) }; end rule "Customer VIP" when $c : Customer( salary > 9000, type == null) then modify( $c ) { setType(CustomerType.VIP) }; end ================================================ FILE: examples/drools/drools-simple/src/test/java/org/apache/servicemix/examples/drools/test/ActivatorTest.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.test; import org.apache.servicemix.examples.drools.simple.osgi.SimpleRuleActivator; import org.junit.Test; /** * * @author ghalajko * */ public class ActivatorTest { /** * Simple test. Checks method * @throws Exception */ @Test public void test() throws Exception{ SimpleRuleActivator act = new SimpleRuleActivator(); try{ act.start(null); }finally{ act.stop(null); } } } ================================================ FILE: examples/drools/drools-simple/src/test/java/org/apache/servicemix/examples/drools/test/SimpleTest.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.test; import org.apache.servicemix.examples.drools.simple.model.Customer; import org.apache.servicemix.examples.drools.simple.model.CustomerType; import org.apache.servicemix.examples.drools.simple.osgi.Utils; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.kie.api.KieBase; import org.kie.api.KieServices; import org.kie.api.event.rule.DebugAgendaEventListener; import org.kie.api.event.rule.DebugRuleRuntimeEventListener; import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; /** * * @author ghalajko * */ public class SimpleTest { /** * KieSession */ private static KieSession ksession; /** * beforeClass. */ @BeforeClass public static void beforeClass() { KieServices ks = KieServices.Factory.get(); KieContainer kcont = ks.newKieClasspathContainer(); KieBase kbase = kcont.getKieBase("SimpleRuleKBase"); ksession = kbase.newKieSession(); ksession.addEventListener(new DebugAgendaEventListener()); ksession.addEventListener(new DebugRuleRuntimeEventListener()); } /** * afterClass. */ @BeforeClass public static void afterClass() { if (null != ksession) { ksession.dispose(); } } /** * Rule Poor */ @Test public void testPool() { test(Utils.customerPoor(), CustomerType.POOR); } /** * Rule Normal */ @Test public void testNormal() { test(Utils.customerNormal(), CustomerType.NORMAL); } /** * Rule Poor */ @Test public void testVip() { test(Utils.customerVip(), CustomerType.VIP); } /** * */ private void test(Customer customer, CustomerType expected) { FactHandle fh = ksession.insert(customer); ksession.fireAllRules(); ksession.delete(fh); Assert.assertEquals(expected, customer.getType()); } } ================================================ FILE: examples/drools/drools-spring/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Drools 6 Simple Example ========================== Purpose ------- This example will show you how to use Drools 6 inside Apache ServiceMix and how to use rule engine with spring. Prerequisites for Running the Example ------------------------------------- 1. You must have the following installed on your machine: - JDK 1.6 or higher - Maven 3.0.2 or higher (for building) For more information, see the README in the top-level examples directory. 2. Start ServiceMix by running the following command: /bin/servicemix (on UNIX) \bin\servicemix (on Windows) Running the Example ------------------- To install and run the example where you build the example bundle yourself, complete the following steps: 1. Before being able to run this example, you have to install some additional features into the container first to add spring support for the Drools 6. feature:install kie-spring 2. Build the example by opening a command prompt, changing directory to examples/drools/drools-simple (this example) and entering the following Maven command: mvn clean install If all of the required OSGi bundles are available in your local Maven repository, the example will build very quickly. Otherwise it may take some time for Maven to download everything it needs. The mvn install command builds the example deployment bundle and copies it to your local Maven repository and to the target directory of this example. 3. Install the example by entering the following command in the ServiceMix console: bundle:install -s mvn:org.apache.servicemix.examples/drools-spring/${project.version} 4. Once the bundle has been started, you will see on console logs from rule engine. | ------------------- START ------------------ KieSession fireAllRules. Customer [salary=978, type=null] DebugRuleRuntimeEventListener | 286 - drools-spring - 6.0.0.SNAPSHOT | objectInserted ==>[ObjectInsertedEventImpl: getFactHandle()=[fact 0:1:1887740067:18877 40067:1:DEFAULT:NON_TRAIT:Customer [salary=978, type=null]], getObject()=Customer [salary=978, type=null], ...... Stopping and Uninstalling the Example ------------------------------------- First, find the bundle id for the deployed example bundle by doing bundle:list and looking for a line that looks like this one 229 | Active | 80 | | Apache ServiceMix :: Examples :: Drools :: Spring In the above case, the bundle id would be 229 To stop the example, enter the following command in the ServiceMix console: bundle:stop To uninstall the example, enter one of the following commands in the ServiceMix console: bundle:uninstall ================================================ FILE: examples/drools/drools-spring/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples drools 7.1.0-SNAPSHOT drools-spring Apache ServiceMix :: Examples :: Drools :: Spring bundle org.apache.servicemix.examples.drools.spring.osgi, org.apache.servicemix.examples.drools.spring.model org.slf4j;version="[1.6,2)", org.kie.api.*;version="[6.0,7)", org.kie.spring;version="[6.0,7)", org.kie.internal.command;version="[6.0,7)", org.drools.osgi.spring;version="[6.0,7)", org.kie kie-api org.drools drools-core org.drools drools-osgi-integration org.slf4j slf4j-api org.apache.felix maven-bundle-plugin ================================================ FILE: examples/drools/drools-spring/src/main/java/org/apache/servicemix/examples/drools/spring/model/Customer.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.spring.model; public class Customer { /** * Salary */ private int salary; /** * IS VIP. */ private CustomerType type; /** * Create customer with salary. * * @param salary */ public Customer(int salary) { this.salary = salary; } /** * @return the salary */ public int getSalary() { return salary; } /** * @return the type */ public CustomerType getType() { return type; } /** * @param salary the salary to set */ public void setSalary(int salary) { this.salary = salary; } /** * @param type the type to set */ public void setType(CustomerType type) { this.type = type; } /** * @see Object#toString() */ @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Customer [salary=").append(salary).append(", type=") .append(type).append("]"); return builder.toString(); } } ================================================ FILE: examples/drools/drools-spring/src/main/java/org/apache/servicemix/examples/drools/spring/model/CustomerType.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.spring.model; public enum CustomerType { POOR, NORMAL, VIP; } ================================================ FILE: examples/drools/drools-spring/src/main/java/org/apache/servicemix/examples/drools/spring/osgi/DebugAgendaEventListener.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.spring.osgi; import org.kie.api.event.rule.AfterMatchFiredEvent; import org.kie.api.event.rule.AgendaEventListener; import org.kie.api.event.rule.AgendaGroupPoppedEvent; import org.kie.api.event.rule.AgendaGroupPushedEvent; import org.kie.api.event.rule.BeforeMatchFiredEvent; import org.kie.api.event.rule.MatchCancelledEvent; import org.kie.api.event.rule.MatchCreatedEvent; import org.kie.api.event.rule.RuleFlowGroupActivatedEvent; import org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Drools 6 Rule Engine events logger. */ public class DebugAgendaEventListener implements AgendaEventListener { /** * Logger. */ private static final Logger log = LoggerFactory .getLogger(DebugAgendaEventListener.class); /** * @see AgendaEventListener#matchCreated(org.kie.api.event.rule.MatchCreatedEvent) */ @Override public void matchCreated(MatchCreatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#matchCancelled(org.kie.api.event.rule.MatchCancelledEvent) */ @Override public void matchCancelled(MatchCancelledEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeMatchFired(org.kie.api.event.rule.BeforeMatchFiredEvent) */ @Override public void beforeMatchFired(BeforeMatchFiredEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#afterMatchFired(org.kie.api.event.rule.AfterMatchFiredEvent) */ @Override public void afterMatchFired(AfterMatchFiredEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#agendaGroupPopped(org.kie.api.event.rule.AgendaGroupPoppedEvent) */ @Override public void agendaGroupPopped(AgendaGroupPoppedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#agendaGroupPushed(org.kie.api.event.rule.AgendaGroupPushedEvent) */ @Override public void agendaGroupPushed(AgendaGroupPushedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeRuleFlowGroupActivated(org.kie.api.event.rule.RuleFlowGroupActivatedEvent) */ @Override public void beforeRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#afterRuleFlowGroupActivated(org.kie.api.event.rule.RuleFlowGroupActivatedEvent) */ @Override public void afterRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeRuleFlowGroupDeactivated(org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent) */ @Override public void beforeRuleFlowGroupDeactivated( RuleFlowGroupDeactivatedEvent event) { log.info("{}", event); } /** * @see AgendaEventListener#beforeRuleFlowGroupDeactivated(org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent) */ @Override public void afterRuleFlowGroupDeactivated( RuleFlowGroupDeactivatedEvent event) { log.info("{}", event); } } ================================================ FILE: examples/drools/drools-spring/src/main/java/org/apache/servicemix/examples/drools/spring/osgi/DebugRuleRuntimeEventListener.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.spring.osgi; import org.kie.api.event.rule.ObjectDeletedEvent; import org.kie.api.event.rule.ObjectInsertedEvent; import org.kie.api.event.rule.ObjectUpdatedEvent; import org.kie.api.event.rule.RuleRuntimeEventListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Drools 6 Working memory events. */ public class DebugRuleRuntimeEventListener implements RuleRuntimeEventListener { /** * Logger. */ private static final Logger log = LoggerFactory .getLogger(DebugRuleRuntimeEventListener.class); /** * @see RuleRuntimeEventListener#objectInserted(ObjectInsertedEvent) */ @Override public void objectInserted(ObjectInsertedEvent event) { log.info("objectInserted {}", event); } /** * @see RuleRuntimeEventListener#objectUpdated(org.kie.api.event.rule.ObjectUpdatedEvent) */ @Override public void objectUpdated(ObjectUpdatedEvent event) { log.info("objectUpdated {}", event); } /** * @see RuleRuntimeEventListener#objectDeleted(org.kie.api.event.rule.ObjectDeletedEvent) */ @Override public void objectDeleted(ObjectDeletedEvent event) { log.info("objectDeleted {}", event); } } ================================================ FILE: examples/drools/drools-spring/src/main/java/org/apache/servicemix/examples/drools/spring/osgi/SimpleRuleBean.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.spring.osgi; import java.util.ArrayList; import java.util.List; import org.apache.servicemix.examples.drools.spring.model.Customer; import org.kie.api.command.Command; import org.kie.api.runtime.ExecutionResults; import org.kie.api.runtime.StatelessKieSession; import org.kie.internal.command.CommandFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.apache.servicemix.examples.drools.spring.osgi.Utils.customer; /** * Simple spring bean. */ public class SimpleRuleBean { /** * LOGGER. */ protected static final transient Logger logger = LoggerFactory .getLogger(SimpleRuleBean.class); /** * StatelessKieSession */ private StatelessKieSession ksession; /** * */ public void start() throws Exception { for (int i = 0; i < 10; i++) { Customer customer = customer(); logger.info("------------------- START ------------------\n" + " KieSession fireAllRules. {}", customer); List> commands = new ArrayList>(); commands.add(CommandFactory.newInsert(customer, "customer")); commands.add(CommandFactory.newFireAllRules("num-rules-fired")); ExecutionResults results = ksession.execute(CommandFactory .newBatchExecution(commands)); int fired = Integer.parseInt(results.getValue("num-rules-fired") .toString()); customer = (Customer)results.getValue("customer"); logger.info("After rule rules-fired={} {} \n" + "------------------- STOP ---------------------", fired, customer); } } /** * @param ksession the ksession to set */ public void setKsession(StatelessKieSession ksession) { this.ksession = ksession; } } ================================================ FILE: examples/drools/drools-spring/src/main/java/org/apache/servicemix/examples/drools/spring/osgi/Utils.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.examples.drools.spring.osgi; import java.util.Random; import org.apache.servicemix.examples.drools.spring.model.Customer; public class Utils { /** * */ private static final Random rand = new Random(12345); /** * @return */ public static Customer customer() { return new Customer(rand.nextInt(9999)); } } ================================================ FILE: examples/drools/drools-spring/src/main/resources/META-INF/spring/simple-spring.xml ================================================ ================================================ FILE: examples/drools/drools-spring/src/main/resources/rule/customer-score.drl ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package rule; import org.apache.servicemix.examples.drools.spring.model.Customer; import org.apache.servicemix.examples.drools.spring.model.CustomerType; rule "Customer poor" when $c : Customer( salary <= 1000, type == null) then modify( $c ) { setType(CustomerType.POOR) }; end rule "Customer NORMAL" when $c : Customer( salary > 1000, salary <= 9000, type == null ) then modify( $c ) { setType(CustomerType.NORMAL) }; end rule "Customer VIP" when $c : Customer( salary > 9000, type == null) then modify( $c ) { setType(CustomerType.VIP) }; end ================================================ FILE: examples/drools/pom.xml ================================================ 4.0.0 org.apache.servicemix.examples examples 7.1.0-SNAPSHOT drools pom Apache ServiceMix :: Examples :: Drools !* !* org.drools drools-bom pom ${drools6.version} import org.apache.felix maven-bundle-plugin true ${project.artifactId} ${project.name} ${osgi.bundle.activator} ${osgi.import.package} ${osgi.private.package} ${osgi.export.package} drools-simple drools-camel-blueprint drools-camel-cxf-server drools-spring ================================================ FILE: examples/pom.xml ================================================ 4.0.0 org.apache.servicemix.parent features-parent 7.1.0-SNAPSHOT ../parent/features-parent/pom.xml org.apache.servicemix.examples examples pom Apache ServiceMix :: Examples activemq activiti akka camel cxf drools ================================================ FILE: itests/pom.xml ================================================ 4.0.0 org.apache.servicemix.parent features-parent 7.1.0-SNAPSHOT ../parent/features-parent/pom.xml org.apache.servicemix.itests itests Apache ServiceMix :: Integration Tests org.apache.servicemix.features servicemix-examples xml features ${project.version} junit junit test org.slf4j slf4j-log4j12 test org.ops4j.pax.logging pax-logging-api test org.ops4j.pax.exam pax-exam-container-karaf test org.ops4j.pax.exam pax-exam-junit4 test org.ops4j.pax.exam pax-exam-spi test org.ops4j.pax.url pax-url-aether test org.apache.geronimo.specs geronimo-atinject_1.0_spec provided org.apache.karaf.features org.apache.karaf.features.core org.apache.servicemix apache-servicemix ${project.version} zip org.apache.camel camel-core-osgi test org.apache.servicemix.tooling depends-maven-plugin generate-depends-file generate-depends-file org.apache.maven.plugins maven-surefire-plugin true INFO ci-build-profile maven.repo.local org.apache.maven.plugins maven-surefire-plugin true -Dorg.ops4j.pax.url.mvn.localRepository=${maven.repo.local} INFO ================================================ FILE: itests/src/test/java/org/apache/servicemix/itests/BasicDistroTest.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.itests; import java.io.File; import java.nio.charset.Charset; import java.nio.file.Files; import java.util.ArrayList; import java.util.List; import org.apache.servicemix.itests.base.ServiceMixDistroTest; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; import org.osgi.framework.Bundle; @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) public class BasicDistroTest extends ServiceMixDistroTest { @Test public void testCorrectStatus() throws Exception { Bundle[] bundles = context.getBundles(); for (Bundle bundle : bundles) { if (!isActive(bundle) && !isFragment(bundle)) { // Starting bundle to cause error bundle.start(); } if (!isResolved(bundle) && isFragment(bundle)) { throw new IllegalStateException("Bundle " + bundle.getSymbolicName() + " is not resolved"); } } } @Test public void testNoErrors() throws Exception { File servicemixHomeFolder = new File(System.getProperty("servicemix.home")); File dataFolder = new File(servicemixHomeFolder, "data"); File logFolder = new File(dataFolder, "log"); File logFile = new File(logFolder, "servicemix.log"); List lines = Files.readAllLines(logFile.toPath(), Charset.forName("utf-8")); List errors = filterErrors(lines); if (errors.size() > 0) { Assert.fail("There should be no errors in the log but found :\n" + errors.toString()); } } private List filterErrors(List lines) { List errors = new ArrayList<>(); for (String line : lines) { String lcLine = line.toLowerCase(); if (lcLine.contains("ERROR") || lcLine.contains("exception")) { errors.add(lcLine); } } return errors; } private boolean isFragment(Bundle bundle) { return bundle.getHeaders().get("Fragment-Host") != null; } private boolean isActive(Bundle bundle) { return Bundle.ACTIVE == bundle.getState(); } private boolean isResolved(Bundle bundle) { return Bundle.RESOLVED == bundle.getState(); } } ================================================ FILE: itests/src/test/java/org/apache/servicemix/itests/ExamplesCXFTest.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.itests; import static org.ops4j.pax.exam.CoreOptions.composite; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut; import org.apache.servicemix.itests.base.Features; import org.apache.servicemix.itests.base.ServiceMixDistroTest; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) public class ExamplesCXFTest extends ServiceMixDistroTest { @Configuration public Option[] config() { return options(composite(super.config()), editConfigurationFilePut("etc/org.apache.cxf.wsn.cfg", "cxf.wsn.activemq.username", "smx"), editConfigurationFilePut("etc/org.apache.cxf.wsn.cfg", "cxf.wsn.activemq.password", "smx") ); } @Test public void testExampleCxfJAXRS() throws Exception { try (Features features = install("examples-cxf-jaxrs", "camel-http")) { log.expectContains("Setting the server's publish address to be /crm"); } } @Test public void testExampleCxfJAXRSBlueprint() throws Exception { try (Features features = install("examples-cxf-jaxrs-blueprint", "camel-http4")) { log.expectContains("Setting the server's publish address to be /crm"); } } @Test public void testExampleCxfJAXWSBlueprint() throws Exception { try (Features features = install("examples-cxf-jaxws-blueprint", "camel-http4")) { log.expectContains("Setting the server's publish address to be /HelloWorld"); } } @Test public void testExampleCxfOSGi() throws Exception { try (Features features = install("examples-cxf-osgi")) { log.expectContains("Setting the server's publish address to be /HelloWorld"); } } //@Test public void testExampleCxfWsRm() throws Exception { try (Features features = install("examples-cxf-ws-rm")) { log.expectContains("Setting the server's publish address to be /HelloWorld"); } } @Test public void testExampleCxfWsSecurityBlueprint() throws Exception { try (Features features = installOnly("examples-cxf-ws-security-blueprint")) { log.expectContains("Setting the server's publish address to be /HelloWorldSecurity"); } } @Test public void testExampleCxfWsSecurityOSGi() throws Exception { try (Features features = install("examples-cxf-ws-security-osgi")) { log.expectContains("Setting the server's publish address to be /HelloWorldSecurity"); } } @Test public void testExampleCxfWsSecuritySignature() throws Exception { try (Features features = install("examples-cxf-ws-security-signature")) { log.expectContains("Setting the server's publish address to be /HelloWorldSecurity"); } } @Test public void testExampleCxfWsn() throws Exception { try (Features features = install("examples-cxf-wsn-receive","examples-cxf-wsn-notifier")) { log.expectContains("### YOU GOT MAIL ####\n"); } } } ================================================ FILE: itests/src/test/java/org/apache/servicemix/itests/ExamplesCamelTest.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.itests; import org.apache.servicemix.itests.base.Features; import org.apache.servicemix.itests.base.ServiceMixDistroTest; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) public class ExamplesCamelTest extends ServiceMixDistroTest { @Test public void testExampleCamelCxfSoap() throws Exception { try (Features features = install("examples-camel-cxf-soap")) { log.expectContains("Setting the server's publish address to be http://localhost:8989/soap"); } } @Test public void testExampleCamelCxfRest() throws Exception { try (Features features = install("examples-camel-cxf-rest")) { log.expectContains("Setting the server's publish address to be http://localhost:8989/rest"); } } @Test public void testExampleCamelOsgi() throws Exception { try (Features features = install("examples-camel-osgi")) { log.expectContains("JavaDSL set body"); log.expectContains("MyTransform set body"); } } @Test public void testExampleCamelBlueprint() throws Exception { try (Features features = install("examples-camel-blueprint")) { log.expectContains("Blueprint-Example set body"); } } @Test public void testExampleCamelDrools() throws Exception { try (Features features = install("examples-camel-drools")) { log.expectContains("Serve this"); } } @Test public void testExampleCamelDroolsBlueprint() throws Exception { try (Features features = install("examples-camel-drools-blueprint")) { log.expectContains("Serve this"); } } } ================================================ FILE: itests/src/test/java/org/apache/servicemix/itests/ExamplesDrools6Test.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.itests; import org.apache.servicemix.itests.base.Features; import org.apache.servicemix.itests.base.ServiceMixDistroTest; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) public class ExamplesDrools6Test extends ServiceMixDistroTest { @Test public void testKieBlueprint() throws Exception { try (Features features = install("kie-aries-blueprint")) { } } @Test public void testKieSpring() throws Exception { try (Features features = install("kie-spring")) { } } @Test public void testKieCamel() throws Exception { try (Features features = install("kie-camel")) { } } @Test public void testDroolsSimpleExample() throws Exception { try (Features features = install("examples-drools-simple")) { log.expectContains("Customer [salary=1000, type=POOR]"); log.expectContains("Customer [salary=5000, type=NORMAL]"); log.expectContains("Customer [salary=9001, type=VIP]"); } } @Test public void testDroolsCamelExample() throws Exception { try (Features features = install("examples-drools-camel-blueprint")) { log.expectContains("Total 2 routes, of which 2 is started"); } } @Test public void testDroolSpringExample() throws Exception { try (Features features = install("examples-drools-spring")) { log.expectContains("KieModule was added: org.drools.osgi.compiler.OsgiKieModule"); } } @Test public void testDroolsCamelServerExample() throws Exception { try (Features features = install("examples-drools-camel-cxf-server")) { log.expectContains(""); } } } ================================================ FILE: itests/src/test/java/org/apache/servicemix/itests/ExamplesTest.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.itests; import java.io.File; import java.nio.file.Files; import org.apache.servicemix.itests.base.Features; import org.apache.servicemix.itests.base.ServiceMixDistroTest; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) public class ExamplesTest extends ServiceMixDistroTest { @Test public void testActivity() throws Exception { try (Features features = install("activiti", "examples-activiti-camel")) { File orderDir = new File("var/activiti-camel/order"); orderDir.mkdirs(); Files.copy(stream("Some nice order message goes here"), new File(orderDir, "001").toPath()); log.expectContains("Processing order"); File deliveryDir = new File("var/activiti-camel/delivery"); deliveryDir.mkdirs(); Files.copy(stream("Some nice delicery message goes here"), new File(deliveryDir, "001").toPath()); log.expectContains("Processing delivery for order"); } } @Test public void testExampleActiveMQ() throws Exception { try (Features features = install("examples-activemq-camel-blueprint")) { log.expectContains("ActiveMQ-Blueprint-Example set body"); } } } ================================================ FILE: itests/src/test/java/org/apache/servicemix/itests/base/Features.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.itests.base; import java.util.Arrays; import java.util.EnumSet; import java.util.HashSet; import java.util.Set; import org.apache.karaf.features.FeaturesService; public class Features implements AutoCloseable { private Set featureSet; private FeaturesService featuresService; private boolean uninstall; public Features(FeaturesService featuresService, boolean uninstall, String ... names) throws Exception { this.featuresService = featuresService; this.uninstall = uninstall; featureSet = new HashSet<>(Arrays.asList(names)); featuresService.installFeatures(featureSet, EnumSet.noneOf(FeaturesService.Option.class)); } @Override public void close() throws Exception { if (this.uninstall) { featuresService.uninstallFeatures(featureSet, EnumSet.noneOf(FeaturesService.Option.class)); } } } ================================================ FILE: itests/src/test/java/org/apache/servicemix/itests/base/LogCollector.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.itests.base; import java.util.ArrayList; import java.util.Dictionary; import java.util.Hashtable; import java.util.List; import java.util.concurrent.TimeoutException; import org.ops4j.pax.logging.spi.PaxAppender; import org.ops4j.pax.logging.spi.PaxLoggingEvent; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; public class LogCollector implements PaxAppender { List log = new ArrayList<>(); private ServiceRegistration reg; public LogCollector(BundleContext context) { Dictionary props = new Hashtable<>(); props.put("org.ops4j.pax.logging.appender.name", "ITestLogAppender"); reg = context.registerService(PaxAppender.class, this, props); } @Override public synchronized void doAppend(PaxLoggingEvent event) { log.add(event); this.notify(); } public synchronized void expectContains(String message) throws InterruptedException, TimeoutException { for (PaxLoggingEvent event : log) { if (event.getMessage().contains(message)) { return; } } long startTime = System.currentTimeMillis(); while (System.currentTimeMillis() - startTime < 10 * 2000) { this.wait(100); if (log.size() > 0) { PaxLoggingEvent event = log.get(log.size() - 1); if (event.getMessage().contains(message)) { return; } } } throw new TimeoutException("Timeout waiting for log message containing " + message); } public void close() { reg.unregister(); } } ================================================ FILE: itests/src/test/java/org/apache/servicemix/itests/base/ServiceMixDistroTest.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.itests.base; import static org.ops4j.pax.exam.CoreOptions.maven; import static org.ops4j.pax.exam.CoreOptions.systemProperty; import static org.ops4j.pax.exam.CoreOptions.when; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureSecurity; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStream; import java.io.UnsupportedEncodingException; import javax.inject.Inject; import org.apache.karaf.features.FeaturesService; import org.junit.Before; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.CoreOptions; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.karaf.options.KarafDistributionOption; import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel; import org.ops4j.pax.exam.options.MavenArtifactUrlReference; import org.osgi.framework.BundleContext; public class ServiceMixDistroTest { protected LogCollector log; @Inject protected BundleContext context; @Inject protected FeaturesService featuresService; protected MavenArtifactUrlReference examples; private MavenArtifactUrlReference karafUrl; @Before public void initLog() { log = new LogCollector(context); } public Features installOnly(String ... names) throws Exception { return new Features(featuresService, false, names); } public Features install(String ... names) throws Exception { return new Features(featuresService, true, names); } public Option baseConfig() { examples = maven().groupId("org.apache.servicemix.features").artifactId("servicemix-examples").type("xml").classifier("features").versionAsInProject(); karafUrl = maven().groupId("org.apache.servicemix").artifactId("apache-servicemix").type("zip").versionAsInProject(); String LOCAL_REPOSITORY = System.getProperty("org.ops4j.pax.url.mvn.localRepository"); return CoreOptions.composite( // KarafDistributionOption.debugConfiguration("8889", true), karafDistributionConfiguration().frameworkUrl(karafUrl) .name("Apache Servicemix") .unpackDirectory(new File("target/exam")) .useDeployFolder(false), systemProperty("pax.exam.osgi.unresolved.fail").value("true"), configureSecurity().disableKarafMBeanServerBuilder(), keepRuntimeFolder(), logLevel(LogLevel.INFO), editConfigurationFilePut("etc/custom.properties", "karaf.delay.console", "false"), editConfigurationFilePut("etc/org.ops4j.pax.logging.cfg", "log4j.logger.org.apache.karaf.features", "WARN"), editConfigurationFilePut("etc/org.ops4j.pax.logging.cfg", "log4j.logger.org.apache.aries.spifly", "WARN"), KarafDistributionOption.features(examples, "transaction"), when(null != LOCAL_REPOSITORY && LOCAL_REPOSITORY.length() > 0) .useOptions(editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", LOCAL_REPOSITORY)) ); } @Configuration public Option[] config() { return new Option[] { baseConfig() }; } protected InputStream stream(String content) throws UnsupportedEncodingException { return new ByteArrayInputStream(content.getBytes("UTF-8")); } @Before public void closeLog() { log = new LogCollector(context); } } ================================================ FILE: itests/src/test/resources/log4j.properties ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # The logging properties used during tests.. # log4j.rootLogger=WARN, stdout, out # CONSOLE appender not used by default log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n # File appender log4j.appender.out=org.apache.log4j.FileAppender log4j.appender.out.layout=org.apache.log4j.PatternLayout log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n log4j.appender.out.file=target/itests.log log4j.appender.out.append=true ================================================ FILE: logging/jms-appender/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ServiceMix Pax JMS Appender =========================== This ServiceMix features allows to configure a JMS appender with ActiveMQ. When the bundle is deployed, a new OPS4J Pax logging appender will be registered using Pax Logging OSGI service. This appender can be used next by modifying the org.ops4j.pax.logging.cfg file and adding the following lines log4j.rootLogger=INFO, out, osgi:VmLogAppender, osgi:JMSLogAppender Procedure to install the bundle and configure it ================================================ 1) Compile the project mvn install 2) Create config file under ${servicemix.home}/etc directory touch org.apache.servicemix.logging.cfg edit the file and add destinationName=logTopic 3) Modify org.ops4j.pax.logging.cfg log4j.rootLogger=INFO, out, osgi:VmLogAppender, osgi:JMSLogAppender # Be sure that ActiveMQ messages are not logged to 'jms' appender log4j.logger.org.apache.activemq=INFO, stdout log4j.logger.org.apache.activemq.karaf.logging = INFO, stdout 4) Start ServiceMix server ./bin/servicemix or bin/servicemix.bat 5) Deploy the bundle install -s mvn:org.apache.servicemix.logging/pax-jms-appender/${project.version} 5) Check that topic logTopic contains entries ! ================================================ FILE: logging/jms-appender/pom.xml ================================================ 4.0.0 org.apache.servicemix.logging logging 7.1.0-SNAPSHOT jms-appender Apache ServiceMix :: Logging :: JMS Appender bundle org.ops4j.pax.logging pax-logging-service org.ops4j.pax.logging pax-logging-api org.apache.activemq activemq-broker org.apache.geronimo.specs geronimo-json_1.0_spec org.apache.johnzon johnzon-core org.apache.camel camel-test test org.apache.activemq activemq-camel test org.slf4j slf4j-log4j12 test org.apache.felix maven-bundle-plugin true ${project.artifactId} * org.apache.servicemix.logging.jms johnzon-core, geronimo-json_1.0_spec ================================================ FILE: logging/jms-appender/src/main/java/org/apache/servicemix/logging/jms/DefaultLoggingEventFormat.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.logging.jms; import org.ops4j.pax.logging.spi.PaxLoggingEvent; import java.text.SimpleDateFormat; import java.util.Date; /** * Default event logging format for the JMS appender */ public class DefaultLoggingEventFormat implements LoggingEventFormat { private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); public String toString(PaxLoggingEvent paxLoggingEvent) { StringBuilder writer = new StringBuilder(); writer.append("Error"); writer.append(",\n \"timestamp\" : " + formatDate(paxLoggingEvent.getTimeStamp())); writer.append(",\n \"level\" : " + paxLoggingEvent.getLevel().toString()); writer.append(",\n \"logger\" : " + paxLoggingEvent.getLoggerName()); writer.append(",\n \"thread\" : " + paxLoggingEvent.getThreadName()); writer.append(",\n \"message\" : " + paxLoggingEvent.getMessage()); String[] throwable = paxLoggingEvent.getThrowableStrRep(); if (throwable != null) { writer.append(",\n \"exception\" : ["); for (int i = 0; i < throwable.length; i++) { if (i != 0) writer.append(", " + throwable[i]); } writer.append("]"); } writer.append(",\n \"properties\" : { "); boolean first = true; for (Object key : paxLoggingEvent.getProperties().keySet()) { if (first) { first = false; } else { writer.append(", "); } writer.append("key : " + key.toString()); writer.append(": " + paxLoggingEvent.getProperties().get(key).toString()); } writer.append(" }"); writer.append("\n}"); return writer.toString(); } private String formatDate(long timestamp) { return simpleDateFormat.format(new Date(timestamp)); } } ================================================ FILE: logging/jms-appender/src/main/java/org/apache/servicemix/logging/jms/JMSAppender.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.logging.jms; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.DeliveryMode; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; import org.ops4j.pax.logging.spi.PaxAppender; import org.ops4j.pax.logging.spi.PaxLoggingEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class JMSAppender implements PaxAppender { private static final String PACKAGE = JMSAppender.class.getPackage().getName(); private static final transient Logger LOG = LoggerFactory.getLogger(JMSAppender.class); private static final String DEFAULT_EVENT_FORMAT = "default"; private static final String LOGSTASH_EVENT_FORMAT = "logstash"; private ConnectionFactory jmsConnectionFactory; private Connection connection; private Session session; private MessageProducer producer; private String destinationName; private LoggingEventFormat format = new DefaultLoggingEventFormat(); private ExecutorService executor = Executors.newSingleThreadExecutor(); public void close() { closeJMSResources(); } public void onBind(ConnectionFactory service){ closeJMSResources(); jmsConnectionFactory = service; // Connect early to fail fast in case of config errors executor.execute(new Runnable() { @Override public void run() { try { getOrCreateConnection(); } catch (JMSException e) { LOG.warn("Exception connecting to broker - reinitializing JMS resources to recover",e); closeJMSResources(); } } }); } public void onUnbind(ConnectionFactory service){ closeJMSResources(); } public void doAppend(final PaxLoggingEvent paxLoggingEvent) { if (exclude(paxLoggingEvent) || jmsConnectionFactory == null) { return; } Runnable worker = new Runnable() { public void run() { try { // Send message to the destination TextMessage message = getOrCreateSession().createTextMessage(); message.setText(format.toString(paxLoggingEvent)); MessageProducer producer = getOrCreatePublisher(); producer.send(message); } catch (JMSException e) { LOG.warn("Exception caught while sending log event - reinitializing JMS resources to recover",e); closeJMSResources(); } } }; executor.execute(worker); } private static boolean exclude(PaxLoggingEvent event) { return startsWith(event.getLoggerName(), PACKAGE); } private static boolean startsWith(String string, String start) { return string != null && string.startsWith(start); } public void setJmsConnectionFactory(ConnectionFactory jmsConnectionFactory) { this.jmsConnectionFactory = jmsConnectionFactory; } public void setDestinationName(String destinationName) { this.destinationName = destinationName; } public void setFormat(String name) { if (LOGSTASH_EVENT_FORMAT.equals(name)) { format = new LogstashEventFormat(); } else { format = new DefaultLoggingEventFormat(); } } protected Connection getOrCreateConnection() throws JMSException { if (connection == null) { connection = jmsConnectionFactory.createConnection(); connection.start(); } return connection; } protected Session getOrCreateSession() throws JMSException { if (session == null) { session = getOrCreateConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); } return session; } protected MessageProducer getOrCreatePublisher() throws JMSException { if (producer == null) { Destination topic = session.createTopic(destinationName); producer = session.createProducer(topic); producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); } return producer; } private void closeJMSResources() { close(producer); close(session); close(connection); producer = null; session = null; connection = null; } private static void close(Object obj) { if (obj == null) { return; } try { if (obj instanceof MessageProducer) { ((MessageProducer)obj).close(); } else if (obj instanceof Session) { ((Session)obj).close(); } else if (obj instanceof Connection) { ((Connection)obj).close(); } } catch (JMSException e) { LOG.debug("Exception caught while closing JMS resources", e); } } } ================================================ FILE: logging/jms-appender/src/main/java/org/apache/servicemix/logging/jms/LoggingEventFormat.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.logging.jms; import org.ops4j.pax.logging.spi.PaxLoggingEvent; /** * Interface to represent an event message format, used for serializing log events into JMS messages */ public interface LoggingEventFormat { public String toString(PaxLoggingEvent event); } ================================================ FILE: logging/jms-appender/src/main/java/org/apache/servicemix/logging/jms/LogstashEventFormat.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.logging.jms; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; import javax.json.Json; import javax.json.JsonArrayBuilder; import javax.json.JsonException; import javax.json.JsonObjectBuilder; import org.ops4j.pax.logging.spi.PaxLoggingEvent; /** * Creates a log message in Logstash' internal message format, * cfr. https://github.com/logstash/logstash/wiki/logstash's-internal-message-format */ public class LogstashEventFormat implements LoggingEventFormat { protected static final DateFormat TIMESTAMP_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); protected static final String FIELDS = "@fields"; protected static final String MESSAGE = "@message"; protected static final String SOURCE = "@source"; protected static final String TAGS = "@tags"; protected static final String TIMESTAMP = "@timestamp"; public String toString(PaxLoggingEvent event) { JsonObjectBuilder object = Json.createObjectBuilder(); try { object.add(MESSAGE, event.getMessage()); object.add(SOURCE, event.getLoggerName()); object.add(TIMESTAMP, TIMESTAMP_FORMAT.format(new Date(event.getTimeStamp()))); JsonObjectBuilder fields = Json.createObjectBuilder(); for (Object property : event.getProperties().entrySet()) { Map.Entry entry = (Map.Entry) property; fields.add(entry.getKey(), entry.getValue().toString()); } object.add(FIELDS, fields); JsonArrayBuilder tags = Json.createArrayBuilder(); tags.add(event.getLevel().toString()); object.add(TAGS, tags); } catch (JsonException e) { // let's return a minimal, String-based message representation instead return "{ \"" + MESSAGE + "\" : " + event.getMessage() + "}"; } return object.build().toString(); } } ================================================ FILE: logging/jms-appender/src/main/resources/OSGI-INF/blueprint/config.xml ================================================ ================================================ FILE: logging/jms-appender/src/test/java/org/apache/servicemix/logging/jms/JMSAppenderTest.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.logging.jms; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.camel.component.ActiveMQComponent; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.*; import javax.naming.Context; /** * Test cases for {@link JMSAppender} */ public class JMSAppenderTest extends CamelTestSupport { private static final String EVENTS_TOPIC = "Events"; private JMSAppender appender; private static BrokerService broker; @BeforeClass public static void setupBroker() throws Exception { broker = new BrokerService(); broker.setPersistent(false); broker.setUseJmx(false); broker.setBrokerName("test.broker"); broker.start(); } @Before public void setupAppender() throws Exception { appender = new JMSAppender(); appender.setDestinationName(EVENTS_TOPIC); appender.onBind(new ActiveMQConnectionFactory(broker.getVmConnectorURI().toString() + "?create=false")); } @After public void closeAppender() throws Exception { appender.onUnbind(null); appender.close(); } @AfterClass public static void stopBroker() throws Exception { broker.stop(); } @Test public void testLogstashAppender() throws InterruptedException { MockEndpoint events = getMockEndpoint("mock:events"); events.expectedMessageCount(1); appender.doAppend(MockEvents.createInfoEvent()); assertMockEndpointsSatisfied(); } @Test public void testReconnectToBroker() throws Exception { MockEndpoint events = getMockEndpoint("mock:events"); events.expectedMessageCount(2); appender.doAppend(MockEvents.createInfoEvent()); // let's tamper with the underlying JMS connection, causing us to get an exception on the next log event // afterwards, the appender should recover and start logging again automatically appender.getOrCreateConnection().close(); appender.doAppend(MockEvents.createInfoEvent()); appender.doAppend(MockEvents.createInfoEvent()); assertMockEndpointsSatisfied(); } @Override protected Context createJndiContext() throws Exception { Context context = super.createJndiContext(); context.bind("amq", ActiveMQComponent.activeMQComponent(broker.getVmConnectorURI().toString() + "?create=false")); return context; } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("amq:topic://" + EVENTS_TOPIC).to("mock:events"); } }; } } ================================================ FILE: logging/jms-appender/src/test/java/org/apache/servicemix/logging/jms/LogstashEventFormatTest.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.logging.jms; import java.io.StringReader; import javax.json.Json; import javax.json.JsonException; import javax.json.JsonObject; import org.junit.Test; import org.ops4j.pax.logging.spi.PaxLoggingEvent; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; /** * Test cases for the {@link LogstashEventFormat} class */ public class LogstashEventFormatTest { private final LoggingEventFormat format = new LogstashEventFormat(); @Test public void testBasicLogstashFormat() throws JsonException { PaxLoggingEvent event = MockEvents.createInfoEvent(); JsonObject object = Json.createReader(new StringReader(format.toString(event))).readObject(); assertEquals(MockEvents.LOG_MESSAGE, object.getString(LogstashEventFormat.MESSAGE)); assertEquals(MockEvents.LOGGER_NAME, object.getString(LogstashEventFormat.SOURCE)); assertEquals("INFO", object.getJsonArray(LogstashEventFormat.TAGS).getString(0)); assertEquals(MockEvents.LOG_PROPERTY_VALUE, object.getJsonObject(LogstashEventFormat.FIELDS).getString(MockEvents.LOG_PROPERTY_ID)); assertNotNull(object.get(LogstashEventFormat.TIMESTAMP)); System.out.println(object); } } ================================================ FILE: logging/jms-appender/src/test/java/org/apache/servicemix/logging/jms/MockEvents.java ================================================ /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.servicemix.logging.jms; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.spi.LoggingEvent; import org.ops4j.pax.logging.service.internal.PaxLoggingEventImpl; import org.ops4j.pax.logging.spi.PaxLoggingEvent; /** * Helper class to create mock {@link PaxLoggingEvent}s for testing */ public class MockEvents { public static final String LOGGER_NAME = "my.test.logger"; public static final String LOG_MESSAGE = "Important message about your application!"; public static final String LOG_PROPERTY_ID = "property.id"; public static final String LOG_PROPERTY_VALUE = "property.value"; protected static PaxLoggingEvent createInfoEvent() { return createInfoEvent(LOGGER_NAME, LOG_MESSAGE); } protected static PaxLoggingEvent createInfoEvent(String name, String message) { Logger logger = Logger.getLogger(name); return createEvent(logger, Level.INFO, message, null); } private static PaxLoggingEvent createEvent(Logger logger, Level level, String message, Exception exception) { LoggingEvent event = new LoggingEvent(logger.getName(), logger, level, message, exception); event.setProperty(LOG_PROPERTY_ID, LOG_PROPERTY_VALUE); return new PaxLoggingEventImpl(event); } } ================================================ FILE: logging/jms-appender/src/test/resources/log4j.properties ================================================ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # The logging properties used during tests.. # log4j.rootLogger=DEBUG, out # CONSOLE appender not used by default log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n # File appender log4j.appender.out=org.apache.log4j.FileAppender log4j.appender.out.layout=org.apache.log4j.PatternLayout log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n log4j.appender.out.file=target/jms-appender.log log4j.appender.out.append=true ================================================ FILE: logging/pom.xml ================================================ 4.0.0 org.apache.servicemix.parent features-parent 7.1.0-SNAPSHOT ../parent/features-parent/pom.xml org.apache.servicemix.logging logging pom Apache ServiceMix :: Logging jms-appender ================================================ FILE: manual/README.txt ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ServiceMix Documentation ======================== Overview -------- The documentation is written in the Asciidoctor format, and processed using the Maven Asciidoctor plugin. Building the documentation project ---------------------------------- `mvn clean install` will build the documentation and create a static website in `target/generated-docs`. The build process will also create files for all Karaf commands based on the correct Karaf version defined in the pom file. It appears that the Karaf manual is no longer deployed as a Maven artifact to the central repository. Consequently, no copy of the user and developmemt guides are included in this documentation. Instead, the link to the current Karaf documentation is provided. Publishing the documentation to the website ------------------------------------------- If you're an Apache ServiceMix committer, you can publish a new copy of the documentation pages with this command: `mvn clean install scm-publish:publish-scm` ================================================ FILE: manual/pom.xml ================================================ org.apache.servicemix.parent assemblies-parent 7.1.0-SNAPSHOT ../parent/assemblies-parent/pom.xml 4.0.0 org.apache.servicemix manual pom Apache ServiceMix :: Manual Manual and Documentation ${project.version} 7.x 1.5.5 1.5.0-alpha.15 1.5.5 ${project.basedir}/src/main/asciidoc ${project.build.directory}/generated-docs ${asciidoctor.outputDirectory}/pdf 2.0.8 0.16.2 6.0.0 5.0.0 ${asciidoctor.sourceDirectory}/generated-docs-karaf/ maven-clean-plugin 3.0.0 ${karaf.commands.dir} **/*.adoc false org.asciidoctor asciidoctor-maven-plugin ${asciidoctor-maven-plugin.version} org.asciidoctor asciidoctorj-pdf ${asciidoctorj.pdf.version} org.asciidoctor asciidoctorj ${asciidoctorj.version} ${asciidoctor.sourceDirectory} ./images article ${project.version} ${servicemix.version} ${camel.version} output-html process-resources process-asciidoc html5 ${asciidoctor.outputDirectory} coderay left@ 5@ Generated font true - true output-pdf process-resources process-asciidoc pdf ${asciidoctor.pdf.outputDirectory} rouge article font center - ${project.version} org.apache.karaf.tooling karaf-maven-plugin ${karaf.version} generate-commands-help generate-resources commands-generate-help asciidoc ${karaf.commands.dir} plugin org.apache.karaf.shell org.apache.karaf.shell.commands ${karaf.version} org.apache.karaf.shell org.apache.karaf.shell.core ${karaf.version} org.apache.karaf.log org.apache.karaf.log.core ${karaf.version} org.apache.karaf.obr org.apache.karaf.obr.core ${karaf.version} org.apache.karaf.bundle org.apache.karaf.bundle.core ${karaf.version} org.apache.karaf.bundle org.apache.karaf.bundle.springstate ${karaf.version} org.apache.karaf.service org.apache.karaf.service.core ${karaf.version} org.apache.karaf.system org.apache.karaf.system.core ${karaf.version} org.apache.karaf.shell org.apache.karaf.shell.ssh ${karaf.version} org.apache.karaf.web org.apache.karaf.web.core ${karaf.version} org.apache.karaf.wrapper org.apache.karaf.wrapper.core ${karaf.version} org.apache.karaf.instance org.apache.karaf.instance.core ${karaf.version} org.apache.karaf.diagnostic org.apache.karaf.diagnostic.core ${karaf.version} org.apache.karaf.features org.apache.karaf.features.command ${karaf.version} org.apache.karaf.jaas org.apache.karaf.jaas.command ${karaf.version} org.apache.karaf.scr org.apache.karaf.scr.command ${karaf.version} org.apache.karaf.jdbc org.apache.karaf.jdbc.core ${karaf.version} org.apache.karaf.jms org.apache.karaf.jms.core ${karaf.version} org.apache.karaf.jndi org.apache.karaf.jndi.core ${karaf.version} org.apache.karaf.config org.apache.karaf.config.core ${karaf.version} org.apache.karaf.http org.apache.karaf.http.core ${karaf.version} org.apache.karaf.kar org.apache.karaf.kar.core ${karaf.version} org.apache.karaf.package org.apache.karaf.package.core ${karaf.version} org.apache.karaf.profile org.apache.karaf.profile.core ${karaf.version} org.apache.karaf.scheduler org.apache.karaf.scheduler.core ${karaf.version} org.apache.karaf.subsystem org.apache.karaf.subsystem.core ${karaf.version} org.apache.felix org.apache.felix.gogo.runtime ${felix.gogo.version} org.osgi org.osgi.core ${osgi.version} org.osgi org.osgi.compendium ${osgi.compendium.version} org.apache.felix org.apache.felix.bundlerepository ${felix.bundlerepository.version} org.codehaus.groovy.maven gmaven-plugin 1.0 create-commands-adoc-file generate-resources execute ${basedir}/src/main/groovy/CreateKarafCommandsAdocFile.groovy ${karaf.commands.dir} org.apache.maven.plugins maven-scm-publish-plugin 1.0-beta-2 [scm-publish] Updating ServiceMix ${servicemix.docs.location} documentation contents scm:svn:https://svn.apache.org/repos/asf/servicemix/site/production/docs/${servicemix.docs.location} ${project.build.directory}/generated-docs ================================================ FILE: manual/src/main/asciidoc/activemq-guide/_activemq-camel-example.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Using ActiveMQ with Camel This sections is based on the activemq-camel-blueprint example in the ServiceMix distribution. === Objectives The objectives of this sections are to explain how to * define Camel routes as an OSGi bundle using Blueprint, * publish messages to an ActiveMQ queue, * consume messages from an ActiveMQ queue, * build and install the OSGi bundle, * write messages to the log. === Prerequisites For this example, it is assumed that ServiceMix, Java and Maven are installed locally on your machine. Further, it is assumed that ServiceMix is up and running. === ActiveMQ and ServiceMix Web Consoles The ActiveMQ web console can be used to inspect and manage ActiveMQ configuration, queues and topics. If ServiceMix is running locally, the console can be accessed at http://localhost:8181/activemqweb/. If the ActiveMQ web console has not been installed previously, install the feature from the Karaf console: [source,text] ---- karaf@root> feature:install activemq-web-console ---- Note that the ServiceMix console is accessible at http://localhost:8181/system/console/, with default username smx, and password smx. This feature can be installed from the Karaf console using [source,text] ---- karaf@root>feature:install webconsole ---- Inspect the ActiveMQ web console before running the example. Note that initially, there are no queues defined. === Blueprint Example Explained The following Blueprint XML-file is based on the example included in the ServiceMix distribution. Configuration related to the custom transformation bean and handling of persistent properties have been removed for simplicity. [source,xml,options="nowrap"] ---- ---- <1> A Camel timer endpoint generates a heartbeat event every 2000ms, generating a new message. <2> The timer message is transformed by the _transform_ method of the bean referenced by _myTransform_. <3> The message is sent to the LOG.ME queue on the ActiveMQ broker. This queue is created automatically. <4> The message is consumed from the LOG.ME queue on the ActiveMQ broker. <5> A Camel log endpoint sends the message to the Jakarta commons logger. By default, the log is written to _c:\bin\apache-servicemix-7.0.0\data\log\servicemix.log. <6> The persistent property _prefix_ has a default value of _ActiveMQ-Blueprint-Example_ and can be configured in the file _org.apache.servicemix.examples.cfg_ if desired. <7> The bean _myTransform_ references the class _org.apache.servicemix.examples.activemq.MyTransform_. This class has one configurable property, _prefix_. The expression _${prefix}_ links it to the corresponding persistent cm:property. The class _org.apache.servicemix.examples.activemq.MyTransform_ transforms the message, using the _prefix_, some text and the current date. It writes to both a logger and System.out. === Building, Running, and Modifying the Example Open a command window and navigate to the example directory, e.g. _c:\bin\apache-servicemix-7.0.0\examples\activemq\activemq-camel-blueprint\_. WARNING: If you are using ServiceMix 7.0.0 download the pom.xml-file from https://issues.apache.org/jira/browse/SM-3225 and replace the pom.xml-file in the examples folder of the distribution with this. Build the bundle by executing `mvn clean install`. After a successfull build, install the bundle from the Karaf console using [source,text] ---- karaf@root> feature:install examples-activemq-camel-blueprint ---- Almost immediately, log messages begin to appear in the Karaf console. Open the ActiveMQ web console at http://localhost:8181/activemqweb/ and inspect the Queues: the queue _LOG.ME_ has automatically been created. Edit the class _MyTransform_ and set `verbose=false;` to suppress the messages written to the Karaf console. Rebuild the bundle, and reinstall it. Note that the bundle needs to be uninstalled before it can be re-installed: [source,text] ---- karaf@root> feature:uninstall examples-activemq-camel-blueprint karaf@root> feature:install examples-activemq-camel-blueprint ---- TIP: The relation between the feature name, _examples-activemq-camel-blueprint_, and the Maven artifact coordinates is defined in the file _servicemix-examples-{servicemix-version}-features.xml_ in the ServiceMix distribution. ================================================ FILE: manual/src/main/asciidoc/activemq-guide/_activemq-guide.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This document is intended to be included in other documents. // No title heading! // The top level heading in all included documents should not be a document title. include::_introduction.adoc[] include::_activemq-camel-example.adoc[] ================================================ FILE: manual/src/main/asciidoc/activemq-guide/_introduction.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Introducing ActiveMQ Apache ActiveMQ is the most popular and powerful open source messaging and Integration Patterns provider. Apache ActiveMQ is fast, supports many Cross Language Clients and Protocols and many advanced features while fully supporting JMS 1.1 and J2EE 1.4. Apache ActiveMQ is released under the Apache 2.0 License. === ActiveMQ Supports ==== Easy communication via Cross Language Clients * ActiveMQ C++ Clients * Ajax * C Integration * CMS * Delphi and FreePascal * dot Net * Perl * PHP * Pike * Python * Ruby * WebSockets * JMS to JMS Bridge ==== Several Protocols * AMQP * OpenWire * REST * RSS and Atom * Stomp * WSIF * WS Notification * XMPP === Using ActiveMQ from ServiceMix To start using ActiveMQ from your code, simply get hold of the connection pool declared in the activemq.xml file. You can also utilize ActiveMQ from Camel via the camel-jms component. === When should I use ActiveMQ? Whenever you have a unit of work or payload that you could process asynchronously, you would like to have multiple recipients, concurrent competing recipients to scale or leverage multiple processing units. If you want to spread load across multiple system boundaries. You want to cluster or provide fail over and messaging security, you have long running flows. In any of these instances it would be strongly suggested you evaluate what a scalable and secure messaging solution can bring to the table. === Common use cases Integration with other systems, since you can pass messages in and out of ActiveMQ from pretty much any programming language it is very simple to start integrating heterogeneous environments. Providing an event driven architecture. You can develop your solutions based on actions as opposed to looking for data or relying on completely synchronous behaviour. Providing infrastructure for messaging across large distances, leverage the network connectors and broker networks to integrate for example geographically different data centres. ================================================ FILE: manual/src/main/asciidoc/activemq-guide/activemq-guide.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This is standalone document with a Asciidoctor document title. // This document is not intended to be included in other documents. = ActiveMQ Guide Apache Software Foundation :numbered: include::activemq-guide/_activemq-guide.adoc[] ================================================ FILE: manual/src/main/asciidoc/activiti-guide/_activiti-camel-example.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Using Activiti with Camel In this example we show an example how Activiti can be used with Camel in ServiceMix through http://aries.apache.org/modules/blueprint.html[Blueprint Container]. Before being able to run Activiti with Camel, you have to install some additional features into the container first to add support for the Activiti. [source,text] ---- karaf@root>feature:install activiti ---- By default in ServiceMix, the Activiti Engine uses an embedded (local) H2 database. It the can be found under [source,text] ---- ${karaf.data}/activiti/database. ---- The Activiti engine is the entry point for starting new process instances, deploying new processes, querying for user tasks, and more. Process data is stored in the H2 database. === Blueprint configuration Let's see how you can set up the Camel context in a Blueprint configuration. As you can see, the Camel integration is specified with the Activiti Engine in the same Blueprint configuration: [source,xml,options="nowrap"] ---- org.apache.servicemix.examples.activiti ---- <1> This Camel context contains the routes that interact with our BPMN process. <2> Here we instruct the Camel context to scan the classpath in org.apache.servicemix.examples.activiti. <3> Obtain a reference to Activiti's RuntimeService - this reference will automatically be picked up by the subsequent Activiti Camel component definition. <4> Register a context provider to link the Camel context to the OrderProcess definition. Doing this will allow your BPMN process to communicate with the Camel routes using the ${camel} expression. === Route Definition [source,java,options="nowrap"] ---- public class ActivitiRouteBuilder extends RouteBuilder { private final Helper helper = new Helper(); @Override public void configure() throws Exception { /* * This route will start a new OrderProcess instance. Using the * PROCESS_KEY_PROPERTY, we are assigning a business key to our process * to allow for easier correlation in later processing steps. We are * also sending a Map containing additional variables to add to the * process instance. */ from("file:var/activiti-camel/order") .setBody(bean(helper)) .setProperty(PROCESS_KEY_PROPERTY, simple("file:name")) .to("activiti:OrderProcess") .log("Process to handle incoming order file has been started (process instance id ${body})"); /* * This route will notify a running OrderProcess of an order delivery * event. Here too, we are setting the PROCESS_KEY_PROPERTY to * correlate the delivery message with right order process instance. */ from("file:var/activiti-camel/delivery") .log("Notifying process about delivery for order ${file:name}") .setBody(bean(helper)) .setProperty(PROCESS_KEY_PROPERTY, simple("file:name")) .to("activiti:OrderProcess:receiveDelivery"); /* * The BPMN process can also trigger Camel routes as part of the * process. In these routes, the variables that you added to the * process are available as Exchange properties. The next two routes * will be triggered while processing the order and the order delivery. */ from("activiti:OrderProcess:processOrder?copyVariablesToProperties=true") .log("Processing order ${property.orderid} created on ${property.timestamp}") .log(" original message: ${property.message}"); from("activiti:OrderProcess:processDelivery?copyVariablesToProperties=true") .log("Processing delivery for order ${property.orderid} created on ${property.timestamp}") .log(" original message: ${property.message}"); } /* * A few helper methods used for routing */ public static final class Helper { /* * This method will extract information from the Exchange (using Camel * annotations) and put them in a Map that will be used for setting up * the process' variables. */ @Handler public Map getProcessVariables(@Body String body, @Header(Exchange.FILE_NAME) String filename, @Simple("${date:now:yyyy-MM-dd kk:mm:ss}") String timestamp) { Map variables = new HashMap(); variables.put("message", body); variables.put("orderid", filename); variables.put("timestamp", timestamp); return variables; } } } ---- === Process definition [source,xml,options="nowrap"] ---- ---- The process presented here above define a simple order process. It processes the incoming orders and subsequently waits for its delivery. Once the delivery notification has been received, another bit of processing occurs before the business process ends. This process defines the BPMN definition and is automatically deployed as soon as bundle is started: [source,text] ---- start --> processOrder --> waitForDelivery --> processDelivery --> end ---- When the service task is executed by the Activiti Engine, the execution is delegated to the CamelBehaviour class, which will send a message containing all process variables to an Activiti endpoint defined in the Camel context. This behavior is obtained through the use the delegateExpression in the Java service task === Building and running the example . Open a command prompt, and navigate to the directory containing the example, _examples/activiti/activiti-camel_. . Build the bundle using `mvn clean install`. . In the Karaf console, install the bundle using `bundle:install mvn:org.apache.servicemix.examples/activiti-camel/{servicemix-version}`. Note the bundle id that is returned. . In the Karaf console, start the bundle using `bundle:start `, where the id is the bundle id returned from the preceeding command. . Create a possibly empty file representing a new order in the newly created directory _var/activiti-camel/order_ under your ServiceMix installation directory. The file name corresponds to the order id. . In the log, you will find a message similar to + _Process to handle incoming order file has been started (process instance id {orderid=1234, message=, timestamp=2017-05-09 20:35:33})_ . At that point, you have a running process instance for order 1234 that is waiting for delivery. . To notify the process about the delivery, you have to create a file with the same name in the _var/activiti-camel/delivery_ directory. . As soon as the Camel route picks up the file, you will find messages similar to + _Notifying process about delivery for order 1234_ + and + _Processing delivery for order 1234 created on 2017-05-09 20:43:09_ + in the log. ================================================ FILE: manual/src/main/asciidoc/activiti-guide/_activiti-guide.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This document is intended to be included in other documents. // No title heading! // The top level heading in all included documents should not be a document title. include::_introduction.adoc[] include::_activiti-camel-example.adoc[] ================================================ FILE: manual/src/main/asciidoc/activiti-guide/_introduction.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Introducing Activiti Activiti is a BPMN 2.0 process-engine framework that implements the BPMN 2.0 specification. It's able to perform BPMN 2.0 functions including deploy process definitions, start new process instances, and execute user tasks. Its core is a super-fast and rock-solid BPMN 2 process engine for Java. === Activiti Engine This is the heart of the Activiti project. It's a Java process engine that runs BPMN 2 processes natively. It will have the following key properties: * Allows user updates to be combined with process updates in a single transaction * Runs on any Java environment like Spring, JTA, standalone with any form of transaction demarcation * Easy to get up and running with the setup utility * Built to support the cloud scalability from the ground up * Very simple to add new custom activity types and complete dedicated process languages * Transactional timers * Asynchronous continuations * Hidden event listeners for decoupling software technical details from business level diagram * Ability to test process executions in isolation in a plain unit test == Goal of this guide The goal of this guide is to look into the details for using Activiti inside ServiceMix: * create a project * write and debug a simple process == Examples The Apache ServiceMix distributions also contains an Activiti example. You can find this example in the _examples/activiti_ directory. == More information about Activiti More information about Activiti itself, can be found on http://activiti.org/. There's also book available about Activiti * Tijs Rademakers. (July 2012). _Activiti in Action_. Greenwich, Manning. ISBN: 9781617290121. image::rademakers2.png[Activiti in Action] ================================================ FILE: manual/src/main/asciidoc/activiti-guide/activiti-guide.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This is standalone document with a Asciidoctor document title. // This document is not intended to be included in other documents. = Activiti Guide Apache Software Foundation :numbered: include::activiti-guide/_activiti-guide.adoc[] ================================================ FILE: manual/src/main/asciidoc/camel-guide/_camel-guide.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This document is intended to be included in other documents. // No title heading! // The top level heading in all included documents should not be a document title. include::_introduction.adoc[] include::_deployment.adoc[] include::_plain-spring.adoc[] include::_plain-blueprint.adoc[] include::_osgi-bundle-spring.adoc[] include::_osgi-bundle-blueprint.adoc[] include::_installing-components.adoc[] include::_troubleshooting.adoc[] ================================================ FILE: manual/src/main/asciidoc/camel-guide/_deployment.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Deployment Options There are a few different ways to deploy Camel routes on ServiceMix: * deploy routes in a plain Blueprint XML file * deploy routes in a plain Spring XML file * deploy a bundle containing a Blueprint XML file * deploy a bundle containing a Spring XML file === Benefits and drawbacks ==== Plain XML or OSGi bundles Choose a plain XML file: * if you want to get routes deployed as quickly as possible. + All you need for developing routes is a simple text editor, no compilation and building is required. * if you prefer the XML syntax over the Java of Scala DSL. Choose an OSGi bundle: * if you want to package helper classes together with your route definitions. * if you prefer developing routes in the Java or Scala DSL. + The RouteBuilder implementations can be packaged inside the bundle. ==== Blueprint or Spring Choose Blueprint if you want the best possible integration with the OSGi Framework and Service Registy. The Blueprint specification has been developed specifically for the OSGi Framework by the OSGi Alliance. Choose Spring if you already invested in Spring for creating and running Camel routes. ================================================ FILE: manual/src/main/asciidoc/camel-guide/_installing-components.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Installing Components [[camel-installing]] Camel comes with almost 200 components, so you can imagine that we don't install all of them by default. This section shows you how to find available components and how to install them at runtime. === List available components Camel components are available as installable features. You can look at the full list of available features using the _feature:list_ command, using _grep_ to limit things down to features related to Camel: [source,text,subs="attributes"] ---- karaf@root> feature:list | grep camel camel-xmlsecurity | {camel-version} | | Uninstalled | camel-{camel-version} | camel-xmpp | {camel-version} | | Uninstalled | camel-{camel-version} | camel-xstream | {camel-version} | x | Started | camel-{camel-version} | camel-yammer | {camel-version} | | Uninstalled | camel-{camel-version} | camel-zipfile | {camel-version} | | Uninstalled | camel-{camel-version} | ---- === Install and uninstalling components You can use _feature:install_ to install any component on the list. An example: to install the _camel-cache_ component [source,text] ---- karaf@root> feature:install camel-cache ---- Similarly, you can also uninstall components that you're no longer using with _feature:uninstall_ [source,text] ---- karaf@root> feature:uninstall camel-cache ---- ================================================ FILE: manual/src/main/asciidoc/camel-guide/_introduction.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Introduction Apache Camel is a powerful open source integration framework based on known Enterprise Integration Patterns with powerful Bean Integration. === Camel in ServiceMix In ServiceMix, Apache Camel is like our swiss army knife for creating integration solutions. It allows using XML or a Java/Scala-based DSL to express your routes, comes with almost 200 optional components, has powerful and versatile Java bean integration, error handling, and tons of other features. Apache Camel is installed by default if you first start the container. We also have out-of-the-box hot-deployment support for both Spring and Blueprint to make it easy to deploy your own Camel routes, as well as optionally installable features for all the available Camel components. === Goal of this guide The goal of this guide is to look into the details for using Camel inside ServiceMix: * deployment options * installing additional components === Examples The Apache ServiceMix distribution also contain a set of Camel examples. You can find these examples in the _examples/camel_ directory. === More information about Camel More information about Camel itself can be found on http://camel.apache.org. There's also a great book available about Camel. Its second edition is planned to be published in July 2017: * Ibsen, Claus, and Anstey, Jonathan. (July 2017). _https://www.manning.com/books/camel-in-action-second-edition[Camel in Action, Second Edition]_. Manning Publications. ISBN: 9781617292934. image::ibsen_2nd_meap.png[Camel in Action, Second Edition] ================================================ FILE: manual/src/main/asciidoc/camel-guide/_osgi-bundle-blueprint.adoc ================================================ === Deploy as an OSGi bundle with Blueprint Using an OSGi bundle to deploy your Camel routes allows you to use the Java or Scala DSL for defining your routes. In this case, we will use a Blueprint XML file to start your Camel routs. To do so, the Blueprint XML files have to be included in the bundle inside the _OSGI-INF/blueprint_ directory. [source,text] ---- + |- META-INF | |- MANIFEST.MF \- OSGI-INF \- blueprint \- camel-context.xml ---- As soon as the bundle becomes Active, the Blueprint extender will create the Blueprint container starting your Routes. ==== Example: Referring to Java or Scala RouteBuilder classes If your RouteBuilder classes have been defined in the _org.apache.servicemix.examples.camel_ package, the file would look like this: [source,xml,options="nowrap"] ---- org.apache.servicemix.examples.camel ---- ==== Example in the distribution Another example for using this deployment option can be found in the _camel-blueprint_ example that is shipped with Apache ServiceMix. In order to add a Java DSL route to that example, the following changes have to be implemented. First, add the camel-core library as a dependency to the pom-file: [source,xml,subs="attributes+"] ---- org.apache.camel camel-core {camel-version} ---- Then, add the following class to the org.apache.servicemix.examples.camel-package, alongside the existing _MyTransform_-class: [source,java] ---- package org.apache.servicemix.examples.camel; import org.apache.camel.builder.RouteBuilder; public class MyRouteBuilder extends RouteBuilder { public void configure() { // set up the transform bean MyTransform transform = new MyTransform(); transform.setPrefix("JavaDSL"); from("timer://javaTimer?fixedRate=true&period=2000") .bean(transform, "transform") .to("log:ExampleRouter"); } } ---- Finally, add the package-element to the Blueprint-file. The complete Blueprint file looks like this: [source,xml,options="nowrap"] ---- org.apache.servicemix.examples.camel ---- <1> The package-element causes the route defined by the Java DSL to be installed and started. <2> The route defined by XML tags and the one defined by the Java DSL are functionally equivalent, and run independently. <3> The default value of the prefix-parameter is displayed in the output in the Karaf console, unless it is changed in the example configuration file. Once you have built the example, with `mvn clean install`, and installed it in Karaf using `feature:install examples-camel-blueprint` output from both routes will be displayed in the Karaf console: [source,text] ---- >>>> Blueprint-Example set body: Sun May 07 13:38:47 CEST 2017 >>>> JavaDSL set body: Sun May 07 13:38:47 CEST 2017 ---- ================================================ FILE: manual/src/main/asciidoc/camel-guide/_osgi-bundle-spring.adoc ================================================ === Deploy as an OSGi bundle with Spring Using an OSGi bundle to deploy your Camel routes allows you to use the Java or Scala DSL for defining your routes. In this case, you're using Spring to start your Camel routes, so you include your Spring XML file (e.g. _camel-context.xml_) in the _META-INF/spring_ folder inside your bundle. [source,text] ---- + \- META-INF |- MANIFEST.MF \- spring \- camel-context.xml ---- After the bundle has been activated, the Spring DM extender will find, create and start your Spring ApplicationContexts. ==== Example: Referring to Java or Scala RouteBuilder classes If your RouteBuilder classes have been defined in the _org.apache.servicemix.manual.camel_ package, the file would look like this: [source,xml] ---- org.apache.servicemix.manual.camel ---- ==== Example in the distribution Another example for using this deployment option can be found in the _camel-osgi_ example that is shipped with Apache ServiceMix. ================================================ FILE: manual/src/main/asciidoc/camel-guide/_plain-blueprint.adoc ================================================ === Deploy as a plain Blueprint XML file ServiceMix supports the deployment of plain Blueprint XML files, automatically creating and starting the Blueprint container from the XML file. In order to leverage this feature to create and start Camel routes, drop a file with this syntax in the _$SERVICEMIX_HOME/deploy_ folder: [source,xml,options="nowrap"] ---- include::plain-blueprint-template.xml[] ---- ==== Example Create a new XML file, plain-blueprint.xml, in the deployment folder with the code below to start a route to copy files from one directory to another. [source,xml,options="nowrap"] ---- include::plain-blueprint.xml[] ---- Verify in the Karaf console that it has been started: [source,text] ---- karaf@root> bundle:list | grep plain-blueprint 223 | Active | 80 | 0.0.0 | plain-blueprint.xml karaf@root> ---- Copy a file into the folder _$SERVICEMIX_HOME/input_, and verify that it is copied to the folder _$SERVICEMIX_HOME/output_. Note that the original file has been moved to the folder _$SERVICEMIX_HOME/input/.camel_. ================================================ FILE: manual/src/main/asciidoc/camel-guide/_plain-spring.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // === Deploy as a plain Spring XML file ServiceMix supports the deployment of plain Spring XML files, automatically creating and starting the Spring ApplicationContext from the XML file. In order to leverage this feature to create and start Camel routes, drop a file with this syntax in the _$SERVICEMIX_HOME/deploy_ folder: [source,xml,options="nowrap"] ---- include::plain-spring-template.xml[] ---- ==== Example Create a new XML file, plain-spring.xml, in the deployment folder with the code below to start a route to copy files from one directory to another. [source,xml,options="nowrap"] ---- include::plain-spring.xml[] ---- Verify in the Karaf console that it has been started: [source,text] ---- karaf@root> bundle:list | grep plain-spring 223 | Active | 80 | 0.0.0 | plain-spring.xml karaf@root> ---- Copy a file into the folder _$SERVICEMIX_HOME/input_, and verify that it is copied to the folder _$SERVICEMIX_HOME/output_. Note that the original file has been moved to the folder _$SERVICEMIX_HOME/input/.camel_. ================================================ FILE: manual/src/main/asciidoc/camel-guide/_troubleshooting.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Troubleshooting In this section, you'll find solutions for some frequently asked questions when using Camel on ServicMix. === No component with id 'xyz' could be found This usually means that your route is trying to use a component that hasn't been installed yet. Solution: . install the additional component . restart the bundle using the _bundle:restart _ command - you can find the bundle id for your route in the output of the _bundle:list_ command Refer to <> ================================================ FILE: manual/src/main/asciidoc/camel-guide/camel-guide.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This is standalone document with a Asciidoctor document title. // This document is not intended to be included in other documents. = Camel User Guide Apache Software Foundation :numbered: include::camel-guide/_camel-guide.adoc[] ================================================ FILE: manual/src/main/asciidoc/camel-guide/plain-blueprint-template.xml ================================================ ================================================ FILE: manual/src/main/asciidoc/camel-guide/plain-blueprint.xml ================================================ ================================================ FILE: manual/src/main/asciidoc/camel-guide/plain-spring-template.xml ================================================ ================================================ FILE: manual/src/main/asciidoc/camel-guide/plain-spring.xml ================================================ ================================================ FILE: manual/src/main/asciidoc/contribute.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This is standalone document with a Asciidoctor document title. // This document is not intended to be included in other documents. = Contributing to the Documentation Apache Software Foundation :!numbered: :!toc: == Found an mistake or have a suggestion for improvement? We welcome any feedback or contribution to the documentation. Whether you spotted a mistake, have suggestions for new content or just want to say hi, feel to get in touch using the http://servicemix.apache.org/community/mailing-lists.html[mailing lists], http://servicemix.apache.org/community/irc.html[IRC channel] or on Twitter using the `#servicemix` hash tag. == Contributing to the documentation code The documentation is written using http://asciidoctor.org/[Asciidoctor]. The pages can be edited in any text editor. You can find more information about how to get and build the documentation codebase http://servicemix.apache.org/developers/source/documentation-source.html[here] and one more thing... We really love documentation patches ;) ================================================ FILE: manual/src/main/asciidoc/docinfo-footer.html ================================================
Apache ServiceMix Version {servicemix-version}. © 2008-2017 The Apache Software Foundation.
Apache ServiceMix, ServiceMix, Apache, the Apache feather logo, and the Apache ServiceMix project logo are trademarks of The Apache Software Foundation.
================================================ FILE: manual/src/main/asciidoc/docinfo.html ================================================ ================================================ FILE: manual/src/main/asciidoc/documentation.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This is standalone document with a Asciidoctor document title. // This document is not intended to be included in other documents. // This document is meant to contain (almost) everything. = Apache ServiceMix Documentation Apache Software Foundation :numbered: :toclevels: 3 == User Guide include::user-guide/_user-guide.adoc[leveloffset=+1] == Quickstart Guide include::quickstart/_quickstart.adoc[leveloffset=+1] == Camel Guide include::camel-guide/_camel-guide.adoc[leveloffset=+1] == ActiveMQ Guide include::activemq-guide/_activemq-guide.adoc[leveloffset=+1] == Activiti Guide include::activiti-guide/_activiti-guide.adoc[leveloffset=+1] == Karaf User Guide Apache ServiceMix uses Apache Karaf as the underlying OSGi server runtime. The https://karaf.apache.org/manual/latest/#_user_guide[Karaf User Guide] explains about the features and functionality provided by Karaf. == Karaf Developer Guide The Apache https://karaf.apache.org/manual/latest/#_developer_guide[Karaf Developer Guide] gives you some information about developing with and for the OSGi server runtime. == Resources include::resources/_resources.adoc[leveloffset=+1] ================================================ FILE: manual/src/main/asciidoc/index.adoc ================================================ = ServiceMix Apache Software Foundation :!numbered: :!toc: * <> [.small]#(image:pdf.png[] link:pdf/quickstart.pdf[as PDF])# + [smx-list-description]#If you're new to Apache ServiceMix, this document will guide you in your first steps in Apache ServiceMix.# * <> + [smx-list-description]#Apache ServiceMix contains a lot of different components and it embeds a lot of other Apache projects. This user guide will help you select and configure the right components when building your own solution.# * <> + [smx-list-description]#Apache ServiceMix embeds Apache ActiveMQ to provide a JMS message broker that you can interact with from your Camel routes, providing support for message persistence, clustering, failover, ...# * <> + [smx-list-description]#Apache Camel is a core component of Apache ServiceMix. This guide will show you how to build and deploy Camel routes for Apache ServiceMix.# * <> + [smx-list-description]#Apache ServiceMix embeds Activiti to provide a light-weight workflow and Business Process Management (BPM) Platform targeted at business people, developers and system admins, ...# * <> + [smx-list-description]#Help pages for all the available Karaf commands in the Apache ServiceMix console.# * link:++https://karaf.apache.org/manual/latest/#_user_guide++[Karaf User Guide] + [smx-list-description]#Apache ServiceMix uses Apache Karaf as the underlying OSGi server runtime. This manual explains about the features and functionality provided by Karaf.# * link:++https://karaf.apache.org/manual/latest/#_developer_guide++[Karaf Developer Guide] + [smx-list-description]#The Apache Karaf Developer Guide gives you some information about developing with and for the OSGi server runtime.# * <> + [smx-list-description]#A selection of related books and websites.# * <> * <> [.small]#(image:pdf.png[] link:pdf/documentation.pdf[as PDF])# + [smx-list-description]#The complete ServiceMix documentation as one file, without the Karaf documentation.# ================================================ FILE: manual/src/main/asciidoc/quickstart/_activemq.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Adding ActiveMQ to the 'Mix Out-of-the-box, every Apache ServiceMix instance comes with an embedded ActiveMQ JMS broker. This makes it easy to communicate between Camel routes using persistent messages on the same machine, but it will also enable you to distribute your routes over multiple instances afterwards for clustering or load-balancing. === Our scenario In this scenario, we also want to move files between directories. Instead of logging the move directly, we are going to send an event JMS message onto a queue. Afterwards, we will create a second Camel route to receive the events and log them. === Moving files and sending event messages The first Blueprint XML file we'll create contains a Camel route that moves the files from _activemq/input_ to the _activemq/output_ directory. Afterwards, it will generate an event message and send that to an ActiveMQ queue called _events_. [source,xml] ---- FileMovedEvent(file: ${file:name}, timestamp: ${date:now:hh:MM:ss.SSS}) ---- Save this file in ServiceMix' _deploy_ folder and use _bundle:list_ to check on the bundle status as you did with the simple Camel example. You should now be able to put files in the _activemq/input_ directory and see them being moved to _activemq/output_. === Receiving the event messages After deploying the first XML file, you're obviously not seeing any events being logged yet. The event messages are sent to an ActiveMQ queue, but there's nobody to receive the events yet. Let's change that now by creating a second Blueprint XML file. [source,xml] ---- ---- As soon as this second file has been deployed, you'll start seeing the event messages in your _log:display_ output. === Using the shell to manage the routes You can now start and stop both routes from the command shell. The important thing to note here is that you can stop the event handler route while files are being processed. As soon as you restart that bundle afterwards, you'll receive the events from all files that have been moved while the route was not running. ================================================ FILE: manual/src/main/asciidoc/quickstart/_camel.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Using Camel Now that we know how to operate Apache ServiceMix through the shell console, it's time to start using it for what it is built for. Let's build our very first integration solution with a Camel route and deploy it on ServiceMix. === Our simple scenario In this simple scenario, we're going to move files from an input directory called _camel/input_ to an output directory called _camel/output_. To ensure we can keep track of which files get moved, we'll also write a message to the log file whenever we move a file. === Creating the route One of the most simple ways to deploy a new route on ServiceMix, is by defining the route in a Blueprint XML file. [source,xml] ---- ---- === Deploying the route In order to deploy and start the route, just copy the XML file you created into ServiceMix' _deploy_ directory. The file will get picked up and deployed by ServiceMix. You will see a _camel/input_ folder appear in your ServiceMix installation directory and any files you copy into that directory will get moved into the _camel/output_ directory. If you do a _log:display_ in the shell, you will also see the log output for every file that's been moved. image::camel-sample-log.png[] === Using the shell to manage the route Using _bundle:list_, you'll notice that your XML file has been transformed into a bundle and that the Blueprint container has been created to start your Camel route. image::camel-sample-deploy.png[] From this output, you also learn that the bundle id for your XML file is 250. This allow you to start and stop the route whenever necessary. Let's give this a go now: First, stop the route with [source,text] ---- karaf@root> bundle:stop 250 ---- The route is no longer active, so any files you copy into the _orders/input_ folder will remain there for now. As soon as you restart the route, the pending files will get moving again. [source,text] ---- karaf@root> bundle:start 250 ---- ================================================ FILE: manual/src/main/asciidoc/quickstart/_console.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Apache ServiceMix console Now that we successfully installed and started Apache ServiceMix, we'll take a closer look at the console. This is where you manage your ServiceMix instance, add and remove bundles, install optional features, and more. === Working with bundles When ServiceMix is first started, a whole set of bundles providing the core features for the product are being installed. Let's use the command console to find out more about them. The _bundle:list_ command can be used to get a list of all bundles currently installed. Enter this [source,text] ---- karaf@root> bundle:list ---- This is what the output looks like if you run this on your ServiceMix instance. image::osgi-list.png[] For every bundle, you see: * the bundle id * the bundle state * the bundle start level * the bundle version and name If you're looking for something specific in the list, you can use unix-like pipes and utilities to help you. An example: to look for all Camel related bundles: [source,text] ---- karaf@root> bundle:list | grep camel ---- image::osgi-list-pipegrep.png[] === Working with logging Many of the applications you write will have some form of log output. To look at the message in the log file, you can us the _log:diplay_ command. [source,text] ---- karaf@root> log:display ---- image::log-display.png[] If you're only interested in the latest exception in the log file, you can use _log:exception-display_ instead. [source,text] ---- karaf@root> log:exception-display ---- image::log-display-exception.png[] You can also change the log level at runtime by using the _log:set_ command. You can try these commands on your instance now by first setting the log level to _DEBUG_ and then using _grep_ to make sure that you can actually see the extra logging. [source,text] ---- karaf@root> log:set DEBUG karaf@root> log:display | grep DEBUG ---- image::log-set-debug.png[] Afterwards, revert the log level to its original _INFO_ value again with _log:set_. [source,text] ---- karaf@root> log:set INFO ---- === ...and there's a lot more These are obviously just a few examples of what the command shell is all about. There are a lot more commands in the shell to help you deploy, monitor, manage and troubleshoot the applications you're building with ServiceMix. ================================================ FILE: manual/src/main/asciidoc/quickstart/_features.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Optional features Everything discussed in the quickstart guide so far is installed out-of-the-box in Apache ServiceMix, but we also have a lot of optional features that can be installed in the container when necessary. === List of features The list of features is available with the _feature:list_ command. The overview shows you whether or not the feature is currently installed, the version and the name of the feature. image::featureslist.png[] The full list contains a lot of different features: optional Camel components, features for adding OBR or wrapper support to ServiceMix, a web console, and many more. Again, you can use things like _|_ and _grep_ to find the things in the list that you're interested in. [source,text] ---- karaf@root> feature:list | grep camel ---- === Example: web console To get the web console installed in ServiceMix, install the feature from your console [source,text] ---- karaf@root> feature:install webconsole ---- Afterwards, you can verify that the feature is installed and started in the overview. [source,text] ---- karaf@root> feature:list | grep -i webconsole ---- image::featureslist-grep-webconsole.png[] You will now be able to point your browser to http://localhost:8181/system/console and login with user _smx_ and password _smx_ to access the web console. From the webconsole, Karaf can be managed, including starting and stopping bundles, installing and uninstalling features, and managing the configuration. ================================================ FILE: manual/src/main/asciidoc/quickstart/_installation.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Installation Before we can start working with Apache ServiceMix, we have to get it installed and running on our local machine first. === System requirements For running Apache ServiceMix itself, you'll need * Java Runtime Environment (JRE) 1.7.x (Java 7) or Java Runtime Environment (JRE) 1.8.x (Java 8) * About 100 MB of free disk space for the default assembly If you're developing your own integration applications and OSGi bundles, you'll also need * Java Developer Kit (JDK) 1.7.x (Java 7) or Java Developer Kit (JDK) 1.8.x (Java 8) * Apache Maven 3.0.4 or higher === Downloading Apache ServiceMix Apache ServiceMix {servicemix-version} is available under the Apache License v2 and can be downloaded from http://servicemix.apache.org/downloads.html. Depending on your operation system, you should download either the tar.gz or the zip file: * _tar.gz_ for Linux/Unix/MacOS X * _zip_ for Windows === Installing Apache ServiceMix Installing Apache ServiceMix is as simple as uncompressing the downloaded archive on your hard disk. For the rest of this guide, we'll refer to the this location as *__*. === Starting Apache ServiceMix Depending on your platform, start Apache ServiceMix by following the instructions below. After starting the container, you will have access to the console from which you can manage the container. ==== On Windows In a command prompt window, navigate to the directory where you extracted ServiceMix and run the _bin\servicemix.bat_ file. Example: if ServiceMix in installed in the _c:\tools\apache-servicemix-{servicemix-version}_ directory [source,text,subs="attributes"] ---- > cd c:\tools\apache-servicemix-{servicemix-version} > .\bin\servicemix ---- image::start-windows.png[] ==== On Linux/Unix/MacOS X On a command shell, navigate to the directory where you extracted ServiceMix and the _bin/servicemix_ shell script Example: if ServiceMix is installed in the _~/bin/apache-servicemix-{servicemix-version}_ directory. [source,text,subs="attributes"] ---- $ cd ~/bin/apache-servicemix-{servicemix-version} $ ./bin/servicemix ---- image::start-linux.png[] ================================================ FILE: manual/src/main/asciidoc/quickstart/_introduction.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Introduction First of all, welcome to the Apache ServiceMix project! The goal of this Quickstart guide is to give you a 20-minute overview of what ServiceMix is and what you can do with it. In that time, we'll install ServiceMix on your machine, deploy some basic integration routes and extend the container with an additional feature. ================================================ FILE: manual/src/main/asciidoc/quickstart/_quickstart.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This document is intended to be included in other documents. // No title heading! // The top level heading in all included documents should not be a document title. include::_introduction.adoc[] include::_installation.adoc[] include::_console.adoc[] include::_camel.adoc[] include::_activemq.adoc[] include::_features.adoc[] include::_summary.adoc[] ================================================ FILE: manual/src/main/asciidoc/quickstart/_summary.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Wrapping it up... This is where our introductory journey through the world of Apache ServiceMix ends. We've obviously just scratched the surface of what is possible, but we hope you have an idea of what you can expect from Apache ServiceMix and how you can use it in your environment. For more in-depth information, have a look at our set of user guides. Also, if you have any questions, we welcome you on our user mailing list! ================================================ FILE: manual/src/main/asciidoc/quickstart/quickstart.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This is standalone document with a Asciidoctor document title. // This document is not intended to be included in other documents. = Quickstart Guide Apache Software Foundation :numbered: include::quickstart/_quickstart.adoc[] ================================================ FILE: manual/src/main/asciidoc/resources/_resources.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This document is intended to be included in other documents. // No title heading! // The top level heading in all included documents should not be a document title. == Books [%autowidth,frame=topbot,grid=rows] |=== a|https://www.amazon.com/Enterprise-Integration-Patterns-Designing-Deploying/dp/0321200683/ref=sr_1_1?s=books&ie=UTF8&qid=1494695165&sr=1-1[Enterprise Integration Patterns : Designing, Building, and Deploying Messaging Solutions] + Gregor Hohpe and Bobby Woolf + October 2003 | image:eip150x198.jpg[] a|http://www.amazon.com/Service-Oriented-Business-Integration-Binildas-Christudas/dp/1847194400[Service Oriented Java Business Integration - Enterprise Service Bus Integration Solutions for Java Developers] + Binildas A. Christudas + March 2008 | image:sojbi150x190.jpg[] a|https://www.amazon.com/Design-Patterns-Prentice-Service-Oriented-Computing/dp/0136135161[SOA Design Patterns] + Thomas Erl + January 2009 | image:soa-dp-erl150x195.jpg[] a|https://www.manning.com/books/understanding-enterprise-soa[Understanding Enterprise SOA] + Eric Pulier and Hugh Taylor + November 2005 | image:pulier150x188.jpg[] a|https://www.amazon.com/o/ASIN/0131428985/002-7139888-4078404[Service-Oriented Architecture: A Field Guide to Integrating XML and Web Services] + Thomas Erl + April 2006 | image:soa-fieldguide-xml-ws150x197.jpg[] a|https://www.amazon.com/o/ASIN/0131858580/002-7139888-4078404[Service-Oriented Architecture (SOA): Concepts, Technology, and Design] + Thomas Erl + August 2005 | image:soa-concepts150x212.jpg[] a|https://www.amazon.com/o/ASIN/0131465759/002-7139888-4078404[Enterprise SOA: Service-Oriented Architecture Best Practices] + Dirk Krafzig, Karl Banke, and Dirk Slama + November 2004 | image:enterpreise-soa-best-practices-krafzig150x197.jpg[] a|https://www.amazon.com/Understanding-SOA-Services-Eric-Newcomer/dp/0321180860[Understanding SOA with Web Services] + Eric Newcomer and Greg Lomow + December 2004 | image:understanding-soa-ws-newcomer150x202.jpg[] a|https://www.amazon.com/Services-Service-Oriented-Architectures-Computing-Second/dp/0123983576[Web Services, Service-Oriented Architectures, and Cloud Computing, Second Edition: The Savvy Manager's Guide] + Douglas K. Barry + January 2013 | image:ws-soa-cloud-mamager-guide-barry150x225.jpg[] a|https://www.amazon.com/Web-Services-Platform-Architecture-WS-Addressing/dp/0131488740[Web Services Platform Architecture : SOAP, WSDL, WS-Policy, WS-Addressing, WS-BPEL, WS-Reliable Messaging, and More] + Sanjiva Weerawarana, Francisco Curbera, Frank Leymann, Tony Storey, and Donald F. Ferguson + April 2005 | image:webservice-platform150x196.jpg[] a|https://www.amazon.com/Loosely-Coupled-Missing-Pieces-Services/dp/1881378241[Loosely Coupled: The Missing Pieces of Web Services] + Doug Kaye + August 2003 | image:loosely-coupled-kaye150x208.jpg[] |=== == Websites * http://www.eaipatterns.com/[Enterprise Integration Patterns] * http://www.servicetechbooks.com/[The Prentice Hall Service Technology Series from Thomas Erl] ================================================ FILE: manual/src/main/asciidoc/resources/resources.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This is standalone document with a Asciidoctor document title. // This document is not intended to be included in other documents. = Resources Apache Software Foundation :numbered: include::resources/_resources.adoc[] ================================================ FILE: manual/src/main/asciidoc/user-guide/_introduction.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Introduction Apache ServiceMix is a flexible, open-source integration container that unifies the features and functionality of Apache ActiveMQ, Camel, CXF and Karaf into a powerful runtime platform for building integrations solutions. The goal of this document is to introduce you to the different components that are part of Apache ServiceMix and explain how and when they can be used together. ================================================ FILE: manual/src/main/asciidoc/user-guide/_technology-selection.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == Technology selection guide ServiceMix offers a set of different messaging and integration technologies: * ActiveMQ * Camel * CXF Depending on the solution you're building, you want to select one or more of these technologies. Below are some guidelines to help you pick the right mix for your problem. === When to use Camel? For any integration scenario, we recommend to start as simple as possible. Camel allows you to build routes for integration scenario's quickly and efficiently. You can deploy these routes directly on ServiceMix by deploying the plain Spring XML route or by packaging the route in an OSGi bundle. As you need more (advanced) features, start combining Camel with ActiveMQ and CXF. === When to use ActiveMQ? ActiveMQ is a JMS message broker, featuring support for clustering, pluggable persistence mechanism, master-slave configuration for failover, and more. ServiceMix includes an instance of the ActiveMQ broker, which can be combined with Camel to provide easy-to-use message persistence and reliable messaging. After setting up multiple instances of ActiveMQ (or ServiceMix) on the network, you can configure ActiveMQ clustering or master-slave mode to allow for a more reliable and scalable set-up. === When to use CXF? CXF is an open-source services framework that you can use to suit your REST and WS-* standards integration needs. It allows you to use common programming APIs like JAX-RS or JAX-WS for building your own services and to expose them to the outside world. You can use CXF from within your Camel routes with the Camel CXF component. ================================================ FILE: manual/src/main/asciidoc/user-guide/_user-guide.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This document is intended to be included in other documents. // No title heading! // The top level heading in all included documents should not be a document title. include::_introduction.adoc[] include::_what-is-servicemix.adoc[] include::_technology-selection.adoc[] ================================================ FILE: manual/src/main/asciidoc/user-guide/_what-is-servicemix.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // == What is (in) ServiceMix? Apache ServiceMix is an open source ESB (Enterprise Service Bus) that combines the functionality of a Service Oriented Architecture (SOA) and the modularity. The adoption of a Service Bus allows to decouple the applicatons together and reduce dependencies. Messages are used to wire together applications (=services) and/or connectors to exchange information using different protocols or communication modes like FTP, HTTP, and web services. Apache ServiceMix is designed on top of the OSGI specification. Using OSGI framework brings a new important feature to SOA development: modularity. That means that we can handle classloading and application lifecycle differently between the components. ServiceMix is lightweight and easily embeddable, has integrated Spring support and can be run at the edge of the network (inside a client or server), as a standalone ESB provider or as a service within another ESB. You can use ServiceMix in Java SE or Java EE application server. === Platform presentation Apache ServiceMix is a distributed ESB built from the ground up and released under the Apache license. ServiceMix uses ActiveMQ to provide remoting, clustering, reliability and distributed failover. ServiceMix can also be embedded into a JEE application server such as JBoss WildFly, Oracle Weblogic or IBM Websphere. === OSGi for Dummies http://www.osgi.org/About/Technology[OSGi technology] is the dynamic module system for http://www.oracle.com/technetwork/java/index.html[Java]. The OSGi Service Platform provides functionality to Java that makes Java the premier environment for software integration and thus for development. Java provides the portability that is required to support products on many different platforms. The OSGi technology provides the standardized primitives that allow applications to be constructed from small, reusable and collaborative components. These components can be composed into an application and deployed. The OSGi Service Platform provides the functions to change the composition dynamically on the device of a variety of networks, without requiring restarts. To minimize the coupling, as well as make these couplings managed, the OSGi technology provides a service-oriented architecture that enables these components to dynamically discover each other for collaboration. The OSGi Alliance has developed many standard component interfaces for common functions like HTTP servers, configuration, logging, security, user administration, XML and many more. Plug-compatible implementations of these components can be obtained from different vendors with different optimizations and costs. However, service interfaces can also be developed on a proprietary basis. OSGi technology adopters benefit from improved time-to-market and reduced development costs because OSGi technology provides for the integration of pre-built and pre-tested component subsystems. The technology also reduces maintenance costs and enables unique new aftermarket opportunities because components can be dynamically delivered to devices in the field. For more information, check out the http://www.osgi.org/Main/HomePage[OSGi Alliance website]. === Powered by Apache Karaf Apache ServiceMix is based on http://karaf.apache.org/[Apache Karaf]. Apache Karaf is a small http://www.osgi.org/Main/HomePage[OSGi-based] runtime which provides a lightweight container onto which various components and applications can be deployed. Here is a short list of features supported by the Karaf: Hot deployment: Karaf supports hot deployment of OSGi bundles by monitoring jar files inside the $home/deploy directory. Each time a jar is copied in this folder, it will be installed inside the runtime. You can then update or delete it and changes will be handled automatically. In addition, the Karaf also supports exploded bundles and custom deployers (Blueprint and Spring ones are included by default). Dynamic configuration: Services are usually configured through the ConfigurationAdmin OSGi service. Such configuration can be defined in Karaf using property files inside the $home/etc directory. These configurations are monitored and changes on the properties files will be propagated to the services. Logging System: using a centralized logging back end supported by Log4J, Karaf supports a number of different APIs (JDK 1.4, JCL, SLF4J, Avalon, Tomcat, OSGi) Provisioning: Provisioning of libraries or applications can be done through a number of different ways, by which they will be downloaded locally, installed and started. Native OS integration: Karaf can be integrated into your own Operating System as a service so that the lifecycle will be bound to your Operating System. Extensible Shell console: Karaf features a nice text console where you can manage the services, install new applications or libraries and manage their state. This shell is easily extensible by deploying new commands dynamically along with new features or applications. Remote access: use any SSH client to connect to Karaf and issue commands in the console . Security framework based on JAAS. Managing instances: Karaf provides simple commands for managing multiple instances. You can easily create, delete, start and stop instances of Karaf through the console. For more information, check out the http://karaf.apache.org/[Apache Karaf project page]. === Apache Camel Apache Camel is a powerful open source integration framework based on known http://camel.apache.org/enterprise-integration-patterns.html[Enterprise Integration Patterns] with powerful http://camel.apache.org/bean-integration.html[Bean Integration]. Apache Camel lets you create the http://camel.apache.org/enterprise-integration-patterns.html[Enterprise Integration Patterns] to implement routing and mediation rules in either a Java based http://camel.apache.org/dsl.html[Domain Specific Language (or Fluent API)], via http://camel.apache.org/spring.html[Spring based Xml Configuration] files or via the http://camel.apache.org/scala-dsl.html[Scala DSL]. For more information, check out the <>. === Services proposed _TODO: write this bit_ ==== Message Broker : Apache ActiveMQ Apache ServiceMix ships with an embedded instance of http://activemq.apache.org[Apache ActiveMQ] out-of-the-box. It is a fully functional Apache ActiveMQ message broker instance listening for http://activemq.apache.org/openwire.html[TCP] connections on port 61616 and http://activemq.apache.org/stomp.html[STOMP] connections on port 61613. The http://activemq.apache.org/xml-configuration.html[default configuration for the Apache ActiveMQ] message broker resides in the ServiceMix installation directory under the etc sub-directory. The ActiveMQ configuration file is named activemq.xml. It's configured with reasonable default information like http://activemq.apache.org/persistence.html[Persistence (KahaDB)] and http://activemq.apache.org/producer-flow-control.html[Producer Flow Control] (essentially to make sure the broker does not run out of memory). The configuration file also makes use of a reusable connection pool available to all OSGi bundles exposing a http://docs.oracle.com/javaee/1.4/api/javax/jms/ConnectionFactory.html[javax.jms.ConnectionFactory] as a service for consumption. You can re-use this connection pool via tools such as http://activemq.apache.org/osgi-integration.html[spring-dm or blueprint]. The ActiveMQ message broker allows several components such as servicemix-cluster, http://camel.apache.org/jms.html[camel-jms], http://camel.apache.org/activemq.html[camel-activemq], http://cxf.apache.org/docs/jms-transport.html[cxf-jms transport] to be utilized without any additional configuration. ==== Transaction : Geronimo Transaction Manager _TODO: write this bit_ ==== Routing and Mediation : Apache Camel _TODO: write this bit_ ==== Web Services : Apache CXF _TODO: write this bit_ ==== Web Container _TODO: write this bit_ ==== SOA platform _TODO: write this bit_ ===== Spring DM container _TODO: write this bit_ ===== Blueprint OSGI container _TODO: write this bit_ ===== EJB Container _TODO: write this bit_ ================================================ FILE: manual/src/main/asciidoc/user-guide/user-guide.adoc ================================================ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // This is standalone document with a Asciidoctor document title. // This document is not intended to be included in other documents. = User Guide Apache Software Foundation :numbered: include::user-guide/_user-guide.adoc[] ================================================ FILE: manual/src/main/groovy/CreateKarafCommandsAdocFile.groovy ================================================ def dir = new File(project.properties.karafCommandsDir) def out = new File(project.properties.karafCommandsDir,"karaf-commands.adoc") out.write ("= Karaf Commands\n\n") def commands = [:] dir.eachFile { it -> def line = it.readLines()[0] def command = line - ~/^=\s/ def filename = command.replace(":","-") + ".adoc" def link = "<<${filename}#,${command}>>" commands.put(command, link) } def keys = commands.keySet().sort() def lastGroup = "" keys.findAll { it.contains(":") }.each { key -> def group = key.split(":")[0] if (!lastGroup.equals(group)) { lastGroup = group out.append("\n== ${group}\n\n") } def link = commands[key] out.append("* ${link}\n") } ================================================ FILE: parent/assemblies-parent/pom.xml ================================================ org.apache.servicemix parent 7.1.0-SNAPSHOT 4.0.0 org.apache.servicemix.parent assemblies-parent pom Apache ServiceMix :: Parent :: Assemblies Parent Bill-of-materials of the core components and versions used for building the assemblies 5.14.5 2.16.5 3.1.9 2.6.3 1.0 2.9 4.0.9 4.9.1 1.8.5 2.8.0 2.7.2_3 2.7.2_1 2.11.0 1.4.0 3.3.0 2.0 org.apache.karaf karaf ${karaf.version} pom import org.apache.camel camel-parent ${camel.version} pom import org.apache.camel.karaf apache-camel ${camel.version} xml features org.apache.cxf.karaf apache-cxf ${cxf.version} xml features org.apache.karaf.features framework ${karaf.version} kar org.apache.karaf.features standard features ${karaf.version} xml org.apache.karaf.features enterprise features ${karaf.version} xml org.apache.karaf.features spring features ${karaf.version} xml org.apache.activemq activemq-karaf ${activemq.version} xml features org.ops4j.pax.logging pax-logging-service ${pax.logging.version} org.ops4j.pax.logging pax-logging-api ${pax.logging.version} org.ops4j.pax.exam pax-exam ${pax.exam.version} test org.ops4j.pax.exam pax-exam-container-karaf ${pax.exam.version} test org.ops4j.pax.exam pax-exam-container-remote ${pax.exam.version} test org.ops4j.pax.exam pax-exam-junit4 ${pax.exam.version} test org.ops4j.pax.exam pax-exam-spi ${pax.exam.version} test org.apache.felix maven-bundle-plugin ${maven-bundle-plugin.version} true org.apache.servicemix.tooling depends-maven-plugin ${depends-maven-plugin.version} org.apache.karaf.tooling karaf-maven-plugin ${karaf.version} true ================================================ FILE: parent/features-parent/pom.xml ================================================ org.apache.servicemix.parent assemblies-parent 7.1.0-SNAPSHOT ../assemblies-parent/pom.xml 4.0.0 org.apache.servicemix.parent features-parent pom Apache ServiceMix :: Parent :: Features Parent Bill-of-materials of the core components and versions used for building the features project (This POM contains the dependencies and versions that are useful to both users and our own development) 5.19.0.2 2.3.9 1.7.1 2.6.0 1.0.5 1.3.1 1.1.1 3.1_7 1.10 1.4 1.3.1 2.4 2.6 3.4 10.11.1.1_1 5.6.0.Final ${drools.version}_1 6.2.0.Final 4.4 2.0.8 1.0.0 1.1.3 15.0 1.3.170 2.2 3.12.1.GA_3 1_2 0.9.4 1.0-alpha-1 3.2.11_1 2.2.1.Final 3.3.0 6.0.0 9.1-901 0.9.10_3 2.11.7 2.10.4 1.0.4 1.7.12 3.2.18.RELEASE_1 [3.2,4) 1.3.12 1.3.12_1 1.3.12_2 2.8 1.2.0 1.6.3_1 ${cxf.version} org.apache.activemq activemq-broker ${activemq.version} org.apache.activemq activemq-camel ${activemq.version} org.apache.activemq activemq-client ${activemq.version} org.apache.activemq activemq-pool ${activemq.version} org.apache.activemq activemq-spring ${activemq.version} org.apache.activemq activemq-web-console ${activemq.version} war org.activiti activiti-camel ${activiti.version} org.activiti activiti-engine ${activiti.version} org.activiti activiti-osgi ${activiti.version} org.apache.cxf cxf-core ${cxf.version} org.apache.cxf cxf-rt-bindings-soap ${cxf.version} org.apache.cxf cxf-rt-bindings-xml ${cxf.version} org.apache.cxf cxf-rt-databinding-jaxb ${cxf.version} org.apache.cxf cxf-rt-frontend-jaxrs ${cxf.version} org.apache.cxf cxf-rt-frontend-jaxws ${cxf.version} org.apache.cxf cxf-rt-frontend-simple ${cxf.version} org.apache.cxf cxf-rt-javascript ${cxf.version} org.apache.cxf cxf-rt-management ${cxf.version} org.apache.cxf cxf-rt-rs-client ${cxf.version} org.apache.cxf cxf-rt-transports-http ${cxf.version} org.apache.cxf cxf-rt-transports-http-jetty ${cxf.version} org.apache.cxf cxf-rt-transports-jms ${cxf.version} org.apache.cxf cxf-rt-transports-local ${cxf.version} org.apache.cxf cxf-rt-ws-addr ${cxf.version} org.apache.cxf cxf-rt-ws-policy ${cxf.version} org.apache.cxf cxf-rt-ws-rm ${cxf.version} org.apache.cxf cxf-rt-ws-security ${cxf.version} org.apache.cxf cxf-rt-rs-security-oauth ${cxf.version} org.apache.cxf cxf-testutils ${cxf.version} org.apache.cxf cxf-tools ${cxf.version} org.apache.cxf cxf-tools-common ${cxf.version} org.apache.cxf cxf-tools-corba ${cxf.version} org.apache.cxf cxf-tools-java2ws ${cxf.version} org.apache.cxf cxf-tools-javato ${cxf.version} org.apache.cxf cxf-tools-misctools ${cxf.version} org.apache.cxf cxf-tools-validator ${cxf.version} org.apache.cxf cxf-tools-wsdlto ${cxf.version} org.apache.cxf cxf-tools-wsdlto-core ${cxf.version} org.apache.cxf cxf-tools-wsdlto-databinding-jaxb ${cxf.version} org.apache.cxf cxf-tools-wsdlto-frontend-javascript ${cxf.version} org.apache.cxf cxf-tools-wsdlto-frontend-jaxws ${cxf.version} org.apache.cxf cxf-tools-wsdlto-test ${cxf.version} org.apache.cxf.services.wsn cxf-services-wsn-core ${cxf.version} org.apache.servicemix.specs org.apache.servicemix.specs.jsr339-api-2.0 ${servicemix.specs.version} org.apache.servicemix.specs org.apache.servicemix.specs.java-persistence-api-2.0 ${servicemix.specs.version} org.apache.servicemix.specs org.apache.servicemix.specs.jaxb-api-${jaxb.api.version} ${servicemix.specs.version} org.apache.servicemix.specs org.apache.servicemix.specs.jaxp-api-1.4 ${servicemix.specs.version} org.apache.servicemix.specs org.apache.servicemix.specs.jaxws-api-2.2 ${servicemix.specs.version} org.apache.servicemix.specs org.apache.servicemix.specs.activation-api-1.1 ${servicemix.specs.version} org.apache.servicemix.specs org.apache.servicemix.specs.activator ${servicemix.specs.version} org.apache.servicemix.specs org.apache.servicemix.specs.saaj-api-1.3 ${servicemix.specs.version} org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec ${geronimo-ws-metadata.version} org.apache.geronimo.specs geronimo-atinject_1.0_spec ${geronimo-atinject.version} org.apache.servicemix.bundles org.apache.servicemix.bundles.commons-httpclient ${commons-httpclient.bundle.version} org.apache.geronimo.specs geronimo-json_1.0_spec ${json-p.spec.version} org.apache.johnzon johnzon-core ${johnzon.version} com.wordnik swagger-jaxrs_2.11 ${swagger.version} org.apache.cxf cxf-codegen-plugin ${cxf.codegen-plugin.version} xerces xercesImpl ${xerces.version} ================================================ FILE: parent/pom.xml ================================================ org.apache.servicemix servicemix 7.1.0-SNAPSHOT 4.0.0 org.apache.servicemix parent pom Apache ServiceMix :: Parent assemblies-parent features-parent ================================================ FILE: pom.xml ================================================ 4.0.0 org.apache apache 18 org.apache.servicemix servicemix pom 7.1.0-SNAPSHOT Apache ServiceMix http://servicemix.apache.org/ 2005 parent activemq activiti branding logging manual examples assemblies itests tooling scm:git:https://gitbox.apache.org/repos/asf/servicemix.git scm:git:https://gitbox.apache.org/repos/asf/servicemix.git https://gitbox.apache.org/repos/asf?p=servicemix.git HEAD jira http://issues.apache.org/jira/browse/SM 3.0.0 true UTF-8 1.7 1.7 ${basedir}/etc/appended-resources 1.6.0 2.15.2 ops4j.snapshots OPS4j Snapshots https://oss.sonatype.org/content/repositories/ops4j-snapshots/ false true apache.snapshots Apache Snapshot Repository https://repository.apache.org/snapshots false true install org.apache.maven.plugins maven-release-plugin 2.5.3 clean install deploy -Prelease,deploy true org.apache.maven.plugins maven-resources-plugin 3.0.2 org.apache.maven.plugins maven-enforcer-plugin 1.4.1 org.apache.maven.plugins maven-gpg-plugin 1.6 org.apache.maven.plugins maven-jar-plugin 3.0.0 org.apache.maven.plugins maven-javadoc-plugin 2.10.4 org.apache.maven.plugins maven-compiler-plugin 3.6.1 ${maven.compiler.source} ${maven.compiler.target} ${maven.compiler.debug} ${maven.compiler.encoding} 256M ${compiler.fork} org.apache.maven.plugins maven-idea-plugin 2.2.1 true true org.apache.maven.plugins maven-eclipse-plugin 2.10 ${basedir}/eclipse-classes true true org.codehaus.mojo cobertura-maven-plugin 2.2 org.apache.maven.plugins maven-surefire-plugin 2.18.1 org.codehaus.mojo exec-maven-plugin ${exec-maven-plugin.version} org.codehaus.mojo build-helper-maven-plugin 3.0.0 org.scala-tools maven-scala-plugin ${maven-scala-plugin.version} org.apache.maven.plugins maven-assembly-plugin 3.0.0 org.apache.maven.plugins maven-antrun-plugin 1.8 ant-contrib ant-contrib 1.0b3 ant ant org.apache.ant ant-nodeps 1.8.1 ant ant-optional 1.5.3-1 org.ccil.cowan.tagsoup tagsoup 1.2 org.apache.maven.plugins maven-dependency-plugin 3.0.0 org.apache.rat apache-rat-plugin 0.11 org.apache.maven.plugins maven-remote-resources-plugin 1.5 org.apache.maven.plugins maven-source-plugin 3.0.1 org.eclipse.m2e lifecycle-mapping 1.0.0 org.apache.felix maven-bundle-plugin [0,) cleanVersions org.apache.maven.plugins maven-dependency-plugin [0,) copy unpack org.apache.servicemix.tooling depends-maven-plugin [0,) generate-depends-file org.scala-tools maven-scala-plugin [0,) compile testCompile org.apache.cxf cxf-codegen-plugin [0,) wsdl2java org.apache.maven.plugins maven-enforcer-plugin enforce-maven enforce [3,4) [1.7,1.9) org.apache.maven.plugins maven-remote-resources-plugin process ${appendedResourcesDirectory} org.apache:apache-jar-resource-bundle:1.4 org.apache.maven.plugins maven-javadoc-plugin 2.10.4 org.apache.maven.plugins maven-jxr-plugin 2.5 org.apache.maven.plugins maven-site-plugin 3.6 org.apache.maven.plugins maven-surefire-report-plugin 2.18.1 org.apache.maven.plugins maven-project-info-reports-plugin 2.9 fastinstall true rat true org.apache.rat apache-rat-plugin verify check ${project.build.directory}/${project.build.finalName}.rat false **/*.csv **/src/main/resources/licenses/** **/*.pub **/target/**/* **/.git/**/* **/.idea/**/* **/*.iml **/*.ipr **/*.iws **/.* **/eclipse-classes/**/* **/dependency-reduced-pom.xml **/.settings/** **/bin/** **/goal.txt **/grep.txt **/edit.txt **/wc.txt **/foo **/maven-metadata-local.xml **/*.css **/*.ssp **/*.conf **/*.mf **/*.json **/*.key .repository/** **/*.jar release org.apache.maven.plugins maven-deploy-plugin true ${deploy.altRepository} true org.apache.maven.plugins maven-gpg-plugin sign-artifacts verify sign setup.eclipse assemblies ${basedir}/../workspace eclipse:eclipse org.apache.maven.plugins maven-eclipse-plugin false setup.eclipse.workspace process-test-sources add-maven-repo ${eclipse.workspace.dir} deploy deploy org.apache.maven.plugins maven-source-plugin 3.0.1 attach-sources jar org.apache.maven.plugins maven-javadoc-plugin 2.10.4 attach-javadocs jar ${javadoc.opts} doclint-java8-disable [1.8,) -Xdoclint:none ================================================ FILE: tooling/archetypes/pom.xml ================================================ 4.0.0 tooling org.apache.servicemix.tooling 7.1.0-SNAPSHOT org.apache.servicemix.tooling archetypes pom Apache ServiceMix :: Tooling :: Archetypes servicemix-cxf-code-first-osgi-bundle servicemix-cxf-wsdl-first-osgi-bundle servicemix-osgi-bundle 3.1 2.6 1.7.1 org.apache.maven.plugins maven-archetype-plugin ${maven-archetype-packaging-version} true org.apache.servicemix.tooling res-maven-plugin 3.2.1 ${basedir}/src/main/resources ${project.build.outputDirectory} ${geronimo-ws-metadata.version} ${jaxb.api.version} ${cxf.version} ${maven-compiler-plugin.version} ${maven-resources-plugin.version} ${maven-bundle-plugin.version} ${maven-shade-plugin.version} 2.8 resources ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/pom.xml ================================================ 4.0.0 archetypes org.apache.servicemix.tooling 7.1.0-SNAPSHOT org.apache.servicemix.tooling.archetypes servicemix-cxf-code-first-osgi-bundle maven-archetype Apache ServiceMix :: Tooling :: Archetypes :: CXF Code First OSGi Bundle org.apache.maven.archetype archetype-packaging ${maven-archetype-packaging-version} ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/META-INF/maven/archetype.xml ================================================ servicemix-cxf-code-first-osgi-bundle src/main/java/Person.java src/main/java/PersonImpl.java src/main/java/UnknownPersonFault.java src/main/java/types/GetPerson.java src/main/java/types/GetPersonResponse.java src/main/java/types/ObjectFactory.java src/main/java/types/package-info.java src/main/java/types/UnknownPersonFault.java src/main/java/client/Client.java src/main/resources/META-INF/spring/beans.xml ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/pom.xml ================================================ 4.0.0 ${groupId} ${artifactId} bundle ${version} Apache ServiceMix :: CXF Code First OSGi Bundle org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec @{geronimo.wsmetadata.version} javax.xml.bind jaxb-api @{jaxb.version} org.apache.geronimo.specs geronimo-jaxws_2.2_spec 1.0 org.apache.cxf cxf-rt-frontend-jaxws @{cxf.version} org.apache.cxf cxf-rt-transports-http @{cxf.version} install org.apache.maven.plugins maven-compiler-plugin @{maven-compiler-plugin.version} 1.5 1.5 UTF-8 org.apache.maven.plugins maven-resources-plugin @{maven-resources-plugin.version} UTF-8 org.apache.felix maven-bundle-plugin @{maven-bundle-plugin.version} true ${project.artifactId} javax.jws, javax.wsdl, javax.xml.bind, javax.xml.bind.annotation, javax.xml.namespace, javax.xml.ws, META-INF.cxf, org.apache.cxf.bus, org.apache.cxf.bus.spring, org.apache.cxf.bus.resource, org.apache.cxf.configuration.spring, org.apache.cxf.resource, org.apache.cxf.jaxws, org.apache.cxf.transport.http, org.springframework.beans.factory.config !${packageName}.* ${packageName}, ${packageName}.types client test org.codehaus.mojo exec-maven-plugin test java ${packageName}.client.Client ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/src/main/java/Person.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ${packageName}; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebParam.Mode; import javax.jws.WebService; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; @WebService @XmlSeeAlso({${packageName}.types.ObjectFactory.class}) public interface Person { @RequestWrapper(localName = "GetPerson", className = "${packageName}.types.GetPerson") @ResponseWrapper(localName = "GetPersonResponse", className = "${packageName}.types.GetPersonResponse") @WebMethod(operationName = "GetPerson") public void getPerson( @WebParam(mode = WebParam.Mode.INOUT, name = "personId") javax.xml.ws.Holder personId, @WebParam(mode = WebParam.Mode.OUT, name = "ssn") javax.xml.ws.Holder ssn, @WebParam(mode = WebParam.Mode.OUT, name = "name") javax.xml.ws.Holder name ) throws UnknownPersonFault; } ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/src/main/java/PersonImpl.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ${packageName}; import javax.jws.WebService; import javax.xml.ws.Holder; import ${packageName}.types.GetPerson; import ${packageName}.types.GetPersonResponse; @WebService(serviceName = "PersonService", endpointInterface = "${packageName}.Person") public class PersonImpl implements Person { public void getPerson(Holder personId, Holder ssn, Holder name) throws UnknownPersonFault { if (personId.value == null || personId.value.length() == 0) { ${packageName}.types.UnknownPersonFault fault = new ${packageName}.types.UnknownPersonFault(); fault.setPersonId(personId.value); throw new UnknownPersonFault(null,fault); } name.value = "Guillaume"; ssn.value = "000-000-0000"; } } ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/src/main/java/UnknownPersonFault.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ${packageName}; import javax.xml.ws.WebFault; @WebFault(name = "UnknownPersonFault") public class UnknownPersonFault extends Exception { public static final long serialVersionUID = 20081110144906L; private ${packageName}.types.UnknownPersonFault unknownPersonFault; public UnknownPersonFault() { super(); } public UnknownPersonFault(String message) { super(message); } public UnknownPersonFault(String message, Throwable cause) { super(message, cause); } public UnknownPersonFault(String message, ${packageName}.types.UnknownPersonFault unknownPersonFault) { super(message); this.unknownPersonFault = unknownPersonFault; } public UnknownPersonFault(String message, ${packageName}.types.UnknownPersonFault unknownPersonFault, Throwable cause) { super(message, cause); this.unknownPersonFault = unknownPersonFault; } public ${packageName}.types.UnknownPersonFault getFaultInfo() { return this.unknownPersonFault; } } ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/src/main/java/client/Client.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ${packageName}.client; import ${packageName}.*; import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; public final class Client { private Client() { } public static void main(String args[]) throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(Person.class); if (args != null && args.length > 0 && !"".equals(args[0])) { factory.setAddress(args[0]); } else { factory.setAddress("http://localhost:8181/cxf/PersonServiceCF"); } Person client = (Person)factory.create(); System.out.println("Invoking getPerson..."); java.lang.String _getPerson_personIdVal = "Guillaume"; javax.xml.ws.Holder _getPerson_personId = new javax.xml.ws.Holder(_getPerson_personIdVal); javax.xml.ws.Holder _getPerson_ssn = new javax.xml.ws.Holder(); javax.xml.ws.Holder _getPerson_name = new javax.xml.ws.Holder(); try { client.getPerson(_getPerson_personId, _getPerson_ssn, _getPerson_name); System.out.println("getPerson._getPerson_personId=" + _getPerson_personId.value); System.out.println("getPerson._getPerson_ssn=" + _getPerson_ssn.value); System.out.println("getPerson._getPerson_name=" + _getPerson_name.value); } catch (${packageName}.UnknownPersonFault upf) { System.out.println("Expected exception: UnknownPersonFault has occurred."); System.out.println(upf.toString()); } } } ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/src/main/java/types/GetPerson.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ${packageName}.types; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** *

Java class for anonymous complex type. * *

The following schema fragment specifies the expected content contained within this class. * *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="personId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "personId" }) @XmlRootElement(name = "GetPerson") public class GetPerson { @XmlElement(required = true) protected String personId; /** * Gets the value of the personId property. * * @return * possible object is * {@link String } * */ public String getPersonId() { return personId; } /** * Sets the value of the personId property. * * @param value * allowed object is * {@link String } * */ public void setPersonId(String value) { this.personId = value; } } ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/src/main/java/types/GetPersonResponse.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ${packageName}.types; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** *

Java class for anonymous complex type. * *

The following schema fragment specifies the expected content contained within this class. * *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="personId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="ssn" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "personId", "ssn", "name" }) @XmlRootElement(name = "GetPersonResponse") public class GetPersonResponse { @XmlElement(required = true) protected String personId; @XmlElement(required = true) protected String ssn; @XmlElement(required = true) protected String name; /** * Gets the value of the personId property. * * @return * possible object is * {@link String } * */ public String getPersonId() { return personId; } /** * Sets the value of the personId property. * * @param value * allowed object is * {@link String } * */ public void setPersonId(String value) { this.personId = value; } /** * Gets the value of the ssn property. * * @return * possible object is * {@link String } * */ public String getSsn() { return ssn; } /** * Sets the value of the ssn property. * * @param value * allowed object is * {@link String } * */ public void setSsn(String value) { this.ssn = value; } /** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value * allowed object is * {@link String } * */ public void setName(String value) { this.name = value; } } ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/src/main/java/types/ObjectFactory.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ${packageName}.types; import javax.xml.bind.annotation.XmlRegistry; /** * This object contains factory methods for each * Java content interface and Java element interface * generated in the org.apache.servicemix.samples.wsdl_first.types package. *

An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class. * */ @XmlRegistry public class ObjectFactory { /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.apache.servicemix.samples.wsdl_first.types * */ public ObjectFactory() { } /** * Create an instance of {@link GetPersonResponse } * */ public GetPersonResponse createGetPersonResponse() { return new GetPersonResponse(); } /** * Create an instance of {@link GetPerson } * */ public GetPerson createGetPerson() { return new GetPerson(); } /** * Create an instance of {@link UnknownPersonFault } * */ public UnknownPersonFault createUnknownPersonFault() { return new UnknownPersonFault(); } } ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/src/main/java/types/UnknownPersonFault.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ${packageName}.types; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** *

Java class for anonymous complex type. * *

The following schema fragment specifies the expected content contained within this class. * *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="personId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "personId" }) @XmlRootElement(name = "UnknownPersonFault") public class UnknownPersonFault { @XmlElement(required = true) protected String personId; /** * Gets the value of the personId property. * * @return * possible object is * {@link String } * */ public String getPersonId() { return personId; } /** * Sets the value of the personId property. * * @param value * allowed object is * {@link String } * */ public void setPersonId(String value) { this.personId = value; } } ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/src/main/java/types/package-info.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ${packageName}.types; ================================================ FILE: tooling/archetypes/servicemix-cxf-code-first-osgi-bundle/src/main/resources/archetype-resources/src/main/resources/META-INF/spring/beans.xml ================================================ ================================================ FILE: tooling/archetypes/servicemix-cxf-wsdl-first-osgi-bundle/pom.xml ================================================ 4.0.0 archetypes org.apache.servicemix.tooling 7.1.0-SNAPSHOT org.apache.servicemix.tooling.archetypes servicemix-cxf-wsdl-first-osgi-bundle maven-archetype Apache ServiceMix :: Tooling :: Archetypes :: CXF WSDL First OSGi Bundle org.apache.maven.archetype archetype-packaging ${maven-archetype-packaging-version} ================================================ FILE: tooling/archetypes/servicemix-cxf-wsdl-first-osgi-bundle/src/main/resources/META-INF/maven/archetype.xml ================================================ servicemix-cxf-wsdl-first-osgi-bundle src/main/java/PersonImpl.java src/main/resources/META-INF/spring/beans.xml src/main/resources/wsdl/person.wsdl ================================================ FILE: tooling/archetypes/servicemix-cxf-wsdl-first-osgi-bundle/src/main/resources/archetype-resources/pom.xml ================================================ 4.0.0 ${groupId} ${artifactId} bundle ${version} Apache ServiceMix :: CXF WSDL First OSGi Bundle org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec @{geronimo.wsmetadata.version} javax.xml.bind jaxb-api @{jaxb.version} org.apache.geronimo.specs geronimo-jaxws_2.1_spec 1.0 install org.apache.maven.plugins maven-compiler-plugin @{maven-compiler-plugin.version} 1.5 1.5 UTF-8 org.apache.maven.plugins maven-resources-plugin @{maven-resources-plugin.version} UTF-8 org.apache.cxf cxf-codegen-plugin @{cxf.version} generate-sources \${basedir}/src/main/java \${basedir}/src/main/resources/wsdl/person.wsdl -verbose wsdl2java org.apache.felix maven-bundle-plugin @{maven-bundle-plugin.version} true ${project.artifactId} javax.jws, javax.wsdl, javax.xml.bind, javax.xml.bind.annotation, javax.xml.namespace, javax.xml.ws, META-INF.cxf, org.apache.cxf.bus, org.apache.cxf.bus.spring, org.apache.cxf.bus.resource, org.apache.cxf.configuration.spring, org.apache.cxf.resource, org.apache.cxf.jaxws, org.apache.cxf.transport.http, org.springframework.beans.factory.config org.apache.servicemix.samples.wsdl_first, org.apache.servicemix.samples.wsdl_first.types ================================================ FILE: tooling/archetypes/servicemix-cxf-wsdl-first-osgi-bundle/src/main/resources/archetype-resources/src/main/java/PersonImpl.java ================================================ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ${packageName}; import javax.jws.WebService; import javax.xml.ws.Holder; import org.apache.servicemix.samples.wsdl_first.Person; import org.apache.servicemix.samples.wsdl_first.UnknownPersonFault; import org.apache.servicemix.samples.wsdl_first.types.GetPerson; import org.apache.servicemix.samples.wsdl_first.types.GetPersonResponse; @WebService(serviceName = "PersonService", targetNamespace = "http://servicemix.apache.org/samples/wsdl-first", endpointInterface = "org.apache.servicemix.samples.wsdl_first.Person") public class PersonImpl implements Person { public void getPerson(Holder personId, Holder ssn, Holder name) throws UnknownPersonFault { if (personId.value == null || personId.value.length() == 0) { org.apache.servicemix.samples.wsdl_first.types.UnknownPersonFault fault = new org.apache.servicemix.samples.wsdl_first.types.UnknownPersonFault(); fault.setPersonId(personId.value); throw new UnknownPersonFault(null,fault); } name.value = "Guillaume"; ssn.value = "000-000-0000"; } } ================================================ FILE: tooling/archetypes/servicemix-cxf-wsdl-first-osgi-bundle/src/main/resources/archetype-resources/src/main/resources/META-INF/spring/beans.xml ================================================ ================================================ FILE: tooling/archetypes/servicemix-cxf-wsdl-first-osgi-bundle/src/main/resources/archetype-resources/src/main/resources/wsdl/person.wsdl ================================================ ================================================ FILE: tooling/archetypes/servicemix-osgi-bundle/pom.xml ================================================ 4.0.0 archetypes org.apache.servicemix.tooling 7.1.0-SNAPSHOT org.apache.servicemix.tooling.archetypes servicemix-osgi-bundle maven-archetype Apache ServiceMix :: Tooling :: Archetypes :: OSGi Bundle org.apache.maven.archetype archetype-packaging ${maven-archetype-packaging-version} ================================================ FILE: tooling/archetypes/servicemix-osgi-bundle/src/main/resources/META-INF/maven/archetype.xml ================================================ servicemix-osgi-bundle ================================================ FILE: tooling/archetypes/servicemix-osgi-bundle/src/main/resources/archetype-resources/pom.xml ================================================ 4.0.0 ${groupId} ${artifactId} bundle ${version} Apache ServiceMix :: Wrapper OSGi Bundle put your wrapped artifact groupId here put your wrapped artifact artifactId here put your wrapped artifact version here put the wrapped artifact export package here put the wrapped artifact import packages here, * false UTF-8 ${pkgGroupId} ${pkgArtifactId} ${pkgVersion} true install org.apache.maven.plugins maven-compiler-plugin @{maven-compiler-plugin.version} 1.5 1.5 UTF-8 org.apache.felix maven-bundle-plugin @{maven-bundle-plugin.version} true ${project.artifactId} ${servicemix.osgi.export.pkg}*;version=${pkgVersion};-split-package:=merge-first ${servicemix.osgi.import.pkg}* ${servicemix.osgi.private.pkg} ${servicemix.osgi.dynamicimport.pkg} ${servicemix.osgi.embed.dependency} ${servicemix.osgi.native} ${servicemix.osgi.fragment.host} ${servicemix.osgi.provide.capability} ${servicemix.osgi.require.capability} ${servicemix.spi.provider} ${servicemix.spi.consumer} <_failok>${servicemix.osgi.failok} <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@))) <_removeheaders>Ignore-Package,Include-Resource,Private-Package,Embed-Dependency org.apache.maven.plugins maven-shade-plugin @{maven-shade-plugin.version} package shade ${pkgGroupId}:${pkgArtifactId} ${pkgGroupId}:${pkgArtifactId} ** true true ================================================ FILE: tooling/pom.xml ================================================ 4.0.0 org.apache.servicemix.parent features-parent 7.1.0-SNAPSHOT ../parent/features-parent/pom.xml org.apache.servicemix.tooling tooling pom Apache ServiceMix :: Tooling archetypes