Tuesday Nov 04, 2008

Fuji on GlassFish V3

Fuji on GlassFish V3
As Fuji runs on any OSGi platform and GlassFish V3 is a platform built on modular OSGi based architecture, Fuji team packaged and configured the Fuji runtime on GlassFish V3 and made it available at open-esb maven repository.  Fuji sever plugin for Netbeans is also updated to manage the Fuji instance on GlassFish V3 from Netbeans.

See this wiki page on how to download and install the Fuji+GlassFish V3 distribution.
See this wiki page on how to download and install  the Fuji server plugin for Netbeans.

See this demo video on how to add and manage Fuji instance from Netbeans.
See this demo video on how to deploy Fuji App to the Fuji instances managed from Netbeans.

For more information on Project Fuji visit https://fuji.dev.java.net


Monday Nov 03, 2008

Deploying Fuji apps directly to Fuji instances in Netbeans

Deploying Fuji apps directly to Fuji instances in Netbeans I have updated the Fuji server plugin to add new ui that allows direct deployment of the fuji maven projects to fuji instances managed in Netbeans.
  • Deploy action is added to Fuji app/interceptor maven projects to deploy directly from the project to the Fuji instance started from Netbeans.
  • Deploy customizer category is added to project customizer so that users can pre-select the target server from the list of Fuji instances for deployment.
  • Deploy action can show the list of Fuji instances available for deployment and remember the selection between IDE restarts.
So, update your Fuji server plugin from here and play with it. See this demo video on how to use this new feature.

Project Fuji is a lightweight runtime based on JBI (JSR 208) that runs on any OSGi platform. For more information on Project Fuji, visit https://fuji.dev.java.net

Tuesday Oct 21, 2008

IFL Editor in Fuji Milestone2

ifl editor in fuji m2 Fuji Milestone2 is now available. Please download and play with it and send your feedback to users@open-esb.dev.java.net. Milestone2 added many features and improvements in the components, runtime, distribution and the netbeans support to Fuji Project. There are some new features we have added to IFL editor in Netbeans. Besides supporting the keywords, syntax validation, coloring and completion for the new EIP support (split, aggregate, filter) in IFL, it  has two new features that help user in editing the ifl and its generated artifacts quickly.
  • IFL editor toolbar/popup menu action for generating the application artifacts for IFL
    • You can now generate the service artifacts directly from the IFL Editor toolbar/popup menu and  hence no need to navigate to maven project custom goal actions for this.  Clicking the right most button with green arrow icon on the IFL editor toolbar will run the fuji:generate-artifacts goal directly from the IFL editor which generates the service/flow configuration artifacts. Another way to invoke the generate artifacts goal is by selecting  "Generate Service Artifacts" action from the popup menu of the IFL editor pane.
  • IFL editor popup menu action for editing the generated service/flow configurations.
    • Once you have generated the service/flow configuration artifacts, to edit them, you can now invoke the configuration file editors directly from the IFL Editor. To do that, move the cursor to the service declaration or flow (splig, aggregate or filter) declaration, bring up the popup menu on the IFL editor pane and select "Edit configuration" action which brings up the corresponding service/flow artifact editor for that service/flow construct under the cursor.
See this little video demo on the above features of IFL editor in Netbeans.

For more information on Project Fuji, visit https://fuji.dev.java.net

And, don't forget to watch this Fuji Milestone 2 Screencast


Thursday Aug 21, 2008

Netbeans tools for standalone Fuji/OSGi runtimes

Netbeans tools for standalone fuji/OSGi runtimes

Do you want to manage OSGi runtime from Netbeans? I have just created a netbeans plugin that can add a node in the services tab in netbeans to manage either Felix or Equinox OSGi runtimes. From this node, you can start, stop OSGi runtime, install and manage(view, start, stop, uninstall) OSGi bundles in  the runtime using its command line interface from the netbeans output window. Of course, this plugin is a preview for the set of Netbeans tools we are  providing for Project Fuji and will be available as part of that project. So, by adding JBI framework bundle and the fuji admin jmx bundle to the OSGi runtime, you can even manage the runtime using it's explorer view and the actions provided on the instance nodes.

When you add the JBI  framework bundle from Project Fuji to the OSGi runtime,  you have Fuji runtime which provides you JBI environment on OSGi platform where you can install/deploy JBI components and service assemblies that constitute your integration application as a set of OSGi bundles.

