<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>J2EE Architecture Blog</title>
	<atom:link href="http://architecturej2ee.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://architecturej2ee.wordpress.com</link>
	<description>THE ARCHITECT KEY TO SUCCESS</description>
	<lastBuildDate>Fri, 15 May 2009 16:13:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='architecturej2ee.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>J2EE Architecture Blog</title>
		<link>http://architecturej2ee.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://architecturej2ee.wordpress.com/osd.xml" title="J2EE Architecture Blog" />
	<atom:link rel='hub' href='http://architecturej2ee.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Caching in a JSF managed bean</title>
		<link>http://architecturej2ee.wordpress.com/2009/05/15/caching-in-a-jsf-managed-bean-2/</link>
		<comments>http://architecturej2ee.wordpress.com/2009/05/15/caching-in-a-jsf-managed-bean-2/#comments</comments>
		<pubDate>Fri, 15 May 2009 16:13:32 +0000</pubDate>
		<dc:creator>prowebtiger</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[jsf]]></category>

		<guid isPermaLink="false">http://architecturej2ee.wordpress.com/?p=12</guid>
		<description><![CDATA[Some Theory &#8230; According to wikipedia, a cache (pronounced /kæʃ/) is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch (owing to longer access time) or to compute, compared to the cost of reading the cache. In other words, a cache is a temporary [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=architecturej2ee.wordpress.com&amp;blog=7764380&amp;post=12&amp;subd=architecturej2ee&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Some Theory &#8230;</strong></p>
<p>According to wikipedia, a cache (pronounced /kæʃ/) is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch (owing to longer access time) or to compute, compared to the cost of reading the cache. In other words, a cache is a temporary storage area where frequently accessed data can be stored for rapid access. Once the data is stored in the cache, it can be used in the future by accessing the cached copy rather than re-fetching or recomputing the original data.</p>
<p> </p>
<p><strong>Let&#8217;s get into practice&#8230;</strong></p>
<p> </p>
<p><strong>Case Study:</strong></p>
<ul>
<li>I have an e-commerce site with a catalog of products stored in a relational database. When a user chooses a category, products are loaded from the database and displayed to the user.</li>
<li>Question: What if the user chooses 10 times the same category ?</li>
<li>Answer: The application will call 10 times the database querying for products of the same category resulting in a performance hit.</li>
<li>Solution : Use of caching.</li>
</ul>
<p><strong>Assumptions:</strong></p>
<ul>
<li>3 tier level architecture using JSF at presentation level and EJB 3 at business level.</li>
<li>The same catalog is used for all the users.</li>
<li>A single machine is sufficient for storing the catalog. No cluster needed.</li>
<li>No need for a deletion or replacement algorithm.</li>
</ul>
<p><strong>Solution:</strong></p>
<ul>
<li>Create a &#8220;CachedCatalogBean&#8221; session bean that has a method &#8220;List loadCatalog()&#8221; that loads the whole catalog from the database.</li>
<li>Create an application scope JSF managed bean &#8220;CachedCatalogController&#8221; to store our catalog.</li>
<li>Define a catalog variable in the JSF maanged bean that&#8217;ll store the catalog and a getter method to access it.</li>
<li>Create a &#8220;CachedCatalogListener&#8221; that&#8217;s subclass of ServletContextListener to cache the catalog at server startup.</li>
<li>From the contextInitialized(ServletContextEvent sce) method of the &#8220;CachedCatalogListener&#8221; class, call the &#8220;loadCatalog&#8221; method to get the catalog in order to put it in the servlet context attribute &#8220;myCatalog&#8221;.</li>
<li>In the JSF managed bean constructor, get the servlet context attribute value by calling FacesContext.getCurrentInstance().getExternalContext().getContext().getAttribute(&#8220;myCatalog&#8221;) in order to initialize the JSF managed bean catalog variable that&#8217;ll be used application-wide to access our catalog.</li>
</ul>
<p style="text-align:center;"><strong><em>Enjoy caching performance and have fun.</em></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/architecturej2ee.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/architecturej2ee.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/architecturej2ee.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/architecturej2ee.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/architecturej2ee.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/architecturej2ee.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/architecturej2ee.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/architecturej2ee.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/architecturej2ee.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/architecturej2ee.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/architecturej2ee.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/architecturej2ee.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/architecturej2ee.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/architecturej2ee.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=architecturej2ee.wordpress.com&amp;blog=7764380&amp;post=12&amp;subd=architecturej2ee&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://architecturej2ee.wordpress.com/2009/05/15/caching-in-a-jsf-managed-bean-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6db03ee7899e5e0244be81f421b334be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">prowebtiger</media:title>
		</media:content>
	</item>
		<item>
		<title>Amine.whoIs() ?</title>
		<link>http://architecturej2ee.wordpress.com/2009/05/15/hello-world/</link>
		<comments>http://architecturej2ee.wordpress.com/2009/05/15/hello-world/#comments</comments>
		<pubDate>Fri, 15 May 2009 15:34:55 +0000</pubDate>
		<dc:creator>prowebtiger</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[Mohammed Amine TAZI]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Hi everybody. Welcome to my architecture blog.  To introduce myself, my name&#8217;s Mohammed Amine TAZI and I was born in Morocco. I&#8217;m a senior J2EE developer and Sun Certified Enterprise Architect for JEE 5 Technology.  I&#8217;m here to share my knowledge blogging  about architecture and development using J2EE technology. I hope you enjoy reading and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=architecturej2ee.wordpress.com&amp;blog=7764380&amp;post=1&amp;subd=architecturej2ee&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi everybody. Welcome to my architecture blog. </p>
<p>To introduce myself, my name&#8217;s Mohammed Amine TAZI and I was born in Morocco. I&#8217;m a senior J2EE developer and Sun Certified Enterprise Architect for JEE 5 Technology. </p>
<p>I&#8217;m here to share my knowledge blogging  about architecture and development using J2EE technology.</p>
<p>I hope you enjoy reading and having fun.</p>
<p>Amine.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/architecturej2ee.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/architecturej2ee.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/architecturej2ee.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/architecturej2ee.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/architecturej2ee.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/architecturej2ee.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/architecturej2ee.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/architecturej2ee.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/architecturej2ee.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/architecturej2ee.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/architecturej2ee.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/architecturej2ee.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/architecturej2ee.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/architecturej2ee.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=architecturej2ee.wordpress.com&amp;blog=7764380&amp;post=1&amp;subd=architecturej2ee&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://architecturej2ee.wordpress.com/2009/05/15/hello-world/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6db03ee7899e5e0244be81f421b334be?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">prowebtiger</media:title>
		</media:content>
	</item>
	</channel>
</rss>
