Technology

You are currently browsing the archive for the Technology category.

The new router/Access Point from Asus, the WL-500g Premium is packing a load of interesting features, like :

  • Two USB ports to connect web cams, or hard drives
  • apparently, based on Linux
  • with a download manager which uses the hard drive to take care of your FTP, HTTP or BitTorrent downloads without the help of a computer.
  • Class of services for HTTP, FTP, and BitTorrent

Along with the regular features, it seems a very cool gadget.

You may not know, but all MacBook Pro have a motion sensor that is used to save your hard drive in case of a fall. It seems that it can be used also :

Very cool. Any other usage I might have missed ?

The next step after playing with the openESB platform in a previous blog entry, more as a user, and look at what it takes to develop a service engine.
I found on the web a tutorial on writing a service engine for ObjectWeb’s Petals.
They give a pre-packaged Hello World service engine.
I tried to install it on top of the openESB starter kit.
It’s quite simple :

  • in the Runtime panel, expand the Sun Java System Application Server node, then the JBI node.
  • right click on the Service Engines node, select Install “New Service Engine”
  • point to the .zip file, and you are done.

Here is the result :

esb-petal

Next step is to understand how to activate the Service Engine, and extend it.

The goal was to put together the following technology components :

  • Java EE 5
  • Netbeans 5.5
  • Open ESB starter Kit Beta

The first step is to acquire the bundle here and follow the instructions on this tutorial to create a web service.

The code for my web service is:

/*
 * passThrough.java
 *
 * Created on May 24, 2006, 8:49 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
 
package org.me.nullOpe;
 
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
 
/**
 *
 * @author jc
 */
@WebService()
public class passThrough {
 
    /**
     * Web service operation
     */
    @WebMethod
    public String echo(@WebParam(name = "input") String input) {
        // TODO implement operation
        System.out.println("---"+input+"+++");
        return input;
    }
}

When this is done, and the service is deployed, right click on the Web Services node in your project to access the menu option “Test Web Service”. The Tester page should open. Note the link to the WSDL file on that page.
(If you are lost, see the Deploying and Testing the Web Service in the above mentioned tutorial

Now, lets create a BPEL workflow to invoke this service. More information on the JBI/Open ESB component of the tool bundle can be found on the Java Technology and Business Integration Services page

The first step is to create an SOA project:

  • File -> New Project
  • Choose Project->Samples->Service Oriented Architecture->Synchronous BPEL Process
  • Next->Give a name to your project -> Finish

At this point, you should have two new nodes created in your Projects navigation panel. One for the BPEL Module, and one for the Composite Application. In order to continue, you have to add the BPEL Module to the composite application by right clicking on your Composite Application node, select “Add JBI Module”, and navigate to your BPEL module jar file. You should now have a BPEL process that you can deploy and test.

More information can be found in the Netbeans Enterprise Pack 5.5 tutorial : A Simple Synchronous BPEL Process

Below are steps that are not found in the previous tutorials, and are the basic steps required to invoke web services from the BPEL process. This might not be the best way to do it, I tried to figure this by myself, and it seems to work in this simple case

The first set of steps is to import the WSDL document in the BPEL project :

  • right click on the Source Package node of your BPEL application
  • New -> Retrieve Schema and WSDL documents
  • Select URL resource in the Location Type
  • in the URL file, paste the WSDL link from your Tester session in the development of the web service, and finish

At this point, you should have two new nodes added under Source Packages . One for the WSDL, and one for the Schema. These documents were generated by JAX-WS when the service was deployed.

The next set of steps are adding a PartnerLinkType to the wsdl document. This is required by the BPEL specification, and will allow you to use this wsdl in the BPEL process as a partnerLink:

  • double click on the wsdl document imported during the last step. you should see a design window allowing you to edit the wsdl document
  • right click on the top level object and select “Add Extension Element” -> “BPEL
    “. You should have a new node created with this label {http://schemas.xmlsoap.org/ws/2004/03/partner-link}partnerLinkType
  • expand this node and edit the name (you need to have the property palette displayed to see on the right side the attribute to change
  • expand the contained node with the label {http://schemas.xmlsoap.org/ws/2004/03/partner-link}role
  • select the portType and enter a name for the provider role in the properties panel.

At this point, if you switch to the source view, you should have something like this added to your wsdl document :

    <plink:partnerLinkType name="nullOpe">
        <plink:role name="nullOpeProvider" portType="tns:passThrough"/>
    </plink:partnerLinkType>

The next set of steps is adding this partnerLink to the process, and invoke it :

  • double click on your bpel file in your Source Packages in order to use the BPEL designer
  • delete the original assign from the SynchronousSample flow
  • select the wsdl file you edited previously in the Projects navigation, and drag ad drop that file in the BPEL designer. Select the Partner Role to be your provider role, click ok.This will create the partnerLink in the designer
  • drag and drop the invoke icon from the palette between the start and end in your flow (in one of the appearing target).
  • right click on the just created invoke object, and select Edit. Select your newly added partnerLink, the operation should be filled, create variables for input and output by accepting the defaults. Click OK. You should now see that your invloke method is connected to the method exposed by your web service.

The next set of steps will connect the input of the BPEL process to the invoke step, and the output of the invoke step to the output of the process:

  • drag and drop an assign step from the basic activities on the target just above your invoke.
  • select the assign step, and you should see a mapper panel below the BPEL designer. (see the BPEL tutorial above for how to use it) connect the inputVar/inputType/paramA to the parameter in your web service input message
  • drag and drop an assign step from the basic activities on the target just below your invoke.
  • connect the parameter in your web service output message to the outputVar/inputType/paramA

The source view of the BPEL process should look like:

<?xml version="1.0" encoding="UTF-8"?>
<process 
    name="SynchronousSample" 
    targetNamespace="http://www.mycomp.org/SynchronousSample"
    xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
    xmlns:wsdlNS="http://www.mycomp.org/SynchronousSample"
    xmlns:xs="http://www.mycomp.org/SynchronousSampleSchemaNamespace" xmlns:ns1="http://nullOpe.me.org/">
 
  <import namespace="http://www.mycomp.org/SynchronousSample" location="SynchronousSample.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
    <import namespace="http://nullOpe.me.org/" location="localhost_8080/nullOpe/passThroughService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
    <partnerLinks>
        <partnerLink name="passThroughService" partnerLinkType="ns1:nullOpe" partnerRole="nullOpeProvider"/>
        <partnerLink name="partnerLinkA" 
         partnerLinkType="wsdlNS:SynchronousSamplePartnerLinkType" 
         myRole="SynchronousSampleProvider" />
   </partnerLinks>
   <variables>
      <variable name="EchoOut1" messageType="ns1:echoResponse"/>
      <variable name="EchoIn1" messageType="ns1:echo"/>
      <variable name="inputVar" messageType="wsdlNS:requestMessage"/>
     <variable name="outputVar" messageType="wsdlNS:responseMessage"/>
   </variables>
   <receive
          name="start"
          partnerLink="partnerLinkA"
          portType="wsdlNS:MyPortType"
          operation="operationA"
          variable="inputVar"
          createInstance="yes"/>
      <assign name="Assign1">
         <copy>
         <from>$inputVar.inputType/paramA</from><to>$EchoIn1.parameters/input</to>
         </copy>
      </assign>
      <invoke name="Invoke1" partnerLink="passThroughService" operation="echo" portType="ns1:passThrough" inputVariable="EchoIn1" outputVariable="EchoOut1"/>
      <assign name="Assign2">
         <copy>
         <from>$EchoOut1.parameters/return</from><to>$outputVar.resultType/paramA</to>
         </copy>
      </assign>
      <reply name="end"  
              partnerLink="partnerLinkA"
              portType="wsdlNS:MyPortType" 
              operation="operationA"
              variable="outputVar"/>
   </sequence>
</process>
 
 
   <sequence>

the resulting workflow would look like this :

bpel

 

This is it. You should be able to deploy the updated project, and test it (remove the content of the output.xml to check the output).

The file provided on the Exim web site seems a bit too simplistic.
An alternative version (under CDDL 1.0) can be downloaded here

<?xml version="1.0"?>
<!--
CDDL HEADER START
 
The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.
 
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.
 
When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]
 
CDDL HEADER END
-->
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='Local:exim'>
<service
	name='network/smtp'
	type='service'
	version='1'>
	<single_instance />
	<dependency
	    name='fs-local'
	    grouping='require_all'
	    restart_on='none'
	    type='service'>
		<service_fmri value='svc:/system/filesystem/local' />
	</dependency>
	<dependency
	    name='network-service'
	    grouping='require_all'
	    restart_on='none'
	    type='service'>
		<service_fmri value='svc:/network/service' />
	</dependency>
	<dependency
	    name='name-services'
	    grouping='require_all'
	    restart_on='refresh'
	    type='service'>
		<service_fmri value='svc:/milestone/name-services' />
	</dependency>
	<dependency
	    name='identity'
	    grouping='optional_all'
	    restart_on='refresh'
	    type='service'>
		<service_fmri value='svc:/system/identity:domain' />
	</dependency>
	<dependency
	    name='system-log'
	    grouping='optional_all'
	    restart_on='none'
	    type='service'>
		<service_fmri value='svc:/system/system-log' />
	</dependency>
	<instance name='exim' enabled='false'>
		<dependency
		    name='config-file'
		    grouping='require_all'
		    restart_on='refresh'
		    type='path'>
			<service_fmri
			    value='file://localhost/usr/local/exim/configure' />
		</dependency>
		<dependency
		    name='nsswitch'
		    grouping='require_all'
		    restart_on='refresh'
		    type='path'>
			<service_fmri
			    value='file://localhost/etc/nsswitch.conf' />
		</dependency>
		<!--
		If autofs is enabled, wait for it to get users' home
		directories.
		-->
		<dependency
		    name='autofs'
		    grouping='optional_all'
		    restart_on='none'
		    type='service'>
			<service_fmri value='svc:/system/filesystem/autofs' />
		</dependency>
		<dependent
			name='exim_multi-user-server'
			grouping='optional_all'
			restart_on='none'>
				<service_fmri
				    value='svc:/milestone/multi-user' />
		</dependent>
		<exec_method
			type='method'
			name='start'
			exec='/lib/svc/method/smtp-exim start'
			timeout_seconds='60' />
		<exec_method
			type='method'
			name='stop'
			exec='/lib/svc/method/smtp-exim stop %{restarter/contract}'
			timeout_seconds='60' />
		<exec_method
			type='method'
			name='refresh'
			exec='/lib/svc/method/smtp-exim refresh'
			timeout_seconds='60' />
		<template>
			<common_name>
				<loctext xml:lang='C'>
				Exim SMTP mail transfer agent
				</loctext>
			</common_name>
                </template>
	</instance>
	<stability value='Unstable' />
</service>
</service_bundle>

I just saw a cool video of all the effects that the Logitech Quickcam Orbit can do. It’s very cool. Notice the computer fan starting to pickup during the demo ? I’m sure that this require some serious CPU to achieve.

You might have seen ads for the Ambient Orbs . They are basically a pager on the FLEX protocol with a bunch of leds attached, changing colours with the weather forecast, the phase of the moon, the traffic or the NASDAQ.

The interesting thing is that on the company’s web site, there is a page on how to build your own. This is where I found that there are some data only FLEX pager, certainly with a serial port.

On the same web site, there is a mention of the Ambient Energy Orb developed for DemandResponse (this one is not wireless though….)
Potentially interesting combination …

Portals and SOA

I recently saw a blog entry mentioning an article relating SOA with the portal technology. It’s not clear to me that this is really related. Yes, there are services, which can expose portlets, but are we saying that the composition of portlets inside a portal is identical to the composition of services by a composite application platform like Sun’s CAPS ?

Here is the pointer to the document: A Service Oriented Architecture for Portals Using Portlets

First, Pebble is a Java/JSP based weblog software. It requires some kind of servet container, in my case, I choosed Tomcat 5.5.x. However, I will likely switch to glassfish at some point.

Second, the Tomcat container runs on x86 Solaris 10, each application is integrated with the SMF, more on that later.

Third, www.alopi.com is a virtual domain served by apache 2.2.x. The communication between Apache and Tomcat is using AJP 1.3. However, Apache and Tomcat run on the same machine, without load balancers

The steps for implementing this solution are:

  • install mod_jk along with apache
  • configure the workers (in my case, only one, on localhost)
  • configure the virtual host, mod_jk, and workers in the apache httpd.conf
  • unzip pebble.war inside a directory
  • change Tomcat’s server.xml to redefine the default path to point to the pebble directory

Below are the extracts of the relevant configuration elements :
apache mod-jk.conf (included at the end of httpd.conf)

# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info

 

apache extra/httpd-vhosts.conf (included in httpd.conf)

ServerName www.alopi.com
DocumentRoot /usr/local/alopi/pebble
JkMount /* localWorker

apache workers.properties (referenced in mod-jk.conf)

worker.list=localWorker
worker.localWorker.port=8009
worker.localWorker.host=localhost
worker.localWorker.type=ajp13

Tomcat server.xml
The following code snipet assume that the default application for the tomcat deployment is pebble. Identical result could have been achieved by deploying the pebble war in the ROOT directory under webapps.
This code goes into the default virtual host in my case:

<Context path="" docBase="/usr/local/alopi/pebble" debug="0" />

Here you have it, I cannot guarantee that this will work for you, but it should give you some hints. I’ve not re-verified that these instructions work from scratch, I hope that I did not forgot something.

Newer entries »