Compare commits

...

5 Commits
master ... mac

71 changed files with 2830 additions and 1 deletions
Split View
  1. 38
      camel-cxf-maven-example-master/.classpath
  2. 2
      camel-cxf-maven-example-master/.gitignore
  3. 23
      camel-cxf-maven-example-master/.project
  4. 8
      camel-cxf-maven-example-master/.settings/org.eclipse.jdt.core.prefs
  5. 4
      camel-cxf-maven-example-master/.settings/org.eclipse.m2e.core.prefs
  6. 11
      camel-cxf-maven-example-master/README.md
  7. 174
      camel-cxf-maven-example-master/pom.xml
  8. 12
      camel-cxf-maven-example-master/src/main/java/com/steve/research/CamelMain.java
  9. 41
      camel-cxf-maven-example-master/src/main/java/com/steve/research/MyRoute.java
  10. 43
      camel-cxf-maven-example-master/src/main/java/com/steve/research/ProductServiceImpl.java
  11. 30
      camel-cxf-maven-example-master/src/main/resources/example-camel-context.xml
  12. 65
      camel-cxf-maven-example-master/src/main/resources/wsdl/HelloService.wsdl
  13. 63
      camel-cxf-maven-example-master/src/main/resources/wsdl/ProductService.wsdl
  14. 30
      camel-cxf-maven-example-master/src/test/java/com/steve/research/MyRouteTest.java
  15. BIN
      camel-cxf-maven-example-master/target/camel-cxf-maven-example-1.0-SNAPSHOT.jar
  16. BIN
      camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/HelloWorld.class
  17. BIN
      camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/HelloWorldService.class
  18. BIN
      camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/ObjectFactory.class
  19. BIN
      camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/Product.class
  20. BIN
      camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/ProductRequest.class
  21. BIN
      camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/ProductResponse.class
  22. BIN
      camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/ProductService.class
  23. BIN
      camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/SayHello.class
  24. BIN
      camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/SayHelloResponse.class
  25. BIN
      camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/package-info.class
  26. BIN
      camel-cxf-maven-example-master/target/classes/com/steve/research/CamelMain.class
  27. BIN
      camel-cxf-maven-example-master/target/classes/com/steve/research/MyRoute.class
  28. BIN
      camel-cxf-maven-example-master/target/classes/com/steve/research/ProductServiceImpl$Product.class
  29. BIN
      camel-cxf-maven-example-master/target/classes/com/steve/research/ProductServiceImpl.class
  30. 30
      camel-cxf-maven-example-master/target/classes/example-camel-context.xml
  31. 65
      camel-cxf-maven-example-master/target/classes/wsdl/HelloService.wsdl
  32. 63
      camel-cxf-maven-example-master/target/classes/wsdl/ProductService.wsdl
  33. BIN
      camel-cxf-maven-example-master/target/cxf-codegen-plugin-markers/.03BA8A379A1C11045D1B73515CFEEC0594F0D3C6
  34. BIN
      camel-cxf-maven-example-master/target/cxf-codegen-plugin-markers/.6916CA2A5478EADC9F34E4CDF39BE8BFB10429B0
  35. 5
      camel-cxf-maven-example-master/target/maven-archiver/pom.properties
  36. 11
      camel-cxf-maven-example-master/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  37. 13
      camel-cxf-maven-example-master/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  38. 0
      camel-cxf-maven-example-master/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
  39. 1
      camel-cxf-maven-example-master/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
  40. 65
      camel-cxf-maven-example-master/target/surefire-reports/TEST-com.steve.research.MyRouteTest.xml
  41. 4
      camel-cxf-maven-example-master/target/surefire-reports/com.steve.research.MyRouteTest.txt
  42. BIN
      camel-cxf-maven-example-master/target/test-classes/com/steve/research/MyRouteTest.class
  43. 1
      jboss-fuse-cxf-rest
  44. 19
      jboss-fuse-cxf-rest-local/.gitignore
  45. 107
      jboss-fuse-cxf-rest-local/README.md
  46. 109
      jboss-fuse-cxf-rest-local/configuration/settings.xml
  47. 363
      jboss-fuse-cxf-rest-local/pom.xml
  48. 52
      jboss-fuse-cxf-rest-local/src/main/java/io/fabric8/quickstarts/rest/Customer.java
  49. 224
      jboss-fuse-cxf-rest-local/src/main/java/io/fabric8/quickstarts/rest/CustomerService.java
  50. 113
      jboss-fuse-cxf-rest-local/src/main/java/io/fabric8/quickstarts/rest/Order.java
  51. 52
      jboss-fuse-cxf-rest-local/src/main/java/io/fabric8/quickstarts/rest/Product.java
  52. 18
      jboss-fuse-cxf-rest-local/src/main/java/io/fabric8/quickstarts/rest/package-info.java
  53. 75
      jboss-fuse-cxf-rest-local/src/main/resources/OSGI-INF/blueprint/blueprint.xml
  54. 43
      jboss-fuse-cxf-rest-local/src/main/resources/features.xml
  55. 1
      jboss-fuse-cxf-rest-local/src/test/resources/add_customer.json
  56. 3
      jboss-fuse-cxf-rest-local/src/test/resources/add_customer.xml
  57. 35
      jboss-fuse-cxf-rest-local/src/test/resources/log4j.properties
  58. 4
      jboss-fuse-cxf-rest-local/src/test/resources/update_customer.xml
  59. 1
      spring-boot-camel-xml
  60. 17
      spring-boot-camel-xml-local/.gitignore
  61. 201
      spring-boot-camel-xml-local/LICENSE
  62. 202
      spring-boot-camel-xml-local/LICENSE.md
  63. 47
      spring-boot-camel-xml-local/README.md
  64. 199
      spring-boot-camel-xml-local/pom.xml
  65. 15
      spring-boot-camel-xml-local/src/main/fabric8/deployment.yml
  66. 35
      spring-boot-camel-xml-local/src/main/java/io/fabric8/quickstarts/camel/Application.java
  67. 38
      spring-boot-camel-xml-local/src/main/java/io/fabric8/quickstarts/camel/MyTransformer.java
  68. 17
      spring-boot-camel-xml-local/src/main/resources/application.properties
  69. 17
      spring-boot-camel-xml-local/src/main/resources/logback.xml
  70. 20
      spring-boot-camel-xml-local/src/main/resources/spring/camel-context.xml
  71. 2
      test.txt

38
camel-cxf-maven-example-master/.classpath

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/generated">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

2
camel-cxf-maven-example-master/.gitignore

@ -0,0 +1,2 @@
.idea
src/main/generated

23
camel-cxf-maven-example-master/.project

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>camel-cxf-maven-example</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

8
camel-cxf-maven-example-master/.settings/org.eclipse.jdt.core.prefs

@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.5

4
camel-cxf-maven-example-master/.settings/org.eclipse.m2e.core.prefs

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

11
camel-cxf-maven-example-master/README.md

@ -0,0 +1,11 @@
## Camel / CXF Maven Example
This is a Hello World project using Apache Camel and Apache CXF
A simple web service, HelloService.wsdl is exposed.
Build and run the main class.
The url is http://localhost:8080/HelloService?wsdl
Test via SOAP-UI.

174
camel-cxf-maven-example-master/pom.xml

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.steve.research</groupId>
<artifactId>camel-cxf-maven-example</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<!-- <camel.version>2.14.1</camel.version> -->
<!-- <cxf.version>3.0.2</cxf.version> -->
<!-- <spring.version>3.1.0.RELEASE</spring.version> -->
<log4j.version>1.2.12</log4j.version>
<slf4j.version>1.6.4</slf4j.version>
<camel.version>2.17.0.redhat-630187</camel.version>
<cxf.version>3.1.5.redhat-630187</cxf.version>
<activemq.camel.version>5.11.0.redhat-630187</activemq.camel.version>
<spring.version>3.2.16.RELEASE</spring.version>
<cxf.codegen.version>3.1.5.redhat-630187</cxf.codegen.version>
</properties>
<dependencies>
<!-- camel -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- test -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>${camel.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>red-hat-ga</id>
<url>https://maven.repository.redhat.com/ga</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>Fuse - repo</id>
<url>http://repo.fusesource.com/nexus/content/groups/public/</url>
</pluginRepository>
<pluginRepository>
<id>Apache Snapshot</id>
<url>http://repository.apache.org/snapshots/</url>
</pluginRepository>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>red-hat-ga</id>
<url>https://maven.repository.redhat.com/ga</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<defaultGoal>clean install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<!-- <version>2.6.0.fuse-71-047</version> -->
<version>${cxf.codegen.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
<configuration>
<sourceRoot>${basedir}/src/main/generated</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/HelloService.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>test</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/main/generated</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>${basedir}/src/main/generated</directory>
<includes>
<include>**/*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
</project>

12
camel-cxf-maven-example-master/src/main/java/com/steve/research/CamelMain.java

@ -0,0 +1,12 @@
package com.steve.research;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class CamelMain {
public static void main(String[] args) throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/example-camel-context.xml");
context.start();
context.registerShutdownHook();
Thread.currentThread().join();
}
}

41
camel-cxf-maven-example-master/src/main/java/com/steve/research/MyRoute.java

@ -0,0 +1,41 @@
package com.steve.research;
import org.apache.camel.builder.RouteBuilder;
import com.moodykettle.webservice.helloworld.ProductResponse;
public class MyRoute extends RouteBuilder {
private String webserviceEndpoint = "cxf:bean:helloService";
private String productWebserviceEndpoint = "cxf:bean:productService?defaultOperationName=getProductDetails";
@Override
public void configure() throws Exception {
from("timer:foo?period=1s&repeatCount=1")
.log("Hello!!!")
;
from(webserviceEndpoint)
.log("WebService opearation: ${header.operationName}")
.log("WebService body: ${body}")
.setBody(simple("Hello, ${body}"))
;
ProductResponse response = new ProductResponse();
response.setId("001");
response.setDescription("Test");
response.setPrice(101);
from(productWebserviceEndpoint)
.log("WebService opearation: ${header.operationName}")
.log("WebService body: ${body}")
.bean(ProductServiceImpl.class)
;
}
public void setWebserviceEndpoint(String webserviceEndpoint) {
this.webserviceEndpoint = webserviceEndpoint;
}
public void setProductWebserviceEndpoint(String w) {
this.productWebserviceEndpoint = w;
}
}

43
camel-cxf-maven-example-master/src/main/java/com/steve/research/ProductServiceImpl.java

@ -0,0 +1,43 @@
package com.steve.research;
import java.util.HashMap;
import java.util.Map;
import com.moodykettle.webservice.helloworld.ProductResponse;
public class ProductServiceImpl {
public ProductResponse getProductDetails(com.moodykettle.webservice.helloworld.ProductRequest request) {
Product product = PRODUCT_DETAILS.get(request.getId());
/*if (product == null) {
throw new ProductNotFoundException(request.getId());
}*/
ProductResponse response = new ProductResponse();
response.setId(product.id);
response.setDescription(product.description);
response.setPrice(product.price);
System.out.println("Coming HERE >>>>>>>>>>>>>>>>>>");
return response;
}
private static Map<String, Product> PRODUCT_DETAILS = new HashMap<String, Product>();
private static class Product {
private String id;
private String description;
private int price;
Product(String id, String desc, int price) {
this.id = id;
this.description = desc;
this.price = price;
}
}
static {
PRODUCT_DETAILS.put("P01", new Product("P01", "Laptop", 40000));
PRODUCT_DETAILS.put("P02", new Product("P02", "Mobile", 14000));
PRODUCT_DETAILS.put("P03", new Product("P03", "Tablet", 30000));
}
}

30
camel-cxf-maven-example-master/src/main/resources/example-camel-context.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<cxf:cxfEndpoint id="helloService"
address="http://localhost:8080/HelloService" serviceClass="com.moodykettle.webservice.helloworld.HelloWorld"
wsdlURL="wsdl/HelloService.wsdl">
</cxf:cxfEndpoint>
<cxf:cxfEndpoint id="productService"
address="http://localhost:8081/ProductService" serviceClass="com.moodykettle.webservice.helloworld.Product"
wsdlURL="wsdl/ProductService.wsdl">
</cxf:cxfEndpoint>
<beans:bean id="myRoute" class="com.steve.research.MyRoute"/>
<camel:camelContext>
<camel:routeBuilder ref="myRoute"/>
</camel:camelContext>
</beans>

65
camel-cxf-maven-example-master/src/main/resources/wsdl/HelloService.wsdl

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:impl="http://helloworld.webservice.moodykettle.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://helloworld.webservice.moodykettle.com">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://helloworld.webservice.moodykettle.com">
<element name="sayHello">
<complexType>
<sequence>
<element name="name" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="sayHelloResponse">
<complexType>
<sequence>
<element name="sayHelloReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="sayHelloResponse">
<wsdl:part element="impl:sayHelloResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="sayHelloRequest">
<wsdl:part element="impl:sayHello" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="HelloWorld">
<wsdl:operation name="sayHello">
<wsdl:input message="impl:sayHelloRequest" name="sayHelloRequest">
</wsdl:input>
<wsdl:output message="impl:sayHelloResponse" name="sayHelloResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldSoapBinding" type="impl:HelloWorld">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayHelloRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldService">
<wsdl:port binding="impl:HelloWorldSoapBinding" name="HelloWorld">
<wsdlsoap:address location="http://localhost:8080/WebService/services/HelloWorld"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

