Skip navigation
kcbabo

SwitchYard 0.3 Released

Posted by kcbabo Dec 8, 2011

The JIRAs are closed, the bits are hosted, and the docs are ready to go.  SwitchYard 0.3.0 Final is ready to rock!  As always, we've created a summary of what's in this release with pointers to more info.  Check out the 0.3 Release Overview, take SwitchYard for a spin, and please let us know what you think!

 

Cheers,

The SwitchYard Team

A quick heads up that I have posted the presentations and lab materials from our recent SwitchYard workshops to our community space.  So if you want to learn a bit more about SwitchYard or just really like to review presentation slides, head on over and check it out.

 

http://community.jboss.org/wiki/SwitchYardWorkshop-Asia

The SwitchYard 0.2 release contained full JBoss AS6 and JBoss AS7 distributions i.e. modified AS6 and AS7 distributions containing the "bits" to allow it run SwitchYard applications.  SwitchYard 0.3 will also contain a JBoss AS7 Installer, which will allow you to install SwitchYard into an existing JBoss AS7 instance.

 

This installer is a simple .zip file containing an Ant script plus all the components for AS7.  It reduces the download binary size quite a bit - 40M Vs 120M (for the full distribution), and we'll be reducing it more.

 

The nightly builds can be found here.  Just download the "SwitchYard-AS7-Installer.zip" file, unzip it and follow the instructions in the README.txt file.

As Keith mentioned in his postSwitchYard Plugin for Eclipse, we have some initial Eclipse based tooling for SwitchYard (prototype may be a better word as the tooling is likely to evolve rapidly in the next few months).

Prerequisites

The tooling may be installed atop any standard Eclipse IDE for JEE distribution version 3.6 or later.  You may use another type of distribution, but you will need to figure out which features need to be installed; at a minumum you will need XML tools and JEE project facets.

 

