<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;A0QNQX45eSp7ImA9WhBTE08.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178</id><updated>2013-02-08T05:16:30.021-08:00</updated><category term="javafx" /><category term="open source java" /><category term="hibernate" /><category term="jsf 2.0" /><category term="ant" /><category term="java" /><category term="patterns" /><category term="security" /><category term="development" /><category term="tutorial" /><category term="Address Bar" /><category term="startup" /><category term="gil" /><category term="glassfish" /><category term="maven" /><category term="tomcat" /><category term="Taskbar" /><category term="rome" /><category term="adobe" /><category term="wsimport" /><category term="primefaces" /><category term="environments" /><category term="multimedia" /><category term="oracle" /><category term="netbeans" /><category term="osgi" /><category term="java ee 6" /><category term="SEO" /><category term="desktop" /><category term="frameworks" /><category term="izpack" /><category term="miscellanous" /><category term="Linux" /><category term="shortcuts" /><category term="windows" /><category term="programing" /><category term="netbeans IDE" /><category term="java ee" /><category term="lunch4j" /><category term="ftp" /><category term="computing" /><category term="google" /><category term="javaee 6" /><title>Cameo Tutorials</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://cameotutorials.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>35</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/CameoTutorials" /><feedburner:info uri="cameotutorials" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;CkACQngyeip7ImA9WhJUEUU.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-6476159226932730825</id><published>2012-09-09T01:52:00.000-07:00</published><updated>2012-09-09T01:52:43.692-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-09T01:52:43.692-07:00</app:edited><title>Visualization concepts for portfolio risk and Performance</title><content type="html">&lt;p&gt;   &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c90e8201-f738-4daa-84d7-8e203e5af546" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Portfolio+Theory" rel="tag"&gt;Portfolio Theory&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Java" rel="tag"&gt;Java&lt;/a&gt;,&lt;a href="http://technorati.com/tags/WPF" rel="tag"&gt;WPF&lt;/a&gt;,&lt;a href="http://technorati.com/tags/C%23" rel="tag"&gt;C#&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Jensen.+Sharpe" rel="tag"&gt;Jensen. Sharpe&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Visualization" rel="tag"&gt;Visualization&lt;/a&gt;&lt;/div&gt; Visualising multi dimensional data is critical in understanding the performance of portfolios. Our research was focussed on the most innovative ways by which the risk and return of portfolios can be visualised to make informed decisions about the portfolio.&lt;/p&gt;  &lt;p&gt;Here we have a parallel coordinates, This is the most interesting as it allows very dynamic filtering and also shows all the ratios from a single view for all accounts.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-_sZAF2dfZ2s/UExVZE7TYWI/AAAAAAAAAHw/vIdGMaGyx7s/s1600-h/par%25255B10%25255D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="par" border="0" alt="par" src="http://lh5.ggpht.com/-YP1CgrcHpVw/UExVaJW4SKI/AAAAAAAAAH4/EK6fdron4mU/par_thumb%25255B6%25255D.jpg?imgmax=800" width="659" height="364" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Mean – Variance scatter&amp;#160; plot visualisation. Should look like the efficient frontier if the accounts are efficient&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-xmLGE9W19WY/UExX6LoehgI/AAAAAAAAAIA/d9iipszCyBc/s1600-h/Untitled-3%25255B6%25255D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Untitled-3" border="0" alt="Untitled-3" src="http://lh6.ggpht.com/-_0KXSCiijJU/UExX6zEaW-I/AAAAAAAAAIE/jspyT_V8huo/Untitled-3_thumb%25255B3%25255D.jpg?imgmax=800" width="661" height="411" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Top 5 and worse 5 accounts using a radar chart&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-ePu8_AFNTDk/UExX7jmCQFI/AAAAAAAAAIM/tUtDGwgPkPw/s1600-h/Untitled-4%25255B6%25255D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Untitled-4" border="0" alt="Untitled-4" src="http://lh4.ggpht.com/-cQHyNRVHIm8/UExX8c4CDqI/AAAAAAAAAIU/tiakz7PIUJM/Untitled-4_thumb%25255B3%25255D.jpg?imgmax=800" width="675" height="401" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Portfolio history details over a period of time&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-uIb-tWfC98g/UExX9MmnywI/AAAAAAAAAIc/lTeCh7kpuMo/s1600-h/Untitled-6%25255B6%25255D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Untitled-6" border="0" alt="Untitled-6" src="http://lh6.ggpht.com/-OSGaDhFeXQI/UExX963mNgI/AAAAAAAAAIo/5ITqCqJ_XCA/Untitled-6_thumb%25255B3%25255D.jpg?imgmax=800" width="687" height="367" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Another view of the Portfolio Analysis over a period of time&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-4X8WOiFUBs8/UExX-ygaWLI/AAAAAAAAAIw/ze1F_oeCTCU/s1600-h/Untitled-11%25255B5%25255D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Untitled-11" border="0" alt="Untitled-11" src="http://lh3.ggpht.com/-q959e-7wKE8/UExX_4E_9eI/AAAAAAAAAI4/mtscfLrCDPY/Untitled-11_thumb%25255B2%25255D.jpg?imgmax=800" width="704" height="393" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;All Portfolios in a single view&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-15atLpvCxI4/UExYAlu6K-I/AAAAAAAAAJA/C-JeSX_ylvI/s1600-h/Untitled-5%25255B6%25255D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Untitled-5" border="0" alt="Untitled-5" src="http://lh5.ggpht.com/-taZnoM63uyg/UExYBWPr8MI/AAAAAAAAAJE/j_KzZcVbFRo/Untitled-5_thumb%25255B3%25255D.jpg?imgmax=800" width="717" height="386" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;TreeMap visualization of all portfolios. Size for Risk and Shade of blue for return.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-1GdjCnrM3Yc/UExYQylp0LI/AAAAAAAAAJQ/uM_CF7FxD3I/s1600-h/Untitled-8%25255B6%25255D.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Untitled-8" border="0" alt="Untitled-8" src="http://lh6.ggpht.com/-y2G6krGD7t8/UExYRjk38XI/AAAAAAAAAJY/_2o3wev9PlE/Untitled-8_thumb%25255B3%25255D.jpg?imgmax=800" width="722" height="475" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The visualization concepts have never been applied to portfolio theory!!!&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/0jvaEOcVOlM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/6476159226932730825/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=6476159226932730825" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/6476159226932730825?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/6476159226932730825?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/0jvaEOcVOlM/visualization-concepts-for-portfolio.html" title="Visualization concepts for portfolio risk and Performance" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-YP1CgrcHpVw/UExVaJW4SKI/AAAAAAAAAH4/EK6fdron4mU/s72-c/par_thumb%25255B6%25255D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2012/09/visualization-concepts-for-portfolio.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUYEQHw4eyp7ImA9WhJQGU4.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-6309270762474486949</id><published>2012-08-02T12:51:00.001-07:00</published><updated>2012-08-02T12:51:41.233-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-02T12:51:41.233-07:00</app:edited><title>Presentation of Risk and Performance Monitoring system at Microsoft</title><content type="html">&lt;p&gt;Pictures of our group presentation of our risk and performance monitoring system at Microsoft. The Front end is developed in C# with WPF and the backend is developed in Java. &lt;/p&gt;  &lt;p&gt;The WPF Client consumes a REST interface exposed by the Server.&lt;/p&gt;  &lt;p&gt;Below is me making a presentation on the functionality of the system&lt;a href="http://lh6.ggpht.com/-LCbID_SEDts/UBraK3kkLTI/AAAAAAAAAGg/FtOMj32umVM/s1600-h/IMG_9758%25255B9%25255D.jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="IMG_9758" border="0" alt="IMG_9758" src="http://lh4.ggpht.com/-mgn-MRtvysY/UBraL2tGx8I/AAAAAAAAAGk/Gx2krgVsyZU/IMG_9758_thumb%25255B3%25255D.jpg?imgmax=800" width="460" height="308" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The ATRADE Team&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-EgmnyPQvHTE/UBraMs0XfeI/AAAAAAAAAGw/FI2iIInH6ac/s1600-h/IMG_9788a%25255B4%25255D.jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="IMG_9788a" border="0" alt="IMG_9788a" src="http://lh5.ggpht.com/-115odjei0vM/UBraNpKIqpI/AAAAAAAAAG0/Kf2mdO2ViWs/IMG_9788a_thumb%25255B1%25255D.jpg?imgmax=800" width="473" height="317" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Another team member explaining the Architecture of the system&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-hY2hRJHO1xo/UBraPM0xB6I/AAAAAAAAAHA/DVYJRtkVTOw/s1600-h/IMG_9757%25255B4%25255D.jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="IMG_9757" border="0" alt="IMG_9757" src="http://lh6.ggpht.com/-idhuMElbBzM/UBraQI1HtvI/AAAAAAAAAHE/byhtubUHhyY/IMG_9757_thumb%25255B1%25255D.jpg?imgmax=800" width="500" height="335" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Microsoft Representative&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-TnzUYQu3lu4/UBraRLClUuI/AAAAAAAAAHM/XdDhAyW1cf4/s1600-h/IMG_9748%25255B5%25255D.jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="IMG_9748" border="0" alt="IMG_9748" src="http://lh3.ggpht.com/-jNYfkWAvu_Q/UBraSJ3I0vI/AAAAAAAAAHY/L6OR3Y4b5Hw/IMG_9748_thumb%25255B2%25255D.jpg?imgmax=800" width="514" height="342" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Our system is still under development but due to be completed soon.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/78mS1K9ap9k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/6309270762474486949/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=6309270762474486949" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/6309270762474486949?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/6309270762474486949?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/78mS1K9ap9k/presentation-of-risk-and-performance.html" title="Presentation of Risk and Performance Monitoring system at Microsoft" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-mgn-MRtvysY/UBraL2tGx8I/AAAAAAAAAGk/Gx2krgVsyZU/s72-c/IMG_9758_thumb%25255B3%25255D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2012/08/presentation-of-risk-and-performance.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMDSH09cSp7ImA9WhJRFU0.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-6688335352637849135</id><published>2012-07-16T06:23:00.000-07:00</published><updated>2012-07-16T21:47:59.369-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-16T21:47:59.369-07:00</app:edited><title>Nose Dive into core Java: Understanding equals(Object o) and hashCode()</title><content type="html">In this series, I plan to write on some of the fine details of the core Java API, some performance optimisations and some advanced Java concepts.&lt;br /&gt;
&lt;br /&gt;
In this installation of the series(more to follow), we learn all there is to know about equals(Object o) and hashCode(), two fundamental methods that every serious developer must fully understand and keep in mind for the rest of their lives.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;So what are these two methods?&lt;/h3&gt;These are methods defined in the Object class in java.lang package. &lt;br /&gt;
So every object you instantiate, inherits these methods because all objects extends from the java.lang.Object class.&lt;br /&gt;
&lt;br /&gt;
The method definitions in the Object class are as shown below.&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
public boolean equals(Object o){
 //....blah blah
}

public int hashCode(){
 //....blah blah
}
]]&gt;&lt;/script&gt;&lt;br /&gt;
So why do we need to master them and what makes them special?&lt;br /&gt;
They are special and we need to master them because certain other aspects of the Java API rely on the correctness of these two methods for their efficiency and correctness when used, the biggest ones being the Collections API in the java.util package.&lt;br /&gt;
&lt;br /&gt;
Even if you don't use the Collections API that much, you still need to know these two methods and their requirements thoroughly if you are implementing anything that has performance characteristics.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;equals(Object o)&lt;/h3&gt;The purpose of the equals method is to provide a facility for us to be able ask, at any point, in the life of an object if an object we hold a reference to "equals" another object. It allows us to compare ANY two objects!&lt;br /&gt;
&lt;br /&gt;
Literally, we want to ask &lt;br /&gt;
&lt;br /&gt;
If we were to assign two numerical values to each of these two objects, should the two numbers be the same?&lt;br /&gt;
&lt;br /&gt;
This question is very different from asking, &lt;br /&gt;
&lt;br /&gt;
"Do the references for these two objects point to the same memory location?"&lt;br /&gt;
&lt;br /&gt;
The second question is different because it asks if two objects are the same, i.e, occupy the same address space.&lt;br /&gt;
&lt;br /&gt;
Just for emphasis, the equals method in the Object class and therefore the JDK asks the first one.&lt;br /&gt;
&lt;br /&gt;
The default implementation of the equals method in the JDK is implemented as shown below.&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
    public boolean equals(Object obj) {
        return (this == obj);
    } 
]]&gt;&lt;/script&gt;&lt;br /&gt;
Now whilst this implementation looks simplistic, almost like the guys at Sun(Ooops Oracle)are playing lazy, it has some serious consequences.&lt;br /&gt;
&lt;br /&gt;
By using the equality operator on reference variables, the default implementation says if the two objects have identical bits, then they are equal!  This is because, the equality operator on reference variables compares just the references being considered.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Understanding the equality operator&lt;/h3&gt;To fully understand what the code above does, lets remind ourselves quickly how the equality operator works with a quick example.&lt;br /&gt;
&lt;br /&gt;
Consider the code below.&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
public class MyObject {
    public static void main(String[] args) {
        MyObject a = new MyObject();
        MyObject b = new MyObject();
        MyObject c = a;
       
        System.out.println(" result of  a == b? Ans: " + (a == b) );
        System.out.println(" result of  a == b? Ans: " + (a == c) );
    }
} 
]]&gt;&lt;/script&gt;&lt;br /&gt;
When we execute this code, this is the result we get;&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
result of  a == b? Ans: false 
result of  a == b? Ans: true
]]&gt;&lt;/script&gt;&lt;br /&gt;
&lt;h5&gt;Back to equals(Object o) method&lt;/h5&gt;So we can now understand that the default implementation, only asks if the two objects we are comparing have the same reference.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;What does this mean?&lt;/h3&gt;Effectively, the JDK's default implementation answers our second question and uses that &lt;br /&gt;
answer as the answer to the first.&lt;br /&gt;
&lt;br /&gt;
So the default implementation effectively says, &lt;br /&gt;
&lt;br /&gt;
"If two objects have the same references, then they are also equal."&lt;br /&gt;
&lt;br /&gt;
That in itself is not a lie since a reference can belong to only one object. No two different objects can have the same reference. So the default is true but a very narrow true.&lt;br /&gt;
&lt;br /&gt;
The default implementation doesn't answer the first question comprehensively. It only takes the minimal truth that will always hold, but leaves the concept of equality of objects as a responsibility of the developer to decide. This is Object Oriented Programming(OOP) at its core.&lt;br /&gt;
&lt;br /&gt;
You as the creator of the object must decide when two objects are equal. You can play along with the default implementation for trivial classes but in the end, it is your responsibility as the creator of the classes that represent the Objects in you domain space, to define the how equality is implemented among the objects you create.&lt;br /&gt;
&lt;br /&gt;
The JDK developers have left a nice slot for you to answer what makes objects equal and that is why it is important to override the equals method in any non-trivial class that you implement.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;What happens if I don't care about equality?&lt;/h3&gt;That's fine as long as you don't touch any of the Collections API classes, then you MAY be able to get away with your laziness. But if you touch any of them especially the ones that have Hash in their names, you run into serious trouble.&lt;br /&gt;
&lt;br /&gt;
To fully appreciate it, lets think about why equality is important in the collections world.&lt;br /&gt;
&lt;br /&gt;
We humans have used the concept of names to identify people since the stone age or possibly before then. But the flaw in the use of names is very easy to see. Just put 10 people in a room and give two of them the same name. The moment you call that name, we have a conflict. You must use another way to identify the one you want to call!&lt;br /&gt;
&lt;br /&gt;
The creators of the Collections Framework sidestepped that conflict by partly relying on the equality of the objects in your collections. When Objects are put in a Hash* Collection, they go into baskets by the integer number returned by their hashCode() method. When you search for objects in that collection, the Collections API uses this value to identify the basket they went into. &lt;br /&gt;
Now in the selected basket, the collections API relies on the equals(Object obj) to find the object you are looking for. This means, if you have not overwritten the equals(Object o) method to define equality in a way you can recreate, and you use this Object as Key in a HashMap, then the only way you can fetch your items is to have a reference to the key.&lt;br /&gt;
&lt;br /&gt;
Lets do an example to understand what we are talking about.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to use This class as a key for our data&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
public class DataKeyNoOveride {
    private String key;

    public DataKeyNoOveride(String key) {
        this.key = key;
    }
}
]]&gt;&lt;/script&gt;&lt;br /&gt;
And our data is actually represented by the following dummy class&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
public class Data {
}
]]&gt;&lt;/script&gt;&lt;br /&gt;
Now lets see the how the argument made so far by implementing a lookup like this&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
public class ObjectLost {
    
    //NOTE New JDK 7 Syntax!
    private static Map&lt;DataKeyNoOveride, Data&gt; store = new HashMap&lt;&gt;();
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        String objectId = "Unique-1";
        Data data = new Data();
        DataKeyNoOveride key1 = new DataKeyNoOveride(objectId);
        
        store.put(key1, data);
        
        DataKeyNoOveride key2 = new DataKeyNoOveride(objectId);
        