So, how do you get the Standalone Fuji runtime which is a OSGi runtime(Felix or Equinox) + JBI Framework OSGi bundle? 

Visit this wiki page to know how to get the standalone Fuji runtime.

This wiki page shows how to setup Netbeans to manage standalone Fuji runtime from netbeans.

Watch  this video to see how to use the netbeans plugin to manage the standalone Fuji runtime from netbeans.




Thursday Jul 17, 2008

Apache Camel JBI service engine for OpenESB

camelse
I have  checked in the code for Apache Camel JBI service engine and its Netbeans based tools at OpenESB project. This JBI service engine along with it's Netbeans based tools can be used to develop Apache Camel application in Netbeans IDE and deploy it to the OpenESB to run.  By running  Camel application in the Camel JBI service engine in OpenESB, the Camel application can do message exchange with the JBI service endpoints deployed in other JBI components in the OpenESB.

See this demo video on how to develop and run the Apache Camel application in OpenESB

Visit the project wiki page for more details and download CamelSE service engine and it's netbeans plugin.

Apache Camel is a Spring based integration framework which implements Enterprise Integration Patterns allowing you to configure routing and mediation rules using a Java based Route Builder.  Visit Apache Camel site for more information.

Friday Aug 10, 2007

Updated JBI CDK (JBI Component Development Kit)

Updated JBI CDK (JBI Component Development Kit)
I have updated JBI CDK modules in the latest open-esb installer (https://open-esb.dev.java.net/Downloads_OpenESB_Addons_NB6.html) which now provide both runtime and design time development support for both Binding Components(BC) and Service Engines(SE). There is still some work in progress for JBI CDK to improve the existing features and develop new features to provide more help on the component development process and yes, documentation on how to use these tools will be very helpful :-). I will post videos and documentation on these tools in the near future.

Here is the summary of changes
  • New component code  - The component code generated for BC or SE by the project wizard is now capable of handling the wsdl 1.1 based deployments. The binding code further shows the processing of the wsdl 1.1 extensions using which a binding component can configure the services it provides and consumes. If you go through the code  you will find answers to the following :-)
    • Component lifecycle code
      • How to handle installation lifecycle
      • How to handle component lifecycle
    • WSDL 1.1 based deployment code (service unit mgmt)
      • How to read service definitions from wsdl files
      • How to read service configuration from wsdl extension elements
      • How to use jbi wrapper to wrap wsdl 1.1 messages
      • How to denormalize, normalize  concrete (protocol specific) messages
      • How to handle message exchange events
    • Testing code
      • How to configure Service assembly artifacts ( jbi.xml )
      • How to configure service unit artifacts ( jbi.xml, .wsdl, ...)
      • How to build service units and service assembly
      • How to test the message exchange using external client
  • Added new user library to include wsdl1.6.2 library in the component project for handling wsdl1.1 processing in the component code.
  • Updated the BC design time plugin generation wizard which now generates generates all the necessary artifacts required to represent the BC design time in composite app project, wsdl editor, wsdl wizard and CASA editor.  Note that there is no tool to regenerate these artifacts with extension schema changes and component description changes and developer can manually add these to each artifact. We are planing to provide the tool that can regenerate these artifacts.
    • Netbeans module project artifacts
      • Project meta-data and  module dependencies configuration
      • META-INF/services configuration for lookups
    • CompApp hooks in layer.xml for component configuration.
    • WSDL extension schema configuration
      • Create wsdl extension schema file
    • WSDL wizard artifacts
      • WSDL templates with default extension configuration
    • WSDL editor artifacts
      • layer.xml configuration for wsdl extension elements
      • wsdl extension validator model
  • Added SE design time plugin generation wizard - this wizard generates Netbeans module development project which will have code for jbi module project (netbeans ant based project system) required to participate in the composite application project to create and build the service unit archive file targeted to a service engine. The jbi module project code is a netbeans ant based project in the IDE with the required hooks to participate in the composite application project system. To understand the code one should have  understanding of the Netbeans Ant based project system and how it works in the IDE environment. For more details about the Netbeans Ant based project system see  http://projects.netbeans.org/buildsys/howto.html and http://projects.netbeans.org/buildsys/design.html
         

Friday Apr 20, 2007

Maven Archetypes for JBI Component projects


I have created two maven archetypes for creating maven based projects for developing JBI Components (Service Engines and Binding Components). The maven projects created using these archetypes are complete projects which are ready to build and test ( unit and integration test ) a working JBI Component. The maven project created for the JBI Component will have a maven project metadata (pom.xml), ant build scripts,  sample code that implements either BC or SE,  sample junit test and integration test code. The project can be buildable using maven build lifecycle or ant build lifecycle to completely build and test the component. The sample source code and the source structure for component implementation is same as that explained in the article JBI Examples - Developing JBI Components.

How to create maven project for SE or BC

To create  SE or BC maven projects, "create" goal of the maven archetype plugin should be executed with SE or BC archetypes configuration parameters.  Maven version 2.0.4 or 2.0.5 is required to correctly download the archetype plugin. If you have setup the build environment for open-esb or open-jbi-components projects, you already have the required maven setup. If not, download and install Maven2 version : 2.0.5 from http://maven.apache.org/

 The following configuration parameters effect the code generated in the maven project for SE or BC
  • groupId :  Group id of the new jbi component maven project that you are creating.
  • artifactId: Artifact id of the new project. Its value will be used to create the project directory. This value will be also used as a JBI component name in generated sample code and the jbi installation descriptor for the component.
  • packageName:  A dot separated name for the java package name that will be created under source root and where the component specific classes will be added. It also will be used as  package name for the Component and Bootstrap classes in the installation descriptor. If you omit the packageName, the groupId value will be used as a package name. So, make sure that the group id is a qualified package name if you omit the packageName.
  • version:  Version for your component project. for example, 1.0-SNAPSHOT

Service Engine(SE) archetype command

To create a service engine maven project, use maven-archetype-jbi-se  archetype. The command that creates the service engine project using this archetype is as follows.

Note that all the options to the archetype:create must be specified in a single line.
Service Engine project create command

mvn archetype:create
-DremoteRepositories=http://download.java.net/maven/2/
-DarchetypeGroupId=open.jbi.components.maven.archetype
-DarchetypeArtifactId=maven-archetype-jbi-se
-DarchetypeVersion=0.1
-DgroupId=<your.component.group.id>
-DartifactId=<yourEngineName>
-DpackageName=<your.component.package>
-Dversion=<your project version>


The following is an example of the SE project create command that creates service engine maven project with  jbi component name "my-first-se"  in a directory "my-first-se" and creates a sample code specific to the SE in "com.example.engine" along with other build and test artifacts.

Note that all the options to the archetype:create must be specified in a single line.
Example Service Engine project create command

mvn archetype:create
-DremoteRepositories=http://download.java.net/maven/2/
-DarchetypeGroupId=open.jbi.components.maven.archetype
-DarchetypeArtifactId=maven-archetype-jbi-se
-DarchetypeVersion=0.1
-DgroupId=my.group.id
-DartifactId=my-first-se
-DpackageName=com.example.engine
-Dversion=1.0-test


Binding Component(BC) archetype command

To create a binding component maven project, use maven-archetype-jbi-bc  archetype. The command that creates the binding component project using this archetype is as follows.

Note that all the options to the archetype:create must be specified in a single line.
Binding Component (BC)  project create command

mvn archetype:create
-DremoteRepositories=http://download.java.net/maven/2/
-DarchetypeGroupId=open.jbi.components.maven.archetype
-DarchetypeArtifactId=maven-archetype-jbi-bc
-DarchetypeVersion=0.1
-DgroupId=<your.component.group.id>
-DartifactId=<yourBindingName>
-DpackageName=<your.component.package>
-Dversion=<your project version>


The following is an example of the BC project create command that creates binding component maven project with  jbi component name "my-first-bc"  in a directory "my-first-bc" and creates a sample code specific to the BC in "com.example.binding" along with other build and test artifacts.

Note that all the options to the archetype:create must be specified in a single line.
Example Binding Component project create command

mvn archetype:create
-DremoteRepositories=http://download.java.net/maven/2/
-DarchetypeGroupId=open.jbi.components.maven.archetype
-DarchetypeArtifactId=maven-archetype-jbi-bc
-DarchetypeVersion=0.1
-DgroupId=my.group.id
-DartifactId=my-first-bc
-DpackageName=com.example.binding
-Dversion=1.0-test


How to Build  SE or BC maven project

In the maven project for JBI Component ( BC or SE ), the code generated and the filesystem structure are similar to what is describes in the JBI Examples - Developing JBI Components.  The difference is that the component name and component specific classes are generated according to the project creation settings and a maven project metadata ( pom.xml ) is generated to build the project from maven build environment.

The build lifecycle for  both SE and BC projects are same.  During the build, when a maven build phase is executed, the maven build lifecycle phases call the corresponding ant build script targets ( ant build lifecycle ) where the actual action for compile, package and test the components takes place.

The following maven build lifecycle phases can be executed to perform compile, package, unit testing and integration testing of the component.

build phase
Description
mvn compile Compiles the  component sources
mvn test-compile Compiles test sources and component sources
mvn test Runs junit tests after compiling component sources and test sources.
mvn package Packages compiled component sources into JBI component installation zip archive file. It runs junit tests by executing test phase before packaging.
mvn integration-test Runs integration test after calling package and test phase. The integration test  installs and starts the component, build, deploy and starts test service assembly if needed,  and runs the test client code, then undeploys test service assembly if needed and then uninstalls the component. The results of the test will be in Output.xml in the test results directory.
mvn install Executes all the above phases and then installs the component installer zip archive file to the maven local repository.
mvn clean Cleans the output directories ( build, dist ) and then try to uninstall the component from the server. If uninstall fails, the results are shown, but the build will not fail.