63
camel-cxf-maven-example-master/src/main/resources/wsdl/ProductService.wsdl

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:impl="http://helloworld.webservice.moodykettle.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://helloworld.webservice.moodykettle.com">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://helloworld.webservice.moodykettle.com">
<element name="productRequest">
<complexType>
<sequence>
<element name="id" type="xsd:string" />
</sequence>
</complexType>
</element>
<element name="productResponse">
<complexType>
<sequence>
<element name="id" type="xsd:string" />
<element name="description" type="xsd:string" />
<element name="price" type="xsd:int" />
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="getProductDetails">
<wsdl:part element="impl:productRequest" name="parameters"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getProductDetailsResponse">
<wsdl:part element="impl:productResponse" name="parameters"> </wsdl:part>
</wsdl:message>
<wsdl:portType name="Product">
<wsdl:operation name="getProductDetails">
<wsdl:input message="impl:getProductDetails" name="getProductDetails"> </wsdl:input>
<wsdl:output message="impl:getProductDetailsResponse" name="getProductDetailsResponse"> </wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ProductServiceSoapBinding" type="impl:Product">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getProductDetails">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getProductDetails">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getProductDetailsResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ProductService">
<wsdl:port binding="impl:ProductServiceSoapBinding" name="ProductPort">
<wsdlsoap:address location="http://localhost:8080/WebService/services/Product"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

30
camel-cxf-maven-example-master/src/test/java/com/steve/research/MyRouteTest.java

@ -0,0 +1,30 @@
package com.steve.research;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class MyRouteTest extends CamelTestSupport {
@Produce(uri = "direct:webservice")
ProducerTemplate webservice;
@Produce(uri = "direct:webservice2")
ProducerTemplate webservice2;
@Test
public void testFoo() throws InterruptedException {
Object result = webservice.requestBody("Dude");
System.out.println("Result from web service call was: " + result);
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
MyRoute myRoute = new MyRoute();
myRoute.setWebserviceEndpoint("direct:webservice");
myRoute.setProductWebserviceEndpoint("direct:webservice2");
return myRoute;
}
}

BIN
camel-cxf-maven-example-master/target/camel-cxf-maven-example-1.0-SNAPSHOT.jar

BIN
camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/HelloWorld.class

BIN
camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/HelloWorldService.class

BIN
camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/ObjectFactory.class

BIN
camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/Product.class

BIN
camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/ProductRequest.class

BIN
camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/ProductResponse.class

BIN
camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/ProductService.class

BIN
camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/SayHello.class

BIN
camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/SayHelloResponse.class

BIN
camel-cxf-maven-example-master/target/classes/com/moodykettle/webservice/helloworld/package-info.class

BIN
camel-cxf-maven-example-master/target/classes/com/steve/research/CamelMain.class

BIN
camel-cxf-maven-example-master/target/classes/com/steve/research/MyRoute.class

BIN
camel-cxf-maven-example-master/target/classes/com/steve/research/ProductServiceImpl$Product.class

BIN
camel-cxf-maven-example-master/target/classes/com/steve/research/ProductServiceImpl.class

30
camel-cxf-maven-example-master/target/classes/example-camel-context.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<cxf:cxfEndpoint id="helloService"
address="http://localhost:8080/HelloService" serviceClass="com.moodykettle.webservice.helloworld.HelloWorld"
wsdlURL="wsdl/HelloService.wsdl">
</cxf:cxfEndpoint>
<cxf:cxfEndpoint id="productService"
address="http://localhost:8081/ProductService" serviceClass="com.moodykettle.webservice.helloworld.Product"
wsdlURL="wsdl/ProductService.wsdl">
</cxf:cxfEndpoint>
<beans:bean id="myRoute" class="com.steve.research.MyRoute"/>
<camel:camelContext>
<camel:routeBuilder ref="myRoute"/>
</camel:camelContext>
</beans>

65
camel-cxf-maven-example-master/target/classes/wsdl/HelloService.wsdl

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:impl="http://helloworld.webservice.moodykettle.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://helloworld.webservice.moodykettle.com">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://helloworld.webservice.moodykettle.com">
<element name="sayHello">
<complexType>
<sequence>
<element name="name" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="sayHelloResponse">
<complexType>
<sequence>
<element name="sayHelloReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="sayHelloResponse">
<wsdl:part element="impl:sayHelloResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="sayHelloRequest">
<wsdl:part element="impl:sayHello" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="HelloWorld">
<wsdl:operation name="sayHello">
<wsdl:input message="impl:sayHelloRequest" name="sayHelloRequest">
</wsdl:input>
<wsdl:output message="impl:sayHelloResponse" name="sayHelloResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldSoapBinding" type="impl:HelloWorld">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayHelloRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldService">
<wsdl:port binding="impl:HelloWorldSoapBinding" name="HelloWorld">
<wsdlsoap:address location="http://localhost:8080/WebService/services/HelloWorld"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

63
camel-cxf-maven-example-master/target/classes/wsdl/ProductService.wsdl

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:impl="http://helloworld.webservice.moodykettle.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://helloworld.webservice.moodykettle.com">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://helloworld.webservice.moodykettle.com">
<element name="productRequest">
<complexType>
<sequence>
<element name="id" type="xsd:string" />
</sequence>
</complexType>
</element>
<element name="productResponse">
<complexType>
<sequence>
<element name="id" type="xsd:string" />
<element name="description" type="xsd:string" />
<element name="price" type="xsd:int" />
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="getProductDetails">
<wsdl:part element="impl:productRequest" name="parameters"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getProductDetailsResponse">
<wsdl:part element="impl:productResponse" name="parameters"> </wsdl:part>
</wsdl:message>
<wsdl:portType name="Product">
<wsdl:operation name="getProductDetails">
<wsdl:input message="impl:getProductDetails" name="getProductDetails"> </wsdl:input>
<wsdl:output message="impl:getProductDetailsResponse" name="getProductDetailsResponse"> </wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ProductServiceSoapBinding" type="impl:Product">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getProductDetails">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getProductDetails">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getProductDetailsResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ProductService">
<wsdl:port binding="impl:ProductServiceSoapBinding" name="ProductPort">
<wsdlsoap:address location="http://localhost:8080/WebService/services/Product"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

BIN
camel-cxf-maven-example-master/target/cxf-codegen-plugin-markers/.03BA8A379A1C11045D1B73515CFEEC0594F0D3C6

BIN
camel-cxf-maven-example-master/target/cxf-codegen-plugin-markers/.6916CA2A5478EADC9F34E4CDF39BE8BFB10429B0

5
camel-cxf-maven-example-master/target/maven-archiver/pom.properties

@ -0,0 +1,5 @@
#Generated by Maven
#Sat Mar 27 01:27:46 IST 2021
version=1.0-SNAPSHOT
groupId=com.steve.research
artifactId=camel-cxf-maven-example

11
camel-cxf-maven-example-master/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@ -0,0 +1,11 @@
com\moodykettle\webservice\helloworld\HelloWorldService.class
com\moodykettle\webservice\helloworld\ProductService.class
com\moodykettle\webservice\helloworld\ProductRequest.class
com\moodykettle\webservice\helloworld\HelloWorld.class
com\moodykettle\webservice\helloworld\ProductResponse.class
com\steve\research\CamelMain.class
com\moodykettle\webservice\helloworld\ObjectFactory.class
com\moodykettle\webservice\helloworld\package-info.class
com\moodykettle\webservice\helloworld\Product.class
com\moodykettle\webservice\helloworld\SayHelloResponse.class
com\moodykettle\webservice\helloworld\SayHello.class

