SwitchYard + OpenShift For The Win...
bfitzpat Feb 14, 2013 3:57 PM(work in progress)
So I've been looking into SWITCHYARD-1293, which addresses integrating SwitchYard and OpenShift to simplify the process for the user who wants to develop a SwitchYard application on OpenShift or move an existing local project on OS.
While doing that, I needed to figure out the steps to get this working so that we knew what needed to be done to improve the process in the tooling. So here are the steps (assuming you have an OpenShift account at http://openshift.redhat.com):
(1) Find your vavorite Eclipse Juno installation with SwitchYard tooling installed and add the OpenShift tooling (from the JBoss Tools Juno site - choose JBoss Cloud Development Tools).
(2) Create a new OpenShift application with the SwitchYard 0.6 cartridge (it's really 0.7.0.Final).
(3) Update the .openshift/config/standalone.xml file in two places:
* In the <extensions> element, add a new <extension module="org.switchyard"/> to the list of extensions.
* And in the <subsystems> element, you need to add a subsystem for the switchyard bits:
{code}
<subsystem xmlns="urn:jboss:domain:switchyard:1.0">
<modules>
<module identifier="org.switchyard.component.bean" implClass="org.switchyard.component.bean.deploy.BeanComponent"/>
<module identifier="org.switchyard.component.soap" implClass="org.switchyard.component.soap.deploy.SOAPComponent"/>
<module identifier="org.switchyard.component.camel.core" implClass="org.switchyard.component.camel.core.deploy.CamelCoreComponent"/>
<module identifier="org.switchyard.component.rules" implClass="org.switchyard.component.rules.deploy.RulesComponent"/>
<module identifier="org.switchyard.component.bpm" implClass="org.switchyard.component.bpm.deploy.BPMComponent"/>
<module identifier="org.switchyard.component.bpel" implClass="org.switchyard.component.bpel.deploy.BPELComponent"/>
<module identifier="org.switchyard.component.resteasy" implClass="org.switchyard.component.resteasy.deploy.RESTEasyComponent"/>
<module identifier="org.switchyard.component.http" implClass="org.switchyard.component.http.deploy.HttpComponent"/>
</modules>
</subsystem>
{code}
(4) (Optional) Change the default packaging in the pom.xml from WAR to JAR. In the pom.xml for the project, there are two places to change:
* Look for <packaging>war</packaging> near the top of the file and change it to <packaging>jar</packaging>.
{code}
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>deployments</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
{code}
* Next, look for <plugin><artifactId>maven-war-plugin</artifactId> and change that section to:
{code}
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>deployments</outputDirectory>
</configuration>
</plugin>
{code}
(5) So now you have your OpenShift project ready to go, we have to configure the project in Eclipse so that the SwitchYard tooling is enabled.
* Right-click on the project and select Properties...
* In the Properties dialog, find the Project Facets listing.
* In the list of project facets, if Java isn't yet checked, go ahead and check it. And then check the SwitchYard facet as well.
* Click OK to apply the changes.
(6) Lastly, you have to select the SwitchYard components you'll be using in this project. These components will differ based on what you want to do in your SwitchYard configuration.
* Right-click on the project, find the SwitchYard->Configure Capabilities... menu.
* This opens the Properties dialog so you can choose the various components you want to use. Since I wanted to use the Bean Quickstart for this project, I'll go ahead and check Implementation Support-> Bean and Gateway Bindings -> SOAP.
Once all that was done, I was able to grab my favorite SwitchYard Quickstart. I took the Bean Quickstart.(You can find it here: https://github.com/jboss-switchyard/quickstarts/tree/master/bean-service) I copied all the relevant bits into the same locations in my OS/SY project, pushed it to the git repository, and was able to test the exposed WSDL using the JBoss Web Service Tester.
----------------------------------------
Obviously this is too many steps. Far too many potholes for users to fall into to get their project running on OpenShift.
What we're going to look into is:
* Handling steps 3 and 4 when the user adds the SwitchYard facet to the project. Basically we'll check to see if the project is OpenShift enabled and update those files accordingly.
* Handling step 5 is a bit cumbersome as well. Would be better to make it so the Configure->SwitchYard Capabilities... menu automatically adds the facet if it's not there and then enables you to specify the components you want to include.
That would reduce steps 3-6 down to a couple of less convoluted steps.