Before building and testing the component from maven do the following
  1. Install glassfish  ( download and install from https://glassfish.dev.java.net/ )
  2. Set the JV_GFBASE environment variable to the glassfish V2 installation root ( e.g. set JV_GFBASE=C:/Sun/glassfish ) .
  3. Edit pom.xml (optional) - only required if the glassfish is not installed with default settings or JV_GFBASE environment variable is not set.
    1. Set the glassfish home :  under <properties> element set glassfish.home property value to the glassfish v2 installation root.
    2. Set the jbi admin settings (optional) :  under <properties> element set jbi.host, jbi.port, jbi.username, jbi.password properties to glassfish admin settings.
  4. Run the glassfish (optional)  only required for the integration-test and install phases of the project builds.
  5. Execute build lifecycle phases using "mvn" command.
Note:  To do the integration-test of the  generated BC project,  a service engine from the generated SE project should be installed and started.  So, before executing the "integration-test" of the generated BC project,  execute the "integration-test" phase of the SE project with "-Dtest.uninstall.skip=true" to not uninstall the SE.

Sample integration testing steps for the SE and BC projects created from the example commands shown above.

asadmin start-domain domain1 - to start the glassfish
cd my-first-se
mvn -Dtest.uninstall.skip=true integration-test
cd my-first-bc
mvn integration-test
mvn clean
cd my-first-se
mvn clean
asadmin stop-domain domain1 - to stop the glassfish

Building project with Apache Ant (Optional)

If you would like to build and test the project using ant outside the maven, do the following setup before using the ant targets directly from ant.
  1. Install glassfish  ( download and install from https://glassfish.dev.java.net/ )
  2. Set the JV_GFBASE environment variable to the glassfish v2 installation root ( e.g. set JV_GFBASE=C:/Sun/glassfish ) .
  3. Edit build.properties file
    1. Set the glassfish home : set glassfish.home property value to the glassfish v2 installation root.
    2. Set the jbi admin settings (optional) :  set jbi.host, jbi.port, jbi.username, jbi.password properties to glassfish admin settings if the glassfish is not installed with default settings.
    3. Set the libs.junit.classpath property to point to the correct location of the junit jar files for junit runtime and junit ant task
  4. Run the glassfish (optional)  only required for the integration-test and install phases of the project builds.
  5. Execute ant targets using  "ant -lib "path/to/junit/jars" <target>" to build and test the component.  -lib option is required as the junit ant task can not load the junit runtime jars from the taskdef classpath if the junit taskdef jar is in the lib directory of the ant home.
the following are the ant targets available for execution

Ant build targets to build project using Apache Ant
cd my-first-se
ant -p
Buildfile: build.xml
This project compile, package and manage JBI Components using Ant and JBI Ant tasks in OpenESB2.0
Main targets:

clean clean up
compile compiles jbi component source
compile-test compile the test source
install compile, package, install and starts the jbi component
integration-test run integration tests on the jbi component
package compile and packages jbi component sources into installer zip archive file
run compile, package and installs the jbi component
show displays runtime state of jbi component info
test run unit tests on the jbi component
uninstall Stop, shuts down and uninstalls the jbi component
Default target: run


Wednesday Apr 11, 2007

JBI Examples - Developing JBI Components

JBI Examples - Developing JBI Components

I have posted an article JBI Examples - Developing JBI Components  on open-esb project web site. This article describes various steps and artifacts involved in developing JBI Components by using examples. It has ant build scripts to build and test components from command line. The build scripts used in these examples does not depend on any IDE.  

If you are interested to use your favorite IDE, an ant based free-form project support for Netbeans IDE and ant based project support for Eclipse IDE is in the examples for your convenience. Watch the videos below to see how you can use the IDE to run the examples.

Running JBI Examples from command line
Running JBI Examples as ant based free-form project in Netbeans IDE
Running JBI Examples as ant based project in Eclipse IDE


If you are looking for more help on developing your JBI Components, check out JBI Component Development tools preview added in Netbeans 6.0 IDE bundled in the OpenESB plus Addons bundle. Get the latest  from downloads  page.  I will write another blog on how to use these tools  to quickly create, modify and test your JBI Components .

Wednesday Mar 07, 2007

How to use JBI Ant tasks in your own Ant environment?

how to use jbi ant tasks in your own ant environment?
asant wrapper in Glassfish V2 with Open ESB 2.0 sets all the environment required for appserver and OpenESB for you to execute OpenESB administrative Ant scripts within the Ant environment configured for Glassfish V2. But, do you know you can also run OpenESB Ant scripts from any Ant environment that you may be using for building and testing your jbi components and service assemblies?. It is not required to use asant wrapper to run OpenESB Ant scripts if you do the required setup in your OpenESB Ant scripts.  The following are few steps that you can add to your Ant scripts which uses jbi ant tasks to run in any Ant environment.

1. Setup classpath required for running jbi ant tasks

OpenESB2.0  jbi ant tasks require sun-appserv-ant.jar and jbi-ant-tasks.jar jar files in Ant classpath to load jbi ant tasks implementation and its dependencies. It is important to use these jar files from the same location where they were installed in GlassFish as these two jar files depend on the other Glassfish/OpenESB  library jar files relative to their installation directory in the Glassfish installation.

You can add the following ant script snippet to your ant script to define jbi ant tasks classpath in glassfish
<!-- set the Glassfish home -->
<property name="glassfish.home" location="D:/Sun/gfv2/glassfish" />
<!-- define the jbi ant tasks classpath path -->
<path id="jbi.ant.tasks.classpath.id">
<pathelement location="${glassfish.home}/lib/sun-appserv-ant.jar"/>
<pathelement location="${glassfish.home}/jbi/lib/jbi-ant-tasks.jar"/>
</path>

2. Load jbi ant task definitions.

jbi-ant-tasks.jar has a antlib xml resource file at com/sun/jbi/ui/ant/antlib.xml that defines jbi ant task definitions. So, in your ant script, you can use this antlib xml file as a resource to load jbi ant tasks implementation. Make sure that you have setup correct jbi ant tasks classpath in the taskdef task to load jbi ant tasks from antlib xml. You can use classpathref attribute in taskdef task to set classpath defined with path id jbi.ant.tasks.classpath.id defined above. Use the following ant script snippet
<!-- Load jbi task definitions -->
<taskdef resource="com/sun/jbi/ui/ant/antlib.xml" classpathref="jbi.ant.tasks.classpath.id"/>

3. Use jbi ant tasks in ant target

After jbi ant tasks are loaded into the Ant environment with the setup mentioned above, you can call any jbi ant task in your ant script target. For example, you can use  the follows Ant script snippet to install and start a jbi component.
<target name="install" >
<!-- Install the component -->
<jbi-install-component host="localhost" port="4848" username="admin" password="adminadmin"
file="/path/to/my-jbi-component.jar"/>
<!-- Start the installed component -->
<jbi-start-component host="localhost" port="4848" username="admin" password="adminadmin"
name="MyJBIComponent" />
</target>

Download and View

I have created a simple build script that uses jbi ant tasks to build and install jbi component to OpenESB. I have used the same build script in a Netbeans or Eclipse based Ant project system to run ant script from Netbeans or Eclipse IDE. You can download JbiBuildProject.zip zip file that has the Project system that works in Netbeans IDE or Eclipse.  Check out this demo video to see the project in action.

Note1: Please set glassfish.home property in JbiBuildProject/build.xml  to your glassfish installation directory before building  JbiBuildProject.
Note2: Please make sure that you have started glassfish before you invoke jbi ant tasks from the ant script.

How to build/run the JbiBuildProject


From Netbeans IDE:

1. install and configure glassfish v2 in Netbeans IDE
2. start the glassfish from the Runtime tab of the Netbeans IDE
3. unzip JbiBuildProject.zip
4. open JbiBuildProject from Open Project action
5. edit build.xml in the JbiBuildProject to set the correct glassfish.home
6. invoke Run Project Action from the Project node of the Jbi Build Project
7. see the output in ant output window
8. check that the MyJBIComponent is shown in the JBI node of the glassfish  from the Runtime Tab of the IDE.

From Eclipse 3.2.1 :

1. install and start glassfish v2 from command line
2. unzip JbiBuildProject.zip
3. open JbiBuildProject by importing the project to your eclipse workspace
4.  edit build.xml in the JbiBuildProject to set the correct glassfish.home
5. run the project from build.xml.

From Command line:

1.  install and start glassfish v2 from command line
2. download the JbiBuildProject.zip
3. unzip JbiBuildProject.zip  to any directory. For example /test
4. cd  /test/JbiBuildProject
5.  edit build.xml to set the correct glassfish.home
6. run ant which picks up the build.xml in the JbiBuildProject directory as its default build script

Here is the build script that is used in the project.

build.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved. -->
<project name="JBI Build Project" default="run" basedir=".">
  <description> This project demonstrates the JBI Ant tasks usage in OpenESB2.0 </description>
  
  <!-- ### Set the Glassfish home ### -->
  <property name="glassfish.home" location="D:/Sun/gfv2/glassfish" />  
  
  <!-- Set global properties for compile and distribution -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist"  location="dist"/>
  
  <target name="-init-jbi-ant-tasks" description="initializes jbi tasks ">
    <available file="${glassfish.home}" property="glassfish.home.exists" />
    <fail unless="glassfish.home.exists"
          message="glassfish.home=${glassfish.home} is not valid. Please set a valid glassfish home." />
    
    <!-- Define the jbi tasks classpath path -->
    <path id="jbi.ant.tasks.classpath.id">
      <pathelement location="${glassfish.home}/lib/sun-appserv-ant.jar"/>
      <pathelement location="${glassfish.home}/jbi/lib/jbi-ant-tasks.jar"/>
    </path>    
    <!-- Load jbi task definitions -->
    <taskdef resource="com/sun/jbi/ui/ant/antlib.xml" classpathref="jbi.ant.tasks.classpath.id"/>   
    
    <!-- JMX Connection properties to use in jbi tasks. -->
    <property name="jbi.host" value="localhost" />
    <property name="jbi.port" value="4848" />            
    <property name="jbi.username" value="admin" />
    <property name="jbi.password" value="adminadmin" />
    
    <!-- component install file and component name properties used in JBI component admin. -->
    <property name="jbi.install.file" location="${dist}/MyJBIComponent.jar" />
    <property name="jbi.component.name" value="MyJBIComponent" />
    
  </target>
  
  <target name="install" depends="-init-jbi-ant-tasks, dist" >
    <!-- Install the component -->
    <jbi-install-component 
      host="${jbi.host}" port="${jbi.port}" username="${jbi.username}" password="${jbi.password}" 
      file="${jbi.install.file}"/>
    <!-- Start the installed component -->
    <jbi-start-component 
      host="${jbi.host}" port="${jbi.port}" username="${jbi.username}" password="${jbi.password}" 
      name="${jbi.component.name}" failOnError="false" />      
  </target>
  
  <target name="uninstall" depends="-init-jbi-ant-tasks, dist" >
    <!-- Stop and shutdown the component before uninstalling -->
    <jbi-stop-component 
      host="${jbi.host}" port="${jbi.port}" username="${jbi.username}" password="${jbi.password}" 
      name="${jbi.component.name}" failOnError="false" />     
    <jbi-shut-down-component 
      host="${jbi.host}" port="${jbi.port}" username="${jbi.username}" password="${jbi.password}" 
      name="${jbi.component.name}" failOnError="false" />     
    <!-- uninstall the component -->
    <jbi-uninstall-component 
      host="${jbi.host}" port="${jbi.port}" username="${jbi.username}" password="${jbi.password}" 
      name="${jbi.component.name}"/>
  </target>    
  
  <target name="list" depends="-init-jbi-ant-tasks" >
    <!-- Shows the jbi component installed with ${jbi.component.name} in the OpenESB runtime -->
    <jbi-list-service-engines 
      host="${jbi.host}" port="${jbi.port}" username="${jbi.username}" password="${jbi.password}" 
      serviceEngineName="${jbi.component.name}" />
    <!-- use this if the component you installed is of type binding-component
    <jbi-list-binding-components 
      host="${jbi.host}" port="${jbi.port}" username="${jbi.username}" password="${jbi.password}" 
      bindingComponentName="${jbi.component.name}" />
    -->
  </target>
  
  <target name="init" depends="-init-jbi-ant-tasks">
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
  </target>
  
  <target name="compile" depends="init"  description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}" classpath="${glassfish.home}/jbi/lib/jbi.jar"/>
    <copy todir="${build}">  <!-- copy resources from ${src} -->
      <fileset dir="${src}" excludes="\*\*/\*.java"/>
    </copy>
  </target>
  
  <target name="dist" depends="compile" description="generate the jbi component zip file" >
    <!-- Create the distribution directory and -->
    <mkdir dir="${dist}"/>
    <!-- Put everything in ${build} into the ${jbi.install.file} file -->
    <jar jarfile="${jbi.install.file}" basedir="${build}"/>
  </target>  
  
  <target name="clean" description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>  
  
  <target name="run" depends="install, list" />
  
</project>




Tuesday Feb 27, 2007

JBI ant tasks in OpenESB 2.0 Beta - What is New

what's new in jbi ant tasks in OpenESB 2.0 Beta
JBI 1.0  Specification ( jsr 208, section 6.10 ) defines set of Ant tasks that can be used to manage JBI runtime from Apache Ant scripting environment. In addition to implementing all the JBI Ant tasks and their attributes defined in the JBI 1.0 specification, OpenESB 2.0 has added few new features to the JBI Ant tasks for managing the JBI artifacts in a multi-instance or clustered environment. The Beta branch builds of the GlassFish V2 with the OpenESB 2.0 Beta are available at https://glassfish.dev.java.net/public/downloadsindex.html#GlassFish_v2_Beta_branch .

The documenation on JBI Ant tasks in OpenESB 2.0 is available online at http://www.glassfishwiki.org/jbiwiki/Wiki.jsp?page=JBIAntTaskReference

The following are the new features or modified functionality that has been added to the JBI Ant tasks in OpenESB in Glassfish V2. Note that these new features have default settings so that any Ant script that use just the JBI Ant tasks and their attributes defined in JBI 1.0 specification will work without modification.

1. "target" attribute

Since OpenESB in GlassFish V2 supports multi-instance or clustered environment where a OpenESB runtime will be started in each standalone  instance or  clustered  instances of the appserver, a new attribute "target" has been added to all the JBI Ant tasks to manage JBI management operations targeted per instance or cluster. 

2. "force" attribute

"force" attribute that has been added tells the OpenESB runtime to perform the management task forcefully under normal or error conditions.  The following are the Ant tasks that have been modified for this feature.

    jbi-shut-down-component  - forcefully shuts down the component when force=true
    jbi-uninstall-component  -  forcefully uninstalls the component when force=true
    jbi-shut-down-service-assembly -  forcefully shuts down the service assembly when force=true
    jbi-undeploy-service-assembly -  forcefully undeploys service assembly when force=true
  
3. "name" attribute on install/deploy tasks  ( install/deploy from repository )

When dealing with multi-instance and multi cluster scenarios, you may want to reconfigure your multi-instance OpenESB runtime to add/remove components or service assemblies to/from a particular instance or cluster. In this case, when you already have  component/service-assembly installed/deployed to "domain", you can install/deploy that component/service-assembly using it's name to other instances or clusters in the system without again passing the component/service-assembly archive file. 

"name" attribute that has been added on the install/deploy tasks can be used to install/deploy component/service-assembly from the domain repository to other instances or clusters in the system. The tasks that have been modified for this feature are

    jbi-install-shared-library
    jbi-install-component
    jbi-deploy-service-assembly

4. "keepArchive" attribute

"keepArchive" attribute has been added to uninstall/undeploy tasks to tell the OpenESB runtime to keep the component/service-assembly in the domain repository even when the component/service-assembly is uninstalled/undeployed from all the instances and clusters in the system.  Keeping the component/service-assembly in the domain repository will be useful when you want to install/deploy the component/service-assembly to old/new instances or clusters  just by name ( install/deploy from repository ).  By default, OpenESB runtime removes the component/service-assembly from the system including from the repository when component/service-assembly is uninstalled/undeployed from all the instances and clusters in the system. The tasks that have been modified for this feature are

    jbi-uninstall-shared-library
    jbi-uninstall-component
    jbi-undeploy-service-assembly

5. JMX Connection settings on the JBI Ant tasks

Since we have tightly integrated the OpenESB into GlassFish V2, the JBI Ant tasks now support jmx over HTTP/HTTPS ( proprietary implementation of JSR 160 over HTTP/S in GlassFish ) in addition to supporting the JMX over RMI/JRMP.  The HTTP/S port used for the jmx connection is same as the GlassFish administrative port. So, now you can use same port for OpenESB administration and GlassFish administration from the Ant environment.

5.1 "secure" attribute
the value of the secure attribute tell the JBI Ant task to get the jmx connection over HTTP/HTTPS.  If the GlassFish uses HTTPS port for its administration, then use that port along with setting the "secure" attribute to "true" in order to connect the jmx server over HTTPS.  If the secure attribute is not set (default), JBI Ant tasks try to acquire a jmx connection over HTTP, HTTPS or RMI/JRMP in that order.

5.2 "passwordfile" attribute
Now you can also set the  JMX connection password of the JBI Ant tasks using a password file. The file should be of the Java Properties file format and should contains the property "AS_ADMIN_PASSWORD", the value of which is set as a password for the JMX connection for the JBI Ant tasks.

6. ASANT setup for OpenESB in GlassFish V2

Asant is a wrapper to the Apache Ant installed in GlassFish. It sets up the classpath and the other environment variables required to run the appserver Ant tasks in Ant environment. This setup has been modified in two places to run the Ant scripts that use JBI Ant tasks using Asant.

6.1. JBI Ant tasks classpath setup
Ant environment classpath set in the Asant wrapper has been modified to include the JBI Ant tasks implementation jar files in the classpath so that the JBI Ant tasks implementation is directly available to the Ant scripts executed using Asant. 

6.2. JBI Ant task definitions setup 
JBI Ant task definitions are included in the default Ant task definitions under Asant setup to make the jbi ant tasks available as default Ant tasks in an ant environment. With this, Ant scripts that run under Asant environment need not include the jbi ant task definitions in order to use the jbi ant tasks.

7. jbi_admin.xml - a custom Ant script

jbi_admin.xml is a custom Ant script that defines a set of targets that  perform the JBI management tasks using the JBI Ant tasks. Users can directly use this Ant script and call appropriate Ant target to perform the JBI administration after setting the required Ant properties via -D option or by -propertyfile option. jbi_admin.xml is located at $AS_INSTALL/JBI/bin  where $AS_INSTALL is the glassfish install root. 

Example usage of this script to install a component is ( assuming default  jmx connection settings )

$AS_INSTALL/bin/asant -f $AS_INSTALL/jbi/bin/jbi_admin.xml  -Djbi.install.file=/my/dir/my-component.zip  install-component

Documentation and other information

The JBI Ant tasks documentation is available under glassfish installation at $AS_INSTALL/jbi/doc/antdoc in the following two zip files

jbi-ant-tasks-reference.zip
jbi-ant-targets-reference.zip

You can also browse the documentation online at JBI Wiki

http://www.glassfishwiki.org/jbiwiki/Wiki.jsp?page=JBIAntTaskReference
http://www.glassfishwiki.org/jbiwiki/Wiki.jsp?page=JBIAdminAntTargetReference

For more information on OpenESB in GlassFish V2 visit 

JBI Wiki ( http://www.glassfishwiki.org/jbiwiki/Wiki.jsp?page=GlassfishJbiIntegration )
OpenESB project at Java.net ( https://open-esb.dev.java.net/ )

About

schikkala

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today