<?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>Xebia Blog &#187; Sunil Prakash Inteti</title>
	<atom:link href="http://blog.xebia.com/author/sunilinteti/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xebia.com</link>
	<description>Software development done right!</description>
	<lastBuildDate>Wed, 01 Feb 2012 00:30:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Setting session bean property in SeamTest</title>
		<link>http://blog.xebia.com/2009/04/17/setting-session-bean-property-in-seamtest/</link>
		<comments>http://blog.xebia.com/2009/04/17/setting-session-bean-property-in-seamtest/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 13:26:35 +0000</pubDate>
		<dc:creator>Sunil Prakash Inteti</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/blog.xebia.com/www/wp-content/plugins/autometa/autometa.php</b> on line <b>303</b><br />
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Seam]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=1147</guid>
		<description><![CDATA[SeamTest is a class we extend for the tests we write in our Seam application. It provides the seam environment in tests something analogous to WicketTester in Wicket Application. I want to share some information on setting the property of Session bean, i came to know while using the SeamTest. Let us look at the [...]]]></description>
			<content:encoded><![CDATA[<p>SeamTest is a class we extend for the tests we write in our Seam application. It provides the seam environment in tests something analogous to WicketTester in Wicket Application.<br />
I want to share some information on setting the property of Session bean, i came to know while using the SeamTest.<br />
<span id="more-1147"></span></p>
<p>Let us look at the following code.</p>
<pre lang="java">@Stateless
@Scope(ScopeType.SESSION)
@Name("Something")
public class SomethingBean implements Something {
	@Logger
	private Log log;
	@In
	StatusMessages statusMessages;
	@In
	User user;
	@In
	public String test;
	@Out
	boolean invoked = false;
	@Out
	String userName = "No name";
	public String something() {
		log.info("Something.something() action called");
		statusMessages.add("something");
		invoked = true;
		userName = user.getName();
		return test;
 	}
}</pre>
<p>And the testClass :</p>
<pre lang="java">public class SomethingTest extends SeamTest {
	@Test
	public void test_something() throws Exception {
		new FacesRequest() {
			@Override
			protected void invokeApplication() {
				setValue("#{user.name}", "user");
				setValue("#{Something.test}", "testValue");
		//		Contexts.getSessionContext().set("test", "testValue");
				Object result = invokeMethod("#{Something.something}");
				Object object = Contexts.getSessionContext().get("invoked");
				Assert.assertTrue((Boolean) object);
			        Assert.assertEquals(Contexts.getSessionContext().get("userName"), "user");
				Assert.assertEquals(result, "testValue");
			}
		}.run();
	}
}</pre>
<p>Using the setValue() method of the SeamTest, we can set the property on Entity bean User. BUT when I tried to use the SetValue() method to set the &#8216;test&#8217; property on &#8216;Something&#8217; (Session bean ) I get the following stack trace.</p>
<p><strong>java.lang.AssertionError: javax.el.PropertyNotFoundException: The class &#8216;org.javassist.tmp.java.lang.Object_$$_javassist_1&#8242; does not have the property &#8216;test&#8217;.<br />
	at org.jboss.seam.mock.AbstractSeamTest$Request.onException(AbstractSeamTest.java:455)<br />
</strong></p>
<p>Clearly Seam is trying to find the &#8216;test&#8217; property on some other class &#8220;org.javassist.tmp.java.lang.Object_$$_javassist_1&#8243;.<br />
This is the proxy class generated by Seam framework. The proxy class has the same interface as the the Session  bean &#8216;Something&#8217;. It  doesn&#8217;t have the property &#8216;test&#8217;, since the interface doesn&#8217;t declare the getter and setter.</p>
<p>The Entity bean &#8216;user&#8217; is handled differently by the Seam framework: No proxy is created, thus the property can be set using
<pre lang="java"> setValue("#{user.name}", "user"); </pre>
<p>So if in test we cannot set the property like this for session bean, how does Seam set this in production?</p>
<p>Seam looks for the @In property in the corresponding Context if the property is not not specified. and if it is there in the context, it is set.</p>
<p>The solution is to set the property value to corresponding Context.<br />
For example in your Seam Test you could use,
<pre lang="java">Contexts.getSessionContext().set("test", "testValue").</pre>
<p>The other option can be to have the getter and setter for the property in the @Local Interface implemented by the Session bean. This way the getter and setter of the property is there in the proxy class generated and we can use ,<br />
setValue(Something.test, &#8220;testValue&#8221;) to set the property from test. But this would break the injection of the property. The property wont be looked up in the context and we get the error &#8220;@In attribute requires non-null value: Something.test&#8221;</p>
<p>In some scenarios where property is not annotated with @In, then we can go for the previous option.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2009/04/17/setting-session-bean-property-in-seamtest/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2009%2F04%2F17%2Fsetting-session-bean-property-in-seamtest%2F&amp;title=Setting%20session%20bean%20property%20in%20SeamTest" id="wpa2a_2"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2009/04/17/setting-session-bean-property-in-seamtest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why and When to use Groovy</title>
		<link>http://blog.xebia.com/2009/01/02/why-and-when-to-use-groovy/</link>
		<comments>http://blog.xebia.com/2009/01/02/why-and-when-to-use-groovy/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 08:46:14 +0000</pubDate>
		<dc:creator>Sunil Prakash Inteti</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Groovy]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=862</guid>
		<description><![CDATA[I have just started learning Groovy few days back.The first thing that I have asked myself and searched for is &#8216;Why should i use groovy over java and When I can use Groovy. ?&#8217; I am following the book &#8216;Programming Groovy&#8217;. The things I have understood regarding &#8216;Why&#8217; part are Simplicity : Groovy syntax is [...]]]></description>
			<content:encoded><![CDATA[<p>I have just started learning Groovy few days back.The first thing that I have asked myself and searched for is &#8216;Why should i use groovy over java and When I can use Groovy. ?&#8217;</p>
<p>I am following the book &#8216;Programming Groovy&#8217;. The things I have understood regarding &#8216;Why&#8217; part are<br />
<span id="more-862"></span><br />
<strong>Simplicity </strong>: Groovy syntax is simple and easy. It saves a lot of code and effort thus increasing the productivity of developer if he had to do the same thing in Java.</p>
<p><strong>in Java </strong></p>
<p><code>for(int i = 0; i < 3; i++) {<br />
   System.out.println("United United..." )<br />
}</code></p>
<p><strong>in Groovy<br />
</strong></p>
<p><code>3.times {<br />
   println "United United..."<br />
 }</code></p>
<p>This is just a trivial example but there are lot more things like this.</p>
<p><strong>Groovy's Dynamicity </strong>: This is one reason why coding is made simpler and concepts like polymorphism and<br />
callback patterns are made easy to implement.</p>
<p><code>class Player  {<br />
	String name<br />
	int age<br />
}<br />
class Club {<br />
	String name<br />
	String city<br />
}<br />
public printNameOfTheFootballingEntity(entity) {<br />
	println "the entity with name "+ entity.name + " is related to Football"<br />
}</code></p>
<p><code>player = new Player(name:"Giggs", age:35)<br />
club = new Club(name:"ManchesterUnited", city:"Old Trafford")<br />
printNameOfTheFootballingEntity(player)<br />
printNameOfTheFootballingEntity(club)<br />
</code></p>
<p>Consider above code. It prints the following:</p>
<p><em>the entity with name Giggs is related to Football<br />
the entity with name ManchesterUnited is related to Football</em></p>
<p>If you observe there is no compile time check for the presence of the property "name" in the entity. While interpreting Groovy checks for this property and if it is not there it throws the Missing Property Exception. Dynamic!! ain't it? </p>
<p>In Groovy you dont need to end statement with semicolon.</p>
<p>Closures are the piece of code blocks contains some statements. They are like fucntion pointers in C. They are infact objects in groovy and can be passed to functions as arguemts as well. Closures can do the job of callbacks.</p>
<p>For Example </p>
<p><code>def  checkPlayer = {<br />
    println it  + " is a good Striker"<br />
}<br />
</code><br />
<code>list = ["Rooney", "Tevez" , "Berbatov" ]<br />
list.each(checkPlayer)</code></p>
<p>The above code prints the following</p>
<p><em>Rooney is a good Striker<br />
Tevez is a good Striker<br />
Berbatov is a good Striker</em></p>
<p>Here <strong>'it'</strong> represents the each single item in the list that is passed to the Closure 'checkPlayer'.</p>
<p>The code inside the braces is closure code acting like a callback for all the elements of the set.</p>
<p>The same thing in Java will be a bit more effort to code.</p>
<p>		<code>List<String> list = new ArrayList<String>();<br />
		list.add("Rooney");<br />
		list.add("Tevez");<br />
		list.add("Berbatov");<br />
</code><br />
		<code>for (String player : list) {<br />
			checkPlayer(player);<br />
		}<br />
		private void checkPlayer(String player) {<br />
			System.out.println(player + "is a good Striker");<br />
		}</code></p>
<p>The examples so far shows the ease with which things can be developed with little effort but ultimately have the same result because the groovy code is compiled to bytecode which JVM understands. This can make a developer more productive and it can give more agility.</p>
<p>Groovy accepts almost all Java programs as it can use the Java libraries and it even extends some core Java classes as well.</p>
<p>For example </p>
<p><code>list.join() </code></p>
<p>This prints 'RooneyTevezBerbatov'. Groovy has added the join() method on the 'List' of Java while retaining remaining methods.</p>
<p>All is well. These are some reasons which are good enough for any Java developer to explore Groovy. </p>
<p>Now the big Question arises 'When can I use Groovy over Java?' and 'What sort of applications are targeted?</p>
<p>I am at the moment stuck at this question. Honestly speaking i didn't get a sufficient answer . I think this 'When' question is really important especially if some thing is improved over some other thing and you are comparing both. </p>
<p>Groovy scripts are interpreted at runtime, this might cause some performance overhead, which is not all that bad. You can always compile it to java bytecode to remove that performance penalty.<br />
Other reasons may be revealed to myself after some more exposure, about what kind of applications can be created using Groovy. I will share it my next blog. But any suggestions and thoughts are always welcome!</p>
<p><strong>References:</strong><br />
'Programming Groovy' Book</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2009/01/02/why-and-when-to-use-groovy/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2009%2F01%2F02%2Fwhy-and-when-to-use-groovy%2F&amp;title=Why%20and%20When%20to%20use%20Groovy" id="wpa2a_4"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2009/01/02/why-and-when-to-use-groovy/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Great Indian Developer&#8217;s Summit</title>
		<link>http://blog.xebia.com/2008/05/28/great-indian-developers-summit/</link>
		<comments>http://blog.xebia.com/2008/05/28/great-indian-developers-summit/#comments</comments>
		<pubDate>Wed, 28 May 2008 04:37:47 +0000</pubDate>
		<dc:creator>Sunil Prakash Inteti</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/blog.xebia.com/www/wp-content/plugins/autometa/autometa.php</b> on line <b>303</b><br />
		<category><![CDATA[General]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=577</guid>
		<description><![CDATA[Great Indian Developers Summit was held from may 21-23 at Banglore, India Around 3,000 developers attended it. This is supposed to be the biggest developer&#8217;s summit so far in India. http://www.developersummit.com/ Climate was very good in Banglore despite the summers in India. Many reputed speakers around the world were there to give their presentations. It [...]]]></description>
			<content:encoded><![CDATA[<p>Great Indian Developers Summit was held from may 21-23 at Banglore, India Around 3,000 developers attended it. This is supposed to be the biggest developer&#8217;s summit so far in India.<br />
<a href="http://www.developersummit.com/">http://www.developersummit.com/</a><br />
Climate was very good in Banglore despite the summers in India. Many reputed speakers around the world were there to give their presentations. It was like a kick-off before a champions league final , huge number of attendees, huge auditoriums, all set for a great summit for first time in India.<br />
Sponsers included some big brands like Oracle, Msdn, Nokia, Adobe, Amazon, Yahoo, Infosys etc. The facilities were excellent and very well arranged and organised. Abhishek, Ganesh, Saket, Sunil  and Vivek represented Xebia at the summit. Here goes the summary of the 3 days that we have been there.<br />
<span id="more-577"></span><br />
Day 1 Rich Web</p>
<p>Topics revolved around Web 2.0 and RIA<br />
I liked the session by alessandro alinone on comet(Ajax Push data to browser when ever new data is available).<br />
<a href="http://cometdaily.com/people/alessandro_alinone/">http://cometdaily.com/people/alessandro_alinone/</a></p>
<p>I am new to Ajax and I thought there are lot of Real-Time web applications that are being developed based on Ajax and so it is worth looking in to these pastures.</p>
<p>The decription of Allesandro&#8217;s session :<br />
Several applications require real-time data to be effective, for example financial market data visualization; online auctions; online gaming; messaging systems and social networks. The Comet paradigm, as an extension to the traditional Ajax techniques, allows any web page to receive real-time data pushed by a specialized server. </p>
<p>Allesandro showed examples of websites (uses the comet paradigm)of stock trading where data  changes are very frequent.<br />
Many Ajax sessions were conducted in parallel in diferent halls.</p>
<p>Day 2: Daring Java &#8211; Day 1</p>
<p>I personally liked the presentation of Dr.Holly Cummins, a performance expert IBM, UK. She gave some of her ideas and experiences about the garbage collector and some general rules like the going by the row instead of column in an Array , use of reference objects ,trade-off in increasing the heap size. </p>
<p>She developed some garbage collection analysis tools during her 6 years stay at IBM. This was completely new to me.</p>
<p><a href="http://www4.java.no/web/show.do?page=67;303&#038;articleid=5474">http://www4.java.no/web/show.do?page=67;303&#038;articleid=5474</a></p>
<p>Day 3 : Daring Java &#8211; Day 2</p>
<p>I chose wicket track, as my affinity towards wicket took over me.<br />
Peter Thomas from Satyam gave a session on Apache Wicket. I hoped to have an advanced session on this but this was basic and not more than what we are doing in our projects.<br />
Peter claimed that he was a friend of Anurag and he was impressed when we said that we used the Wicket tester as well in our project. There was lot of fighting between the Wicket and JSF fans and the introductory session looked relevant as most of the attendes were not aware of the Wickets&#8217;s edge. Later on there was a workshop by Peter on using wicket with spring and hibernate.</p>
<p>All days apart from attending sessions:</p>
<p>We visited some stalls which were organised by sponsors and exhibitors. We visited CORDYS stall, which is also a dutch company. They are Amsterdam based compnay and have a branch in hyderabad. Saket and Sunil won consolation prizes from CORDYS for answering 2 questions(including one mind bending puzzle).</p>
<p>We can share the session videos and ppt&#8217;s once we recieve them.</p>
<p>conclusion:<br />
There were some sessions by sponsers themselves which were aimed at marketing rather than any technology perspective, for example the Nokia presentation. All in all this was a great summit, which gave us chance to meet some very good people and some old friends and some new technologies.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2008/05/28/great-indian-developers-summit/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2008%2F05%2F28%2Fgreat-indian-developers-summit%2F&amp;title=Great%20Indian%20Developer%26%238217%3Bs%20Summit" id="wpa2a_6"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2008/05/28/great-indian-developers-summit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JMatter Framework</title>
		<link>http://blog.xebia.com/2008/04/08/jmatter-framework/</link>
		<comments>http://blog.xebia.com/2008/04/08/jmatter-framework/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 12:16:56 +0000</pubDate>
		<dc:creator>Sunil Prakash Inteti</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Jmatter]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[objects]]></category>
		<category><![CDATA[sunil]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=491</guid>
		<description><![CDATA[The aim of this blog is to introduce the audience about JMatter framework and its features and capabilities. JMatter is a software application framework. It is designed specifically for building business software applications for work groups. Variety of applications can be developed using JMatter like accounting software, software for legal firms etc. The main advantage [...]]]></description>
			<content:encoded><![CDATA[<p>The aim of this blog is to introduce the audience about JMatter framework and its features and capabilities. </p>
<p>JMatter is a software application framework. It is designed specifically for building business software applications for work groups. Variety of applications can be developed using JMatter like  accounting software, software for legal firms etc. </p>
<p>The main advantage of JMatter applications is the massive reduction in the development time. Development time is  unbelievably small when compared to traditional methods of developing software. </p>
<p><strong>Let see how this is possible.</strong><br />
<span id="more-491"></span><br />
Most of the applications have a lot of common features like login dialogs, authentication etc. Developers spend most of their time in developing these common features. Technically these can be referred as Orthogonal services which are general in nature across different applications.</p>
<p>Some of these Orthogonal features are User Interface , Query Services like display all persons who live in a city for example, Validation, Persistence , Calendaring , Logging ,Authorization , Reporting-The ability to produce printable (PDF) reports from the information that an application manages.</p>
<p>JMatter comes up with most of these Orthogonal services and so developers don&#8217;t have to start from scratch. This in-turn will help to reduce developement time.</p>
<p>Let&#8217;s look at the architecture of JMatter framework&#8230;..</p>
<p>JMatter and its applications are  written in Java. As we know, Model-view-Controller is the most widely used architecture, JMatter provides generic view-Controller  implementation leaving the developers to work on model.</p>
<p>In JMatter applications all data is persisted to a back end relational database. The JMatter framework uses the Hibernate  framework to communicate to back-end databases.</p>
<p>JMatter uses the Java Swing Toolkit to produce client applications. The overall architecture has two tiers: the client application communicates over the network to the back-end database. Multiple clients can be installed on multiple workstations, and multiple users can access the system concurrently.</p>
<p>JMatter framework is based on Naked Object pattern. This means, the framework auto creates the object-oriented user interface for the Model Objects that we create.</p>
<p><strong>Installation:</strong><br />
Its very easy to install JMatter.  JMatter requires J2SE 5 or later and Ant 1.6 or later.<br />
Now download the <a href="http://www.jmatter.org">JMatter framework zip version</a> and unzip it and start using it.</p>
<p><strong>Sample Application:</strong><br />
Lets look at how to create a zero code Contact Manger Application using JMatter.  A typical contact manager application manages contacts of different persons and provides CRUD activities on Person.</p>
<p>To create a new project in JMatter, invoke the new-project-ui ant target:<br />
<em><strong>$ cd jmatter<br />
$ ant new-project-ui</strong></em><br />
Then a dialog appears asking for the project name and directory. Give the details and click OK.</p>
<p>JMatter creates the project directory with the following structure.</p>
<p><em><strong>$ cd ../CM<br />
$ ls<br />
build.xml  doc/ resources/  src/   test/</strong></em></p>
<p>JMatter creates the above directory structure for your project, along with its own ant build file.<br />
JMatter provides a number of universal business objects, including persons, their contact information, addresses, and businesses.</p>
<p>In this example application I reused the predefined implementations of Person and Business, whose<br />
fully-qualified class names are com.u2d.type.composite.Person and com.u2d.type.composite.Business, respectively.</p>
<p>Before we can generate our database schema, we have to communicate to JMatter the various types of objects we would like to persist. We can do this by adding an annotation (@Persist) directly<br />
on the model classes that we define. However in this application, since we’re using pre-existing model<br />
classes, we do this by editing the underlying template, src/persistClasses.st, directly:</p>
<pre lang="xml">
..
<value>com.u2d.type.composite.Person</value>
<value>com.u2d.type.composite.Business</value>
..
</pre>
<p>We’re now ready to generate the database schema:<br />
<em><strong>$ ant schema-export</strong></em></p>
<p>Note that, behind the scenes, JMatter  generates a Hibernate database mapping file for each class, and finally asks hibernate to generate the DDL (data definition language) instructions and send them to the database.</p>
<p>By default JMatter uses the H2 database but we can configure it to use any database.</p>
<p><strong>The Class Bar: </strong><br />
JMatter gives the default screen for all its applications. A class bar is present on the left side of the JMatter application screen which contains different icons like Users,roles, types , folders etc. By right clicking on these icons we can do all CRUD operations on them.All these operations are provided by JMatter pertaining to Naked Object pattern . We can also add our own model objects to the class bar after writing the classes.<br />
We can  edit src/class-list.xml to add our own Model Objects to Class Bar.</p>
<pre lang="xml">
<folder>
<name>Class List</name>
<items>
<folder>
<name>Model</name>
<items>
<type>com.u2d.type.composite.Person</type>
<type>com.u2d.type.composite.Business</type>
<type>com.u2d.type.composite.Folder</type>
...
</pre>
<p>Here we have added the person object already provided by JMatter.</p>
<p>Running the application: <strong>run the ant target , ant run</strong>.<br />
Login to the application with default admin (admin) login. We can also change our password. Go on to create the person objects with his contacts.</p>
<p>We have written <em>0 lines of code </em>for this application. Makes developer&#8217;s life easy!!</p>
<p>JMatter provides the CRUD capabilities for Person or any other Object you develop following the Naked Object pattern. All the database operation and hibernate mappings are taken care by JMatter.</p>
<p>Orthogonal services like login dialog, logging, persistence , localization etc are provided by JMatter. We just need to implement the Model Objects.</p>
<p>Following is the example for a sample class for Object Song.</p>
<pre lang="java">
package com.u2d.mytunes;
import com.u2d.type.atom.StringEO;
import com.u2d.type.atom.ImgEO;
import com.u2d.model.AbstractComplexEObject;
import com.u2d.model.Title;
import com.u2d.list.RelationalList;
import com.u2d.persist.Persist;
@Persist
public class Album extends AbstractComplexEObject
{
private final StringEO _name = new StringEO();
private final ImgEO _cover = new ImgEO();
public static final String[] fieldOrder = {"name", "cover"};
public Album() {}
public StringEO getName() { return _name; }
public ImgEO getCover() { return _cover; }
public Title title() { return _name.title(); }
}
</pre>
<p>We can add this class to class bar and start using it. JMatter provides all the CRUD operations on it.</p>
<p>Now let us see what the above code (Album class.) is doing&#8230;</p>
<p><strong>AbstractComplexEObject</strong> is the base class extended by all JMatter model objects.<br />
JMatter gives us many atomic types to choose from, including types for phone numbers, social security numbers, time durations, images, email addresses, colors, and much more. StringEO is just extension to String. There are two differences between a StringEO and a TextEO: 1) StringEO are saved to the database as varchar types (limit is typically 255) whereas TextEO’s are saved as text types or some other similar large text object; and 2)  StringEO editors in the GUI are text fields whereas TextEO<br />
editors are text areas.<br />
We can think of the EO part of the type name as being an acronym for Enhanced Object.</p>
<p><strong>Conclusion: </strong><br />
I hope this gave you detailed introduction about JMatter.<br />
I am still not sure how much we can use JMatter if the application complexity increases. But it is absolutely terrific for small applications for Works Groups connected by LAN. I would be glad to your experience about handling complex projects with JMatter.</p>
<p>references: jmatter.org<br />
For  more information  visit <a href="http://www.jmatter.org">http://www.jmatter.org</a>.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2008/04/08/jmatter-framework/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2008%2F04%2F08%2Fjmatter-framework%2F&amp;title=JMatter%20Framework" id="wpa2a_8"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2008/04/08/jmatter-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security Protocols and common attacks.</title>
		<link>http://blog.xebia.com/2007/12/11/344/</link>
		<comments>http://blog.xebia.com/2007/12/11/344/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 12:49:04 +0000</pubDate>
		<dc:creator>Sunil Prakash Inteti</dc:creator>
				<category><![CDATA[Security]]></category>

	<!-- AutoMeta Start -->
	<category>alice</category>
	<category>trent</category>
	<category>mallory</category>
	<category>attack</category>
	<category>protocol</category>
	<category>encryption</category>
	<category>confidentiality</category>
	<category>challenge</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/2007/12/11/344/</guid>
		<description><![CDATA[I wanted to write a blog on Security Protocols. This was the course I liked the most during my College days. Lets look at some protocols and some of the ways these protocols can be attacked. These are some protocols that i studied during my college days. The two most common words in Security world [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to write a blog on Security Protocols. This was the course I liked the most during my College days. Lets look at some protocols and some of the ways these protocols can be attacked. These are some protocols that i studied during my college days.</p>
<p>The two most common words in Security world is Confidentiality and Integrity. Understanding these two terms is very crucial. In simple words Confidentiality means that only authorized entities can read information. Integrity means reassuring the recipient of the message that the message has not been altered since it was generated by a legitimate source.<span id="more-344"></span><br />
In Public Key Cryptography<br />
&#8212;Each user U has an encryption function E<sub>u</sub>that is made public.<br />
&#8212;Each user U has a decryption function (key) Du that is non-public.<br />
D<sub>u</sub>(E<sub>u</sub>(m)) = m<br />
 The encryption function E<sub>u</sub> can be revealed without revealing the decryption function D<sub>u</sub><br />
As we Know Confidentiality can be provided by Encryption . Integrity can be provided by using digital signatures.</p>
<p>Lets plunge into some example protocol with the famous Alice and Bob example.<br />
Now lets look at a session establishment protocol and some attacks on it. A protocol to establish a session key K between Alice and Bob must guarantee the following two properties.</p>
<p>After successful protocol execution:</p>
<ul>
<li>  Only Alice and Bob (and TTP&#8217;s involved if any. TTP is a trusted third party involved in   generation of a session key) should   know    K.<br />
  Alice and Bob should be assured that K is newly generated.</li>
</ul>
<p>An Adversary can do the any of the following</p>
<ul>
<li>Eavesdrop on all messages sent in a protocol<br />
Alter all messages sent in a protocol using any information available<br />
Re-route any message to any principal<br />
Generate and insert completely new messages<br />
Obtain the value of the session key used in any sufficiently old previous run of the protocol<br />
Start any number of parallel protocol runs between any principals.</li>
</ul>
<p>Some Encryption assumptions are involved in Encryption.<br />
The encryption of message M with key K (shared or public) is denoted by ciphertext {M}<sub>K</sub></p>
<p>Assumptions:</p>
<ul>
<li>Without K or matching private key, it should be impossible to retrieve M from {M}<sub>K</sub><br />
It should be impossible to retrieve K or matching private key from {M}<sub>K</sub><br />
Without K even with knowledge of M it should be impossible to alter {M}<sub>K</sub>without being detected
</li>
</ul>
<p>Here is what the notations used in this blog mean<br />
{K}<sub>K<sub>AT</sub></sub> &#8212; K is encrypted with shared key between Alice and Trent.  K<sub>AT</sub>  is known to both Alice and Trent.</p>
<p><img src="http://blog.xebia.com/wp-content/uploads/2007/12/1.gif" alt="1.gif" /></p>
<p>Here Trent is the trusted third party.<br />
In the first step Alice sends a message to Trent saying that it wants to have a session with Bob.<br />
Trent finds keys K<sub>AT</sub> , K<sub>BT</sub>, generates K at random, creates {K}<sub>AT</sub> , {K}<sub>BT</sub> which are the shared keys between Alice and Trent, Bob and Trent respectively.<br />
Alice decrypts {K}<sub>K<sub>AT</sub></sub> to get K.. Bob decrypts {K}<sub>K<sub>BT</sub></sub> to get K. And from now on Alice and Bob can communicate with key K.<br />
Now lets look at the attack on this protocol.<br />
<img src="http://blog.xebia.com/wp-content/uploads/2007/12/2.gif" alt="2" /></p>
<ul>
<li>Mallory(one who tries to break rules,may be a valid principal ) intercepts Alice’s message intended for Trent.
<p>Trent thinks Alice wants key with Mallory. </p>
<p>Alice is fooled that Mallory is Bob.</p>
<p>Attacker is (also) a legitimate principal.</p>
<p>Here Mallory impersonates as Bob and Alice is made to believe it.
</li>
</ul>
<p>FIX FOR THE ATTACK:</p>
<p><img src="http://blog.xebia.com/wp-content/uploads/2007/12/3.gif" alt="3" /></p>
<p>This protocol binds the session key to the intended users</p>
<p>If Mallory tries the previous attack, then Trent will include Mallory’s identity in the encrypted part intended for Alice, so she knows the decrypted key is not shared with Bob and therefore the attack will fail</p>
<p>YET ANOTHER ATTACK ON THIS IMPROVED PROTOCOL</p>
<p><img src="http://blog.xebia.com/wp-content/uploads/2007/12/4.gif" alt="4" /></p>
<p>Mallory records exchange between Alice and Bob as shown in the above figure.</p>
<p>Mallory replays messages in subsequent run like in the second step of the protocol</p>
<p>Here are some points to note</p>
<ul>
<li>K’ is a not fresh
<p>But Alice does not know about this.</p>
<p>K’ is known to Mallory. And Mallory can again fool Alice.</p>
<p>This attack is called a replay/freshness attack.
</li>
</ul>
<p>The fix here is to challenge and expect a response so that No one can play replay attacks.</p>
<p>So here is the improved protocol </p>
<p><img src="http://blog.xebia.com/wp-content/uploads/2007/12/5.gif" alt="5" /></p>
<p>Alice (Bob) checks if Trent is there</p>
<ul>
<li>Sends random challenge to Trent
<p>Trent responds with a message that binds the challenge to the session key as you can see in the second step of the new protocol above.</p>
<p>Alice (Bob) verify the binding before accepting the key</li>
</ul>
<p>Since Alice (Bob) expects a different response each time, Mallory cannot replay an old response without detection</p>
<p>This method is called challenge-response.</p>
<p>NA is called the nonce and its the challenge sent by Alice to Trent and trent responds for it. So a reply is always a fresh one. Now mallory canont replay the messages like it could in the previos version of the protocol.</p>
<p>This brand new protocol includes 2 challenge response exchanges. One is between Alice an Trent and other is between Bob and Alice.</p>
<ul>
<li>Bob checks if Alice is there
<p>Sends challenge to A (Message 4)</p>
<p>Response should be fresh (Message 5)</li>
</ul>
<p>Friends unfortunately there is another attack on this improved protocol as well. Can You guess it???!!!!! [:)]</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2007/12/11/344/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2007%2F12%2F11%2F344%2F&amp;title=Security%20Protocols%20and%20common%20attacks." id="wpa2a_10"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2007/12/11/344/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.xebia.com/author/sunilinteti/feed/ ) in 0.66364 seconds, on Feb 9th, 2012 at 5:14 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 9th, 2012 at 6:14 pm UTC -->
