Yeoman-based Camel Project Generator.
This project uses the Yeoman framework and node.js to generate the scaffold for Apache Camel projects as well as a simple template that can be used as a starting point.
For a Spring DSL-based project, the structure looks like this:
├── README.md Project Readme file
├── pom.xml Maven Project Object Model file
└── src
├── main
│ └── resources
│ └── META-INF
│ └── spring
│ └── camel-context.xml Camel configuration file (Spring XML DSL)
For a Blueprint DSL-based project, the structure looks like this:
├── README.md Project Readme file
├── pom.xml Maven Project Object Model file
└── src
├── main
│ └── resources
│ └── OSGI-INF
│ └── blueprint
│ └── blueprint.xml Camel configuration file (Blueprint XML DSL)
For a Java DSL-based project, the structure looks like this:
├── README.md Project Readme file
├── pom.xml Maven Project Object Model file
└── src
├── main
│ └── java
│ └── [your package name]
│ └── routes
│ └── CamelRoute.java Camel Java class file containing sample route
│ └── Launcher.java Java class aiding in launching from command line
For a Spring-Boot based project, the structure looks like this:
├── README.md Project Readme file
├── pom.xml Maven Project Object Model file
└── src
├── main
│ └── java
│ └── [your package name]
│ └── routes
│ └── SampleCamelApplication.java Spring-Boot application class file
└── resources
└── application.properties Spring-Boot application properties file
└── camel-context.xml Camel configuration file (Spring XML DSL)
You must have yeoman installed first:
> npm install -g yo
The generator is located in the npm repository (https://www.npmjs.com/package/generator-camel-project):
> npm install --global generator-camel-project
> mkdir myproject
> cd myproject
> yo camel-project
_ _
/ \ _ __ __ _ ___ | |__ ___
/ _ \ | '_ \ / _` | / __| | '_ \ / _ \
/ ___ \ | |_) | | (_| | | (__ | | | | | __/
/_/ \_\ | .__/ \__,_| \___| |_| |_| \___|
|_|
____ _
/ ___| __ _ _ __ ___ ___ | |
| | / _` | | '_ ` _ \ / _ \ | |
| |___ | (_| | | | | | | | | __/ | |
\____| \__,_| |_| |_| |_| \___| |_|
-----------------------------------------------
Camel Project Generator
Version: 0.2.0
-----------------------------------------------
? Your Camel project name (myproject)
? Your Camel version 2.22.2
? Camel DSL type (blueprint, spring, spring-boot, or java) blueprint
? Package name: com.myproject
camel project name myproject
camel version 2.22.2
camel DSL blueprint
package name com.myproject
Creating folders
Copying files
create pom.xml
create README.md
create src\main\resources\OSGI-INF\blueprint\blueprint.xml
create src\main\resources\OSGI-INF\log4j2.properties
>
As of version 0.2.0, you now have the option to scaffold a new Spring, Spring-Boot, or Blueprint project based on an available WSDL file for a JAX-WS service.
To run the generator with the additional wsdl2rest functionality, now you simply type:
> yo camel-project --wsdl2rest
This will prompt you for two additional properties:
The addition of the --wsdl2rest option has been made available to help scaffold projects for simple running SOAP services. The wsd2rest utility handles basic SOAP cases, but may not handle your particular scenario if your service uses WS-Security or other more complex options.
To aid with debugging, we have added a "--debug" flag that will show additional information in the terminal. However, the wsdl2rest utility creates two log files -- velocity.log and wsdl2rest.log -- that will provide even more information.
If you have a particular WSDL case you wish to be supported, we recommend logging a new issue with a WSDL sample and as much information as you can provide at https://github.com/jboss-fuse/wsdl2rest/issues
The code is available at github currently in: https://github.com/camel-tooling/generator-camel-project/
Fork the project and clone it locally. If you have suggestions or improvements, feel free to create pull requests and issues.
From the main generator-camel-project directory:
> npm link
Then create a directory you wish to create a Camel project in and run the generator as described above:
> yo camel-project
We have added command-line capabilities for providing argument values for the prompted information. Without prompting, this allows us to use the generator as part of a larger script to help prep a new project in a more automated fashion.
This allows us to do things like the following and avoid having to go through the prompts:
> yo camel-project appname=MyApp camelVersion=2.19.1 camelDSL=spring package=com.myapp
With version 0.1.3, we have also added command-line support for wsdl2rest options. Note that all values must be specified for successful project generation.
yo camel-project appname=MyApp camelVersion=2.22.2 camelDSL=spring package=com.myapp wsdl=http://localhost:3000/helloworldservice?wsdl outdirectory=src/main/java jaxrs=http://localhost:8081/rest jaxws=http://localhost:3000/helloworldservice
Generated templates for spring, blueprint, and Java DSLs can be run with:
> mvn install
> mvn camel:run
Note that there is an issue testing the generated Blueprint/wsdl2rest project currently using mvn camel:run, but it should deploy and run successfully on a Karaf/OSGi container. (See Known Issues)
First you must install mocha with npm.
> npm install --global mocha
Then, in the main generator-camel-project directory:
> npm test
Generated templates for spring and blueprint DSLs can be run with:
> mvn install
> mvn camel:run
Generated templates for Java DSL can be run with:
> mvn install
> mvn exec:java
Generated templates for spring-boot can be run with:
> mvn install
> mvn spring-boot:run