In addition to the basic Eclipse platform, you will also need to install m2eclipse version 1.0 or later.  (Note, for those of you using an older version of m2eclipse, this version is more tightly integrated and may require you to install additional Eclipse plugins to support specific Maven plugin executions.  If you're not already using m2eclipse 1.0, you may want to use a separate Eclipse install until you are sure the latest version supports all the Maven plugins you are using.)  If an update site for m2eclipse is not already configured in your Eclipse install, here's the URL: http://download.eclipse.org/technology/m2e/releases/

Installation

Keith did a great job describing the installation steps, so I won't rehash them here.

** The SwitchYard tooling is now available from the JBoss SOA Tools update site: http://download.jboss.org/jbosstools/updates/nightly/soa-tooling/trunk/

Features

This initial version of the tooling provides the following features:

  • Creation of SwitchYard projects.
  • Creation of SwitchYard bean service classes.
  • Creation of SwitchYard service unit test classes.
  • XML catalog entries for all SwitchYard project schema.
  • m2eclipse support for the SwitchYard Maven plugin.
  • Support for workspace deployment of SwitchYard projects.

New Wizards

All SwitchYard wizards are accessible from the SwitchYard category in the standard Eclipse new wizard:

new_wizards.gif

New SwitchYard Project Wizard

The new project wizard creates a new maven project in your workspace whose pom contains the basic SwitchYard dependencies and build configuration.  To create a new SwitchYard project, select SwitchYard Project.

 

The first screen is a basic new project screen, allowing you to specify the name and location of the new project:

wizard_project_1.gif

 

The second page allows you to specify some basic project details, including the SwitchYard runtime version:

wizard_project_2.gif

Press Finish and you'll have a new project ready for you to create some services.

 

New Bean Service Wizard

This wizard creates a new Java class with SwitchYard annotations that mark it as a bean service.  In addition to creating the class, the pom may be updated to ensure the necessary dependencies are included in the project definition and to ensure that the SwitchYard Maven plugin is configured to scan for bean services.

 

Before opening the wizard, you should create a Java interface on which your service will be based.  For best results, open the new wizard by right-clicking the interface file. selecting New, Other..., then select Bean Service under the SwitchYard category.  The first page looks similar to the standard new class wizard.  The main differences are the Service Interface field, which allows you to specify the interface on which the implementation will be based, and the Create test class option, which allows you to create a service test class, in addition to the implementation class.  Here's a screenshot:

wizard_bean_1.gif

Press Finish and you should have a new Java class with a @Service annotation ready for coding.  If you selected Create test class, you will also have a unit test ready to be implemented as well.

 

New Service Test Wizard

This wizard creates a new service test class.  The class is created from Java interface used to define a service interface.  The class that is created contains stub methods for each operation in the interface.  The method stubs include code for passing a message to the operation and processing the result.  You only need to initialize the message data and validate the results.  The following illustrates the stubs that are created by the wizard:

 

@RunWith(SwitchYardRunner.class)
@SwitchYardTestCaseConfig(mixins = CDIMixIn.class, config = SwitchYardTestCaseConfig.SWITCHYARD_XML)
public class ExampleServiceTest {

    @ServiceOperation("ExampleService")
    private Invoker service;

    @Test
    public void testSomeInOnlyOperation() throws Exception {
        // TODO Auto-generated method stub
        // initialize your test message
        Object message = null;
        service.operation("someInOnlyOperation").sendInOnly(message);

        // validate the results
        Assert.assertTrue("Implement me", false);
    }

    @Test
    public void testSomeInOutOperation() throws Exception {
        // TODO Auto-generated method stub
        // initialize your test message
        Object message = null;
        String result = service.operation("someInOutOperation")
                .sendInOut(message).getContent(String.class);

        // validate the results
        Assert.assertTrue("Implement me", false);
    }

}

 

As with the new bean service wizard, best results are obtained by opening the wizard via a right-click on the interface file.  The wizard is a slimmed down version of the standard new class wizard, which only allows you to specify the service interface which you are testing.  Here's a screenshot:

wizard_test_1.gif

 

The Browse... button will allow you to browse all Java interfaces used by any SwitchYard services within the project.  Here's a screenshot:

wizard_test_browse.gif

Press Finish on the wizard and you've got a unit test ready to be implemented.  Just initialize the test messages and add some validation and you're off!

XSD Catalog

The tooling provides an XML catalog for resolving all namespaces declared within SwitchYard.  For best results, uncheck Honour all XML schema locations in the XML file validation preferences.  If you're seeing bizarre XML validation errors, you probably haven't unchecked this option.  Here's a screenshot to help:

xml_preferences.gif

m2eclipse Support

The tools provide support for using the SwitchYard Maven plugin within Eclipse.  The SwitchYard plugin will be invoked during an Eclipse build and supports auto/incremental builds.  (Note, incremental builds may produce a switchyard.xml file that contains phantom elements.  If you remove or rename services, i.e. @Service, you should run a clean build for best results.)

Workspace Deployment

The tools provide very crude support for workspace deployments.  SwitchYard projects created through the new wizard are created as faceted projects, configured as Utility Modules.  This will allow you to mark the project for deployment to a JEE server.  That said, it's up to you to ensure the server configured to deploy and run SwitchYard applications.  At some point, we will have proper integration with the Eclipse Servers, allowing deployment only to servers supporting SwitchYard deployments.

Gotchas

Here's a list of issues you should be aware of:

  • If you do not have the JBoss Maven repository configured in your workspace, you may not get a list of SwitchYard runtime versions in the new project wizard.  The tools now configure a custom repository pointing to JBoss public.  This will not alter the behavior of project poms, but will allow the JBoss repository to be scanned by tooling components.
  • The generated switchyard.xml file may contain phantom elements. Perform a clean build, Project, Clean..., to completely regenerate the fiile.  (See m2eclipse Support above.) This has been fixed as part of
  • Make sure you disable Honour all XML schema locations in the XML validation preferences.  (See XSD Catalog above.)
  • There is currently an NPE in the new bean service wizard.  The workaround is to make sure Create test class is checked in the wizard (luckily, that's the default).  Hopefully, this is fixed by the time you read this.  This has been addressed.http://https://issues.jboss.org/browse/SWITCHYARD-471
  • There is a bug in the new Service Test wizard that prevents its use when installed atop Eclipse 3.6.  Make sure you uncheck "Create test class" in the new Bean Service wizard until this is fixed.  (This is not an issue when using Eclipse 3.7.)  https://issues.jboss.org/browse/SWITCHYARD-593

As with anything, if you find a bug or have a feature request, please file a JIRA: https://issues.jboss.org/browse/SWITCHYARD

Rob has created an initial version of a SwitchYard plugin for Eclipse.  Please note the emphasis on initial, since this thing is just getting started.  That said, I think it's already super valuable for SwitchYard developers because it wires us into the Eclipse build cycle via m2eclipse.  This means auto-builds and unit tests can be run directly inside of Eclipse and you still get the benefit our our service scanners and config generation (which are implemented as Maven plugins).  This feature alone is worth your time to install another plugin.  Read on if you want to give it a try ....

 

The plugin is currently available through the SwitchYard-Tools Jenkins build here : goo.gl/cIxYH .  From this link you can download the offline site archive (site_assembly.zip) or you can point directly at the following URL as an Eclipse update site:

 

http://hudson.jboss.org/hudson/job/SwitchYard-Tools/lastSuccessfulBuild/artifact/sources/eclipse/site/target/

 

That looks a little something like the following:

 

eclipse-tools.jpg

 

Rob has added a couple more features beyond the build lifecycle integration, so hopefully this will serve as bait for him to discuss them in greater detail. :-)  Between Forge and JBDS, I think we have the foundation for a great tooling story in SwitchYard.  Stay tuned.

Forge is pretty darn cool.  If you haven't had a chance to play with it yet, it's basically a command-line framework for creating applications.  There are a couple things I really like about Forge.  First, it's quite pluggable, so it's easy for developers to create new tooling that integrates seamlessly with the Forge environment.  Second, it dramatically speeds up the process of creating a new application for users.  I used to use Maven archetypes quite a bit to create new applications from a template definition.  The one drawback with this approach is that the new application is static - you only get what you created from the template.  Forge allows you to add behavior and functionality to an application after it's created - stuff like project dependencies, configuration and code generation.  We use Forge quite a bit within SwitchYard, so I thought it would be interesting to share an example of how Forge can be used when creating SwitchYard applications. 

 

Check out the video and let us know what you think.  Musical accompaniment appears to be a requirement for Forge videos, so I've added a classic tune to the audio track on the vid.

 

BTW, I recommend watching the video in HD and full-screen mode so that you can actually see what's going on. :-)  Click here for a direct link to the HD version.

 

 

kcbabo

SwitchYard 0.2 Released

Posted by kcbabo Sep 6, 2011

The SwitchYard community is proud to announce the arrival of our 0.2 release.  Sure, there's loads of exciting new features, but we also benefited from great feedback and contribution from our community after the 0.1 release, which allowed us to improve on existing features as well.  Be sure to check out the Release Overview for a summary of what we've delivered and directions on how to get started with SwitchYard.

Note: Since this blog was written, JBoss AS 7.0.0.Final (Lightning) has been released and our build now bundles this.

 

Our nightly builds are now pre-configured with JBoss AS 7.0.0.CR1 (White Rabbit) and SwitchYard v 0.2.0-SNAPSHOT:

 

 

We have also ensured that the quickstart samples and demos work seamlessly with this build. Thanks to the modular, crazy fast White Rabbit a full fleged application (with CDI Beans and SOAP gateway) deploys in a couple of seconds.

 

14:19:32,515 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) Starting deployment of "switchyard-quickstart-demo-orders-0.2.0-SNAPSHOT.jar"
14:19:32,609 INFO  [org.jboss.weld] (MSC service thread 1-1) Processing CDI deployment: switchyard-quickstart-demo-orders-0.2.0-SNAPSHOT.jar
14:19:32,687 INFO  [org.jboss.weld] (MSC service thread 1-4) Starting Services for CDI deployment: switchyard-quickstart-demo-orders-0.2.0-SNAPSHOT.jar
14:19:32,734 INFO  [org.jboss.weld.Version] (MSC service thread 1-4) WELD-000900 1.1.1 (Final)
14:19:32,750 INFO  [org.switchyard] (MSC service thread 1-4) Deploying SwitchYard application 'switchyard-quickstart-demo-orders-0.2.0-SNAPSHOT.jar'
14:19:32,781 INFO  [org.jboss.weld] (MSC service thread 1-1) Starting weld service
14:19:33,125 INFO  [org.switchyard] (MSC service thread 1-8) Starting SwitchYard service
14:19:33,875 INFO  [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] (MSC service thread 1-8) Found 3 packages with 13 @Converter classes to load
14:19:33,906 INFO  [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service thread 1-8) Loaded 147 type converters in 0.516 seconds
14:19:34,187 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-8) Creating Service {urn:switchyard-quickstart-demo:orders:1.0}OrderService from WSDL: wsdl/OrderService.wsdl
14:19:34,421 INFO  [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-8) Setting the server's publish address to be http://localhost:18001/OrderService
14:19:34,453 INFO  [org.switchyard.component.soap.InboundHandler] (MSC service thread 1-8) WebService published at http://localhost:18001/OrderService
14:19:34,531 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "switchyard-quickstart-demo-orders-0.2.0-SNAPSHOT.jar"

Installation

Download the SwitchYard Distribution Zip file and simply unzip it into a suitable location on your file system. To start the SwitchYard AS7 instance open a command terminal, change directory into the distribution bin directory and execute the "standalone" command script (standalone.sh on Unix/Linux/MacOS and standalone.bat on Windows). You should see the SwitchYard extension being activated.


 

INFO  [org.jboss.as] JBoss AS 7.0.0.CR1 "White Rabbit" starting
...
INFO  [org.switchyard] (Controller Boot Thread) Activating SwitchYard Extension

 

 

Pre-installed Components

The following components come pre-installed in this distribution


<subsystem xmlns="urn:jboss:domain:switchyard:1.0">
    <modules>
        <module identifier="org.switchyard.component.bean"/>
        <module identifier="org.switchyard.component.soap"/>
        <module identifier="org.switchyard.component.camel"/>
    </modules>
</subsystem>


Quickstarts

Follow the instruction in our guide here to run the quickstarts.

User Guide

A comprehensive guide on how to develop services using the components and gateways is located here.

The SwitchYard team is happy to announce the introduction of the new BPM Component!

 

Using this component, one can easily:

  1. Start a process, signal a process event, or abort a process.
  2. Invoke a SwitchYard Service from within a process.
  3. Use the jBPM 5.1 Eclipse plugin to graphically add SwitchYard Services to a BPMN2 process.

 

