WSO2 Venus

Afkham AzeezArduino Alarm Clock

Recently I built an alarm clock which is powered by an Arduino clone called TechDuino which has the time in 24h format, alarm & temperature display functionality. I built this on strip board (Veroboard) since I wanted to quickly build it, and didn't want to spend time doing a PCB design. Besides, this project started as a simple Arduino clock, and I later added on the alarm & temperature sensor functionality.

The 7 segment display has two modes; time+temperature mode & alarm setting mode. In time+temperature mode, the time is displayed for 5 seconds, and then the temperature is shown for 2 seconds, and the cycle continues.

Initial prototype on breadboard

Initially I built the clock on a breadboard. That setup contained only the seven segment display & a shift register. The wiring was getting very messy as can be seen from the photographs above. So I decided to start building it on protoboard.


Display card plugged into the breadboard

Finally I decided to build everything on protoboards, and make it possible to plug the different parts together.

Parts used;
  1. Arduino/TechDuino
  2. 4 digit 7 segment display
  3. 74HC595 shift register
  4. DHT11 temperature sensor module
  5. RTC clock module
  6. Resistors
  7. BC547 transistor
  8. Piezo buzzer
  9. 104 (100nF) ceramic capacitor
  10. Tactile switches 

I built this to contain two main pluggable modules; the 7 segment display module & clock+alarm+temperature sensor shield. The 7 segment display module plugs into the clock+alarm+temperature sensor shield.



All components laid out

TechDuino

7 segment display card
I decided to build a separate 7 segment display card which is pluggable so that I can use this card for future Arduino projects.

Clock, alarm & temperature shield
The 3 tactile switches are used for setting the alarm. The bottommost button is used for toggling between alarm setup mode & time mode, and the topmost button is used for setting the alarm hour. The middle button is used for setting the alarm minute. The alarm value is stored in the Arduino microcontroller's EEPROM.

RTC Module
An RTC module was used to maintain the time. It is driven by a coin cell battery, and is capable of maintaining the time even when the Arduino is powered off.

DHT11 Temperature sensor module
The DHT11 temperature sensor, which is also capable of sensing humidity, was used for reading temperature measurements. I used the DHT11 Arduino library in my sketch.

Clock, alarm & temperature shield

Clock, alarm & temperature shield

The shield shown above nicely fits into the headers on the Arduino.


The fully assembled alarm clock

The following video shows the clock in action. Sorry about the poor video quality. My camera sucks.




The Arduino sketch is available at https://github.com/afkham-azeez/arduino-sketches/blob/master/ArduinoClock/ArduinoClock.ino. Feel free to copy, modify or redistribute this code.


Breadboard image.  

Breadboard design - developed using Fritzing




Nanadana MihindukulasooriyaLDP Container membership related discussions

There had been a flood of emails in the W3C Linked Data Working Group list about membeshipPredicate and membershipSubject and as a result three related issues were raised.
These were lead by the following arguments 
  • A client should be able to easily find out all the members of an LDPC without any need for reasoning 
  • It is easier if we keep references to the all the LDPRs created by an LDPC in the LDPC itself 
  • Separation of the LDPR and the the actual thing that it describes is important

If we see the effect of these issues in the current specification (assuming we don't remove the membershipX predicates), the main difference is that in contrast to the single triple added when a resource is created as in the current specification (which refers to the membership of the created LDPR in the LDPC), it might be possible that another triple will be added to another target LDPR or the LDPC itself. This is as a result of separation of the HTTP resource (LDPR) from the actual thing (a person, a project, a bug etc.) that it describes.

Whether or not ISSUE-73 get resolved as proposed or not, the most simplest case would still remain the same. So if I have a simple LDP Container like the following

 GET /BugTrac/products/ HTTP/1.1

</BugTrac/products/> a ldp:Container .

and POST some RDF content to create an LDPR under it

 POST /BugTrac/products/ HTTP/1.1
 Content-Type: text/turtle

<> a bt:ProductDescription;
  foaf:primaryTopic <#p>;
  dcterms:title "The Product A Page" .
<#p> a bt:Product;
     dcterms:title "Product A" .

According to the current specification, it will add the created to LDCR as an rdfs:member to the LDPC

 GET /BugTrac/products/ HTTP/1.1

</BugTrac/products/> a ldp:Container ;
             rdfs:member </BugTrac/products/A> .

and LDPR will look something like

 GET /BugTrac/products/A HTTP/1.1

</BugTrac/products/A> a bt:ProductDescription;
  foaf:primaryTopic </BugTrac/products/A#p>;
  dcterms:title "The Product A Page" .
</BugTrac/products/A#p> a bt:Product;
     dcterms:title "Product A" .

And then depending on how ISSUE-71 and ISSUE-72 will be solved,  we might have three more options that would define how an additional triple that will added to an appropriate resource (names of these predicates may not be the most appropriate as not they will be representing the relationships between the things denoted by LDPRs not really the memberships). 

The combinations of the following will decide the second triple to be added 

A - ldp:membeshipSubject defines the subject of the triple
B - ldp:membershipPredicate defines the predicate of the triple

</BugTrac/products/> a ldp:Container ;
         ldp:membeshipSubject </BugTrac#it>;
         ldp:membershipPredicate bt:tracks .

C. membeshipObject defines the object of the triple (ISSUE-72). One possible way to do this is to say that foaf:primaryTopic denotes the thing describes by the LDPR.

<> a bt:ProductDescription;
        foaf:primaryTopic <#p> .

So if we look at the 8 different possibilities,  in all the 8 cases following triple will be added (if ISSUE-73 gets resolved as proposed).

</BugTrac/products/> rdfs:member </BugTrac/products/A> .

In addition, in each of the following cases another triple may be added to a target LDPR or the LDPC itself.

membership
Subject
membeship
Predicate
membership
Object
Resulting Triple
/BugTrac#it bt:tracks #p </BugTrac#it> bt:tracks </BugTrac/products/A#p>
/BugTrac#it bt:tracks - </BugTrac#it> bt:tracks </BugTrac/products/A>
- bt:tracks - </BugTrac/products/> bt:tracks </BugTrac/products/A>
/BugTrac#it - #p
/BugTrac#it - -
- bt:tracks #p </BugTrac/products/> bt:tracks </BugTrac/products/A#p>
- - #p ?
- - - Simple case mentioned above.

* This assumes the default values
      ldp:membeshipSubject - container itself
membeshipObject - the newly created resource

Clearly some of the combinations do not make much sense. So the if we are going in this path, the specification will have to be articulated in a way that the other combinations are not possible.

Anyway this is only one part of the story, that is creation. Then we will have to also think about what will happen to these two triples when an LDPR is deleted. However,  the specification has left this open so it won't require any changes.
4.5.2 LDPR servers may alter the state of other resources as a result of an HTTP DELETE request. For example, it is acceptable for the server to remove triples from other resources whose subject or object is the deleted resource. It is also acceptable and common for LDPR servers to not do this – behavior is server application specific. 

Isuru SuriarachchiMongoDB Read/Write using a Java Client

Recently I’ve been working on some NoSQL projects using Cassandra and MongoDB. So I just thought of sharing some basic stuff related to those NoSQL stores which will be useful for the beginners. In this very first post I’m going to show you how to write a very simple Java code through which you can write data into a MongoDB store and read from it.

Step 1 : Install MongoDB. Depending on your environment, you can very easily install MongoDB on your machine by following the guidelines given here.

Step 2 : Create a Java project on your favorite IDE and add the MongoDB Java driver into your class path. If you are using a Maven script to build your project, you can add the following dependency into it.

<dependency>
   <groupId>org.mongodb</groupId>
   <artifactId>mongo-java-driver</artifactId>
   <version>2.10.1</version>
</dependency>

Step 3 : In this simple example, first we are going to create a database called “sample” and then add a collection called “book” into it. Then we’ll add 3 pages as documents into that collection. To be used as pages in the book collection, make sure you have 3 text files “page1.txt”, “page2.txt” and “page3.txt” in your classpath. After successfully inserting data into the database, we read the first document back from the database to make sure we’ve correctly inserted data. Here’s the Java code to do this. Read comments at each line to get an idea about what each line does.

import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;

import java.io.IOException;
import java.io.InputStream;

public class MongoSampleClient {

    public static void main(String[] args) {
        try {
            // create a MongoClient by connecting to the MongoDB instance in localhost
            MongoClient mongoClient = new MongoClient("localhost", 27017);
            // drop database if it already exists
            mongoClient.dropDatabase("sample");
            // creating a db named "sample" and a collection named "book"
            DB db = mongoClient.getDB("sample");
            DBCollection bookCollection = db.getCollection("book");
            // insert the 3 pages of the book into the collection
            for (int i = 1; i < 4; i++) {
                BasicDBObject doc = new BasicDBObject("pageId", "page" + i).
                        append("content", readFile("page" + i + ".txt"));
                bookCollection.insert(doc);
            }
            // read the first doc to make sure that we've inserted correctly
            DBObject firstDoc = bookCollection.findOne();
            System.out.println(firstDoc);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * Reads the specified file from classpath
     */
    private static String readFile(String fileName) throws IOException {
        // get the input stream
        InputStream fileStream = MongoSampleClient.class.getResourceAsStream("/" + fileName);
        // create a buffer with some default size
        byte[] buffer = new byte[8192 * 2];
        // read the stream into the buffer
        int size = fileStream.read(buffer);
        // create a string for the needed size and return
        return new String(buffer, 0, size);
    }
}

You’ll see the following on your console, which is the first document on your new collection.

{ "_id" : { "$oid" : "519f6c1f44ae9aea2881672a"} , "pageId" : "page1" , "content" : "your page1 content" }

Step 4 : Finally you can see the content you inserted above through the MongoDB console by using following commands.

isuru@isuru-w520:~$ mongo

MongoDB shell version: 2.0.4
connecting to: test
> 
> use sample
switched to db sample
> 
> db.book.find()
{ "_id" : ObjectId("519f6c1f44ae9aea2881672a"), "pageId" : "page1", "content" : "your page1 content" }
{ "_id" : ObjectId("519f6c1f44ae9aea2881672b"), "pageId" : "page2", "content" : "your page2 content" }
{ "_id" : ObjectId("519f6c1f44ae9aea2881672c"), "pageId" : "page3", "content" : "your page3 content" }
>

That’s it. In the next post on MonogoDB we’ll be looking at how to use MongoDB Map-Reduce functionality on top of the “book” collection we created above.


Kathiravelu PradeebanColder nights and warmer days..

Sunset at Setubal
[24/05/2013] Lisbon - Weeks 37, 38, & 39: The speed of time is increasing each day. We are done with the projects and demos, and the project discussions are going on. Exams are approaching. The blog updates are getting more infrequent and probably, updating the blog is the least important thing I worry about, right now.

[19/05/2013] Though we were getting busy, we were still able to pay a quick visit to Setubal and enjoy the sunset in the beach. It was interesting too, having a boat ride from Setubal to Torre for the beach.

Madhuka UdanthaXSLT Mediator Tutorial

This post will illustrate WSO2 ESB XSLT Transform Mediator in theoretical mode and also with sample codes.
When we need XSLT Mediator is need in wso2 ESB?
When we have to deal with dynamic request for ESB proxy. (If proxy request is dynamic (not static/not predefine) we will have to use XSLT mediator to mediator the message)
What is XSLT Mediator ?
The XSLT Mediator applies a specified XSLT transformation to a selected element of the current message payload. The source attribute specifies which element to have XSLT transformation. The feature element defines in to TransformerFactory.
If source element is not specified then soap body as the selected element. Parameters can be passed into the transformations through the property elements and it is optional and those can be accessed during transformation by <xsl:param name="the name of the property"/>.
What is the WSO2 ESB XSLT Mediator Syntax?

<xslt key="string" [source="xpath"]>
     <property name="string" (value="literal" | expression="xpath")/>*
     <feature name="string" value="true| false" />*
     <resource location="string" key="string"/>*
</xslt>

  • Source - Specifies which element to be selected to apply the given XSLT transformation.
  • Property - Allows optional parameters to be passed into the transformations.
  • Feature - Defines any features which should be explicitly set to the TransformerFactory.
  • Resource - Resolves XSLT imports and includes from the repository.
Here are some thing that I will be using in XSLT script
The <xsl:apply-templates> element applies a template to the current element or to the current element's child nodes. If we add a select attribute to the <xsl:apply-templates> element it will process only the child element that matches the value of the attribute. We can use the select attribute to specify the order in which the child nodes are processed.[1]
omit-xml-declaration   
values : yes OR no    Optional.
"yes" specifies that the XML declaration (<?xml...?>) should be omitted in the output. "no" specifies that the XML declaration should be included in the output. The default is "no"
indent 
values:  yes OR no    Optional.
"yes" indicates that the output should be indented according to its hierarchic structure. "no" indicates that the output should not be indented according to its hierarchic structure.
This attribute is not supported by Netscape 6[2]
Let Do sample
We can try our Transport Services (BusServices)[3]
Here Is the Expecting request
<sample:getBusNo xmlns:sample="http://transport.org">
      <xs:rootId xmlns:xs="http://transport.org">2</xs:rootId>
   </sample:getBusNo>
Back end Serive expecting request
<p:getBusNo xmlns:p="http://transport.org">
<xs:rootId xmlns:xs="http://transport.org">2</xs:rootId>
</p:getBusNo>
1. Start BusServices in WSO2 AS
2. Start WSO2 ESB in offset 1
3. Go to Home > Manage > Service Bus > Local Entries in ESB
4. Then add Add In-lined XML Entry
5. Five name as "in_xslt" and Value as below (transform.xsl file contains)
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
                xmlns:xs="http://transport.org"
                xmlns:sample="http://transport.org"
                exclude-result-prefixes="sample fn">
    <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
    <xsl:template match="/">
        <xsl:apply-templates select="//sample:getBusNo"/>
    </xsl:template>
    <xsl:template match="sample:getBusNo">
<p:getBusNo xmlns:p="http://transport.org">
      <xs:rootId xmlns:xs="http://transport.org">
<xsl:value-of select="xs:rootId"/>
</xs:rootId>
   </p:getBusNo>
    </xsl:template>
</xsl:stylesheet>
6. Then create Proxy with XSLT
<proxy xmlns="http://ws.apache.org/ns/synapse" name="testProxyXSLT" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <xslt key="in_xslt"/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
      <endpoint>
         <address uri="http://localhost:9763/services/BusServices"/>
      </endpoint>
   </target>
   <publishWSDL uri="http://10.100.2.150:9763/services/BusServices?wsdl"/>
   <description></description>
</proxy>                              

image
Now I need to change my respond 
from:
<ns:getBusNoResponse xmlns:ns="http://transport.org">
   <ns:return>4Colombo</ns:return>
   <ns:return>Negombo</ns:return>
   <ns:return>Galle</ns:return>
</ns:getBusNoResponse>
to:
<ns:getBusNoResponse xmlns:ns="http://transport.org">
<ns:rootName>2Colombo</ns:rootName>
<ns:rootName>Negombo</ns:rootName>
<ns:rootName>Galle</ns:rootName>
</ns:getBusNoResponse>
Here is XSLT Script for that
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
                xmlns:ns="http://transport.org"
                exclude-result-prefixes="ns fn">
    <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
    <xsl:template match="/">
        <xsl:apply-templates select="//ns:getBusNoResponse"/>
    </xsl:template>
    <xsl:template match="ns:getBusNoResponse">
<ns:getBusNoResponse xmlns:ns="http://transport.org">
 <xsl:for-each select="ns:return">    <ns:rootName> <xsl:value-of select="."/> </ns:rootName>
</xsl:for-each> </ns:getBusNoResponse>
    </xsl:template>
</xsl:stylesheet>
image
Add it to the out sequences in proxy
image
Here is Final testing
image
image

NOTE
If any case If I get empty String in RootID I am adding new RootName
<xsl:choose>
    <xsl:when test=".!= ''">
         <rootNmae><xsl:value-of select="."/></rootNmae>
       
    </xsl:when>
    <xsl:otherwise>
       <rootNmae>Root<xsl:text> </xsl:text>text</rootNmae>
    </xsl:otherwise>
</xsl:choose>

references
[1] http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog_apply
[2] http://www.w3schools.com/xsl/el_output.asp
[3] http://madhukaudantha.blogspot.it/2013/05/wso2-esb-filter-mediator-tutorial.html

Chris HaddadAPI Brand – Stand out from the Crowd

A well-executed API brand strategy helps your API stand out from the crowd, encourages API adoption, and increases business growth.

Ubiquitous broadband access, affordable connectivity, and simple integration is driving a virtual cycle where people are choosing new interaction behavior, encouraging new societal trends, and reshaping business models.  In an always-on environment, instant message is preferred over email, just-in-time planning is preferred, and ad hoc collaboration is possible.

 

APIs drive real-time plan adjustments and enhance situational awareness without pre-planned database downloads and pre-loaded software. While outdoors, individuals can check not only the up-to-date weather forecast, but also weather alerts and real-time radar feeds.  When traveling to a new destination, directions, traffic conditions, and estimated time of arrival are instantly re-calculated.     When shopping, individuals can access comparable pricing and obtain accessory recommendations.

 

 

In the future, and in many cases today, APIs drive more than just your smartphone apps.  APIs help network everything and everybody into an interconnected society (see Figure 1).   For example, package carriers (e.g. Fedex, UPS) seamlessly sending package track status information to both shippers and receivers.  Connected vehicles will transmit performance information to owners, manufacturers, and repair specialists.

Internet of Things

Figure 1: Networked electronics, networked industries, and networked society

Source: http://www.ericsson.com/res/docs/whitepapers/wp-50-billions.pdf

People are shifting away from destination sites (e.g. Yahoo, Google Search, CNET, CNN) and social networks (e.g. Facebook, Twitter) towards accessing information and interacting with businesses using Web APIs and local apps (see Figure 2).

Web Evolution

Figure 2: The Web Evolution

 

 

The transition from networked electronics, into networked industries, towards a networked society will require more APIs, API configuration, and API endpoints.  Today, the number of connected devices exceeds the world’s human population (see Figure 3). A growing number of connected device interactions will increasingly shift web activity from web sites to web APIs.

Connected Device Explosion Figure 3: The Growth of Connected Devices

Source: http://www.futuristspeaker.com/2012/09/empowering-things-for-our-internet-of-things/

 

The trends point to your API being just one of billions.   Think of every company, every individual, and every device offering a Web API.

 

How will your API stand out from the crowd?

 

Taking a page from the business world, API brands will distinguish online API resources, endpoints, and capabilities.   API brands enable you to build mindshare with your target audience. Mindshare increases API visibility; visibility encourages individuals (and devices) to discover and evaluate your API.     API evaluation triggers API adoption, and adoption realizes your goals (i.e. increased interaction and revenue growth).    Figure 4 illustrates the virtuous API branding cycle.

API Brand Cycle

Figure 4: API Branding Cycle

 

 

Building brands requires art, science, and execution. Brands are a blend of consumer perception and provider reputation.    Consumers associate brands with commodity, exclusivity, ease of use, and value.  A provider’s reputation is built by constantly delivering required capabilities and data, API quality and warranty, and delivering customer service through available support channels.

 

Build an API brand strategy by:

  • Defining the API brand message
  • Building API brand awareness
  • Nurture the API brand
  • Measure API brand value

 

When defining the API brand message, identify the target audience and specify key perception targets.   API brand awareness requires continual communication, promotion, and visible outreach actions.  API perception and reputation are nurtured through partnerships, community relations, and education.  Consider tasking a group to be API advocates.   Awareness and nurturing activities require significant time and effort, validate the strategy by comparing adoption, retention, and revenue growth with API alternatives.   Good brand success metrics can be obtained by tracking market interest and third-party coverage.

 

When estblishing your API brand, focus on value, perception, reputation, and retention building blocks.   For example, value is created by delivering the right message elements and attributes, aggregating API endpoints, orchestrating API interactions, and delivering service tiers at reasonable cost.   Quality delivery, ease of use, and proof influences consumer perception and provider reputation.   An API brand is impacted by service level agreements, Terms of Service (TOS), available case studies, number of partners, and available documentation (including client samples, SDK).   API brand activity increases retention by highlighting integration with other useful APIs and promoting the API through logo usage policies.

 

Continually promote the API brand identity by requiring attribution by consumer apps and websites.   Develop a ‘powered by’ logo and embed scripts.  Make the API a subset of wider functionality that is available when the end-consumer establishes a direct relationship (see Zillow branding guidelines).    Retain API exclusivity, monetization potential, and brand control by requiring consumers to present authentication keys and establishing terms of use.   The terms of use should disallow message manipulation, modification, or edits. Authentication keys, rate limiting, and quotas enable you to adjust revenue with end-user value.

 

Because an API brand relies on consumer awareness and perception, nurture the community with a partner program to reinforce API value.  Use hackathons to build an ecosystem and gauge API usability.    When expanding the API’s reach, tailor the brand message to diverse communities.

 

Because perception and reputation are incrementally acquired and persistent, building a name brand requires significant foresight.     Before investing significant time and effort promoting your brand message, answer the following questions:

  • Who will own the customer relationship with the API end-user?
  • How will you increase brand awareness?
  • How will you prevent API commoditization?

 

Balance your desire to syndicate the API across third-party developers with API monetization power.  Place 3rd party attribution and reference guidelines in place before making your API available, and using ‘see more’ attributions to drive the end-user towards your brand property.   Prevent commoditization by executing a plan to aggregate and orchestrate multiple capabilities (i.e. deliver a solution instead of a building block) and tap your API into a broad ecosystem of complementary providers.

 

Look and feel strongly influences perception.   Build a developer and end-user portal that matches your intended audience and desired brand image. Choose an API brand platform where you can customize the portal.    Figure 5 and 6 demonstrate how the WSO2 API Store was customized.

StubHub API Portal

Figure 5: Developer Portal Look and Feel

apicultur portal

Figure 6: Developer Portal Look and Feel

 

When tailoring the brand presentation for the intended audience, different logos, words, fonts, and colors become your brand image and influence perception.  Choose an API brand platform where you can fully customize the feel, create multiple storefronts to reach multiple communities, enable multiple publisher groups, and deliver multiple service level tiers.   Identify a platform that can scale as you add brands targeting market niches.   Learn by watching how General Motors, Gap Inc, and University of Miami brand their distinct offerings.

brand-audience-2 Figure 7: One Car Company, multiple brands serving diverse audiences

brand-audience-3 Figure 8: One University, multiple schools serving diverse students

brand-audience Figure 9: One Clothes Retail, multiple stores serving diverse fashionistas

 

 

Recommended Reading

 

Learn more about API, Branding, and Stores at

Creating an Enterprise App Store

API Branding Webinar with Guest Speaker Kin Lane

All things API at the homeport

 

 

 

 

Ganesh PrasadSOA As Dependency-Oriented Thinking - One Diagram That Explains It All


I've been talking and writing about SOA as "Dependency-Oriented Thinking" for a while now, and have even conducted a couple of workshops on the theme. The feedback after the interactive sessions has always been positive, and it surprises me that such a simple concept is not already widely known.

I'm in the process of splitting (slicing?) my white paper "Slicing the Gordian Knot of SOA Governance" into two, one dealing with SOA ("Dependency-Oriented Thinking" or DOT) and the other dealing with Governance and Management ("Dependency-Oriented Governance and Management Approach" or DOGMA).

Partway through the DOT document, I realised that one of the diagrams in it explains the entire approach at a glance.

Here it is. Click to expand.


This is of course the BAIT model of an organisation, with a specific focus on Dependencies. BAIT refers to Business, Application, Information (Data) and Technology, the four "layers" through which we can trace the journey of application logic from business intent to implementation.

[Basic definitions: SOA is the science of analysing and managing dependencies between systems, and "managing dependencies" means eliminating needless dependencies and formalising legitimate dependencies into readily-understood contracts.]

At the Business layer, the focus on dependencies forces us to rationalise processes and make them leaner. Business processes need to be traceable back to the organisation's vision (its idea of Utopia), its mission (its strategy to bring about that Utopia) and the broad functions it needs to have in place to execute those strategies (Product Management, Engineering, Marketing, Sales, etc.). Within each function, there will need to be a set of processes, each made up of process steps. Here is where potential reuse of business logic is first identified.

At the end of this phase, we know the basic process steps (operations) required, and how to string them together into processes that run the business. But we can't just have these operations floating around in an organisational "soup". We need to organise them better.

At the Application layer, we try to group operations. Note that the Business Layer has already defined the run-time grouping of operations into Processes. At the application layer, we need to group them more statically. Which operations belong together and which do not? That's the dependency question that needs to be asked at this layer.

The answer though, is to be found only in the Information layer below, because operations only "belong" together if they share a data model. As it turns out, there are two groups of data models, those on the "outside" and those on the "inside". The data models on the "inside" of any system are also known as "domain data models", and these are never visible to other systems. In contrast, a data model on the "outside" of a system, known as an "interface data model", is always exposed and shared with other systems. In SOA, data on the outside is at least an order of magnitude more important than data on the inside because it impacts the integration of systems with one another, whereas data on the inside is only seen by a single system.

Version churn is a potential problem at the Information Layer, because changing business requirements could result in changed interfaces. With a well-designed type hierarchy that only exposes generic super-types, the interface data model can remain stable even as newer implementations pop up to handle specialised sub-types. Most changes to interfaces are then compatible with older clients, and incompatible changes are minimised.

Once we have our data models, we can go back up one level to the Application layer and start to group our operations in two different ways, depending on whether they share an internal (domain) data model or an interface data model. Operations sharing a domain data model form Products. Operations sharing an interface data model form Services. (And that's where the "Service" in "Service-Oriented Architecture" comes from.) Products are "black boxes" meant to be used as standalone applications. Services are "glass boxes" with no other function than to loosely bundle together related operations.

Finally, we have to implement our Services. The description and deployment bundles that are used need not correspond one-to-one with the Services themselves. They should in general be smaller, so that the volatility (rate of change) of any single operation does not needlessly impact others merely because they share a description bundle (e.g., a WSDL file) or a deployment bundle (e.g., a JAR file). If we also pay attention to the right types of components to use to host logic, transform and adapt data, and coordinate logic, we will be implementing business intent in the most efficient and agile way possible.

This, in fact, is all there is to SOA. This is Dependency-Oriented Thinking in practice.

The white paper will explain all this in much greater detail and with examples, but this post is an early appetiser.

Madhuka UdanthaXPath2.0

I learn Subject 5 years ago, but realy enterprise usage seen few weeks ago. Therefore I think to write on Xpath 2.0. XPath 2.0 is the current version of the XPath language defined by the World Wide Web Consortium, W3C. XPath is used for selecting parts of an XML document. So it means hierarchicly navigation through out the document tree. XPath became a W3C Recommendation 16. November 1999.

XPath 2.0 is used as a sublanguage of XSLT 2.0, and it is also a subset of XQuery 1.0. All three languages share the same data model (the XDM - XQuery and XPath Data Model).

Here I am going draw a mind map for Xpath. Just like Summary

image

 

image

Xpath axis defines a node-set relative to the current node.

Xpath Operations

|, +, -, *, =, !=, <, >, <=, => or, and, mod

Thilina GunarathneHadoop MapReduce Cookbook Errata

Following are the list of errors that have been found on our book so far. We highly appreciate if you can share with us any errors you have found in the book, so that we can add them to the errata.

Page 36 : Chapter 2 - Setting HDFS block size recipe
2. To specify the HDFS block size for specific file paths, you can specify the block size when uploading the file from the command line as follows:
>bin/hadoop fs -Ddfs.blocksize=134217728 -put data.in /user/foo
The above command  should be as follows.
>bin/hadoop fs -D dfs.block.size=134217728 -put data.in /user/foo


Please accept our apologies about any inconvenience caused due to the above errors.

Ganesh Prasad50 Data Principles For Loosely-Coupled Identity Management


It's been a while since our eBook on Loosely-Coupled IAM (Identity and Access Management) came out. In it, my co-author Umesh Rajbhandari and I had described a radically simpler and more elegant architecture for a corporate identity management system, an architecture we called LIMA (Lightweight/Low-cost/Loosely-coupled Identity Management Architecture).

Looking at developments since then, it looks like that book isn't going to be my last word on the subject.

IAM has quickly moved from within the confines of a corporate firewall to encompass players over the web. New technology standards have emerged that are in general more lightweight and scalable than anything the corporation has seen before. The "cloud" has infected IAM like everything else, and it appears that IAM in the age of the cloud is a completely different beast.

And yet, some things have remained the same.

I saw this for myself when reviewing the SCIM specification. This is a provisioning API that is meant to work across generic domains, not just "on the cloud". It's part of the OAuth 2.0 family of specifications, and OAuth 2.0 is an excellent, layerable protocol that can be applied as a cross-cutting concern to protect other APIs. SCIM too is OAuth 2.0-protected, but that's probably where the elegance ends.

The biggest problem with SCIM is its clumsy data model, which then impacts the intuitiveness and friendliness of its API. I critiqued SCIM on InfoQ, and in response to a "put up or shut up" challenge from some of the members of the SCIM working group, I began working on an Internet Draft to propose a new distributed computing protocol, no less. That's a separate piece of work that should see the light of day in a couple of months.

In the meantime, I began to work on IAM at another organisation, a telco this time. My experiences with IAM at a bank, an insurance company and then a telco, had by then given me a much better understanding of Identity as a concept, and I began to see that many pervasive ideas about Identity were either limiting or just plain wrong. Funnily enough, most of these poor ideas had more to do with the Identity data model than with technology. I also observed that practitioners tended to focus more on the "sexy" technology bits of IAM and less on the "boring" data bits, and that explained to me, very convincingly, why systems were so clumsy.

I then consciously began to set down some data-specific tips and recommendations that I saw being ignored or violated. The irony is that it doesn't cost much to follow these tips. All it costs is a change of mindset, but perhaps that's too high a price to pay for many! In dollar terms, the business benefits of IAM can be had for a song. Expensive technology is simply not required.

So that's the lesson I learnt once more, and the lesson I want to share. No matter what changes we think are occurring in technology, the fundamental concepts of Identity have not changed. The data model underlying Identity has not changed. Collectively, we have a very poor understanding of this data model and how we need to design our systems to work with this data model.

So here are 50 data principles for you, the architect of your organisation's Identity Management solution. I hope these will be useful.

The presentation on Slideshare:
http://slidesha.re/14uo3YY

The document hosted on mesfichiers.org:
http://atarj9.mesfichiers.org/en/

Tharindu MathewConverting all educational institutions to use open source software in Sri Lanka

Recently, I read this post about Richard Stallman’s (RMS) visit to India. I then decided to educate myself about how RMS’s visit impacted India. I read this very, very interesting thing that happened in Kerala. An excerpt from wikipedia:

In August 2006 at his meetings with the government of the Indian State of Kerala, he persuaded officials to discard proprietary software, such as Microsoft’s, at state-run schools. This has resulted in a landmark decision to switch all school computers in 12,500 high schools from Windows to a free software operating system.[45]

Then, I was wondering why this did not happen in Sri Lanka? If it did I’ve never heard about this. All open source Operating Systems are now usable enough for even novices to use it, and most of the software available for it is free.

This would be a brilliant move, not just to cut costs but to ‘fix’ our future generations. Every school child that is above 13 is able to program with his knowledge of basic algebra and such, if he or she has proper guidance. The use of Open Source Operating Systems allows all these children to have access to all development tools for free (Eclipse, vim, emacs, etc.), thus forming a generation with a high computer literacy rate. The other advantage of this is the low barrier to entry in the software world. How cool would it be to see a 15 year old in Sri Lanka creating this amazing app for Android and making a multi-million dollar business out of it? This move would not just make children more computer literate but also allow talented kids to build their entrepreneurial skills as well.

I hope that the leadership in this country grabs this opportunity.


Gillian DassCome Work in Sri Lanka….

Are you a Sri Lankan living overseas and constantly missing home?

I’ve heard almost every Sri Lankan living overseas say how at some point in their life they want to come back to Sri Lanka. Quite natural, it’s home after all, a place where you feel you belong and for those who have lived most of their lives here it’s a place that brings back those cherished memories.

So those of you looking at coming back, this is the right time to do so. Over the recent few years, with the ethnic war being put to an end Sri Lanka is booming immensely in all aspects. Not only is it attracting those who left a war torn Lanka, but there is an increasing number of foreign nationalities who are also looking at job opportunities here.

We now finally have peace. Gone are the days when you leave home in the morning with fear not knowing if you would return back in the evening. The constant news headlines of a bomb being exploded in some part of the island. I remember my friends and relatives overseas having the fear of coming here to visit me thinking that the moment the plane touches Lankan soil they would be shot down or something. (yes, quite a bunch of extremists but then that’s what the news portrayed Sri Lanka to be)

Along with the peace we see a lot of development. Better roadways, the southern highway (and more to follow), parks for jogging and leisure, a large number of resorts and holiday destinations. Talking about holidays, Sri Lanka has the ideal solution for last minute weekend getaways. Within a matter of couple of hours you can drive from a busy city to a calm and cool relaxing surrounding in the hills. The same applies if you fancy going to a beach (there are quite a few lovely beaches to pick from), ancient historical cities, camping, wildlife and the list goes on. The choice is left with you to pick the climate and surroundings for your holiday and its only a matter of being a few hours away.

With the economy booming there is a number of job opportunities and a growing need for highly skilled individuals.

Work in Sri Lanka is an initiative steered by a group of volunteers who advocate Sri Lanka as a work destination. Also provides guidance to those Sri Lankans looking at relocating as well as to foreigners who are looking at the job market here. Assistance to executive level job seekers in the form of providing intros and links to the industry to assist in finding the ideal job.

Image

Work in Sri Lanka website was launched on 14th May, and this serves as an information portal with a single location where all basic information relating to making the decision of moving to Sri Lanka. Check it out at workinsrilanka.lk and let us know what you think about it. Comments to improve it are eagerly welcomed. 

Proud to say I was apart of a very successful event thanks to an incredible team of volunteers who helped pull things through within a matter of few months to make the launch a success. And our efforts are continuous as we move forward in building more partnerships with the industry to help promote those ideal vacancies and also further improve our information portal. 


Madhuka UdanthaWSO2 ESB Enrich Mediator Fast Tutorial

Enrich Mediator can be used to perform transformations with in integration logic. It process a message based on a given source configuration and perform the specified action on the message by using the target configuration.


syntax

<enrich>
    <source \[clone=true\|false\] \[type=custom\|envelope\|body\|property\|inline\] xpath="" property="" />
    <target \[action=replace\|child\|sibiling\] \[type=custom\|envelope\|body\|property\|inline\] xpath="" property="" />
</enrich>

As above you can see there is main two configuration

  • Source
  • Target

Source Configuration

Clone : By this you can clone or used as a reference during enrich mediation. (default value is false)
Type :  Part that use from the original message to enrich the modified message
XPath Expression : Expression 


Target Configuration


Action : Action can be applied to outgoing messages and it is define by type
    Replace - replaces the XML message based on the target type specified (default action)
    Child  - Adding chile for the specified target type.
    Sibling  - Adding as a sibling of the specified target type.


eg:

<enrich xmlns="http://ws.apache.org/ns/synapse">
           <source clone="false" type="envelope" xpath="" property="" />
           <target action="replace" type="body" xpath="" property="" />
</enrich>


Here is sample proxy for replacing xml part in payload

<proxy xmlns="http://ws.apache.org/ns/synapse" name="testingProxy4" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <log level="full"/>
         <enrich>
            <source type="inline">
               <tran:rootId xmlns:tran="http://transport.org">5</tran:rootId>
            </source>
            <target xmlns:tran="http://transport.org" xpath="//tran:getBusNo/tran:rootId"/>
         </enrich>
         <log level="full"/>
         <send>
            <endpoint key="conf:/getBus"/>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <publishWSDL uri="http://localhost:9763/services/BusServices?wsdl"/>
   <description></description>
</proxy>

Console:

image

Check with SOAP UI

image

Changing text in payload

<enrich>
            <source type="inline" clone="true">8</source>
            <target xmlns:tran="http://transport.org" xpath="//tran:getBusNo/tran:rootId/text()"/>
</enrich>

image

Adding new Property for that request body

      <enrich>
            <source type="inline" clone="true">
               <busName xmlns="">Testing</busName>
            </source>
            <target type="body" action="child"/>
        </enrich>

image

 

Adding body or any customer Xpath in to property (new Property)

     <enrich>
           <source type="body"/>
           <target type="property" property="REQUEST_PAYLOAD"/>
      </enrich>
        <log>
               <property name="Request Payload" expression="get-property('REQUEST_PAYLOAD')"/>
        </log>

image

 

Here is the last Proxy code in here

 

<proxy xmlns="http://ws.apache.org/ns/synapse" name="testingProxy4" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <log level="full"/>
         <enrich>
            <source type="inline" clone="true">
               <busName xmlns="">Testing</busName>
            </source>
            <target type="body" action="child"/>
         </enrich>
         <enrich>
            <source type="body" clone="true"/>
            <target type="property" property="REQUEST_PAYLOAD"/>
         </enrich>
         <log>
            <property name="Request Payload" expression="get-property('REQUEST_PAYLOAD')"/>
         </log>
         <log level="full"/>
         <send>
            <endpoint key="conf:/getBus"/>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <publishWSDL uri="http://localhost:9763/services/BusServices?wsdl"/>
   <description></description>
</proxy>

Sanjiva WeerawaranaLaunching WorkInSriLanka.lk Initiative

Over the last many months, I've been privileged to be part of a fantastic team of volunteers working on a new effort:
This is an effort to help people who are considering moving to Sri Lanka to work and live. 

Me? Move to Sri Lanka?? What?!

Yes, Sri Lanka. No more war. No more bombs. No one trying to (systematically .. yeah we have our share of crazies) kill anyone. Great weather. Majorly improving infrastructure. A second airport (with no flights yet .. but that's ok everyone's gotta start at the bottom!). A real, honest-to-goodness highway (dinner in Galle tonite?) and many more coming. Apartments everywhere. Parks all over Colombo.

Compare that to where you're living? Do you go thru a metal detector to your workplace? Not in Sri Lanka any more. We had a long period of that .. but no more .. war finished in 2009, nearly to the day today (May 18th is the anniversary).

Anyway :-). Our objective is to first be a one-stop-site for anyone who's considering moving to Sri Lanka. Everything you need to know from what kind of jobs are available, how much does housing cost, how much do cars cost to kids schooling to visa stuff. All there, all in one place. All done in an objective, volunteer, independent kind of way. The site is still in its infancy of course .. more to come but its got a lot of stuff already!

With regards to jobs- if you're a senior person returning we will even help you get into the "network" to get into the loop of things. We have a pretty connected set of friends who are helping to get that done. We're also partnering with pretty much every industry body so that we can reach into all of those networks.

Going beyond the information portal we want to become an advocacy group to promote what's good about moving to Sri Lanka and also to work hard on breaking down more barriers. Even ex-Sri Lankans returning have some major barriers in the system now and we want to work towards removing them. 

This was a totally volunteer group of people from all over the place. Check us out at the site!

We had a fantastic launch event on Tuesday (May 14th) evening. We had the Governor of the Central Bank of Sri Lanka come and give the keynote talk and then had a superb panel. More on that coming soon at the site itself.

Check it out and give us your feedback - plenty of places in the site to do that. Enjoy surfing!



Dinuka MalalanayakeAnalyze java source with “Yasca” and detecting security vulnerabilities

Here I’m going to explain how to analyze the source code by using the “Yasca

1. First of all you can checkout the Yasca from “https://svn.wso2.org/repos/wso2/people/prabath/yasca

2. Check whether the php installed in your machine. if not you have to install it first
(In Linux you can do easily “sudo apt-get install php5″)

3. Go to the “yasca” directory and write the the following command
./yasca $Source_Directory_path” for more command refer this
is

4. Go to your desktop the you can see the folder call Yasca and all the generated reports are located there
is

This is very useful for detecting security vulnerabilities and other issues in program source code.


Prabath AbeysekeraQuery UDTs(User Defined Types) with WSO2 Data Service Server



In this brief tutorial I ll be guiding you through the process of developing a simple dataservice which is capable of retrieving an Oracle UDT (User Defined Type) from a database using WSO2 Data Services Server.

First, login to your preferred Oracle database via your favourite SQL client tool or the sqlplus command line utility and run the following script. This will create necessary UDT structures, a table to store the UDT type as well as some sample data which will later be queried via dataservice.

CREATE OR REPLACE TYPE address_t AS OBJECT(num NUMBER, street VARCHAR2(100), 
city VARCHAR2(100), STATE VARCHAR2(100), country VARCHAR2(100)); 
/
CREATE OR REPLACE TYPE customer_t AS OBJECT(id NUMBER, name VARCHAR2(50));
/
 
CREATE TABLE customer_tbl(customer_id NUMBER, customer_name VARCHAR2(100),  
customer_address address_t);


INSERT INTO customer_tbl VALUES(1,
'john',
address_t(25, 'flower road', 'Brooklyn', 'Western London', 'United Kingdom');


INSERT INTO customer_tbl VALUES(2,
'peter',
address_t(25, 'flower road', 'El Camino Real', 'Palo Alto', 'California');


CREATE OR REPLACE PROCEDURE getCustomer(cust OUT customer_t)  
IS 
BEGIN cust := customer_t(1, 'prabath'); 
END;
/

Next, download the latest version of WSO2 Data Service Pack from here and extract it to a proper location in your file system. Let's call it DSS_HOME. Then copy the Oracle JDBC jar downloaded from here to DSS_HOME/repository/components/lib directory.

Now we're done with preparing the surroundings for creating the dataservice.

Let's now start the WSO2 Data Service Server and start building up the dataservice. (You can find more detailed information about developing a simple dataservice from here.). Depicted below is a sample dataservice descriptor file (.dbs) that carries a dataservice queries for retrieving and inserting UDT values in customer_address column of the customer_tbl table.

<data name="UDTSample">  
<config id="default">
<property name="org.wso2.ws.dataservice.driver">oracle.jdbc.driver.OracleDriver
</property>
<property name="org.wso2.ws.dataservice.protocol">jdbc:oracle:thin:@localhost:1521:XE
</property>
<property name="org.wso2.ws.dataservice.user">djpro</property>
<property name="org.wso2.ws.dataservice.password">admin</property>
</config>
<query id="q1" useConfig="default">
<sql>SELECT customer_id, customer_name, customer_address FROM customer_tbl</sql>
<result element="Entries" rowName="Entry">
<element name="ID" column="customer_id" xsdType="xs:integer" />
<element name="Name" column="customer_name" xsdType="xs:string" />
<element name="Number" column="customer_address[0]" xsdType="xs:integer" />
<element name="Street" column="customer_address[1]" xsdType="xs:string" />
<element name="City" column="customer_address[2]" xsdType="xs:string" />
<element name="State" column="customer_address[3]" xsdType="xs:string" />
<element name="Country" column="customer_address[4]" xsdType="xs:string" />
</result>
</query>
<query id="q2" useConfig="default">
<sql>INSERT INTO customer_tbl VALUES(?,?,address_t(?,?,?,?,?))</sql>
<param name="ID" sqlType="INTEGER" />
<param name="Name" sqlType="STRING" />
<param name="Number" sqlType="INTEGER" />
<param name="Street" sqlType="STRING" />
<param name="City" sqlType="STRING" />
<param name="State" sqlType="STRING" structType="null" />
<param name="Country" sqlType="STRING" />
</query>
<query id="q3" useConfig="default">
<sql>call getCustomer(?)</sql>
<result element="customers" rowName="customer">
<element name="id" column="cust[0]" xsdType="xs:integer" />
<element name="name" column="cust[1]" xsdType="xs:string" />
</result>
<param name="cust" sqlType="STRUCT" type="OUT" structType="CUSTOMER_T" />
</query>
<operation name="op1">
<call-query href="q1" />
</operation>
<operation name="op2">
<call-query href="q2">
<with-param name="ID" query-param="ID" />
<with-param name="Name" query-param="Name" />
<with-param name="Number" query-param="Number" />
<with-param name="Street" query-param="Street" />
<with-param name="City" query-param="City" />
<with-param name="State" query-param="State" />
<with-param name="Country" query-param="Country" />
</call-query>
</operation>
<operation name="op3">
<call-query href="q3"/>
</operation>
</data>
NOTE: 
If you carefully look at the input mappings defined for the dataservice query "q1", the UDT attributes that are being retrieved are specified in the format of "database_column_name[UDT_attribute_index]"

Once you deploy the "UDTSample" dataservice in the WSO2 Data Services Server it will be displayed under the service list. 


You can then click on the Tryit client functionality using which you will be able to test the data service operations that manipulate the aforementioned UDT structures. 

I trust this simple tutorial helps you understand the basics of manipulating UDTs with WSO2 Data Services Server. Further, I'm hoping to come up with more complex samples explaining scenarios such as how to retrieve UDTs as OUT parameters of stored procedures, how to query SQL Arrays via stored procedures/ordinary SQL queries/Ref cursors, etc soon.

Madhuka UdanthaWSO2 ESB Endpoints Error Handling

This post will illustrate error handling in wso2 esb regards to Endpoints. It is much import because WSO2 Enterprise Service Bus is to send the message to a service provider in it finally stage.

image

Usecase One:

WSO2 ESB sample proxy is pointing in to End point that can be time out. Proxy must able give nice valid message for to user regard to the is time out rather than false message. Response message is able to customize depending on the Error Code.

1. Create End Point (Web services that will make time out ) and host it. (I am using wso2 AS for to host time out services)

2. Create Proxy that end point

<proxy xmlns="http://ws.apache.org/ns/synapse" name="TimeoutProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
 

<target faultSequence="fault">
      <outSequence>
         <log>
            <property name="Out Sequence Testing " value="=============In Out Sequence============"/>

         </log>
         <send/>
      </outSequence>
    

    <endpoint>
         <address uri="http://localhsot:9763/services/TimeoutService/">
            <timeout>
               <duration>1000</duration>
               <responseAction>discard</responseAction>
            </timeout>
         </address>
      </endpoint>


   </target>
   <description></description>
</proxy>

3. Go to "Home > Manage > Service Bus > Sequences" and Click  on fault Sequence Edit link

image

4. Update it with below code

<sequence xmlns="http://ws.apache.org/ns/synapse" name="fault">

   <property xmlns:ns="http://org.apache.synapse/xsd" name="ErrorCode" expression="get-property('ERROR_CODE')" scope="default" type="INTEGER"/>

   <log level="custom">
      <property name="failS" value="=======False Sequence==========="/>
      <property xmlns:ns="http://org.apache.synapse/xsd" name="testCode" expression="$ctx:ErrorCode"/>
   </log>

   <switch xmlns:ns="http://org.apache.synapse/xsd" source="$ctx:ErrorCode">
      <case regex="303001">
         <log>
            <property name="go" value="==== 303001 ==== Error msg transformation"/>
         </log>
      </case>
      <case regex="101503">
         <log>
            <property name="go" value="==== 101503 ==== Error msg transformation"/>
         </log>
      </case>
   </switch>

<drop/>

</sequence >

image

NOTE

Transport Error Codes

Transport Error Codes WSO2 ESB 4.6.0

Endpoint Failures

Endpoint Failures

Here is console of wso2 ESB

image

5. You can do switch depending on your Error Code or Action

<property xmlns:ns="http://org.apache.synapse/xsd" name="Action" expression="get-property('Action')"/>

Or

<property xmlns:ns="http://org.apache.synapse/xsd" name="ErrorCode" expression="get-property('ERROR_CODE')" scope="default" type="INTEGER"/>

6. Rather Logging We need to get Respond Message where user can understand what was happen.

Here is sample Msg for that Error code 101503

<getBusRootResponse xmlns="">
            <error>
               <errorCode>101503</errorCode>
                <errorMsgTitle>Network Connection Failure</errorMsgTitle>
               <errorMsg>We are unable to get Connection to BusRoot Services</errorMsg>
            </error>
         </getBusRootResponse>

Add payload for each case and build your message or add property each case have constracted message details to be show

7. Remove Header “TO”

8. Add  Property "RESPONSE" as  "true"

9. Replace Drop with Send

image

Here is fault sequence

<sequence xmlns="http://ws.apache.org/ns/synapse" name="fault">
   <log level="full"/>
   <property xmlns:ns="http://org.apache.synapse/xsd" name="ErrorCode" expression="get-property('ERROR_CODE')" scope="default" type="INTEGER"/>
   <log level="custom">
      <property name="failS" value="=======False Sequence==========="/>
      <property xmlns:ns="http://org.apache.synapse/xsd" name="testCode" expression="$ctx:ErrorCode"/>
      <property xmlns:ns="http://org.apache.synapse/xsd" name="Action" expression="get-property('Action')"/>
   </log>
   <switch xmlns:ns="http://org.apache.synapse/xsd" source="$ctx:ErrorCode">
      <case regex="303001">
         <log>
            <property name="go" value="==== 303001 ==== Error msg transformation"/>
         </log>
        <payloadFactory>
            <format>
               <getBusRootResponse xmlns="">
                  <error>
                     <errorCode>301503</errorCode>
                     <errorMsgTitle>EndPoint Connection Failure</errorMsgTitle>
                     <errorMsg>We are unable to get Connection to BusRoot Services Provider</errorMsg>
                  </error>
               </getBusRootResponse>
            </format>
         </payloadFactory>
      </case>
      <case regex="101503">
         <log>
            <property name="go" value="==== 101503 ==== Error msg transformation"/>
         </log>
        <payloadFactory>
            <format>
               <getBusRootResponse xmlns="">
                  <error>
                     <errorCode>101503</errorCode>
                     <errorMsgTitle>Network Connection Failure</errorMsgTitle>
                     <errorMsg>We are unable to get Connection to BusRoot Services</errorMsg>
                  </error>
               </getBusRootResponse>
            </format>
         </payloadFactory>
      </case>
   </switch>
  <header name="To" action="remove"/>
   <property name="RESPONSE" value="true"/>
   <send/>
</sequence>

 

Here is Out from Try it

image

Madhuka UdanthaWSO2 ESB Payload Mediator Tutorial

This simple tutorial will lead you to write proxy with WSO2 ESB Payload Mediator.

Here is the client sending request payload for proxy


request:
<body>
   <p:getBusNo xmlns:p="http://transport.org">
      <xs:rootId>root1</xs:rootId>
   </p:getBusNo>
</body>

BackEnd service Request:
<body>
   <pos:getBusNo xmlns:p="http://pos.transport.org">
      <rooter:rootId>root1</rooter:rootId>
      <rooter:token>Aser4Tre321</rooter:token>
   </pos:getBusNo>
</body>

Proxy:

<payloadFactory>
  <format>
   <pos:getBusNo xmlns:pos="http://pos.transport.org">
      <rooter:rootId>$1</rooter:rootId>
      <rooter:token>MyToekn</rooter:token>
   </pos:getBusNo>
  </format>
<args>
    <arg  xmlns:p="http://transport.org" xmlns:xs="http://root.transport.org" expression="//p:getBusNo/xs:rootId"/>
</args>

</payloadFactory>

PUntitled

payload Factory will do the transformation.

Madhuka UdanthaManaging Endpoints and WSDL from WSO2 Register

Here I am going to use my previous post WSO2 proxy where it was written not getting End Points and wsdl from URL.

eg:

<endpoint>
        <address uri="http://localhost:9763/services/BusServices"/>
     </endpoint>
  </target>
  <publishWSDL uri="http://localhost:9763/services/BusServices?wsdl"/>

Now I will make those saved in register

Adding End Point

1. got to –> “Home > Manage > Service Bus > Endpoints”

2. Click on "Add Endpoint" tab and then "Address Endpoint"

image

5. Click on "save in Registry"

image

6. Save & close clicked

image

 

Save wsdl in registy

1. Go to "Home > Registry > Browse"

2. Move to the "/_system/config/sample"

3. click on link called "Add Resource"

4. Then chose wsdl file in local Dir and save it

image 

5. Change Proxy for those from URL to registry location that you have added

<proxy xmlns="http://ws.apache.org/ns/synapse" name="transportProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <filter source="get-property('Action')" regex=".*getBusNo">
            <then>
               <log level="custom">
                  <property name="service" value="Bus Services is called"/>
               </log>
            </then>
            <else>
               <log level="custom">
                  <property name="service" value="Train Service is called"/>
               </log>
            </else>
         </filter>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
      <endpoint key="conf:/sample/transportEndPoint"/>
   </target>
   <publishWSDL key="conf:/sample/BusServices.xml"/>
   <description></description>
</proxy>

Madhuka UdanthaWSO2 ESB Filter Mediator Tutorial

This post will be for WSO2 ESB Filter Mediator and it will be cover simple usecase with basic Filter Mediator functions. It can be used for XPath filtering of messages.

There are two modes of operation

  • Specifies the XPath (boolean expression), return true or false
  • XPath will be matched against the regular expression return true or false


Syntax

<filter (source="xpath" regex="string") | xpath="xpath">
   mediator+
</filter>


Usecase

I have services call 'BusService' where I can give rootId (road name) and get list bus number that going on that root. In the same services it have some train deatils also.

When client call busService it must give busService and also If client ask for train details rather bus system must give it also.

Here is busServices calls

request:
<body>
   <p:getBusNo xmlns:p="http://transport.org">
      <xs:rootId xmlns:xs="http://transport.org">root1</xs:rootId>
   </p:getBusNo>
</body>

respond:
<ns:getBusNoResponse xmlns:ns="http://transport.org">
   <ns:return>root1Colombo</ns:return>
   <ns:return>Negombo</ns:return>
   <ns:return>Galle</ns:return>
</ns:getBusNoResponse>

getTraingNo

request:
<body>
   <p:getTrainNo xmlns:p="http://transport.org">
      <xs:rootId xmlns:xs="http://transport.org">root1</xs:rootId>
   </p:getTrainNo>
</body>

respond:
<ns:getTrainNoResponse xmlns:ns="http://transport.org">
   <ns:return>12-Colombo</ns:return>
   <ns:return>13-Muthu</ns:return>
   <ns:return>01-Bange</ns:return>
</ns:getTrainNoResponse>


Now I have write simple WSO2 ESB proxy with filter mediator.

1. Download wso2 esb 4.6.0 

2. Start wso2 esb <WSO2ESB_HOME>/bin/wso2server.bat (offset 1) Other services expose in wso2 AS in offset 0

3. Go to https://localhost:9444/carbon/

4. Then Create "Pass Through Proxy"

image

5. Here I am adding WSO2 Filter Mediator

image

  • Specify As: XPath or a Regular expression.
  • XPath: XPath expression if you selected the "Specify As" option to "XPath".
  • Source: which is going match with the reguilar expression
  • Regex: Regular expression to match with the source value.

6. In Here I am filtering for the action  of the WS request and it log the client request

is it bus or train request?

image

Here is proxy Source View

<proxy xmlns="http://ws.apache.org/ns/synapse" name="transportProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <filter source="get-property('Action')" regex=".*getBusNo">
            <then>
               <log level="custom">
                  <property name="service" value="Bus Services is called"/>
               </log>
            </then>
            <else>
               <log level="custom">
                  <property name="service" value="Train Service is called"/>
               </log>
            </else>
         </filter>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
      <endpoint>
         <address uri="http://localhost:9763/services/BusServices"/>
      </endpoint>
   </target>
   <publishWSDL uri="http://localhost:9763/services/BusServices?wsdl"/>
   <description></description>
</proxy>
                               

6. Go to https://localhost:9444/services/transportProxy?tryit#

Make bus request and train request and see console log

image

image

You can improve this usecase with some WSO2 ESB mediator if you wish!!

Srinath PereraHow to profile WSO2 Products


We use Profiling to find performance bottlenecks. We use tools like JProfiler and Yourkit profiler to profile java programs. However, if you try to use one of those tools to profile a WSO2 products, there are few things you should know.

I have repeated this many times, and that is the reason I am writing this down.
  1. Start the WSO2 Product
  2. Connect to the product by finding the Java processor from the menu. If you are debugging from a remote machine, you need to start the product with the JVM options (e.g. with jprofiler, the command look like -agentpath:/Applications/jprofiler7/bin/macos/libjprofilerti.jnilib=port=8849).
  3. When it connects, use instrumentation (you can sampling only if you run the test for 3-4 hours or more).
  4. Generally default filters will include org.apache.*, which will remove most useful information. To avoid that, remove all default filters, and add inclusive filters for org.wso2, org.apache, and java.util.
  5. Enable CPU or other useful data recording options, and continue with your profiling. 

Finally, if you have a memory leak, it is good idea to get a memory dump and to analyze it using EclipseMemoryAnalyzer and look at “Leak Suspect Report”.

Charitha KankanamgeThe simplest possible way to simulate a backend service delay

When testing service integrations, we usually want to simulate the delayed responses from backend web services. For example, if you want to test how WSO2 ESB or Apache Synapse reacts when the backend service takes large amount of time for responding, there are many approaches to introduce delay to backend web service. I have observed that, most of the people modify the backend web services to add Thread.sleep() when they need to introduce a delay in service invocation.

If you are not testing the backend web service and just want to test the integration (e.g:- outgoing calls from ESB), I cannot think of a better solution than using soapUI mock services.

Step 1

 

Add a new mock service to soapUI project. This can be done at the time of creating the project or by selecting a particular interface (binding) of a wsdl based project.

Step 2

 

Select the mock service in soapUI navigator and open the mock service editor. In the mock service editor, select OnRequest script.










Step 3

 


Add the following groovy script inside the OnRequest Script editor to introduce 1 minute delay.

sleep(60000)

Now, send a request to the mock service. You will notice that all requests will respond back to the caller after 1 minute of delay.

Read chapter 6 (Web service simulation with soapUI) and 11 (Extending soapUI with Scripting) of Web Services Testing with soapUI book for more information about soapUI scripting capabilities.




Chris HaddadCreating an Enterprise App Store

New IT models include providing a user-friendly experience commonly found in consumer app stores. The goals, challenges, and execution plan when creating an Enterprise App Store should be considered.

Why Create an Enterprise App Store?   Goals!

  • Obtain a user-friendly experience commonly found in consumer app stores
    • Business teams and individuals can rapidly find useful applications that will help them perform their tasks, increase their productivity, or obtain relevant information.
    • Business teams and individuals can directly subscribe to applications and use the application without IT intervention.
    • Companies can efficiently maintain budget, access, and compliance controls
      • IT groups can promote application solutions that conform to corporate policies (e.g. security, service level, budget) and are pre-integrated with corporate resources (e.g. identity directory, workflow, content, structured data, business processes).
      • IT groups can manage licensing, distribution, and upgrades that impact overall IT spend and user experience.
      • IT groups can provision access when employees on-board and turn-off access when an employee leaves the project or company.

 

What are Enterprise App Store Challenges?  Hurdles!

  • Promoting and displaying applications that are relevant to the enterprise app store user.
  • Understanding license and infrastructure costs
  • Establishing and maintaining access approval and budget approval processes.
  • Eliminating lengthy identity and access provisioning tasks
  • Controlling the distribution and upgrade of applications on mobile devices
  • Integrating applications with corporate resources
  • Delivering dashboards providing visibility into application subscriptions, usage, license audits, and policy compliance.

How to Create an Enterprise App Store – Execution!

  • Create on-demand, automated provisioning of application access and application configuration
  • Integrate user identity and single sign-on (SSO) with App Store
  • Ideally, select apps that are OAuth compliant and integrate with identity management and authorization infrastructure
  • Apply policy based promotion, access control, and data security policies to apps and APIs
  • Create branded App Stores that target a segment of the enterprise user population (e.g. HR, call center, sales force, field engineer)
  • Interface enterprise app store with mobile device management (MDM) infrastructure

 

Harshana Eranga Martin#THANKYOUSIRALEX - Tribute to the Greatest Football Manager Ever Sir Alex Ferguson













The Greatest Ever Manager Footballing world witness!!

27 Years ...  38 Trophies ... 28 Major Trophies .... With Manchester United ...

#LEGEND #THANKYOUSIRALEX #MANUTD #WEWILLMISSYOU

Sriskandarajah SuhothayanIntegrating WSO2 BAM & WSO2 CEP

This post demonstrate how we can integrate both WSO2 BAM and WSO2 CEP and run them as a single instance.

To integrate both WSO2 BAM and WSO2 CEP we need to download BAM and install the CEP features form the WSO2 p2repo. Here I have used WSO2 BAM 2.2.0 and 4.0.7 p2repo. Follow the wiki link to get to know how to install new features to existing products.

Testing the installation.
To test the instillation add broker-manager-config.xml to repository/conf/, and add axis2_client.xml to repository/conf/axis2/.
Here axis2_client.xml has the email sender information, and I'm using a demo email account for this.

Then create a directory called 'cepbuckets' in repository/deployment/server/ and add bam-cep-kpi-analyzer.xml there.
In bam-cep-kpi-analyzer.xml, you will be able to find a line
<cep:output brokerName="emailBroker" topic="wso2cep.demo@gmail.com/Phone Purchase Notification">
Change "wso2cep.demo@gmail.com" to the endpoint use email ID, who needs to receive the notification.

Now if you run the KIP-analyser sample of BAM all the events that have totalPrice>350000 and quantity>3 will be notified to the user.

Chris HaddadWhy choose Apache Camel with Apache Tomcat

Apache Camel with Apache Tomcat provides a low-cost and lightweight integration framework. Is Apache Camel with Apache Tomcat a good fit for your project requirements?

Apache Camel

Apache Tomcat is known for it’s ease-of-use and minimal footprint when building servlet and JavaServer Page applications, while Apache Camel is known for supporting Enterprise Integration Patterns, routing and mediation rules in a variety of domain-specific languages, including a Java-based Fluent API, Spring or Blueprint XML Configuration files, and a Scala DSL.

Developers and architects find a straightforward learning curve when using Apache Camel’s Java based DSL, yet they find better tools exist when building simple connections or implementing large integration projects. See Kai Wahner’s writeup on lightweight frameworks.  For larger integration projects requiring reliable messaging, scalability, eventing, business process execution, or web agent hosting, selecting an Enterprise Service Bus provides a better fit.  Kai has another good article placing ESB and integration suites in context.   Apache Camel is often integrated with ActiveMQ, ServiceMix, or Fuse to obtain additional capabilities required to deliver medium to complex integration projects.  The WSO2 ESB team is looking to embrace the simplicity of Apache Camel (by incorporating the project similar to embedding Apache CXF), and extend with multi-tenancy, failover, performance, and scalability enhancements.

Similar to RedHat JBoss Fuse, WSO2 ESB delivers service container clustering and reliable failover functions.   In addition to extensive mediation primitives, the products provide service monitoring and management support not available in the basic Apache Camel with Apache Tomcat combination.

To combat server proliferation, WSO2 ESB inherently supports multi-tenancy.  The multi-tenancy goes beyond simple Tomcat virtual domains by using OSGI class loaders and security managers to provide adequate tenant isolation and separate administration console interfaces.  A single WSO2 ESB instance can support multiple business units with appropriate data, logic, and execution isolation.

SpringSource, MuleSoft, and WSO2 have extended Apache Tomcat to provide better server management and ability to install features within the integration platform.    WSO2 ESB can install over 100+ features (e.g. business process execution, complex event execution, business activity monitoring) into the integration platform.

From performance perspective, Apache Camel with Apache Tomcat depends on the Tomcat transport to provide high performant message transfer.   The WSO2 ESB pass through transport and binary relay transports are optimized to provide the best streaming, non-blocking performance by tightly integrating the transport and mediation layers.

Camel + Tomcat depends on what ever the Tomcat transport support but I believe ESB PT and NHTTP transports are preforming efficiently here but i also don’t have any reference.  If you install Apache Camel on top of Apache Tomcat then you are not going to get the same performance and scalability.   The latest ESB performance benchmarks are posted for reference and replication.

 

 

Manisha EleperumaI/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond

I was continuously getting this error when trying to try out this code.


May 6, 2013 5:53:51 PM org.apache.http.impl.client.DefaultRequestDirector execute
INFO: I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond
May 6, 2013 5:53:51 PM org.apache.http.impl.client.DefaultRequestDirector execute
INFO: Retrying request
May 6, 2013 5:54:53 PM org.apache.http.impl.client.DefaultRequestDirector execute
INFO: I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond
May 6, 2013 5:54:53 PM org.apache.http.impl.client.DefaultRequestDirector execute
INFO: Retrying request
May 6, 2013 5:55:54 PM org.apache.http.impl.client.DefaultRequestDirector execute
INFO: I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond
May 6, 2013 5:55:54 PM org.apache.http.impl.client.DefaultRequestDirector execute
INFO: Retrying request
Exception in thread "main" org.apache.http.NoHttpResponseException: The target server failed to respond
at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:101)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:227)
at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:229)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:298)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:447)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
at QuickStart.main(QuickStart.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)

Finally after wasting about 5-6 hours of my time, :( found that this was due to an old HTTPClient jar. I had earlier used the version 4.0 org.apache.httpcomponents.httpclient. 
When upgraded this to 4.1, the issue got fixed. (source from a mail archive)

Madhuka UdanthaEnabling the HL7 Transport for WSO2 ESB

Posting is mainly for new WSO2 ESB Users and it is for basic users. Here I am using wso2esb 4.6.0 and here the location for download WSO2 Enterprise Service Bus
Start WSO2 ESB from wso2esb-4.6.0\bin\wso2server.bat or wso2server.sh
1. Browse for  https://localhsot:9443/carbon/
2. Login with admin and admin to ESB
3. In the Management Console, Go to Configure -> Features.
4. click Add Repository and add it.
image
Give Name for repo and give Location URL as "http://dist.wso2.org/p2/carbon/releases/4.0.5"
Or get dowload p2 http://dist.wso2.org/products/carbon/4.0.5/p2-repo.zip and give that local Dir
5. Install  Axis2 Transport HL7
This take some time
image

6. Then Restart
 image

Kathiravelu PradeebanSpring is here..

[06/05/2013] Lisbon - Weeks 35 & 36: As usual stuff are getting warmer, lately. Both the weather as well as the Erasmus Life. Project deadlines reaching. May is a special month. In Sri Lanka, May comes with heavy showers. But it brings the spring flowers here, in Lisbon. Weather is changing.

[01/05/2013] Amidst the busy schedule, I was still able to have a day off, on the May day! We took a boat from Cais do Sodre to Cacilhas. From Cacilhas, we took a bus to Costa da Caparica, a magnificent beach town of Setubal district from the Almada neighbourhood, at the other end of the river. Finally, we took a bus to Lisbon - Arreiro, after enjoying(?!) the still-not-warm water of the beach. It is pretty interesting to see how the two sides of the river differ from each other, by the roads, architecture, and transportation. This was the first time I travelled across the 25th April bridge. Last time, it was over the Vasco da Gama bridge for Freeport.

Project deadlines are reaching. Hope we will get some time for a short break after the 10th of May, to enjoy the spring!

Nirmal FernandoLoad Balancing WSO2 ESB 4.6.0 using WSO2 ELB 2.0.3 - Pattern I - Distributed Setup with Separate Worker/Manager Nodes

I wrote a WSO2 Wiki article on explaining the minimum configuration instructions required to configure WSO2 ESB in a distributed setup with separated nodes as management node and worker node/s.

Shown below is the deployment diagram of this setup. The cluster consists of two sub cluster domains as worker/manager and is fronted by a single load balancer. Altogether, we will be configuring three service instances.


You can download esb-worker-mgt-deployment-pattern-1.zip file for the sample configurations discussed there, for ESB 4.6.0.

Charitha KankanamgeTesting one-way operations which do not return HTTP 202 responses

When you invoke a one-way (in-Only) operation of a web service over HTTP, it responds with HTTP 202 accepted message. Many web service clients such as soapUI or Jmeter waits till they receive a response from the web service.
Waiting for HTTP 202 response is always not desirable since there are situations where you do not even get a 202 response. For example, if you invoke one-way JMS operation, it does not send a reply back to the client.
Look at a scenario similar to the following.

A client sends a message over HTTP to a proxy service in WSO2 ESB. The proxy service places the message in a JMS queue and does not expect a response back. In this case, client does not even get a HTTP 202 response hence it waits and eventually timed out. This prevents you using the tools like soapUI, Apache Jmeter in these scenarios. How can we fix this so that the client always get a HTTP 202 response back?

Let's go through the procedure in detail.

Step 1:

Configure Apache ActiveMQ JMS broker with WSO2 ESB as explained here.

Step 2: 

Create a queue in ActiveMQ. You could access ActiveMQ console application through http://localhost:8161/admin and create a new queue. Name it as "onewaytest".

Step 3: 

Create a simple proxy service in WSO2 ESB as shown below. This proxy service just forwards the incoming SOAP messages into the "onewaytest" JMS queue which we have created in the previous step.

<proxy xmlns="http://ws.apache.org/ns/synapse" name="onewayProxy" transports="http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint>
<address uri="jms:/onewaytest?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description></description>
</proxy>


Step 4:


Use soapUI (or SOAP/XML-RPC sampler in Apache Jmeter) and send a SOAP request to the above proxy service. You will get "java.net.SocketTimeoutException: Read timed out" in soapUI log. This explains the behavior of HTTP client waiting for HTTP 202 response.

Step 5:


There is an useful property, FORCE_SC_ACCEPTED which can be used inside the inSequence of the proxy service to send HTTP 202 Accepted response back to the client in case of one-way JMS operations.

Add this property to the inSequence of the above proxy service.

<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2" />

Step 6:


Re-send a SOAP message to the proxy service using soapUI. You will get a HTTP 202 response.


HTTP/1.1 202 Accepted
Content-Type: text/xml; charset=UTF-8
Date: Sun, 05 May 2013 07:42:27 GMT
Server: WSO2-PassThrough-HTTP
Transfer-Encoding: chunked



Nandika JayawardanaHow to implement your own task UI on top of WSO2 BPS Human Task Engine


Human Tasks is a specification which helps us define tasks performed by human beings. From an SOA point of view, we can view a Human Task as a service implemented by a human being.

WSO2 Business process server (WSO2 BPS ) 3.0.0 version includes an evolving initial implementation of a Human Task Engine. It provides the basic human tasks functionality such as the ability to define human tasks and notifications, timer events and escalations, and the people assignments.

Also within its implementation, WSO2 BPS provides its own task UI. However, as this task UI is included within the Administrative console of the server, we do not encourage one to use it. Instead, what we expect from a serious human tasks user is to build his own task ui using what ever the user interface implementation methodology that is used within the organization. This could be done using technologies such as JSP, PHP ect. As long as you have a way of sending out soap messages, you can build your own task ui. In the following section, I will describe how to build your own task UI.

In order to  implement your own task UI, you need to understand how the Human task engine works.
A human task package will include at least one WSDL file which defines the ‘task service’ which is the service implemented by human being. In order to create a task, this task service should be invoked by an external party. This external party can either be an external web service invoker or a bpel process using Bpel4People extension activity.  When a task instance is created, it will have its own unique task id which will be returned to the task invoker. Additionally, this task id can be obtained by using the simpleQuery operation which returns a list of tasks. When your perform operations on the task, this unique task id is used to identify the specific task instance among the many task instances residing within the task engine.

Human Task specification describes the human tasks client api in detail in Chapter 7 Programming interfaces. [1] http://docs.oasis-open.org/bpel4people/ws-humantask-1.1-spec-cs-01.html

WSO2 BPS human tasks implementation also implements the same API. In order to successfully call this task client api, first we need to find out the admin service interface for it.

Step1.

Go to carbon.xml located in <BPS_HOME>/repository/conf/ directory.

Change the setting <HideAdminServiceWSDLs>true</HideAdminServiceWSDLs> to false.
<HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>

Now start the bps server with option –DosgiConsole.

Once the server is fully started, enter to go to osgi console.

Now type listAdminServices in osgi console.

osgi> listAdminServices

This will list down all admin services.

Our interested endpoint is

HumanTaskClientAPIAdmin,https://<ip>:9443/services/HumanTaskClientAPIAdmin/

Usually, when you try ?wsdl on this endpoint, the wsdl will appear. However, there is an issue with the HumanTaskClientApi WSDL. Hence please download the wsdls from following location. http://people.wso2.com/~nandika/htwsdl/

Step2.

Create a soap ui project from the human_task_api.wsdl. Your soap ui project will show the task operations available as following.

image

Now, we can use this soapui client to query the human task client api to obtain the necessary information about tasks. By this method, we can explore the available operations to build our own custom ui.
However, this service is an authenticated service. Therefore, first you need to obtain the session cookie returned by the authentication admin login request and set it as an http header in the soap ui. Please refer to my previous blog on how to set the session cookie.


Step 3.

Do the authentication admin login request and copy the returned session cookie.

image

Using the session cookie, send the simple query request with Filter ALL_TASKS to obtain a list of all tasks.
Use the following soap message for that.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803" xmlns:ns1="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/types/200803">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:simpleQuery>
         <ns:simpleQueryInput>
            <ns1:simpleQueryCategory>ALL_TASKS</ns1:simpleQueryCategory>
         </ns:simpleQueryInput>
      </ns:simpleQuery>
   </soapenv:Body>
</soapenv:Envelope>

This should return a list of currently available tasks.

image

Now iterate though the task list and use load task method with the task id to load individual tasks.
Use following soap message.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:loadTask xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803">
         <ns:identifier>8405</ns:identifier>
      </ns:loadTask>
   </soapenv:Body>
</soapenv:Envelope>

This would return all information about the given task.

image

After you have obtained this data, you can use operations such as start, stop , claim, complete ect with the task id and corresponding xml message.

For example, start task request would look like the following.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:start xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803">
         <ns:identifier>8405</ns:identifier>
      </ns:start>
   </soapenv:Body>
</soapenv:Envelope>

Additionally, you can refer to the human task ui jsp pages of BPS to get more details.
https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.0.0/components/business-processes/humantask/org.wso2.carbon.humantask.ui/4.0.5/src/main/resources/web/humantask

Ganesh Prasad"What Are The Drawbacks Of REST?"


It seems the season for me to post comments in response to provocative topics on LinkedIn. 

A few days ago, Pradeep Bhat posed the question, "What Are The Drawbacks Of REST?" on the REST Architects LinkedIn Group. As before, I had an opinion on this too, which I reproduce below:

"I wouldn't say REST has "drawbacks" as such. It does what it says on the tin, and does that very well. But remember that the only implementation of the REST architecture uses the HTTP protocol. We can surely think of a future RESTian implementation that uses another transport protocol, and that is where some improvements could be made. 

1. HTTP is a synchronous, request/response protocol. This means the protocol does not inherently support server-initiated notifications (peer-to-peer), which are often required. That's why callbacks in RESTian applications require the use of application-level design patterns like Webhooks. Now that we have a bidirectional transport protocol in the form of WebSockets, perhaps the industry should be looking at layering a new application protocol on top of it that follows RESTian principles. 

2. The much-reviled WS-* suite of protocols has at least one very elegant feature. These are all end-to-end protocols layered on top of the core SOAP+WS-Addressing "messaging" capability. They resemble the TCP stack in that the basic protocol is IP, which only knows how to route packets. SOAP messages with WS-Addressing headers are analogous to IP packets. In the TCP world, end-to-end reliability is implemented through TCP over IP, and the SOAP world's analogy is WS-ReliableMessaging headers in SOAP messages. In the TCP stack, IPSec is the end-to-end security protocol (not TLS, which is point-to-point). The SOAP equivalent is WS-SecureConversation. Such Qualities of Service (QoS - reliability, security, transactions) can be specified by policy declaration (WS-PolicyFramework) and SOAP endpoints can apply them like an "aspect" to regular SOAP traffic. 

The REST world has nothing like this. Yes, an argument could be made that idempotence at the application level is a better form of reliability than automated timeouts and retries at the transport level. Similarly, we could argue that an application-level Try-Confirm/Cancel pattern is better than distributed transactions. But what remains is security. WS-SecureConversation with WS-Security is routable, unlike SSL/TLS, which is the only security mechanism in REST. With WS-Sec*, messages can also be partially encrypted, leaving some content in the clear to aid in content-based routing or switching. This is something REST does not have an elegant equivalent for. SSL is point-to-point, cannot be inspected by proxies and violates RESTian principles. It is just tolerated. 

The reason behind REST's inability to support such QoS in general is that all of these require *conversation state* to be maintained. Statefulness has known drawbacks (i.e., impacts to scalability and failure recovery), but with the advent of NoSQL datastores like Redis that claim constant-time, i.e., O(1), performance, it may be possible to delegate conversation state from memory to this datastore and thereby support shared sessions for multiple nodes for the purposes of QoS alone. I don't mean to use this for application-level session objects like shopping carts. If nodes can routinely use shared NoSQL datastores to maintain sessions, then the argument against statefulness weakens, and Qualities of Service can be more readily supported *as part of the protocol*. In RESTian terms, we can have a "uniform interface" for QoS.

3. While REST postulates a "limited" set of verbs, HTTP's verbs are too few! 

POST (add to a resource collection), PUT (replace in toto), PATCH (partially update), DELETE (remove from accessibility) and GET. These are actually not sufficient and they are frequently overloaded, resulting in ambiguity. 

I would postulate a more finely-defined set of verbs if defining a RESTian application protocol over a new peer-to-peer transport: 

INCLUDE (add to a resource collection and return a server-determined URI), PLACE (add to a resource collection with client-specified URI), REPLACE (in toto), FORCE (PLACE or REPLACE), AMEND (partial update, a container verb specifying one or more other verbs to specify operations on a resource subset), MERGE (populate parts of the resource with the supplied representation), RETIRE (a better word than DELETE) and SOLICIT (a GET replacement that is also a container verb, to tell the responding peer what to do to the initiator's own resource(s), because this is a peer-to-peer world now). Think of GET as a SOLICIT-POST to understand the peer-to-peer model. We also need a verb of last resort, a catch-all verb, APPLY, which caters to conditions not covered by any of the others. 

4. HTTP combines application-level and transport-level status codes (e.g., 304 Not Modified and 400 Bad Request vs 407 Proxy Authentication Required and 502 Bad Gateway). The next implementation of REST on another transport should design for a cleaner separation between the application protocol and the transport protocol. HTTP does double-duty and the results are often a trifle inelegant. 

So that's what I think could be done as an improvement to REST-over-HTTP. Apply the principles (which are very good) to a more capable peer-to-peer transport protocol, and design the combination more elegantly."

I'm in the process of writing an Internet Draft for a new application protocol that can be bound to any transport (Pub/Sub, Asynchronous Point-to-Point or Synchronous Request/Response). The protocol is part of a new distributed computing architecture that I call ROMA (Resource/Representation-Oriented Messaging Architecture) and covers not just the data model and message API but also higher levels (QoS, description and process coordination). It's been 5 years in the making and has reached 170 pages so far. It may take another couple of months to get to a reviewable state. Stay tuned.

Adam FirestoneParallel Tracks: National Cyber Security Policy and the Implementation of Secure Software

When it comes to cyber operations, we’re finally on target with respect to policy.  Practical implementation is another matter.  Fortunately, there is a way ahead, and one that leverages open source offerings to control cost and increase availability.

On 26 April 2013, the Associated Press published a story proclaiming that American military academies are “grooming future officers for warfare in cyberspace.”  The article highlighted the increased emphasis being placed on cyber operations by the US Department of Defense, quoting a recently commissioned US Air Force officer who had given up plans to become a fighter pilot:  ““It’s a challenge, and for people who like a challenge, it’s the only place to be.”

Inspirational as Lieutenant Keefer’s story is, the reality is that American military cyber-preparedness is still in its infancy. It was only in 2012 that US Naval Academy began requiring freshmen to take a cybersecurity course, or, for that matter offered a cyber operations major.  Upper classmen will not be required to take additional cyber-focused courses until 2014.  A statement made by the Academy’s superintendent, Vice Admiral Michael Miller, that “There’s a great deal of interest, much more than we could possibly, initially, entertain” indicates not only student interest but, troublingly, a lack of resource allocation. 

Combined, the lack of resourcing and the relatively small academic emphasis placed on cyber operations paint a very different picture than the publicized student enthusiasm.  It’s the military; commanders and leaders have broad latitude to make rapid, sweeping changes when subjected to the demands of either politics or tactical realities.  Today, the United States has a modular Army, women are authorized to serve in combat roles and a service member’s sexual orientation is a non-issue. 

What we do not have is a cohesive national cyber operations policy that addresses force structure, operational doctrine, the implementation of information assurance policies and the cyber-operations education of leadership in the acquisitions, training, doctrine and operational communities.  Compounding the problem is an inability to attract the necessary talent to the nation’s premier cyber defense organization, US Cyber Command.  According to a recent Defense News article, Cyber Command is still nearly 4,000 personnel short of the “a proper cyber force to adequately give capability to the national command authorities, to the COCOMs (Combatant Commands), and defend the nation.”

Fortunately, there is broad recognition at the policy-making level of the need to harden not only the national defense cyber posture, but that of critical commercial infrastructure as well.  Conferences such as the recent International Engagement on Cyber, held at Georgetown University, and the upcoming Government Cybersecurity Forum, are well attended by government, industry and academia.  Everyone agrees as to the nature of the threat and the need for both proactive and reactive response.  Agreement at the policy level, however, is not the same as the implementation of concrete measures and technologies that mitigate the dangers inherent to today’s connected environment.  

Complicating matters is the fact that all implementations aren’t equal.  Setting a standard is not the same as implementing.  Implementing on a scale and cost applicable to large business or government is often not feasible for small or medium business.  And implementations that adversely impact productivity are bound to be resisted by organizations operating under temporal and/or fiscal constraints.  And in the defense and intelligence sector these days, everyone operates under increasingly tight temporal and fiscal constraints.  In the end, it often seems that the only acceptable cyber defense implementations will be ones that are temporally transparent to users and, as much as possible, fiscally transparent to managers and executives at operating organizations.

Fortunately, there is a path ahead for organizations seeking such a transparent defense.  More accurately, there are two paths ahead, one that addresses runtime concerns and another that addresses design-time issues.

Runtime Concerns

Runtime for modern distributed systems is characterized by a constant flow of message traffic between system components.  Typically, a message represents a request for a resource, such as a particular data entity or processing capability.  These messages may adhere to any of a number of standards.  At the most basic level, securing such an environment requires the validation of the identity of a message sender against a predefined list of users (human or machine) who are permitted to make requests against system resources.  This identity validation, or authentication, may take many forms, such as the provision of a valid username and password pair, of a valid digital certificate or of a valid biometric signature.

Authentication on its own is not a strong enough security mechanism.  Alone, it creates an environment where any authenticated user can access any system resource.  The Wikileaks breach resulted from just such an environment.  To harden systems, an access control, or authorization, scheme is often added to the authentication scheme.  When properly applied, authorization mechanisms ensure that the principle of minimum privilege is applied.  That is, that authenticated users have access to only those system resources consistent with and necessary for their job duties.  The authorization scheme preferred by the US Department of Defense (DoD) is called Policy Based Access Control (PBAC). (PBAC is synonymous with Attribute Based Access Control (ABAC)).

In a PBAC scenario, an authenticated user makes a request for a resource.  The request is halted by a systemic gate guard or enforcement point.  The enforcement point requests an access control decision from a decision making point.  The decision maker evaluates information about the requestor and the resource with respect to a predefined access control policy and renders a decision, which is relayed to the enforcement point.  The enforcement point implements the decision as either a go or a no-go for the request.

The PBAC scenario happens transparently with respect to the user. Importantly, with the incorporation of modern interface definition languages such as Apache Thrift, very little system latency is generated with the additional access control processing.  PBAC is usually implemented through the use of open standards such as the eXtensible Access Control Markup Language (XACML) and the Security Assertion Markup Language (SAML).  PBAC implementations are in use with government, military and commercial enterprises throughout the world.

As can be seen, PBAC helps to ensure the core information security principles of confidentiality (only authorized users have access to the requested resources), authenticity (only properly authenticated users can make requests for resources) and non-repudiation (the resource request is tied to a specific, authenticated user).  What PBAC doesn’t do is help to ensure message integrity or system availability.    As noted, the core of distributed (and that includes service oriented or Cloud-based) systems is the exchange of messages. It’s not difficult to imagine a scenario where legitimate messages contain a malware payload, a problem not addressed by traditional PBAC implementations. 

However, the PBAC architecture provides a useful archetype for addressing this threat.  PBAC is premised on the primary gate guard, or enforcement point.  This mechanism stops – or mediates - all incoming requests for an access control check.  (Mediation is a standard data processing pattern where by data in transit is operated upon before it arrives at its final destination.) 

Instead of conceiving of a PBAC scheme as THE security gateway, architects could conceive of it as phase one mediation of the security gate way process.  Upon successful authorization mediation, the request would pass to phase two mediation, where it would be scanned for malware payloads.  Clear messages would be allowed to proceed, while infected messages would be quarantined and the administrator notified.

Design Time Concerns

For systems earmarked for use by government or military organizations the completion of coding and functional testing is not, to paraphrase Winston Churchill said, the end. It is not even the beginning of the end.  It is merely the end of the beginning. Following the development effort, the system is turned over to a certification and accreditation (C&A) process that can take up to eighteen months and cost more than a million dollars.  The C&A process is meant to ensure that the system complies with applicable security paradigms and standards and that it is appropriately hardened. 

Problematically, the C&A process often creates a laundry list of security holes that must be patched prior to acceptance.  This can result in developers closing only gaps noted, and not truly securing the system.  Cybersecurity, in this case, becomes an overlay, not something that was “baked into” the system from the beginning.  What’s really needed is a way to demonstrate that cybersecurity and information assurance requirements are met by the software as it is being developed.

In this case, the defense industry could take a page from commercial industry’s DevOps community.  DevOps principles stress continuous delivery.  In order to achieve continuous delivery, everything possible must be automated, allowing the achievement of continuous development, continuous integration and continuous test.  The critical elements for addressing the defense C&A process are continuous, automated test and integration.  In this environment, not only the software functionality but also the organization’s governance principles are embodied in the automated test regime.  For the defense community, these principles include the cybersecurity and information assurance requirements flowing from DoD Directive 8500.01E (and related documents).

The objective DevOps environment would be instantiated with governed, distributed, Cloud-based development platform.  In this environment, when a developer checks in a code module, it is automatically tested against not only functional requirements, but security (and interoperability and performance) requirements embodied in the DevOps platform’s test regime.  If it doesn’t meet all of the requirements, it is rejected, and the developer is provided a report indicating why the module failed.  The implications of such an environment are significant.  Potentially, the only mechanism that needs to be formally certified and accredited is the DevOps platform. Any software issuing from that trusted platform would be automatically certified and accredited.  As the platform could be certified independently and prior to the commencement of development activities, no independent C&A test period would be necessary for the delivered system, and fielding could begin as soon as the coding was complete.  This would add an unprecedented level of agility to the defense software acquisition process.

The advantages are magnified when the emerging government and defense mobile environments are considered.  A program might produce dozens of apps each month.  Currently, the C&A overhead associated with such a volume of independent software deliveries is, simply, crushing.  A certified, governed, DevOps style development environment would allow the rapid and continuous delivery of trusted, certified apps.

Affordability

Software packages for organizations seeking to implement transparent, effective cyber-defense mechanisms in both runtime (PBAC + malware mediation) and design-time environments exists today.  The savvy program manger’s first question will – and should – be “How much is this going to cost me?”  The short answer is that there doesn’t have to be any acquisition cost at all. 
A good example of the runtime solution is the WSO2 Security and Identity Gateway Solution.  This solution is an implementation pattern the leverages standard SOA components including an enterprise service bus (ESB), a governance registry, a business activity monitoring tool and an identity and access management (IdAM) management component to deliver:

  • Centralized authentication;
  • Centralized PBAC;
  • Collaboration between different security protocols;
  • Throttling;
  • Standards-based single sign on;
  • Caching;
  • Content based filtering; and
  • Schema based input validation.
An example of the design-time solution can be seen in the WSO2 App Factory.  App Factory is a governed, distributed development environment designed from the ground up to operate in the Cloud.  Effectively, it is a DevOps Platform-as-a-Service (PaaS).  It provides complete application lifecycle management in a manner consistent with organizational policies and governance.  It does so in a completely automated manner, while maintaining man-in-the-loop control.  Specific capabilities include:

  • Product and team management;
  • Software development workflow;
  • Governance and compliance;
  • Development status monitoring and reporting;
  • Code development;
  • Issue tracking;
  • Configuration management;
  • Continuous build;
  • Continuous integration;
  • Continuous automated test; and
  • Continuous deployment.
All of WSO2’s products are 100% open source, and as a result, there are no licensing fees.  The open source promise doesn’t stop there, of course.  For example:  SUSE provides a complete, open source enterprise Linux operating system as well as a Cloud environment.  PostgreSQL provides an enterprise level, spatially enabled database.  The Apache Accumulo project offers a highly scalable, fast and secure NoSQL product.  All of these products are free – as in both beer and speech.

Conclusion

An overall national policy with respect to cyber operations (and cyber warfare) remains an ongoing effort.  This does not obviate the ongoing threat posed by both nation-states and non-state actors, nor should it prevent proactive member of the defense community and commercial industry from adopting software development and implementation patterns that dramatically improve an organization’s security.  Such patterns can be implemented both rapidly and cost effectively through the use of readily available open source products. More importantly, they can be implemented in such a way as to minimize disruption to the user and the organization.


Chris HaddadNew IT model

A New IT model is required to reduce delivery time and accelerate business agility.  The New IT Delivery model strives to achieve open collaboration, micro-iterations, no wait states, and streamlined processes.

 

How are you building a pragmatic, open source driven game plan that incorporates New IT approach vectors?

 

The path to New IT requires incrementally moving away from traditional application platforms, traditional team structure, and traditional information flows.  The New IT architecture underlying Responsive IT intelligently incorporates Cloud Platforms, BigData Analytics, Enterprise DevOps, and API first development.

In a New IT operations model, instead of being a single-purpose delivery team, IT serves as a broker and validator of solution building blocks.  IT focus and responsibility shifts towards creating an ecosystem delivering composable and reusable IT capabilities.   Project teams can access open APIs, services, business processes, open data, and applications to compose the assets into new solutions.  The operations model safely shifts

the center of project responsibility to project individuals and business units while maintaining IT as a more valued business partner.   IT maintains responsibility for policy compliance, serves as a trusted technology advisor, and mentors teams on IT capability usage.  Corporate IT delivers ‘solution accelerator packs’ that decrease time to market, reduce development hurdles, and cost effectively implements corporate policy.

 

To build a New IT delivery model, adopt a platform supporting cloud integration, cloud run-time, cloud DevOps, application services governance, API and mobile enablers.

New IT Delivery Accelerates Connected Business Agility

Figure 1: Building Blocks of a New IT Delivery model driving Connected Business

 

Cloud run-time platforms with shared container resource pooling, elastic load balancing, and on-demand scalability provide an efficient deployment environment that enables solutions to target low usage or low margin business opportunities.

 

Cloud DevOps changes the IT operating model to one of continuous innovation based on micro-iterations.  Teams adop continuous integration, continuous test, and continuous deployment practices.  The practices rely on dynamic provisioning and infrastructure as code to automate activities and provide self-service access.

 

Application Service Governance is required to create a trusted environment that encourages adoption.   By introducing deployment synchronization, service level management, and automated governance, teams foster open collaboration across internal development teams, business units, and partners.

 

Enabling mobile apps and prolific API-first development requires an API management platform offering API promotion, API self-service subscription, and mobile access.

 

Cloud integration augments enterprise integration by offering self-service access, cloud connectors, federated identity, and multi-tenancy.

 

Adopting a New IT delivery model and changing the IT-business dynamics is not an easy task.  Traditionally, application platforms have inhibited change, blocked agility, and discouraged best practices.  Platform as a Service offerings delivering DevOps, Analytics, Integration, and Governance best practices provide a viable ramp onto the path to responsive IT.

 

PaaS Venn Diagram

Figure 2: Platform as a Service Focus Areas connect IT domains

 

Recommended Reading

Open Source Business Conference Impressions

New Enterprise IT Drivers

A Path to Responsive IT

A New IT Plan

New IT Steps to Accelerate Agility

Madhuka UdanthaMerging a pull request in Github

Lot of time pull request cannot be merged online due to conflicts. If no Conflict it is easy for you to do merging, from even in web with a one click.

image

 

Confirm the merge

image

 

If the pull request cannot be merged online or you wish to test things locally before sending the merge to the repo on Github, you can perform the merge locally instead.
This post will explain subject using GitHub project for this task under windows with tool tortoisegit[1]

1. Open your local repo (make pull the repo from git.)

2. Check out the branch you wish to merge to

git checkout master

image

3. Pull the desired branch from the other user's repo
git pull https://github.com/otheruser/repo.git branchname

image

4. Resolve any conflicts and commit the merge and review the changes and ensure they are satisfactory

image

5. Push the merge to your GitHub repo
git push origin master

image

[1] https://code.google.com/p/tortoisegit/

Srinath PereraSolving DEBS 2013 Grand Challenge with WSO2 CEP/Siddhi

ACM International Conference on Distributed Event-Based Systems (DEBS) is one of the primary venues for Complex Event processing related research. Every year, they provide a grand challenge that challenges the participants to solve an event-based problem.

This year we are also competing, and following are some of our experiences while doing it.

This year grand challenges is to process events generated in a football game and answer four queries related to the game in streaming fashion. Both the player’s shoes and ball had sensors, and as the game continues, it generates about 15,000 events per second. Each event includes the location (x,y,z), time stamp, velocity and acceleration of the sensor. You can find more information from http://www.orgs.ttu.edu/debs2013/index.php?goto=cfchallengedetails. Complete dataset is 49 million events.

There are four usecases. I will explain each and tell bit about how we implemented them. To understand the queries, you need to know the Siddhi Event query language. Following is a crash course.

from <name of the event stream1>[condition on event], 
<name of the event stream2>[condition on event],
<name of the event stream3>[condition on event] …
select <values to extracted from matching events>
insert into <name of the event stream to send results>
Here the comma separated conditions define an event sequence. That is the query matches when those conditions have matched in the given order by the incoming events.

We worked with two streams: Players – events from players and BallStream – events from the ball.

Usecase 1: Running analysis 

The first usecase measures each player’s running speeds and calculates how long he spent on different speed ranges. For example, results will tell that the player "Martin" is running fast from the time 27 minutes and 01 second of the game to 27 minute and 35 second of the game.

We have implemented this usecase by using CEP event sequences to detect whenever a player crossed a threshold of event speeds using a query like following.

define partition player by Players .id
from s = Players [v <= 1 or v > 11] , 
    t = Players [v > 1 and v <= 11]+ , e = Players [v <= 1 or v > 11]
select s.ts as tsStart , e.ts as tsStop ,s.id as playerId , 
    ‘‘trot" as  intensity , t [0].v as   instantSpeed , 
    (e.ts - s.ts )/1000000000 as  unitPeriod
insert into RunningStats partition by player
Query define sequence of conditions. For example,  Players [v <= 1 or v > 11] means velocity range in events received in player event stream. Siddhi invokes the callback when those conditions are met.

Here “+” point to one or more occurrences similar to regular expressions. You can find more information about Siddhi language from Siddhi Language Specification. We wrote a query for each speed range, found the time stamps of speed range changes, and calculated the final result.

Here event partitions partition the events by some condition before processing it. Above query partition events by the player.

Usecase 2 & 4: Ball Possession and Shots on Goal 

 For the second use case, we need to calculate the time each player controlled the ball (ball possession). A player controls the ball from the time he hit the ball until someone has hit the ball, ball goes out of the ground, or game is stopped. We identify hits when a ball is within one meter of a player and its acceleration increases by more than 55ms-2.

The usecase four is to detect hits and emit events if the ball is going to the goal.

We implemented both using event sequences, and following are the queries. Here fuctions like debs:isGoingToGoal(..) and debs:getDistance(..) are java custom functions we wrote and registered with Siddhi.

 Following query detects the hits.

from Ball#window.length(1) as b join 
Players\#window.length(1) as p unidirectional
on debs:getDistance(b.x,b.y,b.z,
p.x, p.y, p.z) < 1000 and b.a > 55
select p.sid, p.ts, p.x, p.y, p.z, p.a, p.pid,p.tid,
b.sid as ballSid
insert into hitStream
Following query detects the event streams while a player is in control of the ball.   

from old = hitCountStream, 
b = hitCountStream[old.pid != pid ],
n=hitCountStream[b.pid == pid]*,
e1 = hitCountStream[b.pid != pid ]
or e2=ballLeavingHitStream
select b.pid as playerId, b.tid as teamId,
b.ts as startTs,
coalesce(e1.ts ,e2.ts) as endTs,
coalesce(e1.cnt ,e2.cnt) as counter1,
b.cnt as counter2
insert into BallPossessionStream

following query detects hits at the goal.

from s = hitStream, 
t = Ball[debs:getDistance(s.x,s.y,s.z,
x, y, z) < 1000]+,
e = Ball[debs:isGoingToGoal(s.tid,x,y,z
,a,v,vx,vy,vz,s.ts,ts) == 1.0]+,
h = Ball[debs:isGoingToGoal(s.tid,x,y,z,
a,v,vx,vy,vz,s.ts,ts) == 0.0]
or l=ballLeavingStream
select s.ts as startTime, e[0].ts, s.pid,
s.tid, 'on' as mode "
insert into ShotOnGoalStream

Usecase 3: Heatmap of Activity 

Usecase three divides the ground to a grid, and calculate the time a player spends on each cell. However, this usecase needs updates once every second. First part we can solve just like with the first usecase, but to make sure we get an event once a second, we had to couple it with a timer.

The queries are given below, and you can find the explanation from the paper. Following query detects when a player has changed the cell.

from r=PlayersCell, 
s = PlayersCell[cell!=r.cell]
select r.pid as playerId, s.ts as time, s.x, s.y,
s.cell as newCell,r.cell as oldCell,
s.tsms as timems, 'ball' as type
insert into r4CellChanges partition by player
Following query join the events with 1 second timer.
from timer1s unidirectional 
join PlayersCell\#window.unique(pid) as c
select c.pid as playerId, timer.ts as time, c.x,
c.y, c.cell as newCell, c.cell as oldCell,
timer.tsms as timems, 'timer' as type
insert into r4CellChanges
Following query use results from above two queries and calculate the time spent on each cell.   

from s=region4cellChange, 
e=region4cellChange[s.newCell==oldCell]
select s.playerId, e.timems as endTimems,
e.time as ts, s.x, s.y,
e.time- s.time as time,
s.newCell as cell, e.type
insert into r4CellStay partition by player

We were able to get about 50,000 events per second for usecase 3 and more than 100000 event per second with other usecases on a 4 core, 4G VMware virtual machine. This is about three times the required rate of 15000 events, which we believe to be impressive. Also this shows that Siddhi EQL can naturally fit such a complex scenario into queries, and they provide a nice higher level abstraction to think about the problem.

Hope this was interesting. Implementing the actual scenarios included more queries to calculate all the details,  but above presents the basic idea.

If you like to try out WSO2 CEP/ Siddhi you can find it from http://wso2.com/products/complex-event-processor/.

You can find an introduction to Siddhi from http://srinathsview.blogspot.com/2011/12/siddhi-second-look-at-complex-event.html 

Ganesh Prasad"Can Anyone Explain SOA In Simple Terms?"


A few days ago, David Diamond posed a deceptively simple question on one of the LinkedIn Group sites (SOA SIG) - "Can Anyone Explain SOA In Simple Terms?"

The barrage of widely varying responses that followed was, in a way, an eloquent answer to that question!

I've had my own take on SOA for quite a while now, so this gave me the opportunity to validate my model against what other practitioners had to say. And I must say this: I'm more convinced than ever that the industry is horribly confused about SOA. There are those whose understanding of SOA is at a purely technology level (even some of those who profess to understand that SOA is not (just) about technology). And there are others who may understand SOA for all I know, but whose explanations tend to be couched in so much jargon that they're really hard to understand.

In hindsight, David Diamond could not have asked a more insightful question.

Well, this is my blog, so just as history is written by the victors, the one correct answer to David's question is to be found here :-).

Here's what I wrote (put together from more than one post that I made to that topic):

My initial one-paragraph answer: "SOA is the science of analysing and managing dependencies between systems. That means the elimination of unnecessary dependencies and the formalisation of legitimate dependencies into readily understood contracts. The more dependencies there are between systems, the less agile an organisation is (because of the number of related systems that have to change when one of them has to change), the higher its operating costs (because of all the unnecessary extra work to coupled systems) and the higher its operational risk (because of the number of things that could break when something changes). Dependencies exist at all of the BAIT layers - Business, Applications, Information (Data) and Technology. That's why a technology-only view of SOA does not solve an organisation's real problems. SOA should have been called DOT instead ("Dependency-Oriented Thinking")."


After a few days of reading other responses and feeling dissatisfied, I posted again:


"Many of the comments here emphasise reuse as part of the *definition* of SOA. Is reuse a core feature of SOA or just a side-benefit? If the latter, what are SOA's defining features (which is what the original question was about)? Also, while we use the word "services" a lot, how do we define the term?

Let me try and address these two points.

SOA is an organising principle for the enterprise, and the fundamental skill that an architect requires to apply this organising principle is the ability to see dependencies between systems, - to be able to eliminate the ones that shouldn't exist and formalise the legitimate ones into "contracts" maintained in a single place and covering all the dependencies between two systems. This approach greatly reduces the cost of change, improves the speed with which changes are made (agility) and reduces the risk of making changes, all because the number of dependencies (aspects of an interaction affected by a change) are now smaller, one can tell at a glance what they are, and there are no surprises because there are no dependencies outside what is documented by the contract. This is not limited to technology interactions. One can apply this thinking to the design of business processes just as naturally.

When we look through a dependency lens at an organisation, our tasks are quite distinct at its four layers (Business, Applications, Information (Data) and Technology).

At the Business layer, it is more of a BPR (Business Process Re-engineering) exercise, because we end up rationalising processes when we weed out unnecessary dependencies. When we finish, we have a traceability matrix linking the following:

Vision (Our idea of Utopia)
Mission (Our strategy to bring about that Utopia)
Functions (The main groups of activities we need to be doing as part of that strategy)
Processes (The detailed and related sequences of steps comprising each function)
Process Steps (The basic building blocks of these processes)

[At the business layer, we will come across some *potential* reuse when we look at the definition of some of the Process Steps (operations) we arrive at. Only further analysis at the Information layer will tell us if reuse is actually possible or these are independent operations.]

The Application layer is all about grouping "related" operations, and the dependency principle used is that of "cohesion and coupling". In other words, we need to determine which process steps belong together and which do not. This cannot be done independently but must involve the Information (data) layer as well. [That's why architectural frameworks like TOGAF combine the two into a single step (Phase C)].

The Information layer looks at data dependencies (shared models) and classifies data into two groups - "data on the outside" and "data on the inside". "Data on the inside" is the set of internal domain models for operations that other operations do not need to see. "Data on the outside" is what goes "over the wire" between operations.

When we apply the dependency principle of cohesion and coupling to the combined Application and Information layers, we have two ways of grouping operations together. Operations that share a domain model ("data on the inside") coalesce into Applications that are called Products. Operations that share an interface data model ("data on the outside") coalesce into Applications that are called Services. So this is where Services fit into SOA - as a bundle of related operations sharing an interface data model.

The Technology layer deals with "implementation". As others have pointed out as well, implementation need not have anything to do with SOAP, ESBs, etc. We need distinct components to host implementations of exposed operations (Service Containers), to mediate interactions (Brokers) and to coordinate operations (Process Coordinators). Other components merely support these (Rules engines, registries, monitoring tools).

This is SOA :-)."


I would have posted more, but I exceeded the word count for the site, so I had to post my thoughts about the Technology layer separately:


"I must add that when viewed through a dependency lens, the Technology layer often introduces artificial dependencies of its own. There is a reason why many people prefer REST to SOAP. It's because WSDL is a dependency hotspot. Think about it. If a WSDL file describes just one service, and that service comprises 5 operations, each with an input document and an output document, then the version of the WSDL file has a dependency on the version of 10 document schemas. If any one of them changes, the WSDL will have to change! That's why we have so much version churn in organisations.

In addition, because we don't build explicit interface data models with type hierarchies, our operation interfaces are too rigid and low-level, requiring a fresh *version* whenever a new *variant* is to be supported.

A second major dependency introduced by the technology layer is through the ESB, or more correctly, through incorrect use of the ESB. The dependency principle at the Technology layer is to use the right tool for the job and to use it the right way. If we use the ESB to host business logic, we are making it perform the role of a Service Container. If we use the ESB to orchestrate a process, we are making it perform the role of a Process Coordinator. Both of these mistakes create dependencies that reduce performance and increase the cost of change. 

The other ESB-related mistake is its deployment in a hub-and-spokes architecture. Then the ESB becomes both a performance bottleneck and a single point of failure - both symptoms of a needless topological dependency that was created at the Technology layer. IT organisations often ask for funds to buy an ESB because they want to "do SOA", then implement it in a topology that creates dependencies and thereby violates SOA principles. What an irony! 

So one of the reasons why SOA has acquired a bad name is that its practice often introduces dependencies at the Technology layer even as it tries to reduce dependencies at the Business, Application and Information layers. Worse, because organisations are often too technology-focused, they don't do enough of the dependency-reduction at these higher layers and their net effect is to introduce new, technology-related dependencies to an existing set of business processes and data structures. The net effect of SOA on such organisations is then entirely negative.

I'm in the process of writing a white paper on "Dependency-Oriented Thinking" based on my experiences with SOA in large organisations. Stay tuned :-)."


Well, this represents my current thinking about SOA in a nutshell (a fairly large nutshell, I'll grant). The coming white paper on Dependency-Oriented Thinking will elaborate on these points. The workshops on "Dead Simple SOA" that I've been conducting through my company (Eigner Pty Ltd) along with my colleague Rahul Singh, address these very topics.

Nandika JayawardanaDeveloping a Business Process with a Correlation Set Using WSO2 Developer Studio


In the example, we will explore how to use correlation sets to route a message to an existing instance of a business process. We are going to use the simplest possible BPEL process. An Echo Process which will accept the same request message twice. Following is a sequence diagram for the sample use case.
clip_image001[5]

Since the second EchoRequest can either create a new instance of the EchoProcess or be routed to a previously created instance of EchoProcess, we require a correlation set.

CorrelationSet ,Property and property Alias.

A CorrelationSet is some unique set of values contained in the message that will be used by the process engine to select the correct process instance to send the message to. Correlation is done between two or more messages. A CorrelationSet can contain one or more properties.
Once we define a correlation property, we have to define the corresponding values in each of the messages we expect to correlate. These corresponding values are called Property Aliases.

Lets create the process using WSO2 Developer studio

Step1. Create the business process.


 




































Click next and client finish to create the BPEL project.
2. Generate a business process with the synchronous business process template.









































3. Drag and drop receive, assign and reply activities such that we will get the following process


4. Click on the Assign activity and assign ‘input’ from input variable to ‘result’ from output variable.






















5. Similarly, complete the next receive, assign and reply activity by using the same partner link
‘client’ .Now we have completed the business of the process logic. Now we need to add the correlation set to two receive activities.

6. Create a correlation set by clicking on the ‘+’ sign next to Correlation Sets































7. Select the correlation set and select properties and click on Add.



















8. We will get the Select property wizard. Click on New.






































9. Give a name to our correlation property.




































10. Select the data type for our correlation property. We have selected is here as a ‘Simple Type’. Click Browse. Now we have to select the data type from xml schema types. Select string as our type.






































Now a pop up box will appear and asks for the prefix to be used to the xml schema namespace. Give the prefix as ‘xsd’.

















11. Click on the new button next to Alias to define property alias.

 
12. Click on browse and select the message type and input string for query.























clip_image035[5]

13. Now we have finished defining the correlation set, property and alias. Note that we have selected only one alias here because, we are using the same message for both receive activities. Now we have to add the correlation set to the receive activities. On the first receive activity, which creates the process instance, we will initialize the correlation set. On the next, receive activity; we do not need to initialize. Click on the receive activity, and go to properties, click add and select the correlation set. Since we have only one correlation set, it will appear. On the initialize section select yes.























On the next correlation activity, set initiation to no.
14. Next, generate the deployment descriptor.























Next select all files related to the project and create a zip package.  Upload the bpel package.  One the process is deployed successfully; we can use tryit to send a request to the process. 



















Now browse to instance view for this process. Now the instance has complete up to reply activity and
is waiting on the next receive activity. Under the correlation properties: you can see the value we sent in the request.






















 14. Now send the same request from tryit again.  Now the process instance has gone to the completed instance.  You can follow the same steps we used here to add correlation sets to any asynchronous business process you implement. Correlation sets can be added to ‘receive’, ‘invoke’ and ‘pick’ activities.

 

Chris HaddadOpen Source Business Conference Impressions

At Open Source Business Conference 2013, conversations on innovation, disruption, and open source leadership dominated the sessions.  The conference chair, Matt Assay, crafted a program where each presentation and conversation reinforced how traditional business strategies are being disrupted by new market dynamics.   The dynamics are shifting power away from closed, proprietary corporate leadership towards open collaboration and user-led innovation.  The shift is disrupting traditional business strategies, IT operation practices, and market dominance.

 

Open Source startups (e.g. HortonWorks, 10gen, Appcelerator, GitHub, Netflix, SUSE, and WSO2) are leading their respective technology domains by encouraging open collaboration, micro-iterations, and user-led innovation.

Open collaboration is occurs within the diverse Linux, Apache, and OpenStack open source communities, and also in infrastructure ecosystem partnerships (i.e. mobile device providers and mobile application platform vendors, operating system vendors and application platform vendors, or Big Data infrastructure vendors and Cloud analytic providers).  Shaun Connolly described how open collaboration is shaping Big Data and Cloud technology.

 

The rapid pace of technology change is forcing companies to adopt agile product strategies that rely on micro-iterations to fine-tune market impact.   Three and five year plans are rapidly rendered irrelevant by the rise of new market forces (e.g. think about the world before GitHub, before Twitter, before iPhone, before NetFlix, before Amazon).   James Staten outlined how Cloud is still in an early adopter phase with significant opportunity for new leaders to emerge.

 

The open source ethos of open collaboration and listening to users is providing open source companies an edge in a user-led environment.   Mobile adoption, technology consumerization, data democratization, and Cloud self-service access are shifting the market’s paradigm towards user-led innovation.

 

A telling data point is how Adrian Cockcroft from Netflix captured interest at the PaaS lunch table discussion and presented to a standing room only crowd on the last day.    Roman Stanek illustrated how his company, Good Data, is successfully democratizing the rarified world of business intelligence and analytics.  When Software as a Service and streaming movie companies lead the discussion, one can clearly see the paradigm shift on the big screen.

 

My conference contribution was to outline a New IT Plan that embraces the disruptive business forces reshaping technology offerings.   After pondering the conference experience, I believe the plan will be recalculated and re-factored.  My thanks to many conference participants and speakers whose insightful conversations are shaping the next micro-iteration.

 

I look forward to the next Open Source Business Conference, and obtaining an update on how organizations are adapting to a market environment shaped by open collaboration, user-led innovation, and micro-iterations.

 

Ganesh PrasadJEM (JSON with Embedded Metadata) - A Simpler Alternative to JSON Schema?


I've long been a supporter of the JSON Schema initiative, and I was also happy to see developments like Orderly, which offered a simpler and less verbose format than JSON Schema. But Orderly introduces its own format, which necessitates conversion to JSON Schema before it can be used. Both approaches are unsatisfactory in their own way. One is too verbose and the other needs translation.

All of this made me wonder if we aren't approaching the problem the wrong way. JSON Schema is a conscious effort to replicate in the JSON world the descriptive capability that XML Schema brings to XML. But is this the best way to go about it?

I would like descriptive metadata about documents to be capable of being embedded inside the document itself, rather like annotations in Java programs. Indeed, this metadata should be capable of forming a "scaffold" around the data that then allows the data itself to be stripped out, leaving behind a template or schema for other data instances.

So I'm proposing something that I think is a whole lot simpler. It does require one fundamental naming convention to be followed, and that is this:

Any attribute name that begins with an underscore is metadata. Everything else is data.

Let's take this simple JSON document:


We can embed metadata about this document in two different ways. Click diagram to expand.


I'm calling the first style "Metadata Markup", where the data elements of the JSON document retain their primacy, and the metadata around them is secondary and serves to add more detail to these data elements. One can readily see that "_value" is now just one of the possible attributes of an element, and many more such attributes can therefore be added at will.

I call the second style "Metadata Description", where the primary elements are metadata, and any data elements (whether keys or values) are modelled as the values of metadata elements. Note that describing a document as an array (a nested array in the general case) rather than as a dictionary (or nested dictionary) of elements allows the default order of the elements to be retained. This is quite useful when this format is used to publish data for human consumption.

The first style, Metadata Markup, is more suitable for document instances, because a lot of detailed meta-information can accompany a document and can be hidden or stripped out at will. It is easy for a recipient to distinguish data from metadata because of the leading underscore naming convention. There is no need to pre-negotiate a dictionary of metadata elements. (Click to expand.)



The second style, Metadata Description, is more suitable for schemas, because in this format, all elements pertaining to instance data (both keys and values) are just values. If only the values representing keys are retained, we get a "scaffold" structure describing the document, and more metadata elements representing constraints can be added, turning it into a schema definition. (Click to expand.)


Obviously, this system will not work for everyone. I'm sure there are JSON documents out there that have underscores for regular data (HAL?), so adoption of this convention won't be feasible in such domains. But if a significant subset of the JSON-using crowd finds value in this approach, they're more than welcome to adopt it.

Madhuka UdanthaEnabling SSO in WSO2 User Engagement Server (UES)

Currently wso2 User Engagement Server (UES) is in ALPHA stage  and it can contain jaggery APPs (javascritp applications) or webapps with gadgets. There you will need to have Single sign-on (SSO) for you applications. Currently UES have 2 application called portal and store. Single sign-on (SSO) is a property of access control of multiple related, but independent software systems. With this property a user logs in once and gains access to all systems without being prompted to log in again at each of them.

Post will explain how to have Single sign-on (SSO) among them with support of ‘org.wso2.carbon.identity.sso.saml.feature’ or you can used wso2 IS server for SSO. 

Dowload location : http://dist.wso2.org/milestone/gs/ues/ALPHA2/wso2ues-1.0.0-ALPHA2.zip

1. Unzip the pack

2. Open '\wso2ues-1.0.0-ALPHA2\wso2ues-1.0.0\repository\deployment\server\jaggeryapps\portal\portal.json' where contains portal app config data.

Change the 'ssoConfiguration' in portal.json for you need. Here I am using default wso2carbon.jkh file as keyStore

"ssoConfiguration" : {
    "enabled" : true,
    "issuer" : "portal",
    "identityProviderURL" : "https://localhost:9443/admin/samlsso",
    "keyStorePassword" : "wso2carbon",
    "identityAlias" : "wso2carbon",
    "responseSigningEnabled" : "true",
    "keyStoreName" : "C:/WSO2/WSO2Trunk/platform/branches/4.0.0/products/ues/1.0.0/modules/distribution/target/wso2ues-1.0.0-ALPHA2/wso2ues-1.0.0/repository/resources/security/wso2carbon.jks"
}

3. Then go to ‘store’ app and change ‘store.json’  as below ssoConfiguration

    "ssoConfiguration" : {
        "enabled" : true,
        "issuer" : "store",
        "identityProviderURL" : "https://localhost:9443/admin/samlsso",
        "keyStorePassword" : "wso2carbon",
        "identityAlias" : "wso2carbon",
        "responseSigningEnabled" : "true",
        "keyStoreName" : "C:/WSO2/WSO2Trunk/platform/branches/4.0.0/products/ues/1.0.0/modules/distribution/target/wso2ues-1.0.0-ALPHA2/wso2ues-1.0.0/repository/resources/security/wso2carbon.jks"
    }

4. After that Start wso2 UES server  from

wso2ues-1.0.0-ALPHA2\wso2ues-1.0.0\bin\wso2server.bat or wso2server.sh

5. Go to https://localhost:9443/admin/carbon/ and login using “admin” and “admin”

6. Navigagte to Home > Manage > SAML SSO

7. Enter
"Issuer" as "store" (you app name that is define in store.json sso congfig)
"Assertion Consumer URL" as "http://localhost:9763/store/sso.jag"

Check the Enable Single Logout, Use fully qualified username in the SAML Response and Enable Assertion Signing for requirement

image

8. Click  Register and you will be notified as "Service Provider Added Successfully"

9. Enter Portal data for SSO

image

10. SignOut from admin carbon now and go to below url for

portal : http://localhost:9763/portal/ 

11. Click on sign in button on the top

image

There you have to enter the use name and password as “admin” and “admin”

image

Here you see admin is logged in

image

12. go to Store : http://localhost:9763/store/assets/gadget/

and click Sign In or when where system (APP)

request for login SSO do it  so no need to enter user name, password again

image

13. As we enable single log out, click logout in any app and test is it effect to other App as well.

image

image

In console you can find logout infor as below

[2013-04-27 16:43:48,615]  INFO {org.wso2.carbon.identity.sso.saml.ui.logout.LogoutRequestSender} -  single logout request is sent to : http://localhost:9763/portal/sso.jag is returned with OK

 

NOTE

This above SSO work with data level storing concepts and

“org.wso2.stratos.identity.saml2.sso.mgt.feature.” will support predefine SSO configuration rather entering all data in carbon admin mgt.

go to “\wso2ues-1.0.0-ALPHA2\wso2ues-1.0.0\repository\conf\sso-idp-config.xml” and uncomment those line or enter you app data in there for ServiceProvider

eg:

        <ServiceProvider>
            <Issuer>portal</Issuer>        <AssertionConsumerService>http://localhost:9763/portal/sso.jag</AssertionConsumerService>
            <CustomLoginPage>ssoApp/login_processor.jag</CustomLoginPage>
        </ServiceProvider>

Start the UES Server again.

You can see that sso registration infor in console

[2013-04-27 16:55:52,619]  INFO {org.wso2.stratos.identity.saml2.sso.mgt.SSOServiceProviderUpdateManager} -  A SSO Service Provider is registered for : portal

image

Enjoy WSO2 UES with SSO feature!!

You can defein that SSO feature in remote wso2 IS server even. Smile

Chris HaddadNew Enterprise Drivers

The Breakup of the Corporation, Connected Business Strategies, The Now Generation, and The Long Tail are driving organizations towards a New Enterprise Future.

Traditional corporate structure is dissolving into flexible value-webs of business participants.  The business participants dynamically band together on a project, disperse, and reform around new business opportunities.  Because new discovery and connectivity mechanisms lower interaction cost, group formation and participation is fostered. Figure 1 below illustrates how organizational dynamics are changing and a New Enterprise is being born.   Instead of all corporate functions being performed in-house, offshoring, outsourcing, temporary contractors, and dynamic partnerships drive today’s agile New Enterprise business.

The Break Up Of The Corporation

Figure 1:  The Breakup of the Corporation

New Enterprise organizations are defining Connected Business Strategies that rely on big data analytics, contextual personalization, industry ecosystems, and advanced monetization to create new business models.

Connected Business

Figure 2: Connected Business Strategies

Queuing, waiting, and the status quo doesn’t fit well with today’s “now generation’ and New Enterprise dynamics.  Business stakeholders, who drive revenue growth and customer retention, desire to rapidly seize opportunity and market share.  They often view IT timeframes and capabilities as a poor match for today’s fast business-pace.

IT often is geared to only service high-impact, mission critical projects.  A large amount of data access, analytics, and workflow requirements are unmet by the one-size-fits-all, tightly allocated IT service model.   To maximize business flexibility and agility, New Enterprise IT meets The Long Tail of application and analytic demands with new platforms.   Figure 3 illustrates the service scope of Old IT and New Enterprise IT.

The Long Tail

Figure 3: The Long Tail and IT Coverage     Source: Gartner 2011

 

A New IT model is required to reduce delivery time and accelerate business agility.  How are you building a pragmatic, open source driven game plan that incorporates New IT approach vectors, Open DevOp PaaS, Open APIs, and Open Ecosystems?

 

The complete presentation delivered at the Open Source Business Conference on April 29 is posted.    Learn more about New Enterprise drivers, a New IT plan, and network with open source community leaders.   The conference covers the open source strategic challenges that IT management deals with on a daily basis.

 

Recommended Reading

New IT Plan

A Path to Responsive IT

Accelerate Business Agility

 

 

Afkham AzeezTechduino - Arduino clone made in Sri Lanka

I recently purchased a TechDuino V2B from shop.techkatha.com. This is the first Arduino clone made in Sri Lanka. I purchased the unassembled TechDuino kit because I wanted to have fun putting it together & doing a little bit of tinkering.

Shown below is the kit, which comes with comprehensive instructions on assembling it. It also comes securely packaged, and they will mail it via registered post for a nominal postage charge.



Here is another view of the components in the kit. It includes the ATmega328 AVR microcontroller, PCB, 5V regulator, 9V power jack, connector pins, resistors, a few capacitors, LEDs and so on.


Here is the two page instruction manual. TechKatha (meaning Tech talks) is an organization which promotes technology in Sri Lanka in Sinhala, the main native language in Sri Lanka, so this manual is in Sinhala. 

"TechKatha started off as a podcast which discussed the latest developments in the world of technology and answered listeners’ questions in Sinhala, with the goal of making technology more accessible. It has now spawned into popular live video stream which is broadcast every Friday around 9 p.m.
Continuing towards their goal of making technology more accessible, TechKatha created a clone of the open-source Arduino prototyping platform. Conceived to make microcontroller programming more available to Sri Lankans, the TechDuino is purely a volunteer run, not-for-profit project.
All parts are sourced and assembled by the TechKatha team, as well as their friends and listeners who are willing to lend a hand. The project was launched as a hobby and TechKatha was not expecting the huge response they received, with over 300 orders being fulfilled so far."


TechKatha is engaged in the noble mission of making technology knowhow accessible to technology enthusiasts, hobbyists & students, without making English knowledge a barrier.




I couldn't wait to have it assembled and started on it right away.


The PCB is a simple single sided, single layer one, so a few jumpers have to be connected. I believe this simple design helps to keep the cost low.



Here is my fully assembled TechDuino.


Shown below is my TechDuino & Arduino side by side. The Arduino cost me about Rs. 4000, where  as the TechDuino cost me only Rs. 1300! Both provide identical functionality & features. I took the liberty to measure the voltage outputs of the 5V & 3.3V lines, and to my amazement, found that while the TechDuino output was spot on, the Arduino output was off by a few millivolts!



A few hiccups...

One of the first problems I faced was sketch uploading to the TechDuino failed, whereas with my Arduino, it was just plug & play. I figured out that I needed to install the USB to UART(TTL) driver for Mac OS X. Once I did that, a couple of new serial ports showed up on my Arduino IDE, and I was able to successfully upload sketches. The TechDuino is connected to the USB port in the computer via a USB to UART(TTL) converter, which was provided with the TechDuino kit.

USB-to-UART(TTL) Converter

The next thing I wanted to check was that all the pins were working properly. So I used some sample sketches to check each & every pin. Everything worked fine.

Next I wanted to test my Ethernet shield. Once the Ethernet shield was connected to the TechDuino, I wasn't able to upload sketches to it. After some head scratching, I removed the Ethernet shield & tried uploading sketches to the TechDuino while keeping the reset button pressed. Walaa! Upload failed. So I thought of reconnecting the Ethernet shield while keeping the reset pin bent so that it doesn't get connected to the reset connector on the TechDuino, and that solved the issue! There is some problem with the reset connections I presume, and the TechDuino team is currently investigating this. In the meantime, I have managed to work around the problem so this is not a blocker.


Ethernet shield running on TechDuino


All in all, I have become a big fan of the TechDuino, and hope this venture goes well, and more bricks, shields & other hobbyist stuff will be available at low cost on shop.techkatha.com. There was a big void in this market, which was frustrating for hobbyists, but now that void is being filled. I hope to see interesting projects & inventions coming out of this from Sri Lanka in the near future.

Update: The TechDuino team has fixed the Reset issue. It was a minor glitch, which can be fixed by connecting the reset female header to the free pin in the reset button using a jumper.




Adam FirestoneAffordable Public Safety: Leveraging Open Source Software to Support Law Enforcement Surveillance Tools

Surveillance systems are specialized data analytics tools leveraging many of the processes and components found in commercial enterprises, defense organizations and the intelligence community.  The recent tragedy in Boston ensures an increased demand for such systems.  Fortunately, many of the systems’ core components can be satisfied by enterprise grade open source software that comes as part of a unified platform.  By eliminating both licensing costs and improving platform productivity, total cost of ownership (TCO) is significantly reduced, allowing access to modern security tools and techniques can be extended to smaller agencies and jurisdictions. 

Commenting on the April 15th Boston Marathon bombing during an interview with MSNBC’s Andrea Mitchell, US Representative Peter King (R-NY) expressed a belief that Americans are going to have to get used to many more surveillance cameras in public spaces:
So, I do think we need more cameras. We have to stay ahead of the terrorists and I do know in New York, the Lower Manhattan Security Initiative, which is based on cameras, the outstanding work that results from that. So yes, I do favor more cameras. They're a great law enforcement method and device. And again, it keeps us ahead of the terrorists, who are constantly trying to kill us.
Questions of domestic policy and civil liberties aside, Representative King’s inclination toward additional surveillance mechanisms has a number of interesting systemic ripple effects.  Understanding these effects requires closer examination of a surveillance system’s constituent components and the nature of the value it provides.

A generic surveillance system consists of four core capabilities (Such systems can, of course, be further decomposed.)  These include:

Collection:  The acquisition of data about the locale or subject of interest.  Representative King’s cameras are one type of collection mechanism, gathering geospatially and temporally referenced imagery and video data.  Other collection mechanisms might acquire radio-frequency data, including such things as cell phone conversations, text messages or emails sent over Wi-Fi and mobile data networks and laser spectrometers, collecting information about what people have done or eaten based on residues on skin and clothing.
Analysis:  Unanalyzed data, like an unmined vein of gold, is little more than potential value.  Analysis tools, like the crushing and precipitation mechanisms in a gold mining operation, both identify relevant events within the overall set of collected data and make sense of the identified events within an operational context.  Analysis, by transforming data into information and information into knowledge, provides the critical element of “what does this mean to me at this time.”
Decision Support:  Most law enforcement and emergency response organizations have doctrines and policies outlining the expected nature and scope of a response to a given type of incident.  Once  analysis has identified the type and magnitude of an event, it’s simply a matter of applying logic consistent with the organization’s business rules to arrive at  a doctrinally valid recommended course of action.
Dissemination:   The best analysis and business rules engines are useless if results and recommendations aren’t placed in the hands of people and organizations with the means to influence events in a timely manner.  Dissemination mechanisms not only ensure timely delivery of critical information, but also preserve the core attributes of information security.  It must ensure that the information being distributed is available only to authorized entities (confidentiality), that it is not altered or corrupted in any way while in transit (integrity), that it can be retrieved when necessary (availability), that both sides of the dissemination transaction have confidence in the identity of the other (authenticity) and that an undeniable audit trail of the transaction exists (non-repudiation).
Using the generic system as a vantage point, it’s easy to see that Representative King’s desire for more cameras exposes only the tip of the security and surveillance iceberg.  An effective surveillance system must solve all four problems concurrently if it is to successfully fulfill its operational requirements.  Having more cameras addresses only the collection issue.  Additionally, fielding a greatly augmented collection capability prior to developing robust analysis, decision support and dissemination capabilities can overwhelm analyst resources and frustrate timely data analysis and dissemination. 

As an illustration, suppose that Representative King gets his way and the number of cameras for a given area is greatly increased, without concomitant improvements to the back end analysis, decision support and dissemination capabilities.  For a system deploying 100 cameras, 2,400 hours of video are collected every day (and 16,800 every week).

Boston’s police department, among the 20 largest in the United States, has about 2,800 uniformed and civilian personnel.  Theoretically, all the video could be reviewed in the course of a single eight hour shift – assuming that the city was willing to withdraw every single police employee from the street and dedicate them to the task, that every employee was a qualified imagery analyst and that only a single analysis pass was necessary.  Realistically, the requirement to manually analyze that much data could overwhelm even the New York Police Department’s much larger forensics investigation division.  (This problem is not unique to law enforcement.  In 2011, US Air Force surveillance systems collected approximately 720 years of video data over Afghanistan.)

However, even a significantly augmented analyst force doesn’t address the fact that current surveillance architectures are inherently reactive. That is, they provide excellent investigative and forensic tools to establish the nucleus of operative facts after an event has taken place but are not preventative or prophylactic in nature.  Law enforcement’s goal with respect to mass casualty events is to ensure that they remain inchoate; that terrorist plans are never realized.  Based on this, we can safely speculate that what Representative King is really seeking is a significantly improved surveillance architecture, of which the collection hardware is only part.  Such an architecture might include image pattern recognition software capable of identifying backpacks or duffel bags or laser spectrometer capable of detective explosives residue from hundreds of feet away.  Categorized by capability, other architectural components include:

Analysis
  • A pattern recognition tool;
  • A real-time data analytics engine; and
  • A storage mechanism capable of handling large data sets that come in at a very high velocity.
Decision Support

  • A business rules processor capable of storing rule sets representing doctrine and executing rules in the context of analyzed data; and
  • A business process engine capable of implementing processes indicated by the business rules engine.

Dissemination
  • An integration and transport mechanism capable of delivering decision support data to a diverse set of applications and endpoints; and
  • A security mechanism ensuring that information can only be transmitted, stored or acted upon by authenticated and authorized system entities.
As can be seen, effective surveillance systems have a number of infrastructural middleware sub-components operating in parallel.  The attendant software development effort isn’t trivial; the sheer volume and variety of components is a significant cost driver.  Each sub-component can require specific expertise, which in turn can require employees with special (and expensive) skills and knowledge.  Additionally, each sub-component  may come with a discrete licensing fee.  Requirements for specialized knowledge and licensing fees combine to create a TCO that may be beyond the budgetary means of many agencies.

Part of the answer lies in building the surveillance system around a highly productive, highly integrated platform that provides dedicated products leveraging a consistent, composable core.  For example, if the integration/transport, security and business rules mechanisms share a common core providing key enterprise service oriented architecture (SOA) functionality (e.g., mechanisms to provide and consume services, mediation, service orchestration, service governance, business process management, service monitoring and support for open standards such as WS-* and REST), less expertise on individual products is required, and fewer expensive experts are needed on the payroll. 

There are additional platform characteristics that can mitigate TCO:

  • By using an open source platform, licensing fees are eliminated;
  • By using a platform based on open standards, expensive vendor lock-in is avoided and innovation, adaptability and flexibility are promoted; and
  • Configurable components offer greater productivity than those requiring custom integration code.
Theory and Practice

Fortunately for law enforcement and the security industry, open source enterprise middleware based on a common, composable and configurable platform exists in practice as well as in theory, and it’s possible to map the requirements outlined above to existing, available and – importantly – supported software products:


Requirement
Example Software Product
Notes
Analysis
Pattern recognition
Open Pattern Recognition project shares algorithms of image processing, computer vision, natural language processing, pattern recognition, machine learning and  related fields.  
*Not open source
Real time analytics

High volume data storage
 Accumulo is a NoSQL database developed by the NSA and open sourced through the Apache Software Foundation.  It offers cell level security.
Decision Support
Business rule management

Business process management

Dissemination
Integration and Transport

Security & Identity



Conclusion

The terrible events in Boston, and the subsequent identification of the suspects testify to the requirement for and effectiveness of surveillance systems.  Two issues become clear:  The need to improve the processing of surveillance data in a manner that helps prevent terrorist incidents from taking place, and the need to provide systems that are affordable to agencies of all sizes and budgets.  Fortunately, technical advances, coupled with the proliferation of high quality open source software offers the promise of achieving both in the near future.

Chris HaddadDevOps Ticket Reduction

A reduction in DevOps tickets not only drives IT efficiency, but also creates a cultural shift where teams look forward to rapidly achieving accomplishments.  Business stakeholders operate in an agile environment where no change request is too small, and rapidly testing business ideas is the new normal.

As a techie, I like to focus on the technology and IT process side of DevOps; bouncing around terms like ‘infrastructure as code’, ‘automated provisioning’, ‘continuous deployment’, and ‘continuous integration’.   The value-prop is self-evident to me and many of my peers. Yet, for us to change corporate culture and rally around a New IT Plan, the main message focus must not be  ’DevOps for DevOps Itself’, but to create a Responsive IT team that changes business-IT dynamics and accelerates business agility.

 

DevOps is not about ‘creating a better ALM’, but about working together as a single team, reducing wait times, automating repetitious tasks, and accelerating business innovation iterations.  While the ‘NoOps‘ model is subject to confusion and derision, reducing manual activity and operation desk tickets is a straightforward goal.

Define infrastructure as code, automate manual actions, and create self-service interfaces that take the operator out of the middle.  Teams usually invest a significant amount of work to build a more agile, self-service environment, or they can choose a ready-made DevOps PaaS that can be configured to match their workflow stages, gates, approval processes, and infrastructure templates.

Teams can measure progress by tracking the reduction in DevOps tickets, shorter ticket close average, and increased solution iteration count.

Recommended Reading

 

DevOps Driven Demand by Dan Ackerson

Accelerate Business Agility with App Factory DevOps PaaS

A New IT Plan: Enterprise DevOps PaaS, API Management, and Ecosystem Platforms

A Path to Responsive IT

 

 

 

 

Krishantha SamaraweeraHow to write your first Platform Automated Test


Objective of this guide on platform test is to enable users to start with automating platform test scenarios using WSO2 Test Automation Framework. This will be a generic guide written based on ESB and Data services servers. We expect readers of this document to have basic knowledge of TestNG framework. You can refer to TestNG documentation to get initial knowledge required.

What it mean by platform

WSO2 product platform compromise of a set of products, which are integrated to support enterprise use cases. For an example governance platform compromise of Governance registry, CEP, Business Activity Monitor and Identity server which provides SOA governance, social enterprise, analytics, lifecycle management capabilities. In the point of automation we call a specific set up a platform, if one or more products are integrated to implement business use case.

Platform Tests

Automation test framework has been designed to conduct testing of platform scenarios
on a complete, integrated system to evaluate the system's compliance with its desired
requirements.Test scenarios will be mainly based on possible applications which can be
developed using WSO2 product platform.

Scenario to be Automated

SOAP service named student data service which will be deployed on WSO2 Data Service Server which is again fronted by ESB proxy to provide RESTful API to manage student resource. The test case will deploy data service on DSS and synapse artifacts on ESB then it invokes the RESTful API exposed via ESB and perform basic GET, POST, DELETE, PUT methods on student resource.

WSO2 library article written by Amila Suriarachchi describe the end to end scenario that is going to automated here.


Where to Add Platform Tests

You checkout and use WSO2 Platform Automated Test Suite to add the test case.


org.wso2.carbon.automation.platform.test.scenarios module can be used to implement platform automated tests.

Download Test Artifacts
Download artifacts required for the scenario from http://wso2.org/files/sample_10.zip you can find the artifact download link in above mentioned OT article also.

Configure Test Environment
  • Navigate to org.wso2.carbon.automation.platform.test.scenarios module and start by adding a new test package.
e.g.
platform-integration/platform-automated-test-suite/1.1.2/org.wso2.carbon.automation.platform.test.scenarios/src/test/java/org.wso2.carbon.automation.platform.scenarios/esb

  • Then go to automation.properties file under src/test/resources and edit following properties.
  1. product.list=DSS,ESB
  2. execution.environment=platform
  3. execution.mode=user
  4. dss.host.name=localhost
  5. dss.http.port=9764
  6. dss.https.port=9444
  7. esb.host.name=localhost
  8. esb.http.port=9763
  9. esb.https.port=9443
  10. esb.nhttp.port=8280
  11. esb.nhttps.port=8243
  12. database.driver.name=com.mysql.jdbc.Driver
  13. jdbc.url=jdbc:mysql://localhost:3306
  14. db.user=root
  15. db.password=root
  16. db.name=STUDENT_DB


You can set ports and host names of DSS and ESB servers according to your server settings.

Framework uses mysql as the default DB for data services. So you need to set connection settings as illustrated in #13 to #16.

  • Import your keystores in to wso2carbon.jks at org.wso2.carbon.automation.platform.test.scenarios/src/test/resources/keystores       You don’t need to do this step if you are using default keystores in WSO2 products.

  • Update admin credentials in userList.csv and tenantList.csv files at src/test/resources with your admin credentials. You don’t need to update other user details. Test framework will automatically populates user list to products. It identify the server list by reading product.list property defined in automation.properties file. These users will be used in various test cases.  Note that all users have permission to read, write, delete and authorize registry space. in terms of other access privileges they are approximately equal to admins. However don’t have super admin privileges.

  • Now navigate to endpintlookup.xml at src/test/resources and put following entry
    "http://localhost:9765/services/StudentService/"


Here we define address endpoint of student data service in endpointlookup.xml. Endpoint lookup is used to replace the endpoints defined in synapse configuration based on the test execution environment. You need to invoke the endpoint replacement functions before updating synapse configuration via test.


Copy Test Artifacts to Framework Artifact Repo

  • Copy StudentService.dbs into src/test/resources/artifacts/DSS/dbs/rdbms/MySql and student.sql into src/test/resources/artifacts/DSS/sql/MySql




Start Writing Your First Platform Test

please refer to methods comments for further clarifications.

 /**  
  * Implement the scenario discussed in 
  * http://wso2.org/library/articles/2012/10/implementing-restful-services-wso2-esb 
  */ 
 public class RestFullApiTestCase { 
   private static final Log log = LogFactory.getLog(RestFullApiTestCase.class); 
   private DataServiceBaseTest dataServiceBaseTest; 
   private ESBBaseTest esbBaseTest; 
   private URL url; 
   /** 
    * Initialize test environment by creating instances of DataServiceBaseTest and ESBBaseTest classes, these classes 
    * provide required utility functions such as upload data service, update and revert synapse configuration etc.. 
    * <p/> 
    * And resource URI is constructed by getting service URL of esb instance in esbBaseTest. 
    * 
    * @throws Exception - if initialization fails 
    */ 
   @BeforeClass(groups = "wso2.esb", alwaysRun = true, description = "initialize test environment") 
   public void testInitialize() throws Exception { 
     esbBaseTest = new ESBBaseTest(); 
     dataServiceBaseTest = new DataServiceBaseTest(); 
     url = new URL(esbBaseTest.esbServer.getServiceUrl(). 
         substring(0, esbBaseTest.esbServer.getServiceUrl().lastIndexOf("/")) + "/students/003"); 
   } 
   /** 
    * Execute student.sql on mysql instance which specified in automation.properties file. Then deploy the data service 
    * located at DSS artifact repository. 
    * 
    * @throws Exception - if data service deployment fails 
    */ 
   @Test(groups = "wso2.esb", description = "deploy student data service") 
   public void testDeployStudentService() throws Exception { 
     String serviceName = "StudentService"; 
     List<File> sqlFileLis = new ArrayList<File>(); 
     sqlFileLis.add(dataServiceBaseTest.selectSqlFile("student.sql")); 
     dataServiceBaseTest.deployService( 
         serviceName, dataServiceBaseTest. 
         createArtifact(ProductConstant.SYSTEM_TEST_RESOURCE_LOCATION + "artifacts" 
                 + File.separator + "DSS" + File.separator + "dbs" + File.separator 
                 + "rdbms" + File.separator + "MySql" + File.separator 
                 + "StudentService.dbs", sqlFileLis)); 
     log.info(serviceName + " uploaded"); 
   } 
 /** 
    * updateESBConfiguration(OMElement synapseConfigOM) 
    * will deployed the artifact defined in the synapse configuration (proxy, endpoints, sequence, message store, etc..) 
    * using admin services API. Framework will go through the configuration and deployed each synapse artifact separately. 
    * If synapse artifact with same name exists in the system, it is deleted delete existing one and redeploy new one. 
    * 
    * @throws Exception - if update of synapse configuration fails. 
    */ 
   @Test(groups = "wso2.esb", description = "update synapse config", dependsOnMethods = "testDeployStudentService") 
   public void testUpdateSynapseConfig() throws Exception { 
     String synapseConfigPath = ProductConstant.SYSTEM_TEST_RESOURCE_LOCATION + File.separator + 
                   "artifacts" + File.separator + "ESB" + File.separator + "synapseconfig" + 
                   File.separator + "config67" + File.separator + "synapse.xml"; 
     EsbEndpointSetter esbEndpointSetter = new EsbEndpointSetter(); 
     OMElement synapseConfigOM = 
         esbEndpointSetter.setEndpointURL(new DataHandler(new URL("file://" + synapseConfigPath))); 
     esbBaseTest.updateESBConfiguration(synapseConfigOM); 
   } 
   /** 
    * Add new student by sending POST request to student resource. 
    * 
    * @throws Exception - if POST request fails. 
    */ 
   @Test(groups = "wso2.esb", dependsOnMethods = "testUpdateSynapseConfig", description = "Add new student") 
   public void testAddNewStudent() throws Exception { 
     String addPayload = "<p:Student xmlns:p=\"http://ws.wso2.org/dataservice\">\n" + 
               "   <p:name>tharindu</p:name>\n" + 
               "   <p:email>tharindu@gmail.com</p:email>\n" + 
               "   <p:age>16</p:age>\n" + 
               "   <p:class>8B</p:class>\n" + 
               "   <p:average>83.45</p:average>\n" + 
               "</p:Student>"; 
     Reader data = new StringReader(addPayload); 
     Writer writer = new StringWriter(); 
     HttpURLConnectionClient.sendPostRequest(data, url, writer, "application/xml"); 
   } 
   /** 
    * Check whether the newly added student is exits by sending GET request. 
    * 
    * @throws Exception - if GET request fails. 
    */ 
   @Test(groups = "wso2.esb", dependsOnMethods = "testAddNewStudent", description = "get newly added student") 
   public void testGetStudent() throws Exception { 
     HttpResponse response = HttpURLConnectionClient.sendGetRequest(url.toString(), null); 
     assertTrue(response.getData().contains("<Student xmlns=\"http://ws.wso2.org/dataservice\">" + 
                         "<RegistrationNumber>003</RegistrationNumber>" + 
                         "<Name>tharindu</Name><Email>tharindu@gmail.com</Email>" + 
                         "<Age>16</Age><Class>8B</Class><Average>83.45</Average>" + 
                         "</Student>"), "new student has not been added"); 
   } 
   /** 
    * Update the student by sending PUT request to student resource. Then verify the whether the student is updatd by 
    * sending GET request to student resource. 
    * 
    * @throws Exception - if PUT request fails. 
    */ 
   @Test(groups = "wso2.esb", dependsOnMethods = "testGetStudent", description = "update student") 
   public void testUpdateStudent() throws Exception { 
     String updatePayload = "<p:Student xmlns:p=\"http://ws.wso2.org/dataservice\">\n" + 
                 "   <p:name>amila</p:name>\n" + 
                 "   <p:email>amila@wso2.com</p:email>\n" + 
                 "   <p:age>16</p:age>\n" + 
                 "   <p:class>8A</p:class>\n" + 
                 "   <p:average>67.89</p:average>\n" + 
                 "</p:Student>"; 
     Reader data = new StringReader(updatePayload); 
     Writer writer = new StringWriter(); 
     HttpURLConnectionClient.sendPutRequest(data, url, writer, "application/xml"); 
     System.out.println(writer.toString()); 
     HttpResponse response = HttpURLConnectionClient.sendGetRequest(url.toString(), null); 
     assertTrue(response.getData().contains("<Student xmlns=\"http://ws.wso2.org/dataservice\">" + 
                         "<RegistrationNumber>003</RegistrationNumber>" + 
                         "<Name>amila</Name><Email>amila@wso2.com</Email>" + 
                         "<Age>16</Age><Class>8A</Class><Average>67.89</Average>" + 
                         "</Student>"), "new student has not been updated"); 
   } 
   /** 
    * Delete the student by sending DELETE request to student resource. Then verify the whether the student is deleted by 
    * sending GET request to student resource. 
    * 
    * @throws Exception - if DELETE request fails. 
    */ 
   @Test(groups = "wso2.esb", dependsOnMethods = "testUpdateStudent", 
      description = "delete student and try to get the student again") 
   public void testDeleteStudent() throws Exception { 
     HttpURLConnectionClient.sendDeleteRequest(url, null); 
     HttpResponse response = HttpURLConnectionClient.sendGetRequest(url.toString(), null); 
     assertTrue(response.getData().contains("<Students xmlns=\"http://ws.wso2.org/dataservice\"/>"), 
           "new student has not been deleted"); 
   } 
   /** 
    * Undeploy data service after the executing all test methods.  
    * cleanup() will remove all deployed synapse artifacts. 
    *  
    * @throws Exception 
    */ 
   @AfterClass(alwaysRun = true) 
   public void deleteService() throws Exception { 
     dataServiceBaseTest.deleteService("StudentService"); 
     esbBaseTest.cleanup(); 
   } 
 } 


To run the test class you have to add your test classes in testng.xml which is at src/test/resources

 <suite name="PlatformTestSuite" parallel="false">  
   <listeners> 
     <listener class-name="org.wso2.carbon.automation.core.PlatformExecutionManager"/> 
     <listener class-name="org.wso2.carbon.automation.core.PlatformSuiteManager"/> 
     <listener class-name="org.wso2.carbon.automation.core.PlatformAnnotationTransferManager"/> 
     <listener class-name="org.wso2.carbon.automation.core.PlatformTestManager"/> 
     <listener class-name="org.wso2.carbon.automation.core.PlatformReportManager"/> 
   </listeners> 
   <test name="Platform-test-scenarios" preserve-order="true" verbose="2"> 
     <classes> 
       <class name="org.wso2.carbon.automation.platform.scenarios.esb.RestFullApiTestCase"/> 
     </classes> 
   </test> 
 </suite> 


How to Execute the Test

Note that all testNG listeners implemented in automation framework need to be registered in testng.xml

You can execute the test inside the module itself using maven surefire plugin or use platform automated test suite (wso2pats) to get the test executed on product setup.

To execute test using maven

  1. Start ESB and DSS servers.
  2. Make sure mysql server is running.
  3. The run the below command
    1. mvn install -DskipTests=false

You can find the surefire reports at target/surefire-reports directory.

To execute test using platform automated test suite

  1. Build the test by skipping tests.
    1. mvn install -DskipTests=true
  2. Then go to /platform-automated-test-suite/version/distribution directory.

  1. Now build the distribution - mvn clean install
  2. Go to distribution/target directory.
  3. You will find the wso2pats-1.1.x.zip distribution.
  4. Extract it and follow the instructions available at INSTALL.txt file.

Running Test on Different Environments
Once you write a test case you can run that test case in different environments. Just need to change the automation properties which can be found src/test/resources directory.


Executing test on integration Environment as a tenant
By default test runs on the product platform environment on user mode. By changing following properties in automation.properties file, users can execute the same test in product setup on tenant mode.

stratos.test=true  
#execution.environment = integration|platform|stratos  
execution.environment=stratos  
#execution.mode = user|tenant|all  
execution.mode=tenant  
port.enable=true  
carbon.web.context.enable=false  
builder.enable=false

Executing as a tenant
if you want to run the test as a tenant. setting below will execute the test as tenant.
execution.mode=tenant  

Executing test on cloud platform( Stratos)
if you want to run your test class against cloud platform,  change setting as below.

stratos.test=true  
execution.environment=stratos  
execution.mode=tenant  

#Stratos server details  
esb.service.host.name=esb.stratoslive.wso2.com
dss.service.host.name=data.stratoslive.wso2.com



































Chris HaddadCloud Native PaaS Architecture

Cloud platforms exhibiting Cloud Native PaaS architecture provide an opportunity to increase business innovation and creativity.   Cloud native platform solutions shield teams from infrastructure details and inject new behavior into the application.

Cloud native PaaS architecture requires infrastructure innovation in provisioning, service governance, management, deployment, load-balancing, policy enforcement, and tenancy.  Cloud native, innovative provisioning infrastructure increases tenant density and streamlines code deployment and synchronization. Multi-tenancy within middleware containers enables teams to customize applications and services per consumer by changing run-time configuration settings instead of provisioning new instances.

A Cloud platform may automate governance and enforce policies (i.e. security, service level management, usage) through enterprise PaaS services.  Cloud provisioning may fulfill enterprise deployment requirements across all service providers and technologies used by solution delivery teams.

To re-invent the platform and achieve benefits, new Cloud Native platform architectural components and services are required.   Traditional client-server and N-tier web application architectures do not exhibit requisite cloud characteristics (i.e. elastic scalability, multi-tenancy, resource pooling, or self-service).  Figure 1 below depicts the new Cloud Platform architectural components and services.   The PaaS controller layer deploys, scales, monitors, and manages an elastic middleware Cloud. PaaS Foundation services provide common solution building blocks.  A complete, comprehensive, and Cloud-aware middleware container layer delivers new cloud-aware capabilities to business applications.

The middleware container layer should not be tightly coupled to the PaaS foundation.  A cartridge or droplet pattern is used to support running any application or service container on the PaaS.   By providing a cartridge plug-point, Cloud Native PaaS environments can run any language, framework, or server (after appropriate integration via the cartridge API and agents).

 

Stratos2.0-architecture-v1-01

Figure 1: Cloud Platform Architecture Components and Services

Elastic Load Balancer

Elastic Load Balancer (ELB) balances load across cloud service instances on-premise or in the cloud. The ELB should provide multi-tenancy, fail-over, and auto-scaling of services in line with dynamically changing load characteristics.   Cloud Native Elastic Load Balancers are tenant-aware, service-aware, partition-aware, and region-aware.  They can direct traffic based on the consuming tenant or target service.   Cloud Native Elastic Load Balancers manage traffic across diverse topologies (i.e. private partitions, shared partitions, hybrid cloud), and direct traffic according to performance, cost, and resource pooling policies.   A Cloud Native ELB is tightly integrated with the Service Load monitor component and dynamically adjusts to topology changes.

 

Service Load Monitor

The Service Load Monitor component acquires load information from multiple sources (e.g. app servers, load balancers) and communicates utilization and performance information to an Elastic Load Balancer responsible for distributing requests to the optimal instances, based on tenant association, load balancing policies, service level agreements, and partitioning policies.

 

When the level of abstraction is raised above Infrastructure as a Service (IaaS) instances, Teams no longer have direct access to specific virtual machines.  New Cloud Native components are required to flexibly distribute applications, services, and APIs across a dynamic topology.  A Cloud Controller, Artifact Distribution Server, and Deployment Synchronizer perform DevOp activities (i.e. continuous deployment, instance provisioning, automated scaling) without requiring a hard, static binding to run-time instances.

Cloud Controller

A Cloud Native Cloud Controller (or auto-scaler) component creates and removes cloud instances (virtual machines or Linux containers) based on input from the Load Monitor component.   The Cloud Controller right-sizes the instance number to satisfy shifting demand, and conforms instance scaling with quota and reservation thresholds (i.e. minimum instance count, maximum instance count).   The Cloud Native Cloud Controller may provision instances on top of bare metal machines, hypervisors, or Infrastructure as a Service offerings (e.g. Amazon EC2, OpenStack, Eucalyptus).

Artifact Distribution Server

The Artifact Distribution Server takes complete applications (i.e. application code, services, mediation flows, business rules, and APIs) and breaks the composite bundle into per-instance components, which are then loaded into instances by a Deployment Synchronizer.  The Artifact Distribution Server maintains a versioned repository of run-time artifacts and their association with Cloud service definitions.

Deployment Synchronizer

The Deployment Synchronizer checks out and deploys the right code for each Cloud application platform instance (e.g. application server, Enterprise Service Bus, API Gateway).   With infrastructure and servers abstracted and encapsulated by the Cloud, a Cloud Native PaaS Management Console allows control of tenant partitions, services, quality of service, and code deployment by either Web UI or command-line tooling.

Cloud Native PaaS Architecture Business Benefits

Cloud Native PaaS architecture accelerates innovation, increases operational efficiency, and reduces cost.

The traditional, keep-the-lights-on, operational run-rate consumes precious resources and limits innovative new projects.  By optimizing project footprint across pooled resources on a shared Cloud Native PaaS infrastructure, Responsive IT can reduce operational spend, improve total cost of ownership (TCO), and make more projects financially viable.   Multi-tenant delivery models create an efficient delivery environment and significant lower solution deployment cost. For more information on the financial benefits of multi-tenant, Cloud Native platforms, read the white paper.

By building a Cloud Native PaaS environment, you provide your teams with a platform to rapidly develop solutions that address connected business use cases (i.e. contextual business delivery, ecosystem development, mobile interactions).

 

Recommended Reading

A Path to Responsive IT

PaaS Services

Does your PaaS architecture show a paradigm shift?

Cloud-aware Applications and PaaS Architecture

 

 

 

 

 

Saliya EkanayakeHome Made Meditation Benches

My friend, Lahiru, suggested  to make few meditation benches as a donation to Indiana Buddhist Temple few weeks back. I had no idea what a meditation bench was, but luckily he had a basic one with him. After few modifications to the design, here’s what we ended up with.
DSC_0003 DSC_0010 (2)
DSC_0015 (2) DSC_0163

If you like to make one at home too, here are the details.
I think this covers most of the stuff you need to complete this project and any questions are welcome in comments. Happy bench making !!

Saliya EkanayakeRunning MPI.NET Applications with Mono in Ubuntu

Sometime back I played around Mono to get some of our parallel applications running on Ubuntu. These applications were C# based and used MPI.NET.

The following blog post is a great starting point with all the details you'll need. So I'll skip the steps, except to point out couple of caveats you need to consider.

http://blog.biophysengr.net/2011/11/compiling-mpinet-under-ubuntu-oneiric.html


  1. automake versions above 1.9 will give you an error when building MPI.NET. May be you can change the make script to work with them, but I found it easy to just install automake1.9 to solve it.
  2. You'll need to add /usr/local/lib to your LD_LIBRARY_PATH. Essentially what you need to do is add this path to /etc/ld.so.conf and run ldconfig as root. See documenation from Mono on this at http://www.mono-project.com/DllNotFoundException
  3. Make sure to do chmod +x to your dlls

Kathiravelu PradeebanThursday, 18th of April, 2013

An attempt to make milk rice for the Sri Lankan New Year
It is interesting to see how the time is going too fast, and I realized many things have changed this year. We are almost finishing the first trimester of the year. 

Weeks 32, 33, & 34 - I was updating Llovizna with fortnight (if not weekly) reports on my stay in Lisbon. However, the past few weeks were going pretty fast with the presentations, mid-evaluations, and other stuff, which made me forget the blog. I didn't fail to notice a considerable drop in the blog views this year, probably due to the infrequent blog posts, and even the posts are just becoming personal and deviating from the highly technical nature of Llovizna. I am still happy that I didn't let Llovizna starve without posts.

Sinhala Tamil New Year is the mostly celebrated Sri Lankan festival. I tried to create a milk rice for this, though I am not sure about its success, as I ate all of it myself. :D

Today, whilst doing the virtual execution project, I was thinking how the year 2013 is becoming yet another year of changes. The impact of this year is surely remarkable, and I hope this will become a highly effective year just like the years 2002, 2004, 2010, and 2012 for me. Lisbon is getting greener. As I walk towards ISCTE-IUL, I see new leaves appearing on the trees fresh and young. I walk down the streets without the winter clothes. Spring is here. I feel, I will remember this day for many of the upcoming years.

Saliya EkanayakeRepair Mr.Coffee (IDS77) Thermal Fuse

If you haven't bought this product yet, then STOP don't buy it!!

If you, however, have bought it and broke it in the first run then continue.

Mine simply stopped working right on the day I bought it, in fact this is the second Mr. Coffee grinders I bought that day. May be I was trying to grind too much, but as a consumer device I'd expect it to "auto shut off" if it's too hot, rather burn itself.

The good news is, it only burns a thermal fuse, which fairly easy to replace if you get under the hood. Once you remove the grinder cup you can see the following,

Just remove the three plastic hole cover knobs, which you can simply pull out using tweezers or by lifting one side with a sharp point like that of a knife. Once removed these knobs look as shown below.

Get a small flat head screw driver and remove the three screws. Then you can simply take out the motor compartment. You'll need to pop the button panel to find a bolt holding the circuit board. You'll be able to figure out hopefully.

Once the motor is out you can see the thermal fuse wrapped inside the yellow tape covering the motor winding as shown. I cut the pins of the fuse and it's shown left to the motor. 

Now it's time to find a replacement. The original fuse that's there in this one comes from China and here's a link I could find on it. A close up picture is given below.

I found several options in ebay, but either they had low ampere rating or too high functioning temperature. Also, it'd take more than a week to arrive. In the end, I decided to go with an alternative one from RadioShack, which in fact is cheaper (~$1.40) than options from ebay.

If you need some instructions on how to solder these look at this. This one has a high ampere rating, but from what I read having a higher ampere rating than the one used does no harm. It's the temperature that's important.

Once soldered, the unit is alive again. This time I will not grind coffee continuously though :)





Heshan SuriyaarachchiApache Airavata 0.7 Released

The Apache Airavata PMC is pleased to announce the immediate availability of the Airavata 0.7 release.

The release can be obtained from the Apache Airavata download page - http://airavata.apache.org/about/downloads.html


Apache Airavata is a software framework providing API’s, sophisticated server-side tools, and graphical user interfaces to construct, execute, control and manage long running applications and workflows on distributed computing resources. Apache Airavata builds on general concepts of service oriented computing, distributed messaging, and workflow composition and orchestration.

For general information on Apache Airavata, please visit the project website: http://airavata.apache.org/

Hasini GunasingheEnterprise Security and Identity Management Use Cases with WSO2 Identity Server

This is the set of slides used in WSO2Con 2013 - tutorial session on the topic: "Enterprise Security and Identity Management Use Cases with WSO2 Identity Server", along with demos for each of these use cases.

I plan to blog about individual samples used to demonstrate each of these use cases in my future posts.


Ruchith FernandoNational Strategy for Trusted Identities in Cyberspace

My report/summary of CERIAS 2013 Symposium panel on NSTIC, Trusted Identities and the Internet : Link to CERIAS Blog

Chris HaddadStep up to the open source major league

Many IT leaders prefer to buy their application infrastructure software from a single vendor.   When I was at Burton Group, Anne Thomas Manes and I called the providers delivering comprehensive offerings ‘super-platform vendors’.    In a recent report, Gartner helps teams understand the trade-offs associated with the super-platform vendor strategy, and summarizes the strengths and cautions of comprehensive application infrastructure vendors.

Providing a who’s who in the vendor market, this research offers basic profiles for vendors that qualify to provide a comprehensive set of application infrastructure supporting an organization’s projects in the next three to five years.

Gartner cites WSO2 as a visionary in all three Magic Quadrants for Application Infrastructure including SOA Application Projects, Systematic Application Integration Projects, and Systematic SOA Infrastructure Projects. Of the vendors listed as options in the Comprehensive Application Infrastructure reportWSO2 is the only open source vendor included.

Gartner Comprehensive Infrastructure Vendor Chart 2013

Gartner does not endorse any vendor, product or service depicted in its research publications, and does not advise technology users to select only those vendors with the highest ratings. Gartner research publications consist of the opinions of Gartner’s research organization and should not be construed as statements of fact. Gartner disclaims all warranties, expressed or implied, with respect to this research, including any warranties of merchantability or fitness for a particular purpose

While at Burton Group, Anne and I advised clients on how to navigate the best-of-breed vendor versus super-platform vendor choice.  An amazing aspect of the WSO2 application infrastructure platform is the breadth and depth of application infrastructure capabilities.

Before you set your championship plans for this year, view the Gartner report and train for the open source majors.

 

 

Kathiravelu PradeebanLisbon - Week14

[01/12/2012] - We are getting closer to the final project deadlines, as the month of December reaches. I was bored and needed a change. Hence visited Colombo, Centro Comercial (metro station is Colegio Militar), bought Nexus7 tablet from Worten, and came back home. :)


Pensão Amor, which used to be a strip club at the former red light district of Cais do Sodré, in the historic times, is now a regular bar and a tourist attraction of Cais do Sodré, selling quality drinks as a bar. However, the price is simply thrice the amount than that you would find in the neighbourhood. Interestingly, it is crowded as it still holds the images and architectural marvels of its past pride. Check their website for some old live cams captured on the bar and the neighbourhood. We paid a quick visit to this place.

Adam FirestoneDevOps and the Future of Defense and Government Software Development Programs



A frustration inherent to working within the defense industry is the sense that we’re regularly required to design and implement systems using ideas and technologies long since adopted and vetted by the commercial sector.  Defense information and communications practitioners often envy their commercial counterparts’ ability to rapidly integrate new concepts that drive down costs and timelines while improving the quality of delivered products.  Sometimes, however, this pattern doesn’t hold true.  An emergent, and promising, methodology known as “DevOps” appears to be a recombination of defense industry methodologies dating from the mid-1990s.  What sets DevOps apart from earlier process instantiations is the emergence of enabling software tools.  These tools not only significantly improve the likelihood of project success, but also provide a means to automatically integrate certification and accreditation (C&A) requirements, thus promising significant cost and time savings to government and defense programs.

I often joke with my commercial sector colleagues that my corporate title should be “Director of Impenetrable Acronyms, Morphemes and Portmanteaus.”  After all, I come fully equipped with phrases like “BLUF, if we’re going to propose DOD-wide C5I OPSEC components based on SOA for a RSTA Bat tothe SES level, our IA, CM and QA stories need to be squared away.  Everybody HOOAH?”  A few glassy-eyed stares and I remember that not everyone is a defense geek.  Recently, however, the tables were turned when I found myself on the receiving end of the phrase “DevOps.”  Despite my initial (and fervent) hopes, DevOps has nothing to do with black helicopters, covert or kinetic action and everything to do with providing a means to increase cooperation and understanding between business and technology practitioners in a manner that dramatically increases the productivity of both.

Enterprise DevOps is a development methodology that mates operational requirements (i.e., What business purpose is the objective software supposed to accomplish?), legislative, regulatory, policy and guidance requirements (i.e., What constraints are there in the manner in which the business purpose must be accomplished?) with traditional information technology development concerns including design time and runtime resources, solution engineering and coding. 

The goal is a collaborative environment that is marked by:


  • Membership comprising constituents from both the operational and development communities
  • Freely flowing communication; and
  • Iterative, incremental and continuous development, test and deployment.


The collaborative environment is expected to result in a more rapid delivery of capability to the operational community with a concomitant reduction in defects and errors.

That’s great.  And to my colleagues in the commercial sector, I say (with a smile!):   What took you so long?

In May 1995, Secretary of Defense William Perry directed "a fundamental change in the way the Department acquires goods and services.  The concepts of Integrated Process and Product Development (IPPD) and Integrated Product Teams (IPTs) shall be applied throughout the acquisition process to the maximum extent practicable."  The tangible artifact resulting from this directive was the DoD Guide to Integrated Productand Process Development (Version 1.0), dated February 5, 1996.

Among other things, the Guide specifies the implementation of Integrated Product Teams (IPT).   The Guide describes an IPT as follows:


An Integrated Product Team (IPT) is a multidisciplinary group of people who are collectively responsible for delivering a defined product or process.  The IPT is composed of people who plan, execute, and implement life-cycle decisions for the system being acquired.  It includes empowered representatives (stakeholders) from all of the functional areas involved with the product—all who have a stake in the success of the program, such as design, manufacturing, test and evaluation (T&E), and logistics personnel, and, especially, the customer. 


If that sounds a lot like the description of a DevOps team, comprising members across the development and operational communities, it should.  Comparable principles drive the two concepts:  Fostering free and open communication, bridging often parochial disciplinary silos and leveraging the synergies resulting from collective awareness.  The difference is that while IPTs are generally the embodiment of human-centric organizational principles and tenets, DevOps principles assume the integration of automated tools from the beginning. 

DevOps platforms incorporate techniques including self-service configuration, automated provisioning, continuous build, continuous integration, continuous delivery, automated release management, and incremental testing. Like the IPT, DevOps responds to the interdependence of software development and business operations. It then extends the IPT concept with automation capabilities that aid with in rapid production, certification and deployment of software products and services. Flickr, for example, developed DevOps capability to support a business requirement of ten deployments per day.

The core of a DevOps platform is a standardized development environment that automates, as much as possible, different operational and development processes.  In doing so, these toolkits address and automate product delivery, quality testing, feature development and maintenance releases. It should come as no surprise that core DevOps concepts come from the Enterprise Systems Management and Agile software development models.

DevOps platforms really come into their own with respect to programmatic governance.    The rulesets governing continuous test, continuous build and continuous integration activities are (and must be!) reflections of organizational policies.  With respect to government and military software programs, DevOps platforms offer the promise of automating the C&A process within the context of development activities.  In a nutshell, each time a module is checked in, it is not only tested against functional requirements, but vetted against the organization’s overarching C&A requirements as well.  Modules failing either operational or C&A vetting are simply not accepted, and the developer receives near real time feedback.  Corrections are made at the time of coding, reducing or eliminating the need for expensive and time consuming verification, regression and C&A testing activities and shortening the time from development to operational deployment.  Additionally, the platforms incorporate strong man-in-the-loop processes, ensuring that no code is promoted from development to test to deployment without positive control of authorized persons.

Speaking at the 2013 International Engagement on Cyber at Georgetown University on 10 April 2013, US Department of Defense (DoD) Chief InformationOfficer Teresa (Teri) Takai posed the question “Why isn’t information assurance (IA) embedded in the acquisitions process?”  The answer could be that the acquisitions community has not yet fully embraced DevOps tools and platforms.  By certifying that the platform meets C&A requirements before the coding and testing cycles begin, IA becomes a fully embedded, inescapable and transparent part of the process.

This embedded, and therefore less expensive and time consuming IA/C&A process becomes critical as defense and government organizations move ever more rapidly toward the implementation of large scale mobile networks with accompanying smartphone, tablet and app ecosystems.  The current DoD software C&A process can take anywhere from six to eighteen months and may cost a program as much as a million dollars.  This level of effort makes sense when thinking of large and/or monolithic multi-year, multimillion dollar software projects that create applications comprising hundreds of thousands or millions of lines of code.

When it comes to small mobile apps whose deployed size is measured in terms of a few megabytes, whose development time may be a month or less and whose value derives, at least in part from being available to meet an immediate need, the associated financial and temporal burdens of the current IA and C&A regimes become unduly onerous.  Fortunately, the burden can be significantly ameliorated by adopting a regime in which the certification and accreditation of a program’s DevOps platform is extended to software products issuing from that platform.

DevOps platforms are, happily, not wishful thinking of vaporware.  An example is the WSO2 AppFactory.  The 100% open source App Factory embodies both programmatic governance and application lifecycle management capabilities including:

  • Project and Team Management;
  • Software Development Workflow;
  • Governance and Compliance;
  • Development Status Dashboarding;
  • Code Development;
  • Issue Tracking;
  • Source Control;
  • Continuous Build;
  • Continuous Integration;
  • Test Automation; and
  • Continuous Deployment.


DevOps repackages the best of earlier defense and government development methodologies and combines it with software platforms that allow for distributed, governed development in a manner that embeds IA and C&A processes.  For the defense and government sector, DevOps offers the promise of a reduction in the time required to field new capabilities and lower program cost profiles.  Importantly, DevOps platforms such as the WSO2 App Factory are situated to be a key enabler for defense and government mobile networks.

Sanjeewa MalalgodaHow to deploy WSO2 API Manager with BAM

Create database named am_stats_db to store summarized data from BAM. You don't need to create any tables inside database (analyzer scripts will create them when need).

configure the data source definition in the master-datasources.xml file of API Manager and BAM as follows. We need this data source in bam to store summarized data(analyzer script do it). We use same data source inside API manager to pull out aggregated data to present it.
<datasource>
<name>WSO2AM_STATS_DB</name>
<description>The datasource used for getting statistics to API Manager</description>
<jndiConfig>
<name>jdbc/WSO2AM_STATS_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/am_stats_db</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>


To enable API statistics collection you need to configure the following properties in the api-manager.xml
file of API Manager.


<!--Enable/Disable the API usage tracker.-->
<Enabled>true</Enabled>
<!-- JNDI name of the data source to be used for getting BAM statistics.This data source should be
defined in the master-datasources.xml file in conf/datasources directory. →>
<DataSourceName>jdbc/WSO2AM_STATS_DB</DataSourceName>



Change port offset to 1 by editing the repository/conf/carbon.xml if you are running all servers in same box(This step is required as we publish data to port 7712 from API manager). For more details go to usage tracking section of api-manager.xml file and change it as required.

Copy the API_Manager_Analytics.tbox(available under wso2am-1.3.0/statistics) to repository/deployment/server/bam-toolbox (Create the bam-toolbox directory if it already doesn't exist) Copy the MYSQL JDBC driver jar file into the INSTALL_HOME/repository/component/lib folder for all APIManager/ BAM servers.

So you are almost done start both servers. And see how API usage data publish to bam and summarize there.

Nuwan BandaraHappy Sinhalese and Tamil New Year

Image credit goes to Udara, the amazing artist of our time :) Happy New Year forks !! p.s. : My new year resolution :- At least write a blog post once in two weeks ;)

Chris HaddadA New IT Plan: Enterprise DevOps PaaS, APIs, and Ecosystems

Open source PaaS, Open APIs, and Open Ecosystems are accelerating agility, empowering developers, and enabling innovative business strategies.  In a recently published white paper, I describe how adopting a New IT plan can create a responsive IT team.

 

The path to New IT requires moving away from traditional application platforms, traditional team structure, and traditional information flows.  Responsive IT teams are adapting their infrastructure, processes and tooling to re-invent the application platform and re-think application delivery.  The New IT architecture underlying Responsive IT intelligently incorporates Cloud Platforms, BigData Analytics, Enterprise DevOps, and API first development.

 

How are you building a pragmatic, open source driven game plan that incorporates New IT approach vectors, Open DevOp PaaS, Open APIs, and Open Ecosystems?

Adopting an Open Enterprise DevOps PaaS can align your IT model with business agility expectations.

DevOps principles and practices combined with PaaS characteristics will quicken IT solution development and delivery.   A DevOps focus on continuous activity execution (e.g. continuous build, continuous integration, continuous test, continuous delivery) creates a ‘no wait’ environment.   Teams do not have to wait for the next script to run or for the next activity to commence.  By incorporating automation into developer and operations processes, teams bypass time consuming manual tasks and gain faster phase execution.  Both DevOps and PaaS promote simple, on-demand self-service environments that shield team members from complexity and reduce skill hurdles.  By offering on-demand self-service access, rapid business innovation and experimentation is possible. By reducing complexity, team members are not required to obtain special training and skills before consuming IT services and infrastructure.

 

 

PaaS increases agility by democratizing access to IT infrastructure and services.  Offering a low cost environment and increasing resource availability, PaaS promotes democratized access.   The chosen PaaS environments must offer required application building blocks available on-demand, and minimize cost by amortizing infrastructure expense over multiple project teams.   PaaS environments based on multi-tenant, shared application containers facilitate pervasive access by increasing tenant density and lowering tenant cost.   Affordable, pervasive on-demand access encourages project teams to use approved PaaS environments and enables shadow IT teams to efficiently and safely create a long tail of application development projects.

 

To read more about Enterprise DevOps PaaS accelerating team agility, read a recent blog post.

 

Open APIs are empowering developers by delivering business building blocks.

Teams can rapidly compose solutions to meet shifting business demand by re-using Open Data and Open APIs. Teams are embracing long tail development communities that enable innovative business ecosystem strategies to emerge, with Open Data and Open API foundations.

In a New IT operations model, instead of being a single-purpose delivery team, IT serves as a broker and validator of solution building blocks.

 

IT focus and responsibility shifts towards creating an ecosystem delivering composable and reusable IT capabilities.   Project teams can access open APIs, services, business processes, open data, and applications and compose the assets into new solutions.  The operations model safely shifts the center of project responsibility to project individuals and business units while maintaining IT as a more valued business partner.   IT maintains responsibility for policy compliance, serves as a trusted technology advisor, and mentors teams on IT capability usage.  Corporate IT delivers ‘solution accelerator packs’ that decrease time to market, reduce development hurdles, and cost effectively implements corporate policy.

 

How are you building a pragmatic, open source driven game plan that incorporates New IT approach vectors, Open DevOp PaaS, Open APIs, and Open Ecosystems?

 

View the New IT Plan deck presented at  Open Source Business Conference on April 29-30 to learn more about the New IT plan and network with open source community leaders.   The conference covers the open source strategic challenges that IT management deals with on a daily basis.

Chris HaddadApplication Services Governance requires more than a SOA Registry

All SOA infrastructure products should participate in managing, storing, deciding, or enforcing policy.  More than a SOA Governance registry is required.  Application Services Governance Platforms provides advanced policy management capabilities across design-time, run-time, security, and lifecycle management focus areas.

Key WSO2 application services governance platform components participating in policy enforcement, decision, and storage include:

 

WSO2 Governance Registry serves as a policy store for any type of runtime policies including security policies, lifecycle management workflow policies, API policies, service description, service contracts, service consumption, service usage, service lifecycle management, service level agreements (SLAs) and XACML authorization policies. The WSO2 stack has built-in support for a number of standards, including WS-Policy, XACML 3.0 and SCXML.

 

WSO2 API Manager delivers an application services governance experience tuned for self-service, on-demand access, and safe API usage.  API governance management encompasses service level policies, usage policies, version policies, subscription policies, and access control policies.

 

WSO2 App Factory governs and manages application lifecycle policies, infrastructure access policies, and application versioning policies. WSO2 App Factory solves first-mile issues when developing and testing services

 

WSO2 Identity Server serves as a policy decision point and policy manager for sophisticated security policies encoded in XACML.

 

WSO2 Business Process Server is a general-purpose workflow engine used by WSO2 Application Services Governance Platform products to execute governance workflow, present task lists, and manage approvals.

 

WSO2 Complex Event Processor can be configured as a policy decision point, which uses time-based policy pattern matching to evaluate run-time service, message, REST resource, and event traffic.

 

WSO2 ESB (and all WSO2 products) serve as well-integrated policy enforcement points that may delegate policy decisions to external decision points or internally cache and process policy assertions.

 

WSO2 Stratos and WSO2 Carbon middleware components (i.e. WSO2 Elastic Load Balancer) deliver sophisticated run-time policy enforcement for tenant partitioning, service level management, application provisioning, tenant access, and resource management.

 

Policy Management Capabilities

The WSO2 Application Services Governance Platform provides advanced policy management capabilities across design-time, run-time, security, and lifecycle management focus areas.

Design-time policy management

The WSO2 Governance Registry ensures all standard design-time policies, and provides a highly flexible policy management framework, where teams can add new policies and policy validations as extensions using common plug-points. For example, teams can extend basic authentication policies and validate that a minimum level of WS-Security is used on all services. The WSO2 Application Services Governance platform supports all design-time policy management activities listed in this document.

 

Run-time policy management

Run-time policy management is implemented using a fit-for-purpose combination of WSO2 Enterprise Service Bus, WSO2 API Manager gateway component, WSO2 Cloud Gateway, WSO2 Mobile Gateway Solution, WSO2 Elastic Load Balancer, and/or WSO2 Stratos Cloud Platform.

 

WSO2 API Manager clients commonly manage and govern API run-time interactions according to specified API service tier policies (e.g. rate limits), subscriptions, and access policies.  In an ESB or API gateway serving as a policy enforcement point, specific service subscribers can be rate limited, traffic can be throttled, malicious messages discarded.  Additional run-time policy mitigation is possible, and in fact, any flow can be defined (e.g., log, send back a fault to the client, start diagnostic process, send event to management components, or fire off a BPEL workflow process with human activity interactions).  Cloud controllers adjust topology and traffic to rectify service level policy breaches. For example, start a new elastic instance to handle more loads.

Additionally, the WSO2 Application Services Governance platform supports a diverse number of run-time policy management activities.

 

Security Policy Management and Enforcement

The WSO2 application services governance platform supports open Web protocols and popular enterprise protocols including OAuth, SAML2, WS-Trust STS, Kerberos, and Active Directory. The WSO2 applications service governance platform can be interfaced with third-party security policy enforcement systems, including Microsoft Windows Identity Foundation for .NET applications.

 

Service and Application Lifecycle Management

WSO2 App Factory enables teams to govern and manage application lifecycle promotion and versioning.  Development teams may define custom gates, checklist items, and promotion/demotion rules to govern and manage application lifecycle processes.

 

The WSO2 Governance Registry, WSO2 API Manager, and WSO2 App Factory implement a very simple, powerful, flexible model for lifecycle states and stages.

 

The default WSO2 Governance Registry configuration presents a streamlined lifecycle management process that may be modified to match client governance policies.  The management interface presents mandatory and optional checklist items.

 

The default WSO2 API Manager’s lifecycle management process defines ‘created’, ‘published’, ‘deprecated’, ‘retired’, and ‘block’ states.  Team members in the ‘API Creator’ role may define an API and place it in the initial ‘created’ stage.  Team members in the ‘API Publisher’ role may transition APIs across subsequent lifecycle stages.

 

WSO2 App Factory  provides service implementation project-level governance and management. WSO2 App Factory automatically executes application service (service or API) integration tests, compliance tests, and performance tests.  Teams may assess test results before promoting service implementations.

Lifecycle Management Model

As the lifecycle management model is based on the WSO2 Business Process Server and a robust workflow execution engine, the model is completely flexible and can be extended in Java, script languages, or BPEL.  Many clients use the “default” (out of the box) model with minimal customization.

 

The default model is based on the W3C standard State Chart XML (SCXML), which is an XML model of a state machine. Each lifecycle stage is defined as a state and transitions between these are defined as actions that users can take. Each transition has a set of “checklist” pre-conditions that can be tested, together with role-based security to ensure that only the correct role can “check” an item off. In addition, code can be used to calculate checkbox states or form preconditions. Code can be triggered on transition as well. SCXML has a graphical view, which will become part of the tooling around lifecycles.

 

The result is that the governance teams can quickly and easily create effective lifecycle policies. The WSO2 Application Services Governance Platform presents fit-for-purpose governance environment (WSO2 Governance Registry for services, WSO2 API Manager for APIs, or WSO2 App Factory for applications) offering users a simple-to-use UI that allows users to promote or demote assets in the lifecycle. The SCXML model also supports “branching lifecycles” where assets can go down different paths (e.g. passing external services through an extra security assessment).  Lifecycle stage transitions may trigger run-time enforcement actions.  For example, changing an API stage to ‘Deprecated’ will prevent future subscriptions.  Changing an API stage to ‘Blocked’ will deny API calls.  In WSO2 App Factory, changing service implementation stage will automatically deploy or un-deploy service implementation artifacts from run-time cloud environments (i.e. Dev, Test, Production).

 

Recommended Reading

 Application Services Governance

Policy Management Overview

 

 

 

Chris HaddadApplication Services Governance

Application Services Governance is a necessary step towards building a responsive IT organization and achieving business agility.  By guiding teams through a streamlined application services development process, Application Services Governance Platforms optimize IT effectiveness, raise software quality, and reduce delivery timeframes.

Governance relies on policy, people, process and technology to guide business activity and consistently deliver positive outcomes. Effective governance channels business activity towards the ‘right’ path; by making the right actions the path of least resistance.

 

 

To efficiently guide teams and demonstrate policy compliance benefits, Application Services Governance Platforms provide policy management, developer portals, repositories, service integration and composition, and business value dashboards.

 

 

Effective governance encompasses the entire IT solution spanning APIs, services, business processes, data, and application delivery.   While most governance solutions focus on web services, leading Application Services Governance Platforms bridge API governance, SOA governance, Cloud deployment governance, data governance, and application delivery governance.  Additionally, the governance experience must be tailored for the participant’s project role.

 

 

Portals may be personalized to present notifications, tasks, actions, and reports suitable for application service creators, publishers, subscribers, consumers, or business managers.   Application delivery governance segments participants into developers, quality assurance testers, operations, project managers, and application users.

 

 

End-user Application Services Governance priorities are evolving toward bridging service governance with API governance, extending application lifecycle management to embrace cloud deployment environments, and focusing on visualizing asset business value.   Key governance challenges include meeting mobile application demands, implementing efficient self-service provisioning, right-sizing governance practices (not too heavy or light), and defining appropriate policy tiers.

 

 

Governance Components

To efficiently guide teams and demonstrate policy compliance benefits, Application Services Governance Platforms provide policy management, developer portals, repositories, service integration and composition, and business value dashboards.

Application Services Governance Components

Figure 1 Application Services Governance Components

 

Policy Management

 

Policy management is used to specify the correct behavior, detail exception thresholds, and define corrective actions or notifications.   Leading application services governance platforms deliver advanced policy management by conforming to a flexible architecture, addressing relevant policy categories, and spanning all lifecycle phases.

 

A comprehensive Application Services Governance Platform manages:

  • Design-time Policy
  • Run-time Policy
  • Security Policy
  • Developer access Policy
  • Service and API Lifecycle Management Policy
  • Application Lifecycle Management Policy

 

Within these six broad categories, application services governance commonly encompasses service level policies, usage policies, version policies, subscription policies, and access control policies.

 

 

Registries serve as policy stores for many types of runtime policies including security policies, lifecycle management workflow policies, API policies, service description, service contracts, service consumption, service usage, service lifecycle management, service level agreements (SLAs) and XACML authorization policies. Leading platforms have built-in support for a number of policy standards including WS-Policy, XACML 3.0, and SCXML.

 

 

Cloud foundation and cloud middleware components deliver sophisticated run-time policy enforcement for tenant partitioning, service level management, application provisioning, tenant access, and resource management.

 

 

All run-time infrastructure products should serve as well-integrated policy enforcement points that may delegate policy decisions to external decision points or internally cache and process policy assertions.  Identity Management infrastructure components serve as a policy decision point and a policy manager for sophisticated security policies encoded in XACML.

 

 

The Application Service Governance Platforms use workflow engines to execute governance workflow, present task lists, and manage approvals. Complex Event Processor components can be configured as policy decision points, which use time-based policy pattern matching to evaluate run-time service, message, REST resource, and event traffic.

 

 

For more information on policy management, read the detailed policy management blog post.

 

Developer Portal and Repository

Portals serve as the viewport into policy management, service integration and composition, and business value dashboards.  The Application Service Governance portals should deliver an application service governance experience tuned for self-service, on-demand access, and safe API usage.

 

 

Developer portals are often contextually personalized to fit the project and user’s role.  For example, a developer portal may fit the needs of API creators and API publishers who are defining, documenting, and publishing APIs.  The portal’s user experience may enable API creators and publishers to monitor, manage, and analyze API usage.  A developer portal may also be personalized to deliver a user experience tailored for API consumers.  API developers who are consuming APIs can find, explore, subscribe and evaluate APIs.

 

 

Developer portals are often tuned to facilitate service meta-data and lifecycle management for service creators.  Service and integration developers who are consuming services can find and explore services.  A developer portal should guide teams toward effective and efficient governance when building service implementation and service consumption code.

 

 

Advanced developer portals capabilities include overlaying build management governance, test governance (i.e. unit, integration, performance), implementation lifecycle governance, and deployment governance.

 

 

An Application Services Governance Platform should enable flexible organization, classification & documentation of services, APIs, and any IT asset.  Key repository capabilities include governing and managing:

 

  • Any type of metadata in any structure
  • Service, API, or artifact associations and relationships
  • Schema definitions and namespaces
  • Users and Roles
  • User subscriptions
  • Service level agreements
  • Developer documentation
  • Social taxonomies (e.g. ratings, comments, tags)
  • Implementation artifacts (i.e. code, test cases)

Service Integration and Composition

Service integration and composition for APIs, web services, or business process are often implemented using tools provided by the run-time infrastructure vendor.   Application Services Governance components must integrate into diverse run-time infrastructure containers and development tooling.  Synchronizing policy, development artifacts, and deployment packages requires tight integration between design-time tools, development tools, run-time management consoles, and application services governance portals and repositories.

 

Business Value Dashboards

 

To gauge governance effectiveness and enhanced business value, analytic dashboards assess policy compliance, quality of service, service usage, architecture coherence, and team performance.

 

The Application Services Governance platform should capture service tier subscription information, collects usage statistics, and integrate with billing and payment systems that deliver show-back or charge-back reports.  Subscription and usage reports help teams understand asset adoption (by version, by service) and usage (by version, by service).  By understanding adoption and usage, business owners and architects can intelligently invest future development resources, properly plan infrastructure scale, and rationalize the portfolio.

 

Dashboards also present a service overview, number of services, service lifecycle stage, schema re-use, service dependencies, upgrade impacts, development team productivity, and project progress.

Governance Lifecycle Phases

API management portals and SOA Governance Registries must work together to keep API lifecycle stages synchronized with backend service implementation stages.  An API Governance experience may provide a straightforward set of lifecycle stages (e.g., created, published, deprecated, retired, blocked) that may be customized by the development team.  SOA Governance Registries facilitates service metadata management and governance across design, implementation, test, and run-time operations.  Figure 2 below depicts the intersection of the two governance views.

 

API and Service Lifecycle Views

Figure 2: API and Service Lifecycle Views

 

Application delivery governance usually relies on ad hoc tools and processes, knitted together by end-user delivery managers.   Application Services Governance Platforms should span project inception, development, quality assurance, production deployment, production management, maintenance, and retirement.  Figure 3 illustrates service implementation activities governed by an application delivery governance product.

 

Application Delivery Lifecycle Activities

Figure 3: Implementation activities governed by application services delivery governance

Application Services Governance Drivers

The IT focus on API, DevOps, and Cloud scale is driving resurgent interest in Application Services Governance.

 

 

As development teams support mobile applications by fielding web APIs, they are creating a new ‘demand layer’ in front of existing service implementations.  Both API and SOA success requires creating loosely coupled consumer-provider connections, enforcing a separation of concerns between consumer and provider, and exposing a set of re-usable, shared services, and gaining service consumer adoption.   With traditional SOA Governance, many development teams publish services, yet struggle to create a service architecture that is widely shared, re-used, and adopted across internal development teams.

 

 

In today’s connected business world, API and SOA are the business. An effective governance approach must address human collaboration stumbling blocks. By publishing managed APIs, establishing API manager and publisher roles, extending the governance registry, facilitating API management practices (e.g self-service key management, self-service provisioning, service tier management, and usage visualization),and offering APIs through developer portal, organizations can overcome collaboration, trust, and adoption hurdles while enhancing SOA success.

 

 

By publishing managed APIs, establishing API manager and publisher roles, extending the governance registry, and offering APIs through an API Store, team have a new opportunity to increase service re-use and enhance IT business value.  For more information on how teams can complement SOA Governance with API Governance, read the promoting services with API Management white paper.

 

 

Because services are often imbedded in application solutions, leading Application Services Governance platforms wrap services governance inside application delivery governance. When operation team members use traditional point tools (i.e. Puppet, Chef, Jenkins,Selenium) to achieve DevOps benefits, the teams spend a considerable amount of time and effort creating agile workflow, effective governance, seamless activity transitions, and on-demand self-service access.  A configurable DevOps PaaS can implement governance best practices and be readily adopted by teams without extensive implementation effort.  Effective application delivery governance presents a simplified and unified user experience to complex development tools, processes, and team hand-offs.  By integrating software promotion best practices, test automation, continuous integration, and issue tracking, application delivery governance raises software quality while reducing delivery timeframes.  For more information, read about how to accelerate agility and maintain governance with DevOps PaaS.

 

 

Recommended Reading

Policy Management for Application Services Governance

Application Services Governance Requires More Than a SOA Registry

API and SOA Convergence

Promoting services with API Management white paper

Accelerate agility and maintain governance with DevOps PaaS

Governance Registry Brings Integrity to SaaS Platform

Gartner’s analysis of WSO2 SOA Governance

 

 

Chris HaddadPolicy Management for APIs, Services, and Apps

Policy management is a governance cornerstone, and governance can serve as a foundation underlying an responsive IT organization and business agility.

Governance relies on policy, people, process and technology to guide business activity and deliver consistently positive outcomes. Effective governance channels business activity towards the ‘right’ path by making the right actions the path of least resistance.  Policy management is used to specify the correct behavior, detail exception thresholds, and define corrective actions or notifications.  Leading application services governance platforms deliver advanced policy management by conforming to a flexible architecture, covering significant policy categories, and spanning all lifecycle phases.

Flexible policy management architecture enables distribution and separation of policy enforcement points (PEP), policy decision points (PDP), and policy information points (PIP). Additionally, flexible policy management architecture provides self-service access, automates policy decisions, and integrates disparate policy enforcement points.

 

A complete Application Services Governance Platform covers the following policy categories:

  • Design-time Policy
  • Run-time Policy
  • Security Policy
  • Developer access Policy
  • Service and API Lifecycle Management Policy
  • Application Lifecycle Management Policy

 

Teams commonly use design-time policies, lifecycle and code time policies, and run-time policies across service, API, and applications.  To reduce ‘policy islands’, a cohesive Application Services Governance platform will provide end-to-end coverage across all lifecycle phases (e.g. plan, design, develop, test, deploy, manage, evaluate, re-use, deprecate, and retire).

Policy Management Architecture

Teams craft policy definitions using policy management interfaces, and the application services governance platform store the policy definitions in policy information points (PIP).  Policy information points are commonly databases, configuration files, or repositories.  Policy enforcement points (PEP) monitor system interactions and compare behavior to policy thresholds.  Policy enforcement points may determine an interaction crosses a policy threshold (e.g. exceeds rate limit, message sent unencrypted, CPU utilization exceeds limit) or delegate the comparison to a policy decision point (PDP).  Policy enforcement points and policy decision points may both take remediation actions. Common policy decision points are SOA governance registries, identity management and entitlement services, authorization servers, and cloud controllers.   Common policy enforcement points are API gateways, mobile gateways, HTTP interceptors, Enterprise Service Bus’ (ESB), or firewalls.

 

Flexible policy management architecture provides self-service access, automates policy decisions, and integrates policy enforcement points.    When consumers use self-service access and choose their own policy tiers, application service adoption efficiently scales.  Automated policy decisions reduce operations expense and maximize solution consistency.   Integrated policy enforcement points expand policy coverage across the environment and lifecycle phases.

 

Lifecycle Phases

Teams commonly use design-time policies, lifecycle and code time policies, and run-time policies across services, APIs, and applications.  To reduce ‘policy islands’, a cohesive Application Services Governance platform will provide end-to-end coverage across all solution components and all lifecycle phases (e.g. plan, design, develop, test, deploy, manage, evaluate, re-use, deprecate, retire).

 

API management portals and SOA Governance Registries must work together to synchronize API and back-end service policies.   Additionally, API lifecycle stages synchronized with backend service implementation stages.  An API Governance experience may provide a straightforward set of lifecycle stages (e.g., created, published, deprecated, retired, blocked) that may be customized by the development team.  SOA Governance Registries facilitates service metadata management and governance across design, implementation, test, and run-time operations.  Figure 1 below depicts the intersection of the API governance and service governance views.

API and Service Lifecycle Views

Figure 1: API Governance and Service Governance Views

 

Application delivery governance requires a unique set of promotion and demotion policies tied to funding, design reviews, security reviews, and test results.   Application Services Governance Platforms should span project inception, development, quality assurance, production deployment, production management, maintenance, and retirement.  Figure 2 illustrates service implementation activities governed by application delivery governance.

 

Application Delivery Lifecycle Activities

Figure 2: Implementation activities governed by application services delivery governance

 

Policy Management Categories

 

A complete Application Services Governance Platform manages, stores, decides, and enforces:

  • Design-time Policy
  • Run-time Policy
  • Security Policy
  • Developer access Policy
  • Service and API Lifecycle Management Policy
  • Application Delivery Management Policy

Policy Categories

Figure 3. Application Services Governance Policy Categories

Design-Time Policy Management and Enforcement

Design-time polices ensure:

  • Developers use a common naming convention for artifacts
  • Enforcement of standards (e.g.: schema standards, namespace naming conventions and interoperability validation across services)
  • Service and API versioning (e.g.: version numbering policies, policies for creating/approving new versions, revisions and restoration policies)
  • WS-I Compliance
    • Basic Profile (BP)
    • Simple SOAP Binding Profile (SSBP)
    • Attachments Profile (AP)
    • Basic Security Profile (BSP)
    • Lifecycle promotion policies via checklist/policy enforcement
    • Project teams publish their services in the repository
    • WSDL and XML Schema validation

Run-time Policy Management

A complete Application Services Governance platform governs and manages the following run-time policy categories:

Service Level Agreement Monitoring & Reporting

○      Tenant and subscriber rate limiting

○      Service-aware and tenant-aware load balancing policies

○      Private tenant partitions to reduce ‘noisy neighbor’ impact

○      Trigger notifications based on service usage thresholds

 

Billing and metering policies

○      Rate limiting service and API interactions

○      Throttle service and API interactions

 

Entitlement and Authorization via XACML, e.g., who can access which service, API, application, or resource for what purpose

○      WS-SecurityPolicy enforcement

○      Throttling maximum connections to systems via policy

○      Caching responses via policy

○      Attribute-based access control

○      Role-based access control

 

Infrastructure Provisioning

○      Define and enforce auto-scale limits.  Infrastructure resource pool constrained between minimum and maximum run-time instance thresholds

○      Limit provisioning administration activity based on permission policies assign to user role

 

Service mediation policies

Using a zero coding approach and only policy/rule authoring and configuration, teams may define policies that:

○      Automate routing of messages based on content-based rules: i.e. send alerts for all orders where the order value is greater than the customer’s credit limit.

○      Turn off services or reroute based on time of day or other aspects.

○      Transform message format

Security Policy Management and Enforcement

Beyond basic authorization and authentication, a comprehensive Application Services Governance Platform supports API subscription approval policies and API token expiration policies.  Role-based access control (RBAC) and fine-grained entitlement based access control policies may be associated with users, services, and APIs.  Attribute or Claim based access control is available via XACML, WS-Trust, or OpenID. Security policies may be attached to services, APIs, or resources.

 

Developer Access Provisioning Policies

Developer subscription, usage, and access may be managed and governed.  Developer self-service subscription policies may capture developer information and trigger approval workflow.  Role-based access controls may be applied to developer provisioning.  The Application Services Governance Platform should support multiple roles (e.g. API creator, API publisher, and API subscriber).

 

Service and API Lifecycle Management Policies

Teams may define custom gates and checklist items to govern and manage the service and API lifecycle processes. Lifecycle stages and stage transition policies may be defined and extended by administrators. Approval policies (supports multiple approvers) can be setup to control stage transitions.

 

In addition to checklist/approval based manual lifecycle governance policies, users can establish automated validation rules (using pre-built validators or custom Java-based validators) and define lightweight WS-HumanTask based process workflows or complete BPEL business process orchestration.

 

Application Delivery Management Policies

Web services and Web APIs are just one type of solution artifact that should be managed by the governance platform.   Teams must also govern and manage application lifecycle promotion and versioning.  Development teams may define custom gates, checklist items, and promotion/demotion rules to govern and manage application lifecycle processes.

Common Policy Management Scenarios

Teams commonly implement the following design-time, service and API lifecycle management, and run-time policies.

 

Common Design-Time Policies

The platform’s governance registry user interfaces commonly manage and govern WSDL validation, WS-I compliance, and XSD reuse.  Complementary API Manager user interfaces manage and govern API subscriptions and API promotion meta-data.  API promotion meta-data includes keyword tags used to categorize APIs, developer documentation used to help developers evaluate APIs.  Both service and API views enforce design-time checkpoints to ensure adequate documentation and promotion meta-data is defined before publication.  Subscription and usage reports help teams understand API adoption (by version, by API) and usage (by version, by API).  By understanding API adoption and usage, API business owners and API architects can intelligently invest future development resources, properly plan API infrastructure scale, and rationalize the API portfolio

Common Service and API Lifecycle management Policies

Teams using a governance registry (for services), API developer portals (for APIs), and project development interface (for service implementation projects) commonly utilize lifecycle management policies that include versioning schemes, promotion approval authority, and checklist conditions that must be passed before promotion.  During demotion, the reason is captured and workflow triggered to rectify open issues.

 

Common Runtime Policies

In conjunction with message intermediary enforcement points (i.e. ESB and gateway proxies) and identity entitlement decision services, an Application Services Governance Platform is commonly used for service response caching, service throttling, service load-balancing, and XACML-based access control.

 

Sample Governance Model

Within these three broad categories (i.e. design-time, lifecycle-time, run-time), teams may configure advanced policy decisions and enforcement. The Application Services Governance Platform should support defining high-level service descriptions independent of low-level service definitions.  The following best-practice end-to-end service governance model is recommended:

 

1. Build a namespace/organizational hierarchy that correctly defines the business areas.

2.    Business analysts use the service definition interface to create a set of high-level service definitions that map to the eventual model

3.    Using Eclipse modeling technology or third-party tools, teams may build a canonical data model using XSD.

4.    A governance registry helps maintain the consistency of this by finding shared schemas across services and notifying when changed.

5.    As services are refined to create real WSDLs or technical definitions tie these to the high-level service descriptions.

6.    The governance registry should automatically catalogues WSDLs in the correct namespace hierarchy.

7.    Application Services Governance Platform Dashboards provide an overview of the state of services, the number of services, the lifecycle stages of services, schema re-use and other overview to understand the overall progress.

 

Recommended Reading

Policy Management Requires More Than a SOA Registry

 

Application Services Governance

 

Governance Registry Brings Integrity to SaaS Platform

Gartner’s analysis of WSO2 SOA Governance

API and SOA Convergence

 

 

Hiranya JayathilakaMDCC - Strong Consistency with Performance

A few weeks back me and a couple of my colleagues finished developing a complete implementation of the MDCC (Multi-Data Center Consistency) protocol. MDCC is a fast commit protocol proposed by UC Berkeley for large-scale geo-replicated databases. The main advantage of MDCC is that is supports strong consistency for data while providing transaction performance similar to eventually consistent systems. 
With traditional distributed commit protocols, supporting strong consistency usually requires executing complex distributed consensus algorithms (e.g. Paxos). Such algorithms generally require multiple rounds of communication. Therefore when deployed in a multi-data center setting where the inter-data center latency is close to 100ms, the performance of the transactions being executed degrades to almost unacceptable levels. For this reason most replicated database systems and cloud data stores has opted to support a weaker notion of consistency. This greatly speeds up the transactions but you always run the risk of data becoming inconsistent or even lost.
MDCC employs a special variant of Paxos called Fast Paxos. Fast Paxos takes a rather optimistic approach by which it is able to commit most transactions within a single network roundtrip. This way a data object update can be replicated to any number of data centers within a single request-response window. The protocol is also effectively masterless which means if the application is executing in a data center in Europe, it does not have to contact a special master server which could potentially reside in a data center in USA. The only time this protocol doesn't finish within a single request-response window is when two or more transactions attempt to update the same data object (transaction conflict). In that case a per-object master is elected and the Classic Paxos protocol is invoked to resolve the conflict. If the possibility of a conflict is small, MDCC will commit most transactions within a single network roundtrip thus greatly improving the transaction throughput and latency. 
Unlike most replicated database systems, MDCC doesn't require explicit sharding of data into multiple segments. But it can be supported on MDCC if needed. Also unlike most cloud data stores, MDCC has excellent support for atomic multi-row (multi-object) transactions. That is multiple data objects can be updated atomically within a single read-write transaction. All these interesting properties make MDCC an excellent choice for implementing powerful database engines for modern day distributed and cloud computing environments.
Our implementation of MDCC is based on Java. We use Apache Thrift as the communication framework between different components. ZooKeeper is used for leader election purposes (we need to elect a per-object leader whenever there is a conflict). HBase server is used as the storage engine. All the application data and metadata are stored in HBase. In order to reduce the number of storage accesses we also have a layer of in-memory caching. All the critical information and updates are written through to the underlying HBase server to maintain strong consistency. The cache still helps to avoid a large fraction of storage references. Our experiments show that most read operations are able to complete without ever going to HBase layer. 
We provide a simple and intuitive API in our MDCC implementation so that users can write their own applications using our MDCC engine. A simple transaction implementing using this API would look like this.

TransactionFactory factory = new TransactionFactory();
Transaction txn = factory.create();
try {
txn.begin();
byte[] foo = txn.read("foo");
txn.write("bar", "bar".getBytes());
txn.commit();
} catch (TransactionException e){
reportError(e);
} finally {
factory.close();
}
We also did some basic performance tests on our MDCC implementation using the YCSB benchmark. We used 5 EC2 micro instances distributed across 3 data centers (regions) and deployed a simple 2-shard MDCC cluster. Each shard consisted of 5 MDCC storage nodes (amounting to a total of 10 MDCC storage nodes). We ran several different types of workloads on this cluster and in general succeeded in achieving < 1ms latency for read operations and < 100ms latency for write operations. Our implementation performs best with mostly-read workloads, but even with a fairly large number of conflicts, the system delivers reasonable performance. 
Our system ensures correct and consistent transaction semantics. We have excellent support for atomic multi-row transactions, concurrent transactions and even some rudimentary support for crash recovery. If you are interested to give this implementation a try, grab the source code from https://github.com/hiranya911/mdcc. Use Maven3 to build the distribution, extract and run.

Kathiravelu PradeebanBefore Implementing Garbage Collector Algorithms for MMTk

Jikes RVM comes bundled with multiple plans, allowing us to build it with a preferred garbage collection algorithm, either concurrent such as concurrent mark and sweep (CMS), or the stop the world implementations that are not concurrent. When implementing a concurrent garbage collector, it is recommended to benchmark it against CMS collector, as it is the complete concurrent collector in production, where all the other collectors operate in the stop-the-world manner, where the program threads are halted.

Testing whether a new collector will work with the current build is a good starting point before actually starting with the coding.

[1]. First build Jikes RVM, with MarkSweep garbage collector
bin/buildit -j $JAVA_HOME localhost BaseBase MarkSweep

[2]. Test the GC
bin/buildit -j $JAVA_HOME localhost -t gctest BaseBase MarkSweep

[3]. Dummy Compressor GC.

Copy the package org.mmtk.plan.marksweep in MMTk/src as org.mmtk.plan.compressor and rename the package names accordingly. 

In build/configs, copy BaseBaseMarkSweep.properties as BaseBaseCompressor.properties

[4]. Test the dummy compressor GC
bin/buildit -j $JAVA_HOME localhost -t gctest BaseBase Compressor

You should be able to see the [echo] ... SUCCESS as seen above in [2], upon a successful build. Now this is time to check the implementation of the new algorithm.

Jikes RVM comes bundled with multiple test cases for benchmark suites and test benches, which can be found at testing/tests.
For example, SPECjbb2000, SPECjbb2005, SPECjvm98, SPECjvm2008, and mmtk-harness.

[5]. To run the dacapo (free and open source; download) (Dacapo is specifically used for the client side testing of the rvm), SPECjvm2008 (free download), and SPECjbb2005 tests against a production build or a BaseBase Compressor build,
bin/buildit -j $JAVA_HOME localhost  -t dacapo -t SPECjvm2008 -t SPECjbb2005 production
or
bin/buildit -j $JAVA_HOME localhost -t dacapo BaseBase Compressor

[6] Benchmarking with DaCapo. 
pradeeban@llovizna:~/jikesrvm/dist/BaseBaseMarkSweep_x86_64-linux$ ./rvm -jar dacapo.jar jython
*sys-package-mgr*: processing new jar, '/home/pradeeban/jikesrvm/dist/BaseBaseMarkSweep_x86_64-linux/dacapo.jar'
*sys-package-mgr*: processing new jar, '/home/pradeeban/jikesrvm/dist/BaseBaseMarkSweep_x86_64-linux/jksvm.jar'
*sys-package-mgr*: processing new jar, '/home/pradeeban/jikesrvm/dist/BaseBaseMarkSweep_x86_64-linux/rvmrt.jar'
===== DaCapo jython starting =====
-------------------------------------------------------------------------------
PYBENCH 2.0
-------------------------------------------------------------------------------
* using Python 2.2a1
* Python version doesn't support garbage collection
* system check interval set to maximum: 2147483647
* using timer: time.time

Calibrating tests. Please wait...

Running 1 round(s) of the suite at warp factor 20:

* Round 1 done in 61.664 seconds.

-------------------------------------------------------------------------------
Benchmark: 2013-04-06 12:13:24
-------------------------------------------------------------------------------

    Rounds: 1
    Warp:   20
    Timer:  time.time

Test                             minimum  average  operation  overhead
-------------------------------------------------------------------------------
          BuiltinFunctionCalls:    479ms    479ms    1.88us    0.000ms
           BuiltinMethodLookup:    941ms    941ms    1.79us    0.000ms
                 CompareFloats:    256ms    256ms    0.43us    0.000ms
         CompareFloatsIntegers:    199ms    199ms    0.44us    0.000ms
               CompareIntegers:    371ms    371ms    0.41us    0.000ms
        CompareInternedStrings:    510ms    510ms    0.68us    0.000ms
                  CompareLongs:    256ms    256ms    0.49us    0.000ms
                CompareStrings:    371ms    371ms    0.74us    0.000ms
                CompareUnicode:    278ms    278ms    0.74us    0.000ms
                 ConcatStrings:   6144ms   6144ms   24.58us    0.000ms
                 ConcatUnicode:   4123ms   4123ms   27.49us    0.000ms
               CreateInstances:   1094ms   1094ms   19.54us    0.000ms
            CreateNewInstances:   2056ms   2056ms   48.95us    0.000ms
       CreateStringsWithConcat:   4112ms   4112ms    8.22us    0.000ms
       CreateUnicodeWithConcat:   1884ms   1884ms    9.42us    0.000ms
                  DictCreation:   1532ms   1532ms    7.66us    0.000ms
             DictWithFloatKeys:    475ms    475ms    1.06us    0.000ms
           DictWithIntegerKeys:    468ms    468ms    0.78us    0.000ms
            DictWithStringKeys:    266ms    266ms    0.44us    0.000ms
                      ForLoops:    945ms    945ms   75.60us    0.000ms
                    IfThenElse:    397ms    397ms    0.59us    0.000ms
                   ListSlicing:    956ms    956ms  136.57us    0.000ms
                NestedForLoops:   1024ms   1024ms    1.37us    0.000ms
          NormalClassAttribute:    911ms    911ms    1.52us    0.000ms
       NormalInstanceAttribute:    453ms    453ms    0.76us    0.000ms
           PythonFunctionCalls:   1343ms   1343ms    8.14us    0.000ms
             PythonMethodCalls:   2451ms   2451ms   21.79us    0.000ms
                     Recursion:   1091ms   1091ms   43.64us    0.000ms
                  SecondImport:   1009ms   1009ms   20.18us    0.000ms
           SecondPackageImport:   1030ms   1030ms   20.60us    0.000ms
         SecondSubmoduleImport:   1509ms   1509ms   30.18us    0.000ms
       SimpleComplexArithmetic:   1651ms   1651ms    3.75us    0.000ms
        SimpleDictManipulation:    612ms    612ms    1.02us    0.000ms
         SimpleFloatArithmetic:    991ms    991ms    1.50us    0.000ms
      SimpleIntFloatArithmetic:    351ms    351ms    0.53us    0.000ms
       SimpleIntegerArithmetic:    350ms    350ms    0.53us    0.000ms
        SimpleListManipulation:    440ms    440ms    0.75us    0.000ms
          SimpleLongArithmetic:    931ms    931ms    2.82us    0.000ms
                    SmallLists:   1263ms   1263ms    3.71us    0.000ms
                   SmallTuples:   3198ms   3198ms   11.84us    0.000ms
         SpecialClassAttribute:    908ms    908ms    1.51us    0.000ms
      SpecialInstanceAttribute:    456ms    456ms    0.76us    0.000ms
                StringMappings:   2341ms   2341ms   18.58us    0.000ms
              StringPredicates:    825ms    825ms    2.36us    0.000ms
                 StringSlicing:   1803ms   1803ms    6.44us    0.000ms
                     TryExcept:     40ms     40ms    0.04us    0.000ms
                TryRaiseExcept:   2113ms   2113ms   66.03us    0.000ms
                  TupleSlicing:   1951ms   1951ms   14.86us    0.000ms
               UnicodeMappings:    942ms    942ms   52.33us    0.000ms
             UnicodePredicates:    705ms    705ms    2.61us    0.000ms
                UnicodeSlicing:    859ms    859ms    3.51us    0.000ms
-------------------------------------------------------------------------------
Totals:                          61664ms  61664ms

===== DaCapo jython PASSED in 66736 msec =====

Muhammed ShariqHow to do a WebEx screen share on 64-bit Ubuntu 12.04

If your favorite operating system is Ubuntu/Linux, then you might agree with me when I say that its a bit of a pain to have to login to Windows just to join a WebEx session. Well if its just attending WebEx as a listener/viewer its one thing. Imagine if you do all your development in Ubuntu and have all your server/environment etc setup in Ubuntu, and you have to demonstrate your work via a WebEx by sharing your screen. Needless to say having to setup an identical work environment on Windows merely for a presentation is not worth it! As if its going to work just like that on Windows anyway ;) No offense meant, but as software developers we know all too well that its not so simple to switch between platforms.

That doesn't mean you can stay away from doing the demonstrations either. So the next solution is to somehow get the blessed thing to work on Ubuntu. If you are using a 32-bit distribution on Ubuntu, then it might be pretty simple, all you need to do is simply install the 32-bit Java plugin to your Firefox web browser and join the WebEx. However if you are using a 64-bit Ubuntu distribution just installing the Java plugin to your existing (64-bit) Firefox might not work. I know it didn't work for me, initially.

So lets see how you can get WebEx applet to work on 64-bit Ubuntu (12.04).

1. First you need to install ia32-libs on your machine, follow this post if you have issues installing it.
2. Next download 32-bit Firefox and 32-bit Java (JDK) to your machine. (I am assuming you can Google and find the downloads :))
3. Extract Firefox and the JDK to a directory, lets say ~/webex/firefox/ and ~/webex/jdk_<version>/ respectively.
4. The you need to create a symbolic link in ~/webex/firefox/plugins/ directory to ~/webex/jdk_<version>/jre/lib/i386/libnpjp2.so. You can do that as follows;

$cd ~/webex/firefox/
$mkdir plugins
$cd plugins/
$ln -s ~/webex/jdk_/jre/lib/i386/libnpjp2.so

This will basically install the 32-bit Java plugin for your new 32-bit Firefox.

5. Now you are all good to go, simply run Firefox as follows;

$cd ~/webex/firefox/
$./firefox

Make sure you do a "./firefox" and not just "firefox" which might open the default 64-bit browser.

6. To make sure that 32-bit Java is installed correctly go to Java test page and check if the "Java Architecture" is "32-bit". If so, congratulations you are good to go!

Good Luck .! :)

Adam FirestoneOvercoming the Governance Challenge of Providing Mobile Apps to the Warfighter



The US Department of Defense (DoD) is making rapid progress toward the establishment of a department-wide mobile device service that will serve both classified and unclassified communications.  The mobility plan, which is being developed by the Defense Information Systems Agency (DISA), features a converged infrastructure that will transition its classified support components over from the National Security Agency (NSA).  

This is great news for both the warfighters and defense system developers.  DISA’s implementation of a multi-domain mobile network represents a successful balance of new technology adoption and safety and security requirements.  Importantly, it signals a sea change away from an ingrained technological conservatism that has long been the hallmark of the defense acquisitions community. 

The overall vision is breathtaking:  DISA not only wants to expand wireless functionality across the DoD and the services, but also to replace legacy infrastructure such as laptop computers and desktop telephones.  According to Jennifer Carter, DISA’s Component Acquisition Executive:

The goal behind mobility is to establish an integrated infrastructure that can be leveraged to get the mobile device to have the capabilities that the warfighter needs, to bring that capability to them [i.e., the warfighters] – the information they need, the functionality they need – right at their fingertips at the tactical edge.

Unfortunately, the implementation of mobile networks solves only part of the problem. In order to make the networks valuable, two things have to exist:  A strategy for approving devices to operate on the network and an app ecosystem that leverages the power of the devices and the network.   The device strategy seems to be well in hand.  Between October 2012 and September 2013, the new DISA mobile network will support about 5,000 unclassified and 1,500 classified devices.  This number is expected to jump to over 100,000 in FY 14.  Plans for the future include both expanding the number of supported devices (by orders of magnitude) and adding additional types of devices, such as tablets.

The app strategy is less well defined.  While DISA recognizes the need to manage apps (it’s in the middle of a procurement process for an app store), it is still somewhat stymied by the administrative and technical burdens imposed by the DoD Information Assurance Certification and Accreditation Process (DIACAP).  DIACAP is the (DoD) administrative process that ensures that risk management and mitigation activities are applied to information systems and applications that will run on DoD and component service networks. DIACAP defines a department-wide formal and standard set of activities, general tasks as well as a management structure for the certification and accreditation (C&A) of a system to ensure that it will maintain the required information assurance (IA) posture throughout the system's life cycle.

DIACAP is an essential and useful security mechanism; a critical part of the overall protection mechanism that enables vital national security systems to keep functioning.  It’s also very thorough and very detailed with no fewer than five different phases and fifteen constituent activities.  

DIACAP’s high level of scrutiny and detail oriented approach results in a significant cost and time burden.  How significant?  A development effort to produce a significant version update to a software application might encompass ten developers, five systems engineers and a program management staff.  Once coding is complete, the product is submitted for C&A testing.  This effort can easily take four full time effectives (FTE) from six to eight months, as well as the use of specialized government labs.  After this effort, staffing the completed C&A package can take another four to six months.  And that’s for a program that has well vetted IA processes in place.  For a program starting from scratch, tack on another four or six months.

For an application with hundreds of thousands or millions of lines of code developed over a long period of time, the standard DIACAP level of scrutiny and effort makes sense.  However, when it comes to a small app for a mobile device that might be developed in a week’s time, it’s harder to see the justification for what appears to be a disproportionate IA administrative and technical burden.

Luckily for app developers, DoD IA mechanisms allow for an abbreviated qualification effort, where appropriate risk mitigations are baked into the software development process, resulting in dramatically shorter and less expensive C&A effort.  The question for acquisitions program managers in general, and for the mangers of DISA’s cloud infrastructure in particular, is how to apply these procedural mitigations – effectively a development governance process – in a manner that is consistent, repeatable and documented in such a manner as to satisfy IA requirements.

Fortunately, industry faces similar development governance problems.  These requirements led to the development of Cloud-based distributed development environments designed from the ground up to ensure that development efforts were framed within the context of organization’s business rules.  An example of such a distributed development environment is the WSO2 App Factory.

Cloud-based, the WSO2 App Factory operates as a set of pluggable applications on top of a runtime Platform-as-a-Service (PaaS) framework.  It integrates a development forge, enterprise best practices and a Cloud runtime.  Additionally, it ships with open source version control (Subversion, Git), continuous integration (Jenkins, Bamboo), continuous build (Ant, Maven),Test Automation (Selenium) and project management and bug tracking (Redmine) tools.

Additionally, the WSO2 App Factory provides a customizable, extensible governance and compliance modeling framework, project and portfolio dashboards and an App Store for deploying services and applications built within the WSO2 App Factory framework.  It’s also open source, meaning that there are zero acquisition costs associated with the WSO2 App Factory.

For DISA, numerous positive results stem from using such a tool.   The obvious benefit is that IA requirements can be rolled into the governance framework, ensuring that no app built within the environment gets deployed or published without adhering to the required IA standards.  In addition to this, however, it provides a mechanism to require developer organizations to adhere to a single set of department-wide organizational policies and values when developing apps.  Vagaries and resulting risks associated with service and component interpretations of the IA policies are therefore eliminated.  Additionally, costs and time burdens associated with redundant, service-level implementations of IA mechanisms are eliminated, resulting in a leaner, faster and more cost efficient method for delivering capability to the warfighter.

DISA is to be applauded for implementing a mobile infrastructure for the warfighter.  The next step is to provide an environment in which the creativity and capacity of industry to provide solution apps can be efficiently harnessed, robustly governed and rapidly converted into combat capability.

Afkham AzeezArduino 7-segment display sketch

7 Segment Display Pin Out



// Simply change commonCathode to 1 for common cathode 7-seg display
#define commonCathode 0

// The Arduino digital pin numbers connected to the segments
int segmentA = 2;
int segmentB = 3;
int segmentC = 4;
int segmentD = 5;
int segmentE = 6;
int segmentF = 7;
int segmentG = 8;
int segmentDP = 9;

int digit1 = 10;
int digit2 = 11;
int digit3 = 12;
int digit4 = 13;

/*
10 digits:
 Each defines which segments should be on/off for that digit: A,B,C,D,E,F,G,P
 */
byte numbers[10] = 
{
  B11000000, // 0
  B11111001, // 1
  B10100100, // 2
  B10110000, // 3
  B10011001, // 4
  B10010010, // 5
  B10000010, // 6
  B11111000, // 7
  B10000000, // 8
  B10010000  // 9
};

void setup() {
  pinMode(segmentA, OUTPUT);   
  pinMode(segmentB, OUTPUT); 
  pinMode(segmentC, OUTPUT); 
  pinMode(segmentD, OUTPUT); 
  pinMode(segmentE, OUTPUT); 
  pinMode(segmentF, OUTPUT); 
  pinMode(segmentG, OUTPUT); 
  writeDot(0);  // start with the "dot" off
}

void writeDot(byte dot) {
  digitalWrite(segmentDP, dot);
}

void sevenSegWrite(byte digit) {
  byte pin = 2;
  int number =  numbers[digit];
    for (int bitIndex = 0; bitIndex < 7; bitIndex++){
      if(commonCathode){
        digitalWrite(pin, 1-bitRead(number, bitIndex));
      } else {
        digitalWrite(pin, bitRead(number, bitIndex));
      }
      ++pin;
    }
}

void loop(){
  for (byte count = 10; count > 0; --count) {
   delay(1000);
   sevenSegWrite(count - 1); 
  }
  delay(4000);
}




The above sketch running on my TechDuino.




Update: I have written a simple Arduino library which can be used to drive a single 7-segment display. See https://github.com/afkham-azeez/ArduinoSevenSegmentLibrary/blob/master/SevenSegment.cpp

Heshan SuriyaarachchiRun EC2 Jobs with Airavata - Part III

This is a followup to my earlier posts [1] [2]. Here we will execute the application mentioned in [2] programmetically using Airavata.

import org.apache.airavata.commons.gfac.type.*;
import org.apache.airavata.gfac.GFacAPI;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.context.security.AmazonSecurityContext;
import org.apache.airavata.gfac.context.ApplicationContext;
import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.context.MessageContext;
import org.apache.airavata.schemas.gfac.*;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

/**
* Your Amazon instance should be in a running state before running this test.
*/
public class EC2ProviderTest {
private JobExecutionContext jobExecutionContext;

private static final String hostName = "ec2-host";

private static final String hostAddress = "ec2-address";

private static final String sequence1 = "RR042383.21413#CTGGCACGGAGTTAGCCGATCCTTATTCATAAAGTACATGCAAACGGGTATCCATA" +
"CTCGACTTTATTCCTTTATAAAAGAAGTTTACAACCCATAGGGCAGTCATCCTTCACGCTACTTGGCTGGTTCAGGCCTGCGCCCATTGACCAATATTCCTCA" +
"CTGCTGCCTCCCGTAGGAGTTTGGACCGTGTCTCAGTTCCAATGTGGGGGACCTTCCTCTCAGAACCCCTATCCATCGAAGACTAGGTGGGCCGTTACCCCGC" +
"CTACTATCTAATGGAACGCATCCCCATCGTCTACCGGAATACCTTTAATCATGTGAACATGCGGACTCATGATGCCATCTTGTATTAATCTTCCTTTCAGAAG" +
"GCTGTCCAAGAGTAGACGGCAGGTTGGATACGTGTTACTCACCGTGCCGCCGGTCGCCATCAGTCTTAGCAAGCTAAGACCATGCTGCCCCTGACTTGCATGT" +
"GTTAAGCCTGTAGCTTAGCGTTC";

private static final String sequence2 = "RR042383.31934#CTGGCACGGAGTTAGCCGATCCTTATTCATAAAGTACATGCAAACGGGTATCCATA" +
"CCCGACTTTATTCCTTTATAAAAGAAGTTTACAACCCATAGGGCAGTCATCCTTCACGCTACTTGGCTGGTTCAGGCTCTCGCCCATTGACCAATATTCCTCA" +
"CTGCTGCCTCCCGTAGGAGTTTGGACCGTGTCTCAGTTCCAATGTGGGGGACCTTCCTCTCAGAACCCCTATCCATCGAAGACTAGGTGGGCCGTTACCCCGC" +
"CTACTATCTAATGGAACGCATCCCCATCGTCTACCGGAATACCTTTAATCATGTGAACATGCGGACTCATGATGCCATCTTGTATTAAATCTTCCTTTCAGAA" +
"GGCTATCCAAGAGTAGACGGCAGGTTGGATACGTGTTACTCACCGTGCG";

/* Following variables are needed to be set in-order to run the test. Since these are account specific information,
I'm not adding the values here. It's the responsibility of the person who's running the test to update
these variables accordingly.
*/

/* Username used to log into your ec2 instance eg.ec2-user */
private String userName = "";

/* Secret key used to connect to the image */
private String secretKey = "";

/* Access key used to connect to the image */
private String accessKey = "";

/* Instance id of the running instance of your image */
private String instanceId = "";

@Before
public void setUp() throws Exception {
URL resource = GramProviderTest.class.getClassLoader().getResource("gfac-config.xml");
assert resource != null;
System.out.println(resource.getFile());
GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), null, null);

/* EC2 Host */
HostDescription host = new HostDescription(Ec2HostType.type);
host.getType().setHostName(hostName);
host.getType().setHostAddress(hostAddress);

/* App */
ApplicationDescription ec2Desc = new ApplicationDescription(Ec2ApplicationDeploymentType.type);
Ec2ApplicationDeploymentType ec2App = (Ec2ApplicationDeploymentType)ec2Desc.getType();

String serviceName = "Gnome_distance_calculation_workflow";
ec2Desc.getType().addNewApplicationName().setStringValue(serviceName);
ec2App.setJobType(JobTypeType.EC_2);
ec2App.setExecutable("/home/ec2-user/run.sh");
ec2App.setExecutableType("sh");

/* Service */
ServiceDescription serv = new ServiceDescription();
serv.getType().setName("GenomeEC2");

List inputList = new ArrayList();

InputParameterType input1 = InputParameterType.Factory.newInstance();
input1.setParameterName("genome_input1");
input1.setParameterType(StringParameterType.Factory.newInstance());
inputList.add(input1);

InputParameterType input2 = InputParameterType.Factory.newInstance();
input2.setParameterName("genome_input2");
input2.setParameterType(StringParameterType.Factory.newInstance());
inputList.add(input2);

InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);

List outputList = new ArrayList();
OutputParameterType output = OutputParameterType.Factory.newInstance();
output.setParameterName("genome_output");
output.setParameterType(StringParameterType.Factory.newInstance());
outputList.add(output);

OutputParameterType[] outputParamList = outputList
.toArray(new OutputParameterType[outputList.size()]);

serv.getType().setInputParametersArray(inputParamList);
serv.getType().setOutputParametersArray(outputParamList);

jobExecutionContext = new JobExecutionContext(gFacConfiguration,serv.getType().getName());
ApplicationContext applicationContext = new ApplicationContext();
jobExecutionContext.setApplicationContext(applicationContext);
applicationContext.setServiceDescription(serv);
applicationContext.setApplicationDeploymentDescription(ec2Desc);
applicationContext.setHostDescription(host);

AmazonSecurityContext amazonSecurityContext =
new AmazonSecurityContext(userName, accessKey, secretKey, instanceId);
jobExecutionContext.addSecurityContext(AmazonSecurityContext.AMAZON_SECURITY_CONTEXT, amazonSecurityContext);

MessageContext inMessage = new MessageContext();
ActualParameter genomeInput1 = new ActualParameter();
((StringParameterType)genomeInput1.getType()).setValue(sequence1);
inMessage.addParameter("genome_input1", genomeInput1);

ActualParameter genomeInput2 = new ActualParameter();
((StringParameterType)genomeInput2.getType()).setValue(sequence2);
inMessage.addParameter("genome_input2", genomeInput2);

MessageContext outMessage = new MessageContext();
ActualParameter echo_out = new ActualParameter();
outMessage.addParameter("distance", echo_out);

jobExecutionContext.setInMessageContext(inMessage);
jobExecutionContext.setOutMessageContext(outMessage);
}

@Test
public void testGramProvider() throws GFacException {
GFacAPI gFacAPI = new GFacAPI();
gFacAPI.submitJob(jobExecutionContext);
MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
Assert.assertEquals(MappingFactory.
toString((ActualParameter) outMessageContext.getParameter("genome_output")), "476");
}
}

References
[1] - http://heshans.blogspot.com/2013/04/run-ec2-jobs-with-airavata-part-i.html
[2] - http://heshans.blogspot.com/2013/04/run-ec2-jobs-with-airavata-part-ii.html 

Heshan SuriyaarachchiRun EC2 Jobs with Airavata - Part II

In this post we will look at how to compose a workflow out of an application that is installed in an Amazon Machine Image (AMI). In the earlier post we discussed how to do ec2 instance management using XBaya GUI. This is the followup to that post.

For the Airavata EC2 integration testing, I created an AMI which has an application which does gene sequence alignment using Smith-Waterman algorithm. I will be using that application as a reference to this post. You can use an application of your preference that resides in your AMI.

1. Unzip Airavata server distribution and start the server.
unzip apache-airavata-server-0.7-bin.zip
cd apache-airavata-server-0.7/bin
./airavata-server.sh

2. Unzip Airavata XBaya distribution and start XBaya.
unzip apache-airavata-xbaya-gui-0.7-bin.zip
cd apache-airavata-xbaya-gui-0.7/bin
./xbaya-gui.sh

Then you'll get the XBaya UI.


3. Select "XBaya" Menu and click "Add Host" to register an EC2 Host. Once you add the details, click   "ok".


4. You will then be prompted to enter "Airavata Registry" information. If you are using the default setup, you don't have to do any configuration. Just click "ok".


5. In order to use your application installed in the AMI, you must register it as an application in Airavata system. Select "XBaya" menu and click "Register Application". You will get the following dialog. Add the input parameters expected and the output parameters generated by your application.


6. Then Click the "New deployment" button. You have to then select the EC2Host that you registered earlier as the Application Host. Configure the executable path to your application in your AMI and click "Add".


7. Then click "Register". If the application registration was successful, you will be getting the following message.


8. Now select "Registry" menu and click "Setup Airavata Registry". Click "ok".


9. Select "XBaya" menu and click "New workflow". Then configure it accordingly.


10. Select your registered application from the "Application Services" and drag drop it to the workflow window.


11. Drag an "Instance" component from "Amazon Components" and drop it into workflow window. Then connect it to your application using Control ports.


12. Click on top of the "Instance" components config label. Configure your instance accordingly.


13. Drag and drop two input components and one output component to the workflow from "System Components".


14. Connect the components together accordingly.


15. Now click the red colored "play" button to run your workflow. You will be prompted for the inputs   values (in my case the gene sequences) and experiment id. Then click "Run" to execute your workflow.


16. The execution result will be shown in the XBaya GUI.


References
[1] - http://heshans.blogspot.com/2013/04/run-ec2-jobs-with-airavata-part-i.html

Heshan SuriyaarachchiRun EC2 Jobs with Airavata - Part I

This will be the first of  many posts that I will be doing on Apache Airavata EC2 integration. First let's have a look at how you can use Airavata's "XBaya GUI" to manage amazon instances.

Applies to : Airavata 0.7 and above

1. Unzip Airavata server distribution and start the server.
unzip apache-airavata-server-0.7-bin.zip
cd apache-airavata-server-0.7/bin
./airavata-server.sh
2. Unzip Airavata XBaya distribution and start XBaya.
unzip apache-airavata-xbaya-gui-0.7-bin.zip
cd apache-airavata-xbaya-gui-0.7/bin
./xbaya-gui.sh
Then you'll get the XBaya UI.


3. Then Select "Amazon" menu and click "Security Credentials". Specify your secret key and access key in the security credentials dialog box and click "ok".


4. Then Select "Amazon" menu and click "EC2 Instance Management". It will give a glimpse of your running instances.


5. Click the "launch" button to launch new instances and "terminate" button to terminate, running instances.


6. When you launch a new instance, it will be showed in your "Amazon EC2 Management Console".



Afkham AzeezWSO2 Support - using Raspberry Pi


WSO2 provides world class support to its customers. Its cloud-enabled enterprise middleware platform is released under the open source, business-friendly Apache Software Licence. There is no Enterprise Edition gimmicks at WSO2!





Support is the bread & butter of the company. So we take support very seriously. The Google status of Charitha Kankanamge who is one of the leads of the support team, says it all.



One of the major highlights about our support is that support is provided by the engineers who are involved in product, platform & technology development. The people providing the support write & maintain the code that runs these production systems! As a WSO2 customer, you will be directly interacting with brilliant individuals who know the code inside out!


Keeping an eye on the support metrics & statistics becomes a crucial part of support operations if we are to continue to provide world class support to our customers & always keep the customers delighted. So we recently decided to install two monitors which display these metrics & statistics in the WSO2 support operations area.

As some of you may already know, we are big fans of the Raspberry Pi. The Raspberry Pi foundation promotes values similar to that of WSO2.




Two model-B Raspberry Pis power our support dashboards as shown in the above photograph. These dashboards show realtime information on the number of open issues, number of issues waiting on the customer, resolved issue count, graph of open vs. resolved issues and so on. This ensures that the support team always has its eyes on the ball.



Here are a few more photographs of the system we have put in place.





The Raspberry Pi is the ideal platform for such operations, which do not require very powerful machines. The fact that it consumes as little as 2 Watts of power is another major advantage for such a portal that has to run 24x7. 

Keeping customers delighted is what we strive for, and good support keeps the customers delighted!




Dinuka MalalanayakeApply OAuth2.0 base security for Rest endpoint with WSO2ESB 4.6.0 and WSO2IS 4.1.1 alpha

I think this would be good example for applying the security for the simple rest endpoint. Lets think we already have some rest endpoint without security but we need to expose this with the OAuth2.0 base security.

you can achieve this task with the following steps.

1. Create the custom handler to validate the Bearer token.
2. Create API element in the ESB and pointing the rest endpoint that you have
3. Include created handler to the created API element.
4. Go to IS and create the OAuth2.0 application and get the Access token form IS
5. Invoke the API with the valid access token.

Functional Scenario

Rest endpoint with security

1. Creating custom handler (Download the mvn project here)
You need to extends AbstractHandler and implements ManagedLifecycle as follows. as well I’m getting some parameters from the axis2.xml

package org.wso2.handler;

/**
 * Created with IntelliJ IDEA.
 * User: dinuka
 * Date: 4/4/13
 * Time: 3:46 PM
 * To change this template use File | Settings | File Templates.
 */
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;
import org.apache.http.HttpHeaders;
import org.apache.synapse.core.axis2.Axis2MessageContext;
import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub;
import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO;
import org.apache.synapse.ManagedLifecycle;
import org.apache.synapse.MessageContext;
import org.apache.synapse.core.SynapseEnvironment;
import org.apache.synapse.rest.AbstractHandler;

import java.util.Map;

public class SimpleOauthHandler extends AbstractHandler implements ManagedLifecycle {

    private String securityHeader = HttpHeaders.AUTHORIZATION;
    private String consumerKeyHeaderSegment = "Bearer";
    private String oauthHeaderSplitter = ",";
    private String consumerKeySegmentDelimiter = " ";
    private String oauth2TokenValidationService = "oauth2TokenValidationService";
    private String identityServerUserName = "identityServerUserName";
    private String identityServerPw = "identityServerPw";

    @Override
    public boolean handleRequest(MessageContext messageContext) {
        try{
            ConfigurationContext configCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
            //Read parameters from axis2.xml
            String identityServerUrl = messageContext.getConfiguration().getAxisConfiguration().getParameter(oauth2TokenValidationService).getValue().toString();
            String username = messageContext.getConfiguration().getAxisConfiguration().getParameter(identityServerUserName).getValue().toString();
            String password = messageContext.getConfiguration().getAxisConfiguration().getParameter(identityServerPw).getValue().toString();

            OAuth2TokenValidationServiceStub stub = new OAuth2TokenValidationServiceStub(configCtx,identityServerUrl);
            ServiceClient client = stub._getServiceClient();
            Options options = client.getOptions();
            HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
            authenticator.setUsername(username);
            authenticator.setPassword(password);
            authenticator.setPreemptiveAuthentication(true);

            options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
            client.setOptions(options);
            OAuth2TokenValidationRequestDTO dto = new OAuth2TokenValidationRequestDTO();
            dto.setTokenType("bearer");
            Map headers = (Map) ((Axis2MessageContext) messageContext).getAxis2MessageContext().
                    getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
            String apiKey = null;
            if (headers != null) {
                apiKey = extractCustomerKeyFromAuthHeader(headers);
            }
            dto.setAccessToken(apiKey);
            //validate passed apiKey(token)
            if(stub.validate(dto).getValid()){
                return true;
            }else{
                return false;
            }
        }catch(Exception e){
            e.printStackTrace();
            return false;
        }
    }

    public String extractCustomerKeyFromAuthHeader(Map headersMap) {

        //From 1.0.7 version of this component onwards remove the OAuth authorization header from
        // the message is configurable. So we dont need to remove headers at this point.
        String authHeader = (String) headersMap.get(securityHeader);
        if (authHeader == null) {
            return null;
        }

        if (authHeader.startsWith("OAuth ") || authHeader.startsWith("oauth ")) {
            authHeader = authHeader.substring(authHeader.indexOf("o"));
        }

        String[] headers = authHeader.split(oauthHeaderSplitter);
        if (headers != null) {
            for (int i = 0; i < headers.length; i++) {
                String[] elements = headers[i].split(consumerKeySegmentDelimiter);
                if (elements != null && elements.length > 1) {
                    int j = 0;
                    boolean isConsumerKeyHeaderAvailable = false;
                    for (String element : elements) {
                        if (!"".equals(element.trim())) {
                            if (consumerKeyHeaderSegment.equals(elements[j].trim())) {
                                isConsumerKeyHeaderAvailable = true;
                            } else if (isConsumerKeyHeaderAvailable) {
                                return removeLeadingAndTrailing(elements[j].trim());
                            }
                        }
                        j++;
                    }
                }
            }
        }
        return null;
    }

    private String removeLeadingAndTrailing(String base) {
        String result = base;

        if (base.startsWith("\"") || base.endsWith("\"")) {
            result = base.replace("\"", "");
        }
        return result.trim();
    }

    @Override
    public boolean handleResponse(MessageContext messageContext) {
      return true;
    }

    @Override
    public void init(SynapseEnvironment synapseEnvironment) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public void destroy() {
        //To change body of implemented methods use File | Settings | File Templates.
    }
}

2. Now I take rest unsecured endpoint as “https://www.google.lk/search?q=wso2“(You can use your own endpoint)
Lets look at how to configure the WSO2 ESB with this endpoint.

Start the ESB 4.6.0 and Sign in as admin.
Then go to Source View.
esb

Insert following xml configuration in to the source view to create the API element name as TestGoogle

  <api name="TestGoogle" context="/search">
      <resource methods="GET">
         <inSequence>
            <log level="custom">
               <property name="Test" value="Test"/>
            </log>
            <send>
               <endpoint>
                  <address uri="https://www.google.lk/search?q=wso2"/>
               </endpoint>
            </send>
         </inSequence>
      </resource>
      <handlers>
         <handler class="org.wso2.handler.SimpleOauthHandler"/>
      </handlers>
   </api>

esb2

3. We need to add the created custom handler.jar in to $ESB_HOME/repository/components/libs and go to the $ESB_HOME/repository/conf/axis2/axis2.xml and put the following parameters.

 
    <!-- OAuth2 Token Validation Service -->
    <parameter name="oauth2TokenValidationService">https://localhost:9444/services/OAuth2TokenValidationService</parameter>
    <!-- Server credentials -->
    <parameter name="identityServerUserName">admin</parameter>
    <parameter name="identityServerPw">admin</parameter>

restart the ESB.

Again go to source view and place the following xml to engage the custom handler in to the API element

 
    <handlers>
         <handler class="org.wso2.handler.SimpleOauthHandler"/>
    </handlers>
1

Total configuration looks like this
1
  <api name="TestGoogle" context="/search">
      <resource methods="GET">
         <inSequence>
            <log level="custom">
               <property name="Test" value="Test"/>
            </log>
            <send>
               <endpoint>
                  <address uri="https://www.google.lk/search?q=wso2"/>
               </endpoint>
            </send>
         </inSequence>
      </resource>
      <handlers>
         <handler class="org.wso2.handler.SimpleOauthHandler"/>
      </handlers>
   </api>

4. Start the WSO2 Identity server and create the Oauth2.0 Application

is

Request the access token from IS you need to pass the ClientID and Client Secret with the curl request.

curl -v -X POST –user <strong>R2CNjiq672f6xXQabAfWbYby2nca</strong>:<strong>QhEQi9eJv8BmSinPBnWscCFFDgsa</strong> -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" -k -d "grant_type=password&username=admin&password=admin" https://localhost:9444/oauth2endpoints/token

Then you will receive the access token
cmd

5. Now you can invoke the API with the received access token

curl -v -X GET -H “Authorization: Bearer ca1799fc84986bd87c120ba499838a7″ http://10.100.1.198:8280/search
cmd


Dinuka MalalanayakeCustom JDBC user store manager with Custom properties as Claims in WSO2IS 4.1.1 alpha

In my early blog post I have describe how to write the custom user store manager and plug in to the WSO2 Identity Server. Now I’m going to explain how we can plug the user properties as claims and how to do some authorization with that properties. First of all you need to read my early blog post (How to write Custom JDBC user store manager with WSO2IS 4.1.1 alpha)

I have modify the DB Schema as follows

CREATE TABLE CUSTOMER_DATA (
             CUSTOMER_ID INTEGER NOT NULL AUTO_INCREMENT,
             CUSTOMER_NAME VARCHAR(255) NOT NULL,
             PASSWORD VARCHAR(255) NOT NULL,
             EMAIL VARCHAR(255) NOT NULL,
             AGE VARCHAR(255) NOT NULL,
             STATUS VARCHAR(255) NOT NULL,
             PRIMARY KEY (CUSTOMER_ID),
             UNIQUE(CUSTOMER_NAME)
);

INSERT INTO CUSTOMER_DATA (CUSTOMER_NAME, PASSWORD,EMAIL,AGE,STATUS) VALUES("dinuka" ,"dinuka","dinukam@wso2.com","25","ACTIVE");
INSERT INTO CUSTOMER_DATA (CUSTOMER_NAME, PASSWORD,EMAIL,AGE,STATUS) VALUES("malinda" ,"malinda","malinda@gmail.com","25","INACTIVE");

As I mention in the early post we need to create the data sources in master-datasources.xml and plug the newly created JDBCUserStoreManager through the user-mgt.xml

1. Lets look at the modification of JDBCUserStoreManager.

If we need to get some user properties as claims then you need to override the following methods in JDBCUserStoreManager (Download the mvn project here).

    @Override
    protected String getProperty(Connection dbConnection, String userName, String propertyName,
                                 String profileName) throws UserStoreException {
        String sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.GET_PROPS_FOR_PROFILE);
        if (sqlStmt == null) {
            throw new UserStoreException("The sql statement for add user property sql is null");
        }
        PreparedStatement prepStmt = null;
        ResultSet rs = null;
        String value = null;
        try {
            prepStmt = dbConnection.prepareStatement(sqlStmt);
            prepStmt.setString(1, userName);

            rs = prepStmt.executeQuery();
            while (rs.next()) {
                if(propertyName.equals("EMAIL")){
                    value = rs.getString(1);
                }else if(propertyName.equals("AGE")){
                    value = rs.getString(2);
                }else if(propertyName.equals("STATUS")){
                    value = rs.getString(3);
                }
            }
            return value;
        } catch (SQLException e) {
            log.error("Using sql : " + sqlStmt);
            throw new UserStoreException(e.getMessage(), e);
        } finally {
            DatabaseUtil.closeAllConnections(null, rs, prepStmt);
        }
    }

    @Override
    public Map<String, String> getUserPropertyValues(String userName, String[] propertyNames,
                                                     String profileName) throws UserStoreException {
        if (profileName == null) {
            profileName = UserCoreConstants.DEFAULT_PROFILE;
        }
        Connection dbConnection = null;
        String sqlStmt = null;
        PreparedStatement prepStmt = null;
        ResultSet rs = null;
        String[] propertyNamesSorted = propertyNames.clone();
        Arrays.sort(propertyNamesSorted);
        Map<String, String> map = new HashMap<String, String>();
        try {
            dbConnection = getDBConnection();
            sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.GET_PROPS_FOR_PROFILE);
            prepStmt = dbConnection.prepareStatement(sqlStmt);
            prepStmt.setString(1, userName);

            rs = prepStmt.executeQuery();
            while (rs.next()) {
                String email = rs.getString(1);
                String age = rs.getString(2);
                String status = rs.getString(3);
                if (Arrays.binarySearch(propertyNamesSorted, "EMAIL") >= 0) {
                    map.put("EMAIL", email);
                }

                if(Arrays.binarySearch(propertyNamesSorted, "AGE") >= 0){
                    map.put("AGE", age);
                }

                if(Arrays.binarySearch(propertyNamesSorted, "STATUS") >= 0){
                    map.put("STATUS", status);
                }

            }

            return map;
        } catch (SQLException e) {
            throw new UserStoreException(e.getMessage(), e);
        } finally {
            DatabaseUtil.closeAllConnections(dbConnection, rs, prepStmt);
        }
    }

2. In this code you can see we are using some external sql query as GET_PROPS_FOR_PROFILE (realmConfig.getUserStoreProperty(JDBCRealmConstants.GET_PROPS_FOR_PROFILE);) so we need to pass it from user-mgt.xml as follows.

       
<UserManager>
    <Realm>
        <Configuration>
		<AddAdmin>true</AddAdmin>
                <AdminRole>admin</AdminRole>
                <AdminUser>
                     <UserName>admin</UserName>
                     <Password>admin</Password>
                </AdminUser>
            <EveryOneRoleName>everyone</EveryOneRoleName> <!-- By default users in this role sees the registry root -->
            <Property name="dataSource">jdbc/WSO2CarbonDB</Property>
            <Property name="MultiTenantRealmConfigBuilder">org.wso2.carbon.user.core.config.multitenancy.SimpleRealmConfigBuilder</Property>
	    <!-- Use the following MultiTenantRealmConfigBuilder with LDAP based UserStoreManagers-->
	    <!--Property name="MultiTenantRealmConfigBuilder">org.wso2.carbon.user.core.config.multitenancy.CommonLDAPRealmConfigBuilder</Property-->
        </Configuration>
	
	<UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager">
	    <Property name="ReadOnly">false</Property>
	    <Property name="dataSource">jdbc/WSO2CarbonDB</Property>
            <Property name="MaxUserNameListLength">100</Property>
            <Property name="Disabled">false</Property>                       
            <Property name="IsEmailUserName">false</Property>
            <Property name="DomainCalculation">default</Property>
            <Property name="PasswordDigest">SHA-256</Property>
            <Property name="StoreSaltedPassword">true</Property>
            <Property name="ReadGroups">true</Property>
	    <Property name="WriteGroups">true</Property>
            <Property name="UserNameUniqueAcrossTenants">false</Property>
            <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
            <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
	    <Property name="UsernameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>
	    <Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
	    <Property name="RolenameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>
	    <Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
            <Property name="UserRolesCacheEnabled">true</Property>
            <Property name="MaxRoleNameListLength">100</Property>
            <Property name="MaxUserNameListLength">100</Property>            
        </UserStoreManager>

	<UserStoreManager class="org.wso2.carbon.jdbc.sample.SampleJDBCUserStoreManager">
	    <Property name="ReadOnly">false</Property>
	    <Property name="dataSource">jdbc/SampleUserStore</Property>
            <Property name="MaxUserNameListLength">100</Property>
            <Property name="Disabled">false</Property>                       
            <Property name="IsEmailUserName">false</Property>
            <Property name="DomainCalculation">default</Property>
            <Property name="PasswordDigest">SHA-256</Property>
            <Property name="StoreSaltedPassword">true</Property>
            <Property name="ReadGroups">true</Property>
	    <Property name="WriteGroups">true</Property>
            <Property name="UserNameUniqueAcrossTenants">false</Property>
            <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
            <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
	    <Property name="UsernameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>
	    <Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
	    <Property name="RolenameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>
	    <Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
            <Property name="UserRolesCacheEnabled">true</Property>
            <Property name="MaxRoleNameListLength">100</Property>
            <Property name="MaxUserNameListLength">100</Property>
	    <Property name="DomainName">sample.com</Property>

            <Property name="SelectUserSQL">SELECT * FROM CUSTOMER_DATA WHERE CUSTOMER_NAME=?</Property>
            <Property name="UserFilterSQL">SELECT CUSTOMER_NAME FROM CUSTOMER_DATA WHERE CUSTOMER_NAME LIKE ?  ORDER BY CUSTOMER_ID</Property>
	    <Property name="GetUserPropertiesForProfileSQL">SELECT EMAIL,AGE,STATUS FROM CUSTOMER_DATA WHERE CUSTOMER_NAME=?</Property>
        </UserStoreManager>
	
	<AuthorizationManager
            class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager">
            <Property name="AdminRoleManagementPermissions">/permission</Property>
	    <Property name="AuthorizationCacheEnabled">true</Property>
        </AuthorizationManager>
    </Realm>
</UserManager>

3. Same as you did in early post you have to place the mysql-connector-java-5.1.7-bin.jar and Sample_user_store-1.0.jar in to $IS_HOME/repository/component/libs

4. Start the Identity server and Sign in as admin.

5. Go to claim management.
is
Now you can see some Available Claim Dialects here. In the user store manager is using the http://wso2.org/claims so we need to add the new claim mapping on this.

5. Go to http://wso2.org/claims Dialect.
is

6. Add new Claim EMAIL
is1
Here you need to specify the Mapped Attribute (s) as EMAIL because in our custom user store manager check the property name as “EMAIL”,”AGE”,”STATUS”

7. Add new Claim AGE
is

8. Add new Claim STATUS
is1

9. Lets look at the users
is

And go to User profile
is

Now you can see the properties in the database is coming under user profile.

10. Now we need to use those properties and do some authorization. So we can easily move to XACML engine coming with the Identity server to do the needful. Here I’m not going to explain the behavior of the XACML Engine in Identity server but you can follow my early blog posts such as
Authentication and Authorization with WSO2ESB and WSO2IS
XACML Authorization

11. Now I’m going to create the XACML policy buy using the claims that we newly added.
is1

You can see the claim names that we mapped early so you can select those from the UI.
is

Click on the policy name and go to source view of XACML policy.
is

is1

and replace the Deny with Permit and update the policy.
is2

12. Now enable the created policy as follows.

is

13. Go to Tryit and test your policy.

is1

is2

This is very basic example but when its coming to the real world example you can do so many things with this user store extensible facility. as well you can do all the above stuff with the use of web services which are exposed by WSO2 Identity Server.


Kathiravelu PradeebanMMTk mechanisms, policies, and plans

Class Diagram: MMTk Policies
MMTk is a flexible memory management utility written using java, for Jikes RVM. It is also ported to Rotor - the Microsoft's open C# runtime. Key Compositional Elements in MMTk are utilities, policies, and plans.

Bootstrapping
Jikes is meta-circular, as it is written in Java, the language it interprets as a JVM. Here, the functionality of the parent interpreter is applied directly to the source code being interpreted, without any additional implementation. Hence it requires a bootstrap VM to run upon, to create a boot image. However, it doesn't run on an external JVM. Rather, a small boot image runner written using C is responsible for loading the image files at run time, and it transfers the control to the native VM code that runs on the host [1].

Interruptibility
Compiler pragmas are used by MMTk to control the inlining and interruptibility, and scoped across methods and classes, where more specific pragma scopes such as method pragmas override the broader ones such as class pragmas. Classes annotated @Uninterruptible make the class uninterruptible. If most of the methods in a class are uninterruptible, annotating the class as uninterruptible is reasonable and preferred. All the policies and plans have the unintteruptible classes.


1) Mechanisms (utility)
1. Bump pointer allocation
2. Free list allocation
3. Large object allocation
4. Finalization

2) Policies (policy)
Spaces are contiguous regions of virtual memory, that is managed by a single policy. MMTk maps policies to spaces. In an address space, any given policy can manage multiple spaces.

Policies are implemented following the local/global pattern, and named XXXSpace and XXXLocal.
1. Copying Collector - CopySpace extends Space | CopyLocal extends BumpPointer
Class Diagram: MMTk Plans
2. Explicitly Managed Collector - ExplicitFreeListSpace extends SegregatedFreeListSpace | ExplicitFreeListLocal extends SegregatedFreeListLocal
3. ExplicitLargeObjectSpace extends BaseLargeObjectSpace |
4. Immortal Collector - ImmortalSpace extends Space | ImmortalLocal extends BumpPointer
5. Treadmill Collector - LargeObjectSpace extends BaseLargeObjectSpace | LargeObjectLocal extends LargeObjectAllocator
6. Mark-Compact Collector (MarkCompactCollector) - MarkCompactSpace extends Space | MarkCompactLocal extends BumpPointer
7. Mark-Sweep Collector - MarkSweepSpace extends SegregatedFreeListSpace | MarkSweepLocal extends SegregatedFreeListLocal
8. RawPageSpace extends Space
9. SegregatedFreeListSpace extends Space

Each instance of a policy space maps to a single virtual memory space, with P instances of the local class attached, where the collector is P-way parallel.

3) Plans (plan)
It is the highest level of composition, as it composes policies to build a memory management algorithm.
1. CMS (concurrent.marksweep)
2. CopyMS (copyms)
3. GenCopy (generational.copying)
4. GenMS (generational.marksweep)
5. GenImmix (generational.immix)
6. MC (markcompact)
7. MS (marksweep)
8. NoGC (Global state of a simple allocator without a collector)
9. RC (refcount.fullheap)
10. GenRC (refcount.generational)
11. SS (semispace)
12. GCTrace (semispace.gctrace)
13. UsePrimitiveWriteBarriers (semispace.usePrimitiveWriteBarriers)
14. StickyImmix (stickyimmix)
15. StickyMS (stickyms)

Kathiravelu PradeebanBuilding Jikes RVM on Ubuntu 12.04 / 64 bit from source

Jikes RVM is a research virtual machine, built using Java. Building Jikes RVM from the source (trunk) is pretty interesting.


Installing the pre-requisites

Mercurial is the version control system of Jikes RVM. (To learn the basics of Mercurial, please refer to this article.) Jikes RVM is built using Apache Ant. Make sure to install these.
sudo apt-get install mercurial ant

Install gcc, g++, gcc-multilib, and g++-multilib
sudo apt-get install gcc-multilib g++-multilib


Checking out the source

Checkout the source code of Jikes RVM.
hg clone http://hg.code.sourceforge.net/p/jikesrvm/code jikesrvm

Updating the source
If you have already checked out the source code sometime back, you may have to update it to reflect the later changes.
To view the information of the working directory, such as the version number, from the root directory,
hg log -l1


To update,
hg pull

hg update



Building using Ant
Find the target architecture of your system.
uname -m
x86_64


Build using Ant from jikesrvm (the root directory of Jikes RVM).
 ant -Dconfig.name=prototype -Dhost.name=x86_64-linux -Dtarget.name=x86_64-linux

Here,
1) host.name and target.name entries should match the names of the properties files present in the directory jikesrvm/build/hosts (without the suffix, .properties).

2) config.name entry should match the names of the properties files present in the directory jikesrvm/build/configs (without the suffix, .properties).

You may alternatively build Jikes using the buildit tool that is included in the project.
 bin/buildit -j $JAVA_HOME localhost production


Common Exceptions

1) You may encounter the below exceptions, if you have 32-bit GTK libraries installed on a 64-bit machine.
     [exec] checking for X... no
     [exec] configure: error: GTK+ peers requested but no X library available

BUILD FAILED
/home/pradeeban/jikesrvm/build.xml:266: The following error occurred while executing this line:
/home/pradeeban/jikesrvm/build.xml:272: The following error occurred while executing this line:
/home/pradeeban/jikesrvm/build/components/classpath.xml:305: The following error occurred while executing this line:
/home/pradeeban/jikesrvm/build/components/base.xml:70: The following error occurred while executing this line:
/home/pradeeban/jikesrvm/build/components/base.xml:76: The following error occurred while executing this line:
/home/pradeeban/jikesrvm/build/components/classpath.xml:254: exec returned: 1
Passing the flag -Dcp.enable.gtk-peer="--disable-gtk-peer" will fix this issue.

 ant -Dconfig.name=prototype -Dhost.name=x86_64-linux -Dtarget.name=x86_64-linux -Dcp.enable.gtk-peer="--disable-gtk-peer"

2) You may encounter the below exceptions, if you miss gcc-multilib and g++-multilib in your system.

build:
     [exec] checking build system type... Invalid configuration `x86_64-unknown-linux-': machine `x86_64-unknown-linux' not recognized
     [exec] configure: error: /bin/bash ./config.sub x86_64-unknown-linux- failed

BUILD FAILED
/home/pradeeban/jikesrvm/build.xml:266: The following error occurred while executing this line:
/home/pradeeban/jikesrvm/build.xml:272: The following error occurred while executing this line:
/home/pradeeban/jikesrvm/build/components/classpath.xml:305: The following error occurred while executing this line:
/home/pradeeban/jikesrvm/build/components/base.xml:70: The following error occurred while executing this line:
/home/pradeeban/jikesrvm/build/components/base.xml:76: The following error occurred while executing this line:
/home/pradeeban/jikesrvm/build/components/classpath.xml:254: exec returned: 1

Running Jikes RVM
Once built, you will find the complete rvm runtime directory at ${dist.dir}/${config.name}_${target.name} (For me, it was dist/prototype_x86_64-linux, as I built with 'prototype' configuration). Now you should be able to run the rvm from the directory. A Java class can be run as below.
javac HelloWorld.java
./rvm HelloWorld

Supun KamburugamuvaStarting Hadoop, setting Datanode directory file permissions

I was trying to start Apache Hadoop in my Ubuntu machine with the data node and name node on the same machine. I've changed the hdfs-site.xml as following.

Loading ....
Then when the datanode starts it said the permission of the data directory is incorrect.

WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Invalid directory in dfs.data.dir: Incorrect permission for /home/supun/dev/apache/hadoop-data/data, expected: rwxr-xr-x, while actual: rwxrwxr-x

So I had to change the permission of the data dir as following and it worked. 

chmod 755 hadoop-data/data

Dinuka MalalanayakeHow to write Custom JDBC user store manager with WSO2IS 4.1.1 alpha

Download id 4.1.1- alpha here
Lets think about real world business scenario, Simple company has their own database with Customer name and the password. now they need to do some security implementation with WSO2 Identity Server and they cannot duplicate those data as well as cannot change their db schema.

That means we cannot take those users and insert into the WSO2 IS database as well as they cannot change their DB schema to our WSO2 IS database schema. Don’t worry WSO2 Identity server has capability to solve this issue. lets look at the solution with mysql DB.

Steps:
1. Plug the external db as secondary user store.
2. Create some roles in Identity Server and assign the users (coming from external DB).
3. Give the permission to the role.
4. Access the Identity server.

Custom DB Schema

CREATE TABLE CUSTOMER_DATA (
             CUSTOMER_ID INTEGER NOT NULL AUTO_INCREMENT,
             CUSTOMER_NAME VARCHAR(255) NOT NULL,
             PASSWORD VARCHAR(255) NOT NULL,
             PRIMARY KEY (CUSTOMER_ID),
             UNIQUE(CUSTOMER_NAME)
);

1. First we have to write down the Custom JDBCUserStoreManager to compatible with the above schema. So you need to create a class with any name that you preferred and extends JDBCUserStoreManager. I have created class call SampleJDBCUserStoreManager.java (download mvn project here).

In my custom class I’m not going to override all methods in JDBCUserStoreManager because this user store is going to plug as read only mode.

2. Let’s look at the master-datasource.xml
I have created two data source because I’m going to connect to the two user stores as primary and secondary. you bettor read my early blog post call (Multiple User Stores configuration in WSO2 Identity Server) but there is lot of api changes in 4.1.1 alpha.

<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
  
    <providers>
        <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
    </providers>
  
    <datasources>
      
        <datasource>
            <name>WSO2_CARBON_DB</name>
            <description>The datasource used for registry</description>
            <jndiConfig>
                <name>jdbc/WSO2CarbonDB</name>
            </jndiConfig>
	    <definition type="RDBMS">
                <configuration>
                    <url>jdbc:mysql://localhost:3306/WSO2_CARBON</url>
                    <username>root</username>
                    <password>root</password>
                    <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
           
        </datasource>

	<datasource>
            <name>Sample_DB</name>
            <description>The datasource used for user manager</description>
            <jndiConfig>
                <name>jdbc/SampleUserStore</name>
            </jndiConfig>
	    <definition type="RDBMS">
                <configuration>
                    <url>jdbc:mysql://localhost:3306/custom_users</url>
                    <username>root</username>
                    <password>root</password>
                    <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
	</datasource>
        
    </datasources>

</datasources-configuration>

3. Go to user-mgt.xml
Here I have define two user store manages and the first definition pic as primary user store manager form the Identity server.
The secondary one is the custom user store manager that i have written early.

 
<UserManager>
    <Realm>
        <Configuration>
		<AddAdmin>true</AddAdmin>
                <AdminRole>admin</AdminRole>
                <AdminUser>
                     <UserName>admin</UserName>
                     <Password>admin</Password>
                </AdminUser>
            <EveryOneRoleName>everyone</EveryOneRoleName> <!-- By default users in this role sees the registry root -->
            <Property name="dataSource">jdbc/WSO2CarbonDB</Property>
            <Property name="MultiTenantRealmConfigBuilder">org.wso2.carbon.user.core.config.multitenancy.SimpleRealmConfigBuilder</Property>
	    <!-- Use the following MultiTenantRealmConfigBuilder with LDAP based UserStoreManagers-->
	    <!--Property name="MultiTenantRealmConfigBuilder">org.wso2.carbon.user.core.config.multitenancy.CommonLDAPRealmConfigBuilder</Property-->
        </Configuration>
	
	<UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager">
	    <Property name="ReadOnly">false</Property>
	    <Property name="dataSource">jdbc/WSO2CarbonDB</Property>
            <Property name="MaxUserNameListLength">100</Property>
            <Property name="Disabled">false</Property>                       
            <Property name="IsEmailUserName">false</Property>
            <Property name="DomainCalculation">default</Property>
            <Property name="PasswordDigest">SHA-256</Property>
            <Property name="StoreSaltedPassword">true</Property>
            <Property name="ReadGroups">true</Property>
	    <Property name="WriteGroups">true</Property>
            <Property name="UserNameUniqueAcrossTenants">false</Property>
            <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
            <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
	    <Property name="UsernameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>
	    <Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
	    <Property name="RolenameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>
	    <Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
            <Property name="UserRolesCacheEnabled">true</Property>
            <Property name="MaxRoleNameListLength">100</Property>
            <Property name="MaxUserNameListLength">100</Property>            
        </UserStoreManager>

	<UserStoreManager class="org.wso2.carbon.jdbc.sample.SampleJDBCUserStoreManager">
	    <Property name="ReadOnly">false</Property>
	    <Property name="dataSource">jdbc/SampleUserStore</Property>
            <Property name="MaxUserNameListLength">100</Property>
            <Property name="Disabled">false</Property>                       
            <Property name="IsEmailUserName">false</Property>
            <Property name="DomainCalculation">default</Property>
            <Property name="PasswordDigest">SHA-256</Property>
            <Property name="StoreSaltedPassword">true</Property>
            <Property name="ReadGroups">true</Property>
	    <Property name="WriteGroups">true</Property>
            <Property name="UserNameUniqueAcrossTenants">false</Property>
            <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
            <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
	    <Property name="UsernameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>
	    <Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
	    <Property name="RolenameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>
	    <Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
            <Property name="UserRolesCacheEnabled">true</Property>
            <Property name="MaxRoleNameListLength">100</Property>
            <Property name="MaxUserNameListLength">100</Property>
	    <Property name="DomainName">sample.com</Property>

            <Property name="SelectUserSQL">SELECT * FROM CUSTOMER_DATA WHERE CUSTOMER_NAME=?</Property>
            <Property name="UserFilterSQL">SELECT CUSTOMER_NAME FROM CUSTOMER_DATA WHERE CUSTOMER_NAME LIKE ?  ORDER BY CUSTOMER_ID</Property>
        </UserStoreManager>
	
	<AuthorizationManager
            class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager">
            <Property name="AdminRoleManagementPermissions">/permission</Property>
	    <Property name="AuthorizationCacheEnabled">true</Property>
        </AuthorizationManager>
    </Realm>
</UserManager>

You can see I’m passing the custom SQLs as “SelectUserSQL” and “UserFilterSQL”

4. You need to put following jars in to the $IS_HOME/repository/component/libs
mysql-connector-java-5.1.7-bin.jar and Sample_user_store-1.0.jar

5. Now I’m going to start the Identity server and sign in as admin

6. Go to users then you can see the users coming from secondary user store as read only
is

7. Now we need to create the internal role because we cannot create the roles inside of the secondary user store manager due to read only mode.So you can do it as follows.

is1

you have to give the permission to the created role

is2

Now you can assign the users from secondary user store.

is

8. Login to the IS from the secondary users.

is


Kathiravelu PradeebanLisbon - Weeks 30 & 31

Cooking in Lisboa!
[30/03/2013] - This week comes with the Easter vacation, which was not really a vacation, as we had projects to be completed for the checkpoint.

[29/03/2012] For the past few days this week, I have been cooking myself, and interestingly, it came out pretty well. Within 3 days since I started cooking, I have even started to cook without a recipe. So much win, and yet another mission successful of the year 2013. There is a Nepal restaurant (Restaurante Kathmandu) close to my apartment which has a good Chicken mango curry. So I decided to try and cook it. 

The mango recipe of Fish or Chicken are pretty simple. First you cook Chicken in Coconut milk without adding spices (no curry powder or chilli powder), except onion, garlic, turmeric, ginger etc, and eventually start adding Mango milkshake, as the chicken is cooked. Mango milkshake was made with one mango, two cups of yoghurt, some milk, a little salt, and a tablespoon lime juice as the ingredients. The final flavor of the sauce is mostly yummy mango. Cooking with coconut milk was just to cook the chicken long enough, without spoiling the mango flavor. So the only difference is, replacing the chilli powder/curry powder combination with the mango milkshake. Make sure the mango milkshake is not burnt. It easily gets burnt and sticks to the pan, as it is sugar. Adding it later to the pan helps avoiding this, while preserving the sweetness. I tried banana apple milkshake too. But Mango seems better. You should give a try to mango.
Obidos
Fish Mango curry, Leaves curry, Carrot mango curry, and Rice in the image above. It was a huge success for the 3rd night of my cooking. Fish mango curry was a dish inspired from the Chicken mango of the Restaurante Kathmandu. However, I guess, I am the first to invent Fish Mango in this way.. :D Recipe (my own recipe.. haha..)

[27/03/2013] - We paid a quick visit to Obidos. It is a lovely neighbourhood. Regular bus services are available from Campo Grande of Lisboa, operated by Rodo Tejo. (Return trip, 2* 7.55 Euro).

[18/03/2013] - Freeport is a huge open shopping centre (centro comercial) situated in Alcochete, across the Tagus river, which can be reached by the bus 431 from Oriente, and many other means, pretty easily. The shopping centre was not that interesting, though it is considered to be the largest outlet in Europe. However the bus travel over the Vasco da gama bridge, which is considered the longest bridge in the Europe, was interesting.

3 months have already passed this year (almost!). Happiness, Excitement, Craziness, Sadness, Depression, and Stupidity - everything that comes in a mixture, slightly overdose, and that is my year 2013.

Dinuka MalalanayakeSimple Java Client to talk to Queues and Topics in IBM MQ 7.5

IBM MQ is one of Message Queue implementation heavily used for interprocess communication in the software industry.
So I just crated a simple java client to talk to Queues and Topics in the IBM MQ.
Here I’m going to talk to the IBM MQ through the “.binding” file provided by the IBM MQ installation.

1. First you need to install the IBM MQ (I’m using windows machine to Install the IBM MQ).
2. Open IBM WebSphere MQ Explorer and do the following

Create Queue Manager as mymgr
1

Create Local Queue as localq
2

Create Local Topic as localt
3

3. Go to C:\Program Files\IBM\WebSphere MQ\java\bin, and invoke IVT app by running the following command:

IVTRun.bat –nojndi

If successful the following will be displayed:
4

4. Run the following command:
IVTRun.bat -nojndi -client -m mymgr -host localhost -channel mychannel

If successful the following will be displayed:
5

5. Navigate to to C:\IBM\WebSphere MQ\java\bin directory, open ‘JMSAdmin.config’ file and edit the file as follows:
a. Uncomment the configuration for INITIAL_CONTEXT_FACTORY
ex: INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
b. Point to an empty folder for PROVIDER_URL – ex: PROVIDER_URL=file:/C:/JNDI-Directory

6. Create the default set of JNDI bindings by running the following command in the command prompt:
IVTSetup.bat

If successful the following will be displayed:
6

7. Let’s use the JMSAdmin tool to make some modifications in the JNDI bindings
Navigate to the C:\IBM\WebSphere MQ\java\bin directory from the console and start jmsadmin by running the following command:
jmsadmin.bat

Run the following commands:

For Queue:
ALTER QCF(ivtQCF) TRANSPORT(CLIENT)
ALTER QCF(ivtQCF) QMGR(mymgr)
For Topics:

ALTER TCF(ivtTCF) TRANSPORT(CLIENT)
ALTER TCF(ivtTCF) QMGR(mymgr)

8. Go to the “JMS Administered Objects” and select Add initial context. Then select the “File system” and enter the JNDI directory path. Then you can view all created Queues and Topics.

4 (1)

4 (2)

9. Now you can download the Java project here and open it form JIdea and make the following changes and run the client.
Replace your JNDI-Directory path
Replace the Queue Name and Queue connection factory name
Replace the Topic Name and Topic connection factory name


Isuru SuriarachchiSlow internet with Zoom 5350 Router? Here’s how to fix..

I’m using a Zoom 5350 Router and I’ve been experiencing a very slow connection specially when streaming. I thought it’s something to do with my ISP and called them. But they couldn’t find any issues with my connection. After trying many things, finally I found that the issue is with my Router. Actually what you have to do is a very simple configuration change to disable IP Flood Detection which is enabled by default. See this for more details.


Adam FirestoneThe Top Five Misconceptions About Open Source Software in Government Programs



On March 15, 2013, ComputerWeekly.com, the “leading provider of news, analysis, opinion, information and services for the UK IT community” published an article by Bryan Glick entitled “Government mandates ‘preference’for open source.”  The article focuses on the release of the UK’s new GovernmentService Design Manual, which, from April 2013, will provide governing standards for the online services developed by the UK’s government for public consumption.

Perhaps the most interesting part of the new document is a section entitled “When to use open source.”  Interesting to me, at least.  For a number of years I’ve been advocating the use of open source products for projects within the US defense and intelligence communities.  So forgive me for going a little green with envy when I read the following within that section:
Use open source software in preference to proprietary or closed source alternatives, in particular for operating systems, networking software, web servers, databases and programming languages.
The statement doesn’t leave much room for discussion or doubt.  When there’s a choice between comparable alternatives, open source wins. Period. How enlightened!

Within US government programs, while the use of open source software (OSS) is not mandatory it is both permissible and often encouraged.  However, due to the Byzantine nature of the controlling laws, regulations, policies and guidance (LRPG) as well as some popular misconceptions, architects, systems engineers and developers often encounter reactions ranging from unfamiliarity to resistance when recommending the use of OSS.  For the remainder of this article, we’ll debug five of the most widespread misconceptions.  Specifically, we'll talk about the myths that:
  • OSS isn't widely used in government programs;
  • OSS isn't equivalent to commercial software;
  • Government information assurance policies prohibit OSS;
  • OSS is less secure than proprietary software; and
  • It's easier to insert malicious code into OSS.

OSS Isn’t Widely Used in Government Programs
Open source components and applications have long been leveraged by US government programs, and often provide irreplaceable core system capabilities.  To name a few:
  • Mozilla Firefox Browser and Thunderbird Email Client;
  • Google Android Operating System for Mobile Devices;
  • Apache Tomcat Web Server and Servlet Container;
  • Linux Operating System;
  • PostgreSQL Object Relational Database Management System (ORDBMS);
  • Drupal Content Management System;
  • WSO2 Enterprise Service Bus (ESB);
  • Apache Hadoop Distributed Computing Framework; and
  • NASA World Wind Geospatial Information System (GIS).

OSS Isn’t Equivalent to Commercial Software
Most, if not all, OSS applications and components are, by law, commercial items.  The definition comes from a US federal law (41 USC 403, subsection 12) that identifies a “commercial item” as
(A) Any item, other than real property, that is of a type customarily used by the general public or by nongovernmental entities for purposes other than governmental purposes, and that -
(i) has been sold, leased, or licensed to the general public; or
(ii) has been offered for sale, lease, or license to the general public.
(B) Any item that evolved from an item described in subparagraph (A) through advances in technology or performance and that is not yet available in the commercial marketplace, but will be available in the commercial marketplace in time to satisfy the delivery requirements under a Federal Government solicitation.
(C) Any item that, but for -
(i) modifications of a type customarily available in the commercial marketplace, or
(ii) minor modifications made to meet Federal Government requirements, would satisfy the criteria in subparagraph (A) or (B).
The interpretation of this law as declaring OSS to be “commercial software” was confirmed by the DoD’s issuance of “Clarifying Guidance Regarding OSS” on October 16, 2009 and the US Navy’s issuance of a memorandum for OSS guidance on July 5, 2007. 

Moreover, the US Office of Management and Budget (OMB) has recognized the commercial nature of OSS support agreements since the 2003 issuance of memorandum M-03-14 “Reducing Cost and Improving Quality in Federal Purchases of Commercial Software.”  Indeed, many well-known commercial companies (e.g., IBM, RedHat, Novell, Microsoft, etc.) earn considerable revenue by supporting open source products.  Other commercial companies, such as WSO2, build open source software products and generate revenue solely from support and consulting associated with those products.


Government Information Assurance Policies Prohibit OSS
This misconception derives from a misreading or, more accurately, an incomplete reading of DoD Instruction 8500.2 “Information Assurance (IA) Implementation.”  This document contains an enclosure (Enclosure 4) entitled “Baseline Information Assurance Levels.”  This enclosure contains a number of software controls with which an approved system must comply (or, if non-compliant, must receive a waiver from the “Designated Approval Authority” (DAA)).  Among them is control DCPD-1 “Public Domain Software Controls.” The idea that OSS is prohibited arises because many people only read the first set few lines, which read:
Binary or machine executable public domain software products and other software products with limited or no warranty such as those commonly known as freeware or shareware are not used in DoD information systems unless they are necessary for mission accomplishment and there are no alternative IT solutions available.
The text of the control continues, however:
Such products are assessed for information assurance impacts, and approved for use by the DAA. The assessment addresses the fact that such software products are difficult or impossible to review, repair, or extend, given that the Government does not have access to the original source code and there is no owner who could make such repairs on behalf of the Government. (Emphasis added.)
The key to fully understanding this control lies in the last sentence, which discusses consequences flowing from the fact that the government does not have access to the original source code.  The control (which was put in place to deal with abandoned binaries) clearly cannot apply to OSS because by definition, the user has access to the source code!


OSS is Less Secure than Proprietary Software
There is a common misunderstanding along the lines of “since OSS is available for the world to see, it’s easier to hack.”  Put another way, the assertion is that since the source code for proprietary software is not disclosed, attackers are unaware of vulnerabilities. Reality and the information technology community disagree with this premise.  As far back as 1973 Jerome Saltzer and Michael Schroeder argued in their paper “The Protection of Information in Computer Systems” that depending on attacker ignorance isn’t an effective protection mechanism.  More recently, security experts Vincent Rijmen (one of the creators of the Rijndael algorithmthat later became the Advanced Encryption Standard (AES)) and Whitfield Diffie(a pioneer of public key cryptography) echoed the sentiment.

It’s especially telling that prior to adopting the Rijndael algorithm as AES in Federal Information Processing Standard (FIPS) 197 in 2001, the National Institute of Standards and Technology (NIST) published the algorithm publicly.  Approximately three years were allocated, during which cryptanalysts from all over the world were asked to try to defeat Rijndael.  In the end, all attempts failed, and AES remains the core of US government encryption methods today.  Of the transparent (and essentially open source) process, Bruce Schneier, author of one of the losing algorithms said “I have nothing but good things to say about NIST and the AES process.”


It’s Easier to Insert Malicious Code into OSS
One of the arguments made against OSS is that anyone can modify it, including attackers.  The reality is that ANY code can be modified; all you need is a hex editor.  The real issue is getting the modified code into the supply chain.  Not only does this premise require subverting both the developers and the trusted repository, but it simply ignores the realities of working with a distributed source.  OSS, whether developed by a community or a company, is regularly reviewed by a loosely coupled inspection organization that is many times the size of those economically feasible for proprietary developer companies.  Additionally, the wide range of reviewers results in inspection from many different perspectives. 

As a result, it is much more difficult for subverted code to remain undetected for long.   Perhaps the most illustrative story in this vein is that of Borland’s InterBase/Firebird database.  When developed, a back door was built into the system.  Using the username “politically” and the password “correct” it was possible to get administrative access to the database over the Internet.  At the time of discovery in 2001, it was estimated that the back door had existed at least since 1994.  From an OSS standpoint, it’s interesting to note that Borland open sourced the InterBase source code under a Mozilla Public License in mid-2000.  Within five months of the open source release, the security hole that had lain undiscovered for at least seven years had been discovered.


Conclusion
In summary, while the US government has, to date not issued guidance requiring a preference for open source, it has clearly indicated that open source products are to be given at least as much preference as proprietary products.  Additionally, open source products come with some significant intrinsic benefits with respect to security and information assurance.  What this really means is that acquisitions managers have greater choice and an increased ability to make programmatic decisions that increase capability while lowering total cost of ownership.  And that’s a recipe for success all around.







Muhammed ShariqInstalling ia32-libs on Ubuntu 12.04


If you ever wanted to run a 32-bit program in a 64-bit Ubuntu 12.04 and encountered package dependency issues while trying to install the ia32-libs via apt-get, don't worry, you are not alone. I myself tried this once when I wanted to install JD-GUI (Java de-compiler) but gave up because I ran out of options that time. This time however I had no choice but to get it to work. Good news is that I manage to to install the necessary libs thanks to post found at [1]. For my own future reference and also for those who might need this I am writing it down here, hope some find it useful, lemme know if its you :)

Downgrade the installed package is follows;

$sudo vi /etc/apt/preferences

and insert the following code;

Package: *       
Pin: release a=precise*
Pin-Priority: 2012

and "write & quite" by doing ":wq!"

Next you can downgrade the packages as follows;

$sudo apt-get dist-upgrade

This operation is going to take a while, so let if complete. Once it is done you can install ia32-libs as follows;

$sudo apt-get install ia32-libs

Don't forget to remove the preference file you created, remove it as follows;

$sudo rm /etc/apt/preferences

If not new updated will not be installed. That's it you can now run you 32-bit applications without a issue. Hope this post will help you.!

[1] - http://askubuntu.com/questions/136394/cannot-install-ia32-libs

Chris Haddad10 Ways To Participate In Open Source

I wonder why more open source users do not actively participate in the open source community and become committers or contributors.

After understanding a project’s capabilities and roadmap, anyone is able to start directly hacking the source code and contributing useful extensions. Because open source is a distributed, participatory meritocracy, the upside benefit is high and the barrier to entry is low—you don’t have to move, be employed by a Valley startup, give up your day job, or wait to obtain a 4 years for a degree.

Over on opensource.com, I have published an article describing 10 Ways to Participate in Open Source.      If you want to hear the webinar presentation, register at the WSO2 site.

Muhammed ShariqScaling transparent images in Java.

Ever had the need to scale images using Java? If so you would have realized that its a fairly easy task given the amount of support provided by Java Imaging API's as well as the numerous resources available online. Yup I just said it, numerous resources online, so the obvious question why write another blog post? Well you are about to find out.

I've been working on scaling uploaded images using Java for a couple of days now. Everything works fine for an opaque image, but not too well for transparent images. As it turned out most of the articles on scaling images discussed how to scale opaque images but not transparent ones. So I thought I might as well blog about it.

The issue with scaling transparent images are that the resulting images is distorted, and the transparent areas are drawn in black! Check out the two images below.

                                        Original image                           Scaled Image

This obviously wasn't acceptable, as a quick fix we investigated on coloring the transparent images to White color but the that was an ugly fix too.

Most of the blogs and forums that discussed this issue of black background issue suggested setting the ColorModel to BufferedImage.TYPE_INT_ARGB but unfortunately that didn't quite work for me.

The issue is how we paint the image once transformed, make sure to write the image in PNG format so that transparency is preserved. JPEG doesn't support transparency and GIF formats behave differently depending on the background etc. On the other hand using PNG works fine for transparent and opaque images.
          
private static DataHandler scaleImage(DataHandler dataHandler, int height, int width) throws IOException {

Image image = ImageIO.read(new BufferedInputStream(dataHandler.getInputStream()));
// Check if the image has transparent pixels
boolean hasAlpha = ((BufferedImage)image).getColorModel().hasAlpha();

// Maintain Aspect ratio
int thumbHeight = height;
int thumbWidth = width;
double thumbRatio = (double)width / (double)height;
double imageRatio = (double)image.getWidth(null) / (double)image.getHeight(null);
if (thumbRatio < imageRatio) {
thumbHeight = (int)(thumbWidth / imageRatio);
} else {
thumbWidth = (int)(thumbHeight * imageRatio);
}

BufferedImage thumb;
// Check if transparent pixels are available
// and set the color mode accordingly
if (hasAlpha) {
thumb = new BufferedImage(thumbWidth, thumbHeight,
BufferedImage.TYPE_INT_ARGB);
} else {
thumb = new BufferedImage(thumbWidth, thumbHeight,
BufferedImage.TYPE_INT_RGB);
}
Graphics2D graphics2D = thumb.createGraphics();
graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null);

// Save the image as PNG so that transparent pixels are rendered
ByteArrayOutputStream output = new ByteArrayOutputStream();
ImageIO.write(thumb, "PNG", output);

DataSource dataSource= new ByteArrayDataSource(output.toByteArray(),
"application/octet-stream");
return new DataHandler(dataSource);
}

As you can see the image format is set to PNG when and the final image is returned as a DataHandler.

If you want to iterate each and every pixel of an image and then identify transparent pixels and change the color of that pixel you can do it as follows;

int destWidth = 151;
int destHeight = 179;
BufferedImage dest = new BufferedImage(destWidth, destHeight,
BufferedImage.TYPE_INT_ARGB);
for (int i = 0; i < dest.getHeight(); i++) {
for (int j = 0; j < dest.getWidth(); j++) {
int pixel = dest.getRGB(j, i);
byte alpha=(byte)pixel;
alpha%=0xff;
if (pixel == 0) {
// Set the color of the pixel to White
dest.setRGB(j, i, Color.WHITE.getRGB());
}
}
}

More useful links on scaling images are listed below.


[1] - http://developeriq.in/articles/2010/oct/07/playing-with-images-using-java/
[2] - http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html


Chamara SilvaHow to deactivate monitor sleep in Raspbery Pi

This is my personal experience. I have installed "Raspbery Pi Wheezy" in to my raspberry pi. I used it to display some browser based dashboard and it going to sleep mode frequently. i found this solution from one of the site i couldn't' remember what it is. Following was the solution what i have used to avoid this issue. It's worked perfect. 1. Open a root terminal in raspberry Pi. Now  you

Ganesh PrasadThe Happy Confluence of IAM, SOA and Cloud


Someone pointed me to this Gartner blog post on IAM, and I was once again reminded why Gartner doesn't get it, (or when they do, they get it much after everyone else).

The Gartner analyst in his presentation makes a big deal of the fact that LDAP, being a hierarchical data structure, is incapable of modelling the various complex relationships between entities in an IAM system. This is one of the reasons he believes we need to "kill IAM in order to save it". But is this limitation in traditional IAM systems really new? I'm no fan of LDAP, and it has been known in IAM circles for at least 5 years that LDAP directories are suited for nothing other than the storage of authentication credentials (login names and passwords)! Everything else should go into a relational database, which is much better at modelling complex relationships. A meaning-free identifier links an LDAP entry with its corresponding record in the relational database. I describe this hybrid design in a fair amount of detail in my book "Identity Management on a Shoestring". And this wasn't even my original idea. It was one of the pieces of advice my team got from a consultant (Stan Levine) that my employer hired to review our IAM plans.

Seriously, where has Gartner been?

Another big point made by the Gartner analyst was that IAM should not be "apart from" the rest of an organisation's systems but become "a part of" them. Joining the dots with my cynical knowledge of where Gartner tends to go with this kind of argument, I can see them making the case for big vendors that do everything including IAM. The cash registers at SAP, Oracle and Salesforce.com must have started ringing already, since Gartner has given those vendors' product strategies their all-important blessing.

Um, no. If there's anything we've learnt in the last few years (especially from SOA thinking), it's the great benefits that are gained from loose coupling. IAM should neither be "apart from" (decoupled) nor "a part of" (tightly coupled) with respect to an organisation's other, business-related systems. IAM needs to be loosely-coupled with respect to them.

What does this mean in practical terms? It means IAM needs to be a cross-cutting concern that can be transparently layered onto business systems to enforce access policies, but without disrupting those systems with IAM-related logic.

That's really what the latest IAM technology, OAuth 2, brings to the table. But the Gartner analyst, while dwelling for quite a while on how great OAuth is, completely omits to define its true contribution.

Eve Maler of Forrester says it much better in her presentations. She defines OAuth as a way to delegate authorisation, and positions it as a way to protect APIs. Can you see the confluence of IAM, SOA and the Cloud in that simple characterisation?

Let's take those two aspects one by one and have a closer look.

OAuth as a way to delegate authorisation:
The traditional model of authorisation works like this. There is an entity that owns as well as physically controls access to a resource. When a client requests access to that resource, the owning entity does three things:

1. Authenticates the client (i.e., establishes that they are who they claim to be)
2. Checks the authorisation of the authenticated client to access the resource (i.e., acts as a Policy Decision Point)
3. Allows (or denies) the client access to the resource (i.e., acts as a Policy Enforcement Point)

What OAuth does is recognise that the Policy Decision Point and the Policy Enforcement Point may be two very different organisational entities, not just two systems within the same organisational entity. The PDP role is typically performed by the owner of the resource. The PEP role is performed by the custodian of the resource. The owner need not be the custodian.

Under the OAuth model, there is a three-way handshake between the owner of a resource, the custodian of the resource and a client. Three separate trust relationships are established between the three pairs of entities in this model, and authentication is obviously required in setting these up (owner-to-client, owner-to-custodian and client-to-custodian-through-owner). Once the owner's permission to access the resource for a certain window of time is recorded in the form of an access token that the client stores, the owner's presence is no longer required when such access takes place. The custodian is able to verify the token and allow access in accordance with the owner's wishes even in the owner's absence. This is delegated authorisation.

And since the resource doesn't even know it's being protected, this is loose coupling. IAM is neither "apart from" nor "a part of" the business system with OAuth.

OAuth as a way to protect APIs:
The delegated authorisation model can be used to protect resources that are not just "things" but also "actions". In other words, OAuth can be used to control who can invoke what logic, and do so in a delegated manner. In other words, owners of business logic can grant access to clients to invoke business logic, and custodians that host such business logic can validate the access tokens presented by clients and allow or deny access in accordance with the wishes of the owners.

Now why does this development in the IAM world bring it into confluence with the SOA and cloud worlds?

The SOA bit is easy to understand. We did mention that an API is a form of resource. If all business logic can be reduced to service operations exposed through endpoints, then these form an API. Endpoints can be protected by OAuth as we saw, so OAuth can be an effective security mechanism for SOA.

The cloud bit isn't hard to understand either. If business logic can be abstracted behind APIs, then does it matter where that logic sits? Bingo - cloud! The cloud also forces separation of owner and custodian roles, with the cloud platform performing the role of custodian, and the cloud customer performing the role of resource owner or API owner. With OAuth as the authorisation mechanism, the cloud model becomes viable from an access control perspective as well.

So that's really what OAuth signifies. It's not just a development in IAM. It has profound implications for SOA security and the viability of the cloud model.

Watch for Gartner to break this news to their clients in 3 to 5 years' time...

(Meanwhile, someone at Gartner or elsewhere ought to tell that analyst that "staid" is not spelled "stayed". This presentation has irritated me on so many levels - spiritually, ecumenically, grammatically, as Captain Jack Sparrow said.)

Ganesh PrasadThe Promise And The Potential Of WSO2


(I write this piece with a bit of trepidation as I don't know how it will be taken, but I mean it with the very best of intentions and wishes for my ex-colleagues.)

Looking over the list of my FaceBook friends, I am struck by how many of those I connected with during my brief assignment with WSO2 (Aug-Dec 2011) have moved on to pursue graduate programs of study at US universities. Just like Macquarie Bank in Australia was once called "The Millionaire Factory" for making so many employees rich through bonuses, this little company is rapidly becoming an Intellectuals' Factory. If they succeed in staying in business over the next decade, they will have seeded some very powerful and influential links in academia and the higher levels of the technology world.

Which brings me to my main point - does WSO2 have what it takes to survive the next decade? I believe they do, and not just survive but also move up to the next higher level. But to do that requires a kind of thinking I have not seen from the company's leadership so far.

For at least the last five years, I have been searching for a "next-generation SOA company". I thought I had found it with WSO2, but was quickly disappointed when I realised that this was a company with traditional SOA thinking and only a next-generation business model (free software and paid-for support). That's not quite what I was looking for, and to me, it explains why WSO2 hasn't yet hit the big time in spite of a decent product suite and some very smart, sincere and hard-working people. They're just not revolutionary enough for the market to take notice.

OK, so what do I have in mind?

The view of SOA as being ultimately about SOAP-based Web Services in its implementation (OK, and some REST as well) is so last-decade. That view of SOA, I am convinced, is actually toxic to organisations. The impacts of that kind of SOA to agility and cost are entirely negative. (I have numbers to prove it but I could be sued by more than one ex-employer for breach of confidentiality, so you'll just have to take my word for it.)

If you sell traditional SOA with a different business model, you're not even half revolutionary. You're an interesting sideshow to the main game, and when the traditional SOA model gets discredited, as it largely has already, you get washed away in a way the IBMs and Oracles don't because of their size. (Which is a pity because I simply hate the IBMs and Oracles for what they have done to the industry - milked customers while providing them no benefit.)

My view of SOA is simple - it's "dependency-oriented thinking", and it applies to every layer of the organisation - Business, Applications, Information and Technology. Unfortunately, every SOA guru, after paying ritual obeisance to the notion that "SOA is not technology", proceeds to insult our collective intelligence by discussing Web Services technology (or lately, REST). It seems we just need to look away for a second after someone says SOA is not technology, and we find they're talking technology when we next look!

Similarly, I have a very jaundiced view of the term "SOA governance" as it is popularly applied. I suspect most SOA experts wouldn't be able to define the term in a readily comprehensible manner if they were tied to a chair and threatened with a copy of Lotus Notes. I also suspect most of them use the term "governance" for effect when all they mean is plain old "management".

My definitions of governance versus management are also simple - "doing the right thing" versus "doing things right" - in other words, the "what" versus the "how".

And so, "SOA Governance" is nothing but the process of determining the right dependencies that ought to exist at all layers (Business, Applications, Information and Technology) and identifying the dependencies that do exist. "SOA Management" is about using these as a starting point and eliminating the dependencies that should not exist, formalising the ones that should exist into contracts, and ensuring that fresh dependencies do not creep in. That's all there is to SOA governance and practice, but the benefits are significant and will not escape attention.

I talk about all this at some length in my InfoQ interview. [Update 29/11/2012: I've now also written a white paper on it, which interested folk can download from box.com.]

There is so much potential for a truly SOA-enlightened consultant to enter a client organisation and point out all the areas of tight coupling that are driving up their costs and risks and driving down their agility. Heck, if all that the consultant did was concentrate on tight coupling at the data layer, so much wasted potential could be unleashed. That's the power of SOA in the right hands.

What I want to see in a next-generation SOA company is an organisation that is not fixated on technology but on education and consultancy, because it's SOA thinking that is so badly in need of a reboot. WSO2 is full of smart people, but they're focused on the wrong thing. It's not technology they need to be tinkering with. They need to apply their screwdrivers to the minds of IT and business folk at all levels. They need to hire fewer nerds and more business-savvy consultant types trained to think about dependencies. People with backgrounds in risk management, project management and contract law are especially good at thinking about every kind of dependency or "fine print" that could trip up an undertaking, and these are the kinds of people needed for SOA consultancy.

Admittedly, that's a bit hard to do when you do technology too well. Perhaps WSO2 ought to start by setting up a consultancy arm (which isn't focused on selling their own technology support services), getting that division to drive SOA thinking from the business layer down, and then watching it outgrow its older sibling as customers start to see its dramatic impact.

Can they rise to the challenge?

Chathuri WimalasenaEnable SSL with Apache HTTPD server 2.4.3

To enable SSL in apache httpd server, you need to have mod_ssl module installed. Below commands will install apache with mod_ssl.

Then you need to create key file and the cert files.

Create the key file

Create the cert file

.key file is your private key. After generating key file and the cert file, you can configure httpd.conf file.  

Configure httpd.conf

Make sure mod_ssl.so is enabled in modules list section.

Then add following lines to your httpd.conf.

Now restart apache server and now your http server will only accepts https requests. To work with apache HTTPD server 2.4.3, you need to have openssl-1.0.1e or higher. If your current openSSL version is minor to this, you will have to set LD_LIBRARY_PATH to a newer version.



Chathuri WimalasenaScripting with Perl

Perl is very good scripting language since it has lot of in-built modules to do lot of complex tasks that you would not be able to do with shell scripts. For example, if you want to insert data in to mysql data store or if you want to connect to a AMQP channel and get messages, you can use inbuilt modules in perl.

In this blog, I'm summarizing some very useful functionalities that I was able to do with perl.
  1. Read a config file and assign values to variables from the file 
  2. Connect to MySQL data store
  3. Execute a query in MySQL data store
  4. Creating a directory
  5. Go to working directory
  6. Replace a string in a file with another string
1. Read a config file and assign values to variables from the file

Suppose name of the configuration file I have is "config.ini". In here we use , Config::Simple perl module. If I have a parameter called "host" in my config file, below is how I read the config file and assign the value for host parameter to a defined variable in the perl script.

$cfg is a hash map. It will contain all the parameters that are defined in that config file.

2. Connect to MySQL data store

In here we use, DBI and DBD::mysql perl modules.        


In here, $host is where your MySQL server is running,  $userid is the database user and $passwd is the password for the given db user. Once you execute this, you will connect to the MySQL store that is running in the given host with given user name and password.


3. Execute a query in MySQL data store

Once you connect to the MySQL data store, you can execute queries.   

In here, $connection is the connection object that you get, when you connect to MySQL data store.


4. Creating a directory
To create a directory, you can use File::Path module of perl.
In here, it creates a directory called IUGateway and another directory called UBMoD inside IUGateway directory.

5. Go to working directory


Suppose you want to do a maven build by going to your source directory. Below is how you can jump to whatever directory that you wish.




6. Replace a string in a file with another string

There are lot of occasions where you want replace strings in a file with some other string. Here is a example how you can do it using perl.

If you have only single instance of that string, here is what you can use.     


Here $user_substr is the original string in the file. $http_running_user is the value that the original string will be replaced. When you replacing, make sure you don't have special characters such as ":", "/" inside that string. $httpd_conf_location is the location of the file. In perl you can run any command that you run in the command line inside "system".


If you have multiple occurrences of the same string and you want to replace all the occurrences, here is the command that you can use.     


All the above commands are extracted by googling. It took me lot of time since I'm very new to perl. I hope this post will be helpful for someone like me.

Supun KamburugamuvaGraphene supercapacitors, can be the biggest invention in 21st century

It seems finally humanity has found a way to create more efficient batteries.



There is a long way to go. But the future seems promising. This can be one of the biggest inventions that changed the human history. Looking forward to a day where we can charge our cars within minutes, cell phones and other devices instantly.

Supun KamburugamuvaScripting with perl

Here is a tutorial about some basics of perl that can be very handy.. The tutorial talks about how to connect to a database, reading a config file, replace a string in a file etc.

Manisha EleperumaCreating a custom User Store with WSO2 IS 4.0.0


Introduction

Generally, we can  configure an external LDAP with a WSO2 IS using <UserStoreManager> tag , and with the class attribute like this : 
<UserStoreManager class="org.wso2.carbon.user.core.ldap.LDAPUserStoreManager"> 
Apart from this, there are other default UserStoreManagers that are available with WSO2 IS, such as ActiveDirectoryUserStoreManager, JDBCUserStoreManager etc. You can find more from user-mgt.xml inside a WSO2 IS distribution's repository/conf directory

Similarly there we can define custom user stores as well.

Use Case

In the sample, CustomUserStoreManager reads a user credentials from an xml file (user.xml) and authenticates the user. This can be taken analogous to a CustomUserStoreManager that connects to a custom user store and authenticates users against the credentials stored there. The same CustomUserStoreManager has been extended to provide the functionality required by the STS configuration and issuing a SAML token with requested claim values.

 

Configurations

0.  Download WSO2 IS 4.0.0 and extract it to a preferred location. We will refer to that as [IS_HOME]

1. Download the sample from here and extract.

2. Place the jar file in the sample: org.wso2.carbon.userstoremanager.sample-1.0.jar in [IS_HOME]/repository/components/lib.
    eg: /home/manisha/WSO2/wso2is-4.0.0/repository/components/lib
3. Replace the user-mgt.xml in [IS_HOME]/repository/conf with the user-mgt.xml comes with this.
 
4. Make the enable EmbeddedLDAP propety "false" in embedded-ldap.xml file in [IS_HOME]/repository/components/conf.
    <EmbeddedLDAP>
            <Property name="enable">false</Property>
        ...................

5. Comment out the default CommonHybridLDAPTenantManager in tenant-mgt.xml in [IS_HOME]/repository/components/conf.

6. Uncomment the JDBCTenantManager property in tenant-mgt.xml

7. Delete the database folder in [IS_HOME]/repository if you are not using a newly extracted IS distribution.

8. Start the server with the command 'sh wso2server.sh -Dsetup' if you followed the step 3.
   Or else, if you are using a newly extracted IS distribution, start the server with 'sh.wso2server.sh' as usual.
   (Start up file changes according to the OS you are in, above commands listed for Linux environment.)

9. Login to the management console with the credentials mentioned in the user.xml that comes with this.

10. Configure the STS to use that with the related STS client.

11. Run STS client to obtain the SAML token.



PS: Courtesy goes to Hasini Gunasinghe

Chris HaddadA Path to Responsive IT

IT teams desire to gain an edge and improve their ability to grow business revenues, improve customer retention, and deliver timely and cost effective solutions.  Often, outdated IT infrastructure, processes, and tooling impede efficient IT delivery; increases project delivery times, and inhibits business model flexibility.  With disruptive New IT technologies (i.e. Cloud, mobile, social, Big Data, APIs), IT teams have a solid technology foundation that can transform business agility and build a more responsive organization.  The path to a responsive organization requires empowering business teams to safely recognize business opportunity, adapt processes, and respond.  A responsive IT team enables on-demand self-service, ticketless IT, a low cost structure, and widespread participation.

 

Cloud’s on-demand self-service and ticketless IT processes drastically reduce time to provision IT resources. APIs and cloud infrastructure services serve as composable building blocks, enabling solution adaptation on opportunity context.  For example, a bank can re-use bank services in a new market and plug-in local regulations.

 

 

DevOps PaaS delivers an approved, low cost development, deployment, and maintenance cost structure.   IT efficiently supports the long tail of user strategy and priorities, and business needs are met by a timely and cost-efficient IT solution.  Shadow IT is embraced and enabled within the IT structure rather than being excluded and repressed.

 

When everyone is on the same team, participation is encouraged and the team scales to meet business demand. When extending the IT team with business analysts, power-users, out-sourced teams, and contractors, a responsive IT structure consistently and automatically enforces compliance and governance policies.

 

The path to Responsive IT requires moving away from traditional application platforms, traditional team structure, and traditional information flows.  Responsive IT teams are adapting their infrastructure, processes and tooling to re-invent the application platform and re-think application delivery.  The New IT architecture underlying Responsive IT intelligently incorporates Cloud Platforms, BigData Analytics, Enterprise DevOps, and API first development.

The Path to Responsive IT white paper provides a roadmap plan.

 

Recommended Reading

Accelerating Business Agility with App Factory DevOps PaaS

What is an API Management Platform?

 

Dhananjaya jayasingheHow to use WSO2 ESB VFS transport to transfer large files..


We can use VFS transport in WSO2 ESB as described in the sample [1]. Apart from that Supun which was a project manger of WSO2 ESB has written and article[2] on that. These articles and samples provides a great help on using VFS transport to transfer files.

But when using that configurations for transferring large files (Greater that 500 MB), i got an Out Of Memory exceptions[3] and some other errors[4].

When looking in to the problem more deeply, i could found the solution for the problem. The issue was with the message builder class that i have used and missing a property. We need to use the message builder "org.apache.axis2.format.BinaryBuilder" for this. Apart from that  we need to include the property "ClientApiNonBlocking" in the proxy configuration.

As a sample i have defined a custom content type "chs/binary".

Entries in axis2.xml


<messageFormatters>
        ...    
        <messageFormatter contentType="chs/binary"
        class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
        ...
</messageFormatters>
    <messageBuilders>
        ...
        <messageBuilder contentType="chs/binary"
        class="org.apache.axis2.format.BinaryBuilder"/>
        ...
   </messageBuilders>

Then we need to have a sample VFS proxy as :

 <proxy xmlns="http://ws.apache.org/ns/synapse"
       name="FileProxy"
       transports="vfs"
       startOnLoad="true"
       trace="disable">
    <description/>
    <target>
       <inSequence>
          <log level="custom">
             <property name="FileProxy" value="Processing file"/>
          </log>
          <property name="OUT_ONLY" value="true"/>
          <property name="ClientApiNonBlocking"
                   value="true"
                  scope="axis2"
                  action="remove"/>
          <send>
             <endpoint name="FileEpr">
                <address uri="vfs:file:////home/shammi/file-out"/>
             </endpoint>
          </send>
       </inSequence>
    </target>
    <parameter name="transport.vfs.Streaming">true </parameter>
    <parameter name="transport.PollInterval">15 </parameter>
    <parameter name="transport.vfs.ActionAfterProcess">MOVE </parameter>
    <parameter name="transport.vfs.FileURI">file:///home/shammi/file-in </parameter>
    <parameter name="transport.vfs.MoveAfterProcess">file:///home/shammi/file-original </parameter>
    <parameter name="transport.vfs.MoveAfterFailure">file:////home/shammi/file-failure </parameter>
    <parameter name="transport.vfs.Locking">enable </parameter>
    <parameter name="transport.vfs.FileNamePattern">.*.zip|.*.test </parameter>
    <parameter name="transport.vfs.ContentType">chs/binary </parameter>
    <parameter name="transport.vfs.ActionAfterFailure">MOVE </parameter>
 </proxy>

    

With this proxy , i could use VFS transport to transfer a file with the size 1 GB with out any issue. I have made the points bold which needs to pay more attention..

Cheers.. Thats it......





[1]http://docs.wso2.org/wiki/pages/viewpage.action?pageId=15471427
[2]http://wso2.org/library/articles/2011/01/wso2-esb-example-file-processing
[3]2012-12-19 11:49:04,797 [-] [Framework Event Dispatcher]  WARN PollTableEntry transport.vfs.FileURI parameter is missing in the proxy service configuration
2012-12-19 11:50:08,896 [-] [vfs-Worker-3] ERROR NativeWorkerPool Uncaught exception
java.lang.OutOfMemoryError: Java heap space
at org.apache.commons.io.output.ByteArrayOutputStream.needNewBuffer(ByteArrayOutputStream.java:124)
at org.apache.commons.io.output.ByteArrayOutputStream.write(ByteArrayOutputStream.java:155)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1263)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1236)
at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:360)
at org.apache.axis2.format.BinaryBuilder.processDocument(BinaryBuilder.java:72)
at org.apache.synapse.transport.vfs.VFSTransportListener.processFile(VFSTransportListener.java:558)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:312)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:158)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:107)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)


[4]

2012-12-19 13:59:58,033 [-] [Axis2 Task] ERROR VFSTransportSender IO Error while creating response file : file:///home/shammi/wso2/foo/file-out/response.xml
org.apache.axis2.AxisFault: Error serializing binary content of element : {http://ws.apache.org/commons/ns/payload}binary
at org.apache.axis2.format.BinaryFormatter.writeTo(BinaryFormatter.java:66)
at org.apache.synapse.transport.vfs.VFSTransportSender.populateResponseFile(VFSTransportSender.java:235)
at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:173)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:627)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.commons.vfs2.FileNotFoundException: Could not read from "file:///home/shammi/wso2/foo/file-in/a.zip" because it is a not a file.
at org.apache.commons.vfs2.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1316)
at org.apache.commons.vfs2.provider.DefaultFileContent.getInputStream(DefaultFileContent.java:397)
at org.apache.synapse.transport.vfs.FileObjectDataSource.getInputStream(FileObjectDataSource.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis2.format.ManagedDataSourceFactory$DataSourceManager.invoke(ManagedDataSourceFactory.java:91)
at $Proxy15.getInputStream(Unknown Source)
at javax.activation.DataHandler.writeTo(DataHandler.java:290)
at org.apache.axis2.format.BinaryFormatter.writeTo(BinaryFormatter.java:64)
... 7 more
Caused by: java.io.FileNotFoundException: /home/shammi/wso2/foo/file-in/a.zip (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:120)
at org.apache.commons.vfs2.provider.local.LocalFile.doGetInputStream(LocalFile.java:210)
at org.apache.commons.vfs2.provider.AbstractFileObject.getInputStream(AbstractFileObject.java:1308)
... 17 more
2012-12-19 14:00:26,458 [-] [Timer-7]  WARN TimeoutHa

Tharindu MathewSolving the NameNotFoundException when connecting to IBM MQ through JMS

If you are facing an exception like the one at [0], then the problem might be hard to figure out. Because, if you look at the Queues in the MQ explorer, the queu named FOOQ will be there.

So, the missing part here is the JMS binding of that queue. This takes 10 minutes to solve. Right click on the queue, and select ‘create JMS queue’. Pick the JNDI Context you have created (creating this is out of scope of this post), and just click next, next and finish. Now re-generate the JNDI bindings by running IVTSetup.bat, and copy it over to the client machine and use it.

Your problem should be solved by now and you will be happily putting messages to IBM MQ Queues.

[0] –

TID: [0] [ESB] [2013-03-20 19:01:11,515] ERROR {org.apache.axis2.transport.jms.JMSConnectionFactory} -  Error looking up the JMS destination with name FOOQ of type generic {org.apache.axis2.transport.jms.JMSConnectionFactory}
javax.naming.NameNotFoundException: dynamicQueues/FOOQ
    at com.sun.jndi.fscontext.RefFSContext.getObjectFromBindings(RefFSContext.java:400)
    at com.sun.jndi.fscontext.RefFSContext.lookupObject(RefFSContext.java:327)
    at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
    at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
    at org.wso2.carbon.context.internal.CarbonContextDataHolder$CarbonInitialJNDIContext.lookup(CarbonContextDataHolder.java:1030)
    at javax.naming.InitialContext.lookup(InitialContext.java:411)
    at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:509)
    at org.apache.axis2.transport.jms.JMSUtils.lookupDestination(JMSUtils.java:718)
    at org.apache.axis2.transport.jms.JMSConnectionFactory.getDestination(JMSConnectionFactory.java:198)
    at org.apache.axis2.transport.jms.JMSMessageSender.<init>(JMSMessageSender.java:88)
    at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:120)
    at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
    at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
    at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:456)
    at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:316)
    at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:329)
    at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
    at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:175)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:367)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:408)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:219)

    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
TID: [0] [ESB] [2013-03-20 19:01:12,045] ERROR {org.apache.synapse.core.axis2.Axis2Sender} -  Unexpected error during sending message out {org.apache.synapse.core.axis2.Axis2Sender}
org.apache.axis2.transport.jms.AxisJMSException: Error looking up the JMS destination with name FOOQ of type generic
    at org.apache.axis2.transport.jms.JMSConnectionFactory.handleException(JMSConnectionFactory.java:228)
    at org.apache.axis2.transport.jms.JMSConnectionFactory.getDestination(JMSConnectionFactory.java:200)
    at org.apache.axis2.transport.jms.JMSMessageSender.<init>(JMSMessageSender.java:88)
    at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:120)
    at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
    at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
    at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:456)
    at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:316)
    at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:329)
    at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
    at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:175)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:367)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:408)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:219)

    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
Caused by: javax.naming.NameNotFoundException: dynamicQueues/FOOQ
    at com.sun.jndi.fscontext.RefFSContext.getObjectFromBindings(RefFSContext.java:400)
    at com.sun.jndi.fscontext.RefFSContext.lookupObject(RefFSContext.java:327)
    at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
    at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
    at org.wso2.carbon.context.internal.CarbonContextDataHolder$CarbonInitialJNDIContext.lookup(CarbonContextDataHolder.java:1030)
    at javax.naming.InitialContext.lookup(InitialContext.java:411)
    at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:509)
    at org.apache.axis2.transport.jms.JMSUtils.lookupDestination(JMSUtils.java:718)
    at org.apache.axis2.transport.jms.JMSConnectionFactory.getDestination(JMSConnectionFactory.java:198)
    ... 20 more


Chris HaddadAPI and SOA convergence

As the technology discussion pivots to focus on APIs, teams are wondering how API and SOA converge.   Are services simply being re-branded?  Are APIs only good for mobile or external use cases?  If we publish APIs, do we need SOA?   Many architects believe that APIs do not apply to their projects or business use cases.

Both API and SOA success requires creating loosely coupled consumer-provider connections, enforcing a separation of concerns between consumer and provider, and exposing a set of re-usable, shared services, and gaining service consumer adoption.   With traditional SOA, many development teams publish services, yet struggle to create a service architecture that is widely shared, re-used, and adopted across internal development teams.

Over a period of six years (i.e. 2003-2009), I consulted and advised over 200 large enterprise IT organizations on how to create effective SOA strategy and SOA roadmaps.  The experience provided a battle-tested SOA strategy for moving organizations forward.  After performing a SOA portfolio review and understanding their maturity, many teams were overwhelmed by the amount of IT transformation required to implement an effective SOA initiative.   All teams gained small and localized benefit by implementing ‘service oriented integration’ and web services, yet many struggled to establish a coherent architecture.

In today’s connected business world, API and SOA are the business.   How do we deliver the technology the business wants and accelerate business agility?  An effective approach must address human collaboration stumbling blocks.

Kin Lane posted a provocative and philosophical article describing “SOA vs. API: The Humans Win.”   Kin states an API focus is more effective than traditional SOA because they focus on the human side of endpoint consumption. According to Kin,

SOA …doesn’t always provide for the best interest of the user–aka human side of the equation. APIs have allowed for valuable resources to flow around traditional IT bottlenecks, outside the firewall and be put to use by those who are potentially closer to the human problem that is being solved.

Kin describes how common API attributes complement SOA by providing important SOA puzzle pieces:

API introduces newer pieces of the SOA puzzle, found within the OAuth security relationship, terms of use and privacy policies, self-service access, transparency, while also providing monetization strategies that encourage partner and developer innovation.

The real insight in Kin’s post:  API and SOA fit together, and API management can be used to advance SOA initiatives.  API management complements SOA Governance, drives service reuse, and maximizes Service Oriented Architecture success.  Many development teams publish services, yet struggle to create a service architecture that is widely shared, re-used, and adopted across internal development teams. SOA governance programs often fall far short of encouraging consumer adoption, tracking service consumption, and illustrating business value. Too often, there is little or no insight into service reuse and:

  • How to enable business functionality as an API
  • Who is writing re-usable APIs and services
  • Who is consuming APIs and services
  • How APIs and services are being used

A recent blog post and white paper describes how API management complements SOA initiatives by overcoming traditional SOA implementation limitations.

Software architects and developers can take five actions to avoid common API and SOA pitfalls, create business value, and monetize API assets:

  1. Embrace the Managed API
  2. Establish a Monetization Model
  3. Make APIs Easy for Developers to Access
  4. Employ Governance
  5. Monitor API Use

How are you making your SOA initiative a success?

Tharindu MathewSolving the IBM MQ client error – no mqjbnd in java.library.path

If you come across this issue when you try to connect a JMS client to IBM MQ (v7.0.x.x), this has nothing to do with any environment variables or VM arguments, at least it wasn’t for me (There are quite a lot of those articles out there, that makes you think this is the problem).

The fix for this will has to be done on the server side. Open the MQ Explorer. Now, if you have not done so already, you need to add your JNDI directory to JMS Administered Objects. In the Connection Factories,  you will note that your factories’ transport type is actually “Binding”. You need to right-click and go to the switch transport option which will have the “MQ Client” option that needs to be selected. Now the transport type will be “Client”. Do this to all Connection Factories that you are connecting to. Now, your configuration will look something like below:

Screen Shot 2013-03-20 at 5.28.49 PM

Now, run your client again, and the error should go away. HTH.


Damitha KumarageEasy installation of Openstack Essex on a single node

In this guide I explain how to install Openstack in a single physical node. I install the nova controller and a compute node in this node. The aim of this article is to get you started with Openstack IaaS with minimum effort in a short period of time.

What you need

The steps below can be followed using one physical node. The node should posses two network interfaces. One of them could be a virtual one. I have tested this on Ubuntu 12.04 LTS 64 bit server. The memory and storage requirements of the node depend on how much virtual machines you run on Openstack once it is ready. For example if you plan to run 10 virtual machines with 256Mb memory and 5Gb HD each, then you need at least 3G memory and 60Gb hard disk for the node. You also need an internet connection to download the necessary Openstack software.
Note the installation described in this document is in no way production ready. You may need to do lot of enhancements, feature additions to make it such.

Installation Steps

Step1:Insatll Ubuntu server

Install Ubuntu server as you do any normal installation. Please refer to good Ubuntu documentation for this. During the installation steps do the following.
- Create a user account on the host machine(say nova).
- Install openssh.
- Assign hostname(say openstack). Assign domain name(say demo.com)
- Assign static ip(say 192.168.16.20)
- Give gateway to access internet (say 192.168.16.1). I assume here you have a wired connection to the internet. Insead if you have a wireless connection you can let it connect to internet using dhcp.
You can do the above steps once the Ubuntu installation is finished as well like below

- Create user account(say nova)

$ sudo /usr/sbin/adduser nova

- Install openssh

$ sudo apt-get install openssh-server(to ssh into instance)

- Assign static ip by editing /etc/network/interfaces file

auto eth0
iface eth0 inet static
address 192.168.16.20
netmask 255.255.252.0
gateway 192.168.16.1
auto eth1
iface eth1 inet manual
up ifconfig eth1 up

Then

$ sudo ifup eth0
$ sudo ifup eth1

- Assign hostname and domain name by putting an entry in /etc/hosts file as in

192.168.16.20    openstack.demo.com    openstack

Step2:

Log in using nova account you created.
$ sudo apt-get update

Step3:

Checkout the Installation Scripts
$ sudo apt-get -y install git
$ git clone https://github.com/damitha23/openstack.git
$ cd openstack
$ unzip OpenStackInstaller.zip

Note that content of OpenStackInstaller folder has scripts I took from https://github.com/uksysadmin/OpenStackInstaller.git maintained by Kevin Jackson <kevin@linuxservices.co.uk> https://twitter.com/#!/itarchitectkevirc.freenode.org: uksysadmin

Step4: Installing Openstack

$ cd /home/nova/OpenStackInstaller

Modify oscontrollerinstall.sh as per your requirements and execute. It will take couple of minutes to install Openstack.
Also modify the OSinstall.sh to add following configuration that would go into nova.conf

--rpc_response_timeout=<new timeout in seconds>

Give a sufficient response timeout to avoid timeout errors.
Example oscontrollerinstall.sh

./OSinstall.sh -T all -C openstack.demo.com -F 192.168.16.128/25 -f 192.168.17.128/25 -s 126 -P eth0
 -p eth1 -t demo -v kvm

Important: The virtualization type here I used is kvm.
Note that I use -T all options since I install in this server both controller and a compute node.
With -C parameter we give the hostname of the node. You should have an entry in the /etc/hosts file for this as following.

192.168.16.20    openstack.demo.com    openstack

If your node ip regulary change it is good idea to have following kind of entry in /etc/rc.local file so that it will automatically add that entry when node bootup

ip=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
echo $ip openstack.demo.com openstack >> /etc/hosts

Note that here ip is taken from eth0 interface. You may need adjustments.

With -F parameter we give the floating ip range for the project.
With -f parameter we give the fixed ip range for the project.
With -s parameter we give number of nodes in the private network.

I use eth1 as private interface. eth0 as public interface. For the public ips(floating ips) we should give an valid range from the network where the host machine took IP. So a valid floating ip subnet would be 192.168.16.128/25. You can calculate such an range from the subnet calculator in link [1] or [2]
A valid fixed ip subnet would be 192.168.17.128/25. Note that if the floating ip’s are exhausted, then there will be errors and instance would not be created. To avoid this situation, make sure that you allocate as many as floating ips, at least, as the fixed ips. Now you can access Openstack UI from http://openstack.demo.com using

Username:admin
Password:openstack

You may need to add an host entry in the node where your browser reside when giving the above url as in

192.168.16.20    openstack.demo.com    openstack

Now you can manage your Openstack environment from the UI interface.

If one of your interface is a virtual interface(This could be the case when are installing on a laptop) your install command could be like following

./OSinstall.sh -T all -C openstack.demo.com -F 192.168.16.128/25 -f 192.168.17.128/25 -s 126 -P eth0
 -p eth0:0 -t demo -v kvm

Make sure eth0:0 is defined as following

auto eth0:0
iface eth0:0 inet manual

And make sure it is up by using
$ ifup eth0:0

Step5: Upload an Image

From this step on you can execute the commands as normal user. I upload an ubuntu image to glance. For kvm virtual machine download a base ubuntu image precise-server-cloudimg-amd64-disk1.img from http://cloud-images.ubuntu.com/precise/current/ and create a folder called /home/nova/upload folder and copy the image into it.

Modify /home/nova/OpenStackInstaller/uploadimage.sh and execute to upload the image.

An example uploadimage.sh would be

./imageupload.sh -a admin -p openstack -t demo -C openstack.demo.com -x amd64 -y ubuntu -w 12.04 
 -z /root/upload/precise-server-cloudimg-amd64-disk1.img -n cloudimg-ubuntu-12.04

Here openstack.demo.com is the hostname of the openstack controller.
Execute

$ cd OpenStackInstaller
$ source ./demorc
$ nova image-list

command to see whether your newly uploaded image appear in the image list.

Step6: Testing the Controller

$ cd OpenStackInstaller
$ source ./demorc

Now add a keypair. It is highly recommended that you use your own keypair when creating
instances. For example suppose you create an instance as normal user, using a keypair owned by root user. You may succeed in creating your instance. But you will get permission denied exception when trying to ssh to that instance.

$ nova keypair-add wso2 > wso2.pem

Set permission for the private key

$ chmod 0600 wso2.pem

You can see the created key listed

$ nova keypair-list

Allow needed ports for the default security group.

$ nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
$ nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
$ nova secgroup-add-rule default tcp 80 80 0.0.0.0/0
$ nova secgroup-add-rule default tcp 443 443 0.0.0.0/0
$ nova secgroup-add-rule default tcp 3306 3306 0.0.0.0/0
$ nova secgroup-add-rule default tcp 8080 8080 0.0.0.0/0

Now list the images and select an image id to create an instance from it

$ nova image-list
$ nova boot –key_name=nova-key –flavor=1 –image=<image id> <instance name>

Instead of the above command you can use the following command if you need to pass some user data into the instance you want to create.

$ nova boot –key_name=nova-key –flavor=1 –image=<image id> –user_data=/root/client/payload.zip <instance name>

Now see whether your instance is up and running. Look for the running instances ip.

$ nova list
$ ssh -i wso2.pem ubuntu@ipaddress

If you can access the virtual machine instance then you have successfully created a controller with a compute node in it. Log into the nova mysql database running in the controller machine and observe that there is a compute node entry in the compute_nodes table.

$ mysql -uroot -popenstack

Note that mysql password is defined in the OpenStackInstaller/OSinstall.sh file.

mysql>use nova
mysql>select id, created_at from compute_nodes;

Your should see one compute node entry in the table. Now from your Openstack node you can start playing with creating/deleting your new instances. You can monitor the /var/log/nova/nova-compute.log to see the status of creating the nodes. You can create more and more instances and verify that in both compute nodes until you see a short, undescriptive message that basically say your quota has exceeded.

Some useful settings in the Openstack environment

In the following sections, some useful settings on Openstack Nova environment is explained.

Adding a new VM resource type

You can add new resource types by

$ nova-manage flavor create –name=m1.wso2 –memory=128 –cpu=1 –root_gb=2 –ephemeral_gb=0 –flavor=6 –swap=0 –rxtx_factor=1

User data injection

From openstack nova essex that ship with Ubuntu 12.04 LTS the instances created from cloud images are ready to get information such as user-data, public ip, keys etc from the metadata service. User data data can be passed to the instance at startup like

$ nova boot –key_name=nova-key –flavor=1 –image=<image id> –user_data=/root/client/payload.zip <instance name>

At instance startup, nova copy the zip file into the instance as /var/lib/cloud/instance/user-data.txt.

Accessing Metadata information from within instances

We can get the public ip from the metadata server

$ wget http://169.254.169.254/latest/meta-data/public-ipv4

Now public-iv4 file contain the public ip

Adding floating ip to instances

We can add floating ip’s to the instances automatically when spawned or later. For automatically assiginint ip when instance spawn, add the following line into /etc/nova.conf and restart nova services

--auto_assign_floating_ip

To add a floating ip first allocate one using the following command

$ nova floating-ip-create
$ nova add-floating-ip <instance id> <floating ip>
$ nova remove-floating-ip <instance id> <floating ip>

$ nova floating-ip-delete <floating ip>

To list the floating ips

$ nova floating-ip-list

Monitoring Openstack

To see how much memory an lxc container is using

$ cat /sys/fs/cgroup/memory/libvirt/lxc/instance-0000002d/memory.stat

and look at rss entries
or
$ cat /sys/fs/cgroup/memory/libvirt/lxc/instance-0000002d/memory.usage_in_bytes

In /sys/fs/cgroup/memory/libvirt/lxc/instance-0000002d/ folder you can see several other memory related files

Some of the other folders that contain files regarding resources are

./blkio/libvirt/lxc/instance-0000002d
./freezer/libvirt/lxc/instance-0000002d
./devices/libvirt/lxc/instance-0000002d
./memory/libvirt/lxc/instance-0000002d
./cpuacct/libvirt/lxc/instance-0000002d
./cpu/libvirt/lxc/instance-0000002d
./cpuset/libvirt/lxc/instance-0000002d

Troubleshooting

Cannot ping to the instance created

Make sure you have enabled icmp using the nova command-line tool:

$ nova secgroup-add-rule default icmp -1 -1 -s 0.0.0.0/0

Cannot ssh to the instance

Make sure you have enabled tcp port

Using the nova command-line tool:

$ nova secgroup-add-rule default tcp 22 22 -s 0.0.0.0/0

If you still cannot ping or SSH your instances after issuing the nova secgroup-add-rule commands, look at the number of dnsmasq processes that are running. If you have a running instance, check to see that TWO dnsmasq processes are running. If not, perform the following

as root:

$ sudo killall dnsmasq
$ sudo service nova-network restart

When installing nova essex into a new box dpkg error occur and then mysql configuration take a long time and fail

This happen when you forget to do an apt-get update before starting to install nova essex. This could not be corrected until doing a fresh installation again.

Your applications deployed in instances cannot be accessed

Make sure you have enabled your application port.

Using the nova command-line tool:

$ nova secgroup-add-rule default tcp 8080 8080 -s 0.0.0.0/0

Note that you need to replace 8080 above with the port your application is running.

Cannot shutdown the instance

Sometimes even after terminate command is executed on an instance it is not terminated but go to shutoff state. At such moments try restarting nova services.

Error returned when creating the very first instance

Make sure that you public and private interfaces are up

Eg: sudo ifconfig eth1 up

Timeout: Timeout while waiting on RPC response

Sometimes when creating instances you get the response timeout error. The default request
timeout for nova is 60seconds. To increase this add following entry to /etc/nova.conf and restart nova services

--rpc_response_timeout=<new timeout in seconds>

Successfully added compute node but cannot create instances in that node

When instances are created in that node the instance state is in ERROR. In the compute node log we have

libvirtError: Unable to read from monitor: Connection reset by peer

To avoid this make sure that you have commented out the following three entries in the compute nodes /etc/nova.conf

#--novncproxy_base_url=http://192.168.16.20:6080/vnc_auto.html
#--vncserver_proxyclient_address=192.168.16.20
#--vncserver_listen=192.168.16.20

If not comment them out and restart nova services in the compute node.

Instances are not created

- Check whether both interfaces of the controller is up and all compute node interfaces are up. If not make them up and then restart nova services.

Disaster Recovery

Nova instances can be rebooted using

$ nova reboot <instance id>

I notices that when node is restarted while some vm’s are running I could not ping to those vm’s when node restarted. Then rebooting the vm as above solved it. But now I could ping to the instance but connection is refused when ssh to it. Then I cd to OpenStackInstaller and executed

$ sudo restartservices.sh

You may need to run this command twice if you see any warning/error first time. Then that problem is solved too.

References

[1] http://www.subnet-calculator.com/subnet.php?net_class=C
[2]http://jodies.de/ipcalc?host=192.168.25.10&mask1=22&mask2=


Chris HaddadAccelerating Business Agility with App Factory DevOps PaaS

Queuing, waiting, and the status quo doesn’t fit well with today’s “now generation’.  Business stakeholders, who drive revenue growth and customer retention, desire to rapidly seize opportunity and market share.  They often view IT timeframes and capabilities as a poor match for today’s fast business-pace.  A New IT model is required to reduce delivery time and accelerate business agility.  DevOps PaaS brings no waits, faster phase execution, widespread accessibility, rapid grassroots innovation, and increased resource availability to IT projects.


As the pace of business quickens, mismatched IT delivery cycle periods decrease business satisfaction and revenue growth.  We live today in a ‘now generation’, where individuals expect instant gratification and action.   Even the Black Eyed Peas recognize today’s business growth imperative and IT customer demands:

I want it now

Big money, give me mo’ money

Yeah, I want it now

I need cash, oh, I need it bad

I want it now


The Peas also underscore how stakeholders pressured to grow the business today will be irked by misaligned delivery timeframes:

Cause if time can’t wait

Then I sure can’t wait

I ain’t got no patience

No, I just can’t wait, not today


For more pop inspiration, read the full BLACK EYED PEAS – NOW GENERATION LYRICS and watch the video.



In 2011, Gartner presaged the ‘now generation’ sentiment and consumerized IT ownership shift we see today in their Top Predictions for 2012 and Beyond report:


Next generation digital enterprises are being driven by a new wave of business managers and individual employees who no longer need technology to be contextualized for them by an IT department. These people are demanding control over the IT expenditure required to evolve the organization within the confines of their roles and responsibilities. CIOs will see some of their current budget simply reallocated to other areas of the business. In other cases, IT projects will be redefined as business projects with line-of-business managers in control.


You and your team probably feel mounting demands and pressure to clear a backlog of project requests.   You have gained agility benefits by adopting Agile and Iterative development methods, but have experienced a bottleneck when Agile’s fast pace clashes with systems administration and provisioning.  Agile and DevOps principles must be applied across a cross-functional team and the entire lifecycle (e.g. project inception, design, development, deployment, and management).


When defining a roadmap to align IT’s pace with business agility expectations, establish IT team objectives that quicken IT solution development and delivery, offer new technology as on-demand shared services, and enhance your team’s ability to rapidly satisfy emerging business use cases (e.g. social collaboration, mobile application connectivity, ecosystem partnering).


Adopting a DevOps PaaS can align your IT model with business agility expectations.


How DevOps and PaaS influence Business Agility


DevOps principles and practices combined with PaaS characteristics will quicken IT solution development and delivery.   A DevOps focus on continuous activity execution (e.g. continuous build, continuous integration, continuous test, continuous delivery) creates a ‘no wait’ environment.   Teams do not have to wait for the next script to run or for the next activity to commence.  By incorporating automation into developer and operations processes, teams bypass time consuming manual tasks and gain faster phase execution.  Both DevOps and PaaS promote simple, on-demand self-service environments that shield team members from complexity and reduce skill hurdles.  By offering on-demand self-service access, rapid business innovation and experimentation is possible. By reducing complexity, team members are not required to obtain special training and skills before consuming IT services and infrastructure.

 

 

PaaS increases agility by democratizing access to IT infrastructure and services.  Offering a low cost environment and increasing resource availability, PaaS promotes democratized access.   The chosen PaaS environments must offer required application building blocks available on-demand, and minimize cost by amortizing infrastructure expense over multiple project teams.   PaaS environments based on multi-tenant, shared application containers facilitate pervasive access by increasing tenant density and lowering tenant cost.   Affordable, pervasive on-demand access encourages project teams to use approved PaaS environments and enables shadow IT teams to efficiently and safely create a long tail of application development projects.


Quantifying Agility

In the abstract, business agility can be defined as your ability to rapidly change business vectors. A business vector is your business speed and direction.  The direction may lead into new markets and new products, or engaging with new participants.  Reducing time to IT solution delivery increases your team’s ability to adjust the business vector and match business opportunity.


With adequate instrumentation, IT delivery agility can be quantified.  Consider the following agility metric recommendations:


  • Time to create project workspace

  • Time to build, integrate, test

  • Time to approve, promote

  • Time to deploy, release

  • Dwell time – time waiting for the next operation to commence or complete


After application project inception and before coding commences, systems administrators must create project workspaces.   How long does your team wait before gaining access to source code management repositories, requirement management projects, and defect tracking projects?


Moving code through build, integration, and test tools is often a time and labor-intensive process.  The entire team waits while applications assets are built, integrated, and tested.  When teams use iterative development processes, the wait time aggregates over several hundred or thousands cycles.  How long does your team wait during build, integration, and test phases?


When one team member finishes a task and the work enters an approval phase, how long does the team wait?  After the work is approved to move through phase gate, how long before the project is promoted into the next phase?


Operations activities related to deployment and release management often hinders agility and time-to-market.   The level of effort required to deploy a real-world application is often non-trivial.  Continuous deployment technology automates operations activities and replaces manual intervention.


While dwell time sounds cozy and refreshing, excessive wait states and downtime between activities diminishes team efficiency and engagement.  Automated notifications eliminate dwell time between hand-offs.  Automated project workspace creation, Cloud environment provisioning, and on-demand self-service access reduces wait time between software development phases.


How AppFactory DevOps PaaS Accelerates Business Agility

 

 

A DevOps PaaS incorporates DevOps principles and practices into a Platform as a Service environment.  DevOps principles include iterative cycles, continuous activities (e.g. build, integration, test, delivery), automated processes, self-service IT, on-demand access, collaborative interactions, and incremental releases,  .


When operation team members use traditional point tools (i.e. Puppet, Chef, Jenkins, Selenium) to achieve DevOps benefits, the teams spend a considerable amount of time and effort creating agile workflow, effective governance, seamless activity transitions, and on-demand self-service access.  WSO2 App Factory delivers a configurable DevOps PaaS that can be readily adopted by teams without extensive implementation effort.  WSO2 App Factory presents a simplified and unified user experience to complex development tools, processes, and team hand-offs.  By integrating software promotion best practices, test automation, continuous integration, and issue tracking, App Factory raises software quality while reducing delivery timeframes.  Figure 1 illustrates the holistic lifecycle approach delivered by a DevOps PaaS.


Figure 1.  DevOps PaaS Process Activities

 

Traditional application PaaS (aPaaS) environments do not help organizations build apps, but simply serve as a cloud run-time environment.  DevOps PaaS delivers development, test, and production run-time clouds that are integrated into development workspaces containing source code management, defect tracking, requirements management, test automation frameworks, and continuous build.  Figure 2 describes the infrastructure topology underlying a DevOps PaaS.



Figure 2. DevOps PaaS Infrastructure Topology


By automating software activities, workflow, and phase approval gates, a DevOps PaaS decreases software development and delivery times.   A rapid IT timeframe closely matching today’s fast business-pace will accelerate revenue growth and enhance customer retention rates.  A New IT model driven by DevOps PaaS will expand development team participation, lower IT cost, and increase business agility.


Recommended Reading

DevOps Meets ALM in the Cloud


PaaS Performance Metrics


Multi-tenant, shared container PaaS TCO


WSO2 App Factory Product Page

Saliya EkanayakeWindows Live Writer: Life Made Easy for Blogging

I've been using Blogger for quite some time and over the years they have improved their Web based blog editor a lot, yet there was some uneasiness always when thinking about editing or adding a post. Anyway, after I got to know about Windows Live Writer I wanted to get it setup with Blogger but it wasn’t successful simply for some reason I couldn't understand “Username or password is incorrect”! I remembered only today that I was using two step verification with Google and that I have to create an application specific password to connect to Blogger. Wish it came to my mind sooner! Anyway, it’s now working fine and if you can read this online that means I made a post successfully with Live Writer.
Few places to note if you are having trouble connecting to Blogger with Live Writer as I did.
  1. Blog URL: Don’t forget to use https instead of http
  2. Username: Remember to add @gmail.com to your user id
  3. Password: As mentioned above, if you are using a two step verification with Google you need to generate application specific password to connect (see http://support.google.com/accounts/bin/answer.py?hl=en&answer=185833)

Heshan SuriyaarachchiAiravata Deployment Studio (ADS)


This is an independent study that I have been doing for Apache Airavata [1]. Airavata Deployment Studio or simply ADS, is a platform where an Airavata user can deploy his/her Airavata deployment on a Cloud computing resource on demand. Now let's dive into ADS and what's the actual problem that we are trying the solve here. 


What is Airavata? 


Airavata is a framework which enables a user to build Science Gateways. It is used to compose, manage, execute and monitor distributed applications and workflows on computational resources. These computational resources can range from local resources to computational grids and clouds. Therefore, various users with different backgrounds either contribute or use Airavata in their applications.



Who uses Airavata? 

From the Airavata standpoint, three main users can be identified.


1) End Users


End User is the one who will have a model code to do some scientific application. Sometimes this End User can be a Research Scientist. He/She writes scripts to wrap the applications up and by executing those scripts, they run the scientific workflows in Super Computers. This can be called a scientific experiment.

2) Gateway Developers


The Research Scientist is the one who comes up with requirement of bundling scientific applications together and composing as a workflow. The job of the Gateway Developer is to use Airavata and wrap the above mentioned model code and scripts together. Then, scientific workflows are created out these. In some cases, Scientist might be the Gateway Developer as well.

3) Core Developers


Core Developer is the one who develops and contributes to Airavata framework code-base. The Gateway Developers use the software developed by the Core Developers to create science gateways.

Why ADS?

According to the above description, Airavata is used by different people with different technical backgrounds. Some people will have in depth technical knowledge on their scientific domains; like chemistry, biology, astronomy, etc and may not have in depth knowledge on computer science aspects such as cluster configuration, configuring and trouble-shooting in VMs, etc. 

When it comes to ADS, it's targeted towards the first two types of users as they will be ones who will be running in to configuration issues with Airavata in their respective systems. 

Sometimes we come across instances where a user might run into issues while setting up Airavata on their Systems. These might be attributed to; 
  1. User not following the documented steps properly.
  2. Issues in setting up the user environment. 
  3. User not being able to diagnose the issues at their end on their own.
  4. Sometimes when we try to diagnose their issue remotely, we face difficulties trying to access user's VM remotely due to security policies defined in their System. 
  5. Different security policies at client's firewall.

Due to the above mentioned issues, a first time user might go away with a bad impression due to a System/VM level issue that might not be directly related to Airavata. 

What we are trying to do here is to give a first time user a good first impression as well as ease of configuring the Airavata eco system for production usage. 

How? 

Now you might be wondering how does ADS achieve this? ADS will use FutureGrid [3] as the underlying resource platform for this application. If you are interested in learning about what FutureGrid is, please refer [3] for more information. ADS will ultimately become a plugin to the FutureGrid's CloudMesh [4] environment.

ADS will provide a user with a web interface which a user can use to configure his/her Airavata eco system. Once the configuration options are selected and user hits the submit button, a new VM with the selected configurations will be created. The user will be able to create his/her image with the following properties. 
  • Infrastructure - eg: OpenStack, Eucalyptus, EC2, etc
  • Architecture - eg: 64-bit, 32-bit 
  • Memory - eg: 2GB, 4GB, 8GB, etc
  • Operating System - eg: Ubuntu, CentOS, Fedora, etc
  • Java version - eg: Java 1.6, Java 1.7
  • Tomcat Version - eg: Tomcat6, Tomcat7
  • Airavata Version - eg: Airavata-0.6, Airavata-0.7

Advantages?

  1. One click install. 
  2. No need to interact with the shell to configure an Airavata environment.
  3. Deploying on various Cloud platforms based on user preference.
  4. Ease of use. 
  5. First time user will be able to quickly configure an insatnce of his own and run a sample workflow quickly. 
  6. On demand aspect.

Sneak Peak

Supun KamburugamuvaA Myth about Threads


We were given an assignment in one of our classes to write a port scanner. This was a great assignment and we've learn't a lot from it. The assignment was pretty huge with lot of functions. For those of you who don't know what a port scanner is, a port scanner is a piece of software that can be used to determine the status of network ports in a given machine. A port scanner can also be used to determine what are the software running on open ports etc. Ports are specific to TCP and UDP and a port scanners functionality is border than TCP and UDP and can be used to determine the protocols that are running in machines etc.  A good place to look at for more details is here. For making our discussion simple lets assume we are only going to scan TCP ports.

One of the key things about a port scanner is the ability to scan ports in parallel. Usually there are 2 to the power 16 ports in a given machine. But usually we want to scan a subset of these ports and even this subset can be huge. So if we scan each port one by one it will take a lot of time. To avoid this we have to send requests in parallel to the range of ports that we scan.

A port scanning request for the most part is an IP packet with a TCP or UDP payload. In the TCP case we don't want to create a full TCP connection in order to determine weather the port is open. We can simply send a TCP SYN packet and if we get a response with SYN + ACK  we can conclude that the port is open. There are many other techniques for determining the status of a port and non of them require us to create a connection. To send these TCP SYN packets we need to use RAW Sockets and we cannot use regular stream sockets.

The important summery of the above is that we create a TCP SYN packet for each port that we are going to scan and send them in parallel to the destination IP using a RAW Socket.

Since these are RAW sockets there is no TCP Flow Control or TCP Congestion control. Once we call the send with the IP packet, the kernel will send the packet as fast as it can. First it will copy the buffer to the kernel space and hand over this to the IO Subsystem to send. The important thing is the call to send the packet is non blocking on IO as we are not waiting for the success or failure of this packets to be delivered to the destination or out of the host machine. But since send involves a system call it can be bit slow compared to other method calls. Also note that these are very small packets, with byte sizes no more that 50 bytes for the IP packet and there is no data in the TCP packet.

The assignment asked us to create threads for making the sending process parallel. The expectation is that as the number of threads increases the sending speed will increase. But is this really true? Will threads increase the sending performance linearly?

If we run the program on a multi-core machine definitely the increase of threads should increase the sending rate until the number of threads is somewhat greater than the available processors. But will this increase the performance if we increase the number of threads to 100 and available processes is 8? My gut feeling is it NO. But people tend to think that increasing the number of threads will increase the rate of sending. But since the operations are CPU bound increasing the number of threads beyond the number of available cores is not going to give any performance. On the contrary increasing the threads should decrease the performance of the system.

This is a conclusion I came from theoretical knowledge and past experiences. No performance test was done. may be I should do a performance test or may be I should not :) Lets see what others have to say.








Supun KamburugamuvaJava Regular expression for getting sentences with a given word

Here is a simple regular expression for finding a sentence with a given word.

Loading ....

Supun KamburugamuvaREST vs SOAP Adoption - A Perspective

I worked for three year in a company called WSO2, building Web Services based middle-ware systems. Five years ago we believed Web Services is going to take over the world by becoming the de-facto standard in communication. Web Services is such a nice and well thought technology. It has a metadata model, a rich set of tooling, a built in security model; which are essential parts of enterprise grade communication. Also WS is backed by industry giants like Microsoft, IBM, Oracle etc. No matter what this background is WS lacks mass adoption. It seems only the big companies with lot of money and resources invest on Web Service adoption. For sometime I was bothered by this strange situation. Why such a robust and well thought out messaging paradigm backed by industry giants lacks the adoption?

On the other hand REST doesn't have any of the nice things about Web Services. It doesn't have a well thought metadata model, comprehensive tooling support or a standard security model. But against all odds REST seems to be gaining traction and becoming the cool thing in communication. Everyone wants to build a cool REST Api.

So what is wrong with SOAP and what is so appealing about REST?

In my perspective this all lies in the developer mind set. Developers love when the sky is the limit for their programming. They want to create unique designs that no one else has done. They want to explore the unknown.

REST as a framework gives the developers exactly that. The freedom to innovate. Developers love that. As a framework REST introduces very few rules. Most of them are not even rules. Rather they are soft guidelines. So building a proper powerful REST API is an Art and a challenging task. In my opinion this makes it cool.

This is completely opposite to SOAP. SOAP gives the developer all the rules. First thing about SOAP is you get a SOAP envelope where you have to put your data according to some rules. So from start to end the system is pretty well defined. There are standards for doing even the simplest things. Top of all this SOAP is very complex to understand. So in my opinion SOAP doesn't give user the nuts and bolts to innovate. Instead it gives a half baked solution that user has to obey. I guess not all developers like to bog down by rules and they don't like to learn that kind of rules as well.

There are many aspects to REST vs SOAP than what I have mentioned above. Someone can argue SOAP is better than REST. But I just wanted to express my perspective on what is happening in the world.



Chris HaddadPaaS Services and Backend as a Service (BaaS)

During the API Strategy Conference panel discussion on Backend as a Service (BaaS), I was struck by the lack of clarity around BaaS market space boundaries and roadmaps.    While BaaS is currently well tuned for mobile client backend use cases, the market definition is on a collision course with Platform as a Service (PaaS).

PaaS offerings could easily extend and provide developer-friendly application platform services via consumable APIs; subsuming today’s BaaS value proposition.   As mobile application use cases collide with mission-critical enterprise requirements, developers will require more extensive platform capabilities, which are not delivered by BaaS today.   PaaS services deliver application platform capabilities required when building sophisticated applications.  For example, a BaaS offering billing, security, and data storage services today must evolve to offer messaging, registry, logging, and task management.  Figure 1 describes a few sample foundation services.  Additionally, leading PaaS environments offer application platform middleware services that span identity management, application lifecycle governance, integration, and custom code hosting (within app, service, process, rules, and data containers).

Stratos 2.0 PaaS Reference Architecture

Figure 1.  Platform as a Service Reference Architecture and PaaS Services Layer

 

When the moderator, Kin Lane, asked the panel about their views regarding unique value proposition, a few participants mentioned ‘hosting custom code’.   My attention raised an order of magnitude!   Hosting custom code is the fundamental PaaS differentiator from IaaS (hosts servers) and SaaS (hosts configurations).

 

In a recent blog post, Toddy Mladenov brings an interesting perspective to the PaaS/BaaS value proposition:

 More than decade ago the application servers advanced the way new applications are developed by offering common framework and set of reusable components. Platforms-as-a-Service are the next step in the evolution of application development

 

As the underlying application platform evolves into PaaS, the innovator dilemma is unfolding and market disruption is occurring. The new school BaaS vendors are riding the mobile trend while delivering a useful toolbox for overcoming mobile application development hurdles.  Yet BaaS offerings are hitting a wall by offering a closed set of backend application services.  Innovative Public and Private PaaS vendors (e.g. Apprenda, Heroku, WSO2) are challenging established vendors (e.g. Oracle, IBM, Red Hat) as the preferred platform when forklifting web applications or building new cloud-aware applications.

 

As PaaS innovators focus on increasing application development agility, reducing time to market, and lowering backend skill hurdles, the line between PaaS Services and BaaS Services will blur.  The end goal is to deliver an open, extensible PaaS where developers can easily weave APIs, services, processes, data, and user interface widgets into a compelling user experience.

 

 

 

Ushani BalasooriyaHow to test the values in the OAuth2 token (authorization header) of the original client API Call request in WSO2 API Manager


The WSO2 API Manager is an on-going project with continuous improvements and enhancements introduced with each new release to address new business challenges and customer expectations. WSO2 invites users, developers and enthusiasts to get involved or get the assistance of our development teams at many different levels through online forums, mailing lists and support options. We are committed to ensure you a fulfilling user experience at any level of involvement with the WSO2 API Manager. Reference and For more information : http://docs.wso2.org/wiki/display/AM130/About+API+Manager



I hope the intended reader of this post has successfully installed WSO2 API Manager and has got an idea about using API manager, OAuth2 token, JWT, client API calls and etc. If not, please refer the documentation for installation and as a user guide.
This blog post will be useful for anyone who wants to configure and test the authorization header of the original client API call request in API manager.

Steps to follow

  1. Refer the User Guide (http://dist.wso2.org/products/api-manager/1.1.1/WSO2APIManager-v1.1-GettingStarted.pdf and follow the steps to create user roles, users, an application and take it up to publishing level. 

  2. Before the above step, to view the header values, refer http://docs.wso2.org/wiki/display/AM130/Configure+JSON+Web+Token+%28JWT%29+Generation#ConfigureJSONWebTokenJWTGeneration-EnableTokenGeneration and set <EnableTokenGeneration>true</EnableTokenGeneration> as true. 

  3. Start the server and create an API, publish it and subscribe to it from the API Store.

  4. Invoke the API and capture the outgoing message from the API Gateway.

  5. To perform the above step, configure tcp mon to view the API client call request. This request should be configured to view the client call request goes from the WSO2 API Manager to respective interface.

  6. Once the app is published, make a GET, POST or a PUT request call using a curl or a Jmeter script or using a REST Client (Latest API manager has its own rest client. Or can use Chrome Advanced Rest Client Application). Read more : http://docs.wso2.org/wiki/display/AM140/REST+APIs
     Token generation is explained in Step 7.
    E.g., 
      curl -v -X POST -H "Content-type: application/xml" -d @create.xml http://localhost:9280/app/1.0.0 -H "Authorization: Bearer <token> "
      curl -v -X PUT -H "Content-type: application/xml" -d @update.xml http://localhost:9280/app/1.0.0 -H "Authorization: Bearer <token>"
     
  7. If you use the access the app as an application creator use the Access Token or else as a consumer, you have to follow the below steps (8-10) to generate the authorization bearer key using both Consumer key and the consumer secret in the API Store of the relevant application once you have successfully subscribed.
    Get the both keys and copy and paste on a text pad together separated by a colon as below.
    E.g.,
      <Consumer key> : <Consumer secret>
      3kaBCHnXCYX9wgS0sFV2zGWqnRQa:YGynxN1Y43LsXCOU4gjkVuwYfoUa


  8. Then encode it to Base64 format. Refer this site to perform it. 
    E.g., Generated key : M2thQkNIblhDWVg5d2dTMHNGVjJ6R1dxblJRYTpZR3lueE4xWTQzTHNYQ09VNGdqa1Z1d1lmb1Vh



  9. Then using curl generate the login key. For more reference : http://docs.wso2.org/wiki/display/AM140/User+Tokens

    curl -k -d "grant_type=password&username=admin&password=admin&scope=PRODUCTION" -H "Authorization :Bearer M2thQkNIblhDWVg5d2dTMHNGVjJ6R1dxblJRYTpZR3lueE4xWTQzTHNYQ09VNGdqa1Z1d1lmb1Vh, Content-Type: application/x-www-form-urlencoded" http://localhost:8280/login

Response :
{"token_type":"bearer","expires_in":3600,"refresh_token":"401b9bca56c9afff8e9f8aece86181","access_token":"c822da634acba682187f17f32e6ed9e7"}

  1. Get the access token generated (E.g., c822da634acba682187f17f32e6ed9e7) and provide it for the above access token in Step 6 curl command or for the jmeter script's variable - TokenID. "Authorization: Bearer <token>

  2. Now send a API call request using Jmeter or curl. (Step 6)

  3. Observe tcp mon.

  4. You will see something like below in tcpmon.
    GET http://10.100.2.115:12765/jaxrs_basic_44/services/customers/customerservice/customers/test1/123/test2 HTTP/1.1
    X-JWT-Assertion: eyJ0eXAiOiJKV1QiLCJhbGciOiJTSEEyNTZ3aXRoUlNBIiwieDV0IjoiTm1KbU9HVXhNelpsWWpNMlpEUmhOVFpsWVRBMVl6ZGhaVFJpT1dFME5XSTJNMkptT1RjMVpBPT0ifQ==.eyJpc3MiOiJ3c28yLm9yZy9wcm9kdWN0cy9hbSIsImV4cCI6MTM2MjczNDYxNjE1NywiaHR0cDovL3dzbzIub3JnL2NsYWltcy9zdWJzY3JpYmVyIjoiYXBpc3Vic2NyaWJlciIsImh0dHA6Ly93c28yLm9yZy9jbGFpbXMvYXBwbGljYXRpb25pZCI6IjYiLCJodHRwOi8vd3NvMi5vcmcvY2xhaW1zL2FwcGxpY2F0aW9ubmFtZSI6IkFhYmNkIiwiaHR0cDovL3dzbzIub3JnL2NsYWltcy9hcHBsaWNhdGlvbnRpZXIiOiJVbmxpbWl0ZWQiLCJodHRwOi8vd3NvMi5vcmcvY2xhaW1zL2FwaWNvbnRleHQiOiIvQUFBIiwiaHR0cDovL3dzbzIub3JnL2NsYWltcy92ZXJzaW9uIjoiMS4wLjAiLCJodHRwOi8vd3NvMi5vcmcvY2xhaW1zL3RpZXIiOiJVbmxpbWl0ZWQiLCJodHRwOi8vd3NvMi5vcmcvY2xhaW1zL2tleXR5cGUiOiJQUk9EVUNUSU9OIiwiaHR0cDovL3dzbzIub3JnL2NsYWltcy91c2VydHlwZSI6IkFQUExJQ0FUSU9OX1VTRVIiLCJodHRwOi8vd3NvMi5vcmcvY2xhaW1zL2VuZHVzZXIiOiJhZG1pbiJ9.Q4Q1ET1SECUT1+OT3AEkNXuUnRg3ssUnWWyOt2Us8boBwjA9AYjnKvDnMqqaOJUjRzWqGdZjoYXycTlTmqFBVdNNq+V4Ol4FMcL5zA3mat4JvYQlvhtqD/3zP0pM7SrLCPQ8uCTWWVlX/y+bUg1F1MoKUGvpmACDbgdLtRT9Btc=
    assertion: eyJ0eXAiOiJKV1QiLCJhbGciOiJTSEEyNTZ3aXRoUlNBIiwieDV0IjoiTm1KbU9HVXhNelpsWWpNMlpEUmhOVFpsWVRBMVl6ZGhaVFJpT1dFME5XSTJNMkptT1RjMVpBPT0ifQ==.eyJpc3MiOiJ3c28yLm9yZy9wcm9kdWN0cy9hbSIsImV4cCI6MTM2MjcyNDczMzc4NiwiaHR0cDovL3dzbzIub3JnL2NsYWltcy9zdWJzY3JpYmVyIjoiYWRtaW4iLCJodHRwOi8vd3NvMi5vcmcvY2xhaW1zL2FwcGxpY2F0aW9ubmFtZSI6IkRlZmF1bHRBcHBsaWNhdGlvbiIsaHR0cDovL3dzbzIub3JnL2NsYWltcy9hcGljb250ZXh0IjoiL0FBQSIsImh0dHA6Ly93c28yLm9yZy9jbGFpbXMvdmVyc2lvbiI6IjEuMC4wIiwiaHR0cDovL3dzbzIub3JnL2NsYWltcy90aWVyIjoiVW5saW1pdGVkIiwiaHR0cDovL3dzbzIub3JnL2NsYWltcy9lbmR1c2VyIjoiYWRtaW4ifQ.Q4Q1ET1SECUT1+OT3AEkNXuUnRg3ssUnWWyOt2Us8boBwjA9AYjnKvDnMqqaOJUjRzWqGdZjoYXycTlTmqFBVdNNq+V4Ol4FMcL5zA3mat4JvYQlvhtqD/3zP0pM7SrLCPQ8uCTWWVlX/y+bUg1F1MoKUGvpmACDbgdLtRT9Btc=
    Content-Type: application/x-www-form-urlencoded; charset=UTF-8
    Host: 10.100.2.115:12765
    Connection: Keep-Alive

  5. Copy the above green colored key which in between 2 separators. (. - dots) in assertion. That is where the header values are included. Base64 decode the second part of the 'assertation' header. Note: The assertion header consists of 3 parts separated by the '.' (period) character.

  6. Use this site to decode it as below and it will generate the following. Now observe the header values.



    E.g.,
    {"iss":"wso2.org/products/am","exp":1362724733786,"http://wso2.org/claims/subscriber":"admin","http://wso2.org/claims/applicationname":"DefaultApplication",http://wso2.org/claims/apicontext":"/AAA","http://wso2.org/claims/version":"1.0.0","http://wso2.org/claims/tier":"Unlimited","http://wso2.org/claims/enduser":"admin"}
    E.g.,
{"iss":"wso2.org/products/am","exp":1362724733786,
"http://wso2.org/claims/subscriber":"admin",
"http://wso2.org/claims/applicationname":"DefaultApplication",
"http://wso2.org/claims/apicontext":"/AAA",
"http://wso2.org/claims/version":"1.0.0",
"http://wso2.org/claims/tier":"Unlimited",
"http://wso2.org/claims/enduser":"admin"}

Prabath AbeysekeraSolved - Weird exceptions while starting Intellij IDEA

Intellij IDEA has been my favourite IDE for nearly the past 4 years. The amazing set of user-friendly options and functionalities offered to the developers by the IDE have clearly gotten me attracted towards it.

However, recently when I tried to boot up my IDEA instance it started throwing a flurry of exceptions at the my command line console out of the blue. Although the server was started, most of the options such as attaching dependencies to my projects, etc were not functioning properly. The following log depicts part of the error logged at the server startup.



Though I tried re-installing the distribution and various other options I couldn't really get it to work. Finally, I backed up the "config" and "system" directories that contain your IDEA configuration settings and data cache residing in "~/.IntelliJIdea90/" directory and deleted them from the file system. Then restarted the IDEA instance and that seemed to have fixed all the aforementioned issues!

Note : This may result in you losing all the metadata stored in the data cache resides in the "~/.IntelliJIdea90/system" folder and your configuration settings stored in the "~/.IntelliJIdea90/config" directory. You also will have to re-install your license if you're using enterprise edition of Intellij IDEA.

Heshan SuriyaarachchiInstalling Moab Web Services on a Unix box

1) Install Tomcat
yum install tomcat6
2) Install 64-bit version of Oracle Java SE6 JRE.
sh jre-6u37-linux-x64-rpm.bin
rm -f /usr/bin/java
ln -s /etc/alternatives/java /usr/bin/java
alternatives --install /usr/bin/java java /usr/java/jre1.6.0_37/bin/java 500
alternatives --set java /usr/java/jre1.6.0_37/bin/java
3) Create mws home directories and sub-directories
mkdir -p /opt/mws/etc /opt/mws/hooks /opt/mws/plugins /opt/mws/log
chown -R tomcat:tomcat /opt/mws # Depending on your OS, the Tomcat username might be
tomcat6.
chmod -R 555 /opt/mws
chmod u+w /opt/mws/plugins /opt/mws/log
4) Extract mws tarball to a tempory directory.
mkdir /tmp/mws-install
cd /tmp/mws-install
tar xvzf $HOME/Downloads/mws-.tar.gz
cd /tmp/mws-install/mws-
5) Set up the MWS configuration file.
 i) In the extracted MWS directory are two sample configuration files:
   mws-config-cloud.groovy and mws-config-hpc.groovy
mws-config-cloud.groovy provides sample configuration for the Moab Cloud Suite
mws-config-hpc.groovy provides sample configuration for the Moab HPC Suites

ii) Choose the correct file for your suite, rename it to mws-config.groovy, and copy it to /opt/mws/etc.

iii) Give the Tomcat user read access to /opt/mws/etc/mws-config.groovy. 6) Add the following line to the end of /etc/tomcat6/tomcat6.conf.
CATALINA_OPTS="-DMWS_HOME=/opt/mws -Xms256m -Xmx3g -XX:MaxPermSize=384m"
7) Start Tomcat and deploy mws.war.
chkconfig tomcat6 on
service tomcat6 stop
cp /tmp/mws-install/mws-/mws.war /var/lib/tomcat6/webapps
service tomcat6 start
8) Visit http://localhost:8080/mws/ in a web browser to verify that MWS is running. You will see some sample queries and a few other actions.

9) Log into MWS to verify that the MWS credentials are working. The credentials are the values of auth.defaultUser.username and auth.defaultUser.password that you set above.

Chris HaddadCobiacomm Tag Clouds

Since re-starting my blog with a focus on architecture, PaaS, SOA, API Management, Big Data, and DevOps,  I have seen increasing visitor interest in my content.   With a super-majority of my visitors arriving via organic search, understanding how blog page meta-data and content aligns with referral search terms and page rank will help amplify my message.   I’ve started to use wordle.net to analyze keyword distribution on my blog pages, and tagcrowd.com to analyze search referral term distribution.  The tools generate tag clouds that visualize keyword/term distribution.

A first pass simply collates search referral terms and does not normalize the list by search referral count.   A visitor search for PaaS 50 times is counted equally as a search for SOA five times.   In the tag cloud, the tag size for the search term indicates how many times the keyword is used in combination with other search term modifiers.  For example,  PaaS architecture, PaaS TCO, and DevOps PaaS.   Figure 1 below illustrates the search term distribution:

Referral Search Term Tag Cloud

Across all search term phrases, the tag cloud identifies the following common terms: ‘API’, ‘architecture’, ‘cloud’, ‘Enterprise Service Bus’, ‘ESB’, ‘paas’, ‘products’, and ‘vs WSO2′.

I used wordle.net to generate a tag cloud by evaluating keyword distribution across the cobiacomm RSS feed.  A first pass limitation, the RSS feed only feeds blog post excerpt text up to the ‘read more…’ section break.   Figure 2. below presents a tag cloud illustring keyword distribution across the cobiacomm RSS feed.

Blog Excerpt Keyword Distribution

In the excerpt text, the blog post content demonstrates a focus on ‘architecture’, ‘application’, ‘business’, ‘cloud’, ‘open’, ‘platform’, ‘PaaS’, ‘source’, and ‘WSO2′.

 

Next pass will be to analyze full blog post content and properly weight referral search terms by term count.

 

 

Kathiravelu PradeebanLisbon - Week29

A nightly walk at Entre Campos
[14/03/2013] The second semester is getting hotter. ;) We have received the project specifications for 3 out of the 4 modules. We have already submitted the project proposals for 2 of them. We are researching Jikes RVM for the Virtual Execution Environments module.

[13/03/2013] - These days, I was busy buying flight tickets. It was a good learning experience. I was not aware of the clause, "LOW COST FARE. CANNOT BE CHANGED OR CANCELLED" and this means, we can not change a flight or cancel it. I confirmed it from the two airlines concerned, and they mentioned that this can be changed only by the travel agents (eDreams), but the travel agent eDreams policy doesn't let changing the reservation of the "Economy Restricted" tickets. I find it interesting. I should note that TAP Portugal outlet at Marques De Pombal officers were pretty much helpful.

I am enjoying the nightly walks in Lisbon. 2013 is different. I should start writing a blog post on how the year 2013 is remarkably different. :)

Kathiravelu PradeebanLisbon - Weeks 27 & 28

From Cabo Ruivo to Parque das Nações..
[07/03/2013] - EMDC 2013 batch now received the official invitations, and they are being added to the Facebook group of EMDC. The group is getting more and more active. The excitement of the students remind me the early 2012, when I was expecting the day to join EMDC - good old days. ;)

[05/03/2013] - I have been elected as an Erasmus Mundus Course Representative for the EMDC, for the year 2013. Click HERE to view the list of elected representatives for 128 programmes!

[27/02/2013] - I bought a Sony Xperia J from fnac, and realized it was locked by Vodafone. It keeps asking "SIM Network Unlock PIN", when I start the phone with the MOCHE SIM, instead of the Vodafone SIM that came bundled with the phone, and without it, it was not working with the MOCHE SIM.

From Spain to Portugal - A boat of descubriter.
I visited fnac and asked whether they could unlock my phone, when I realized that I couldn't unlock it myself or via online services, without paying for their service. Fnac pointed me out that I should contact the service providers to unlock the phone. I reached Vodafone and paid 47.47 Euros to unlock the phone, which included the discount due to the bond with the service provider and the service charge + tax.

I was told I will be sent an sms with the unlock code, in 3 days, which is supposed to be a Saturday. I didn't get any. Assuming they may not work in weekends, I waited further, and eventually waited till the Monday. I still didn't get it! So I reached to them again on the Tuesday, where they unlocked my phone, by entering the unlock code themselves. Never mind, I got it sorted out, at least! :)

[22/02/2013] - Parque das Nações never fails to amuse me. It is full of interesting restaurants, seagulls, and cold wind. The small port of Parque das Nações provides a stay for the mini boats. Parque das Nações surely is a highlight of my year 2013.

Chris HaddadOpen Source Community Participation

I wonder why more open source users do not actively participate in the open source community and become committers or contributors.  My open source participation led to a cost efficient and adaptable infrastructure for my company, and useful trade experience skills on my resume.  My open source contributions established a professional network of mentors and improved my understanding of the project.   Becoming an open source committer enhanced by personal brand, increased business opportunities, and filled important open source project gaps.

Interacting with open source community committers and recommending source code hacks is a valuable experience.   During 2001-2003, I had the opportunity to interact with many hard-core, professional open source luminaries (e.g. Sam Ruby, James Snell, Glenn Daniels, Dims, Steve Loughran, and Sanjiva Weerawarana) across multiple organizations while participating in the Apache Axis project.  I watched the distributed Axis team advance the project via IRC, code check-ins, and mailing list interactions.  After understanding the project’s capabilities and roadmap (by writing many sample code service clients and providers), I gained the knowledge to start directly hacking the source code and contributing useful extensions.   My everlasting thanks to Glenn Daniels for nominating me to be a committer!  The open source community and committer experience established my open source street creds, raised my personal brand,  led to presenting from the OSCON stage (and others), and helped build my consulting business.

My Apache Axis participation (as an independent XML web services consultant) a decade ago has introduced me to many helpful individuals (e.g. Anne Thomas Manes, Michele Leroux Bustamante, and Burr Sutter ) and opened many opportunities.  With the upside so high and barrier to entry low (don’t have to move, be employed by a Valley startup, give up your day job, or wait for a 4 years for a degree), I wonder why more open source users do not actively participate in the open source community and become  committers or contributors.

 

Today’s open source is competitive (or even more advanced than) with proprietary software, and delivered without proprietary handcuffs.  By integrating and enhancing leading, best-of-breed open source projects, WSO2 extends Apache projects (and other leading OSS projects not hosted in Apache) into a comprehensive cloud platform.   The WSO2 Apache Way web page lists key embedded projects, and the impressive list of WSO2 individuals who are Apache committers.  By building on external open source projects, WSO2 is able to interact with the innovative thought leaders from Twitter, FaceBook, Google, IBM, Red Hat, and Netflix to advance open source value.

 Call To Action

Donnie Berkholz at RedMonk has a good blog post describing How to recruit open-source contributors.    I am following Donnie Berkholz‘s advice and reaching out to request your participation as we take the most complete and composable open source WSO2 Carbon platform to the next level.

 

Has your team built any platform, management or framework code that you would like to see directly incorporated into WSO2 Carbon? Are you a GitHub project owner and your code could enhance the WSO2 platform and be helpful to thousands of WSO2 users?

 

We welcome your participation in the WSO2 and Apache open source community!  Contact us today to explore community involvement opportunities and contributions.

Pragmatic Recommendations On How To Get Started with Open Source Community Participation

Jeremy Mikola has shared a slide deck describing on how to be a good OSS contributor.  A good way to start is by subscribing to WSO2 architecture mailing lists and digging into the sample code.  Daniel Doubrovkine has compiled a list of qualities that will make you an amazing contributor:

1. Have a real problem to solve, business need, or some type of commercially-driven motivation.

2. Understand the goals of the project and make sure your contribution is in line with them.

3. Submit complete patches that implement full features. Include any test information and documentation.

4. Play by the rules of the project that you’re contributing to.

5. Be humble. Never add your name to the list of contributors yourself—the project leader should do so, if she or he values your work.

6. Have low expectations. Learn to accept rejection.

7. Persevere. Improve upon comments and keep sending updates.

8. Be honest and vocal about your available time and skills.

9. Be a doer, not a talker or a troll.

10. Finish what you started, don’t give up.

 

Other less code-intensive contribution opportunities exist. You may be more confortable contributing documentation, blog posts, and presentations. Barbara Shuarette shares a contribution list at opensource.com.

Recommended Reading

10 Ways to Participate In Open Source

 

 

Sriskandarajah SuhothayanMonitoring ActiveMQ Queues via JMX MBeans with WSO2 Complex Event Processor (WSO2 CEP)

WSO2 CEP and WSO2 Business Activity Monitor have support for JMX MBeans monitoring. You can find the docs for JMX MBeans monitoring for WSO2 BAM from here.

I'm writing this blog to illustrate how WSO2 CEP can be used to monitor the JMX MBeans, and I'm using ActiveMQ JMS broker as an example to demonstrate its capabilities.
Here I have used apache-activemq-5.4.3

First we need to enable ActiveMQ JMS broker to support JMX remotely.

To do so, you have to enable JMX in the broker, in the <activemq_home>/conf/activemq.xml:
<broker xmlns="http://activemq.org/config/1.0" brokerName="localhost" useJmx="true">
 and 
<managementContext>
    <managementContext connectorPort="1099" />
</managementContext> 
Now you have to enable JMX in the JVM parameters in <activemq_home>/bin/activemq: 
Locate the line 
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $SUNJMX $SSL_OPTS" 
and change it to: 
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $SUNJMX $SSL_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" 

To test whether its correctly working run "jconsole"

Now we need to Enable to CEP to receive JMX Events

To do so first we need to install JMX Agent to CEP 

Add 4.0.7 P2 repository form the URL  http://dist.wso2.org/p2/carbon/releases/4.0.7

Next install the "BAM JMX Agent Aggregate" 


Restart CEP.

Now we need to configure JMX.

To do so, go to Configure -> JMX Agent 
Click on "Add Profile"  and configure he profile as below


Here use the Data Receiver user name & password as "admin" & "admin" 
and JMX Server user name & password as "admin" & "activemq" 

Then  click on the "Load Means" button to load the available MBeans, 
Note : ActiveMQ need to be up an running in-order to load its MBeans

Next when you click on the appropriate MBean a dropdown will appear showing its attributes. 

You have to select your relevant attributes one by one from the drop down. 

You also need to change the Alias to a much readable strings, 
For this Example I have used:
BrokerName, TotalEnqueueCount, TotalDequeueCount, TotalMessageCount, MemoryPercentUsage

Now click "Save" to save & deploy the JMX Agent.

When we add the above configuration JMX agent will automatically create the following WSO2 Event Stream Definition

{
    "streamId": "org.wso2.bam.jmx.agent.activemq:1.0.0",
    "name": "org.wso2.bam.jmx.agent.activemq",
    "version": "1.0.0",
    "nickName": "JMX Dump",
    "description": "JMX monitoring data",
    "metaData": [{
        "name": "clientType",
        "type": "STRING"
    }, {
        "name": "host",
        "type": "STRING"
    }],
    "payloadData": [{
        "name": "BrokerName",
        "type": "STRING"
    }, {
        "name": "TotalEnqueueCount",
        "type": "LONG"
    }, {
        "name": "TotalDequeueCount",
        "type": "LONG"
    }, {
        "name": "TotalMessageCount",
        "type": "LONG"
    }, {
        "name": "MemoryPercentUsage",
        "type": "INT"
    }]
}

Next step is creating a CEP Bucket to use JMX event. 
To do this:
  • Shutdown CEP 
  • Run "ant deploy-broker-manager" from  <cep_home>/samples/cep-samples
  • Copy paste activemq-all-xxx.jar from the <activemq_home> directory to <cep_home>/samples/lib directory. 
  • Copy paste activemq-core-xxx.jar and geronimo-j2ee-management_1.1_spec-1.0.1.jar from <activemq_home>/lib to <cep_home>/repository/components/lib directory.
  • Copy the queue-monitor.xml to <cep_home>/repository/deployment/server/cepbuckets
  • In a new terminal run "ant jmsSubscriber -Dtopic=QueueInfo" from <cep_home>/samples/cep-samples to receive the outputs of the queue-monitor bucket.
  • Start CEP 
Now try running the Queue example which is in the <amq_home>/example.
In a new terminal run "ant consumer" to run the sample consumer 
In a new terminal run "ant producer" to send some sample messages to the ActiveMQ Queue. 

you will be able to view some appropriate outputs in CEP QueueInfo jmsSubscriber

Ganesh PrasadHow to Implement An Atomic "Get And Set" Operation In REST


This question came up yesterday at work, and it's probably a common requirement.

You need to retrieve the value of a record (if it exists), or else create it with a default value. An example would be when you're mapping identifiers between an external domain and your own. If the external domain is passing in a reference to an existing entity in your domain, you need to look up the local identifier for that entity. If the entity doesn't yet exist in your domain, you need to create (i.e., auto-provision) it and insert a record in the mapping table associating the two identifiers. The two operations have to be atomic because you can't allow two processes to both check for the existence of the mapping record, find out it doesn't exist, then create two new entity instances. Only one of the processes should win the race.

(Let's ignore for a moment the possibility that you can rely on a uniqueness constraint in a relational database to prevent this situation from occurring. We're talking about a general pattern here.)

Normally, you would be tempted to create an atomic operation called "Get or Create". But if this is to be a RESTian service operation, there is no verb that combines the effects of GET and POST, nor would it be advisable to invent one, because it would in effect be a GET with side-effects - never a good idea.

One solution is as follows (and there could be others):

Step 1:

GET /records/{external-id}

If a record exists, you receive a "200 OK" status and the mapping record containing the internal ID.

Body:
{
  "external-id" :  ...
  "internal-id" :  ...
}

If the record does not exist, you get a "404 Not found" and a one-time URI in the "Location" header.

Location: /newrecords/84c5d65a-2198-42eb-8537-b16f58733791

(The server will also use the header "Cache-control: no-cache" to ensure that intermediate proxies do not cache this time-sensitive response but defer to the origin server on every request.)

Step 2 (Required only if you receive a "404 Not found"):

2a) Generate an internal ID.

2b) Create a new entity with this internal ID and also create a mapping record that associates this internal ID with the external ID passed in. This can be done with a single POST to the one-time URI.

POST /newrecords/84c5d65a-2198-42eb-8537-b16f58733791

Body:
{
  "external-id" :  ...
  "internal-id" :  ... (what you just generated)
  "other-entity-attributes" : ...
}

The implementation of the POST will create a new local entity instance as well as insert a new record in the mapping table - in one atomic operation (which is easy enough to ensure on the server side).

If you win the race, you receive a "201 Created" and the mapping record as a confirmation.

Body:
{
  "external-id" :  ...
  "internal-id" :  ... (what you generated)
}

If you lose the race, you receive a "409 Conflict" and the mapping record that was created by the previous (successful) process.

Body:
{
  "external-id" :  ...
  "internal-id" :  ... (what the winning process generated)
}

Either way, the local system now has an entity instance with a local (internal) identifier, and a mapping from the external domain's identifier to this one. Subsequent GETs will return this mapping along with a "200 OK". The operation is guaranteeably consistent, without having to rely on an atomic "Get or Create" verb.

One could quibble that a GET that fails to retrieve a representation of a resource does have a side-effect - the creation of a one-time URI with the value "84c5d65a-2198-42eb-8537-b16f58733791" being inserted somewhere. This is strictly true, but the operation is idempotent, which mitigates its impact. The next process to do an unsuccessful GET on the same value must receive the same one-time URI.

It's a bit of work on the server side, but it results in an elegant RESTian solution.

Hiranya JayathilakaStarting HBase Server Programmatically

I'm implementing a database application these days and for that I wanted to programmatically start and stop a standalone HBase server. More specifically I wanted to make HBase server a part of my application so that whenever my application starts, HBase server also starts up. This turned out to be more difficult than I thought it would be. To start a HBase server you actually need to start three things:
1. HBase master server
2. HBase region server
3. ZooKeeper
The default startup script shipped with the HBase binary distribution does all this for you. But I wanted a more tightly integrated and a fully programmatic solution. Unfortunately the HBase public API doesn't seem to expose the functionality required for programmatically starting and stopping the above components (at least not in a straightforward manner). So after going through the HBase source and trying out various things, I managed to come up with some code that does exactly what I want. At a high level, this is what my code does:
1. Create an instance of HQuorumPeer  and execute it on a separate thread.
2. Create an initialize a HBaseConfiguration instance.
3. Create an instance of HMaster and execute it on a separate thread.
4. Create an instance of HRegionServer and execute it on a separate thread.
Both HMaster and HRegionServer implement the Runnable interface. Therefore it's easy to run them on separate threads. I created a simple Java Executor instance and scheduled HMaster and HRegionServer for execution on it. But HQuorumPeer was a bit tricky. This class only contains a main method and has no such thing called a public API. So one solution is to create your own thread class, which simply invokes the above mentioned main method. The other option is to write your own HQuorumPeer class implementing the Runnable interface. The original HQuorumPeer class from the HBase project is fairly small and contains only a small amount of code. So I  took the second approach. I simply copied the code from the original HQuorumPeer and created my own HQuorumPeer implementing the Runnable interface. Overall this is what my finalized code looks like:
        
exec.submit(new HQuorumPeer(properties));
log.info("HBase ZooKeeper server started");

Configuration config = HBaseConfiguration.create();
File hbaseDir = new File(hbasePath, "data");
config.set(HConstants.HBASE_DIR, hbaseDir.getAbsolutePath());
for (String key : properties.stringPropertyNames()) {
if (key.startsWith("hbase.")) {
config.set(key, properties.getProperty(key));
} else {
String name = HConstants.ZK_CFG_PROPERTY_PREFIX + key;
config.set(name, properties.getProperty(key));
}
}

try {
master = new HMaster(config);
regionServer = new HRegionServer(config);
masterFuture = exec.submit(master);
regionServerFuture = exec.submit(regionServer);
log.info("HBase server is up and running...");
} catch (Exception e) {
handleException("Error while initializing HBase server", e);
}
Then I nicely wrapped up all this logic into a single reusable util class called HBaseServer. So whenever I want to start/stop HBase in my application, this is all I have to do.
HBaseServer hbaseServer = new HBaseServer();
hbaseServer.start();
Hope somebody finds this useful :)

Footnotes