        System.out.println("result with key1 "+ store.get(key1));
        System.out.println("result with key2 "+ store.get(key2));
    }
}
]]&gt;&lt;/script&gt;&lt;br /&gt;
When we execute to code above, we get the results shown below &lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
result with key1 thread.tuts.Data420a52f
result with key2 null 
]]&gt;&lt;/script&gt;&lt;br /&gt;
In the second lookup, the result was not found because the equality operator used the references to try to find the Data.&lt;br /&gt;
&lt;br /&gt;
To understand exactly why the second lookup failed, The following code shows the OpenJDK implementation of the get method of HashMap.&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
public V get(Object key) {
 if (key == null)
  return getForNullKey();
 int hash = hash(key.hashCode());
 for (Entry&lt;K,V&gt; e = table[indexFor(hash, table.length)];
   e != null;
   e = e.next) {
  Object k;
  if (e.hash == hash &amp;&amp; ((k = e.key) == key || key.equals(k)))
   return e.value;
 }
 return null;
}
]]&gt;&lt;/script&gt;&lt;br /&gt;
As you can see clearly on line;&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
if (e.hash == hash &amp;&amp; ((k = e.key) == key || key.equals(k)))
]]&gt;&lt;/script&gt;&lt;br /&gt;
The implementation is relying on the keys equals method  key.equals(k). Since the default implementation uses equality reference operator(==), it means the second lookup will fail because it is in a different address location and hence the null result.&lt;br /&gt;
&lt;br /&gt;
Also note that this implementation allows for null keys and will use getForNullKey() to find which ever object was stored under the null key.&lt;br /&gt;
&lt;br /&gt;
The value returned can also be null as can be clearly seen in the last line.&lt;br /&gt;
&lt;br /&gt;
I hope now you understand how the equals(Object o) method affects your use of the Collections Framework.&lt;br /&gt;
&lt;h3&gt;It doesn't stop with filling baskets&lt;/h3&gt;Well apart from using the equals and the hashCode() to store and retrieve Objects, The Collections Framework also relies on the equals in a number of places.&lt;br /&gt;
&lt;br /&gt;
Typically all the contains methods in the List implementations rely on the equals(Object o) for retrieving the associated objects and these are clearly stated in the documentation for those methods. Also, the Set classes rely on equals(Object o) for making sure there are no duplicates.&lt;br /&gt;
&lt;br /&gt;
All the following from the Map&lt;K,V&gt; interface rely on a correct implementation of the equals(Object obj) method.&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
containsKey(Object key) 
containsValue(Object key) 
remove(Object key)
]]&gt;&lt;/script&gt;&lt;br /&gt;
Also the following from the Collection&lt;e&gt;&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
contains(Object o) 
remove(Object o)
]]&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;It doesn't stop with the Collections Framework...Contracts&lt;/h3&gt;The equals method also have contractual obligations it must adhere to. This is the Java API telling you to obey certain rules when overriding the equals(Object o) method.&lt;br /&gt;
&lt;br /&gt;
The JDK's execution, performance etc are only guaranteed if your implementation obeys these rules. So if you override equals(Object o), your implementation must obey them.&lt;br /&gt;
&lt;br /&gt;
The rules are - (ChRiST - No) - you can interpret it whichever way(for/agains/Swear) -  just trying to help you and myself to remember&lt;br /&gt;
&lt;br /&gt;
1. &lt;b&gt;C-Consistent&lt;/b&gt; - For any two references x and y, irrespective of the number of times you invoke x.equals(y), it should consistently return true or consistently return false as long as none of the variables used in the definition of equals() have not changed.&lt;br /&gt;
&lt;br /&gt;
2. &lt;b&gt;R-Reflexive&lt;/b&gt; - For any reference x,  x.equals(x) should return true. i.e., An object should equal itself! Logical, isn't it?&lt;br /&gt;
&lt;br /&gt;
3. &lt;b&gt;S - Symmetric&lt;/b&gt; - For any two references x and y, x.equals(y) should return true if and only if (iff) y.equals(x).  &lt;br /&gt;
Put another way for programmers, &lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
boolean b = y.equals(x) == x.equals(y)   
]]&gt;&lt;/script&gt;&lt;br /&gt;
==&gt; b must always equal true&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
!if(!b) System.out.println("Non-Compliance with equals(Object obj) contract! Call Compliance Police!!");
]]&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
4. &lt;b&gt;T – Transitive&lt;/b&gt; – For any three references, x, y and  z, if x.equals(y)  return true, and y.equals(z)  also returns true, the x.equals(z)  must also return true.&lt;br /&gt;
&lt;br /&gt;
5. &lt;b&gt;N - Null Compare&lt;/b&gt; - for any non-null reference x, x.equals(null) MUST return false. &lt;br /&gt;
So its easy to that this implementation &lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
public boolean equals(Object obj) {
    return true;
}
]]&gt;&lt;/script&gt;&lt;br /&gt;
followed by this call &lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[
MyObject a = new MyObject();
a.equals(null);
]]&gt;&lt;/script&gt;&lt;br /&gt;
will lead to compliance police call&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;.&lt;br /&gt;
1. Object equality is a responsibility of the developer to define. The default implementation only compares objects using the equality operator.&lt;br /&gt;
&lt;br /&gt;
2. You MUST override equals(Object o) method of Object class if your class is going to be used as a key in any Collection, especially Hash-based collections(HashMap, HashSet, LinkedHashSet)&lt;br /&gt;
&lt;br /&gt;
3. When you override equals(Object o), you MUSt obey the contractual obligations of the equals(Object o)method.&lt;br /&gt;
&lt;br /&gt;
I will follow up with hashCode() in the next series. &lt;br /&gt;
Thanks for your time.&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/fLiwwR1ueFo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/6688335352637849135/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=6688335352637849135" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/6688335352637849135?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/6688335352637849135?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/fLiwwR1ueFo/nose-dive-into-core-java-understanding.html" title="Nose Dive into core Java: Understanding equals(Object o) and hashCode()" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2012/07/nose-dive-into-core-java-understanding.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcMR3YyeCp7ImA9WhRWF0U.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-3771653990648197620</id><published>2012-01-05T08:35:00.000-08:00</published><updated>2012-01-05T09:04:46.890-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-05T09:04:46.890-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="netbeans IDE" /><category scheme="http://www.blogger.com/atom/ns#" term="netbeans" /><category scheme="http://www.blogger.com/atom/ns#" term="javafx" /><title>Netbeans 7.1 is out but watch out before you grab that hot cake!</title><content type="html">&lt;p&gt;Good news &lt;a href="http://netbeans.org/"&gt;Netbeans 7.1&lt;/a&gt; is out with lots of support for the latest  technologies ie JavaFx 2.0, Java EE 6 and JDK 7 but there are a few gotcha's if  you decide to jump on-board now. &lt;/p&gt; &lt;p&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;NB: I'm one of the noisiest Netbeans preachers wherever I find myself   trying to win some eclipse souls. I just love the software but these gotchas are  so raw I just want to warn you.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;Netbeans 7.1 does not work with Subversion 1.7  period!&lt;/u&gt;&lt;/strong&gt; So if you have just bought a new pc and you are setting up  a new development environment or upgraded your subversion, or your company uses  subversion 1.7, Netbeans 7.1 is not for you. &lt;/p&gt; &lt;p&gt;I now have to downgrade my subversion to use this but the advantages from  Netbeans outweigh the downgrade so will have to. I have tried all the hack and  command line client noise they usually throw at you and it just didn't work so  don't bother trying&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;strong&gt;The JavaFx 2.0 project format in Netbeans have changed since the 7.1  RC2&lt;/strong&gt; so if you created your nice JavaFx 2.0 project with any of the  previous Netbeans versions, such as 7.0.1, 7.1 beta or any version before the  7.1 RC2, your JavaFX 2.0 project will not run! The ant targets have changed and  there is no migration support, so the only option is to recreate a blank project  and copy your files manually. &lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Unfortunately, I don't have the patience for  some other IDEs so my only options are to downgrade and to copy my files from my  JavaFX 2.0 projects but I know its worth doing. &lt;/li&gt;&lt;/ul&gt;If you have any substantial  development going on, then watch out before you grab that hot cake!&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/AFbDzuuYTnQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/3771653990648197620/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=3771653990648197620" title="11 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3771653990648197620?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3771653990648197620?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/AFbDzuuYTnQ/netbeans-71-is-out-but-watch-out-before.html" title="Netbeans 7.1 is out but watch out before you grab that hot cake!" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>11</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2012/01/netbeans-71-is-out-but-watch-out-before.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkAMSHo-fip7ImA9WhRWFUQ.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-3777935496009395608</id><published>2012-01-03T04:06:00.000-08:00</published><updated>2012-01-03T04:46:29.456-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-03T04:46:29.456-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="netbeans IDE" /><category scheme="http://www.blogger.com/atom/ns#" term="netbeans" /><category scheme="http://www.blogger.com/atom/ns#" term="tomcat" /><title>How to Set VM Arguments for Server in Netbeans - Solving PermGen space effectively</title><content type="html">I'm an avid heavy Netbeans user but for some time now I have been  fighting with a Horrible PermGen space error when debugging a Tapestry  application.&lt;br /&gt;&lt;br /&gt;After setting all the Options and environment variables in &lt;span style="font-weight: bold;"&gt;netbeans.conf&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;nbactions.xml&lt;/span&gt;, as a &lt;span style="font-weight: bold;"&gt;global environment variable&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;catalina.bat&lt;/span&gt; etc I still couldn't pass the VM options to the registered Tomcat server untill today I realised that, &lt;span style="font-style: italic;font-size:180%;" &gt;&lt;span style="font-weight: bold;"&gt;it's in the same place as you register the server!!! &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And  this took me ages to figure out (yea, daft me! ) so I'm sharing it here  for my own reference and for anyone who runs into this.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farent-solutions.com/uploads/netbeans_server_vm_options.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 766px; height: 537px;" src="http://farent-solutions.com/uploads/netbeans_server_vm_options.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-I9CHS3AaNXg/TwLwieSC9PI/AAAAAAAAAF8/6rb8nvLVObw/s1600/netbeans_server_vm_options.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/xCwDfrfnU7A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/3777935496009395608/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=3777935496009395608" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3777935496009395608?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3777935496009395608?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/xCwDfrfnU7A/how-to-set-vm-arguments-for-server-in.html" title="How to Set VM Arguments for Server in Netbeans - Solving PermGen space effectively" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2012/01/how-to-set-vm-arguments-for-server-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQDSHk5eip7ImA9WhZVFkk.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-3886934924710221447</id><published>2011-05-28T21:19:00.000-07:00</published><updated>2011-05-28T21:29:39.722-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-28T21:29:39.722-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="desktop" /><category scheme="http://www.blogger.com/atom/ns#" term="javafx" /><title>Yesss!!!!!!! Java FX Runtime is Distributable! The future is bright!</title><content type="html">Wow after all the Licensing issues raised &lt;a href="http://javafx.uservoice.com/forums/33584-official-javafx-feedback-forum/suggestions/403105-allow-us-to-distribute-the-javafx-runtime-binary?ref=title"&gt;here &lt;/a&gt;by worried observers, Oracle has listened and now, you can happily write desktop applications with javafx 2.0 and distribute it under exactly the same License as Java itself.&lt;br /&gt;&lt;br /&gt;You can read the mini statement &lt;a href="http://javafx.com/faq/#10"&gt;here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Let the java desktop revolution begin!&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class=" down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;img src="img/blank.gif" alt="Link" class="gl_link" border="0" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/igFRXuORnTw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/3886934924710221447/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=3886934924710221447" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3886934924710221447?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3886934924710221447?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/igFRXuORnTw/yesss-java-fx-runtime-is-distributable.html" title="Yesss!!!!!!! Java FX Runtime is Distributable! The future is bright!" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2011/05/yesss-java-fx-runtime-is-distributable.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkAHRXoyeip7ImA9Wx9bGUs.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-3028273849138283688</id><published>2011-02-28T23:19:00.000-08:00</published><updated>2011-02-28T23:32:14.492-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-28T23:32:14.492-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="multimedia" /><category scheme="http://www.blogger.com/atom/ns#" term="open source java" /><category scheme="http://www.blogger.com/atom/ns#" term="rome" /><category scheme="http://www.blogger.com/atom/ns#" term="adobe" /><category scheme="http://www.blogger.com/atom/ns#" term="gil" /><title>Adobe does Open Source in a very open way</title><content type="html">While browsing the net, I came accross this list of &lt;a href="http://www.adobe.com/"&gt;Adobe&lt;/a&gt; supported open source projects that covers almost all your needs for your next multi media project.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sourceforge.net/adobe/wiki/Projects/"&gt;&lt;span style="text-decoration: underline;"&gt;http://sourceforge.net/adobe/wiki/Projects/&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I must say I am really impressed and I hope some of these libraries will start finding  their way into the Java ecosystem, especially &lt;a href="http://sourceforge.net/adobe/genimglib/home/"&gt;GIL&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thank you &lt;a href="http://www.adobe.com/"&gt;Adobe&lt;/a&gt; for sharing.&lt;br /&gt;&lt;br /&gt;Whiles there, you can also checkout this free webapp, &lt;a href="http://rome.adobe.com/"&gt;ROME&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/0-wqGv-LKUM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/3028273849138283688/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=3028273849138283688" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3028273849138283688?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3028273849138283688?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/0-wqGv-LKUM/adobe-does-open-source-in-very-open-way.html" title="Adobe does Open Source in a very open way" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2011/02/adobe-does-open-source-in-very-open-way.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8FRn0-fyp7ImA9Wx5XGEo.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-9140230606297502311</id><published>2010-09-18T23:03:00.000-07:00</published><updated>2010-09-18T23:30:17.357-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-18T23:30:17.357-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="hibernate" /><category scheme="http://www.blogger.com/atom/ns#" term="osgi" /><title>Hibernate in OSGi is a definite NO NO!</title><content type="html">Recently I had the honor of trying to switch the persistence provider of our application so we can debug some performance issues and to my horrible suprise, there is no standard OSGi bundles for hibernate. Wow, with eclipselink, it was just a single jar! easy to find on eclipselink website, drop it in your auto start folder and bang! you are on your way.&lt;br /&gt;&lt;br /&gt;After spending all day googling, I found some out of date bundles in &lt;a href="http://www.springsource.com/repository/app/library/version/detail?name=org.hibernate.ejb&amp;amp;version=3.4.0.GA&amp;amp;searchType=librariesByName&amp;amp;searchQuery=hibernate"&gt;SpringSource's repository&lt;/a&gt;. Wow, how difficult is it to produce an OSGi bundle if you have managed to write the code. I was thinking its just a packaging thing. Maybe am mistaken.&lt;br /&gt;&lt;br /&gt;Anyway, after spending all that time, downloading all the gazillion dependencies manually and copying them to the felix auto start folder and also adding them to my pom file, the application finally started with all dependencies resolved.&lt;br /&gt;&lt;br /&gt;As if that was not enough , I got an exception on startup&lt;em style="font-style: italic; font-weight: bold;"&gt; &lt;/em&gt;&lt;blockquote&gt;&lt;em style="font-style: italic; font-weight: bold;"&gt;No&lt;/em&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt; Persistence &lt;/span&gt;&lt;em style="font-style: italic; font-weight: bold;"&gt;provider&lt;/em&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt; for EntityManager named ...blah blah &lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-style: italic;"&gt;What??&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;That was not enough? the persistence.xml file was there. The provider class specified in that file was there. I could clearly see it in Netbeans by just expanding the libraries tree and navigating the packages and the jar file that contained that class was also in the felix auto deploy folder.&lt;br /&gt;&lt;br /&gt;I then started another googling session. It turns out hibernate has problems with classpath&lt;span style="font-style: italic; font-weight: bold;"&gt; &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;in OSGi. Ypu have to use some thread hacking to make it see your META-INF/persistence.xml and when you finish reset the classpath to what iwas before. At that point I just gave up. Its not worth the effort. As much as I love hibernate and hibernate-Search, its just not ready for OSGi. Will reinvent my search wheel with eclipselink&lt;span style="font-style: italic; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/x5w5RIwDgAQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/9140230606297502311/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=9140230606297502311" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/9140230606297502311?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/9140230606297502311?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/x5w5RIwDgAQ/hibernate-in-osgi-is-definite-no-no.html" title="Hibernate in OSGi is a definite NO NO!" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>3</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2010/09/hibernate-in-osgi-is-definite-no-no.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D08BQng7cSp7ImA9Wx5SFkQ.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-1796699703463584706</id><published>2010-08-13T03:00:00.000-07:00</published><updated>2010-08-13T03:37:33.609-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-13T03:37:33.609-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="google" /><category scheme="http://www.blogger.com/atom/ns#" term="oracle" /><title>Is Oracle sinking the Java Boat?  Please think of us too</title><content type="html">A lot of people were wary with the Oracle Acquisition of Sun. For me, I was disappointed Sun was not acquired by a much more open source company. Oracle doesn't do open source with the heart and commitment Sun did. That is a fact!&lt;br /&gt;&lt;br /&gt;The problem started becoming apparent when the &lt;a href="http://nighthacks.com/roller/jag/entry/time_to_move_on"&gt;big java people started leaving or walking away&lt;/a&gt;. That meant these guys were not comfortable in their new home.&lt;br /&gt;&lt;br /&gt;Then it was followed by Oracle dropping some Sun products including the Sun Webspace server , &lt;a href="https://wonderland.dev.java.net/"&gt;project wonderland&lt;/a&gt; etc.&lt;br /&gt;&lt;br /&gt;Then came &lt;a href="http://wiki.netbeans.org/NetBeans_610"&gt;Netbeans scaling down&lt;/a&gt;. In the new &lt;a href="http://wiki.netbeans.org/NetBeans_610"&gt;Netbeans 6.10 document&lt;/a&gt;, the only thing you read is performance and support for Oracle specific products. Nothing substantial to increase adoption or popularity.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java.dzone.com/articles/oracle-sues-google-over"&gt;Then finally Oracle is sending Google, a prominent Java shop, to the courts&lt;/a&gt;. Imagine all those frameworks and technologies Google has developed. What does oracle intend to acheive? More Money? Scare away big companies from Java? Or just Kill Java?&lt;br /&gt;&lt;br /&gt;Who knows whats next?? Time for some Consipracy Theories.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;My Message to Oracle&lt;/span&gt;&lt;br /&gt;When making these decisions, think of the Millions of people who make a daily bread because they are able to write in Java and think of all those companies who employ them. If these companies fear to use Java, a lot of people will not be able to feed their families.&lt;br /&gt;&lt;br /&gt;Please think of the Java Community! Please DO!&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/uVMuf3DGcIE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/1796699703463584706/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=1796699703463584706" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/1796699703463584706?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/1796699703463584706?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/uVMuf3DGcIE/is-oracle-sinking-java-boat-please.html" title="Is Oracle sinking the Java Boat?  Please think of us too" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2010/08/is-oracle-sinking-java-boat-please.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIFRH8-cCp7ImA9Wx5TGE4.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-4255629764458386969</id><published>2010-08-03T01:22:00.000-07:00</published><updated>2010-08-03T03:15:15.158-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-03T03:15:15.158-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="netbeans IDE" /><category scheme="http://www.blogger.com/atom/ns#" term="netbeans" /><category scheme="http://www.blogger.com/atom/ns#" term="shortcuts" /><title>Top 10 Netbeans IDE Java Editor Shortcuts. Required for Daily Editor Usage.</title><content type="html">These are my top 10 basic Netbeans Java Editor shortcuts that I use all the time everyday.&lt;br /&gt;Hope it helps you increase your productivity.&lt;br /&gt;&lt;br /&gt;1. Commenting. (This works in all Standard IDE editors, not just the Java editor). The commenting works regardless of the language, it will comment it appropriately.  You can try it in the css editor or the XML editor&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;Select some text, press CTRL+SHIFT+C&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;If no text is selected, the current line is commented appropriately.&lt;br /&gt;&lt;br /&gt;2.Duplicate Current line.&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;With the cursor on the right line, press CTRL+SHIFT+DOWN ARROW&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;3.Find implementation of an interface&lt;br /&gt;With the cursor on the name of the interface,&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;press CTRL+ALT+B&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;When the list turns up, you can just click to open that class or use the keyboard to select and press enter&lt;br /&gt;&lt;br /&gt;4. Fix Imports&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;CTRL+SHIFT+I&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;5. Open class by name&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;CTRL+O&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;Supports Camel case search and wildcards&lt;br /&gt;To open any Resource ie css, html, text file use&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;ALT+SHIFT+O&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;6.Formatting&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;With some java code selected, press ALT+SHIF+F&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;if no code is selected, the whole class file is formatted.&lt;br /&gt;The formatting is controlled from that specified in &lt;b&gt;Tools -&gt; Options -&gt; Editor -&gt; Formatting&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;7.Rename a variable, class or method&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;Place the cursor on the variable/class/method or highlight it and press CTRL+R&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;8. Insert Some code.&lt;br /&gt;This is one of the most used  shortcut. Loads of options just appear when pressed.&lt;br /&gt;The best way to utilise them is to generate getters and setters. declare all those properties,&lt;br /&gt;and then press &lt;b&gt;ALT+INSERT(Insert Key on the keyboard)&lt;/b&gt;&lt;br /&gt;It works in a lot of editors, for example, in the html editor, you can easily generate Lorem Ipsum place holder.&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;ALT+INSERT(Insert Key on the keyboard)&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;9. Toggle Bookmark.&lt;br /&gt;This helps when your file is very large and you keep scrolling up and down.&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;Place the cursor on a line and press CTRL+SHIFT+M&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;If the line is bookmarked already, the bookmark is removed and vice versa&lt;br /&gt;&lt;br /&gt;10. Navigate bookmarks.&lt;br /&gt;You can easily jump between bookmarks by pressing &lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;CTRL+SHIFT+PERIOD(The key with the full stop on the keyboard)&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Coming up next, Letting the IDE do the unnecessary typing. Stay tuned&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/NNdogl0e-ew" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/4255629764458386969/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=4255629764458386969" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/4255629764458386969?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/4255629764458386969?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/NNdogl0e-ew/top-10-netbeans-ide-java-editor.html" title="Top 10 Netbeans IDE Java Editor Shortcuts. Required for Daily Editor Usage." /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2010/08/top-10-netbeans-ide-java-editor.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cEQ3Y_eCp7ImA9WxFVEk4.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-2390793915177980648</id><published>2010-06-10T23:20:00.000-07:00</published><updated>2010-06-10T23:50:02.840-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-10T23:50:02.840-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="netbeans" /><title>Wow, Netbeans Rocks! Now I understand why the hype</title><content type="html">Recently there have been articles where new discovers of Netbeans have gone on to write articles about how cool the IDE does this and does that.&lt;br /&gt;&lt;br /&gt;For someone who have been using netbeans on a daily basis EVERYDAY for the past four years, I found those articles to be generally boring as their new discoveries are things I have been using on a minute by minute basis for ages. To me they sounded sooo 2002..lol.&lt;br /&gt;&lt;br /&gt;Anyway, at work, everyone uses Eclipse but I refuse to budge so still use Netbeans with the checkstyle plugin so I don't get done for code formatting and it all works smoothly once you setup you editor options. The ecosystem is just perfect. By the power of maven, I don't even touch the eclipse plugin in netbeans. Its all smooth.&lt;br /&gt;&lt;br /&gt;However, one thing they always get me on is the eclipse shortcut "CTRL + SHIFT + T". Every eclipse guy knows it. At first I was a bit frustrated so I resorted to the netbeans Quick Search(CTRL + I) but its quite slow so they always moaned during code review as that circle thing kept turning and never brought the class.&lt;br /&gt;&lt;br /&gt;Then I discovered the actual netbeans equivalent of "CTRL+SHIFT+T" was actually easy to use. It is "CTRL + O". Wow. Its even shorter that theirs. So these days during code review, I just go "CTRL + O" and there the class is. To even impress them, I just use the capital letters in the class name so for example for "CodeReviewModel", I just go "CRM" and there the class is. Wow!&lt;br /&gt;&lt;br /&gt;Then they will go in which project is that class. There I am, stuck so I hover over the filename at the top of the editor and find the filepath and from there I deduce the Project.&lt;br /&gt;&lt;br /&gt;Then today it struct me. What is that "Select in" thing at the bottom of the right click menu? It usually was Code folds so you can minimize the size of the file if it was 3000 lines.&lt;br /&gt;&lt;br /&gt; I rightclicked again and there it was. I can select the file from the project, file and even in favourites!. Now, that is COOL!&lt;br /&gt;To make it even COOLER, its got shortcuts! "CTRL + SHIFT + 1 " does make it soooooo simple.&lt;br /&gt;&lt;br /&gt;I am no new user to netbeans. I even have Netbeans Platform Applications and plugins I have developed, but today am totally impressed I just thought I will let the whole world know, NETBEANS ROCKS!!&lt;br /&gt;&lt;br /&gt;NB: I use Netbeans 6.8, the official release at the time of this writing.&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/4Jl9h0Qx7eI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/2390793915177980648/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=2390793915177980648" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/2390793915177980648?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/2390793915177980648?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/4Jl9h0Qx7eI/wow-netbeans-rocks-now-i-understand-why.html" title="Wow, Netbeans Rocks! Now I understand why the hype" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>7</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2010/06/wow-netbeans-rocks-now-i-understand-why.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0ABQ3syeyp7ImA9WxBUGE0.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-3989399809716576362</id><published>2010-03-05T03:14:00.000-08:00</published><updated>2010-03-05T07:09:12.593-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-05T07:09:12.593-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="patterns" /><category scheme="http://www.blogger.com/atom/ns#" term="java ee" /><category scheme="http://www.blogger.com/atom/ns#" term="java ee 6" /><title>In the age of DRYness, how dry are you?</title><content type="html">In the age of DRYness, how dry are you. Here are 7 things to measure your DRY level.&lt;br /&gt;&lt;ol style="list-style-type: disc;"&gt;&lt;br /&gt;  &lt;li&gt;If you are using Code generators to generate CRUD functions for each of your entity controllers&lt;br /&gt;      a.k.a DAOs or Entity facades each of which defines the same CRUD code with the Entity bean&lt;br /&gt;      names changed, you are the Least DRY. Consider Generics and Delegation&lt;br /&gt;  &lt;/li&gt;&lt;br /&gt;  &lt;li&gt;If you are using EJB 2.1 on Java 1.4, you can NEVER be DRY as there is just too much artifacts&lt;br /&gt;      that are completely not reusable, ejb-jar.xml, CMP mappings, remote and local interfaces that&lt;br /&gt;      don’t do anything etc. Another reason is because that platform promotes tight-coupling more&lt;br /&gt;      than Channel4 promotes Big Brother!&lt;br /&gt;  &lt;/li&gt;&lt;br /&gt;  &lt;li&gt;If you use Strings and scriptlets to generate your HTML ouput, your chances of being unDRY are&lt;br /&gt;      above 80%&lt;br /&gt;  &lt;/li&gt;&lt;br /&gt;  &lt;li&gt;If you are using the Command Controller pattern for your EJBs Session Bean or Front Contrliler&lt;br /&gt;      Filter for your Views and using if clauses to select your handlers, you are 90% &lt;strong&gt;unDRY&lt;/strong&gt;&lt;br /&gt;  &lt;/li&gt;&lt;br /&gt;  &lt;li&gt;If all your JSP’s have the same top and bottom or if you use scriptlets to pull in the top and&lt;br /&gt;      bottom such that for every JSP, there is an ‘include’ with a filename in String at the top, you are&lt;br /&gt;      unDRY. Consider Templating&lt;br /&gt;  &lt;/li&gt;&lt;br /&gt;  &lt;li&gt;If there is a lot of casting going on in your code, you are probably not DRY. Too much generic&lt;br /&gt;      stuff that are not type safe!&lt;br /&gt;  &lt;/li&gt;&lt;br /&gt;  &lt;li&gt;If you use Strings to construct your SQL statements, no matter what you do, you are unDRY even&lt;br /&gt;      if you define them as global static final String!&lt;br /&gt;  &lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/Batn8WLW3PI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/3989399809716576362/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=3989399809716576362" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3989399809716576362?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3989399809716576362?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/Batn8WLW3PI/in-age-of-dryness-how-dry-are-you.html" title="In the age of DRYness, how dry are you?" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2010/03/in-age-of-dryness-how-dry-are-you.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4BRnc7fyp7ImA9WxBUFUQ.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-7251698760153171361</id><published>2010-03-02T20:07:00.000-08:00</published><updated>2010-03-02T20:35:57.907-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-02T20:35:57.907-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javaee 6" /><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="java ee" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="glassfish" /><category scheme="http://www.blogger.com/atom/ns#" term="jsf 2.0" /><category scheme="http://www.blogger.com/atom/ns#" term="security" /><category scheme="http://www.blogger.com/atom/ns#" term="maven" /><title>Beginning Java EE 6. JSF 2.0 Tutorial. Part 3. Implementing Security. Access Control Logic via Annotations</title><content type="html">OK. Its time for security. In the previous tutorials &lt;a&gt;Part 1&lt;/a&gt; and &lt;a&gt;Part 2&lt;/a&gt;&lt;br /&gt;we laid some foundational work. Now we are going to move into the real application development.&lt;br /&gt;&lt;br /&gt;I did an extensive search on the internet looking for best practise with regards to implementing&lt;br /&gt;security in a Java EE 6/JSF 2.0 Application. The reference samples from Sun..(Ooops Oracle..lol)&lt;br /&gt;only provide example of how to use the Authentication functions of the Container. However, in&lt;br /&gt;a real world, user access credentials and roles are mostly stored in the database and can therefore not&lt;br /&gt;be hardcoded in the web.xml file.&lt;br /&gt;&lt;br /&gt;Alternative solutions seem to use ACEGI Security for implementing Access Control Logic(ACL). However, I'm not keen on&lt;br /&gt;learning Spring at this time just to implement Security. That solution also exponentially increase the number of&lt;br /&gt;jars I have to worry about during deployment.&lt;br /&gt;&lt;br /&gt;Another alternative is to use frameworks like JBoss Seam that provide in-built ACLs but at the time of this writing,&lt;br /&gt;Seam is not compliant with the JSF2.0 Specification. Also , IMHO, this is not enough reason to adopt a full framework for this project,&lt;br /&gt;So we will implemet it ourselves.&lt;br /&gt;&lt;br /&gt;Lets get started.&lt;br /&gt;&lt;br /&gt;I assume you have read &lt;a href=""&gt;Part 1&lt;/a&gt; and &lt;a href=""&gt;Part 2&lt;/a&gt;. If you haven't please do as I will&lt;br /&gt;make a lot of assumptions to tasks such as your simplea folder location, having run setenv.bat etc.&lt;br /&gt;However, the main concept should be easy to follow without reading those previous sessions.&lt;br /&gt;&lt;br /&gt;Also we are using the JSF 2.0 reference implementation (Mojarra). If you are using a different implementation such&lt;br /&gt;as Apache myFaces, you will have to find the corresponding class names in your distribution and make the changes accordingly.&lt;br /&gt;whiles we go along, I will mention it whenever we use anything Mojarra Specific&lt;br /&gt;&lt;br /&gt;STEP 1&lt;br /&gt;&lt;br /&gt;NB. Since we are not using an IDE yet, I want to say that if I say we create a&lt;br /&gt;Java Class com.simplea.here.Foobar, I mean you should create the folder structure&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;com\simplea\here&lt;/strong&gt; in the folder &lt;strong&gt;src\main\java&lt;/strong&gt; and&lt;br /&gt;in that folder create a file with name &lt;strong&gt;Foobar.java&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Task 1.&lt;br /&gt;Add the following to your pom.xml file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: xml"&gt;&lt;![CDATA[&lt;br /&gt;    &lt;dependency&gt;&lt;br /&gt;        &lt;groupId&gt;com.sun.faces&lt;/groupId&gt;&lt;br /&gt;        &lt;artifactId&gt;jsf-impl&lt;/artifactId&gt;&lt;br /&gt;        &lt;version&gt;2.0.2&lt;/version&gt;&lt;br /&gt;        &lt;scope&gt;provided&lt;/scope&gt;&lt;br /&gt;    &lt;/dependency&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;So your complete pom.xml looks like this&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: xml"&gt;&lt;![CDATA[&lt;br /&gt;&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;&lt;br /&gt;  &lt;!-- Defining our project Basic Info--&gt;&lt;br /&gt;  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;&lt;br /&gt;  &lt;!-- Normally, the root package. So if all your classes will be like com.simplea.core,&lt;br /&gt;  com.simplea.data, you use com.simplea which is common to all of them --&gt;&lt;br /&gt;  &lt;groupId&gt;com.simplea&lt;/groupId&gt;&lt;br /&gt;  &lt;artifactId&gt;simplea&lt;/artifactId&gt;&lt;br /&gt;  &lt;!-- Identifies how we will package this application --&gt;&lt;br /&gt;  &lt;packaging&gt;war&lt;/packaging&gt;&lt;br /&gt;  &lt;!-- This is the version. At the moment, its just a snapshot--&gt;&lt;br /&gt;  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;&lt;br /&gt;  &lt;!-- Name of project --&gt;&lt;br /&gt;  &lt;name&gt;simplea&lt;/name&gt;&lt;br /&gt;  &lt;url&gt;http://maven.apache.org&lt;/url&gt;&lt;br /&gt;&lt;br /&gt;    &lt;repositories&gt;&lt;br /&gt;        &lt;!-- repository for Java EE 6 Binaries --&gt;&lt;br /&gt;        &lt;repository&gt;&lt;br /&gt;            &lt;id&gt;java.net2&lt;/id&gt;&lt;br /&gt;            &lt;name&gt;Repository hosting the jee6 artifacts&lt;/name&gt;&lt;br /&gt;            &lt;url&gt;http://download.java.net/maven/2&lt;/url&gt;&lt;br /&gt;        &lt;/repository&gt;&lt;br /&gt;   &lt;!-- repository for Primelocation Binaries --&gt;&lt;br /&gt;        &lt;repository&gt;&lt;br /&gt;            &lt;id&gt;prime-repo&lt;/id&gt;&lt;br /&gt;            &lt;name&gt;Prime Technology Maven Repository&lt;/name&gt;&lt;br /&gt;            &lt;url&gt;http://repository.prime.com.tr/&lt;/url&gt;&lt;br /&gt;            &lt;layout&gt;default&lt;/layout&gt;&lt;br /&gt;        &lt;/repository&gt;&lt;br /&gt;    &lt;/repositories&gt;&lt;br /&gt;&lt;br /&gt;    &lt;!-- Dependencies are the Libraries that our application depend on&lt;br /&gt;    they will be pulled from standard maven repositories as well as those declared above --&gt;&lt;br /&gt;    &lt;dependencies&gt;&lt;br /&gt;   &lt;!-- This dependency will bring in everything we need for JAVA EE6 --&gt;&lt;br /&gt;        &lt;dependency&gt;&lt;br /&gt;            &lt;groupId&gt;javax&lt;/groupId&gt;&lt;br /&gt;            &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;&lt;br /&gt;            &lt;version&gt;6.0&lt;/version&gt;&lt;br /&gt;            &lt;scope&gt;provided&lt;/scope&gt;&lt;br /&gt;        &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;  &lt;!-- This is not required but will aid code completion when using a Java IDE  Using provided means it will not be included in the war package--&gt;&lt;br /&gt;        &lt;dependency&gt;&lt;br /&gt;            &lt;groupId&gt;com.sun.faces&lt;/groupId&gt;&lt;br /&gt;            &lt;artifactId&gt;jsf-impl&lt;/artifactId&gt;&lt;br /&gt;            &lt;version&gt;2.0.2&lt;/version&gt;&lt;br /&gt;            &lt;scope&gt;provided&lt;/scope&gt;&lt;br /&gt;        &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- This will bring in JUNIT 3.8 jar files. they are needed by the surefire plugin which runs the tests.&lt;br /&gt;        Even if you have no tests, just add this to stay out of trouble..lol--&gt;&lt;br /&gt;        &lt;dependency&gt;&lt;br /&gt;            &lt;groupId&gt;junit&lt;/groupId&gt;&lt;br /&gt;            &lt;artifactId&gt;junit&lt;/artifactId&gt;&lt;br /&gt;            &lt;version&gt;3.8.2&lt;/version&gt;&lt;br /&gt;            &lt;scope&gt;test&lt;/scope&gt;&lt;br /&gt;        &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;   &lt;!-- This will bring in primefaces. The component library we will use. Its is great.&lt;br /&gt;  The apache Licence means you can use it and sell to anyone without trouble--&gt;&lt;br /&gt;        &lt;dependency&gt;&lt;br /&gt;            &lt;groupId&gt;org.primefaces&lt;/groupId&gt;&lt;br /&gt;            &lt;artifactId&gt;primefaces&lt;/artifactId&gt;&lt;br /&gt;            &lt;version&gt;2.0.0.RC&lt;/version&gt;&lt;br /&gt;        &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/dependencies&gt;&lt;br /&gt;    &lt;build&gt;&lt;br /&gt;        &lt;plugins&gt;&lt;br /&gt;            &lt;!-- This plugin tells maven to compile to JDK 1.6. --&gt;&lt;br /&gt;            &lt;plugin&gt;&lt;br /&gt;                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;&lt;br /&gt;                &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;&lt;br /&gt;                &lt;configuration&gt;&lt;br /&gt;                    &lt;source&gt;1.6&lt;/source&gt;&lt;br /&gt;                    &lt;target&gt;1.6&lt;/target&gt;&lt;br /&gt;                &lt;/configuration&gt;&lt;br /&gt;            &lt;/plugin&gt;&lt;br /&gt;  &lt;!-- This is to tell maven not to fail the build if web.xml is not found. Pre servlets 3.0, the web.xml was required.&lt;br /&gt;   in this current life, its not..lol--&gt;&lt;br /&gt;&lt;br /&gt;            &lt;plugin&gt;&lt;br /&gt;                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;&lt;br /&gt;                &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;&lt;br /&gt;                &lt;version&gt;2.1-beta-1&lt;/version&gt;&lt;br /&gt;                &lt;configuration&gt;&lt;br /&gt;                    &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;&lt;br /&gt;     &lt;useCache&gt;false&lt;/useCache&gt;&lt;br /&gt;                &lt;/configuration&gt;&lt;br /&gt;            &lt;/plugin&gt;&lt;br /&gt;        &lt;/plugins&gt;&lt;br /&gt;   &lt;!-- This is to tell maven the name to use for the final war. We dont want any version number and stuff in the file name--&gt;&lt;br /&gt;        &lt;finalName&gt;simplea&lt;/finalName&gt;&lt;br /&gt;    &lt;/build&gt;&lt;br /&gt;&lt;/project&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Task 1.&lt;br /&gt;create Java Class &lt;strong&gt;com.simplea.jsf.extensions.CustomApplicationFactory&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Enter the following in the file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;package com.simplea.jsf.extensions;&lt;br /&gt;&lt;br /&gt;import com.sun.faces.application.ApplicationFactoryImpl;&lt;br /&gt;import com.sun.faces.util.FacesLogger;&lt;br /&gt;import java.text.MessageFormat;&lt;br /&gt;import java.util.logging.Level;&lt;br /&gt;import java.util.logging.Logger;&lt;br /&gt;import javax.faces.application.Application;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author farouka&lt;br /&gt; */&lt;br /&gt;public class CustomApplicationFactory extends ApplicationFactoryImpl {&lt;br /&gt;&lt;br /&gt;   // Log instance for this class&lt;br /&gt;    private static final Logger logger = FacesLogger.APPLICATION.getLogger();&lt;br /&gt;&lt;br /&gt;    private volatile Application application;&lt;br /&gt;&lt;br /&gt;    public CustomApplicationFactory() {&lt;br /&gt;        super();&lt;br /&gt;    }&lt;br /&gt;    /**&lt;br /&gt;     * &lt;p&gt;Create (if needed) and return an {@link Application} instance&lt;br /&gt;     * for this web application.&lt;/p&gt;&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public Application getApplication() {&lt;br /&gt;&lt;br /&gt;        if (application == null) {&lt;br /&gt;            application = new CustomApplication();&lt;br /&gt;            if (logger.isLoggable(Level.FINE)) {&lt;br /&gt;                logger.fine(MessageFormat.format("Created Application instance ''{0}''",&lt;br /&gt;                                                 application));&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        return application;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;NB: In this class, we are overiding a sun specific class. You must replace it with the corresponding&lt;br /&gt;classname in your JSF 2.0 Implementation&lt;br /&gt;&lt;br /&gt;Task 2.&lt;br /&gt;create Java Class &lt;strong&gt;com.simplea.jsf.extensions.CustomActionListener&lt;/strong&gt;&lt;br /&gt;Enter the following in the file&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;&lt;br /&gt;package com.simplea.jsf.extensions;&lt;br /&gt;&lt;br /&gt;import com.simplea.annotations.SecuredClass;&lt;br /&gt;import com.simplea.annotations.SecuredMethod;&lt;br /&gt;import com.sun.faces.application.ActionListenerImpl;&lt;br /&gt;import com.sun.faces.application.MethodExpressionMethodBindingAdapter;&lt;br /&gt;import com.sun.faces.util.FacesLogger;&lt;br /&gt;import java.lang.reflect.Method;&lt;br /&gt;import java.text.MessageFormat;&lt;br /&gt;import java.util.Arrays;&lt;br /&gt;import java.util.logging.Level;&lt;br /&gt;import java.util.logging.Logger;&lt;br /&gt;import javax.el.ELContext;&lt;br /&gt;import javax.el.ExpressionFactory;&lt;br /&gt;import javax.el.MethodExpression;&lt;br /&gt;import javax.el.MethodInfo;&lt;br /&gt;import javax.el.ValueExpression;&lt;br /&gt;import javax.faces.application.ConfigurableNavigationHandler;&lt;br /&gt;import javax.faces.component.ActionSource;&lt;br /&gt;import javax.faces.component.UIComponent;&lt;br /&gt;import javax.faces.context.FacesContext;&lt;br /&gt;import javax.faces.el.MethodBinding;&lt;br /&gt;import javax.faces.event.ActionEvent;&lt;br /&gt;import javax.faces.event.ActionListener;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author farouka&lt;br /&gt; */&lt;br /&gt;public class CustomActionListener extends ActionListenerImpl implements ActionListener {&lt;br /&gt;&lt;br /&gt;    private static final Logger LOGGER = FacesLogger.APPLICATION.getLogger();&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public void processAction(ActionEvent event) {&lt;br /&gt;&lt;br /&gt;        if (LOGGER.isLoggable(Level.FINE)) {&lt;br /&gt;            LOGGER.fine(MessageFormat.format("processAction({0})", event.getComponent().getId()));&lt;br /&gt;        }&lt;br /&gt;        FacesContext context = FacesContext.getCurrentInstance();&lt;br /&gt;        CustomApplication application = (CustomApplication) context.getApplication();&lt;br /&gt;        //        Application application =  context.getApplication();&lt;br /&gt;        ConfigurableNavigationHandler navHandler = (ConfigurableNavigationHandler) application.getNavigationHandler();&lt;br /&gt;&lt;br /&gt;        //Action stuff&lt;br /&gt;        UIComponent source = event.getComponent();&lt;br /&gt;        ActionSource actionSource = (ActionSource) source;&lt;br /&gt;&lt;br /&gt;        MethodBinding binding;&lt;br /&gt;&lt;br /&gt;        binding = actionSource.getAction();&lt;br /&gt;        String expr = binding.getExpressionString();&lt;br /&gt;        if (!expr.startsWith("#")) {&lt;br /&gt;            super.processAction(event);&lt;br /&gt;            return;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        int idx = expr.indexOf('.');&lt;br /&gt;        String target = expr.substring(0, idx).substring(2);&lt;br /&gt;        String t = expr.substring(idx + 1);&lt;br /&gt;        String method = t.substring(0, (t.length() - 1));&lt;br /&gt;&lt;br /&gt;        MethodExpression expression = new MethodExpressionMethodBindingAdapter(binding);&lt;br /&gt;        ELContext elContext = context.getELContext();&lt;br /&gt;        ExpressionFactory factory = context.getApplication().getExpressionFactory();&lt;br /&gt;        ValueExpression ve = factory.createValueExpression(elContext,&lt;br /&gt;                "#{" + target + '}',&lt;br /&gt;                Object.class);&lt;br /&gt;        Object result = ve.getValue(elContext);&lt;br /&gt;&lt;br /&gt;        // Check if the target class is a secured method and act accordingly&lt;br /&gt;        if (result.getClass().isAnnotationPresent(SecuredClass.class)) {&lt;br /&gt;            if (application.getSecurityManager().isAuthenticated()) {&lt;br /&gt;                super.processAction(event);&lt;br /&gt;            } else {&lt;br /&gt;                //Redirect to login page&lt;br /&gt;                navHandler.handleNavigation(context, null, "login");&lt;br /&gt;                context.renderResponse();&lt;br /&gt;            }&lt;br /&gt;        } else {&lt;br /&gt;            // Check if the target method is a secured method&lt;br /&gt;            // and check security accordingly&lt;br /&gt;            Method[] methods = result.getClass().getMethods();&lt;br /&gt;            for (Method meth : methods) {&lt;br /&gt;                if (meth.getName().equals(method)/**&lt;br /&gt;                        &amp;&amp; meth.getReturnType().equals(controlInfo.getReturnType())&lt;br /&gt;                        &amp;&amp; Arrays.equals(meth.getParameterTypes(),&lt;br /&gt;                        controlInfo.getParamTypes()) */) {&lt;br /&gt;                    if (meth.isAnnotationPresent(SecuredMethod.class)) {&lt;br /&gt;                        //        NavigationCase navCase = navHandler.getNavigationCase(context, null, null);&lt;br /&gt;                        if (application.getSecurityManager().isAuthenticated()) {&lt;br /&gt;                            super.processAction(event);&lt;br /&gt;                        } else {&lt;br /&gt;                            //Redirect to login page&lt;br /&gt;                            navHandler.handleNavigation(context, null, "login");&lt;br /&gt;                            context.renderResponse();&lt;br /&gt;                            return;&lt;br /&gt;                        }&lt;br /&gt;                    } else {&lt;br /&gt;                        super.processAction(event);&lt;br /&gt;                    }&lt;br /&gt;                    break;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Task 3.&lt;br /&gt;create Java Class &lt;strong&gt;com.simplea.jsf.extensions.CustomApplication&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Enter the following in the file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;package com.simplea.jsf.extensions;&lt;br /&gt;&lt;br /&gt;import com.simplea.security.SecurityManager;&lt;br /&gt;import com.sun.faces.application.ApplicationImpl;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author farouka&lt;br /&gt; */&lt;br /&gt;public class CustomApplication extends ApplicationImpl{&lt;br /&gt;&lt;br /&gt;    private SecurityManager securityManager;&lt;br /&gt;&lt;br /&gt;    public CustomApplication() {&lt;br /&gt;        super();&lt;br /&gt;        securityManager = new SecurityManager();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public SecurityManager getSecurityManager() {&lt;br /&gt;        return securityManager;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setSecurityManager(SecurityManager securityManager) {&lt;br /&gt;        this.securityManager = securityManager;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Task 4.&lt;br /&gt;create Java Class &lt;strong&gt;com.simplea.security.SecurityManager&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Enter the following in the file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;package com.simplea.security;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author farouka&lt;br /&gt; */&lt;br /&gt;public class SecurityManager {&lt;br /&gt;&lt;br /&gt;    private boolean authenticated = false;&lt;br /&gt;&lt;br /&gt;    public boolean isAuthenticated() {&lt;br /&gt;        return authenticated;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public boolean authenticate(/**AbstractDatasource String,**/&lt;br /&gt;            UsernamePasswordCredentials credentials){&lt;br /&gt;   //TODO Will be implemented after database has been set up&lt;br /&gt;        authenticated = true;&lt;br /&gt;        return authenticated;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;The authenticate method is overloaded to accept different Security credentials depending on the client environment&lt;br /&gt;At the moment it will only take UsernamePasswordCredentials so lets go ahead and create it&lt;br /&gt;&lt;br /&gt;Task 5.&lt;br /&gt;create Java Class &lt;strong&gt;com.simplea.security.UsernamePasswordCredentials&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Enter the following in the file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;package com.simplea.security;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author farouka&lt;br /&gt; */&lt;br /&gt;public class UsernamePasswordCredentials {&lt;br /&gt;&lt;br /&gt;    private String username;&lt;br /&gt;&lt;br /&gt;    private String password;&lt;br /&gt;&lt;br /&gt;    public UsernamePasswordCredentials() {&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public UsernamePasswordCredentials(String username, String password) {&lt;br /&gt;        this.username = username;&lt;br /&gt;        this.password = password;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    public String getPassword() {&lt;br /&gt;        return password;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setPassword(String password) {&lt;br /&gt;        this.password = password;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public String getUsername() {&lt;br /&gt;        return username;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setUsername(String username) {&lt;br /&gt;        this.username = username;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public boolean equals(Object obj) {&lt;br /&gt;        if (obj == null) {&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;        if (getClass() != obj.getClass()) {&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;        final UsernamePasswordCredentials other = (UsernamePasswordCredentials) obj;&lt;br /&gt;        if ((this.username == null) ? (other.username != null) : !this.username.equals(other.username)) {&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;        if ((this.password == null) ? (other.password != null) : !this.password.equals(other.password)) {&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;        return true;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public int hashCode() {&lt;br /&gt;        int hash = 5;&lt;br /&gt;        hash = 89 * hash + (this.username != null ? this.username.hashCode() : 0);&lt;br /&gt;        hash = 89 * hash + (this.password != null ? this.password.hashCode() : 0);&lt;br /&gt;        return hash;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Task 5.&lt;br /&gt;create Java Class &lt;strong&gt;com.simplea.annotations.SecuredClass&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Enter the following in the file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;package com.simplea.annotations;&lt;br /&gt;&lt;br /&gt;import java.lang.annotation.ElementType;&lt;br /&gt;import java.lang.annotation.Retention;&lt;br /&gt;import java.lang.annotation.RetentionPolicy;&lt;br /&gt;import java.lang.annotation.Target;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author farouka&lt;br /&gt; */&lt;br /&gt;@Target( ElementType.TYPE )&lt;br /&gt;@Retention( RetentionPolicy.RUNTIME )&lt;br /&gt;public @interface  SecuredClass {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Task 6.&lt;br /&gt;create Java Class &lt;strong&gt;com.simplea.annotations.SecuredMethod&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Enter the following in the file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;package com.simplea.annotations;&lt;br /&gt;&lt;br /&gt;import java.lang.annotation.ElementType;&lt;br /&gt;import java.lang.annotation.Retention;&lt;br /&gt;import java.lang.annotation.RetentionPolicy;&lt;br /&gt;import java.lang.annotation.Target;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author farouka&lt;br /&gt; */&lt;br /&gt;@Target( ElementType.METHOD )&lt;br /&gt;@Retention( RetentionPolicy.RUNTIME )&lt;br /&gt;public @interface  SecuredMethod {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Task 7.&lt;br /&gt;create Java Class &lt;strong&gt;com.simplea.handler.DashboardHandler&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Enter the following in the file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;package com.simplea.handler;&lt;br /&gt;&lt;br /&gt;import com.simplea.annotations.SecuredMethod;&lt;br /&gt;import javax.faces.bean.ManagedBean;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author farouka&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;@ManagedBean(name = "dashboardHandler")&lt;br /&gt;public class DashboardHandler {&lt;br /&gt;&lt;br /&gt; @SecuredMethod&lt;br /&gt;    public String view() {&lt;br /&gt;        return "dashboard";&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;This Handler has the SecuredClass Annotation on it. That means no method on it should&lt;br /&gt;be called without being logged in. At the moment that is what we will use to test our SecuredClass Annotation&lt;br /&gt;&lt;br /&gt;Task 8.&lt;br /&gt;create Java Class &lt;strong&gt;com.simplea.handler.LoginHandler&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Enter the following in the file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;&lt;br /&gt;package com.simplea.handler;&lt;br /&gt;&lt;br /&gt;import com.simplea.jsf.extensions.CustomApplication;&lt;br /&gt;import com.simplea.annotations.SecuredMethod;&lt;br /&gt;import com.simplea.security.UsernamePasswordCredentials;&lt;br /&gt;import javax.faces.bean.ManagedBean;&lt;br /&gt;import javax.faces.bean.RequestScoped;&lt;br /&gt;import javax.faces.context.FacesContext;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author farouka&lt;br /&gt; */&lt;br /&gt;@ManagedBean(name = "loginHandler")&lt;br /&gt;@RequestScoped&lt;br /&gt;public class LoginHandler {&lt;br /&gt;&lt;br /&gt;    private String username;&lt;br /&gt;&lt;br /&gt;    private String password;&lt;br /&gt;&lt;br /&gt;    /** Creates a new instance of LoginHandler */&lt;br /&gt;    public LoginHandler() {&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public String login() {&lt;br /&gt;        System.out.println("username="+username);&lt;br /&gt;        System.out.println("password="+password);&lt;br /&gt;        UsernamePasswordCredentials credentials =&lt;br /&gt;                new UsernamePasswordCredentials(username, password);&lt;br /&gt;        FacesContext context = FacesContext.getCurrentInstance();&lt;br /&gt;        CustomApplication application = (CustomApplication) context.getApplication();&lt;br /&gt;        if (application.getSecurityManager().authenticate(credentials)) {&lt;br /&gt;            return "dashboard.xhtml?faces-redirect=true";&lt;br /&gt;        } else {&lt;br /&gt;            return null;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public String getPassword() {&lt;br /&gt;        return password;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setPassword(String password) {&lt;br /&gt;        this.password = password;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public String getUsername() {&lt;br /&gt;        return username;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setUsername(String username) {&lt;br /&gt;        this.username = username;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;The Login Handler does not have any of our security annotations so you can click the login button.&lt;br /&gt;&lt;br /&gt;Now lets test our classes to make sure they compile.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;All these instructions are on the Command Prompt&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Run &lt;strong&gt;setenv.bat&lt;/strong&gt;. &lt;i&gt;I assume you know how to do that.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Then cd to your &lt;strong&gt;simplea&lt;/strong&gt; folder.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;From now on, when I say type an mvn command, I will assume you have run &lt;strong&gt;setenv.bat&lt;/strong&gt; in your current command prompt, and changed directory to the root of the &lt;strong&gt;simplea&lt;/strong&gt; application folder&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;type command&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;mvn compile&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;If that does not produce any errors, then you are good to proceed to the next Step. Make sure your code&lt;br /&gt;compiles before proceeding to Step 2.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;STEP 2&lt;/h3&gt;&lt;br /&gt;This is the site security story at the moment. To be built on.&lt;br /&gt;Any user can access the &lt;strong&gt;index.xhtml&lt;/strong&gt; and &lt;strong&gt;login.xhtml&lt;/strong&gt; pages without having to log in.&lt;br /&gt;&lt;br /&gt;To access the &lt;strong&gt;dashboard.xhtml&lt;/strong&gt; page, the user must be logged in. At the moment, since only the &lt;strong&gt;LoginHandler&lt;/strong&gt;&lt;br /&gt;calls the securityManager.authenticate(), we will assume the user has logged in. In the next session when&lt;br /&gt;we integrate a database, we will finish that up.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;We accomplish the security requirements for the &lt;strong&gt;dashboard.xhtml&lt;/strong&gt; by just annotating the DashboardHandler&lt;br /&gt;with &lt;strong&gt;@SecuredClass&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;1.a) Create a file in the &lt;strong&gt;src\main\webapp\WEB-INF&lt;/strong&gt; folder called &lt;strong&gt;faces-config.xml&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1.b) Enter the following into that file&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: xml"&gt;&lt;![CDATA[&lt;br /&gt;&lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- =========== FULL CONFIGURATION FILE ================================== --&gt;&lt;br /&gt;&lt;faces-config version="2.0"&lt;br /&gt;              xmlns="http://java.sun.com/xml/ns/javaee"&lt;br /&gt;              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"&gt;&lt;br /&gt;    &lt;factory&gt;&lt;br /&gt;        &lt;application-factory&gt;&lt;br /&gt;            com.simplea.jsf.extensions.CustomApplicationFactory&lt;br /&gt;        &lt;/application-factory&gt;&lt;br /&gt;    &lt;/factory&gt;&lt;br /&gt;    &lt;application&gt;&lt;br /&gt;        &lt;action-listener&gt;&lt;br /&gt;            com.simplea.jsf.extensions.CustomActionListener&lt;br /&gt;        &lt;/action-listener&gt;&lt;br /&gt;    &lt;/application&gt;&lt;br /&gt;&lt;br /&gt;&lt;/faces-config&gt;&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;2.a) Create a file in the  &lt;strong&gt;src\main\webapp&lt;/strong&gt; folder called &lt;strong&gt;login.xhtml&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;2.b) Enter the following into that file&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&lt;br /&gt;   xmlns:h="http://java.sun.com/jsf/html"&lt;br /&gt;      xmlns:p="http://primefaces.prime.com.tr/ui"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;&lt;br /&gt;&lt;title&gt;SimpleA limited&lt;/title&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/reset.css" /&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/960.css" /&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/styles.css" /&gt;&lt;br /&gt;&lt;p:resources /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;h:form&gt;&lt;br /&gt;&lt;div class="container_12"&gt;&lt;br /&gt;&lt;br /&gt; &lt;!--Header Div --&gt;&lt;br /&gt; &lt;div class="grid_12" style="align:left;"&gt;&lt;br /&gt;  &lt;h1&gt;&lt;a href="#"&gt;Simplea&lt;/a&gt;&lt;/h1&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!-- END HeaderDiv --&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Navbar Div --&gt;&lt;br /&gt; &lt;div class="grid_12" id="navbar"&gt;&lt;br /&gt;  &lt;ul&gt;&lt;br /&gt;   &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;   &lt;li&gt;&lt;h:commandLink action="#{dashboardHandler.view}" value="Dashboard" /&gt;&lt;/li&gt;&lt;br /&gt;   &lt;li&gt;About&lt;/li&gt;&lt;br /&gt;  &lt;/ul&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!-- End Navbar Div--&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Stories Area--&gt;&lt;br /&gt; &lt;div class="grid_3"&gt;&lt;br /&gt;  &lt;h2&gt;&lt;a href="#"&gt;Sidebar&lt;/a&gt;&lt;/h2&gt;&lt;br /&gt;  &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.&lt;/p&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="grid_9"&gt;&lt;br /&gt;  &lt;h2&gt;Login&lt;/h2&gt;&lt;br /&gt;              &lt;div id="login-content"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                    &lt;div class="notification information png_bg"&gt;&lt;br /&gt;                        &lt;div&gt;&lt;br /&gt;     Enter you access credentials&lt;br /&gt;                        &lt;/div&gt;&lt;br /&gt;                    &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;                    &lt;p&gt;&lt;br /&gt;                        &lt;h:outputLabel value="Username" for="username"  /&gt;&lt;br /&gt;                        &lt;h:inputText styleClass="text-input" id="username" value="#{loginHandler.username}" required="true" requiredMessage="Enter your username" /&gt;&lt;br /&gt;                    &lt;/p&gt;&lt;br /&gt;                    &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt;                    &lt;p&gt;&lt;br /&gt;                        &lt;p&gt;&lt;br /&gt;                            &lt;h:outputLabel value="Password" for="password"  /&gt;&lt;br /&gt;                            &lt;h:inputSecret styleClass="text-input" id="password" value="#{loginHandler.password}" required="true" requiredMessage="Enter your password" /&gt;&lt;br /&gt;                        &lt;/p&gt;&lt;br /&gt;                    &lt;/p&gt;&lt;br /&gt;                    &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt;                    &lt;p&gt;&lt;br /&gt;                        &lt;h:commandButton styleClass="button"  id="nav2" action="#{loginHandler.login}" value="Login" type="submit"/&gt;&lt;br /&gt;                    &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            &lt;/div&gt; &lt;!-- End #login-content --&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!--End Stories Area--&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Footer --&gt;&lt;br /&gt; &lt;div class="grid_12" id="footer"&gt;&lt;br /&gt;  &lt;div class="grid_4 alpha"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="grid_4"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="grid_4 omega"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!--End Stories Area--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div id="legal"&gt;&lt;br /&gt; &lt;p&gt;Simplea&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/h:form&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;3.a) Create a file in the  &lt;strong&gt;src\main\webapp&lt;/strong&gt; folder called &lt;strong&gt;dashboard.xhtml&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;3.b) Enter the following into that file&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&lt;br /&gt;   xmlns:h="http://java.sun.com/jsf/html"&lt;br /&gt;      xmlns:p="http://primefaces.prime.com.tr/ui"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;&lt;br /&gt;&lt;title&gt;SimpleA limited&lt;/title&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/reset.css" /&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/960.css" /&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/styles.css" /&gt;&lt;br /&gt;&lt;p:resources /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;h:form&gt;&lt;br /&gt;&lt;div class="container_12"&gt;&lt;br /&gt;&lt;br /&gt; &lt;!--Header Div --&gt;&lt;br /&gt; &lt;div class="grid_12" style="align:left;"&gt;&lt;br /&gt;  &lt;h1&gt;&lt;a href="#"&gt;Simplea&lt;/a&gt;&lt;/h1&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!-- END HeaderDiv --&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Navbar Div --&gt;&lt;br /&gt; &lt;div class="grid_12" id="navbar"&gt;&lt;br /&gt;  &lt;ul&gt;&lt;br /&gt;   &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;   &lt;li&gt;&lt;h:commandLink action="#{dashboardHandler.view}" value="Dashboard" /&gt;&lt;/li&gt;&lt;br /&gt;   &lt;li&gt;About&lt;/li&gt;&lt;br /&gt;  &lt;/ul&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!-- End Navbar Div--&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Stories Area--&gt;&lt;br /&gt; &lt;div class="grid_3"&gt;&lt;br /&gt;  &lt;h2&gt;&lt;a href="#"&gt;Sidebar&lt;/a&gt;&lt;/h2&gt;&lt;br /&gt;  &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.&lt;/p&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="grid_9"&gt;&lt;br /&gt;  &lt;h2&gt;Welcome to the Dashboard&lt;/h2&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!--End Stories Area--&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Footer --&gt;&lt;br /&gt; &lt;div class="grid_12" id="footer"&gt;&lt;br /&gt;  &lt;div class="grid_4 alpha"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="grid_4"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="grid_4 omega"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!--End Stories Area--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div id="legal"&gt;&lt;br /&gt; &lt;p&gt;Simplea&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/h:form&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;We need to update the &lt;strong&gt;index.xhtml&lt;/strong&gt; to include links to those pages&lt;br /&gt;&lt;br /&gt;4. Delete the content of the &lt;strong&gt;index.xhtml&lt;/strong&gt; and insert the following&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&lt;br /&gt;   xmlns:h="http://java.sun.com/jsf/html"&lt;br /&gt;      xmlns:p="http://primefaces.prime.com.tr/ui"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;&lt;br /&gt;&lt;title&gt;SimpleA limited&lt;/title&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/reset.css" /&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/960.css" /&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/styles.css" /&gt;&lt;br /&gt;&lt;p:resources /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;h:form&gt;&lt;br /&gt;&lt;div class="container_12"&gt;&lt;br /&gt; &lt;!--Header Div --&gt;&lt;br /&gt; &lt;div class="grid_12" style="align:left;"&gt;&lt;br /&gt;  &lt;h1&gt;&lt;a href="#"&gt;Simplea&lt;/a&gt;&lt;/h1&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!-- END HeaderDiv --&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Navbar Div --&gt;&lt;br /&gt; &lt;div class="grid_12" id="navbar"&gt;&lt;br /&gt;  &lt;ul&gt;&lt;br /&gt;   &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;   &lt;li&gt;&lt;h:commandLink action="#{dashboardHandler.view}" value="Dashboard" /&gt;&lt;/li&gt;&lt;br /&gt;   &lt;li&gt;About&lt;/li&gt;&lt;br /&gt;  &lt;/ul&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!-- End Navbar Div--&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Stories Area--&gt;&lt;br /&gt; &lt;div class="grid_3"&gt;&lt;br /&gt;  &lt;h2&gt;&lt;a href="#"&gt;Sidebar&lt;/a&gt;&lt;/h2&gt;&lt;br /&gt;  &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.&lt;/p&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="grid_9"&gt;&lt;br /&gt;  &lt;h2&gt;&lt;a href="#"&gt;Main Section&lt;/a&gt;&lt;/h2&gt;&lt;br /&gt;  &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.&lt;/p&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!--End Stories Area--&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Footer --&gt;&lt;br /&gt; &lt;div class="grid_12" id="footer"&gt;&lt;br /&gt;  &lt;div class="grid_4 alpha"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="grid_4"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="grid_4 omega"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!--End Stories Area--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div id="legal"&gt;&lt;br /&gt; &lt;p&gt;Simplea&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/h:form&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;NB&lt;br /&gt;&lt;strong&gt;I am sure you have noticed the repetition in those pages and are wondering why dont we templatize them.Yes, we will do that&lt;br /&gt;when we start actually designing the site. At this stage, its important we don't deviate.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Step 3&lt;/h3&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Undeploy Deploy.&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;Our undeploy deploy sequence is becoming repetitive so i have created a batch file to do that for us&lt;br /&gt;&lt;br /&gt;In the folder &lt;strong&gt;C:\home\training\simplea&lt;/strong&gt;, create a file called &lt;strong&gt;undeploy_deploy.bat&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Enter the following into that file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;&lt;br /&gt;cd C:\home&lt;br /&gt;&lt;br /&gt;rem setenv.bat&lt;br /&gt;&lt;br /&gt;cd C:\home\training\simplea&lt;br /&gt;&lt;br /&gt;call mvn package&lt;br /&gt;&lt;br /&gt;cd C:\home\training\glassfishv3\glassfish\bin&lt;br /&gt;&lt;br /&gt;call asadmin undeploy simplea&lt;br /&gt;&lt;br /&gt;call asadmin deploy C:\home\training\simplea\target\simplea.war&lt;br /&gt;&lt;br /&gt;cd C:\home\training\simplea&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Also, I have updated &lt;strong&gt;C:\home\setenv.bat&lt;/strong&gt; so the default path is in the application folder&lt;br /&gt;So open it and replace the content with this&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;&lt;br /&gt;rem Make sure your JAVA_HOME points to a correct Java Installation without the bin&lt;br /&gt;set JAVA_HOME=L:\home\apps_dev\java\jdk1.6_u18&lt;br /&gt;set PATH=%PATH%;%JAVA_HOME%\bin&lt;br /&gt;&lt;br /&gt;set M2_HOME=C:\home\training\apache-maven-2.2.1&lt;br /&gt;set PATH=%PATH%;%M2_HOME%\bin&lt;br /&gt;&lt;br /&gt;cd C:\home\training\simplea&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Make sure Glassfish is running &lt;i&gt;Instructions on doing that is available in the previous sessions&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Open comand prompt, change directory to &lt;strong&gt;C:\home\training\simplea&lt;/strong&gt; and type&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;undeploy_deploy.bat&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;and press enter&lt;br /&gt;&lt;br /&gt;Now browse to&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;http://localhost:8080/simplea&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;You will observe that clicking the dashboard take you to the login screen. Just enter anything&lt;br /&gt;to login. Then you will be taken to the dashboard. Also see that once logged in, clicking the dashboard link&lt;br /&gt;doesn't require you to login again.&lt;br /&gt;&lt;br /&gt;In the next installation of this series,&lt;br /&gt;&lt;br /&gt;We will integrate a Database,(Mysql 5) and JPA. Then we will complete this security by doing a proper check&lt;br /&gt;from the database and acting according. Stay Tuned&lt;br /&gt;&lt;br /&gt;&lt;br/&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/0_EzuJM72uE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/7251698760153171361/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=7251698760153171361" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/7251698760153171361?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/7251698760153171361?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/0_EzuJM72uE/beginning-java-ee-6-tutorial-part-3.html" title="Beginning Java EE 6. JSF 2.0 Tutorial. Part 3. Implementing Security. Access Control Logic via Annotations" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>3</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2010/03/beginning-java-ee-6-tutorial-part-3.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIHSXo8fCp7ImA9WxBUFUQ.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-7728694292052162785</id><published>2010-02-28T11:03:00.000-08:00</published><updated>2010-03-02T20:28:58.474-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-02T20:28:58.474-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javaee 6" /><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="development" /><category scheme="http://www.blogger.com/atom/ns#" term="java ee" /><category scheme="http://www.blogger.com/atom/ns#" term="glassfish" /><category scheme="http://www.blogger.com/atom/ns#" term="jsf 2.0" /><category scheme="http://www.blogger.com/atom/ns#" term="maven" /><title>Beginning Java EE 6. Hand Holding Learning Trail Part 2. (JSF 2.0, Maven, Glassfish, Primefaces)</title><content type="html">In the previous &lt;a title="Beginning Java EE 6. Hand Holding Learning Trail (JSF 2.0, Maven, Glassfish, Primefaces) " href="http://cameotutorials.blogspot.com/2010/02/beginning-java-ee-6-hand-holding.html" target="_blank"&gt;session&lt;/a&gt; we setup the skeleton of our simplea application.&lt;br /&gt;In this installation, we will add a bit of Layout to the user interface before the next major atticle which&lt;br /&gt;wil takle centralising Access control and security.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;NB&lt;/strong&gt;&lt;br /&gt;This is only to beautify the look and feel. We will look at 'componentising' and taking advantage of&lt;br /&gt;facelets in a future session. I actually dont feel easy just leaving it as this but in order not to be distracted&lt;br /&gt;we will stay with this for now.&lt;br /&gt;&lt;br /&gt;Lets get Rolling.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;    This is a continuation of a series. Please read the previous post to get a feel of what we are up to from &lt;a  title="Beginning Java EE 6. Hand Holding Learning Trail (JSF 2.0, Maven, Glassfish, Primefaces) " href="http://cameotutorials.blogspot.com/2010/02/beginning-java-ee-6-hand-holding.html" target="_blank"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3 title="Integrating 960 CSS framework"&gt;TASK 1&lt;/h3&gt;&lt;br /&gt;Integrating 960 CSS framework.&lt;br /&gt;&lt;br /&gt;As you may know, programmers are normally very bad at design and I am no exception. The 960 css framework is a grid framework that&lt;br /&gt;allows you to position containers(divs) and other objects on your page very easily without having to worry about advanced CSS&lt;br /&gt;&lt;br /&gt;It is a production ready open source CSS framework. Read More about it from &lt;a href="http://960.gs/" target="_blank"&gt;here&lt;/a&gt;&lt;br /&gt;So we will use that for our simplea application. I am hoping to create composite components for the 960 framework&lt;br /&gt;later in this series.&lt;br /&gt;OK, here we go.&lt;br /&gt;&lt;br /&gt;1. In the &lt;strong&gt;src\main\webapp&lt;/strong&gt; folder (this is a relative to the simplea folder), create&lt;br /&gt;&lt;br /&gt;   another folder called css.&lt;br /&gt;&lt;br /&gt;2. Download the Zip version of 960 grid framework from &lt;a href="http://github.com/nathansmith/960-Grid-System/zipball/master" target="_blank"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;3. Extract the ziped file into a folder.&lt;br /&gt;&lt;br /&gt;4. In the &lt;strong&gt;code\css&lt;/strong&gt; folder, copy the file &lt;strong&gt;960.css&lt;/strong&gt; and&lt;strong&gt; reset.css&lt;/strong&gt; to the css folder created in step 1.&lt;br /&gt;&lt;br /&gt;5. In the same folder ie &lt;strong&gt;code\css&lt;/strong&gt;, create a file called &lt;strong&gt;styles.css&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Enter the following in that file&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: css"&gt;&lt;![CDATA[&lt;br /&gt;div#navbar, div.spacer {&lt;br /&gt; margin-top: 10px;&lt;br /&gt; margin-bottom: 10px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div#navbar {&lt;br /&gt; background-color: #8FC73E;&lt;br /&gt; padding: 10px 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div#navbar ul {&lt;br /&gt; list-style: none;&lt;br /&gt; display: block;&lt;br /&gt; margin: 0 10px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div#navbar ul li {&lt;br /&gt; float: left;&lt;br /&gt; margin: 0 1.5em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div.spacer {&lt;br /&gt; background-color: #8FC73E;&lt;br /&gt; height: 1em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div.topSection div {&lt;br /&gt; border: solid 10px #e5e5e6;&lt;br /&gt; height: 280px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div.topSection div p {&lt;br /&gt; margin: 10px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;img#poster {&lt;br /&gt; width: 360px;&lt;br /&gt; height: 280px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div#footer {&lt;br /&gt; background-color: #e5e5e6;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div#footer div p{&lt;br /&gt; margin: 5px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div#legal {&lt;br /&gt; clear:both;&lt;br /&gt; margin: 10px;&lt;br /&gt;}&lt;br /&gt;/************************ Typography ***************/&lt;br /&gt;&lt;br /&gt;div#navbar ul li {&lt;br /&gt; font: bold 1em Arial;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;p {&lt;br /&gt; font: .8em/1.4em Georgia;&lt;br /&gt; margin: .2em 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;p#headlineText {&lt;br /&gt; font: .9em/1.4em Georgia;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div#legal p {&lt;br /&gt; text-align:center;&lt;br /&gt; font: bold .7em Arial;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;h1 {&lt;br /&gt; font: bold 1.5em Helvetica;&lt;br /&gt; margin: .2em 0;&lt;br /&gt; text-align: center;&lt;br /&gt;}&lt;br /&gt;a {&lt;br /&gt; color: #1162b7;&lt;br /&gt; text-decoration: none;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;h2 {&lt;br /&gt; font: bold 1.3em Helvetica;&lt;br /&gt; margin: .2em 0;&lt;br /&gt; text-align: center;&lt;br /&gt;}&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;6. Open the &lt;strong&gt;index.xhtml&lt;/strong&gt; file created in the previous session and enter this&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&lt;br /&gt;      xmlns:p="http://primefaces.prime.com.tr/ui"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;&lt;br /&gt;&lt;title&gt;SimpleA limited&lt;/title&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/reset.css" /&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/960.css" /&gt;&lt;br /&gt;&lt;link rel="stylesheet" type="text/css" media="all" href="css/styles.css" /&gt;&lt;br /&gt;&lt;p:resources /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="container_12"&gt;&lt;br /&gt; &lt;!--Header Div --&gt;&lt;br /&gt; &lt;div class="grid_12" style="align:left;"&gt;&lt;br /&gt;  &lt;h1&gt;&lt;a href="#"&gt;Simplea&lt;/a&gt;&lt;/h1&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!-- END HeaderDiv --&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Navbar Div --&gt;&lt;br /&gt; &lt;div class="grid_12" id="navbar"&gt;&lt;br /&gt;  &lt;ul&gt;&lt;br /&gt;   &lt;li&gt;Articles&lt;/li&gt;&lt;br /&gt;   &lt;li&gt;Contact Us&lt;/li&gt;&lt;br /&gt;   &lt;li&gt;About&lt;/li&gt;&lt;br /&gt;  &lt;/ul&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!-- End Navbar Div--&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Stories Area--&gt;&lt;br /&gt; &lt;div class="grid_3"&gt;&lt;br /&gt;  &lt;h2&gt;&lt;a href="#"&gt;Sidebar&lt;/a&gt;&lt;/h2&gt;&lt;br /&gt;  &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.&lt;/p&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="grid_9"&gt;&lt;br /&gt;  &lt;h2&gt;&lt;a href="#"&gt;Main Section&lt;/a&gt;&lt;/h2&gt;&lt;br /&gt;  &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.&lt;/p&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!--End Stories Area--&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Footer --&gt;&lt;br /&gt; &lt;div class="grid_12" id="footer"&gt;&lt;br /&gt;  &lt;div class="grid_4 alpha"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="grid_4"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="grid_4 omega"&gt;&lt;br /&gt;   &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus&lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div class="clear"&gt;&lt;/div&gt;&lt;br /&gt; &lt;!--End Stories Area--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div id="legal"&gt;&lt;br /&gt; &lt;p&gt;Simplea&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;7. Create a package:&lt;br /&gt;&lt;br /&gt;First cd into C:\home directory&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;cd C:\home&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;Run &lt;strong&gt;setenv.bat&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;type setenv.bat and hit the enter key&lt;br /&gt;&lt;br /&gt;Then cd into &lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;C:\home\training\simplea&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;then type &lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;mvn package&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Now Start Glasfish by typing&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;cd C:\home\training\glassfishv3\glassfish\bin&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;then type&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;asadmin start-domain&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;make sure previous version is uninstalled by typing&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;asadmin undeploy simplea&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;then type&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;asadmin deploy C:\home\training\simplea\target\simplea.war&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;then browse to&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;http://localhost:8080/simplea/&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;to see the application&lt;br /&gt;&lt;br /&gt;You can now shutdown glassfish by typing&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;asadmin stop-domain&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;That brings us of the end of today's seesion.&lt;br /&gt;&lt;br /&gt;Coming Up&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Login and security in JSF 2.0. Stay tuned&lt;/strong&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/ilA13vzMfhQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/7728694292052162785/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=7728694292052162785" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/7728694292052162785?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/7728694292052162785?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/ilA13vzMfhQ/beginning-java-ee-6-hand-holding_28.html" title="Beginning Java EE 6. Hand Holding Learning Trail Part 2. (JSF 2.0, Maven, Glassfish, Primefaces)" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2010/02/beginning-java-ee-6-hand-holding_28.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcARnY4fyp7ImA9WxBUE0U.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-4026305466299169213</id><published>2010-02-19T13:19:00.001-08:00</published><updated>2010-02-28T11:07:27.837-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-28T11:07:27.837-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javaee 6" /><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="primefaces" /><category scheme="http://www.blogger.com/atom/ns#" term="java ee" /><category scheme="http://www.blogger.com/atom/ns#" term="jsf 2.0" /><category scheme="http://www.blogger.com/atom/ns#" term="maven" /><title>Beginning Java EE 6. Hand Holding Learning Trail  (JSF 2.0, Maven, Glassfish, Primefaces)</title><content type="html">In this series and few more to follow, I will be posting on how to get started&lt;br /&gt;with Java EE 6, JSF 2.0, Maven, Glasfish V3, Primefaces 2.0 and related frameworks.&lt;br /&gt;This is just part of my effort to know it more. As I try to teach you,&lt;br /&gt;I will be teaching myself even more. Lets get started.&lt;br /&gt;&lt;br /&gt;I will try as much as possible not to use any IDE for now. Just plain text editor&lt;br /&gt;so we can understand the basics.&lt;br /&gt;&lt;br /&gt;This is to help us understand the structure of the whole web application.&lt;br /&gt;Once we are done and we start using an IDE (Netbeans 4 Me), you will realise you have much control&lt;br /&gt;you have over what you are doing because you understand how it all comes together.&lt;br /&gt;&lt;br /&gt;Ok. Lets Run&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ONE GOTCHA&lt;/strong&gt;&lt;br /&gt;Windows Notepad has the habit of adding .txt to my xml files which caused me a lot of trouble&lt;br /&gt;untill I realised the files were being named wrongly. eg web.xml.txt.&lt;br /&gt;&lt;br /&gt;Make sure your files are actually .xml and .xhtml files as windows will still tell&lt;br /&gt;you they are even when they are not. (I used &lt;a href="http://sourceforge.net/projects/notepad-plus/"&gt;notepad++&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;PART 1&lt;/h3&gt;&lt;br /&gt;Setting up our environment&lt;br /&gt;I will not be jack of all trades. I will only use Windows. If you are using linux&lt;br /&gt;or some other platform you must look for the equivalent commands.&lt;br /&gt;&lt;br /&gt;Create the folder&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;    c:\home\training&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;This will be our Workspace will be&lt;br /&gt;(Just make sure you understand what you are doing if you have to choose settings&lt;br /&gt;to suit your environment)&lt;br /&gt;I will generally work from c:\&lt;br /&gt;Change the drive letters to suit your environment&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Task 1. Install Java&lt;/h4&gt;&lt;br /&gt;Get Java from our old(rebranded) site. Make sure your version is &amp;gt;= 1.6 update 17&lt;br /&gt;Get 1.6 update 18(the latest at the time of writing) from here&lt;br /&gt;&lt;a href="http://java.sun.com/javase/downloads/widget/jdk6.jsp"&gt;http://java.sun.com/javase/downloads/widget/jdk6.jsp&lt;/a&gt;&lt;br /&gt;Install it to so your JAVA_HOME becomes&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;C:\home\training\java\jdk1.6_u18&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;I will not install it because I already have it installed but it should be very easy.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Task 2. Install Glassfish V3 (Zip Version)&lt;/h4&gt;&lt;br /&gt;Download Glassfish V3(Zip Version). The zip version will help us to understand how things work&lt;br /&gt; even more. Also we can easily clean up our environment easily if we dont need it.&lt;br /&gt;Get the full zip (Not the Web profile) from&lt;br /&gt;&lt;a href="http://download.java.net/glassfish/v3/release/glassfish-v3.zip"&gt;http://download.java.net/glassfish/v3/release/glassfish-v3.zip&lt;/a&gt;&lt;br /&gt;NB: the web profile will do but as I'm new to this, I will stay out of trouble for now&lt;br /&gt;Save it to&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;C:\home\training&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;Right-click and extract it so that, after its done, your glassfish home will be&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;C:\home\training\glassfishv3&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;Open notepad or any editor and type the following&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;cd C:\home\training&lt;br /&gt;&lt;br /&gt;rem Make sure your JAVA_HOME points to a correct Java Installation without the bin&lt;br /&gt;set JAVA_HOME=C:\home\training\java\jdk1.6_u18&lt;br /&gt;set PATH=%PATH%;%JAVA_HOME%\bin&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;and save it as &lt;b&gt;setenv.bat&lt;/b&gt; in the folder &lt;b&gt;C:\home&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Task 3. Install Maven&lt;/h4&gt;&lt;br /&gt;Download Maven from one of the mirrors here&lt;br /&gt;&lt;a href="http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-2.2.1-bin.zip"&gt;http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-2.2.1-bin.zip&lt;/a&gt;&lt;br /&gt;and save it.&lt;br /&gt;Then extract it such that your maven home folder will be&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;C:\home\training\apache-maven-2.2.1&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;Open your &lt;b&gt;setenv.bat&lt;/b&gt; in the folder &lt;b&gt;C:\home&lt;/b&gt;&lt;br /&gt;and add the following&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;set M2_HOME=C:\home\training\apache-maven-2.2.1&lt;br /&gt;set PATH=%PATH%;%M2_HOME%\bin&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;So your whole setenv.bat file will look like&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;cd C:\home\training&lt;br /&gt;&lt;br /&gt;rem Make sure your JAVA_HOME points to a correct Java Installation without the bin&lt;br /&gt;set JAVA_HOME=C:\home\training\java\jdk1.6_u18&lt;br /&gt;set PATH=%PATH%;%JAVA_HOME%\bin&lt;br /&gt;&lt;br /&gt;set M2_HOME=C:\home\training\apache-maven-2.2.1&lt;br /&gt;set PATH=%PATH%;%M2_HOME%\bin&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;Now open Command Prompt(I guess you know how to do that..lol)&lt;br /&gt;and type each of the following, press enter after each command(Don't copy and paste)&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;c:&lt;br /&gt;&lt;br /&gt;cd c:\home&lt;br /&gt;&lt;br /&gt;setenv.bat&lt;br /&gt;&lt;br /&gt;java -version&lt;br /&gt;&lt;br /&gt;mvn -version&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;You should get something like this after your last command&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;C:\home\training&amp;gt;mvn -version&lt;br /&gt;Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100)&lt;br /&gt;Java version: 1.6.0_18&lt;br /&gt;Java home: C:\home\training\java\jdk1.6_u18\jre&lt;br /&gt;Default locale: en_GB, platform encoding: Cp1252&lt;br /&gt;OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"&lt;br /&gt;C:\home\training&amp;gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;Our environment is almost set.&lt;br /&gt;Lets test our glassfish.&lt;br /&gt;With our command prompt still opened(&lt;strong&gt;If you closed it, make sure you run setenv.bat to set your environment and cd to the training folder before you proceed.)&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;type&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;cd C:\home\training\glassfishv3\glassfish\bin&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;then type&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;asadmin start-domain&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;then browse to &lt;a href="http://localhost:4848/"&gt;http://localhost:4848/&lt;/a&gt;&lt;br /&gt;You should see glassfish loading.&lt;br /&gt;For now, If we get a modal box asking us to register we will not register,so just do remind me later.&lt;br /&gt;Hopefully, you will see a very nice man in a boat with a paddle.&lt;br /&gt;That is the test. If you see that, you have completed part 1.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;PART 2 Creating the Skeleton of the Application&lt;/h3&gt;&lt;br /&gt;On the command prompt&lt;br /&gt;&lt;br /&gt;type&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;cd C:\home\training&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;the type&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.simplea -DartifactId=simplea&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;then press Enter&lt;br /&gt;This is a wrapped version so you can understand it. Use the one above to stay out of trouble&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;mvn archetype:create \&lt;br /&gt;  -DarchetypeGroupId=org.apache.maven.archetypes \&lt;br /&gt;  -DgroupId=com.mycompany.app \&lt;br /&gt;  -DartifactId=my-app&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Maven will go off to do some stuff. You will get some messages on the console and the you will see&lt;br /&gt;Build Successful. Yes. The Skeleton is now created.&lt;br /&gt;&lt;br /&gt;Maven will generate standard maven project into our training folder.&lt;br /&gt;&lt;br /&gt;The folder structure of the maven generated project is as shown below&lt;br /&gt;&lt;img src="http://www.faroukalhassan.com/screenshots/maven_skeleton.jpg" alt="Skeleton of a maven application"/&gt;&lt;br /&gt;&lt;br /&gt;Open the pom.xml with your favourite editor . Delete the whole content and just paste this there.&lt;br /&gt;(You can also just copy the parts you just need but to make sure we all make&lt;br /&gt;the same mistakes, just change it all)&lt;br /&gt;&lt;br /&gt;I have put a lot of comments in the pom.xml to explain each part so you can adapt it to suit your needs&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;&lt;br /&gt;  &lt;!-- Defining our project Basic Info--&gt;&lt;br /&gt;  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;&lt;br /&gt;  &lt;!-- Normally, the root package. So if all your classes will be like com.simplea.core,&lt;br /&gt;  com.simplea.data, you use com.simplea which is common to all of them --&gt;&lt;br /&gt;  &lt;groupId&gt;com.simplea&lt;/groupId&gt;&lt;br /&gt;  &lt;artifactId&gt;simplea&lt;/artifactId&gt;&lt;br /&gt;  &lt;!-- Identifies how we will package this application --&gt;&lt;br /&gt;  &lt;packaging&gt;war&lt;/packaging&gt;&lt;br /&gt;  &lt;!-- This is the version. At the moment, its just a snapshot--&gt;&lt;br /&gt;  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;&lt;br /&gt;  &lt;!-- Name of project --&gt;&lt;br /&gt;  &lt;name&gt;simplea&lt;/name&gt;&lt;br /&gt;  &lt;url&gt;http://maven.apache.org&lt;/url&gt;&lt;br /&gt;&lt;br /&gt;    &lt;repositories&gt;&lt;br /&gt;        &lt;!-- repository for Java EE 6 Binaries --&gt;&lt;br /&gt;        &lt;repository&gt;&lt;br /&gt;            &lt;id&gt;java.net2&lt;/id&gt;&lt;br /&gt;            &lt;name&gt;Repository hosting the jee6 artifacts&lt;/name&gt;&lt;br /&gt;            &lt;url&gt;http://download.java.net/maven/2&lt;/url&gt;&lt;br /&gt;        &lt;/repository&gt;&lt;br /&gt;   &lt;!-- repository for Primelocation Binaries --&gt;&lt;br /&gt;        &lt;repository&gt;&lt;br /&gt;            &lt;id&gt;prime-repo&lt;/id&gt;&lt;br /&gt;            &lt;name&gt;Prime Technology Maven Repository&lt;/name&gt;&lt;br /&gt;            &lt;url&gt;http://repository.prime.com.tr/&lt;/url&gt;&lt;br /&gt;            &lt;layout&gt;default&lt;/layout&gt;&lt;br /&gt;        &lt;/repository&gt;&lt;br /&gt;    &lt;/repositories&gt;&lt;br /&gt;&lt;br /&gt;    &lt;!-- Dependencies are the Libraries that our application depend on&lt;br /&gt;    they will be pulled from standard maven repositories as well as those declared above --&gt;&lt;br /&gt;    &lt;dependencies&gt;&lt;br /&gt;   &lt;!-- This dependency will bring in everything we need for JAVA EE6 --&gt;&lt;br /&gt;        &lt;dependency&gt;&lt;br /&gt;            &lt;groupId&gt;javax&lt;/groupId&gt;&lt;br /&gt;            &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;&lt;br /&gt;            &lt;version&gt;6.0&lt;/version&gt;&lt;br /&gt;            &lt;scope&gt;provided&lt;/scope&gt;&lt;br /&gt;        &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- This will bring in JUNIT 3.8 jar files. they are needed by the surefire plugin which runs the tests.&lt;br /&gt;        Even if you have no tests, just add this to stay out of trouble..lol--&gt;&lt;br /&gt;        &lt;dependency&gt;&lt;br /&gt;            &lt;groupId&gt;junit&lt;/groupId&gt;&lt;br /&gt;            &lt;artifactId&gt;junit&lt;/artifactId&gt;&lt;br /&gt;            &lt;version&gt;3.8.2&lt;/version&gt;&lt;br /&gt;            &lt;scope&gt;test&lt;/scope&gt;&lt;br /&gt;        &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;   &lt;!-- This will bring in primefaces. The component library we will use. Its is great.&lt;br /&gt;  The apache Licence means you can use it and sell to anyone without trouble--&gt;&lt;br /&gt;        &lt;dependency&gt;&lt;br /&gt;            &lt;groupId&gt;org.primefaces&lt;/groupId&gt;&lt;br /&gt;            &lt;artifactId&gt;primefaces&lt;/artifactId&gt;&lt;br /&gt;            &lt;version&gt;2.0.0.RC&lt;/version&gt;&lt;br /&gt;        &lt;/dependency&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/dependencies&gt;&lt;br /&gt;    &lt;build&gt;&lt;br /&gt;        &lt;plugins&gt;&lt;br /&gt;            &lt;!-- This plugin tells maven to compile to JDK 1.6. --&gt;&lt;br /&gt;            &lt;plugin&gt;&lt;br /&gt;                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;&lt;br /&gt;                &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;&lt;br /&gt;                &lt;configuration&gt;&lt;br /&gt;                    &lt;source&gt;1.6&lt;/source&gt;&lt;br /&gt;                    &lt;target&gt;1.6&lt;/target&gt;&lt;br /&gt;                &lt;/configuration&gt;&lt;br /&gt;            &lt;/plugin&gt;&lt;br /&gt;  &lt;!-- This is to tell maven not to fail the build if web.xml is not found. Pre servlets 3.0, the web.xml was required.&lt;br /&gt;   in this current life, its not..lol--&gt;&lt;br /&gt;&lt;br /&gt;            &lt;plugin&gt;&lt;br /&gt;                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;&lt;br /&gt;                &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;&lt;br /&gt;                &lt;version&gt;2.1-beta-1&lt;/version&gt;&lt;br /&gt;                &lt;configuration&gt;&lt;br /&gt;                    &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;&lt;br /&gt;     &lt;useCache&gt;false&lt;/useCache&gt;&lt;br /&gt;                &lt;/configuration&gt;&lt;br /&gt;            &lt;/plugin&gt;&lt;br /&gt;        &lt;/plugins&gt;&lt;br /&gt;   &lt;!-- This is to tell maven the name to use for the final war. We dont want any version number and stuff in the file name--&gt;&lt;br /&gt;        &lt;finalName&gt;simplea&lt;/finalName&gt;&lt;br /&gt;    &lt;/build&gt;&lt;br /&gt;&lt;/project&gt;&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Inside the main folder create another two subfolders&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;resources&lt;br /&gt;webapp&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;In the webapp folder, create another sub folder called WEB-INF&lt;br /&gt;&lt;br /&gt;In the WEB-INF folder, create a new file called web.xml&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;&lt;strong&gt;For servlet 3.0, web.xml is not required. However, you need a way to specify your welcome file and also, the custom tags were not getting processed if i used .xhtml files instead of jsp &lt;br/&gt; When we understand it more, we will know why it didn't work&lt;/strong&gt;&lt;br /&gt;So your entire directory structure will look like this:&lt;br /&gt;The folder structure of the maven generated project is as shown below&lt;br /&gt;&lt;img src="http://www.faroukalhassan.com/screenshots/maven_web_app.jpg" alt="Maven Web Application Directory Structure"/&gt;&lt;br /&gt;&lt;br /&gt;Open the web.xml in your favourite editor and enter the following&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;br /&gt;&lt;br /&gt;&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"&lt;br /&gt;         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&lt;br /&gt;         version="3.0"&gt;&lt;br /&gt;    &lt;display-name&gt;simplea&lt;/display-name&gt;&lt;br /&gt;    &lt;session-config&gt;&lt;br /&gt;        &lt;session-timeout&gt;&lt;br /&gt;            30&lt;br /&gt;        &lt;/session-timeout&gt;&lt;br /&gt;    &lt;/session-config&gt;&lt;br /&gt;&lt;br /&gt;    &lt;servlet&gt;&lt;br /&gt;        &lt;servlet-name&gt;Resource Servlet&lt;/servlet-name&gt;&lt;br /&gt;        &lt;servlet-class&gt;org.primefaces.resource.ResourceServlet&lt;/servlet-class&gt;&lt;br /&gt;    &lt;/servlet&gt;&lt;br /&gt;    &lt;servlet&gt;&lt;br /&gt;        &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;&lt;br /&gt;        &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;&lt;br /&gt;        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;&lt;br /&gt;    &lt;/servlet&gt;&lt;br /&gt;&lt;br /&gt;    &lt;servlet-mapping&gt;&lt;br /&gt;        &lt;servlet-name&gt;Resource Servlet&lt;/servlet-name&gt;&lt;br /&gt;        &lt;url-pattern&gt;/primefaces_resource/*&lt;/url-pattern&gt;&lt;br /&gt;    &lt;/servlet-mapping&gt;&lt;br /&gt;    &lt;servlet-mapping&gt;&lt;br /&gt;        &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;&lt;br /&gt;        &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;&lt;br /&gt;    &lt;/servlet-mapping&gt;&lt;br /&gt;&lt;br /&gt;    &lt;context-param&gt;&lt;br /&gt;        &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt;&lt;br /&gt;        &lt;param-value&gt;Development&lt;/param-value&gt;&lt;br /&gt;    &lt;/context-param&gt;&lt;br /&gt;    &lt;context-param&gt;&lt;br /&gt;        &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;&lt;br /&gt;        &lt;param-value&gt;server&lt;/param-value&gt;&lt;br /&gt;    &lt;/context-param&gt;&lt;br /&gt;&lt;br /&gt;    &lt;welcome-file-list&gt;&lt;br /&gt;        &lt;welcome-file&gt;index.xhtml&lt;/welcome-file&gt;&lt;br /&gt;    &lt;/welcome-file-list&gt;&lt;br /&gt;&lt;br /&gt;&lt;/web-app&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;In the webapp folder, create a new file called index.xhtml&lt;br /&gt;Open it in your editor and enter the following&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&lt;br /&gt;      xmlns:p="http://primefaces.prime.com.tr/ui"&gt;&lt;br /&gt;    &lt;head&gt;&lt;br /&gt;        &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt;&lt;br /&gt;        &lt;title&gt;PrimeFaces Test&lt;/title&gt;&lt;br /&gt;        &lt;p:resources /&gt;&lt;br /&gt;    &lt;/head&gt;&lt;br /&gt;    &lt;body&gt;&lt;br /&gt;        &lt;p&gt;&lt;br /&gt;            &lt;p:editor /&gt;&lt;br /&gt;        &lt;/p&gt;&lt;br /&gt;    &lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;]]&gt;&lt;/script&gt; &lt;br /&gt;Now our basic application is almost complete.&lt;br /&gt;Now cd into simplea folder by typing&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;cd c:\home\training\simplea&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;    make sure you run cd c:\home\setenv.bat if you closed you Command Prompt&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;then type&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;mvn package&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;I all goes well, You will see the build successfull message on the screen.&lt;br /&gt;That will create our war file:&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;C:\home\training\simplea\target\simplea.war&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;h4&gt;Task 4. Installing the war file in glassfish&lt;/h4&gt;&lt;br /&gt;&lt;strong&gt;NOTE &lt;/strong&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;   If you shut it down, restart it using the instructions above . If you are doing that&lt;br /&gt;make sure you run c:\home\setenv.bat before.&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;Now whiles Glassfish is running&lt;br /&gt;Now go to&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;http://localhost:4848/&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;On the left sidebar, click on Applications&lt;br /&gt;Click on the deploy button&lt;br /&gt;On the next page, leave the selected radio button and click browse&lt;br /&gt;Browse to C:\home\training\simplea\target and select simplea.war and click open.&lt;br /&gt;When you return, leave all the defaults, scroll to the bottom and click ok.&lt;br /&gt;That should take you back to the applications list page&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Task 5. Enable and Run&lt;/h4&gt;&lt;br /&gt;On the applications list just tick checkbox for simplea and click enable.&lt;br /&gt;When the notification comes that the application is snabled,&lt;br /&gt;Just click launch to see the application&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Task 5. Shut down Glassfish&lt;/h4&gt;&lt;br /&gt;type&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;cd C:\home\training\glassfishv3\glassfish\bin&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;then type&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;asadmin stop-domain&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;Coming up next. &lt;a title="Java EE 6 JSF 2.0 Designing Homepage" href="http://cameotutorials.blogspot.com/2010/02/beginning-java-ee-6-hand-holding_28.html"&gt;Designing the homepage and the Login&lt;/a&gt;.&lt;br /&gt;Stay tuned&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/-nGnfYyd7e4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/4026305466299169213/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=4026305466299169213" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/4026305466299169213?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/4026305466299169213?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/-nGnfYyd7e4/beginning-java-ee-6-hand-holding.html" title="Beginning Java EE 6. Hand Holding Learning Trail  (JSF 2.0, Maven, Glassfish, Primefaces)" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2010/02/beginning-java-ee-6-hand-holding.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEYCRHo8eSp7ImA9WxBVF0o.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-250580058039529427</id><published>2009-09-10T05:08:00.000-07:00</published><updated>2010-02-21T10:16:05.471-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-21T10:16:05.471-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="izpack" /><category scheme="http://www.blogger.com/atom/ns#" term="lunch4j" /><category scheme="http://www.blogger.com/atom/ns#" term="ant" /><title>IzPack Installation Script Example,  with Lunch4j, Ant integration, Java Service Wrapper and Windows Service</title><content type="html">My IzPack installation script that I use for my installer has changed tremendously to integrate easily with our production system which needed installation environment properties defined in a properties file instead of being supplied by the customer. With this system, the client defines all the variables in the properties file and supply the packed zip file at installation time. The Zip file is created by us from a Technical&amp;nbsp;questionnaire(TQ)&amp;nbsp;given to the client at the project initiation phase. This way, we control all the parameters and customer does not make any input during the installation. We also have a Java Service wrapper file to install it automatically as a service. The file is parsed by the IzPack script to insert all the variables. We currently use this to integrate into more than ten different LLPG and NLPG systems.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CHANGE THE PATHS TO SUIT YOUR ENVIRONMENT&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;So here I will post my scripts: build.xml&lt;/i&gt; &lt;br /&gt;&lt;br /&gt;Ant Integration Task&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;    &lt;target name="build-dev-installer" depends="deploy_zip,create-dev-installer"&gt;&lt;br /&gt;    &lt;/target&gt;&lt;br /&gt;    &lt;target name="create-dev-installer" description="Create Windows Installer"&gt;&lt;br /&gt;        &lt;echo message=" "/&gt;&lt;br /&gt;        &lt;echo message="Setting property and task for installer creation" /&gt;&lt;br /&gt;        &lt;taskdef name="launch4j"   classname="net.sf.launch4j.ant.Launch4jTask"&lt;br /&gt;                 classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar"/&gt;&lt;br /&gt;        &lt;echo message=" "/&gt;&lt;br /&gt;        &lt;echo message="Preparing ...." /&gt;&lt;br /&gt;        &lt;delete dir="${packaging.dir}"/&gt;&lt;br /&gt;        &lt;mkdir dir="${packaging.dir}" /&gt;&lt;br /&gt;        &lt;mkdir dir="${packaging.build.dir}" /&gt;&lt;br /&gt;        &lt;copy todir="${deploy.dir}" file="${catalina.source}" failonerror="true"/&gt;&lt;br /&gt;        &lt;copy todir="${packaging.dir}"&gt;&lt;br /&gt;            &lt;fileset dir="installer"&gt;&lt;br /&gt;                &lt;include name="nizpack.xml"/&gt;&lt;br /&gt;                &lt;include name="launch4jConfig.xml"/&gt;&lt;br /&gt;                &lt;include name="launcher.ini"/&gt;&lt;br /&gt;            &lt;/fileset&gt;&lt;br /&gt;            &lt;fileset dir="src/web"&gt;&lt;br /&gt;                &lt;include name="lalpac.ico"/&gt;&lt;br /&gt;                &lt;include name="lal_Logo3d.gif"/&gt;&lt;br /&gt;            &lt;/fileset&gt;&lt;br /&gt;        &lt;/copy&gt;&lt;br /&gt;        &lt;replace dir="${packaging.dir}"&gt;&lt;br /&gt;            &lt;include name="*.xml"/&gt;&lt;br /&gt;            &lt;replacefilter token="[APP-NAME]" value="${app.name}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[BUILD-VERSION]" value="${build.version}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[APP-VERSION]" value="${app.version}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[APP-PATH]" value="${app.subpath}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[JAVA-VERSION]" value="${java.version.minimum}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[APP-URL]" value="${app.url}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[APP-AUTHOR]" value="${app.author}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[APP-CONTACT]" value="${app.contact}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[CATALINA-VERSION]" value="${catalina.version}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[CATALINA-SOURCE]" value="${catalina.source}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[FILE-NAME]" value="${izpack-installer}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[DEPLOY]" value="${deploy.win}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[PACKAGING_BUILD]" value="${packaging.build.dir}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[COPY_RIGHT]" value="${app.copyright}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[ANT_HOME]" value="${ant.dir}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[PACK_SOURCE]" value="${deploy.dir}" /&gt;&lt;br /&gt;            &lt;replacefilter token="[PKG_DEV]" value="${deploy.dir}" /&gt;&lt;br /&gt;        &lt;/replace&gt;&lt;br /&gt;        &lt;echo message=" "/&gt;  &lt;br /&gt;        &lt;echo message="Makes the installer using IzPack to ${izpack-installer}"/&gt;&lt;br /&gt;        &lt;izpack input="${basedir}/${packaging.dir}/nizpack.xml"&lt;br /&gt;                output="${deploy.dir}/${izpack-installer}"&lt;br /&gt;                installerType="standard"&lt;br /&gt;                basedir="${basedir}"&lt;br /&gt;                izPackDir="${izpack.dir}/"/&gt;&lt;br /&gt;        &lt;echo message=" Creating Launch4j Pack"/&gt;&lt;br /&gt;        &lt;mkdir dir="${ms.install.dev}/${ms.package.name}" /&gt;&lt;br /&gt;        &lt;launch4j configFile="${packaging.dir}/launch4jConfig.xml"/&gt;&lt;br /&gt;        &lt;echo message=" "/&gt;&lt;br /&gt;        &lt;echo message="cleaning and finalizing release" /&gt;&lt;br /&gt;        &lt;delete dir="${packaging.dir}"/&gt;&lt;br /&gt;    &lt;/target&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;i&gt;The IzPack Script: nizpack.zml&lt;/i&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;    &lt;installation version="1.0"&gt; &lt;br /&gt;        &lt;info&gt;   &lt;br /&gt;            &lt;appname&gt;[APP-NAME]&lt;/appname&gt;   &lt;br /&gt;            &lt;appversion&gt;[APP-VERSION]&lt;/appversion&gt; &lt;br /&gt;            &lt;appsubpath&gt;[APP-PATH]&lt;/appsubpath&gt;   &lt;br /&gt;            &lt;javaversion&gt;[JAVA-VERSION]&lt;/javaversion&gt;  &lt;br /&gt;            &lt;summarylogfilepath&gt;$INSTALL_PATH/installinfo/Summary.htm&lt;/summarylogfilepath&gt;    &lt;br /&gt;            &lt;url&gt;[APP-URL]&lt;/url&gt;    &lt;br /&gt;            &lt;authors&gt;      &lt;br /&gt;                &lt;author name="[APP-AUTHOR]" email="[APP-CONTACT]"/&gt;   &lt;br /&gt;            &lt;/authors&gt; &lt;br /&gt;        &lt;/info&gt; &lt;br /&gt;        &lt;guiprefs width="700" height="530" resizable="yes"&gt;    &lt;br /&gt;            &lt;modifier key="useLabelIcons" value="no"/&gt;  &lt;br /&gt;            &lt;modifier key="useHeadingPanel" value="yes"/&gt;  &lt;br /&gt;            &lt;modifier key="headingLineCount" value="1"/&gt; &lt;br /&gt;            &lt;modifier key="headingFontSize" value="2"/&gt;  &lt;br /&gt;            &lt;modifier key="useFlags" value="no"/&gt;   &lt;br /&gt;            &lt;modifier key="langDisplayType" value="native"/&gt; &lt;br /&gt;            &lt;modifier key="allYGap" value="8"/&gt;   &lt;br /&gt;            &lt;modifier key="allXGap" value="4"/&gt;   &lt;br /&gt;            &lt;modifier key="labelGap" value="2"/&gt;  &lt;br /&gt;            &lt;modifier key="headingPanelCounter" value="progressbar"/&gt;  &lt;br /&gt;            &lt;modifier key="headingPanelCounterPos" value="inNavigationPanel"/&gt; &lt;br /&gt;        &lt;/guiprefs&gt; &lt;br /&gt;        &lt;locale&gt;  &lt;br /&gt;            &lt;langpack iso3="eng"/&gt;  &lt;br /&gt;        &lt;/locale&gt; &lt;br /&gt;        &lt;native name="ShellLink.dll" type="izpack"&gt; &lt;br /&gt;            &lt;os family="windows"/&gt;  &lt;br /&gt;        &lt;/native&gt; &lt;br /&gt;        &lt;native name="COIOSHelper.dll" stage="both" type="3rdparty"&gt;  &lt;br /&gt;            &lt;os family="windows"/&gt; &lt;br /&gt;        &lt;/native&gt; &lt;br /&gt;        &lt;listeners&gt;   &lt;br /&gt;            &lt;listener installer="RegistryInstallerListener" uninstaller="RegistryUninstallerListener"&gt;    &lt;br /&gt;                &lt;os family="windows"/&gt;   &lt;br /&gt;            &lt;/listener&gt;   &lt;br /&gt;            &lt;listener installer="AntActionInstallerListener" uninstaller="AntActionUninstallerListener"/&gt; &lt;br /&gt;        &lt;/listeners&gt;  &lt;br /&gt;        &lt;!-- Conditions --&gt;  &lt;br /&gt;        &lt;conditions&gt;  &lt;br /&gt;            &lt;condition type="variable" id="condition.qas.gbr"&gt; &lt;br /&gt;                &lt;name&gt;connector.type&lt;/name&gt;  &lt;br /&gt;                &lt;value&gt;QAS_GBR_V6&lt;/value&gt;  &lt;br /&gt;            &lt;/condition&gt;   &lt;br /&gt;            &lt;condition type="variable" id="condition.qas.lpg"&gt;    &lt;br /&gt;                &lt;name&gt;connector.type&lt;/name&gt;   &lt;br /&gt;                &lt;value&gt;QAS_LPG_V6&lt;/value&gt;  &lt;br /&gt;            &lt;/condition&gt;   &lt;br /&gt;            &lt;condition type="variable" id="start.addresshub"&gt;    &lt;br /&gt;                &lt;name&gt;start_addresshub&lt;/name&gt;   &lt;br /&gt;                &lt;value&gt;true&lt;/value&gt;  &lt;br /&gt;            &lt;/condition&gt;  &lt;br /&gt;            &lt;condition type="variable" id="condition.mvm"&gt;  &lt;br /&gt;                &lt;name&gt;connector.type&lt;/name&gt;    &lt;br /&gt;                &lt;value&gt;MVM&lt;/value&gt; &lt;br /&gt;            &lt;/condition&gt;   &lt;br /&gt;            &lt;condition type="variable" id="condition.sql"&gt; &lt;br /&gt;                &lt;name&gt;connector.type&lt;/name&gt;   &lt;br /&gt;                &lt;value&gt;SQL&lt;/value&gt;  &lt;br /&gt;            &lt;/condition&gt; &lt;br /&gt;        &lt;/conditions&gt;  &lt;br /&gt;        &lt;!-- Variables --&gt;  &lt;dynamicvariables&gt;  &lt;br /&gt;            &lt;variable name="TOMCAT_HOME" value="$INSTALL_PATH\$TOMCAT_VER"/&gt;   &lt;br /&gt;            &lt;variable name="JDK_HOME" value="${jdk.home}"/&gt;   &lt;br /&gt;            &lt;variable name="TEMP_HOME" value="$INSTALL_PATH\temp"/&gt;  &lt;br /&gt;            &lt;variable name="JDKPathPanel.minVersion" value="1.5"/&gt;  &lt;br /&gt;            &lt;variable name="JDKPathPanel.maxVersion" value="1.5"/&gt;&lt;br /&gt;            &lt;variable name="JDKPathPanel.skipIfValid" value="yes"/&gt;  &lt;br /&gt;            &lt;variable name="ADDRESSHUB_CONF_FILE" value="${addresshub.file}"/&gt;  &lt;br /&gt;        &lt;/dynamicvariables&gt; &lt;br /&gt;        &lt;variables&gt;   &lt;br /&gt;            &lt;variable name="TOMCAT_VER" value="[CATALINA-VERSION]"/&gt; &lt;br /&gt;        &lt;/variables&gt;&lt;br /&gt;        &lt;resources&gt;   &lt;br /&gt;            &lt;res src="installer/ProcessPanel.Spec.xml" id="ProcessPanel.Spec.xml"/&gt; &lt;br /&gt;            &lt;!-- res src="installer/shortcutSpec.xml" id="shortcutSpec.xml"/ --&gt;  &lt;br /&gt;            &lt;res src="installer/UserInput.Spec.xml" id="userInputSpec.xml" /&gt;  &lt;br /&gt;            &lt;res src="installer/antActionsSpec.xml" id="AntActionsSpec.xml" /&gt;   &lt;br /&gt;            &lt;res id="Heading.image" src="src/web/lalpac-logo-cms.png"/&gt; &lt;br /&gt;        &lt;/resources&gt; &lt;br /&gt;        &lt;panels&gt;  &lt;br /&gt;            &lt;panel classname="HelloPanel"/&gt;   &lt;br /&gt;            &lt;panel classname="TargetPanel"/&gt;   &lt;br /&gt;            &lt;panel classname="UserInputPanel" id="Connector.Select"/&gt; &lt;br /&gt;            &lt;panel classname="InstallPanel"/&gt;  &lt;br /&gt;            &lt;!-- panel classname="ShortcutPanel"/ --&gt;  &lt;br /&gt;            &lt;panel classname="SimpleFinishPanel"/&gt; &lt;br /&gt;        &lt;/panels&gt; &lt;br /&gt;        &lt;packs&gt;  &lt;br /&gt;            &lt;pack name="Installing Selected Packages" required="yes"&gt;  &lt;br /&gt;                &lt;description&gt;LalPac Addresshub core installation.&lt;/description&gt;&lt;br /&gt;                &lt;file targetdir="$INSTALL_PATH" src="[PACK_SOURCE]/[CATALINA-VERSION].zip" unpack="true"/&gt;   &lt;br /&gt;                &lt;file targetdir="$INSTALL_PATH/[CATALINA-VERSION]" src="[PACK_SOURCE]/lalpac-tomcat-customised.zip" unpack="true"/&gt;    &lt;br /&gt;                &lt;file targetdir="$INSTALL_PATH/[CATALINA-VERSION]" src="[PACK_SOURCE]/lalpac-tomcat-nt-service.zip" unpack="true"/&gt;  &lt;br /&gt;                &lt;singlefile target="$INSTALL_PATH/temp/installer_scripts.xml" src="installer/installer_scripts.xml"/&gt;     &lt;br /&gt;                &lt;parsable type="plain" parse="yes" targetfile="$INSTALL_PATH/[CATALINA-VERSION]/conf/wrapper.conf"/&gt;      &lt;br /&gt;                &lt;parsable type="at" targetfile="$INSTALL_PATH/temp/installer_scripts.xml" parse="yes"/&gt;   &lt;br /&gt;                &lt;file targetdir="$INSTALL_PATH/temp" src="[PACK_SOURCE]/lalpac-tomcat.zip" unpack="true"/&gt;   &lt;br /&gt;                &lt;singlefile target="$INSTALL_PATH/temp/web.xml" src="src/conf/dist.web_1.xml"/&gt;    &lt;br /&gt;                &lt;singlefile target="$INSTALL_PATH/temp/server.xml" src="src/conf/dist.server.win.xml"/&gt;   &lt;br /&gt;                &lt;singlefile target="$INSTALL_PATH/temp/qas/QAWSERVE_GBR.INI" src="src/conf/qas/dist.QAWSERVE_GBR.INI"/&gt;    &lt;br /&gt;                &lt;singlefile target="$INSTALL_PATH/temp/qas/QAWSERVE_LPG.INI" src="src/conf/qas/dist.QAWSERVE_LPG.INI"/&gt;     &lt;br /&gt;                &lt;singlefile target="$INSTALL_PATH/temp/qas/QAWORLD.INI" src="src/conf/qas/QAWORLD_dist.INI"/&gt;   &lt;br /&gt;                &lt;parsable type="plain" parse="yes" targetfile="$INSTALL_PATH/temp/qas/QAWORLD.INI"/&gt;   &lt;br /&gt;        &lt;/pack&gt;  &lt;/packs&gt;  &lt;jar src="[ANT_HOME]/lib/ant.jar" stage="both"/&gt;  &lt;br /&gt;        &lt;jar src="[ANT_HOME]/lib/ant-launcher.jar" stage="both"/&gt;&lt;br /&gt;    &lt;/installation&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;The Packing Time Ant Integration Script which invokes the ant script: AntActionsSpec.xml&lt;/i&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;    &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;br /&gt;    &lt;antactions&gt;&lt;br /&gt;        &lt;pack name="Installing Selected Packages"&gt; &lt;br /&gt;            &lt;antcall order="afterpacks" buildfile="$TEMP_HOME/installer_scripts.xml" logfile="$TEMP_HOME/ant-log.txt" verbose="yes"&gt;  &lt;br /&gt;                &lt;property name="extract_from" value="$ADDRESSHUB_CONF_FILE"/&gt;   &lt;br /&gt;                &lt;property name="extract_to" value="$TEMP_HOME"/&gt; &lt;br /&gt;                &lt;target name="extract"/&gt; &lt;br /&gt;            &lt;/antcall&gt; &lt;br /&gt;            &lt;antcall order="afterpacks" buildfile="$TEMP_HOME/installer_scripts.xml" logfile="$TEMP_HOME/ant-log.txt" verbose="yes"&gt;  &lt;br /&gt;                &lt;property name="extract_to" value="$TEMP_HOME"/&gt; &lt;br /&gt;                &lt;property name="tomcat.home" value="$TOMCAT_HOME"/&gt; &lt;br /&gt;                &lt;property name="install.path" value="$INSTALL_PATH"/&gt;   &lt;br /&gt;                &lt;target name="setup"/&gt; &lt;br /&gt;            &lt;/antcall&gt; &lt;br /&gt;            &lt;antcall order="afterpacks" buildfile="$TEMP_HOME/installer_scripts.xml" logfile="$TEMP_HOME/ant-log.txt" verbose="yes"&gt; &lt;br /&gt;                &lt;property name="extract_to" value="$TEMP_HOME"/&gt;  &lt;br /&gt;                &lt;property name="tomcat.home" value="$TOMCAT_HOME"/&gt; &lt;br /&gt;                &lt;property name="install.path" value="$INSTALL_PATH"/&gt; &lt;br /&gt;                &lt;target name="ConnectorConfig"/&gt;  &lt;br /&gt;            &lt;/antcall&gt;  &lt;br /&gt;            &lt;antcall order="afterpacks" uninstall_order="beforedeletion" buildfile="$TEMP_HOME/installer_scripts.xml"&gt; &lt;br /&gt;                &lt;target name="InstallService"/&gt; &lt;br /&gt;                &lt;uninstall_target name="UninstallService"/&gt; &lt;br /&gt;            &lt;/antcall&gt; &lt;br /&gt;        &lt;/pack&gt;&lt;br /&gt;    &lt;/antactions&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;i&gt;The actual Ant script that is executed: installer_scripts.xml&lt;/i&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;    &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;br /&gt;    &lt;project name="InstallerScripts" basedir="."&gt;  &lt;br /&gt;        &lt;!-- This target extracts the Config pack received at install time--&gt; &lt;br /&gt;        &lt;target name="extract" description="This target extracts the Config pack received at install time"&gt;  &lt;br /&gt;            &lt;!-- TODO define script. See Help menu or http://ant.apache.org/ --&gt;  &lt;br /&gt;            &lt;unzip src="${extract_from}" dest="${extract_to}"/&gt; &lt;br /&gt;        &lt;/target&gt;  &lt;br /&gt;        &lt;!-- This target sets up the core addresshub without any specific Connector Configurations--&gt;&lt;br /&gt;        &lt;target name="setup" description="This target sets up the core addresshub without any specific Connector Configurations"&gt;   &lt;br /&gt;            &lt;!-- Set The properties--&gt;    &lt;br /&gt;            &lt;property file="${extract_to}/install.properties"/&gt;   &lt;br /&gt;            &lt;!-- Replace the placeholders--&gt;  &lt;br /&gt;            &lt;replace dir="${install.path}/temp"&gt;     &lt;br /&gt;                &lt;include name="*.xml"/&gt;    &lt;br /&gt;                &lt;replacefilter token="[START-PORT]" value="${port.startup}" /&gt;  &lt;br /&gt;                &lt;replacefilter token="[SHUTDOWN-PORT]" value="${port.shutdown}" /&gt;   &lt;br /&gt;                &lt;replacefilter token="[LOCALHOST]" value="${server.name}" /&gt; &lt;br /&gt;            &lt;/replace&gt;  &lt;br /&gt;            &lt;!-- Replace the webapps folder--&gt;  &lt;br /&gt;            &lt;delete dir="@TOMCAT_HOME/webapps" failonerror="true"&gt;  &lt;br /&gt;            &lt;/delete&gt;  &lt;br /&gt;            &lt;echo message="webapps deleted" /&gt;  &lt;br /&gt;            &lt;mkdir dir="@TOMCAT_HOME/webapps"/&gt;  &lt;br /&gt;            &lt;copy todir="@TOMCAT_HOME/webapps" failonerror="true" verbose="true"&gt;   &lt;br /&gt;                &lt;fileset dir="@TEMP_HOME/webapps" &gt;    &lt;br /&gt;                &lt;/fileset&gt;   &lt;br /&gt;            &lt;/copy&gt;    &lt;br /&gt;            &lt;!-- Replace the Addresshub properties --&gt;   &lt;br /&gt;            &lt;delete file="@TOMCAT_HOME/webapps/lalpac-addresshub/WEB-INF/classes/addresshub.properties"/&gt;  &lt;br /&gt;            &lt;copy file="${extract_to}/addresshub.properties" tofile="${tomcat.home}\webapps\lalpac-addresshub\WEB-INF\classes\addresshub.properties"  verbose="true"  failonerror="true"  /&gt; &lt;br /&gt;            &lt;!-- Replace the Web.xml properties --&gt;  &lt;br /&gt;            &lt;delete file="@TOMCAT_HOME/webapps/lalpac-addresshub/WEB-INF/web.xml"/&gt;  &lt;br /&gt;            &lt;copy file="@TEMP_HOME/web.xml"  tofile="${tomcat.home}\webapps\lalpac-addresshub\WEB-INF\web.xml"  verbose="true"  failonerror="true"  /&gt;  &lt;br /&gt;            &lt;!-- Replace the Tomcat Configurations  --&gt;   &lt;br /&gt;            &lt;copy file="@TEMP_HOME/server.xml" tofile="@TOMCAT_HOME/conf/server.xml" failonerror="true" /&gt; &lt;br /&gt;            &lt;!-- copy file="@TEMP_HOME/conf/catalina.policy" tofile="@TOMCAT_HOME/conf/catalina.policy"  failonerror="true" / --&gt;   &lt;br /&gt;        &lt;!-- copy file="@TEMP_HOME/conf/wrapper.conf" tofile="@TOMCAT_HOME/conf/wrapper.conf" failonerror="true" / --&gt;  &lt;/target&gt;  &lt;target name="ConnectorConfig"&gt;  &lt;br /&gt;            &lt;property file="${extract_to}/install.properties"/&gt;  &lt;br /&gt;        &lt;antcall target="qas.conf"/&gt;  &lt;/target&gt;  &lt;br /&gt;        &lt;condition property="qas.lpg.installed"&gt;    &lt;br /&gt;            &lt;equals arg1="${install.type}" arg2="qas_lpg" casesensitive="false"/&gt;  &lt;br /&gt;        &lt;/condition&gt;  &lt;target name="qas.conf"  if="qas.lpg.installed"&gt;  &lt;br /&gt;            &lt;copy todir="@TOMCAT_HOME\shared\lib" &gt;      &lt;br /&gt;                &lt;fileset dir="//${qas.api.home}" &gt;       &lt;br /&gt;                    &lt;include name="qalcl.dat"/&gt;       &lt;br /&gt;                    &lt;include name="qalicn.ini"/&gt;      &lt;br /&gt;                    &lt;include name="qaupied.dll"/&gt;     &lt;br /&gt;                    &lt;include name="qaupied.044"/&gt;   &lt;br /&gt;                &lt;/fileset&gt;    &lt;br /&gt;            &lt;/copy&gt;     &lt;br /&gt;            &lt;copy file="@TEMP_HOME/qas/QAWSERVE_LPG.INI" tofile="@TOMCAT_HOME/shared/lib/QAWSERVE.INI" failonerror="true"/&gt;     &lt;br /&gt;            &lt;copy file="@TEMP_HOME/qas/QAWORLD.INI" tofile="@TOMCAT_HOME/shared/lib/QAWORLD.INI" failonerror="true"/&gt;   &lt;br /&gt;            &lt;replace file="@TOMCAT_HOME\shared\lib\QAWSERVE.INI" propertyFile="${extract_to}\install.properties"&gt;  &lt;br /&gt;                &lt;replacefilter token="@QAS_DATA_DIR@" property="qas.data.home"/&gt;   &lt;br /&gt;            &lt;/replace&gt;     &lt;br /&gt;        &lt;/target&gt;  &lt;br /&gt;        &lt;target name="InstallService"&gt;  &lt;br /&gt;            &lt;exec executable="@TOMCAT_HOME\bin\Tomcat-NT-service-install.bat"&gt;   &lt;br /&gt;            &lt;/exec&gt; &lt;br /&gt;        &lt;/target&gt;  &lt;br /&gt;        &lt;target name="UninstallService"&gt; &lt;br /&gt;            &lt;exec executable="@TOMCAT_HOME\bin\Tomcat-NT-service-uninstall.bat"&gt;  &lt;br /&gt;            &lt;/exec&gt;  &lt;br /&gt;        &lt;/target&gt;&lt;br /&gt;    &lt;/project&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;Lastly, the Lauch4j script&lt;br /&gt;&lt;br /&gt;&lt;i&gt;The Lunch4jt script that is executed: launch4jConfig.xml&lt;/i&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[&lt;br /&gt;    &lt;launch4jConfig&gt;   &lt;br /&gt;        &lt;!-- Header types: 0-GUI, 1-console --&gt;    &lt;br /&gt;        &lt;headerType&gt;0&lt;/headerType&gt;   &lt;br /&gt;        &lt;outfile&gt;[PKG_DEV]/[FILE-NAME].exe&lt;/outfile&gt;   &lt;br /&gt;        &lt;jar&gt;[PACK_SOURCE]/[FILE-NAME].jar&lt;/jar&gt;   &lt;br /&gt;        &lt;dontWrapJar&gt;false&lt;/dontWrapJar&gt;   &lt;br /&gt;        &lt;errTitle&gt;[APP-NAME]: Installation Error&lt;/errTitle&gt;  &lt;br /&gt;        &lt;customProcName&gt;LalPacAddresshub&lt;/customProcName&gt; &lt;br /&gt;        &lt;downloadUrl&gt;https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jre-1.5.0_15-oth-JPR@CDS-CDS_Developer&lt;/downloadUrl&gt;  &lt;br /&gt;        &lt;cmdLine/&gt; &lt;br /&gt;        &lt;chdir/&gt;   &lt;br /&gt;        &lt;icon&gt;lalpac.ico&lt;/icon&gt;  &lt;br /&gt;        &lt;stayAlive/&gt;  &lt;br /&gt;        &lt;jre&gt;     &lt;br /&gt;            &lt;minVersion&gt;1.5.0&lt;/minVersion&gt;  &lt;br /&gt;            &lt;maxVersion&gt;1.5.0_15&lt;/maxVersion&gt;    &lt;br /&gt;            &lt;initialHeapSize&gt;0&lt;/initialHeapSize&gt;      &lt;br /&gt;            &lt;maxHeapSize&gt;0&lt;/maxHeapSize&gt;  &lt;br /&gt;        &lt;/jre&gt; &lt;br /&gt;    &lt;/launch4jConfig&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/dXncfvdb0sk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/250580058039529427/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=250580058039529427" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/250580058039529427?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/250580058039529427?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/dXncfvdb0sk/izpack-installation-script-example-with.html" title="IzPack Installation Script Example,  with Lunch4j, Ant integration, Java Service Wrapper and Windows Service" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2009/09/izpack-installation-script-example-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0MCSXg8eyp7ImA9WxJbE0k.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-5107308837415027239</id><published>2009-07-23T02:31:00.000-07:00</published><updated>2009-07-23T02:31:08.673-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-23T02:31:08.673-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="izpack" /><title>IzPack Examples from Sun and Terracotta</title><content type="html">From &lt;a href="http://jpz-log.info/archives/2009/05/17/two-izpack-use-cases-terracotta-and-sun-grid-engine/"&gt;this &lt;/a&gt;blog post by the main guy behind IzPack regarding the use of IzPack in both Sun Grid Engine and Terracotta, I went on a look out to find the code so I could borrow some code examples and thanks to the world of open source, I found them so here, you go.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;IzPack Install example form Sun Grid System Installation&lt;br /&gt;
&lt;a href="http://gridengine.sunsource.net/source/browse/gridengine/source/clients/gui-installer/resources/"&gt;Click Here to view&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
IzPack Code as used in Terracotta&lt;br /&gt;
&lt;a href="http://svn.terracotta.org/fisheye/qsearch/Terracotta/?q=izpack"&gt;Click Here to View &lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enjoy&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/iid09SxdUds" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/5107308837415027239/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=5107308837415027239" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/5107308837415027239?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/5107308837415027239?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/iid09SxdUds/izpack-examples-from-sun-and-terracotta.html" title="IzPack Examples from Sun and Terracotta" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2009/07/izpack-examples-from-sun-and-terracotta.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcHQHc_fyp7ImA9WxBQE0U.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-2840820674155285431</id><published>2009-06-15T20:16:00.000-07:00</published><updated>2010-01-13T03:27:11.947-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-13T03:27:11.947-08:00</app:edited><title>Money Class for use in Currency Calculations. Based on Martin Fowler's Value Object</title><content type="html">This is my own implementation of the Money value object from Martin Fowler's book Partterns of Enterprise Application Architecture. Enjoy&lt;br /&gt;
&lt;br /&gt;
&lt;pre name="code" class="html"&gt;package com.console.utils.value;