For more information, please refer to the article: SwitchYard BPM Component.

We just implemented code to help creation of Webservice-friendly CDI/bean services.  Check out the screencast I just ran off.

 

The basic gist of what's happening here is simple enough.  When SwitchYard sees a CDI @Service with operations implemented using JAXB annotated types, it automatically installs JAXB transformers to transform between these JAXB types and their corresponding XML namespace.  If then (for example), you use the same wsdl (as used to generate the JAXB Java types) to expose a Webservice via the SwitchYard SOAP Gateway, all the transformation logic is automatically set up for the service, so no need to implement and configure any transformers.

 

Give it a try and let us know what you think!!

Even though SwitchYard is a new project, we have already enjoyed fantastic support from our community.  Prior blog posts have highlighted the initial support for Camel and the addition of a JSON transformer.  For this community spotlight post, I want to point out some work that Mario Antollini has done w/r/t Camel configuration.

 

Camel supports a wide array of components which accept configuration as a URI.  For example, the following URI configures the Camel File component to consume files from the "/tmp/input" directory:

 

file:///tmp/input

 

You can't get much more convenient than that.  This is one of the features that makes Camel such a joy to use.  There are a couple of things to watch out for with URIs though.  First, some components in the Camel community support a ton of config options.  Let's take another look at a file config URI that uses a few more options:

 

file:///dev/inbound/purchaseOrders?autoCreate=false&bufferSize=1024&initialDelay=10&delete=true&readLockCheckInterval=1000&startingDirectoryMustExist=true&include=*.txt

 

The above config is a bit chattier and presents two potential challenges:

1)  It's getting tough to parse with the naked eye, which makes reading or updating the config string a bit more error prone.

2)  Validation in tooling is a challenge because we don't have a definition of which settings are allowed and what values those settings can take.

 

One way to address this is to define a schema for the component configuration and use that to structure the config parameters and validate them.  Here's the same config URI represented as a gateway binding config:

 

<binding.file xmlns="urn:switchyard-component-camel:config:1.0">
   <operationSelector operationName="someOperation"/>
   <targetDir>/dev/inbound/purchaseOrders</camel:targetDir>
   <autoCreate>false</camel:autoCreate>
   <bufferSize>1024</camel:bufferSize>
   <consume>
      <initialDelay>10</camel:initialDelay>
      <delete>false</camel:delete>
      <readLockCheckInterval>1000</camel:readLockCheckInterval>
      <startingDirectoryMustExist>true</camel:startingDirectoryMustExist>
      <include>*.txt</include>
   </consume>
