February 8th, 2012 • Comments Off on Coffee instead of snakes – Openshift fun (2)
In my last post I demoed how OpenShift can be used to deploy WSGI based Python application. But since OpenShift also supports other languages including Java I wanted to give it a shot.
So I developed a very minimalistic application which emulates a RESTful interface. Of course it takes the simplistic – all time favorite – Hello World approach for this. Client can create resources, which when queried will return the obligatory ‘Hello <resource name>’.
To start create a new java application in your OpenShift dashboard. When cloning the git repository – which was created – you will notice that you basically get a maven project with some templates in it. Now you can simple use maven to test and develop your application. When done do a git push and your application is ready to go.
The implementation is pretty straight forward:
/**
* Simple REST Hello World Service.
*
* @author tmetsch
*
*/
public class HelloServlet extends HttpServlet {
[...]
@Override
protected final void doGet(final HttpServletRequest req,
final HttpServletResponse resp) throws ServletException,
IOException {
[...]
}
[...]
So beside from extending the HttpServlet class all you need to do is implement the doGet and doPost methods. When done edit the ‘web.xml’ file in the folder src/main/webapp:
[...]
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>the.ultimate.test.pkg.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/users/*</url-pattern>
</servlet-mapping>
[...]
This will make sure you the application can be found under the right route. If you like you can also add an index.html file in the same folder so people can read a brief introduction when visting the top layer of you application. In my case that would be http://testus-sample.rhcloud.com – The application itself can be found under: http://testus-sample.rhcloud.com/users/.
So I like the approach OpenShift takes here with maven. You can simply add you dependencies like jmock, junit etc. and during deployment it is taken care of that everything falls in place. Also if you write Unittest it’ll also ensure that you’re application will work – Non functional apps will not be deployed obviously if you write a Unittest and use maven. It’s pretty easy to write Unittest for the HttpServlet class if you use a mocking framework like jmock. You can get the source code at github.
Categories: Personal • Tags: Cloud, Java • Permalink for this article
December 2nd, 2009 • 2 Comments
OCCI has been around for a while now, and for those just starting to fiddle with it here is a ‘introduction’. OCCI is more then just a document and specification…’
The OGF Open Cloud Computing Interface Working Group (OCCI-wg) is developing a clean, open API for ‘Infrastructure as a Service’ (IaaS) based Clouds. IaaS is one of three primary services: Infrastructure, Software, and Platform of the emerging Cloud industry.
OCCI–wg is a working group of the OGF established in March 2009. The group has active membership of over 200 individuals and is led by four chairs from industry, academia, service providers and end-users. Several members are from commercial service providers that are committed to implementing the OGF-OCCI specification.

Ignacio and me during the founding session.
The idea of cost reduction, GreenIT and on-demand resource planning lead to the idea of having elastic environments which scale on demand. Today’s demand for elastic environments in which public Clouds (like Amazon’s EC2 offerings) and private Clouds (locally installed resources) interoperate (Hybrid-,Federate- or InterClouds) show the need for standardization. Differentiation in the offerings is done by extensions and prices not by core functionalities. The need to interface all Cloud providers (private as well as public) in the same manner shows the need for standards for core features. Therefore main drivers behind the specification are to ensure Portability, Interoperability and Integration between Cloud service providers and end-users.
OCCI will be a very slim RESTful based API which can be easily extended. Without the overhead of many similar protocols the REST approach allows users to easily access their services. Every resource is uniquely addressed using a Uniform Resource Identifier (URI). Based on a set of operations – create, retrieve, update and delete (CRUD) – resources can be managed. Currently three types of resources are considered: storage, network and compute resources. Those resources can be linked together to form a virtual machine with assigned attributes. For example, it is possible to provision a machine which has 2GB of RAM, one hard disk and one network interface.
The Specification itself is setup to be modular. Therefore it is delivered as a document series. Each of the documents focuses on a certain topic and can be independently used from the others. Until now the OCCI specification consist of four modules: The Core specification, a description of how IaaS based resources should look like, a HTTP rendering for easy machine-to-machine management and a XHTML rendering for creation of human-to-machine interfaces.
The following diagram shows an example RESTful query towards an OCCI compliant service provider:

OCCI overview diagram
An HTTP GET operation is performed on an unique URI representing a virtual machine of Solaris zone. The URI encapsulates the instance and provider id. The OCCI specification describes how operations can be performed upon resources (Compute, Storage and Network). Resources can be linked so they described e.g. a Virtual Machine. Each resource type has a certain set of attributes (e.g. CPU speed, Storage size and IP addresses).
The CRUD operations can be performed upon the resources. During the past months two reference implementations have emerged. Based on drafts of the specification a group of the University of Madrid (UCM – OpenNebula) and a group inside of the National Institute of Nuclear Physics (INFN) created reference implementations.
The idea which led to the creation of the OCCI group has been triggered and sponsored by the EU project RESERVOIR. RESERVOIR tries to establish a tool suite for Cloud computing middleware in which the interfaces should be standardized. One of these interface will be an implementation of the OCCI specification. The work done within the group has gained an significant impact in the Cloud community. Blogs, technology related websites, twitter (Tag #OCCI) and journals have driven and reported about OCCI thanks to the open process of the group.
Currently the OCCI group is finalizing and documenting the initial draft specification. After only half a year the OCCI group succeeded in delivering on of the first standards for the Cloud community. This could be achieved thanks to the big momentum the group has had. Due to the specification’s high extensibility the group will start to work on extensions after the first draft has been delivered. In future OCCI might become a provider of a complete Cloud computing interface stack which covers IaaS as well as PaaS based offerings.
OCCI plays a major role in today’s Cloud computing standardization efforts. The group is actively collaborating with other groups from SNIA for storage and DMTF for management standards. A white paper has been published describing how SNIA’s Cloud Data Management Interface and OCCI can work in conjunction. The work is also featured on the http://www.cloud- standards.org wiki where Cloud related standards are coordinated by the major Standards Development Organizations (SDOs).
For more information visit http://www.occi-wg.org/
Categories: Personal, Work • Tags: Cloud, OCCI, OpenNebula • Permalink for this article
October 27th, 2009 • Comments Off on The Cloud & Standards collaboration
Cloud Computing is a hype topic, most of you know that. Still there is a lot of interesting stuff going on during the past months and weeks. As one of the chairs of the OCCI (http://www.occi-wg.org) working group I had the great opportunity to present the status and some cloud related work during the Cloud Computing and its Applications conference. I was invited by Ian Foster to present the following slides:
What it comes done to is the following: During OGF27 (http://www.ogf.org/OGF27) we stated to present one of the first standardized Cloud interfaces. We are almost there and soon the specification will be out in the public comments phase of the OGF editor pipeline. More important than having one standard is to have the standards collaborate while each focus on a different aspect. For example the Cloud Data Management Interface driven by SNIA (http://www.snia.org). Now we need some more efforts like demos demonstrating interoperable and portable cloud solutions.
If you wanna know what is going on for OCCI right now: We had a lot of blog posts, mails, etc going on…
BTW the OCCI sessions during OGF27 itself went pretty well and both OCCI and myself have been in the closing remarks from Craig Lee:

Categories: Work • Tags: Cloud, OCCI, OGF • Permalink for this article