13
camel-cxf-maven-example-master/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@ -0,0 +1,13 @@
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\java\com\steve\research\CamelMain.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\generated\com\moodykettle\webservice\helloworld\SayHelloResponse.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\java\com\steve\research\MyRoute.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\generated\com\moodykettle\webservice\helloworld\ProductService.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\generated\com\moodykettle\webservice\helloworld\package-info.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\generated\com\moodykettle\webservice\helloworld\HelloWorldService.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\generated\com\moodykettle\webservice\helloworld\ObjectFactory.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\java\com\steve\research\ProductServiceImpl.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\generated\com\moodykettle\webservice\helloworld\Product.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\generated\com\moodykettle\webservice\helloworld\ProductResponse.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\generated\com\moodykettle\webservice\helloworld\ProductRequest.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\generated\com\moodykettle\webservice\helloworld\HelloWorld.java
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\main\generated\com\moodykettle\webservice\helloworld\SayHello.java

0
camel-cxf-maven-example-master/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst

1
camel-cxf-maven-example-master/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

@ -0,0 +1 @@
C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\src\test\java\com\steve\research\MyRouteTest.java

65
camel-cxf-maven-example-master/target/surefire-reports/TEST-com.steve.research.MyRouteTest.xml

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="1" failures="0" name="com.steve.research.MyRouteTest" time="0.485" errors="0" skipped="0">
<properties>
<property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
<property name="sun.boot.library.path" value="C:\Java\jdk1.8.0_281\jre\bin"/>
<property name="java.vm.version" value="25.281-b09"/>
<property name="java.vm.vendor" value="Oracle Corporation"/>
<property name="maven.multiModuleProjectDirectory" value="C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master"/>
<property name="java.vendor.url" value="http://java.oracle.com/"/>
<property name="path.separator" value=";"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/>
<property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
<property name="file.encoding.pkg" value="sun.io"/>
<property name="user.script" value=""/>
<property name="user.country" value="IN"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="sun.os.patch.level" value=""/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master"/>
<property name="java.runtime.version" value="1.8.0_281-b09"/>
<property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/>
<property name="java.endorsed.dirs" value="C:\Java\jdk1.8.0_281\jre\lib\endorsed"/>
<property name="os.arch" value="amd64"/>
<property name="java.io.tmpdir" value="C:\Users\macko\AppData\Local\Temp\"/>
<property name="line.separator" value="
"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="user.variant" value=""/>
<property name="os.name" value="Windows 10"/>
<property name="classworlds.conf" value="C:\Users\macko\eclipse-workspace-casestudy3\.metadata\.plugins\org.eclipse.m2e.launching\launches\m2conf2229280176160758005.tmp"/>
<property name="sun.jnu.encoding" value="Cp1252"/>
<property name="java.library.path" value="C:\Java\jdk1.8.0_281\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Users/macko/Downloads/eclipse-java-2020-12-R-win32-x86_64/eclipse//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin/server;C:/Users/macko/Downloads/eclipse-java-2020-12-R-win32-x86_64/eclipse//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Users\macko\AppData\Local\Microsoft\WindowsApps;C:\Users\macko\.dotnet\tools;C:\Users\macko\Downloads\eclipse-java-2020-12-R-win32-x86_64\eclipse;;."/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="java.class.version" value="52.0"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="os.version" value="10.0"/>
<property name="user.home" value="C:\Users\macko"/>
<property name="user.timezone" value="Asia/Calcutta"/>
<property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/>
<property name="java.specification.version" value="1.8"/>
<property name="file.encoding" value="Cp1252"/>
<property name="user.name" value="macko"/>
<property name="java.class.path" value="C:\Users\macko\Downloads\eclipse-java-2020-12-R-win32-x86_64\eclipse\plugins\org.eclipse.m2e.maven.runtime_1.16.0.20200610-1735\jars\plexus-classworlds-2.6.0.jar"/>
<property name="java.vm.specification.version" value="1.8"/>
<property name="sun.arch.data.model" value="64"/>
<property name="java.home" value="C:\Java\jdk1.8.0_281\jre"/>
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher -B install"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="user.language" value="en"/>
<property name="awt.toolkit" value="sun.awt.windows.WToolkit"/>
<property name="java.vm.info" value="mixed mode"/>
<property name="java.version" value="1.8.0_281"/>
<property name="java.ext.dirs" value="C:\Java\jdk1.8.0_281\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext"/>
<property name="sun.boot.class.path" value="C:\Java\jdk1.8.0_281\jre\lib\resources.jar;C:\Java\jdk1.8.0_281\jre\lib\rt.jar;C:\Java\jdk1.8.0_281\jre\lib\sunrsasign.jar;C:\Java\jdk1.8.0_281\jre\lib\jsse.jar;C:\Java\jdk1.8.0_281\jre\lib\jce.jar;C:\Java\jdk1.8.0_281\jre\lib\charsets.jar;C:\Java\jdk1.8.0_281\jre\lib\jfr.jar;C:\Java\jdk1.8.0_281\jre\classes"/>
<property name="java.vendor" value="Oracle Corporation"/>
<property name="maven.home" value="C:\Users\macko\Desktop\gyno-fuse\camel-cxf-maven-example-master\camel-cxf-maven-example-master\EMBEDDED"/>
<property name="file.separator" value="\"/>
<property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/>
<property name="sun.cpu.endian" value="little"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="sun.desktop" value="windows"/>
<property name="sun.cpu.isalist" value="amd64"/>
</properties>
<testcase classname="com.steve.research.MyRouteTest" name="testFoo" time="0.485"/>
</testsuite>

4
camel-cxf-maven-example-master/target/surefire-reports/com.steve.research.MyRouteTest.txt

@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.steve.research.MyRouteTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.576 sec

BIN
camel-cxf-maven-example-master/target/test-classes/com/steve/research/MyRouteTest.class

1
jboss-fuse-cxf-rest

@ -0,0 +1 @@
Subproject commit 9d1c260964d6d4959e4a4538cde4f1cfc7449b9b

19
jboss-fuse-cxf-rest-local/.gitignore

@ -0,0 +1,19 @@
target
.idea
*.iml
*.im
*.ipr
*.iws
overlays
.DS_Store
.settings
*.swp
*.log
.project
.classpath
*.fmd
.cache
dependency-reduced-pom.xml
kube-cluster/kubernetes
apps/modifiedFabric8.json
git-clones

107
jboss-fuse-cxf-rest-local/README.md

