SoaFaqCustomSUProjectType

<< CompApp/CASA FAQ

How to create a custom SE Service Unit project type?

Contents



OK, you have implemented a custom service engine and will like to extend the NetBeans SOA tooling to support your SE. The following is an outline of basic steps needed to achive this.

Basic steps

1. Define SU jar content and layout

The first step is to define the content and layout of your service unit jar file. Please read the JBI spec to understand the SU jar format requirements. For SOA tooling integration, there are two requirements:

  • A SU jbi.xml must be included which defines the provides and consumes endpoints of the service unit. An example of a BPEL SU jbi.xml is shown below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jbi xmlns="http://java.sun.com/xml/ns/jbi"
     xmlns:ns0="http://enterprise.netbeans.org/bpel/SynchronousSample/SynchronousSample_1" 
     xmlns:ns1="http://localhost/SynchronousSample/SynchronousSample"
     xmlns:ns2="http://enterprise.netbeans.org/jbi-extensions" version="1.0">
    <services binding-component="false">
        <provides endpoint-name="partnerlinktyperole1_myRole" 
                  interface-name="ns1:portType1" 
                  service-name="ns0:SynchronousSample">
        </provides>
    </services>
</jbi>
  • The associated WSDL and XSD files that define the provides and consumes endpoints must be made available to CompApp/CASA. This is normally done by including these files directly in the SU jar. However, alternative solutions can be considered if needed. For example, NetBeans EJB projects do not always have WSDL included. So, it provides a WSDL export action to allow the user to copy service WSDL to CompApp project directly.

2. Implement custom editors (Optional)

If there is any need to create custom editors in NetBeans, there are many tutorials and examples showing how this can be done. For SOA tooling integration, there is no mandatory requirement on editors.

3. Implement a custom SU project type

The most important step is to implement a NetBeans project type for the service engine. For SOA tooling integration, there are several requirements on the SU project module:

  • Implement a NetBeans ant project type
  • Implement
    org.netbeans.spi.project.ant.AntArtifactProvider
    interface and add it to the project lookup. This interface has a method, {getBuildArtifacts()}, to return a list of AntArtifact generated by the project.
  • Return a
    org.netbeans.api.project.ant.AntArtifact
    with the SOA tooling artifact type in one of its type property. There are several standard AntArtifcat properties that are needed. These properties tell CompApp/CASA the type of artifact, its location, how to build it, and how to remove it.
  • type - a type with SOA prefix "CAPS.asa:", e.g.
    CAPS.asa:my_test_engine
  • locationProperty - the project-relative location of the artifact, e.g.
    build/su.jar
  • eval - a location property evaluator, e.g.
    getStandardPropertyEvaluator()
  • targetName - the Ant target to build the artifact, e.g.
    dist_se
  • cleanTargetName - the Ant target to delete the artifact, e.g.
    clean
The following is an example implementation of a SOA tooling AntArtifact, i.e., an AntArtifact with "
CAPS.asa:
" prefix:
public AntArtifact[] getBuildArtifacts() {
  return new AntArtifact[]{helper.createSimpleAntArtifact(
      "CAPS.asa:sun-bpel-engine",             // Artifcat type
      "build/su.jar",                         // Artifcat location
      helper.getStandardPropertyEvaluator(),  // Evaluator
      "dist_se",                              // Ant build target
      "clean"),                               // Ant clean target
  };
}
  • In the layer.xml of SU project module, add a <JbiComponents> element for each of the service engine supported by the project. Attach to each SE, the following attributes:
  • id - the name of service engine, e.g.,
    sun-javaee-engine
  • description - a description, e.g.,
    Java EE service engine
  • type - the JBI component type, e.g.,
    Engine

The following is an example of this layer.xml entry:

<folder name="JbiComponents">
   <!-- JBI Component -->
   <file name="sun-javaee-engine">
      <attr name="id" stringvalue="sun-javaee-engine"/>
      <attr name="description" stringvalue="Java EE service engine."/>
      <attr name="type" stringvalue="Engine"/>
   </file>
</folder>

Summary of SOA tooling requirements

This is a short summary of SOA tooling integration requirements for NetBeans SU project type. There are four key requirements:

  1. generate SU jbi.xml
  2. add an implementation of
    AntArtifactProvider
    in project lookup
  3. return a SOA tooling type
    AntArtifact
  4. add a
    <JbiComponents>
    entry in module's layer.xml

Using Component Development Toolkit (CDK)

OpenESB provides a Component Development Toolkit (CDK) for generating project templates for generic SE and BC components. CDK can also generate a generic template for NetBeans SU project. There is a demo, JBI CDK Service Engine Deployment Plugin (JBIModule) Demo, showing how to create the SU project template using the CDK.

References:

  • Component Development Toolkit wiki page
  • NetBeans SU project template demo
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo