The Turmeric SOA project at eBay Open Source, provides a runtime framework for executing web services and returning the data in a variety of formats (XML, JSON, Name Value Pair, etc). You can submit a request in one format (i.e. XML) and specify that you want the return data to be in JSON format. You can mix and match to your hearts content, and you as the developer do not have to write any custom code to accomplish this.
To make this possible, Turmeric takes a document-literal style WSDL, and generates the service code. It has a command line tool called CodeGen which provides the code generation facilities. Codegen also provides an API in which adopters can call it directly. The Turmeric Eclipse Plugins when they are in legacy mode, do this for project creation.
Turmeric Eclipse Plugins are in a stake of flux at the moment. Prior to the use of maven as the build system, it was using a custom in house system. So a custom eclipse builder was written for the early Turmeric Eclipse Plugins to handle the code generation. With the migration to maven, a maven specific plugin has been written. When running in eclipse this caused some conflicts early on with the maven plugin and the custom eclipse builders. We could cause an infinite build loop to occur.
So to get around this, the turmeric-maven-plugin checks to see if it is running within eclipse. It does this by looking for the .project file, and checking to see if a Turmeric Builder has already been configured for the project. If not, then the maven plugin will handle the code generation, otherwise it defers to the Turmeric Eclipse Plugin’s builders. This gets around the issue but there is still duplication that is happening within the build. There is the potential that the eclipse builders will generate different code than the maven plugin. This is because of dependencies, and trying to make sure the same version of codegen is being used. The turmeric eclipse plugins bundle their own version of codegen. These checks are only done if the turmeric-maven-plugin is setup to run in legacy mode. The disparity of possible issues in code generation can be addressed by moving to a maven standard way of building and directory structure.
With the migration to open source, one of the requirements was to make it play nice with other maven plugins. To do this, code generation and the existing maven plugin needed to support the standard maven directory structures. Turmeric has introduced for the upcoming 1.0.0 release, a maven archetype for generating a “standard” maven project structure. The archetype will generate a standard interface and service implementation project. It also configures the turmeric-maven-plugin for standard mode. When the turmeric-maven-plugin is configured for standard mode, all generated code is place in the appropriate place.
The turmeric eclipse plugins, also have a special configuration plugin that leverages the M2Eclipse configuration extension point. So when a standard project is detected, the appropriate generated sources are added to the classpath and build path as source folders.
Also, when a standard mode project is run within eclipse, the Turmeric Eclipse Plugins will defer to the turmeric-maven-plugin for code generation. This guarantees that what the build generates outside of eclipse is also what will be generated within eclipse. There is one role responsible for the code generation. It also helps that IDE’s like NetBeans, IntelliJ and others can use the same turmeric-maven-plugin and generate the exact same artifacts.
Along with handling service code generation, the turmeric-maven-plugin handles other code generation chores.
- Error Library
- Type Library
- Service Interface
The turmeric-maven-plugin and codegen together, are the main work horses from a development stand point. They help make it possible to generate services quickly and enable the creation of web services that can easily serve up data in a variety of formats. Standardizing on maven as the default build system has allowed the project to leverage the same build technology not only with in the Eclipse IDE, but in other IDEs as well. If you use the turmeric-maven-plugin you will get the same artifacts generated from the command line or the IDE.