import com.console.core.exceptions.UnknownCurrencyCodeException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.Currency;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.Assert;
import static java.math.RoundingMode.HALF_UP;

/**
 *
 * @author farouka
 */
public class Money implements Serializable {

  /**
   * Why me
   */
  private static final int[] cents = new int[]{1, 10, 100, 1000};
  
  private BigDecimal amount;
  
  private Currency currency;

  //private MathContext DEFAULT_CONTEXT = new MathContext( 2, HALF_UP );

  private MathContext DEFAULT_CONTEXT = new MathContext( 10, RoundingMode.HALF_DOWN );

  public Money(long amount, Currency currency) {
    this.currency = currency;
    this.amount = BigDecimal.valueOf(amount, currency.getDefaultFractionDigits()); 
  }

  /**
   * Creates a currency object from the long value provided assuming the long value
   * represents the base currency in the least monetary unit. For eg, new Money(500, "GBP")
   * is assumed to mean 5.00 great british pounds
   * @param amount in base monetary unit
   * @param currCode
   * @throws com.console.core.exceptions.UnknownCurrencyCodeException
   */
  public Money(long amount, String currCode) throws UnknownCurrencyCodeException {
    this( amount, Currency.getInstance(currCode) );
  }
  
  /**
   * Construct an IMMUTABLE money object from a double. It is assumed that 
   * the whole part of the double is the Money with the fractional part representing
   * lowest denominator of the currency. For eg, new Money (50.99, "GBP") is assumed
   * to be 50 pounds and 99 pence.
   * PS. 89.788 will be truncated to 89.78 based on the defaultcurrencydigit of the currency
   * @param amount
   * @param curr
   */
  public Money(double amount, Currency curr) {
    this.currency = curr;
    BigDecimal bd = BigDecimal.valueOf( amount );
    this.amount = bd.setScale(centFactor(), HALF_UP);
  }

  private Money() {
  }

  /**
   * Construct an IMMUTABLE money object from a double. It is assumed that 
   * the whole part of the double is the Money with the fractional part representing
   * lowest denominator of the currency. For eg, new Money (50.99, "GBP") is assumed
   * to be 50 pounds and 99 pence.
   * PS. 89.788 will be truncated to 89.78 based on the defaultcurrencydigit of the currency
   * code supplied
   * @param amount
   * @param currCode iso 4217 currency code
   * @throws com.console.core.exceptions.UnknownCurrencyCodeException
   */
  public Money(double amount, String currCode) throws UnknownCurrencyCodeException {
    this.currency = Currency.getInstance(currCode);
    BigDecimal bd = BigDecimal.valueOf( amount );
    this.amount = bd.setScale( currency.getDefaultFractionDigits(), HALF_UP);
  }
  
  /**
   * Constructs an IMMUTABLE money from a BigDecimal. the BigDecimal provided is only scaled
   * to used the default digits in currency object represented by the sting parameter
   * @param bigDecimal
   * @param currCode ISO 4217 cuurency code
   * @throws com.console.core.exceptions.UnknownCurrencyCodeException
   */
  public Money(BigDecimal bigDecimal, String currCode ) throws UnknownCurrencyCodeException {    
    this.currency = Currency.getInstance(currCode);
    this.amount = bigDecimal.setScale( currency.getDefaultFractionDigits(), HALF_UP);
  }

  /**
   * Constructs an IMMUTABLE money from a BigDecimal. the BigDecimal provided is only scaled
   * to used the default digits in currency object represented by the sting parameter
   * @param multiply
   * @param currency
   */
  public Money(BigDecimal bigDecimal, Currency currency) {
    this.currency = currency;   
    this.amount = bigDecimal.setScale( currency.getDefaultFractionDigits(), HALF_UP);
  }

//  public  boolean assertSameCurrencyAs(Money arg) {
//    return  this.currency.getCurrencyCode().equals(arg.currency.getCurrencyCode());
//  }
//  
  public boolean assertSameCurrencyAs(Money money) throws IncompatibleCurrencyException{
  if ( this.currency == null ) {
   throw new IncompatibleCurrencyException( "currency.invalid" );
  }
  if ( money == null ) {
   throw new IncompatibleCurrencyException( "currency.invalid" );
  }
    Assert.assertEquals("money math mismatch", currency, money.currency);
    return true;
  }

  private int centFactor() {
    return cents[ getCurrency().getDefaultFractionDigits() ];
  }

  public BigDecimal amount() {
    return amount;
  }
  
  public long amountAsLong(){
    return amount.unscaledValue().longValue();
  }

  public Currency getCurrency() {
    return currency;
  }
//    common currencies
  public static Money dollars(double amount) {
    Money result = null;
    try {
      result = new Money(amount, "USD");
    } catch (UnknownCurrencyCodeException ex) {
      Logger.getLogger(Money.class.getName()).log(Level.SEVERE, null, ex);
    }
    return result;
  }
  
  public static Money dollars(long amount) {
    Money result = null;
    try {
      result = new Money(amount, "USD");
    } catch (UnknownCurrencyCodeException ex) {
      Logger.getLogger(Money.class.getName()).log(Level.SEVERE, null, ex);
    }
    return result;
  }

  public static Money pounds(double amount) {
    Money result = null;
    try {
      result = new Money(amount, "GBP");
    } catch (UnknownCurrencyCodeException ex) {
      Logger.getLogger(Money.class.getName()).log(Level.SEVERE, null, ex);
    }
    return result;
  }
  
  public static Money pounds(long amount) {
    Money result = null;
    try {
      result = new Money(amount, "GBP");
    } catch (UnknownCurrencyCodeException ex) {
      Logger.getLogger(Money.class.getName()).log(Level.SEVERE, null, ex);
    }
    return result;
  }
  
  public static Money pounds(BigDecimal amount) {
    Money result = null;
    try {
      result = new Money(amount, "GBP");
    } catch (UnknownCurrencyCodeException ex) {
      Logger.getLogger(Money.class.getName()).log(Level.SEVERE, null, ex);
    }
    return result;
  }


  @Override
  public int hashCode() {
    int hash = (int) ( amount.hashCode() ^ (amount.hashCode() &gt;&gt;&gt; 32) );
    return hash;
  }

  @Override
  public boolean equals(Object other) {
    return (other instanceof Money &amp;&amp; equals((Money) other));
  }

  public boolean equals(Money other) {
    return ( currency.equals(other.currency) &amp;&amp; (amount.equals(other.amount)) );
  }

  public Money add(Money other) throws Exception{
    assertSameCurrencyAs( other );
    return newMoney(amount.add(other.amount, DEFAULT_CONTEXT));
  }

  private int compareTo(Money money) throws Exception {
    assertSameCurrencyAs( money );
    return amount.compareTo( money.amount ); 
  }

  public Money multiply(BigDecimal amount) {
    return new Money( this.amount().multiply(amount, DEFAULT_CONTEXT), currency);
  }

  public Money multiply( BigDecimal amount, RoundingMode roundingMode ) {
    MathContext ct = new MathContext( currency.getDefaultFractionDigits(), roundingMode );
    return new Money( amount().multiply(amount, ct), currency);
  }

  private Money newMoney(BigDecimal amount) {
    return new Money( amount, this.currency );
  }
  
  public Money multiply(double amount) {
    return multiply( new BigDecimal( amount ) );
  }

  public Money subtract(Money other) throws Exception {
    assertSameCurrencyAs(other);
    return newMoney( amount.subtract(other.amount, DEFAULT_CONTEXT) );
  }
  
  public int compareTo(Object other) throws Exception {
    return compareTo((Money) other);
  }

  public boolean greaterThan(Money other)throws Exception {
    return (compareTo(other) &gt; 0);
  }
  
//  public Money[] allocate(int n){
//    Money lowResult = newMoney( amount.unscaledValue().longValue()/n );
//    Money highResult = newMoney(lowResult.amount + 1);
//    Money[] results = new Money[n];  
//    int remainder = (int) amount % n;
//    
//    for(int i = 0; i &lt; remainder; i++)results[i] = highResult;
//    for(int i = 0; i &lt; n; i++) results[i] = lowResult;
//    
//    return results;
//  }
//  
//  public Money[]allocate(long[] ratios){
//    long total = 0;
//    for (int i = 0; i &lt; ratios.length; i++) {
//      total += ratios[i];
//    }
//    long remainder = amount;
//    Money[] results = new Money[ratios.length];
//    for (int i = 0; i &lt; results.length; i++) {
//      results[i] = newMoney(amount * ratios[i]/total);
//      remainder -= results[i].amount;
//    }
//    for (int i = 0; i &lt; remainder; i++) {
//      results[i].amount++;
//    }
//    return results;
//
//  }
  
  public Money divideByNumber( double divisor){
     BigDecimal div = BigDecimal.valueOf( divisor );
     BigDecimal ans = this.amount.divide(div, DEFAULT_CONTEXT);
     return new Money(ans, this.currency);
  }
  
  public int getQuotient( Money divisor ){
    BigDecimal ans = this.amount.divide(divisor.amount, RoundingMode.DOWN);
    return ans.intValue();
  }
  
  /**
   * divides toe moneys and return the quotient and Remainder this method has been customised,
   * for my money transfer needs...sorry
   * @param divisor
   * @return
   */
  public int[] getQuotientandRemainder(Money divisor){
    int[] ans = new int[2];
    BigDecimal[] bdArr = this.amount.divideAndRemainder(divisor.amount, DEFAULT_CONTEXT);
    BigDecimal quo = bdArr[0];
    BigDecimal rem = bdArr[1];
    ans[0] = quo.intValue();
    if( rem.compareTo(BigDecimal.ZERO) == 0 ){
      ans[1] =0;
    }else{
      ans[1] = 1;
    }
    return ans;
  }
  
 public String toFormattedString() {
  NumberFormat nf = NumberFormat.getCurrencyInstance();
  nf.setCurrency( currency );
  nf.setGroupingUsed( true );
  nf.setMaximumFractionDigits( currency.getDefaultFractionDigits() );
  return nf.format( this.amount.doubleValue() );
 }
  
 /**
  * Returns the ISO-4217 currency code of the currency
  * attached to this money.
  * 
  * @return The ISO-4217 currency code.
  */
 public String getCurrencyCode() {
  return currency.getCurrencyCode();
 }
  
  @Override
  public String toString() {
      return amount.toString();
  }
  
 /**
  * Returns the precision for this money. The precision is the total number
  * of digits that the value can represent. This includes the integer part.
  * So, 18 would be able to represent:
  * 

* &lt;code&gt;1234567890.12345678&lt;/code&gt;
  * 

* &lt;code&gt;1234567890123456.78&lt;/code&gt;
  * 

* &lt;code&gt;123456789012345678&lt;/code&gt;
  * 

* &lt;code&gt;0.123456789012345678&lt;/code&gt;
  * 
  * @return The precision. 
  */ 
 public int precision() {
  return amount.precision();
 }

 /**
  * Returns the 'scale' for this money. The scale is the number of 
  * digits that are moved to the fractional part, assuming that all
  * digits are represented by a single integer value. For example:
  * 

* &lt;code&gt;If: 123456789012345678&lt;/code&gt; has scaling 2, it would be :
  * 

* &lt;code&gt;1234567890123456.78&lt;/code&gt;
  * 
  * @return The scale value. 
  */
 public int scale() {
  return amount.scale();
 }

 /**
  * Returns the sign for the money (negative or positive).
  * -1 if negative, 0 if 0.00 (zero), 1 if positive.
  * 
  * @return The sign of the money. 
  */ 
 public int signum() {
  return amount.signum();
 }
}

&lt;/pre&gt;&lt;br /&gt;
And here is the UnknownCurrencyCodeException class&lt;br /&gt;
&lt;pre name="code" class="html"&gt;package com.console.lib.utils;

/**
 * An exception which is raised when an unrecognised currency code is passed to the
 * Currency class.
 *
 * @author Farouk Alhassan
 * @see Currency
 */
public class UnknownCurrencyCodeException extends Exception {

    // Reason for exception
    private String reason = null;

    /**
     * Create a new unknown currency code exception.
     *
     * @param reason for the exception
     */
    public UnknownCurrencyCodeException(String reason) {
        this.reason = reason;
    }

    /**
     * Return the reason this exception was raised.
     *
     * @return the reason why the string isn't a valid currency code
     */
    public String getReason() {
        return reason;
    }

    /**
     * Convert the exception to a string
     *
     * @return string version of the exception
     */
    public String toString() {
 return getReason();
    }
}
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/1QYGO0iQpfQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/2840820674155285431/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=2840820674155285431" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/2840820674155285431?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/2840820674155285431?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/1QYGO0iQpfQ/money-class-for-use-in-currency.html" title="Money Class for use in Currency Calculations. Based on Martin Fowler's Value Object" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>3</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2009/06/money-class-for-use-in-currency.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IAQ3s5eip7ImA9WxJWEEg.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-8076679114612664181</id><published>2009-06-14T04:03:00.000-07:00</published><updated>2009-06-15T01:45:42.522-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-15T01:45:42.522-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><title>Sending Email with Java Mail with attachments Example</title><content type="html">Here I am sharing my EmailManager class that handles Email. Hope you find it useful.&lt;br /&gt;
&lt;pre name="code" class="html"&gt;package com.console.app.service;

import com.console.app.mtgapi.ApiRequest;
import com.console.app.mtgapi.ApiResponse;
import com.console.core.biz.MtEmailAuthenticator;
import com.sun.mail.smtp.SMTPSSLTransport;
import java.util.Properties;
import javax.ejb.Stateless;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

/**
 *
 * @author Farouk Alhassan
 */
@Stateless
public class EmailManagerImpl implements EmailManager {
  
  private static String SMTP_HOST_SERVER = "plus.smtp.mail.yahoo.com";
  
  private static String POP3_SERVER = " plus.pop.mail.yahoo.com";
  
  private static String SMTP_PORT = "465";
  
  private static String POP3_PORT = "995";
  
  private static String ACCOUNT_NAME ="MY_ACCOUNT_NAME";
  
  private static String EMAIL_ADDRESS = "MY_ACCOUNT_NAME@yahoo.com";
  
  private static String ACCOUNT_PASSWORD = "MY_PASSWORD";
  
  private static String USE_AUTHENTICATION = "true";
  
  private static String SMTP_USE_SSL = "true";
  
  private static String POP3_USE_SSL = "true";

  public void sendEmail(String to,
          String subject, String messageBody ) throws
          MessagingException, AddressException {

    // Setup mail server
    Properties props = System.getProperties();
    props.put("mail.smtps.host", SMTP_HOST_SERVER);
    props.put("mail.smtps.port", SMTP_PORT);
    props.put("mail.smtps.auth", USE_AUTHENTICATION);
    props.put("mail.smtps.user", ACCOUNT_NAME);

    // Get a mail session
    Session session = Session.getDefaultInstance(props,null);
      //new MtEmailAuthenticator());
    session.setDebug(true);

    // Define a new mail message 
    Message message = new MimeMessage(session);
    message.setFrom(new InternetAddress(EMAIL_ADDRESS));
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    message.setSubject(subject);

    // Create a message part to represent the body text
    BodyPart messageBodyPart = new MimeBodyPart();
    messageBodyPart.setContent(messageBody,"text/html");

    //use a MimeMultipart as we need to handle the file attachments 
    Multipart multipart = new MimeMultipart();

    //add the message body to the mime message
    multipart.addBodyPart(messageBodyPart);

    // Put all message parts in the message 
    message.setContent(multipart);

    // Send the message
    SMTPSSLTransport tr = (SMTPSSLTransport) session.getTransport("smtps");
    tr.connect(SMTP_HOST_SERVER, ACCOUNT_NAME, ACCOUNT_PASSWORD);
    message.saveChanges();
    tr.sendMessage(message, message.getAllRecipients());
    tr.close();
  }

  protected void addAtachments(String[] attachments, Multipart multipart)
          throws MessagingException, AddressException {
    for (int i = 0; i &lt;= attachments.length - 1; i++) {
      String filename = attachments[i];
      MimeBodyPart attachmentBodyPart = new MimeBodyPart();

      //use a JAF FileDataSource as it does MIME type detection
      DataSource source = new FileDataSource(filename);
      attachmentBodyPart.setDataHandler(new DataHandler(source));

      //assume that the filename you want to send is the same as the
      //actual file name - could alter this to remove the file path
      attachmentBodyPart.setFileName(filename);

      //add the attachment
      multipart.addBodyPart(attachmentBodyPart);
    }
  }
}

