<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Engwar</title>
	<atom:link href="http://engwar.com/feed" rel="self" type="application/rss+xml" />
	<link>http://engwar.com</link>
	<description>Chintana Wilamuna&#039;s weblog</description>
	<lastBuildDate>Tue, 06 Mar 2012 07:32:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Understanding OSGi</title>
		<link>http://engwar.com/post/702?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=understanding-osgi</link>
		<comments>http://engwar.com/post/702#comments</comments>
		<pubDate>Tue, 06 Mar 2012 07:32:49 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[osgi]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=702</guid>
		<description><![CDATA[When learning about OSGi it&#8217;s easier to start from some sample code first. Then dive into what it all means. Apache Felix is a OSGi container with nice set of samples to start with. First learn how to launch the &#8230; <a href="http://engwar.com/post/702">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When learning about OSGi it&#8217;s easier to start from some sample code first. Then dive into what it all means. Apache Felix is a OSGi container with nice set of samples to start with. First learn <a href="http://felix.apache.org/site/apache-felix-framework-usage-documentation.html">how to launch the Felix framework</a>. Then <a href="http://felix.apache.org/site/apache-felix-osgi-tutorial.html">dive into the examples</a>.</p>
<p>OSGi is a dynamic module system for Java. <a href="http://en.wikipedia.org/wiki/Osgi">Wikipedia entry for OSGi</a> is naturally a good place to start. Then <a href="http://www.osgi.org/About/Technology">tech overview at OSGi.org</a>. Also <a href="http://www.manning.com/hall/">OSGi in Action</a> is a great book to dive into. Although I&#8217;m still in early chapters, looks to be a great treatment of the subject.</p>
<p>If you&#8217;re just trying to find a means to and end, then of course you don&#8217;t need to dive into the gory details. If you&#8217;re trying to hack around existing code, then, look at MANIFEST.MF for the Activator class. If your bundles are written as OSGi declarative services, then your implementation classes are specified in OSGI-INF/serviceComponents.xml file. This happens to be how WSO2 Carbon components are structured. Once you find where execution begins for a bundle it&#8217;s easy to follow along what&#8217;s happening. More on that later.</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/702/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Not being up-to-date on the Internet</title>
		<link>http://engwar.com/post/721?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=not-being-up-to-date-on-the-internet</link>
		<comments>http://engwar.com/post/721#comments</comments>
		<pubDate>Wed, 29 Feb 2012 02:00:28 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[ms live spaces]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=721</guid>
		<description><![CDATA[Staying up-to-date on Internet of things is a daunting task. Come to think of it now, I haven&#8217;t really missed much. Or may be I have on certain things. I said goodbye to RSS readers nearly 4 years ago. I &#8230; <a href="http://engwar.com/post/721">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Staying up-to-date on Internet of things is a daunting task. Come to think of it now, I haven&#8217;t really missed much. Or may be I have on certain things. I said goodbye to RSS readers nearly 4 years ago. I did that after reading a <a href="https://gist.github.com/6443">post by Chris Wanstrath</a>. I tuned into Twitter instead as my primary news source. If it&#8217;s worthy of attention people will tweet it. I haven&#8217;t really missed much on major news bulletins. It&#8217;s useful to stay up-to-date on the field you&#8217;re interested in, trends of the industry etc&#8230; With so many sources of information this will soon become a major time sink. When you go beyond 1000 feeds it&#8217;s really hard to read all of them.</p>
<p>I was looking for one of my old blogs today (you know, the things that you write when you&#8217;re young and naive) and found out that <a href="http://en.blog.wordpress.com/2010/09/27/welcome-windows-live-spaces-bloggers/">Microsoft Live Spaces is no more</a>. In fact they&#8217;re redirecting to WordPress! Ballsy move M$!</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/721/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trying to be a gym buff</title>
		<link>http://engwar.com/post/705?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=trying-to-be-a-gym-buff</link>
		<comments>http://engwar.com/post/705#comments</comments>
		<pubDate>Tue, 28 Feb 2012 18:19:45 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[exercise]]></category>
		<category><![CDATA[gym]]></category>
		<category><![CDATA[staying healthy]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=705</guid>
		<description><![CDATA[Couple of years ago on one gloomy Sunday afternoon, earth was about to get a massive down pour. Signs were all clear. Slight drizzle, turn-on-your-headlights-dark and dark cloud cover visible through thundering. With a massive thundering strike it dawned on &#8230; <a href="http://engwar.com/post/705">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Couple of years ago on one gloomy Sunday afternoon, earth was about to get a massive down pour. Signs were all clear. Slight drizzle, turn-on-your-headlights-dark and dark cloud cover visible through thundering. With a massive thundering strike it dawned on to me. That. I. Need. Exercise. It was either that or have to control my daily calorie intake. You know, for those of us (unfortunate?) folks sitting in front of a computer the good part of the day isn&#8217;t what our bodies would want. Apparently. So, I was all game for doing diet control. </p>
<p>This was tough. Couple of friends were following the <a href="http://www.iimahd.ernet.in/~jajoo/gmdiet.html">GM Diet</a> to the letter. This looked ridiculously hard I didn&#8217;t even bother. When you&#8217;re used to eat a certain sized portion and when you start eating less you naturally feel hungry. When you&#8217;re at it for a couple of days then you run the risk of death by starvation. You food lovers know what I mean! Thousand different reasons cross your mind, &#8220;will I faint?&#8221;, &#8220;am I going to die?!&#8221;, &#8220;is this what dying feels like?&#8221;, &#8220;I should eat, NO! I&#8217;m on a diet&#8221; and so on. It was all too depressing to be around food and not eat the damn thing.</p>
<p>So the next option is to workout. This is relatively easy the first couple of days. So at first I started running followed by a few exercise routines. Running is great but when the weather is bad and when you have to stay indoors for couple of days then it became hard to go back to the routine. Felt lazy and &#8220;well .. not today, may be tomorrow&#8221; sorta thing where tomorrow never happened.</p>
<p>Next option was to try a gym routine. This is good in many fronts. Now you can eat all you want and burn all the fat! Bad weather, no problem. Again getting into a regular schedule was hard. After about 6 months of irregular gym use there was no real improvement. Spending couple of hours twice a week at the gym gives you that warm feeling of &#8220;I&#8217;m going to the gym so I must be healthy&#8221;, but no measurable results. So any routine should be regular and consistent. Regular usually means daily unless may be you&#8217;re into power lifting. Simple act of walking for half an hour a day also yield many benefits as the following video shows,</p>
<p><iframe width="560" height="315" src="http://www.youtube.com/embed/aUaInS6HIGo" frameborder="0" allowfullscreen></iframe></p>
<p>When you&#8217;re at a gym there are many things you can try to complement walking. For couple of days I tried a <a href="http://en.wikipedia.org/wiki/High-intensity_interval_training">HIIT</a> routine which involved one minute of fast running followed by a four minute walk for 20 minutes. I quickly lost interest &#8216;cos it was too hard. I should&#8217;ve started with a lower intensity. </p>
<p>Later this turned out to be one day all cardio and next day cardio + circuit training. This routine has worked ok and I found that I could stick to this. Now I&#8217;ve been at this stint a little over thirty days. When you&#8217;re doing a particular routine regularly I&#8217;m finding it&#8217;s easy to ramp up the intensity. It doesn&#8217;t get too hard too early and not that easy also. Once you find this balance then gradually moving to bigger and heavier things becomes relatively easy. Now where is that six pack? (pun intended!)</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/705/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Insightful analysis of the financial debacle</title>
		<link>http://engwar.com/post/693?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=insightful-analysis-of-the-financial-debacle</link>
		<comments>http://engwar.com/post/693#comments</comments>
		<pubDate>Thu, 23 Feb 2012 05:20:48 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[financial crisis]]></category>
		<category><![CDATA[politics]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=693</guid>
		<description><![CDATA[I have read a bunch of articles about the financial crisis happened a few years back. Never came across such a brilliant write up than The Quiet Coup by Simon Johnson. Typically, these countries are in a desperate economic situation &#8230; <a href="http://engwar.com/post/693">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have read a bunch of articles about the financial crisis happened a few years back. Never came across such a brilliant write up than <a href="http://www.theatlantic.com/magazine/archive/2009/05/the-quiet-coup/7364/1/?single_page=true">The Quiet Coup</a> by <a href="http://en.wikipedia.org/wiki/Simon_Johnson_%28economist%29">Simon Johnson</a>.</p>
<blockquote><p>
Typically, these countries are in a desperate economic situation for one simple reason—the powerful elites within them overreached in good times and took too many risks. Emerging-market governments and their private-sector allies commonly form a tight-knit—and, most of the time, genteel—oligarchy, running the country rather like a profit-seeking company in which they are the controlling shareholders.
</p></blockquote>
<p>Later on Simon writes,</p>
<blockquote><p>
Squeezing the oligarchs, though, is seldom the strategy of choice among emerging-market governments. Quite the contrary: at the outset of the crisis, the oligarchs are usually among the first to get extra help from the government, such as preferential access to foreign currency, or maybe a nice tax break, or—here’s a classic Kremlin bailout technique—the assumption of private debt obligations by the government. Under duress, generosity toward old friends takes many innovative forms. Meanwhile, needing to squeeze someone, most emerging-market governments look first to ordinary working folk—at least until the riots grow too large.
</p></blockquote>
<p>Who said running a country is so hard?!</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/693/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running a Java process as a service</title>
		<link>http://engwar.com/post/678?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=running-a-java-process-as-a-service</link>
		<comments>http://engwar.com/post/678#comments</comments>
		<pubDate>Wed, 15 Feb 2012 11:44:06 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[carbon]]></category>
		<category><![CDATA[wso2]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=678</guid>
		<description><![CDATA[There are many open source projects out there that&#8217;s using Java Service Wrapper to run a process as a Windows service and as a daemon process in Linux. To make money of the excellent project they decided to screw everyone &#8230; <a href="http://engwar.com/post/678">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There are many open source projects out there that&#8217;s using <a href="http://wrapper.tanukisoftware.com/doc/english/download.jsp">Java Service Wrapper</a> to run a process as a Windows service and as a daemon process in Linux. To make money of the excellent project they decided to screw everyone over and change to an <a href="http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html">atrocious licensing scheme</a>. The crippled down community edition now doesn&#8217;t support 64bit Windows. Probably many other such nonsensical terms.</p>
<p>So, if you&#8217;re looking for alternatives there are several other nice projects out there. <a href="http://yajsw.sourceforge.net/">YAJSW</a> is super easy to configure and use no native code.</p>
<p>You can generate a config file from a running Java process by giving the process ID. Found that it&#8217;s easy to start from here and then tweak the system paths according to your setup.</p>
<p>Following wrapper.conf file can be used to start any <a href="http://wso2.com/products/carbon/">WSO2 Carbon</a> product as a service in Windows. In the following configuration I&#8217;ve hard coded the working dir but that can easily be set to take from an environment variable just like the JVM path. I&#8217;ve removed comments from wrapper.conf for brevity.</p>
<pre>
wrapper.working.dir=C:\\test\\wso2greg-4.1.1

wrapper.java.app.mainclass= org.wso2.carbon.bootstrap.Bootstrap

wrapper.console.loglevel=INFO

wrapper.console.title="WSO2 G-Reg"

wrapper.ntservice.name="WSO2GREG"

wrapper.ntservice.displayname="WSO2 GREG"

wrapper.ntservice.description="Governance Registry"

wrapper.daemon.run_level_dir=${if (new File('\/etc\/rc0.d').exists()) return '\/etc\/rcX.d' else return '\/etc\/init.d\/rcX.d'}

wrapper.tray = true

wrapper.tray.port = 15002

wrapper.on_exit.0=SHUTDOWN
wrapper.on_exit.default=RESTART

wrapper.filter.trigger.0=Exception
wrapper.filter.script.0=scripts\/trayMessage.gv
wrapper.filter.script.0.args=Exception

placeHolderSoGenPropsComeHere=
wrapper.java.command = ${JAVA_HOME}\\bin\\java
wrapper.java.classpath.1 = .\\lib
wrapper.java.classpath.2 = ${JAVA_HOME}\\lib\\tools.jar
wrapper.java.classpath.3 = .\\bin\\org.wso2.carbon.bootstrap-3.2.2.jar
wrapper.java.classpath.4 = .\\lib\\endorsed
wrapper.app.parameter.1 = RUN
wrapper.app.parameter.2 = -Dcarbon.registry.root=\/
wrapper.app.parameter.3 = -Dcarbon.home=c:\\test\\wso2greg-4.1.1
wrapper.app.parameter.4 = -Dwso2.server.standalone=true
wrapper.app.parameter.5 = -Djava.command=${JAVA_HOME}\\bin\\java
wrapper.app.parameter.8 = -Dcarbon.xbootclasspath=;.\\lib\\xboot\\org.wso2.carbon.xboot-3.2.0.jar
wrapper.app.parameter.9 = -Djava.io.tmpdir=.\\bin\\..\\tmp
wrapper.app.parameter.10 = -Dwso2.carbon.xml=.\\bin\\..\\repository\\conf\\carbon.xml
wrapper.app.parameter.11 = -Dwso2.registry.xml=.\\bin\\..\\repository\\conf\\registry.xml
wrapper.app.parameter.12 = -Dwso2.user.mgt.xml=.\\bin\\..\\repository\\conf\\user-mgt.xml
wrapper.app.parameter.13 = -Dwso2.transports.xml=.\\bin\\..\\repository\\conf\\mgt-transports.xml
wrapper.app.parameter.14 = -Djava.util.logging.config.file=.\\bin\\..\\lib\\log4j.properties
wrapper.app.parameter.15 = -Dcarbon.config.dir.path=.\\bin\\..\\repository\\conf
wrapper.app.parameter.16 = -Dcarbon.logs.path=.\\bin\\..\\repository\\logs
wrapper.app.parameter.17 = -Dcomponents.repo=.\\bin\\..\\repository\\components
wrapper.app.parameter.18 = -Dcom.atomikos.icatch.file=.\\bin\\..\\lib\\transactions.properties
wrapper.app.parameter.19 = -Dcom.atomikos.icatch.hide_init_file_path=true
wrapper.app.parameter.20 = -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true
wrapper.app.parameter.21 = -Dcom.sun.jndi.ldap.connect.pool.authentication=simple
wrapper.app.parameter.22 = -Dcom.sun.jndi.ldap.connect.pool.timeout=3000
wrapper.app.parameter.23 = -Dcarbon.classpath=.\\lib;${JAVA_HOME}\\lib\\tools.jar;;.\\bin\\org.wso2.carbon.bootstrap-3.2.2.jar;
wrapper.java.additional.1 = -Xbootclasspath\/a:;.\\lib\\xboot\\org.wso2.carbon.xboot-3.2.0.jar
wrapper.java.additional.2 = -Xms256m
wrapper.java.additional.3 = -Xmx512m
wrapper.java.additional.4 = -XX:MaxPermSize=256m
wrapper.java.additional.5 = -Dimpl.prefix=Carbon
wrapper.java.additional.6 = -Dcom.sun.management.jmxremote
wrapper.java.additional.7 = -Djava.endorsed.dirs=.\\lib\\endorsed;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/678/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Cassandra write performance</title>
		<link>http://engwar.com/post/656?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=testing-cassandra-write-performance</link>
		<comments>http://engwar.com/post/656#comments</comments>
		<pubDate>Wed, 30 Nov 2011 13:28:16 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[cassandra]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=656</guid>
		<description><![CDATA[With below tests I was trying to measure Cassandra write performance. First off this is probably not a good performance comparison for a number of reasons. Main one being I was running this on my laptop. If you ran this &#8230; <a href="http://engwar.com/post/656">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With below tests I was trying to measure Cassandra write performance. First off this is probably not a good performance comparison for a number of reasons. Main one being I was running this on my laptop. If you ran this on server grade hardware with a tuned Cassandra setup you probably would get higher numbers. That being said, this was done to get a general idea about write performance in Cassandra &#8216;cos &#8220;You can&#8217;t do much without measuring&#8221;.</p>
<p>My setup was,</p>
<ul>
<li>Cassandra running in a VirtualBox VM with default parameters. Only the data directories were changed</li>
<li>VM was running Kubuntu 11.04</li>
<li>JDK 1.6.0_27</li>
<li>JVM was not warmed up before carrying out the test. I started Cassandra with an empty keyspace for each case</li>
<li>I was <a href="https://svn.wso2.org/repos/wso2/scratch/cassandraBackedRegistry">testing the code hosted here</a></li>
</ul>
<p>Here&#8217;s how the three column families look like.</p>
<p>REGData column family,</p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/regdata-CF.png"><img src="http://engwar.com/wp-content/uploads/2011/11/regdata-CF.png" alt="" title="regdata-CF" width="640" height="383" class="aligncenter size-full wp-image-658" /></a></p>
<p>PropertyIndex column family,</p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/propertyindex-CF.png"><img src="http://engwar.com/wp-content/uploads/2011/11/propertyindex-CF.png" alt="" title="propertyindex-CF" width="640" height="223" class="aligncenter size-full wp-image-659" /></a></p>
<p>TagIndex column family,</p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/tagindex-CF.png"><img src="http://engwar.com/wp-content/uploads/2011/11/tagindex-CF.png" alt="" title="tagindex-CF" width="640" height="232" class="aligncenter size-full wp-image-660" /></a></p>
<p>Here are the results,</p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/cassandra-0-8-6.png"><img src="http://engwar.com/wp-content/uploads/2011/11/cassandra-0-8-6.png" alt="" title="cassandra-0-8-6" width="559" height="359" class="aligncenter size-full wp-image-669" /></a></p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/cassandra-1.0.2.png"><img src="http://engwar.com/wp-content/uploads/2011/11/cassandra-1.0.2.png" alt="" title="cassandra-1.0.2" width="562" height="355" class="aligncenter size-full wp-image-670" /></a></p>
<p>The graphs looks very similar. However Cassandra 1.0.2 is has faster write speeds. Here are the raw data. T in the graph represent number of tags and P number of properties.</p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/cassandra-0-8-6-data.png"><img src="http://engwar.com/wp-content/uploads/2011/11/cassandra-0-8-6-data.png" alt="" title="cassandra-0-8-6-data" width="561" height="390" class="aligncenter size-full wp-image-671" /></a></p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/cassandra-1-0-2-data.png"><img src="http://engwar.com/wp-content/uploads/2011/11/cassandra-1-0-2-data.png" alt="" title="cassandra-1-0-2-data" width="562" height="390" class="aligncenter size-full wp-image-672" /></a></p>
<p>Sudden spike in write speed increase is a bit scary. That can be due to I/O bottleneck in the machine. At that point my disk started grinding heavily. During the time of the tests, I didn&#8217;t do any other disk intensive tasks. On server grade hardware with a few fast disks results might be different. Radically even.</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/656/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating a signed message with .Net WCF</title>
		<link>http://engwar.com/post/636?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-a-signed-message-with-net-wcf</link>
		<comments>http://engwar.com/post/636#comments</comments>
		<pubDate>Sun, 13 Nov 2011 02:59:13 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[wcf]]></category>
		<category><![CDATA[ws-security]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=636</guid>
		<description><![CDATA[A step by step guide to create a signed message with .Net WCF and consume a service secured service written in Java. Service can be implemented in any language as long as it support standard WS-Security standards. In order to &#8230; <a href="http://engwar.com/post/636">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A step by step guide to create a signed message with .Net WCF and consume a service secured service written in Java. Service can be implemented in any language as long as it support standard WS-Security standards. In order to have a service running in minutes and applying security I&#8217;ll be using <a href="http://wso2.com/products/enterprise-service-bus/">WSO2 ESB</a>.</p>
<ol>
<li>Certificates. We&#8217;ll be using two certificates for signing. We&#8217;ll create a private/public keypair in the client side and import the client&#8217;s public key to server. Likewise, we&#8217;ll import server&#8217;s public key to the machine running the client.</li>
<li>First let&#8217;s create a key pair to be used in the client,
<pre>
makecert -r -pe -n "CN=mycert" -sky exchange -sv mycert.pvk mycert.cer
</pre>
<p>This will create a private and public key pair. Next we need to import this into Windows certificate store. In order to do that we need to convert our key pair to PFX format which includes both the private and the public key,</p>
<pre>
pvk2pfx -pvk mycert.pvk -spc mycert.cer -pfx mycert.pfx
</pre>
<p>Now, run mmc and add a certificate snap-in for the Local Computer. Browse into Trusted People and import mycert.pfx. Just click next when it asks for the private key password.
</li>
<li>We have set the certificates for the client. Next we have to extract server&#8217;s public key and import it into Windows certificate store. Since I&#8217;m going to use WSO2 ESB for the server side, we need to extract the public key from the Java keystore that&#8217;s being used by the ESB. Browse to &lt;ESB HOME&gt;\repository\resources\security and give the following command. Java needs to be in your PATH. When prompted type &#8220;wso2carbon&#8221; as the keystore password.
<pre>
keytool -keystore wso2carbon.jks -export -alias localhost -file localhost.cer
</pre>
<p>Import localhost.cer into Trusted People just like before.
</li>
<li>Now we need to import the client&#8217;s public key to the server. Start the ESB by double clicking wso2server.bat. Browse into https://localhost:9443 and login with admin/admin. Click Configure -&gt; Key Stores.
<p><a href="http://engwar.com/wp-content/uploads/2011/11/select-keystore.png"><img src="http://engwar.com/wp-content/uploads/2011/11/select-keystore.png" alt="" title="select-keystore" width="243" height="340" class="aligncenter size-full wp-image-639" /></a></p>
<p> Click Import Cert</p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/import-cert.png"><img src="http://engwar.com/wp-content/uploads/2011/11/import-cert.png" alt="" title="import-cert" width="242" height="55" class="aligncenter size-full wp-image-640" /></a></p>
<p> and browse and select mycert.cer we just created and click Import.</p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/browse-cert-and-import.png"><img src="http://engwar.com/wp-content/uploads/2011/11/browse-cert-and-import.png" alt="" title="browse-cert-and-import" width="512" height="115" class="aligncenter size-full wp-image-641" /></a></p>
</li>
<li>We&#8217;re done setting up certificates. Let&#8217;s create a simple secure service. Luckily ESB ships an echo service which when you send a message, echoes it back. Click Main -&gt; List (under Web Services).
<p><a href="http://engwar.com/wp-content/uploads/2011/11/select-list-ws.png"><img src="http://engwar.com/wp-content/uploads/2011/11/select-list-ws.png" alt="" title="select-list-ws" width="244" height="264" class="aligncenter size-full wp-image-642" /></a></p>
<p>Here you see a list of web services. In front of the echo service you&#8217;ll see a link saying &#8220;Unsecured&#8221;. </p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/unsecured-echo.png"><img src="http://engwar.com/wp-content/uploads/2011/11/unsecured-echo.png" alt="" title="unsecured-echo" width="518" height="54" class="aligncenter size-full wp-image-643" /></a></p>
<p>Click it and select &#8220;yes&#8221; from the drop down to apply security for the echo service.</p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/enable-security.png"><img src="http://engwar.com/wp-content/uploads/2011/11/enable-security.png" alt="" title="enable-security" width="214" height="67" class="aligncenter size-full wp-image-644" /></a></p>
<p>Here you&#8217;ll see a list of pre-configured security scenarios. We&#8217;ll be using number 2, Non-Repudiation under Basic Scenarios. Select it and click Next.</p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/select-non-repudiation.png"><img src="http://engwar.com/wp-content/uploads/2011/11/select-non-repudiation.png" alt="" title="select-non-repudiation" width="229" height="136" class="aligncenter size-full wp-image-645" /></a></p>
<p>Select wso2carbon.jks as a trusted keystore and click Finish. Echo service is secured now.</p>
<p><a href="http://engwar.com/wp-content/uploads/2011/11/select-trusted-keystore.png"><img src="http://engwar.com/wp-content/uploads/2011/11/select-trusted-keystore.png" alt="" title="select-trusted-keystore" width="166" height="186" class="aligncenter size-full wp-image-646" /></a>
</li>
<li>We created and setup certificates and now have a secured service. Open up Visual Studio and create a new console application. You can create any kind of project but I&#8217;d prefer to create console apps for testing these type of scenarios.</li>
<li>Add a Service Reference to your project. WSDL file for the service is located at http://localhost:8280/services/echo?wsdl</li>
<li>For the binding that you&#8217;ll be using you have to configure security,
<pre class="prettyprint ">
&lt;security defaultAlgorithmSuite=&quot;Default&quot; authenticationMode=&quot;MutualCertificateDuplex&quot;
    requireDerivedKeys=&quot;false&quot; securityHeaderLayout=&quot;Lax&quot; includeTimestamp=&quot;true&quot;
    keyEntropyMode=&quot;CombinedEntropy&quot; messageProtectionOrder=&quot;SignBeforeEncrypt&quot;
    messageSecurityVersion=&quot;Default&quot; requireSignatureConfirmation=&quot;false&quot;&gt;
&lt;localClientSettings cacheCookies=&quot;true&quot; detectReplays=&quot;true&quot;
    replayCacheSize=&quot;900000&quot; maxClockSkew=&quot;00:05:00&quot; maxCookieCachingTime=&quot;Infinite&quot;
    replayWindow=&quot;00:05:00&quot; sessionKeyRenewalInterval=&quot;10:00:00&quot;
    sessionKeyRolloverInterval=&quot;00:05:00&quot; reconnectTransportOnFailure=&quot;true&quot;
    timestampValidityDuration=&quot;00:05:00&quot; cookieRenewalThresholdPercentage=&quot;60&quot; /&gt;
&lt;localServiceSettings detectReplays=&quot;true&quot; issuedCookieLifetime=&quot;10:00:00&quot;
    maxStatefulNegotiations=&quot;128&quot; replayCacheSize=&quot;900000&quot; maxClockSkew=&quot;00:05:00&quot;
    negotiationTimeout=&quot;00:01:00&quot; replayWindow=&quot;00:05:00&quot; inactivityTimeout=&quot;00:02:00&quot;
    sessionKeyRenewalInterval=&quot;15:00:00&quot; sessionKeyRolloverInterval=&quot;00:05:00&quot;
    reconnectTransportOnFailure=&quot;true&quot; maxPendingSessions=&quot;128&quot;
    maxCachedCookies=&quot;1000&quot; timestampValidityDuration=&quot;00:05:00&quot; /&gt;
&lt;secureConversationBootstrap /&gt;
&lt;/security&gt;
</pre>
</li>
<li>Your actual service should looks like this,
<pre class="prettyprint ">
static void Main(string[] args)
{
    svc.echoPortTypeClient echo = new svc.echoPortTypeClient(&quot;echoHttpSoap11Endpoint&quot;);

    echo.ClientCredentials.ServiceCertificate.SetDefaultCertificate(
       System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine,
       System.Security.Cryptography.X509Certificates.StoreName.TrustedPeople,
       System.Security.Cryptography.X509Certificates.X509FindType.FindBySubjectName, &quot;localhost&quot;);

    echo.ClientCredentials.ClientCertificate.SetCertificate(
        System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine,
        System.Security.Cryptography.X509Certificates.StoreName.TrustedPeople,
        System.Security.Cryptography.X509Certificates.X509FindType.FindBySubjectName, &quot;mycert&quot;);

    System.Console.WriteLine(echo.echoString(&quot;hello&quot;));
    System.Console.ReadLine();
}
</pre>
<p>Note that we set the correct service and client certificates. As you can see I&#8217;m using an HTTP endpoint. This is useful to test the messages going through a tool like <a href="http://ws.apache.org/commons/tcpmon/">TCPMon</a>. When you have the scenario working you can just switch to the HTTPS endpoint.
</li>
</ol>
<p>Useful references,</p>
<ul>
<li>Various ways to create private/public keypairs &#8211; <a href="http://code.google.com/apis/apps/articles/sso-keygen.html">http://code.google.com/apis/apps/articles/sso-keygen.html</a></li>
<li>Makecert reference &#8211; <a href="http://msdn.microsoft.com/en-us/library/bfsktky3%28v=VS.100%29.aspx">http://msdn.microsoft.com/en-us/library/bfsktky3%28v=VS.100%29.aspx</a></li>
<li>SecurityBindingElement Authentication Modes &#8211; <a href="http://msdn.microsoft.com/en-us/library/aa751836.aspx">http://msdn.microsoft.com/en-us/library/aa751836.aspx</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/636/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java PaaS : Building multitenant applications</title>
		<link>http://engwar.com/post/617?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=java-paas-building-multitenant-applications</link>
		<comments>http://engwar.com/post/617#comments</comments>
		<pubDate>Tue, 13 Sep 2011 00:06:40 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[cloud]]></category>
		<category><![CDATA[cloud apps]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[paas]]></category>
		<category><![CDATA[stratos]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=617</guid>
		<description><![CDATA[This shows you how to write multitenant applications. If you haven&#8217;t already, please read the following two posts before you read this. Those two sets the stage for the rest of this post. Java Paas : Building your first app &#8230; <a href="http://engwar.com/post/617">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This shows you how to write multitenant applications. If you haven&#8217;t already, please read the following two posts before you read this. Those two sets the stage for the rest of this post.</p>
<ol>
<li><a href="http://engwar.com/post/570">Java Paas : Building your first app</a></li>
<li><a href="http://engwar.com/post/578">Java PaaS : Handling authentication in your web apps</a></li>
</ol>
<p>Before proceeding further let me clarify some terms that we&#8217;ll be using . It has become a bit cloudy (no pun intended) since many people mean different things for the same word.</p>
<p>Multitenancy &#8211; In the context of Stratos, I&#8217;m using the word multitenancy to mean as <a href="http://en.wikipedia.org/wiki/Multitenancy">defined in Wikipedia</a>.</p>
<blockquote><p>Multitenancy refers to a principle in software architecture where a single instance of the software runs on a server, serving multiple client organizations (tenants).</p></blockquote>
<p>When you register and get an account in Stratos, that&#8217;s a tenant. An organization. Your data will be isolated from other tenants/organizations in the system. When you sign up, you&#8217;ll be creating the administrator account for your tenant. Which we naturally refer to as the tenant admin. Tenant admin can add users to your domain, turn off/on various Stratos services such as the ESB, App Server, Data Services Server etc&#8230; Monitor data and bandwidth usage of your users, grant/revoke permissions to users.</p>
<p>Let&#8217;s me take a little step back here. When you talk about Stratos, there are two major deployment scenarios. One that&#8217;s hosted by WSO2. That&#8217;s available to users as a service, you sign up, you get an account, your data is hosted on hardware that we manage. This version is called <a href="http://stratoslive.wso2.com">StratosLive</a>. Other scenario, you setup Stratos on your hardware in your private data center, you control everything it&#8217;s not accessible to anyone else.</p>
<p>2 scenarios. StratosLive vs Stratos on your private cloud.</p>
<p>Now, coming back to multitenancy, there&#8217;s one user we called the <em>super tenant</em>. This acts as an admin account for all the tenants in Stratos.  It&#8217;s configured at the time of setting up Stratos. In StratosLive scenario, super tenant is WSO2. In the other scenario, super tenant is you. You can do stuff which will affect to all the tenants across the system. Why would you need this? It&#8217;s necessary when you&#8217;re developing SaaS applications. You&#8217;re providing a service which all the tenants can use.</p>
<p>In Stratos, to make your applications SaaSify you need to add a context parameter to your deployment descriptor.</p>
<pre class="prettyprint ">
&lt;context-param&gt;
    &lt;param-name&gt;carbon.enable.saas&lt;/param-name&gt;
    &lt;param-value&gt;true&lt;/param-value&gt;
&lt;/context-param&gt;
</pre>
<p>Authentication mechanism will be the standard form based authentication that we configured in the <a href="http://engwar.com/post/570">Jwitter app we developed earlier</a>. This however, does not mean that this is the only thing that you need to build SaaS applications, nor does it allow you to take any existing web app out their and magically turn it to a multitenanted app. For that you need to have a <a href="http://msdn.microsoft.com/en-us/library/aa479086.aspx">multitenant data architecture for you application</a>.</p>
<p>When you add the context parameter and deploy the web application as the super tenant, Stratos will authenticate against any user account in the system that has sufficient permissions. When you call <code>request.getPrincipal().getName()</code>, user account will appear in the format foo@example.com. From this point on it&#8217;s upto you to move to the bits of your application.</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/617/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Private cloud and importance of OpenStack</title>
		<link>http://engwar.com/post/613?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=private-cloud-and-importance-of-openstack</link>
		<comments>http://engwar.com/post/613#comments</comments>
		<pubDate>Mon, 12 Sep 2011 04:03:12 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[amazon]]></category>
		<category><![CDATA[openstack]]></category>
		<category><![CDATA[private cloud]]></category>
		<category><![CDATA[stratos]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=613</guid>
		<description><![CDATA[On my last post, I mentioned that it&#8217;s getting more important having a solid open source private cloud solution. Without a doubt OpenStack is getting very good traction from the community, which is a good thing. As it turns out, &#8230; <a href="http://engwar.com/post/613">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://engwar.com/post/607">On my last post</a>, I mentioned that it&#8217;s getting more important having a solid open source private cloud solution. Without a doubt OpenStack is getting very good traction from the community, which is a good thing. As it turns out, for WSO2 Stratos (open source middleware platform as a service for enterprise) a private cloud is a very important part. Specially when most popular public cloud offering, Amazon EC2 is having so many issues.</p>
<p>In WSO2 data center, we run the entire platform on UEC which ships Eucalyptus and we haven&#8217;t seen any of the problems we faced with EC2. Ok, private cloud &#8211; very important.</p>
<p>As a platform as a service, it&#8217;s important to be able to run on top of many IaaS vendors. Same goes for private cloud solutions. So, if Stratos is to be run on OpenStack the auto scaling code should be working. Stratos auto scales on Amazon EC2 that&#8217;s the API that&#8217;s been implemented. It&#8217;s always a pain to support a different API. OpenStack is said to have an EC2 SOAP API but I couldn&#8217;t find the extent to which operations are supported. I&#8217;ll definitely have a definitive answer if I contact one of the devs. This post however was not about that.</p>
<p><a href="http://www.markshuttleworth.com/archives/765">Mark Shuttleworth wrote an excellent blog about some concerns over OpenStack</a>. As Mark correctly observes, it&#8217;s not the right thing to innovate at the API level. As eternal perfectionists it&#8217;s very easy to get into having cleaner and powerful APIs. Then again from a pragmatic perspective it&#8217;s energy that&#8217;s better put into where it matters.</p>
<p>WSO2 Stratos already have a working implementation that is tested. Effort of implementing and testing for another API is going to be time consuming. Whether it&#8217;s a bad or a good API when we have to get it running we&#8217;ll implement it nevertheless.</p>
<p>There are many concerns that needs more attention than having a good API. Higher IO and network throughput comes to the top of the list &#8216;cos that&#8217;s what it matters from a user&#8217;s perspective. It&#8217;s great that people debating this issue and looking to make a difference!</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/613/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Amazon EC2 woes</title>
		<link>http://engwar.com/post/607?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=amazon-ec2-woes</link>
		<comments>http://engwar.com/post/607#comments</comments>
		<pubDate>Sun, 11 Sep 2011 02:10:30 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[amazon]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[iaas]]></category>
		<category><![CDATA[private cloud]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=607</guid>
		<description><![CDATA[Samisa has written a great blog about instability and unpredictability of Amazon EC2 when we ran WSO2 Stratos on it for months. Also, Azeez shares his views which is similar. As a result of Amazon EC2 issues, mainly relating to &#8230; <a href="http://engwar.com/post/607">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://samisa-abeysinghe.blogspot.com/2011/09/cloud-computing-facts-iaas-is-not-prime.html">Samisa has written a great blog about instability and unpredictability of Amazon EC2</a> when we ran WSO2 Stratos on it for months. Also, <a href="http://blog.afkham.org/2011/09/is-paas-on-top-of-iaas-good-idea-after.html">Azeez shares his views which is similar</a>.</p>
<p>As a result of Amazon EC2 issues, mainly relating to unacceptable I/O and network delays hosted version of <a href="http://wso2.com/cloud/stratos/">Stratos</a> which we call <a href="http://stratoslive.wso2.com">StratosLive</a> was so damn slow. Now it&#8217;s hosted on real hardware and the site is way way faster!</p>
<p>In the long run, enterprise-wide software are better off running on real hardware. Investing in more powerful machines. Or horizontally scale with a number of cheap machines. I can see Amazon&#8217;s appeal for a very short term computing problems. Or as Azeez mentioned, cloud bursting for one. <a href="http://open.blogs.nytimes.com/2007/11/01/self-service-prorated-super-computing-fun/">Problems like this infamous article about Amazon EC2 trying to solve</a>. Value you gain for paying exuberant bills for Amazon EC2 is very little at the end of the month. Specially when you&#8217;re running it long term.</p>
<p>IMO, this is one reason why a reliable private cloud infrastructure matters. In my experience open source private cloud software has a lot to improve. The free stuff by VMware is good for playing around. When you need I/O and network performance + provisioning, you have to pay big bucks.</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/607/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

