Version 4

    Introduction

     

    This page provides an overview of features related to design-time governance and repository integration with SwitchYard.

     

    Example Application Structure

     

    The multiApp quickstart demo provides a nice example of multi-project application integrated with a service repository.  There are four project modules in the multiApp quickstart:

    • artifacts : contains XSDs, WSDLs, and Java domain objects which are used by service providers and consumers across application projects
    • order-service : provides two services - OrderService and InventoryService
    • order-consumer : consumes OrderService through a SOAP/HTTP binding
    • web : consumes InventorySerivce using it's Java service interface

     

    There are two ways to build and deploy the example application:

    • Maven Only : this builds the entire project, including service artifact module, to be deployed to AS7.
    • Maven + Guvnor : upload shared service artifacts to Guvnor and build a service module there.  The service provider, consumer and web projects are built via Maven.

     

    Instructions specific to each approach are included below.

     

    Maven

     

    The multiApp project has a top-level pom.xml which can be used to build the entire set of projects, including service artifacts.  The generated service artifact jar is identical to the version that would be produced from Guvnor.  Once the project is built, the following artifacts should be deployed to the AS 7 runtime:

     

    multiApp/artifacts/target/OrderService.jar
    multiApp/order-service/target/switchyard-quickstart-demo-multi-order-service.jar
    multiApp/order-consumer/target/switchyard-quickstart-demo-multi-order-consumer.jar
    multiApp/web/target/switchyard-quickstart-demo-multi-web.war
    

     

    Guvnor

     

    As an alternative to building a service artifact module with Maven, you can use Guvnor to upload and manage individual service artifacts and build a single service artifact module for deployment.  First, you need to download and deploy Guvnor for AS 7.  The latest Guvnor downloads can be found here.  Simply copy the downloaded AS7 war to the standalone/deployments directory of your AS7 installation and you are good to go (you may want to change the filename to guvnorsoa.war, which will produce shorter a context root for the actual webapp URL).  Once GuvnorSOA is deployed, follow these steps to upload and build the OrderService artifact module:

     

    1. In the left frame, choose the Services tab.  Then select 'Create New' -> 'New Service'.  Name the service "OrderService" and click "Create Order Service".
    2. 'Create New' -> 'New XML Schemas".  Name the schema "orderTypes" and click OK.  Upload the schema found in multiApp/artifacts/src/main/resources/orderTypes.xsd.
    3. 'Create New' -> 'New WSDLs".  Name the WSDL "OrderService" and click OK.  Upload the WSDL found in multiApp/artifacts/src/main/resources/OrderService.wsdl.
    4. 'Create New' -> 'New Jars".  Name the jar "order-classes" and click OK.  Upload the jar found in multiApp/artifacts/target/OrderService-classes.jar.
    5. Click on OrderService in the left frame and select the 'Edit' tab in the main frame.  Build the service and note the URL for the service module binary.

     

    You have now built a service artifact module using Guvnor.  The module is almost ready to deploy to AS7, but you need to make one small change.  Since the domain classes in the artifact module are used in a CDI application, the artifact jar must contain a META-INF/beans.xml to make it eligible for bean scanning.  Doing this is trivial.  Here's an example of how to do it:

     

    mkdir META-INF
    touch META-INF/beans.xml
    jar -uvf OrderService.jar META-INF/beans.xml
    

     

    Follow the same deployment instructions for Maven with the exception of using the downloaded service artifact module from Guvnor instead of the version built in multiApp/artfiacts/target.

     

    Artifact Metadata

     

    It is possible to associate a SwitchYard application with a set of artifacts produced by a service repository using the <artifacts> element in the switchyard descriptor:

     

     <switchyard>
         <!-- snip -->
        <artifacts>
            <artifact name="OrderService" url="http://localhost:8080/guvnorsoa/rest/packages/OrderService"/>
        </artifacts>
    </switchyard>
    

     

    This metadata allows the user to track where a given artifact is used in deployed applications, providing the basis for impact and dependency analysis for service artifacts.  The Forge command 'import-artifacts' can be used to add this metadata:

     

    switchyard import-artifacts --URL http://localhost:8080/guvnorsoa/rest/packages/OrderService --name OrderService