</binding.file>

 

Mario has added configuration model support to parse, create, and validate a number of Camel component configs and more are being added.  If you prefer the straight URI route, then that option is still available as well through the base camel binding configuration:

 

<binding.camel configURI="file:///tmp/input">
    <camel:operationSelector operationName="print"/>
 </camel:binding.camel>

 

Thanks Mario!

kcbabo

SwitchYard 0.1 Released!

Posted by kcbabo Jun 16, 2011

The SwitchYard team is happy to announce the arrival of our first release - 0.1!  You can read all about it in the Release Overview, which provides a summary of what's in 0.1 along with links to detailed information on the features in the release.  Take SwitchYard for a spin and let us know what you think.

SwitchYard AS6 & AS7 distros are available for download and test from the JBoss Maven repository.  These are full distributions of JBoss AS6 and AS7 pre-configured with SwitchYard v0.1.0 SNAPSHOT:

 

 

We'd love for people to download one of these deployments, test against the SwitchYard Quickstarts and let us know what you think and whatever issues you encounter.  Simply:

 

  1. Download one of the above distributions and install it on your system in the same way you would the normal AS6 or AS7 distribution (don't forget to point $JBOSS_HOME at the unzipped ditro).
  2. Clone the Quickstarts from github (you need git installed on your system):
    • git clone git://github.com/jboss-switchyard/quickstarts.git
  3. Build the Quickstarts:
    • mvn clean package

 

After building you'll find there are a number of quickstarts jar files that can be deployed to your SwitchYard enabled AS Server.  We'll be adding proper readmes/docs to the quickstarts before the release but here's a quick rundown:

 

  1. demos/orders:  This Quickstart demos the SwitchYard SOAP component combind with the CDI based Bean Services.  Deploy it to your App Server and then use a SOAP Client (e.g. soapUI) to invoke the SOAP endpoint binding (see the AS console for the Service URL and then add "?wsdl" to get the wsdl).  This invokes CDI Bean implemented SwitchYard Service through the SwitchYard Exchange mechansim.
  2. camel-binding:  This Quickstart demos SwitchYard's Apache Camel integration.  A CDI Bean Service is exposed via a Camel File Endpoint.  To exercise the quickstart you need to drop a "test.txt" file (containing some text) into the "target/input" folder off your App Server's bin directory (e.g. "switchyard-as6-0.1/bin/target/input").
  3. camel-service:  This quickstart is currently broken and we are working on fixing it.

 

Please give it a try and let us hear about any issues you encounter !!

SwitchYard community member Alejandro stepped up with a big contribution this week with a JSON transformer.  Like the existing Java and Smooks transformers, JSON transformers are declared in an application configuration and automatically wired into the SwitchYard bus at runtime.  Here's an example definition:

 

<transform.json 
            from="{urn:switchyard-quickstart:transform-json:1.0}order" 
            to="java:org.switchyard.quickstarts.transform.json.Order"/>

 

The JSON transformer takes advantage of the fantabulous Jackson library to map between Java value objects and JSON with ease.  If you would like to see the transformer in action, check out the transform-json project in our Quickstarts repository.

 

Rumor has it that Alejandro will be submitting an XSLT transformer in the near future as well.  Thanks Alejandro!

kcbabo

Friday Rewind

Posted by kcbabo May 27, 2011

It's Friday, which is a great time to reflect on what's happened in the last week ... month!  Holy smokes it's been a long time since we've blogged.  The good news is that we haven't been resting on our laurels.  Our very first release, 0.1, is just around the corner.  No more features or enhancements left - at this stage we're just banging on what's there and fixing any bugs that fall out.  We've made quite a bit of progress from M1 in March.  An exhaustive list of what we've done can be found here and the (thankfully small) list of what remains here.  We will be posting updates and feature details on the blog over the next two weeks, so stay tuned.

 

BTW, if you couldn't make it to JBoss World this year to catch the SwitchYard session, don't despair.  Slides are available online.  :-)

Filter Blog

By date:
By tag: