Just in case anyone was wondering....
I came across this article today which discusses integrating XMPP presence in J2EE, and as I am reading the whole time I'm thinking I could do this with JBI utilizing the XMPP Binding Component and the JMS Binding Component. Leveraging the BPEL Service Engine I could easily orchestrate everything and not have to write any code, just create a composite application and deploy it to my JBI Container (e.g. OpenESB) and I'm golden. The XMPP BC would handle receiving the presence notifications and utilizing BPEL we could pass that along to the JMS BC to be published to the topic or queue.
I get the feeling that most developers feel the need to always write code to come up with solutions to their problems, when in all actuality there might be a solution to your problem already. I have said it 100 times myself, "I'm not happy unless I'm in my IDE coding away".
So my last thought....
Before you get knee deep in code (I know it's fun), check out some of the components that are available and see how you can use JBI to integrate solutions for your problems. Remember the "I" in JBI is for Integration.
Tuesday, September 25, 2007
The "I" in JBI is for Integration
Posted by
Chad Gallemore
at
10:25:00 PM
0
comments
Labels: Integration, J2EE, JBI
Wednesday, August 22, 2007
Bridging the Gap - XMPP to SIP Group Chat
As noted in one of my earlier blogs, we have been enhancing the XMPP BC to be able to participate in Group Chat Sessions. During this process we thought we would also show how you can utilize JBI to be a convergent platform and bridge gaps across protocols. To do this, we thought we would show how a SIP User Agent (e.g. an xlite soft phone) could participate in an XMPP Group Chat session. Brian O'Neill's blog talks a little more about utilizing JBI as a convergent communication platform, and provides a use case here.
Enough with the fluff, on with the demo. I've uploaded the Netbeans Projects here that I will be discussing in this blog so you don’t have to create them from scratch. Below is a list of prerequisetes in order to run the demo:
- You will need to get the latest OpenESB installer
o This comes with Netbeans, Glassfish, and the JBI Components you will need to run the demo.
- Set up an Openfire XMPP Server
o You can go here for a demo on how to setup Openfire
o You will need to get an XMPP client (e.g. Spark or Pidgin)
§ You can go here to see a demo of how to setup Spark
§ You will need to create one user in Openfire with the username sipua and password sipua (This is defined in the XMPP WSLDs
- Set up a SIP User Agent/SIP Server
o We used XLite for the demo, but you should be able to utilize just about any SIP UA and SIP Server.
o Login as a user (e.g. chad)
- Edit the XMPP WSDL
o Edit all xmpp WSDLs to reflect the correct domain (the domain of your Openfire server) and the correct groupChat name (e.g. A@conference.OpenFireDomain). Both attributes can be found in the xmpp:address section of the WSDL.
- Edit the SIP WSDL
o Edit all sip WSDLs to reflect the correct proxyDomain (sip:address section of the wsdl) (the domain of your SIP server)
- Edit the BPEL Process
o Click on Assign3 and edit the String A@conference.b-0498.int.gestalt-llc.com to be the groupChat name you defined in your XMPP WSDL’s earlier.
o Click on Assign1 and edit the String chad@10.9.5.62 to be whatever user you are logged in as (e.g. mySipUserAgent@mySipServerDomain).
You should be all set now. You will need to recompile the Composite Application by right clicking (in Netbeans) on SIPAndXMPPCA module and selecting “Clean and Build”. You are now ready to deploy your application. Follow the following steps to deploy and run the test.
- Start Glassfish
o In Netbeans Click Window à Services à Servers à Right click on Sun Java Application Server à Click Start.
- Start Openfire
o With an XMPP client (e.g. Spark or Pidgin (or Both)) log in, you may have to create an account first.
- Start SIP Server and SIP User Agent
o Using a SIP UA (e.g. XLite) log in as the user you defined in the Bpel Process above (e.g. chad@10.9.5.65).
- Ensure JBI Components are installed and started
o In Netbeans navigate to Window à Services à Sun Java System Application Server 9 à JBI
§ Under Service Engines verify the following Component is installed and started
· sun-bpel-engine
§ Under Binding Components verify the following Component is installed and started
· gestalt-sip-binding
· gestalt-xmpp-binding (uninstall this component by right clicking on the component and selecting "uninstall". We need to ensure you have the latest XMPP BC, you can find it here. Download the xmppbc.jar and install it by righ clicking on Binding Components and selecting Install New Binding Component. After Installation, make sure you start the XMPP BC (Right click and select Start).
o If the components are not there, you can download them here.
- Deploy the SIPAndXMPPCA by right clicking on the project and selecting “Deploy Project”
- Once deployed, you should be able to use your Spark or Pidgin clients and join the Conference room that was created (e.g. A). You should see yourself in the room as well as the user sipua. You can now send a message to the group and your SIP UA will receive the message. Have your SIP UA respond and see the message appear in the Group Chat.
So a quick recap of what we accomplished. First, we were able to create an application that could bridge two protocols that normally couldn’t speak to each other (See screenshot below). Second, we did this without writing one line of code. Yes, you read that correct. To do this application from scratch all you have to do is configure it, and then tell BPEL how to orchestrate it. Netbeans provides a nice way to do this with their toolkit support (automatically generating WSDL’s and leveraging the design view for the BPEL process to drag and drop activities on the screen)

If you have any questions feel free to shoot us an email by using our mailing lists (
Posted by
Chad Gallemore
at
1:11:00 PM
0
comments
Labels: Convergence, JBI, SIP BC, XMPP, XMPP BC
Tuesday, August 14, 2007
New Enhancements for the XMPP Binding Component
We have some new enhancements for the XMPP Binding Component coming down the pipe this month. Already in place is the ability to join, leave, and send messages to group chats. You can join a group chat upon deployment or you can dynamically join/leave groups at runtime. Also in the works for this month are enhancing the XMPP BC to handle complex types. You can view the documentation for the WSDL Extensions here.
Posted by
Chad Gallemore
at
9:53:00 PM
0
comments
Monday, July 30, 2007
Utilizing Installation Descriptor Extensions in JBI
JBI provides a means to add extensions to your Installation Descriptor (jbi.xml). These extensions can be used for a variety of different things, like configuration for your component. Working examples of components utilizing this feature check out the OpenESB HTTP Binding Component or ServiceMix HTTP Binding Component . Recently I needed to use this feature to add some configuration type attributes to the component we were developing. The first thing you will need to do is add the extensions to your installation descriptor. As noted in the API, the Installation Descriptor Extensions are located at the end of the <component> element of the installation descriptor, something like the following:
<component>
....
The rest of the jbi.xml
....
<config:Configuration>
<config:Port>8888</config:Port>
<config:Location>localhost</config:Location>
</config:Configuration>
</component>
During bootstrap init() the InstallationContext is passed in, this object gives you access to the Installation Descriptor Extensions, via installationContext.getInstallationDescriptorExtensions (Which returns a DocumentFramgment containing all Extensions). At this time you need to store the values in an object so that you can access them during the Components init(). The best way to achieve this is to use JMX. So the first thing you will need to do is Create an Interface that defines your MBean, and then create your class that will implement that interface. Something like the following:
public interface ConfigExtensionsMBean {
public void parseConfigExtensions(DocumentFragment documentFragment);
public String getLocation();
public int getPort();
}
Now we need to write our concrete class that implements this interface, something like the following:
public class ConfigExtensions implements ConfigExtensionsMBean {
private int port;
private String location;
public enum Attributes {Location, Port};
public String getLocation() {
return location;
}
private void setLocation(String location) {
this.location = location;
}
public int getPort() {
return port;
}
private void setPort(String port) {
this.port = new Integer(port);
}
public void parseConfigExtensions(DocumentFragment frag) {
//Parse the DocFrag here and call the setters for the port and location.
}
}
So now we have the Interface and the Concrete class, we just have to use it now. So the first thing we need to do is in your Bootstrap classes init() method we need to get the Installations Service Description Extensions and create our MBean and register that MBean in our MBean server, this should look something like the following:
public void init(InstallationContext context) {
ConfigExtensionsMBean mBean = new ConfigExtensions();
DocumentFragment doc = context.getInstallationDescriptorExtension();
mBean.parseConfigExtensions(doc);
MBeanServer mBeanServer = context.getContext().getMBeanServer();
ObjectName mBeanName = context.getContext().getMBeanNames().createCustomComponentMBeanName("MyMBean");
try {
if (!mBeanServer.isRegistered(mBeanName) {
ObjectInstance oi = mBeanServer.registerMBean(mBean, mBeanName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
So what we just did was read the extensions, parse them and call the setters, and registered the mBean for future use. So now our new component is ready to be initialized and needs access to that mBean. The following is how you can access them during ComponentLifeCycle.init(ComponentContext context):
public void init(ComponentContext context) {
MBeanServer mBeanServer = context.getMBeanServer();
ObjectName mBeanName = context.getMBeanNames()
.createCustomComponentMBeanName("MyMBean");
try {
host = (String) mBeanServer.getAttribute(mBeanName,
ConfigExtensions.Attributes.Location.toString());
port = (Integer) mBeanServer.getAttribute(mBeanName,
ConfigExtensions.Attributes.Port.toString());
} catch (Exception e) {
log.warning("Exception getting mBean Attributes: " + e);
e.printStackTrace();
}
}
So, there you have it, an example of how to utilize the Installation Descriptor Extensions from your jbi.xml.
Posted by
Chad Gallemore
at
12:33:00 PM
0
comments
Thursday, July 5, 2007
New Enhancements for the RSS Binding Component
We have recently added some new enhancements to the RSS Binding Component. We now provide support for subscribing and receiving notifications from secure feeds that use Basic Authentication, and the ability to subscribe to multiple feeds at the same time during runtime. Be sure to check out the RSS WSDL Extensiblity elements for definitions on how to create the WSDL. If you have any questions feel free to contact me or use the mailing list from the project site.
Posted by
Chad Gallemore
at
11:39:00 AM
0
comments
Tuesday, June 12, 2007
Your One Stop Shop for JBI Components
Are you in the need for a certain JBI Component, but don't know where to download it at? Here is a great place to download the binaries for the component you need. Don't forget to check out the wiki for demo's and descriptions of the components.
Posted by
Chad Gallemore
at
3:04:00 PM
0
comments
Labels: Binding Components, JBI
Monday, June 11, 2007
XMPP to RSS Demonstration
As noted in my last blog, I have been working on some open source binding components. We recently finished the RSS Binding Component and I wanted to get one of the demonstrations we did out here as an example of how you can use JBI to tie multiple protocols together that would normally be somewhat difficult to do. So in this demonstration I use the XMPP BC to send instant messages, and take that message and publish it as an RSS Feed. You can download the Netbeans project here. Prerequistes to build this application are as follows:
OpenESB Installer this comes with Netbeans, Glassfish with JBI Runtime, and JBI Components
Wildfire XMPP Server: for instructions on how to set up go here.
Spark XMPP IM Client: For instruction on how to set up go here.
XMPP Binding Component installed
RSS Binding Component installed
File Binding Component installed
BPEL Service Engine Installed
All of the Binding Components and the Service Engines come with the OpenESB installer. If you happen to be missing one you can find and download the component you need from here.
You will want to edit the WSDL's to fit your needs. First look at the fileWsdl.wsdl. You will notice that in the address section (file:address) you will be writting a file to you User Home/mag16AOC directory. You can edit this if you wish, and write the file where ever. Next look at the message (file:message) section of the WSDL and notice the file will be called mission100.xml. You can re-name the file if you wish.
Next look at the rssPublish wsdl, you will want to edit the feedUrl in the rss:address section to be specific to your machine (i.e. http://localhost:64801/feed/mag-16_aoc/mission_100). What this means is once you deploy this application and start sending instant messages, the messages will be published to the above link and you can view them using an RSS Reader (i.e. RSSOwl), or you can navigate to that link in a web page and view it there. Next look at the rssSubscribe wsdl. You will want to edit the rss:address section to be the same feedUrl you used above. What this does is subscribes to this feed and every time there is a new post you will get notified and the entry will be written to the file we described above.
Finally lets take a look at the xmppWsdl. You will need to edit the xmpp:address section to update the domain (i.e. localhost).
You can now clean and build the module in netbeans by right clicking on the project and selecting clean and build. With a successfull build you will want to right click on the XMPPtoRSSDemoCompApp and clean and build that. You are now almost ready to deploy these and test. You will first need to create a user for your spark client (This is assuming you have followed the instructions on how to setup Spark and Wildfire). Make sure you Wildfire server is running and start your Spark client. You will need to select "Accounts" and create a new user (i.e. bob, server is localhost). Once logged in you will want to pull up your Wildfire server Admin page and add a user. This user must be the same that is defined in the xmppWsdl (i.e. username = mag-16_aoc, passworkd mag-16_aoc), once this user is created you will want to add him as a contact in your buddy list for your Spark client. You are now ready to deploy and test.
Start the server in Netbeans ( Window --> Runtime --> Servers --> Right Click on Sun Java System Application Server 9 and select Start). Once the server is running you will see a Tab that says JBI, expand that and verify that under Binding Components you see the RSS Binding Component, XMPP Binding Component, File Binding Component, and under Service Engines verify you see BPEL SE. If those are in place you are ready to deploy your Composite Application. Right Click on the XMPPtoRSSDemoCompApp and select Deploy. Once successful you will see the buddy you added in your Spark client (mag-16_aoc) come online (i.e. turn green). You are now ready to send instant messages and have those messages published to an RSS Feed. Send a couple of messages and then navigate to the feedUrl you defined and verify the feed is being published. You can also verify your subscribe is working by navigating to the file and verifying that the file is being written to the location described in your fileWsdl.
So in short what we have done using JBI is the capability to "mash" two protocols together that could normally not happen, at least easily. This is a great example of how to take simple IM client and disseminate information to a large group of people. If you have any questions feel free to email me or use the mailing list on our project site for the RSS BC or XMPP BC
Posted by
Chad Gallemore
at
2:28:00 PM
0
comments
Wednesday, June 6, 2007
New RSS Binding Component on java.net
As I have noted in some of my other blogs, I have been fortunate enough to be working on a team lately that has been developing and open sourcing some JBI components to java.net. This last month we developed a RSS Binding Component that is now available for download and use. Feel free to check it out and feel free to let us know what you think or if you have any questions. You can contact us at the following email address:
dev@rss-bc.java.net
Also, feel free to check out our other Binding Components, XMPP, SIP, and UDDI, that we developed a couple of months ago. For questions about these components you can contact us at the following:
dev@uddi-bc.java.net
dev@xmpp-bc.java.net
dev@sip-bc.java.net
The project sites contain documentation on how to use the components as well as demonstration videos that will walk you through creating a component application. For a complete list of binding components available see the JBI Components WIKI
Posted by
Chad Gallemore
at
12:30:00 PM
0
comments
Thursday, May 10, 2007
Creating a Binding Component Deployment Plug-In for Netbeans
Recently I have had the pleasure of working on a team developing and open sourcing to java.net some binding components for JBI. One of the tasks we had to complete was integrating our binding components into netbeans. One of the things netbeans provides is a WSDL wizard, so when you are creating new modules the wizard lets you select the type of binding you will be using, and based off that binding will give you a base template of your wsdl with some default values of attributes you need to provide. When I first started I had no idea on how to create a plug in for netbeans. So, this will cover how to create a Binding Component Deployment Plugin. The first thing you will need to get is the
OpenESB installer for netbeans.
- Select File --> New Project
- Under Categories select --> JBI Components
- Under Projects select --> Binding Component Deployment Plugin and click next
- Name your plugin (i.e. NewBCPlugin)
- define your source package (i.e. com.company.netbeans.modules.wsdlextensions.newbc)
- Define your component Name (i.e. newbc).
- Edit your WSDL Extension
- Define your Namespace (i.e. http://schemas.company.com/jbi/wsdl-extensions/newbc/)
- Define your prefix (i.e. newbc)
- And click Finish
Once that is finished you will have a Source Packages directory, and under there you will have two packages something like the following:
- com.company.netbeans.modules.wsdlextensions.newbc
- Bundle.properties
- layer.xml
- newbcWsdlExt.xsd
- com.company.netbeans.modules.wsdlextensions.newbc.resources
You will need to edit the layer.xml file. You will need to update the last section to be something like this.
That should be a good starting point for you on that package. Next we will neeed to create a new package called com.company.netbeans.modules.wsdlextensions.newbc.template,and create the following files under that package:
- Bundle.properties
NewBCTemplateProvider.java
template.xml
NewBCTransport=NewBC Transport
NewBCMessage=NewBC Message
http_//schemas.company.com/jbi/wsdl-extensions/newbc/=NewBC
TEMPLATEGROUP_name=NewBC
TEMPLATEGROUP_prefix_newbc=newbc
TEMPLATE_name_NewBCTransport=NewBC TransportNext we are going to edit the NewBCTemplateProvider.java, this class is pretty straight forward and should look like the following:
package com.company.netbeans.modules.wsdlextensions.newbc.template;
import java.io.InputStream;
import org.netbeans.modules.xml.wsdl.ui.
spi.ExtensibilityElementTemplateProvider;
import org.openide.util.NbBundle;
public class NewBCTemplateProvider
extends ExtensibilityElementTemplateProvider {
static final String templateUrl =
"/com/company/netbeans/modules/wsdlextensions/newbc
/template/template.xml";
public InputStream getTemplateInputStream() {
return NewBCTemplateProvider.class
.getResourceAsStream(templateUrl);
}
public String
getLocalizedMessage(String str, Object[] objects) {
return NbBundle.getMessage
(NewBCTemplateProvider.class, str, objects);
}
}
For this code to compile you will have to update your libraries by doing the following:
- Right click on your project --> Properties
- Select Libraries
- Add the following libraries
- WSDL UI (You will need to edit this library and select use Implementation Version)
- Utilities API
- WSDL UI (You will need to edit this library and select use Implementation Version)
Next we will look at creating the template.xml; this is the file where you add any attribute that is defined in your NewBCExt.xsd to include default vaules. Once this plugin
is installed these default values show up as properties in the WSDL Editor. Your template.xml should look something like this.
Finally you well need to add META-INF/services directory which should be located under your src directory (newbc/src/META-INF/services). This should contain a file called
org.netbeans.modules.xml.wsdl.ui.spi.
ExtensibilityElementTemplateProvider
and it should say the following:
com.gestalt.netbeans.modules.wsdlextensions.newbc.
template.NewBCTemplateProvider
Now you are at a point you can test the plugin. You will need to right click on the project and perform a clean and build. Next you will need to test, right click the project and select "Install in Target Platform". This will start a new instance of Netbeans with your plugin installed. Once it is started create a new project and under Service Oriented Archietecture select BPEL Module. Once the project is created right click on Process Files and select create new WSDL Document. Click next through the Wizard until you get to selecting the type of binding. Here you will want to select the drop down box called Binding Type and select your new plugin (If it isn't showing up in the list there is something missing).
Posted by
Chad Gallemore
at
9:28:00 PM
1 comments
Labels: Binding Component Plugin, JBI, Netbeans
