mercoledì 30 aprile 2008

SOA and AOP make Sense

The discussion about SOA, AOP and OOP in Carlo Pescio Blog, and the subsequent comment by Frank, pointed me out that a sample of Sense could be in help in understanding the way we are able to introduce AOP in SOA infrastructure and instrument an already existent infrastructure.


Actually we have a Sense presentation, called Mobile Workshop, that provides and demonstrate this features. The represented business case is very simple, and has the purpose only to demonstrate the power of Sense platform.

The Workshop: scenario
My editing team produces advertising messages, used to promote products. They create only the content, and the message is saved into a Repository, let's call it an XML database.

Inside my database data are represented in a way similar to:
<content id="1"><title>the title</title>
<description>
Christmas is coming, adopt a tree and leave it its natural environment.
</description>
</content>



Users can see and embed the xml simply via http get or through a webservice.

The xml database is a system already existent in my IT division, and is an external system that doesn’t contain specific logic. It’s a system we need to integrate to.

Business problem:
My business need is to enrich, without modification into the database, the content of that external system to provide a much better user experience. The client should receive the right user experience depending on the device used.

I know, there simply is much way to create HTML from and XML, this is only to introduce and demonstrate some concepts inside Sense platform.

Sense concepts:
Sense is a platform that is able to provide Service Level Agreement to software components (and not only).

Feeling:
Components installed in Sense can be defined to be:
  • internal - deployed and running in the Sense Platform
  • external - external systems, hardware or software, that provides data or logic in my business flow: for example a database server.

Sense is able to Feel external system through special type of connectors that provide Service Level Agreement and metrics, for the external device.

Example Feeling configuration:
<components>
<feeling name="feelCms" protocols="http" mapping="*/feelingExist/*">
...
<invoker class="com.moolidoo.sense.workshop.feeling.ExistFeeling" protocol="http">
...
<sla>
<transitions>
<transition from="HIGH" to="MEDIUM" when="">D{100}">
<transition from="MEDIUM" to="LOW" when="">D{200}">
<transition from="LOW" to="NO_SERVICE" when="">D{300}">
</transition>
<when threshold="NO_SERVICE">
<mock class="com.moolidoo.sense.workshop.feeling.mock.ExistMock">
</mock>


Emotions:
in Sense there is the concept of emotion. An emotion is a “piece of code” that the system call, when something happen and the purpose is to influence other components and the behavior of the system.

In our business case I’m going to use an emotion, bound to the Feeling, to instruments the output of the XML Database with the purpose to enrich the xml, and provide the HTML to customer.

Emotions can be conditioned, and in my sample, there is an emotion per device type, so the system can modify and produce the correct html per calling device.

Example Emotion configuration:
<emotionFilter name="BrowserHtmlLayout" >
<match value="eXistCms.biz" />
<condition expression="invocation:device=html" />
...
</emotionFilter>

<emotionFilter name="NokiaN95Layout" >
<match value="eXistCms.biz" />
<condition expression="invocation:device=NokiaN95" />
...
</emotionFilter>

In a such way, my Sense platform emits information and activates emotion, without change in the Process, based on the invocation device and on the innovated service.

The result is that an external device is Feel and governed in the system, on usage of that Feeling, sense emits Emotion that influence the system itself to provide a new behavior.



In Sense, thanks to concepts like Feelings and Emotions, we enable the developer to apply techniques AOP like to instruments SOA services. Services can be external and are not modified but can be Emotioned.