&lt;/pre&gt;
&lt;br /&gt;
Feel free to comment and let me know how I could have done this better&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/08wIiqsdbI8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/8076679114612664181/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=8076679114612664181" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/8076679114612664181?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/8076679114612664181?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/08wIiqsdbI8/sending-email-with-java-mail-with.html" title="Sending Email with Java Mail with attachments Example" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2009/06/sending-email-with-java-mail-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D04GSHc_fSp7ImA9WxJXGUo.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-7662088739976627865</id><published>2009-06-14T03:38:00.001-07:00</published><updated>2009-06-14T03:38:49.945-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-14T03:38:49.945-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SEO" /><category scheme="http://www.blogger.com/atom/ns#" term="miscellanous" /><title>How To Get Top Ranking in Search Engines</title><content type="html">The tutorial is all about getting your site listed on top in Search Engines i.e Search Engine Optimization&lt;br /&gt;
&lt;br /&gt;
First thing you need to do is find the keywords you want to optimize for.&lt;br /&gt;
&lt;br /&gt;
There is great tool by Overture (/http://inventory.overture.com/d/sea...ory/suggestion/)&lt;br /&gt;
&lt;br /&gt;
But I would suggest using this free tool called GoodKeywords (/http://www.goodkeywords.com/products/gkw/)&lt;br /&gt;
&lt;br /&gt;
This one does the same job as Overture does but it also supports other Search Engines (Lycos and Teoma etc..)&lt;br /&gt;
&lt;br /&gt;
For example if you want to optimize for the keyword "tech news", just search for the keyword in any of the tools specified above... It would show you keywords related to that and not of the searches..&lt;br /&gt;
&lt;br /&gt;
Pick the keywords which are related to your site.&lt;br /&gt;
&lt;br /&gt;
For example when you search for "Tech News" you'll see the following results:&lt;br /&gt;
&lt;br /&gt;
Count Search Term&lt;br /&gt;
11770 tech news&lt;br /&gt;
351 itt news tech&lt;br /&gt;
191 high tech news&lt;br /&gt;
60 news tech texas&lt;br /&gt;
49 computer tech news&lt;br /&gt;
42 bio news tech&lt;br /&gt;
34 in itt news tech&lt;br /&gt;
30 news tech virginia&lt;br /&gt;
29 asia news tech&lt;br /&gt;
25 hi tech news&lt;br /&gt;
25 sci tech news&lt;br /&gt;
&lt;br /&gt;
Now see what other terms are related to your keyword technology news&lt;br /&gt;
&lt;br /&gt;
Do couple of searches like that and note down around 15-20 keywords.&lt;br /&gt;
Then, keep the keywords which are searched most on the top.&lt;br /&gt;
&lt;br /&gt;
Now you need Title Tag for the page.&lt;br /&gt;
&lt;br /&gt;
Title tag should include top 3 keywords, like for "tech news" it can be like :&lt;br /&gt;
&lt;br /&gt;
"Latest Tech News, Information Technology News and Other computer raleted news here."&lt;br /&gt;
&lt;br /&gt;
Remember that characters should not be more than 95 and should not have more than 3 "," commas - some search engines might cosider more than 3 commas as spam&lt;br /&gt;
&lt;br /&gt;
Now move on to Meta Tags&lt;br /&gt;
&lt;br /&gt;
You need following Meta Tags in web page&lt;br /&gt;
&lt;br /&gt;
&amp;lt;META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;&lt;br /&gt;
&amp;lt;META name="keywords" content="keyword1,keyword2,keyword3"&gt;&lt;br /&gt;
&amp;lt;META name="description" content="brief description about the site"&gt;&lt;br /&gt;
&amp;lt;META name="robots" Content="Index,Follow"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No need to have other meta tags like abstract, re-visit and all, most people dont read it.&lt;br /&gt;
&lt;br /&gt;
Now...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;&lt;br /&gt;
&lt;br /&gt;
This tag is tells content type is html and character set used it iso-8859-1 there are other character sets also but this is the one mosty used..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;META name="keywords" content="keyword1,keyword2,keyword3"&gt;&lt;br /&gt;
&lt;br /&gt;
This one should have all your keywords inside starting from keyword with most counts...&lt;br /&gt;
&lt;br /&gt;
keyword tag for our example would be something like :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;META name="keywords" content="tech news,technology news, computer technology news,information technology,software news"&gt;&lt;br /&gt;
&lt;br /&gt;
Remember to put around 15-20 keywords max not more than that. Dont repeat keywords or dont put keywords like, "tech news", "info tech news", "latest tech news" and so on...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;META name="description" content="brief description about the site"&gt;&lt;br /&gt;
&lt;br /&gt;
Provide short decription about your site and include all the keywords mentioned in the title tag.&lt;br /&gt;
&lt;br /&gt;
Decription tag should be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;META name="description" content="One Stop for Latest Tech News, Information Technology News, Computer Related and Software news."&gt;&lt;br /&gt;
&lt;br /&gt;
It can be upto 255 characters and avoid using more than 3 "," commas&lt;br /&gt;
&lt;br /&gt;
&amp;lt;META name="robots" Content="Index,Follow"&gt;&lt;br /&gt;
&lt;br /&gt;
This is used for search robots..following explanation will help you :&lt;br /&gt;
&lt;br /&gt;
index,follow = index the page as well as follow the links&lt;br /&gt;
noindex,follow = dont index the page but follow the links&lt;br /&gt;
index,nofollow = index the page but dont follow the links&lt;br /&gt;
noindex,nofollow = dont index page, dont follow the links&lt;br /&gt;
all = same as index,follow&lt;br /&gt;
none = same as noindex,nofollow&lt;br /&gt;
&lt;br /&gt;
Now move on to body part of the page&lt;br /&gt;
&lt;br /&gt;
Include all top 3 keywords here,&lt;br /&gt;
I would suggest to break the keyword and use it...&lt;br /&gt;
&lt;br /&gt;
For example&lt;br /&gt;
&lt;br /&gt;
YourSiteName.com one stop for all kind of Latest Tech News and Computer Related information and reviews.................&lt;br /&gt;
&lt;br /&gt;
Include main keywords in &amp;lt;h#&gt; tags &amp;lt;h1&gt;&amp;lt;h2&gt; etc..&lt;br /&gt;
and start with &amp;lt;h1&gt; and then move to &amp;lt;h2&gt; &amp;lt;h3&gt; etc..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&gt; tag will be too big but CSS can help you there, define small font size in css for H1,H2,... tags&lt;br /&gt;
&lt;br /&gt;
When done with page copy, then you need to provide title and alt tags for images and links.&lt;br /&gt;
&lt;br /&gt;
Use some keywords in the tags but dont add all the keywords and if not neccessary then dont use keywords in it, basically it should explain what is image all about.&lt;br /&gt;
&lt;br /&gt;
Remember to add Top keyword atleast 4 times in the body and other 2 keywords thrice and twice respectively.&lt;br /&gt;
&lt;br /&gt;
Now move on to Footer Part&lt;br /&gt;
Try to include top keywords here and see the effect, use site keywords as links i.e.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a href="news.php"&gt;Tech News&amp;lt;/a&gt; &amp;lt;a href="software-news.php"&gt;Software News&amp;lt;/a&gt; etc..&lt;br /&gt;
&lt;br /&gt;
Now finally, you need to read some more stuff..may be you can all it as bottom lines...&lt;br /&gt;
&lt;br /&gt;
Site Map - This is page where you need to put all the links present in your site, this is will help Search Engines to find the links easily and also provide link for site map in footer, as search engines start scanning the page from bottom.&lt;br /&gt;
&lt;br /&gt;
Robots.txt - This file contains address of directories which should not be scanned by search engines.. more info can be found here : /http://www.robotstxt.org/wc/exclusion.html search engines line google, yahoo ask for robots.txt file.&lt;br /&gt;
&lt;br /&gt;
Valid HTML - Your code should have valid html and doc type, Its kind of diffucult to follow all the standards but you can atleast open and close all the tags properly, you can check your page's html online here : /http://validator.w3.org/ or you can use this free software called HTML Tidy : /http://tidy.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
All done now, you just need to check your site with this script, its called SEO Doctor : /http://www.instantposition.com/seo_doctor.cfm&lt;br /&gt;
&lt;br /&gt;
It'll show you the report of your site with solution.&lt;br /&gt;
&lt;br /&gt;
Now, correct the errors and start submitting the site :&lt;br /&gt;
&lt;br /&gt;
Start with google : /http://google.com/addurl.html&lt;br /&gt;
then yahoo : /http://submit.search.yahoo.com/free/request&lt;br /&gt;
then move to altavista,alltheweb and other search engies..&lt;br /&gt;
&lt;br /&gt;
Also submit your site to direcories like /http://dmoz.org , /http://jayde.com etc...&lt;br /&gt;
Dmoz is must, as google, yahoo and may more search engines uses same directory&lt;br /&gt;
&lt;br /&gt;
And remember, dont try to SPAM with keywords in these directories, dmoz is handled by Human Editors&lt;br /&gt;
&lt;br /&gt;
Submitted the sites, but still i cant see you site on top?&lt;br /&gt;
&lt;br /&gt;
Wait for sometime may be a month or so but keep an eye on your search term, use /http://GoogleAlert.com - this will show whenever google updates for your keywords, it will mail you the new results.&lt;br /&gt;
&lt;br /&gt;
And also check whether your site is listed on google..&lt;br /&gt;
use this tool called Google Monitor, it can be downloaded for free from : /http://www.cleverstat.com/google-monitor.htm&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/9XEV_vOcm3E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/7662088739976627865/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=7662088739976627865" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/7662088739976627865?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/7662088739976627865?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/9XEV_vOcm3E/how-to-get-top-ranking-in-search.html" title="How To Get Top Ranking in Search Engines" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2009/06/how-to-get-top-ranking-in-search.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0ENQnY_eSp7ImA9WxJXGUo.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-6885523552140705586</id><published>2009-06-14T03:30:00.001-07:00</published><updated>2009-06-14T03:34:53.841-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-14T03:34:53.841-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="miscellanous" /><category scheme="http://www.blogger.com/atom/ns#" term="windows" /><title>Change The Default Location For Installing Apps</title><content type="html">As the size of hardrives increase, more people are using partitions to seperate and store groups of files.&lt;br /&gt;
&lt;br /&gt;
XP uses the C:\Program Files directory as the default base directory into which new programs are installed. However, you can change the default installation drive and/ or directory by using a Registry hack.&lt;br /&gt;
&lt;br /&gt;
Run the Registry Editor (regedit)and go to&lt;br /&gt;
&lt;br /&gt;
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion&lt;br /&gt;
&lt;br /&gt;
Look for the value named ProgramFilesDir. by default,this value will be C:\Program Files. Edit the value to any valid drive or folder and XP will use that new location as the default installation directory for new programs.&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/YLZn3p3XdJ0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/6885523552140705586/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=6885523552140705586" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/6885523552140705586?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/6885523552140705586?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/YLZn3p3XdJ0/change-default-location-for-installing.html" title="Change The Default Location For Installing Apps" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2009/06/change-default-location-for-installing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IBRno8eip7ImA9WxJXF00.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-3811238866621390049</id><published>2009-06-11T01:39:00.000-07:00</published><updated>2009-06-11T01:39:17.472-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-11T01:39:17.472-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="miscellanous" /><title>All About Movie Tags (What Is A Dvdrip, Cam, Screener Etc.)</title><content type="html">CAM -&lt;br /&gt;
A cam is a theater rip usually done with a digital video camera. A mini tripod is sometimes used, but a lot of the time this wont be possible, so the camera make shake. Also seating placement isn't always idle, and it might be filmed from an angle. If cropped properly, this is hard to tell unless there's text on the screen, but a lot of times these are left with triangular borders on the top and bottom of the screen. Sound is taken from the onboard microphone of the camera, and especially in comedies, laughter can often be heard during the film. Due to these factors picture and sound quality are usually quite poor, but sometimes we're lucky, and the theater will be fairly empty and a fairly clear signal will be heard.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TELESYNC (TS) - A telesync is the same spec as a CAM except it uses an external audio source (most likely an audio jack in the chair for hard of hearing people). A direct audio source does not ensure a good quality audio source, as a lot of background noise can interfere. A lot of the times a telesync is filmed in an empty cinema or from the projection booth with a professional camera, giving a better picture quality. Quality ranges drastically, check the sample before downloading the full release. A high percentage of Telesyncs are CAMs that have been mislabeled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TELECINE (TC) -&lt;br /&gt;
A telecine machine copies the film digitally from the reels. Sound and picture should be very good, but due to the equipment involved and cost telecines are fairly uncommon. Generally the film will be in correct aspect ratio, although 4:3 telecines have existed. A great example is the JURASSIC PARK 3 TC done last year. TC should not be confused with TimeCode , which is a visible counter on screen throughout the film.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SCREENER (SCR) -&lt;br /&gt;
A pre VHS tape, sent to rental stores, and various other places for promotional use. A screener is supplied on a VHS tape, and is usually in a 4:3 (full screen) a/r, although letterboxed screeners are sometimes found. The main draw back is a "ticker" (a message that scrolls past at the bottom of the screen, with the copyright and anti-copy telephone number). Also, if the tape contains any serial numbers, or any other markings that could lead to the source of the tape, these will have to be blocked, usually with a black mark over the section. This is sometimes only for a few seconds, but unfortunately on some copies this will last for the entire film, and some can be quite big. Depending on the equipment used, screener quality can range from excellent if done from a MASTER copy, to very poor if done on an old VHS recorder thru poor capture equipment on a copied tape. Most screeners are transferred to VCD, but a few attempts at SVCD have occurred, some looking better than others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DVD-SCREENER (DVDscr) -Same premise as a screener, but transferred off a DVD. Usually letterbox , but without the extras that a DVD retail would contain. The ticker is not usually in the black bars, and will disrupt the viewing. If the ripper has any skill, a DVDscr should be very good. Usually transferred to SVCD or DivX/XviD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DVDRip - A copy of the final released DVD. If possible this is released PRE retail (for example, Star Wars episode 2) again, should be excellent quality. DVDrips are released in SVCD and DivX/XviD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
VHSRip -Transferred off a retail VHS, mainly skating/sports videos and XXX releases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TVRip -TV episode that is either from Network (capped using digital cable/satellite boxes are preferable) or PRE-AIR from satellite feeds sending the program around to networks a few days earlier (do not contain "dogs" but sometimes have flickers etc) Some programs such as WWF Raw Is War contain extra parts, and the "dark matches" and camera/commentary tests are included on the rips. PDTV is capped from a digital TV PCI card, generally giving the best results, and groups tend to release in SVCD for these. VCD/SVCD/DivX/XviD rips are all supported by the TV scene.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
WORKPRINT (WP) -A workprint is a copy of the film that has not been finished. It can be missing scenes, music, and quality can range from excellent to very poor. Some WPs are very different from the final print (Men In Black is missing all the aliens, and has actors in their places) and others can contain extra scenes (Jay and Silent Bob) . WPs can be nice additions to the collection once a good quality final has been obtained.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DivX Re-Enc -A DivX re-enc is a film that has been taken from its original VCD source, and re-encoded into a small DivX file. Most commonly found on file sharers, these are usually labeled something like Film.Name.Group(1of2) etc. Common groups are SMR and TND. These aren't really worth downloading, unless you're that unsure about a film u only want a 200mb copy of it. Generally avoid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Watermarks -&lt;br /&gt;
A lot of films come from Asian Silvers/PDVD (see below) and these are tagged by the people responsible. Usually with a letter/initials or a little logo, generally in one of the corners. Most famous are the "Z" "A" and "Globe" watermarks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Asian Silvers / PDVD -&lt;br /&gt;
These are films put out by eastern bootleggers, and these are usually bought by some groups to put out as their own. Silvers are very cheap and easily available in a lot of countries, and its easy to put out a release, which is why there are so many in the scene at the moment, mainly from smaller groups who don't last more than a few releases. PDVDs are the same thing pressed onto a DVD. They have removable subtitles, and the quality is usually better than the silvers. These are ripped like a normal DVD, but usually released as VCD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Formats&lt;br /&gt;
&lt;br /&gt;
VCD -&lt;br /&gt;
VCD is an mpeg1 based format, with a constant bitrate of 1150kbit at a resolution of 352x240 (NTCS). VCDs are generally used for lower quality transfers (CAM/TS/TC/Screener(VHS)/TVrip(analogue) in order to make smaller file sizes, and fit as much on a single disc as possible. Both VCDs and SVCDs are timed in minutes, rather than MB, so when looking at an mpeg, it may appear larger than the disc capacity, and in reality u can fit 74min on a CDR74.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SVCD -&lt;br /&gt;
SVCD is an mpeg2 based (same as DVD) which allows variable bit-rates of up to 2500kbits at a resolution of 480x480 (NTSC) which is then decompressed into a 4:3 aspect ratio when played back. Due to the variable bit-rate, the length you can fit on a single CDR is not fixed, but generally between 35-60 Mins are the most common. To get a better SVCD encode using variable bit-rates, it is important to use multiple "passes". this takes a lot longer, but the results are far clearer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
XVCD/XSVCD -&lt;br /&gt;
These are basically VCD/SVCD that don't obey the "rules". They are both capable of much higher resolutions and bit-rates, but it all depends on the player to whether the disc can be played. X(S)VCD are total non-standards, and are usually for home-ripping by people who don't intend to release them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
KVCD Thanks for lardo4life for the info&lt;br /&gt;
KVCD is a modification to the standard MPEG-1 and MPEG-2 GOP structure and Quantization Matrix. It enables you to create over 120 minutes of near DVD quality video, depending on your material, on a single 80 minute CD-R/CD-RW. We have published these specifications as KVCDx3, our official resolution, which produce 528x480 (NTSC) and 528x576 (PAL) MPEG-1 variable bit rate video, from 64Kbps to 3,000Kbps. Using a resolution of 352x240 (NTSC) or 352x288 (PAL), it's possible to encode video up to ~360 minutes of near VCD quality on a single 80 minute CD-R. The mpeg files created will play back in most modern standalone DVD players. You must burn the KVCD MPEG files as non-standard VCD or non-standard SVCD (depends on your player) with Nero or VCDEasy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DivX / XviD -&lt;br /&gt;
DivX is a format designed for multimedia platforms. It uses two codecs, one low motion, one high motion. most older films were encoded in low motion only, and they have problems with high motion too. A method known as SBC (Smart Bit-rate Control) was developed which switches codecs at the encoding stage, making a much better print. The format is Ana orphic and the bit-rate/resolution are interchangeable. Due to the higher processing power required, and the different codecs for playback, its unlikely we'll see a DVD player capable of play DivX for quite a while, if at all. There have been players in development which are supposedly capable, but nothing has ever arisen. The majority of PROPER DivX rips (not Re-Encs) are taken from DVDs, and generally up to 2hours in good quality is possible per disc. Various codecs exist, most popular being the original Divx3.11a and the new XviD codecs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CVD -&lt;br /&gt;
CVD is a combination of VCD and SVCD formats, and is generally supported by a majority of DVD players. It supports MPEG2 bit-rates of SVCD, but uses a resolution of 352x480(ntsc) as the horizontal resolution is generally less important. Currently no groups release in CVD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DVD-R -&lt;br /&gt;
Is the recordable DVD solution that seems to be the most popular (out of DVD-RAM, DVD-R and DVD+R). it holds 4.7gb of data per side, and double sided discs are available, so discs can hold nearly 10gb in some circumstances. SVCD mpeg2 images must be converted before they can be burnt to DVD-R and played successfully. DVD&amp;gt;DVDR copies are possible, but sometimes extras/languages have to be removed to stick within the available 4.7gb.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MiniDVD -&lt;br /&gt;
MiniDVD/cDVD is the same format as DVD but on a standard CDR/CDRW. Because of the high resolution/bit-rates, its only possible to fit about 18-21 mins of footage per disc, and the format is only compatible with a few players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Misc Info&lt;br /&gt;
&lt;br /&gt;
Regional Coding -&lt;br /&gt;
This was designed to stop people buying American DVDs and watching them earlier in other countries, or for older films where world distribution is handled by different companies. A lot of players can either be hacked with a chip, or via a remote to disable this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
RCE -&lt;br /&gt;
RCE (Regional Coding Enhancement) was designed to overcome "Multiregion" players, but it had a lot of faults and was overcome. Very few titles are RCE encoded now, and it was very unpopular.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Macrovision -&lt;br /&gt;
Macrovision is the copy protection employed on most commercial DVDs. Its a system that will display lines and darken the images of copies that are made by sending the VHS signals it can't understand. Certain DVD players (for example the Dansai 852 from Tescos) have a secret menu where you can disable the macrovision, or a "video stabaliser" costs about 30UKP from Maplin (www.maplin.co.uk)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NTSC/PAL -&lt;br /&gt;
NTSC and PAL are the two main standards used across the world. NTSC has a higher frame rate than pal (29fps compared to 25fps) but PAL has an increased resolution, and gives off a generally sharper picture. Playing NTSC discs on PAL systems seems a lot easier than vice-versa, which is good news for the Brits An RGB enabled scart lead will play an NTSC picture in full colour on most modern tv sets, but to record this to a VHS tape, you will need to convert it to PAL50 (not PAL60 as the majority of DVD players do.) This is either achieved by an expensive converter box (in the regions of £200+) an onboard converter (such as the Dansai 852 / certain Daewoos / Samsung 709 ) or using a World Standards VCR which can record in any format.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
About Release Files&lt;br /&gt;
&lt;br /&gt;
RARset -&lt;br /&gt;
The movies are all supplied in RAR form, whether its v2 (rar&amp;gt;.rxx) or v3 (part01.rar &amp;gt; partxx.rar) form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BIN/CUE -&lt;br /&gt;
VCD and SVCD films will extract to give a BIN/CUE. Load the .CUE into notepad and make sure the first line contains only a filename, and no path information. Then load the cue into Nero/CDRWin etc and this will burn the VCD/SVCD correctly. TV rips are released as MPEG. DivX files are just the plain DivX - .AVI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NFO -&lt;br /&gt;
An NFO file is supplied with each movie to promote the group, and give general iNFOrmation about the release, such as format, source, size, and any notes that may be of use. They are also used to recruit members and acquire hardware for the group.&lt;br /&gt;
&lt;br /&gt;
SFV -&lt;br /&gt;
Also supplied for each disc is an SFV file. These are mainly used on site level to check each file has been uploaded correctly, but are also handy for people downloading to check they have all the files, and the CRC is correct. A program such as pdSFV or hkSFV is required to use these files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Usenet Information&lt;br /&gt;
&lt;br /&gt;
Access -&lt;br /&gt;
To get onto newsgroups, you will need a news server. Most ISPs supply one, but this is usually of poor retention (the amount of time the files are on server for) and poor completition (the amount of files that make it there). For the best service, a premium news server should be paid for, and these will often have bandwidth restrictions in place.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Software -&lt;br /&gt;
You will need a newsreader to access the files in the binary newsgroups. There are many different readers, and its usually down to personal opinion which is best. Xnews / Forte Agent / BNR 1 / BNR 2 are amongst the popular choices. Outlook has the ability to read newsgroups, but its recommended to not use that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Format -&lt;br /&gt;
Usenet posts are often the same as those listed on VCDQUALiTY (i.e., untouched group releases) but you have to check the filenames and the description to make sure you get what you think you are getting. Generally releases should come down in .RAR sets. Posts will usually take more than one day to be uploaded, and can be spread out as far as a week.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PAR files -&lt;br /&gt;
As well as the .rxx files, you will also see files listed as .pxx/.par . These are PARITY files. Parity files are common in usenet posts, as a lot of times, there will be at least one or two damaged files on some servers. A parity file can be used to replace ANY ONE file that is missing from the rar set. The more PAR files you have, the more files you can replace. You will need a program called SMARTPAR for this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scene Tags&lt;br /&gt;
&lt;br /&gt;
PROPER -&lt;br /&gt;
Due to scene rules, whoever releases the first Telesync has won that race (for example). But if the quality of that release is fairly poor, if another group has another telesync (or the same source in higher quality) then the tag PROPER is added to the folder to avoid being duped. PROPER is the most subjective tag in the scene, and a lot of people will generally argue whether the PROPER is better than the original release. A lot of groups release PROPERS just out of desperation due to losing the race. A reason for the PROPER should always be included in the NFO.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SUBBED -&lt;br /&gt;
In the case of a VCD, if a release is subbed, it usually means it has hard encoded subtitles burnt throughout the movie. These are generally in malaysian/chinese/thai etc, and sometimes there are two different languages, which can take up quite a large amount of the screen. SVCD supports switch able subtitles, so some DVDRips are released with switch able subs. This will be mentioned in the NFO file if included.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
UNSUBBED -&lt;br /&gt;
When a film has had a subbed release in the past, an Unsubbed release may be released&lt;br /&gt;
&lt;br /&gt;
LIMITED -&lt;br /&gt;
A limited movie means it has had a limited theater run, generally opening in less than 250 theaters, generally smaller films (such as art house films) are released as limited.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
INTERNAL -&lt;br /&gt;
An internal release is done for several reasons. Classic DVD groups do a lot of .INTERNAL. releases, as they wont be dupe'd on it. Also lower quality theater rips are done INTERNAL so not to lower the reputation of the group, or due to the amount of rips done already. An INTERNAL release is available as normal on the groups affiliate sites, but they can't be traded to other sites without request from the site ops. Some INTERNAL releases still trickle down to IRC/Newsgroups, it usually depends on the title and the popularity. Earlier in the year people referred to Centropy going "internal". This meant the group were only releasing the movies to their members and site ops. This is in a different context to the usual definition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
STV -&lt;br /&gt;
Straight To Video. Was never released in theaters, and therefore a lot of sites do not allow these.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OTHER TAGS -&lt;br /&gt;
&lt;br /&gt;
*WS* for widescreen (letterbox)&lt;br /&gt;
*FS* for Fullscreen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
RECODE -&lt;br /&gt;
A recode is a previously released version, usually filtered through TMPGenc to remove subtitles, fix color etc. Whilst they can look better, its not looked upon highly as groups are expected to obtain their own sources.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
REPACK -&lt;br /&gt;
If a group releases a bad rip, they will release a Repack which will fix the problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NUKED -&lt;br /&gt;
A film can be nuked for various reasons. Individual sites will nuke for breaking their rules (such as "No Telesyncs") but if the film has something extremely wrong with it (no soundtrack for 20mins, CD2 is incorrect film/game etc) then a global nuke will occur, and people trading it across sites will lose their credits. Nuked films can still reach other sources such as p2p/usenet, but its a good idea to check why it was nuked first in case. If a group realise there is something wrong, they can request a nuke.&lt;br /&gt;
&lt;br /&gt;
NUKE REASONS :: this is a list of common reasons a film can be nuked for (generally DVDRip)&lt;br /&gt;
&lt;br /&gt;
** BAD A/R ** :: bad aspect ratio, ie people appear too fat/thin&lt;br /&gt;
** BAD IVTC ** :: bad inverse telecine. process of converting framerates was incorrect.&lt;br /&gt;
** INTERLACED ** :: black lines on movement as the field order is incorrect.&lt;br /&gt;
&lt;br /&gt;
DUPE -&lt;br /&gt;
Dupe is quite simply, if something exists already, then theres no reason for it to exist again without proper reason.&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/dXtJvJ2ciW0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/3811238866621390049/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=3811238866621390049" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3811238866621390049?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/3811238866621390049?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/dXtJvJ2ciW0/all-about-movie-tags-what-is-dvdrip-cam.html" title="All About Movie Tags (What Is A Dvdrip, Cam, Screener Etc.)" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2009/06/all-about-movie-tags-what-is-dvdrip-cam.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cHQ389eyp7ImA9WxJXF00.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-6191108315315225710</id><published>2009-06-11T01:30:00.000-07:00</published><updated>2009-06-11T01:30:32.163-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-11T01:30:32.163-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="frameworks" /><category scheme="http://www.blogger.com/atom/ns#" term="java" /><title>AribaWeb MetaUI Explained - Part 1</title><content type="html">AribaWeb is a full stack Java Ajax framework for developing applications, mostly on the web. It comes with so many features and tools so the issues you would have to deal with in your day to day web development is already sorted out.&lt;br /&gt;
Among its many features it the ability to generate your UI from metadata defined in stylesheet like OSS files and also from annotations defined on your classes.&lt;br /&gt;
This is very beautiful because you can generate different UI based on the device or the context in use. One very practical application is for web applications that will have to run on mobile devices - and this is the area I want to explore most once I have full grasp on AribaWeb.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://bespokecode.blogspot.com/"&gt;Read More &lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/jvafbXdr1FY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/6191108315315225710/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=6191108315315225710" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/6191108315315225710?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/6191108315315225710?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/jvafbXdr1FY/aribaweb-metaui-explained-part-1.html" title="AribaWeb MetaUI Explained - Part 1" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2009/06/aribaweb-metaui-explained-part-1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQNRXs8fyp7ImA9WxJXFU8.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-2870071776719604969</id><published>2009-06-08T23:03:00.000-07:00</published><updated>2009-06-08T23:03:14.577-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-08T23:03:14.577-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="startup" /><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><title>How Linux boots</title><content type="html">As it turns out, there isn't much to the boot process:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 1. A boot loader finds the kernel image on the disk, loads it into memory, and starts it.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 2. The kernel initializes the devices and its drivers.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 3. The kernel mounts the root filesystem.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 4. The kernel starts a program called init.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 5. init sets the rest of the processes in motion.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 6. The last processes that init starts as part of the boot sequence allow you to log in.&lt;br /&gt;
&lt;br /&gt;
Identifying each stage of the boot process is invaluable in fixing boot problems and understanding the system as a whole. To start, zero in on the boot loader, which is the initial screen or prompt you get after the computer does its power-on self-test, asking which operating system to run. After you make a choice, the boot loader runs the Linux kernel, handing control of the system to the kernel.&lt;br /&gt;
&lt;br /&gt;
There is a detailed discussion of the kernel elsewhere in this book from which this article is excerpted. This article covers the kernel initialization stage, the stage when the kernel prints a bunch of messages about the hardware present on the system. The kernel starts init just after it displays a message proclaiming that the kernel has mounted the root filesystem:&lt;br /&gt;
&lt;br /&gt;
VFS: Mounted root (ext2 filesystem) readonly.&lt;br /&gt;
&lt;br /&gt;
Soon after, you will see a message about init starting, followed by system service startup messages, and finally you get a login prompt of some sort.&lt;br /&gt;
&lt;br /&gt;
NOTE On Red Hat Linux, the init note is especially obvious, because it "welcomes" you to "Red Hat Linux." All messages thereafter show success or failure in brackets at the right-hand side of the screen.&lt;br /&gt;
&lt;br /&gt;
Most of this chapter deals with init, because it is the part of the boot sequence where you have the most control.&lt;br /&gt;
init&lt;br /&gt;
&lt;br /&gt;
There is nothing special about init. It is a program just like any other on the Linux system, and you'll find it in /sbin along with other system binaries. The main purpose of init is to start and stop other programs in a particular sequence. All you have to know is how this sequence works.&lt;br /&gt;
&lt;br /&gt;
There are a few different variations, but most Linux distributions use the System V style discussed here. Some distributions use a simpler version that resembles the BSD init, but you are unlikely to encounter this.&lt;br /&gt;
&lt;br /&gt;
Runlevels&lt;br /&gt;
&lt;br /&gt;
At any given time on a Linux system, a certain base set of processes is running. This state of the machine is called its runlevel, and it is denoted with a number from 0 through 6. The system spends most of its time in a single runlevel. However, when you shut the machine down, init switches to a different runlevel in order to terminate the system services in an orderly fashion and to tell the kernel to stop. Yet another runlevel is for single-user mode, discussed later.&lt;br /&gt;
&lt;br /&gt;
The easiest way to get a handle on runlevels is to examine the init configuration file, /etc/inittab. Look for a line like the following:&lt;br /&gt;
&lt;br /&gt;
id:5:initdefault:&lt;br /&gt;
&lt;br /&gt;
This line means that the default runlevel on the system is 5. All lines in the inittab file take this form, with four fields separated by colons occurring in the following order:&lt;br /&gt;
# A unique identifier (a short string, such as id in the preceding example)&lt;br /&gt;
# The applicable runlevel number(s)&lt;br /&gt;
# The action that init should take (in the preceding example, the action is to set the default runlevel to 5)&lt;br /&gt;
# A command to execute (optional)&lt;br /&gt;
&lt;br /&gt;
There is no command to execute in the preceding initdefault example because a command doesn't make sense in the context of setting the default runlevel. Look a little further down in inittab, until you see a line like this:&lt;br /&gt;
&lt;br /&gt;
l5:5:wait:/etc/rc.d/rc 5&lt;br /&gt;
&lt;br /&gt;
This line triggers most of the system configuration and services through the rc*.d and init.d directories. You can see that init is set to execute a command called /etc/rc.d/rc 5 when in runlevel 5. The wait action tells when and how init runs the command: run rc 5 once when entering runlevel 5, and then wait for this command to finish before doing anything else.&lt;br /&gt;
&lt;br /&gt;
There are several different actions in addition to initdefault and wait, especially pertaining to power management, and the inittab(5) manual page tells you all about them. The ones that you're most likely to encounter are explained in the following sections.&lt;br /&gt;
&lt;br /&gt;
respawn&lt;br /&gt;
&lt;br /&gt;
The respawn action causes init to run the command that follows, and if the command finishes executing, to run it again. You're likely to see something similar to this line in your inittab file:&lt;br /&gt;
&lt;br /&gt;
1:2345:respawn:/sbin/mingetty tty1&lt;br /&gt;
&lt;br /&gt;
The getty programs provide login prompts. The preceding line is for the first virtual console (/dev/tty1), the one you see when you press ALT-F1 or CONTROL-ALT-F1. The respawn action brings the login prompt back after you log out.&lt;br /&gt;
&lt;br /&gt;
ctrlaltdel&lt;br /&gt;
&lt;br /&gt;
The ctrlaltdel action controls what the system does when you press CONTROL-ALT-DELETE on a virtual console. On most systems, this is some sort of reboot command using the shutdown command.&lt;br /&gt;
&lt;br /&gt;
sysinit&lt;br /&gt;
&lt;br /&gt;
The sysinit action is the very first thing that init should run when it starts up, before entering any runlevels.&lt;br /&gt;
&lt;br /&gt;
How processes in runlevels start&lt;br /&gt;
&lt;br /&gt;
You are now ready to learn how init starts the system services, just before it lets you log in. Recall this inittab line from earlier:&lt;br /&gt;
&lt;br /&gt;
l5:5:wait:/etc/rc.d/rc 5&lt;br /&gt;
&lt;br /&gt;
This small line triggers many other programs. rc stands for run commands, and you will hear people refer to the commands as scripts, programs, or services. So, where are these commands, anyway?&lt;br /&gt;
&lt;br /&gt;
For runlevel 5, in this example, the commands are probably either in /etc/rc.d/rc5.d or /etc/rc5.d. Runlevel 1 uses rc1.d, runlevel 2 uses rc2.d, and so on. You might find the following items in the rc5.d directory:&lt;br /&gt;
&lt;br /&gt;
S10sysklogd&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S20ppp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S99gpm&lt;br /&gt;
S12kerneld&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S25netstd_nfs&amp;nbsp;&amp;nbsp; S99httpd&lt;br /&gt;
S15netstd_init&amp;nbsp;&amp;nbsp;&amp;nbsp; S30netstd_misc&amp;nbsp; S99rmnologin&lt;br /&gt;
S18netbase&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S45pcmcia&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S99sshd&lt;br /&gt;
S20acct&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S89atd&lt;br /&gt;
S20logoutd&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S89cron &lt;br /&gt;
&lt;br /&gt;
The rc 5 command starts programs in this runlevel directory by running the following commands:&lt;br /&gt;
&lt;br /&gt;
S10sysklogd start&lt;br /&gt;
S12kerneld start&lt;br /&gt;
S15netstd_init start&lt;br /&gt;
S18netbase start&lt;br /&gt;
...&lt;br /&gt;
S99sshd start &lt;br /&gt;
&lt;br /&gt;
Notice the start argument in each command. The S in a command name means that the command should run in start mode, and the number (00 through 99) determines where in the sequence rc starts the command.&lt;br /&gt;
&lt;br /&gt;
The rc*.d commands are usually shell scripts that start programs in /sbin or /usr/sbin. Normally, you can figure out what one of the commands actually does by looking at the script with less or another pager program.&lt;br /&gt;
&lt;br /&gt;
You can start one of these services by hand. For example, if you want to start the httpd Web server program manually, run S99httpd start. Similarly, if you ever need to kill one of the services when the machine is on, you can run the command in the rc*.d directory with the stop argument (S99httpd stop, for instance).&lt;br /&gt;
&lt;br /&gt;
Some rc*.d directories contain commands that start with K (for "kill," or stop mode). In this case, rc runs the command with the stop argument instead of start. You are most likely to encounter K commands in runlevels that shut the system down.&lt;br /&gt;
&lt;br /&gt;
Adding and removing services&lt;br /&gt;
&lt;br /&gt;
If you want to add, delete, or modify services in the rc*.d directories, you need to take a closer look at the files inside. A long listing reveals a structure like this:&lt;br /&gt;
&lt;br /&gt;
lrwxrwxrwx . . . S10sysklogd -&amp;gt; ../init.d/sysklogd&lt;br /&gt;
lrwxrwxrwx . . . S12kerneld -&amp;gt; ../init.d/kerneld&lt;br /&gt;
lrwxrwxrwx . . . S15netstd_init -&amp;gt; ../init.d/netstd_init&lt;br /&gt;
lrwxrwxrwx . . . S18netbase -&amp;gt; ../init.d/netbase&lt;br /&gt;
... &lt;br /&gt;
&lt;br /&gt;
The commands in an rc*.d directory are actually symbolic links to files in an init.d directory, usually in /etc or /etc/rc.d. Linux distributions contain these links so that they can use the same startup scripts for all runlevels. This convention is by no means a requirement, but it often makes organization a little easier.&lt;br /&gt;
&lt;br /&gt;
To prevent one of the commands in the init.d directory from running in a particular runlevel, you might think of removing the symbolic link in the appropriate rc*.d directory. This does work, but if you make a mistake and ever need to put the link back in place, you might have trouble remembering the exact name of the link. Therefore, you shouldn't remove links in the rc*.d directories, but rather, add an underscore (_) to the beginning of the link name like this:&lt;br /&gt;
&lt;br /&gt;
mv S99httpd _S99httpd&lt;br /&gt;
&lt;br /&gt;
At boot time, rc ignores _S99httpd because it doesn't start with S or K. Furthermore, the original name is still obvious, and you have quick access to the command if you're in a pinch and need to start it by hand.&lt;br /&gt;
&lt;br /&gt;
To add a service, you must create a script like the others in the init.d directory and then make a symbolic link in the correct rc*.d directory. The easiest way to write a script is to examine the scripts already in init.d, make a copy of one that you understand, and modify the copy.&lt;br /&gt;
&lt;br /&gt;
When adding a service, make sure that you choose an appropriate place in the boot sequence to start the service. If the service starts too soon, it may not work, due to a dependency on some other service. For non-essential services, most systems administrators prefer numbers in the 90s, after most of the services that came with the system.&lt;br /&gt;
&lt;br /&gt;
Linux distributions usually come with a command to enable and disable services in the rc*.d directories. For example, in Debian, the command is update-rc.d, and in Red Hat Linux, the command is chkconfig. Graphical user interfaces are also available. Using these programs helps keep the startup directories consistent and helps with upgrades.&lt;br /&gt;
&lt;br /&gt;
HINT: One of the most common Linux installation problems is an improperly configured XFree86 server that flicks on and off, making the system unusable on console. To stop this behavior, boot into single-user mode and alter your runlevel or runlevel services. Look for something containing xdm, gdm, or kdm in your rc*.d directories, or your /etc/inittab.&lt;br /&gt;
&lt;br /&gt;
Controlling init&lt;br /&gt;
&lt;br /&gt;
Occasionally, you need to give init a little kick to tell it to switch runlevels, to re-read the inittab file, or just to shut down the system. Because init is always the first process on a system, its process ID is always 1.&lt;br /&gt;
&lt;br /&gt;
You can control init with telinit. For example, if you want to switch to runlevel 3, use this command:&lt;br /&gt;
&lt;br /&gt;
telinit 3&lt;br /&gt;
&lt;br /&gt;
When switching runlevels, init tries to kill off any processes that aren't in the inittab file for the new runlevel. Therefore, you should be careful about changing runlevels.&lt;br /&gt;
&lt;br /&gt;
When you need to add or remove respawning jobs or make any other change to the inittab file, you must tell init about the change and cause it to re-read the file. Some people use kill -HUP 1 to tell init to do this. This traditional method works on most versions of Unix, as long as you type it correctly. However, you can also run this telinit command:&lt;br /&gt;
&lt;br /&gt;
telinit q&lt;br /&gt;
&lt;br /&gt;
You can also use telinit s to switch to single-user mode.&lt;br /&gt;
&lt;br /&gt;
Shutting down&lt;br /&gt;
&lt;br /&gt;
init also controls how the system shuts down and reboots. The proper way to shut down a Linux machine is to use the shutdown command.&lt;br /&gt;
&lt;br /&gt;
There are two basic ways to use shutdown. If you halt the system, it shuts the machine down and keeps it down. To make the machine halt immediately, use this command:&lt;br /&gt;
&lt;br /&gt;
shutdown -h now&lt;br /&gt;
&lt;br /&gt;
On most modern machines with reasonably recent versions of Linux, a halt cuts the power to the machine. You can also reboot the machine. For a reboot, use -r instead of -h.&lt;br /&gt;
&lt;br /&gt;
The shutdown process takes several seconds. You should never reset or power off a machine during this stage.&lt;br /&gt;
&lt;br /&gt;
In the preceding example, now is the time to shut down. This argument is mandatory, but there are many ways of specifying it. If you want the machine to go down sometime in the future, one way is to use +n, where n is the number of minutes shutdown should wait before doing its work. For other options, look at the shutdown(8) manual page.&lt;br /&gt;
&lt;br /&gt;
To make the system reboot in 10 minutes, run this command:&lt;br /&gt;
&lt;br /&gt;
shutdown -r +10&lt;br /&gt;
&lt;br /&gt;
On Linux, shutdown notifies anyone logged on that the machine is going down, but it does little real work. If you specify a time other than now, shutdown creates a file called /etc/nologin. When this file is present, the system prohibits logins by anyone except the superuser.&lt;br /&gt;
&lt;br /&gt;
When system shutdown time finally arrives, shutdown tells init to switch to runlevel 0 for a halt and runlevel 6 for a reboot. When init enters runlevel 0 or 6, all of the following takes place, which you can verify by looking at the scripts inside rc0.d and rc6.d:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 1. init kills every process that it can (as it would when switching to any other runlevel). &lt;br /&gt;
&lt;br /&gt;
# The initial rc0.d/rc6.d commands run, locking system files into place and making other preparations for shutdown.&lt;br /&gt;
# The next rc0.d/rc6.d commands unmount all filesystems other than the root.&lt;br /&gt;
# Further rc0.d/rc6.d commands remount the root filesystem read-only.&lt;br /&gt;
# Still more rc0.d/rc6.d commands write all buffered data out to the filesystem with the sync program.&lt;br /&gt;
# The final rc0.d/rc6.d commands tell the kernel to reboot or stop with the reboot, halt, or poweroff program.&lt;br /&gt;
&lt;br /&gt;
The reboot and halt programs behave differently for each runlevel, potentially causing confusion. By default, these programs call shutdown with the -r or -h options, but if the system is already at the halt or reboot runlevel, the programs tell the kernel to shut itself off immediately. If you really want to shut your machine down in a hurry (disregarding any possible damage from a disorderly shutdown), use the -f option.&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/PdR4Do3PyQI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/2870071776719604969/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=2870071776719604969" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/2870071776719604969?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/2870071776719604969?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/PdR4Do3PyQI/how-linux-boots.html" title="How Linux boots" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2009/06/how-linux-boots.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYARHk8fSp7ImA9WxJXFEQ.&quot;"><id>tag:blogger.com,1999:blog-3814042958808773178.post-8070662222010650127</id><published>2009-06-08T13:32:00.000-07:00</published><updated>2009-06-08T13:32:25.775-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-08T13:32:25.775-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="programing" /><category scheme="http://www.blogger.com/atom/ns#" term="windows" /><category scheme="http://www.blogger.com/atom/ns#" term="computing" /><title>Computer Acronyms</title><content type="html">ADSL - Asymmetric Digital Subscriber Line&lt;br /&gt;
AGP - Accelerated Graphics Port&lt;br /&gt;
ALI - Acer Labs, Incorporated&lt;br /&gt;
ALU - Arithmetic Logic Unit&lt;br /&gt;
AMD - Advanced Micro Devices&lt;br /&gt;
APC - American Power Conversion&lt;br /&gt;
ASCII - American Standard Code for Information Interchange&lt;br /&gt;
ASIC - Application Specific Integrated Circuit&lt;br /&gt;
ASPI - Advanced SCSI Programming Interface&lt;br /&gt;
AT - Advanced Technology&lt;br /&gt;
ATI - ATI Technologies Inc.&lt;br /&gt;
ATX - Advanced Technology Extended&lt;br /&gt;
&lt;br /&gt;
--- B ---&lt;br /&gt;
BFG - BFG Technologies&lt;br /&gt;
BIOS - Basic Input Output System&lt;br /&gt;
BNC - Barrel Nut Connector&lt;br /&gt;
&lt;br /&gt;
--- C ---&lt;br /&gt;
CAS - Column Address Signal&lt;br /&gt;
CD - Compact Disk&lt;br /&gt;
CDR - Compact Disk Recorder&lt;br /&gt;
CDRW - Compact Disk Re-Writer&lt;br /&gt;
CD-ROM - Compact Disk - Read Only Memory&lt;br /&gt;
CFM - Cubic Feet per Minute (ft�/min)&lt;br /&gt;
CMOS - Complementary Metal Oxide Semiconductor&lt;br /&gt;
CPU - Central Processing Unit&lt;br /&gt;
CTX - CTX Technology Corporation (Commited to Excellence)&lt;br /&gt;
&lt;br /&gt;
--- D ---&lt;br /&gt;
&lt;br /&gt;
DDR - Double Data Rate&lt;br /&gt;
DDR-SDRAM - Double Data Rate - Synchronous Dynamic Random Access Memory&lt;br /&gt;
DFI - DFI Inc. (Design for Innovation)&lt;br /&gt;
DIMM - Dual Inline Memory Module&lt;br /&gt;
DRAM - Dynamic Random Access Memory&lt;br /&gt;
DPI - Dots Per Inch&lt;br /&gt;
DSL - See ASDL&lt;br /&gt;
DVD - Digital Versatile Disc&lt;br /&gt;
DVD-RAM - Digital Versatile Disk - Random Access Memory&lt;br /&gt;
&lt;br /&gt;
--- E ---&lt;br /&gt;
ECC - Error Correction Code&lt;br /&gt;
ECS - Elitegroup Computer Systems&lt;br /&gt;
EDO - Extended Data Out&lt;br /&gt;
EEPROM - Electrically Erasable Programmable Read-Only Memory&lt;br /&gt;
EPROM - Erasable Programmable Read-Only Memory&lt;br /&gt;
EVGA - EVGA Corporation&lt;br /&gt;
&lt;br /&gt;
--- F ---&lt;br /&gt;
FC-PGA - Flip Chip Pin Grid Array&lt;br /&gt;
FDC - Floppy Disk Controller&lt;br /&gt;
FDD - Floppy Disk Drive&lt;br /&gt;
FPS - Frame Per Second&lt;br /&gt;
FPU - Floating Point Unit&lt;br /&gt;
FSAA - Full Screen Anti-Aliasing&lt;br /&gt;
FS - For Sale&lt;br /&gt;
FSB - Front Side Bus&lt;br /&gt;
&lt;br /&gt;
--- G ---&lt;br /&gt;
GB - Gigabytes&lt;br /&gt;
GBps - Gigabytes per second or Gigabits per second&lt;br /&gt;
GDI - Graphical Device Interface&lt;br /&gt;
GHz - GigaHertz&lt;br /&gt;
&lt;br /&gt;
--- H ---&lt;br /&gt;
HDD - Hard Disk Drive&lt;br /&gt;
HIS - Hightech Information System Limited&lt;br /&gt;
HP - Hewlett-Packard Development Company&lt;br /&gt;
HSF - Heatsink-Fan&lt;br /&gt;
&lt;br /&gt;
--- I ---&lt;br /&gt;
IBM - International Business Machines Corporation&lt;br /&gt;
IC - Integrated Circuit&lt;br /&gt;
IDE - Integrated Drive Electronics&lt;br /&gt;
IFS- Item for Sale&lt;br /&gt;
IRQ - Interrupt Request&lt;br /&gt;
ISA - Industry Standard Architecture&lt;br /&gt;
ISO - International Standards Organization&lt;br /&gt;
&lt;br /&gt;
--- J ---&lt;br /&gt;
JBL - JBL (Jame B. Lansing) Speakers&lt;br /&gt;
JVC - JVC Company of America&lt;br /&gt;
&lt;br /&gt;
- K ---&lt;br /&gt;
Kbps - Kilobits Per Second&lt;br /&gt;
KBps - KiloBytes per second&lt;br /&gt;
&lt;br /&gt;
--- L ---&lt;br /&gt;
LG - LG Electronics&lt;br /&gt;
LAN - Local Are Network&lt;br /&gt;
LCD - Liquid Crystal Display&lt;br /&gt;
LDT - Lightning Data Transport&lt;br /&gt;
LED - Light Emitting Diode&lt;br /&gt;
&lt;br /&gt;
--- M ---&lt;br /&gt;
MAC - Media Access Control&lt;br /&gt;
MB � MotherBoard or Megabyte&lt;br /&gt;
MBps - Megabytes Per Second&lt;br /&gt;
Mbps - Megabits Per Second or Megabits Per Second&lt;br /&gt;
MHz - MegaHertz&lt;br /&gt;
MIPS - Million Instructions Per Second&lt;br /&gt;
MMX - Multi-Media Extensions&lt;br /&gt;
MSI - Micro Star International&lt;br /&gt;
&lt;br /&gt;
--- N ---&lt;br /&gt;
NAS - Network Attached Storage&lt;br /&gt;
NAT - Network Address Translation&lt;br /&gt;
NEC - NEC Corporation&lt;br /&gt;
NIC - Network Interface Card&lt;br /&gt;
&lt;br /&gt;
--- O ---&lt;br /&gt;
OC - Overclock (Over Clock)&lt;br /&gt;
OCZ - OCZ Technology&lt;br /&gt;
OEM - Original Equipment Manufacturer&lt;br /&gt;
&lt;br /&gt;
--- P ---&lt;br /&gt;
PC - Personal Computer&lt;br /&gt;
PCB - Printed Circuit Board&lt;br /&gt;
PCI - Peripheral Component Interconnect&lt;br /&gt;
PDA - Personal Digital Assistant&lt;br /&gt;
PCMCIA - Peripheral Component Microchannel Interconnect Architecture&lt;br /&gt;
PGA - Professional Graphics Array&lt;br /&gt;
PLD - Programmable Logic Device&lt;br /&gt;
PM - Private Message / Private Messaging&lt;br /&gt;
PnP - Plug 'n Play&lt;br /&gt;
PNY - PNY Technology&lt;br /&gt;
POST - Power On Self Test&lt;br /&gt;
PPPoA - Point-to-Point Protocol over ATM&lt;br /&gt;
PPPoE - Point-to-Point Protocol over Ethernet&lt;br /&gt;
PQI - PQI Corporation&lt;br /&gt;
PSU - Power Supply Unit&lt;br /&gt;
&lt;br /&gt;
--- R ---&lt;br /&gt;
RAID - Redundant Array of Inexpensive Disks&lt;br /&gt;
RAM - Random Access Memory&lt;br /&gt;
RAMDAC - Random Access Memory Digital Analog Convertor&lt;br /&gt;
RDRAM - Rambus Dynamic Random Access Memory&lt;br /&gt;
ROM - Read Only Memory&lt;br /&gt;
RPM - Revolutions Per Minute&lt;br /&gt;
&lt;br /&gt;
--- S ---&lt;br /&gt;
SASID - Self-scanned Amorphous Silicon Integrated Display&lt;br /&gt;
SCA - SCSI Configured Automatically&lt;br /&gt;
SCSI - Small Computer System Interface&lt;br /&gt;
SDRAM - Synchronous Dynamic Random Access Memory&lt;br /&gt;
SECC - Single Edge Contact Connector&lt;br /&gt;
SODIMM - Small Outline Dual Inline Memory Module&lt;br /&gt;
SPARC - Scalable Processor ArChitecture&lt;br /&gt;
SOHO - Small Office Home Office&lt;br /&gt;
SRAM - Static Random Access Memory&lt;br /&gt;
SSE - Streaming SIMD Extensions&lt;br /&gt;
SVGA - Super Video Graphics Array&lt;br /&gt;
S/PDIF - Sony/Philips Digital Interface&lt;br /&gt;
&lt;br /&gt;
--- T ---&lt;br /&gt;
TB - Terabytes&lt;br /&gt;
TBps - Terabytes per second&lt;br /&gt;
Tbps - Terabits per second&lt;br /&gt;
TDK - TDK Electronics&lt;br /&gt;
TEC - Thermoelectric Cooler&lt;br /&gt;
TPC - TipidPC&lt;br /&gt;
TWAIN - Technology Without An Important Name&lt;br /&gt;
&lt;br /&gt;
--- U ---&lt;br /&gt;
UART - Universal Asynchronous Receiver/Transmitter&lt;br /&gt;
USB - Universal Serial Bus&lt;br /&gt;
UTP - Unshieled Twisted Pair&lt;br /&gt;
&lt;br /&gt;
--- V ---&lt;br /&gt;
VCD - Video CD&lt;br /&gt;
VPN - Virtual Private Network&lt;br /&gt;
&lt;br /&gt;
--- W ---&lt;br /&gt;
WAN - Wide Area Network&lt;br /&gt;
WTB - Want to Buy&lt;br /&gt;
WYSIWYG - What You See Is What You Get&lt;br /&gt;
&lt;br /&gt;
--- X ---&lt;br /&gt;
XGA - Extended Graphics Array&lt;br /&gt;
XFX - XFX Graphics, a Division of Pine&lt;br /&gt;
XMS - Extended Memory Specification&lt;br /&gt;
XT - Extended Technology&lt;img src="http://feeds.feedburner.com/~r/CameoTutorials/~4/NSlD6NuoF8c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://cameotutorials.blogspot.com/feeds/8070662222010650127/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=3814042958808773178&amp;postID=8070662222010650127" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/8070662222010650127?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3814042958808773178/posts/default/8070662222010650127?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CameoTutorials/~3/NSlD6NuoF8c/computer-acronyms.html" title="Computer Acronyms" /><author><name>cameo</name><uri>http://www.blogger.com/profile/16658066881665066045</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://cameotutorials.blogspot.com/2009/06/computer-acronyms.html</feedburner:origLink></entry></feed>