@ -0,0 +1,107 @@
# Karaf CXF REST QuickStart
This quickstart demonstrates how to create a RESTful (JAX-RS) web service using CXF and expose it through the OSGi HTTP Service.
The REST service provides a customer service that supports the following operations
- PUT /customerservice/customers/ - to create or update a customer
- GET /customerservice/customers/{id} - to view a customer with the given id
- DELETE /customerservice/customers/{id} - to delete a customer with the given id
- GET /customerservice/orders/{orderId} - to view an order with the given id
- GET /customerservice/orders/{orderId}/products/{productId} - to view a specific product on an order with the given id
When the application is deployed, you can access the REST service using a web browser.
### Building
The example can be built with
mvn clean install
### Running the example in fabric8
It is assumed that OpenShift platform is already running. If not you can find details how to [Install OpenShift at your site](https://docs.openshift.com/enterprise/3.1/install_config/install/index.html).
The example can be built and deployed using a single goal:
mvn -Pf8-deploy
When the example runs in OpenShift, you can use the OpenShift client tool to inspect the status
To list all the running pods:
oc get pods
Then find the name of the pod that runs this quickstart, and output the logs from the running pods with:
oc logs <name of pod>
You can also use the OpenShift [web console](https://docs.openshift.com/enterprise/3.1/getting_started/developers/developers_console.html#tutorial-video) to manage the
running pods, and view logs and much more.
### Access services using a web browser
You can use any browser to perform a HTTP GET. This allows you to very easily test a few of the RESTful services we defined:
Notice: As it depends on your OpenShift setup, the hostname (route) might vary. Verify with `oc get routes` which
hostname is valid for you
Use this URL to display the root of the REST service, which also allows to access the WADL of the service:
http://quickstart-cxf-rest.vagrant.f8/cxf/crm
Use this URL to display the XML representation for customer 123:
http://quickstart-cxf-rest.vagrant.f8/cxf/crm/customerservice/customers/123
You can also access the XML representation for order 223 ...
http://quickstart-cxf-rest.f8/cxf/crm/customerservice/customers/123
**Note:** if you use Safari, you will only see the text elements but not the XML tags - you can view the entire document with 'View Source'
### To run a command-line utility:
You can use a command-line utility, such as cURL or wget, to perform the HTTP requests. We have provided a few files with sample XML representations in `src/test/resources`, so we will use those for testing our services.
1. Open a command prompt and change directory to `cxf-cdi`.
2. Run the following curl commands (curl commands may not be available on all platforms):
* Create a customer
curl -X POST -T src/test/resources/add_customer.xml -H "Content-Type: text/xml" http://quickstart-cxf-rest.f8/cxf/crm/customerservice/customers
* Retrieve the customer instance with id 123
curl http://quickstart-cxf-rest.f8/cxf/crm/customerservice/customers/123
* Update the customer instance with id 123
curl -X PUT -T src/test/resources/update_customer.xml -H "Content-Type: text/xml" http://quickstart-cxf-rest.f8/cxf/crm/customerservice/customers
* Delete the customer instance with id 123
curl -X DELETE http://quickstart-cxf-rest.f8/cxf/crm/customerservice/customers/123
### Running the example using OpenShift S2I template
The example can also be built and run using the included S2I template quickstart-template.json.
The application can be run directly by first editing the template file and populating S2I build parameters, including the required parameter GIT_REPO and then executing the command:
oc new-app -f quickstart-template.json
Alternatively the template file can be used to create an OpenShift application template by executing the command:
oc create -f quickstart-template.json
### More details
You can find more details about running this [quickstart](http://fabric8.io/guide/quickstarts/running.html) on the website. This also includes instructions how to change the Docker image user and registry.

109
jboss-fuse-cxf-rest-local/configuration/settings.xml

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2005-2016 Red Hat, Inc.
Red Hat 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.
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>fusesource.repo</id>
<repositories>
<repository>
<id>fusesource.m2</id>
<name>FuseSource Community Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
<repository>
<id>fusesource.ea</id>
<name>FuseSource Community Early Access Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/ea</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
<repository>
<id>redhat.ga</id>
<name>Red Hat General Availability Repository</name>
<url>https://maven.repository.redhat.com/ga</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>fusesource.m2</id>
<name>FuseSource Community Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>fusesource.ea</id>
<name>FuseSource Community Early Access Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/ea</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>redhat.ga</id>
<name>Red Hat General Availability Repository</name>
<url>https://maven.repository.redhat.com/ga</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>fusesource.repo</activeProfile>
</activeProfiles>
</settings>

363
jboss-fuse-cxf-rest-local/pom.xml

@ -0,0 +1,363 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2005-2016 Red Hat, Inc.
Red Hat 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.fabric8.quickstarts</groupId>
<artifactId>jboss-fuse-cxf-rest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Fabric8 :: Quickstarts :: JBoss Fuse :: CXF REST</name>
<description>REST example using CXF in Karaf container</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.maven-bundle-plugin>2.3.7</version.maven-bundle-plugin>
<camel.version>2.17.0.redhat-630187</camel.version>
<cxf.version>3.1.5.redhat-630187</cxf.version>
<activemq.camel.version>5.11.0.redhat-630187</activemq.camel.version>
<spring.version>3.2.16.RELEASE</spring.version>
<cxf.codegen.version>3.1.5.redhat-630187</cxf.codegen.version>
<!-- configure the versions you want to use here -->
<fuse.version>6.3.0.redhat-187</fuse.version>
<fabric8.version>2.2.156</fabric8.version>
<cxf.plugin.version>3.1.4</cxf.plugin.version>
<karaf.plugin.version>4.0.8.redhat-000017</karaf.plugin.version>
<!-- maven plugin versions -->
<fabric8.maven.plugin.version>1.2.0.redhat-630187</fabric8.maven.plugin.version>
<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
<exec-maven-plugin.version>1.4.0</exec-maven-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- fabric8 bom must be before fabric8 bom -->
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-project-bom-with-platform-deps</artifactId>
<version>${fabric8.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.fuse.bom</groupId>
<artifactId>jboss-fuse-parent</artifactId>
<version>${fuse.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- cxf -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-core</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- swagger -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>1.5.4</version>
<optional>true</optional>
<exclusions>
<!-- avoid this old dependency which breaks CXF -->
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Karaf microcontainer dependencies -->
<dependency>
<!-- scope is compile so all features (there is only one) are installed into startup.properties,
and the feature repo itself is not added in etc/org.apache.karaf.features.cfg file -->
<groupId>org.jboss.fuse</groupId>
<artifactId>fuse-karaf-framework</artifactId>
<version>${fuse.version}</version>
<type>kar</type>
<!-- no need to download kar dependencies -->
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<repositories>
<repository>
<id>redhat-ga-repository</id>
<url>https://maven.repository.redhat.com/ga</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>redhat-ea-repository</id>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>redhat-ga-repository</id>
<url>https://maven.repository.redhat.com/ga</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>redhat-ea-repository</id>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<defaultGoal>install</defaultGoal>
<plugins>
<!-- Compiler plugin enforces Java 1.8 compatibility and activates annotation processors -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
</plugin>
<!-- Need to setup the OSGi meta information here -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${version.maven-bundle-plugin}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
javax.ws.rs;version="[2,3)",
javax.ws.rs.core;version="[2,3)",
javax.ws.rs.ext;version="[2,3)",
javax.xml.bind.annotation,
org.osgi.service.blueprint,
io.swagger.jaxrs.config,
io.swagger.jaxrs.listing,
io.swagger.annotations,
org.apache.cxf.transport.http,
com.fasterxml.jackson.annotation,
com.fasterxml.jackson.core,
com.fasterxml.jackson.databind,
com.fasterxml.jackson.jaxrs.json,
*
</Import-Package>
<Export-Package>
io.fabric8.quickstarts.rest
</Export-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-java2wadl-plugin</artifactId>
<version>${cxf.plugin.version}</version>
<executions>
<execution>
<id>parsejavadoc</id>
<phase>generate-sources</phase>
<goals>
<goal>parsejavadoc</goal>
</goals>
</execution>
<execution>
<id>process-classes</id>
<phase>process-classes</phase>
<goals>
<goal>java2wadl</goal>
</goals>
<configuration>
<classResourceNames>
<classResourceName>io.fabric8.quickstarts.rest.CustomerService</classResourceName>
</classResourceNames>
<docProvider>org.apache.cxf.maven_plugin.javatowadl.ResourceMapJavaDocProvider</docProvider>
<attachWadl>false</attachWadl>
</configuration>
</execution>
</executions>
</plugin>
<!-- attach feature file to install for karaf assembly -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.outputDirectory}/features.xml</file>
<classifier>features</classifier>
<type>xml</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<!-- plugin goals have to be executed in order -->
<!-- 1. install the bundle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>default-install</id>
<goals>
<goal>install</goal>
</goals>
<phase>install</phase>
</execution>
</executions>
</plugin>
<!-- 2. create karaf assembly -->
<!-- karaf-maven-plugin creates custom microservice distribution -->
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>${karaf.plugin.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<id>karaf-assembly</id>
<goals>
<goal>assembly</goal>
</goals>
<phase>install</phase>
</execution>
<execution>
<id>karaf-archive</id>
<goals>
<goal>archive</goal>
</goals>
<phase>install</phase>
</execution>
</executions>
<configuration>
<!-- we are using karaf 2.4.x -->
<karafVersion>v24</karafVersion>
<useReferenceUrls>true</useReferenceUrls>
<archiveTarGz>false</archiveTarGz>
<!-- do not include build output directory -->
<includeBuildOutputDirectory>false</includeBuildOutputDirectory>
<startupRepositories>
<repo>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repo>
</startupRepositories>
<!-- no startupFeatures -->
<startupFeatures>
<feature>karaf-framework</feature>
<feature>jaas</feature>
<feature>shell</feature>
<feature>aries-blueprint</feature>
<feature>cxf-core</feature>
<feature>cxf-jaxrs</feature>
<feature>cxf-http-jetty</feature>
<!-- swagger -->
<feature>http</feature>
<feature>cxf-specs</feature>
<feature>swagger2</feature>
</startupFeatures>
<startupBundles>
<bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
</startupBundles>
</configuration>
</plugin>
<!-- 3. create docker image -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>${fabric8.maven.plugin.version}</version>
</plugin>
</plugins>
</build>
</project>

52
jboss-fuse-cxf-rest-local/src/main/java/io/fabric8/quickstarts/rest/Customer.java

@ -0,0 +1,52 @@
/**
* Copyright 2005-2016 Red Hat, Inc.
*
* Red Hat 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 io.fabric8.quickstarts.rest;
import javax.xml.bind.annotation.XmlRootElement;
/**
* The Customer class is just a plain old java object, with a few properties and getters and setters.
* <p/>
* By adding the @XmlRootElement annotation, we make it possible for JAXB to unmarshal this object into a XML document and
* to marshal it back from the same XML document.
* <p/>
* The XML representation of a Customer will look like this:
* <Customer>
* <id>123</id>
* <name>National Aquarium</name>
* </Customer>
*/
@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;
}
}

224
jboss-fuse-cxf-rest-local/src/main/java/io/fabric8/quickstarts/rest/CustomerService.java

@ -0,0 +1,224 @@
/**
* Copyright 2005-2016 Red Hat, Inc.
*
* Red Hat 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 io.fabric8.quickstarts.rest;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.Consumes;
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.Context;
import javax.ws.rs.core.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.apache.cxf.jaxrs.ext.MessageContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 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.
* <p/>
* 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 {
private static final Logger LOG = LoggerFactory.getLogger(CustomerService.class);
long currentId = 123;
Map<Long, Customer> customers = new HashMap<Long, Customer>();
Map<Long, Order> orders = new HashMap<Long, Order>();
private MessageContext jaxrsContext;
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.
* <p/>
* The method returns a Customer object - for creating the HTTP response, this object is marshaled into XML using JAXB.
* <p/>
* 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) {
LOG.info("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.
* <p/>
* 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).
* <p/>
* 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/")
@Consumes({"application/xml", "application/json" })
@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) {
LOG.info("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.
* <p/>
* 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.
* <p/>
* 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/")
@Consumes({"application/xml", "application/json" })
@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) {
LOG.info("Invoking addCustomer, Customer name is: {}", customer.getName());
customer.setId(++currentId);
customers.put(customer.getId(), customer);
if (jaxrsContext.getHttpHeaders().getMediaType().getSubtype().equals("json")) {
return Response.ok().type("application/json").entity(customer).build();
} else {
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.
* <p/>
* 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) {
LOG.info("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.
* <p/>
* 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) {
LOG.info("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);
}
@Context
public void setMessageContext(MessageContext messageContext) {
this.jaxrsContext = messageContext;
}
}

113
jboss-fuse-cxf-rest-local/src/main/java/io/fabric8/quickstarts/rest/Order.java

@ -0,0 +1,113 @@
/**
* Copyright 2005-2016 Red Hat, Inc.
*
* Red Hat 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 io.fabric8.quickstarts.rest;
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;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Order class is not only a plain old java object, with a few properties and getters and setters, but it also defines
* a sub-resource for the Order returned by CustomerService.
* <p/>
* By adding the @XmlRootElement annotation, we make it possible for JAXB to unmarshal this object into a XML document and
* to marshal it back from the same XML document.
* <p/>
* The XML representation of an Order will look like this:
* <Order>
* <id>223</id>
* <description>Order 223</description>
* </Order>
*/
@XmlRootElement(name = "Order")
public class Order {
private static final Logger LOG = LoggerFactory.getLogger(CustomerService.class);
private long id;
private String description;
private Map<Long, Product> products = new HashMap<Long, Product>();
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;
}
/**
* This method is mapped to an HTTP GET of '/', relative to the URL that point to this Order resource itself.
* <p/>
* The method returns the Order object itself - for creating the HTTP response, this object is marshaled into XML using
* JAXB.
* <p/>
* For example: if surfing to 'http://localhost:8181/cxf/crm/customerservice/orders/223' will show you the information of
* order 223 in XML format (as defined in CustomerService's getOrder() method), you can access product 323 in that order by
* accessing 'http://localhost:8181/cxf/crm/customerservice/orders/223/products/323'
*/
@GET
@Path("/")
@Produces("application/xml")
public Order getThisOrder() {
return this;
}
/**
* This method is mapped to an HTTP GET of 'products/{productId}', relative to the URL that point to this Order resource
* itself.
* The value for {productId} will be passed to this message as a parameter, using the @PathParam annotation.
* <p/>
* The method returns an Product object - for creating the HTTP response, this object is marshaled into XML using JAXB.
* <p/>
* For example: accessing 'http://localhost:8181/cxf/crm/customerservice/orders/223/products/323' will first trigger the
* CustomerService's getOrder() method to return the Order instance for order 223 and afterwards, it will use the remaining
* part of the URI ('products/323') to map to this method and return the product details for product 323 in this order.
*/
@GET
@Path("products/{productId}/")
@Produces("application/xml")
public Product getProduct(@PathParam("productId") int productId) {
LOG.info("----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);
}
}

52
jboss-fuse-cxf-rest-local/src/main/java/io/fabric8/quickstarts/rest/Product.java

@ -0,0 +1,52 @@
/**
* Copyright 2005-2016 Red Hat, Inc.
*
* Red Hat 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 io.fabric8.quickstarts.rest;
import javax.xml.bind.annotation.XmlRootElement;
/**
* The Product class is just a plain old java object, with a few properties and getters and setters.
* <p/>
* By adding the @XmlRootElement annotation, we make it possible for JAXB to unmarshal this object into a XML document and
* to marshal it back from the same XML document.
* <p/>
* The XML representation of a Product will look like this:
* <Product>
* <id>10010</id>
* <description>Armadillo</description>
* </Product>
*/
@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;
}
}

18
jboss-fuse-cxf-rest-local/src/main/java/io/fabric8/quickstarts/rest/package-info.java

@ -0,0 +1,18 @@
/**
* Copyright 2005-2016 Red Hat, Inc.
*
* Red Hat 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.
*/
@javax.xml.bind.annotation.XmlSchema(namespace = "http://rest.fabric.quickstarts.fabric8.io/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package io.fabric8.quickstarts.rest;

75
jboss-fuse-cxf-rest-local/src/main/resources/OSGI-INF/blueprint/blueprint.xml

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2005-2016 Red Hat, Inc.
Red Hat 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 the OSGi Blueprint XML file defining the CXF JAX-RS beans. Because the file is in the
OSGI-INF/blueprint directory inside our JAR, it will be automatically activated as soon as the artifact is installed.
The root element for any OSGi Blueprint file is 'blueprint' - you also see the namespace definitions for both the Blueprint
and the CXF JAX-RS namespaces.
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
<!-- JAXRS providers -->
<bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />
<!-- CXF Swagger2Feature -->
<bean id="swagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
<property name="basePath" value="/cxf/crm"/>
</bean>
<!--
The <jaxrs:server/> element sets up our JAX-RS services. It defines:
- the server's address, '/crm', relative to the default CXF servlet URI
with the default settings, the server will be running on 'http://localhost:8181/cxf/crm'
- a list of service beans
in this example, we refer to another bean defined in this Blueprint XML file with a <ref/> element
-->
<jaxrs:server id="customerService" address="/crm">
<jaxrs:serviceBeans>
<ref component-id="customerSvc"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref component-id="jsonProvider" />
</jaxrs:providers>
<jaxrs:features>
<ref component-id="swagger2Feature" />
</jaxrs:features>
</jaxrs:server>
<cxf:bus>
<cxf:features>
<cxf:logging />
</cxf:features>
</cxf:bus>
<!--
We are using the OSGi Blueprint XML syntax to define a bean that we referred to in our JAX-RS server setup.
This bean carries a set of JAX-RS annotations that allow its methods to be mapped to incoming requests.
-->
<bean id="customerSvc" class="io.fabric8.quickstarts.rest.CustomerService"/>
</blueprint>

43
jboss-fuse-cxf-rest-local/src/main/resources/features.xml

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<features name="swagger2" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0">
<feature name="swagger2" version="${project.version}" description="swagger2 necessary bundkles">
<!-- swagger -->
<bundle start-level="10">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr339-api-2.0/2.5.0</bundle>
<bundle start-level="10">mvn:com.fasterxml.jackson.core/jackson-core/2.6.3</bundle>
<bundle start-level="10">mvn:com.fasterxml.jackson.core/jackson-databind/2.6.3</bundle>
<bundle start-level="10">mvn:com.fasterxml.jackson.core/jackson-annotations/2.6.3</bundle>
<bundle start-level="10">mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-xml/2.6.3</bundle>
<bundle start-level="10">mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.6.3</bundle>
<bundle start-level="10">mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/2.6.3</bundle>
<bundle start-level="10">mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.6.3</bundle>
<bundle start-level="10">mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.6.3</bundle>
<bundle start-level="10">mvn:org.javassist/javassist/3.20.0-GA</bundle>
<bundle start-level="10">mvn:javax.validation/validation-api/1.1.0.Final</bundle>
<bundle start-level="10">mvn:org.apache.commons/commons-lang3/3.4</bundle>
<bundle start-level="10">mvn:com.google.guava/guava/18.0</bundle>
<bundle start-level="10">mvn:io.swagger/swagger-core/1.5.4</bundle>
<bundle start-level="10">mvn:io.swagger/swagger-annotations/1.5.4</bundle>
<bundle start-level="10">mvn:io.swagger/swagger-models/1.5.4</bundle>
<bundle start-level="10">mvn:io.swagger/swagger-jaxrs/1.5.4</bundle>
<bundle start-level="10">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections/0.9.10_3</bundle>
</feature>
</features>

1
jboss-fuse-cxf-rest-local/src/test/resources/add_customer.json

@ -0,0 +1 @@
{ "name": "Jack" }

3
jboss-fuse-cxf-rest-local/src/test/resources/add_customer.xml

@ -0,0 +1,3 @@
<Customer xmlns="http://rest.fabric.quickstarts.fabric8.io/">
<name>Jack</name>
</Customer>

35
jboss-fuse-cxf-rest-local/src/test/resources/log4j.properties

@ -0,0 +1,35 @@
#
# Copyright 2005-2016 Red Hat, Inc.
#
# Red Hat 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.
#
log4j.rootLogger=INFO, file, out
# 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=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
# MDC
#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camelexchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
# File appender
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.file=target/rest.log
log4j.appender.file.append=true
log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
# MDC
#log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer

4
jboss-fuse-cxf-rest-local/src/test/resources/update_customer.xml

@ -0,0 +1,4 @@
<Customer xmlns="http://rest.fabric.quickstarts.fabric8.io/">
<name>Mary</name>
<id>123</id>
</Customer>

1
spring-boot-camel-xml

@ -0,0 +1 @@
Subproject commit 285d3148f4ad2a72a3828efe0affb8805633a79a

17
spring-boot-camel-xml-local/.gitignore

@ -0,0 +1,17 @@
target
.idea
*.iml
*.im
*.ipr
*.iws
overlays
.DS_Store
.settings
*.swp
*.log
.project
.classpath
*.fmd
.cache
dependency-reduced-pom.xml
.vagrant/

201
spring-boot-camel-xml-local/LICENSE

@ -0,0 +1,201 @@
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.

202
spring-boot-camel-xml-local/LICENSE.md

@ -0,0 +1,202 @@
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.

47
spring-boot-camel-xml-local/README.md

@ -0,0 +1,47 @@
# Spring-Boot Camel XML QuickStart
This example demonstrates how to configure Camel routes in Spring Boot via
a Spring XML configuration file.
The application utilizes the Spring [`@ImportResource`](http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/annotation/ImportResource.html) annotation to load a Camel Context definition via a [camel-context.xml](src/main/resources/spring/camel-context.xml) file on the classpath.
IMPORTANT: This quickstart can run in 2 modes: standalone on your machine and on your Single-node OpenShift Cluster
### Building
The example can be built with
mvn clean install
### Running the Quickstart standalone on your machine
You can also run this booster as a standalone project directly:
Obtain the project and enter the project's directory
Build the project:
mvn clean package
mvn spring-boot:run
### Running the Quickstart on a Single-node OpenShift Cluster
All commands below requires one of these:
- be logged in to the targeted OpenShift instance (using oc login command line tool for instance)
- configure properties to specify to which OpenShift instance it should connect
If you have a single-node OpenShift cluster, such as Minishift or the Red Hat Container Development Kit, [installed and running](http://appdev.openshift.io/docs/minishift-installation.html), you can also deploy your quickstart there. A single-node OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.
To deploy your booster to a running single-node OpenShift cluster:
Log in and create your project:
oc login -u developer -p developer
oc new-project MY_PROJECT_NAME
Import base images in your newly created project (MY_PROJECT_NAME):
oc import-image fis-java-openshift:2.0 --from=registry.access.redhat.com/jboss-fuse-6/fis-java-openshift:2.0 --confirm
Unzip, build and deploy your booster:
mvn clean -DskipTests fabric8:deploy -Popenshift -Dfabric8.generator.fromMode=istag -Dfabric8.generator.from=MY_PROJECT_NAME/fis-java-openshift:2.0

199
spring-boot-camel-xml-local/pom.xml

@ -0,0 +1,199 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2005-2016 Red Hat, Inc.
Red Hat 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.redhat.fuse.quickstarts</groupId>
<artifactId>spring-boot-camel-xml</artifactId>
<version>1.0-SNAPSHOT</version>
<name>JBoss Fuse :: Quickstarts :: Spring-Boot :: Camel XML</name>
<description>Spring Boot example running a Camel route defined in XML</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>1.5.18.RELEASE</spring-boot.version>
<camel.version>2.17.0.redhat-630187</camel.version>
<!-- versions of Maven plugins -->
<fmp.version>3.5.37</fmp.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-dependencies</artifactId>
<version>2.18.1.redhat-000005</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<!-- <plugin> -->
<!-- <groupId>io.fabric8</groupId> -->
<!-- <artifactId>fabric8-maven-plugin</artifactId> -->
<!-- <version>${fmp.version}</version> -->
<!-- </plugin> -->
</plugins>
</pluginManagement>
<plugins>
<!-- Core plugins -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<!--
this plugin will use the fabric.* properties to configure its behaviour
see the Properties section here: http://fabric8.io/gitbook/mavenPlugin.html
-->
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>1.2.0.redhat-630187</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>redhat-ga-repository</id>
<url>https://maven.repository.redhat.com/ga</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>redhat-ea-repository</id>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>redhat-ga-repository</id>
<url>https://maven.repository.redhat.com/ga</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>redhat-ea-repository</id>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- <profiles> -->
<!-- <profile> -->
<!-- <id>openshift</id> -->
<!-- <build> -->
<!-- <plugins> -->
<!-- <plugin> -->
<!-- <groupId>io.fabric8</groupId> -->
<!-- <artifactId>fabric8-maven-plugin</artifactId> -->
<!-- <configuration> -->
<!-- <enricher> -->
<!-- <excludes> -->
<!-- <exclude>fmp-openshift-route</exclude> -->
<!-- </excludes> -->
<!-- </enricher> -->
<!-- </configuration> -->
<!-- <executions> -->
<!-- <execution> -->
<!-- <goals> -->
<!-- <goal>resource</goal> -->
<!-- <goal>build</goal> -->
<!-- </goals> -->
<!-- </execution> -->
<!-- </executions> -->
<!-- </plugin> -->
<!-- </plugins> -->
<!-- </build> -->
<!-- </profile> -->
<!-- </profiles> -->
</project>

15
spring-boot-camel-xml-local/src/main/fabric8/deployment.yml

@ -0,0 +1,15 @@
spec:
template:
spec:
containers:
-
resources:
requests:
cpu: "0.2"
memory: 256Mi
limits:
cpu: "1.0"
memory: 256Mi
env:
- name: SPRING_APPLICATION_JSON
value: '{"server":{"tomcat":{"max-threads":1}}}'

35
spring-boot-camel-xml-local/src/main/java/io/fabric8/quickstarts/camel/Application.java

@ -0,0 +1,35 @@
/*
* Copyright 2016 Red Hat, Inc.
* <p>
* Red Hat 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 io.fabric8.quickstarts.camel;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
@SpringBootApplication
// load regular Spring XML file from the classpath that contains the Camel XML DSL
@ImportResource({"classpath:spring/camel-context.xml"})
public class Application {
/**
* A main method to start this application.
*/
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

38
spring-boot-camel-xml-local/src/main/java/io/fabric8/quickstarts/camel/MyTransformer.java

@ -0,0 +1,38 @@
/*
* Copyright 2016 Red Hat, Inc.
* <p>
* Red Hat 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 io.fabric8.quickstarts.camel;
import org.springframework.stereotype.Component;
/**
* A sample transform
*/
@Component(value = "myTransformer")
public class MyTransformer {
public String transform() {
// let's return a random string
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < 3; i++) {
int number = (int) (Math.round(Math.random() * 1000) % 10);
char letter = (char) ('0' + number);
buffer.append(letter);
}
return buffer.toString();
}
}

17
spring-boot-camel-xml-local/src/main/resources/application.properties

@ -0,0 +1,17 @@
#spring.main.sources=io.fabric8.quickstarts.camel
logging.config=classpath:logback.xml
# the options from org.apache.camel.spring.boot.CamelConfigurationProperties can be configured here
camel.springboot.name=MyCamel
# lets listen on all ports to ensure we can be invoked from the pod IP
server.address=0.0.0.0
management.address=0.0.0.0
# lets use a different management port in case you need to listen to HTTP requests on 8080
management.port=8081
# disable all management endpoints except health
endpoints.enabled = false
endpoints.health.enabled = true

17
spring-boot-camel-xml-local/src/main/resources/logback.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>

20
spring-boot-camel-xml-local/src/main/resources/spring/camel-context.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- Define a traditional camel context here -->
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route id="simple-route">
<from id="route-timer" uri="timer:foo?period=2000"/>
<transform id="route-transform">
<method ref="myTransformer"/>
</transform>
<log id="route-log" message=">>> ${body}"/>
</route>
</camelContext>
</beans>

2
test.txt

@ -1 +1 @@
test
another test
Loading…
Cancel
Save