<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' 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'><id>tag:blogger.com,1999:blog-5895727818503045962</id><updated>2024-09-11T19:03:08.169-07:00</updated><title type='text'>Samar&#39;s Blog</title><subtitle type='html'>Everything Java.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-6583038170000468197</id><published>2015-10-23T13:44:00.000-07:00</published><updated>2016-12-08T15:06:18.364-08:00</updated><title type='text'>Create ElasticSearch cluster on single machine</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;i&gt;I wanted to figure out how to create a multi-node ElasticSearch cluster on single machine. So i followed these instructions&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;First i did download elasticsearch zip file.&lt;/li&gt;
&lt;li&gt;Create 3 folders in &amp;nbsp;like node1, node2 and node3&lt;/li&gt;
&lt;li&gt;Unzip elasticsearch.zip in each one of these folders and name the folder node1,node2,node3&lt;/li&gt;
&lt;li&gt;Then i opened the node1/config/elasticsearch.yml and i did change value of cluster.name to samarcluster and value of node.name to node1,node2 and node 3 &amp;nbsp;as shown below.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div&gt;
Typical setup done with 3 nodes on a single machine&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
node1:&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cluster.name: samarcluster&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node.name: &quot;node1&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node.master: true&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node.data: true&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
node2 :&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cluster.name: samarcluster&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node.name: &quot;node2&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node.master: false&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node.data: true&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
node3 :&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cluster.name: samarcluster&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node.name: &quot;node3&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node.master: false&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;node.data: false&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Next step was to install below Plugins&lt;/div&gt;
&lt;div&gt;
Marvel on each of the nodes by executing bin/plugin -i elasticsearch/marvel/latest&lt;/div&gt;
&lt;div&gt;
ElasticSearch-HQ on each of the nodes by executing&amp;nbsp;bin/plugin -install royrusso/elasticsearch-HQ&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Once all the 3 nodes are started, i could see them in marvel and elasticHQ as shown below.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Ze_zCBqrdCssocDSawpmLYqj_7J7RIUcU9DZPQkHpB4EFK_c1N0PlDl_nIMtAMiSJQblmm7piObl_coDZ5S3RPxjS99__CIPM3_WqH89Byo3iFl0RfXyhPxT_jn5YNIgGvhcc-oFE94/s1600/shardAllocation.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;121&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Ze_zCBqrdCssocDSawpmLYqj_7J7RIUcU9DZPQkHpB4EFK_c1N0PlDl_nIMtAMiSJQblmm7piObl_coDZ5S3RPxjS99__CIPM3_WqH89Byo3iFl0RfXyhPxT_jn5YNIgGvhcc-oFE94/s320/shardAllocation.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBcx6aSwS5QnL_LwhCQAIqLJ3ieUGfxHqUQGl8l9td2E3LtK-ARLtStNZdGyH5NEZCi_PgfKqJiBupVFzFNwWLujhxBqx4_zAPxHESzrQqX1wnTF2zdrktwRFMy8dCHrKXcouOKgK-9JQ/s1600/categoryIndex.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBcx6aSwS5QnL_LwhCQAIqLJ3ieUGfxHqUQGl8l9td2E3LtK-ARLtStNZdGyH5NEZCi_PgfKqJiBupVFzFNwWLujhxBqx4_zAPxHESzrQqX1wnTF2zdrktwRFMy8dCHrKXcouOKgK-9JQ/s320/categoryIndex.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyyXbuV4LzNZCKf3mdWNowfCouF5bJFhlI_XOzxfukz_36gPEQvipL9nhzLcXEcAmlNyjGS5Faji5NZ1jf1x4G30ppuWqt_UN_GFCAOa5Au0DDcDQttIz_RnjGUILvZP5A9dOX4RXFqPI/s1600/nodeDiagnostics.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;257&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyyXbuV4LzNZCKf3mdWNowfCouF5bJFhlI_XOzxfukz_36gPEQvipL9nhzLcXEcAmlNyjGS5Faji5NZ1jf1x4G30ppuWqt_UN_GFCAOa5Au0DDcDQttIz_RnjGUILvZP5A9dOX4RXFqPI/s320/nodeDiagnostics.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyJ1yGUXn-vJ1wmLGRparmpA2CviwurIOLQiXcGCiCyOB6_CnlqxotGB7uDhJbfz5ol7Y6W67GNwKtjMS5tVMJgdnBj4aBh6sJZDhoFExnU4DV5JmDXj8Wh7B3Rrk52aIoTJ7ueKOBxNI/s1600/clusterOverview.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;148&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyJ1yGUXn-vJ1wmLGRparmpA2CviwurIOLQiXcGCiCyOB6_CnlqxotGB7uDhJbfz5ol7Y6W67GNwKtjMS5tVMJgdnBj4aBh6sJZDhoFExnU4DV5JmDXj8Wh7B3Rrk52aIoTJ7ueKOBxNI/s320/clusterOverview.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: #666666; font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/6583038170000468197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/6583038170000468197'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2015/10/create-elasticsearch-cluster-on-single.html' title='Create ElasticSearch cluster on single machine'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Ze_zCBqrdCssocDSawpmLYqj_7J7RIUcU9DZPQkHpB4EFK_c1N0PlDl_nIMtAMiSJQblmm7piObl_coDZ5S3RPxjS99__CIPM3_WqH89Byo3iFl0RfXyhPxT_jn5YNIgGvhcc-oFE94/s72-c/shardAllocation.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-4401589613370076569</id><published>2015-10-08T20:13:00.000-07:00</published><updated>2015-10-13T13:33:50.321-07:00</updated><title type='text'>Elastic Search MongoDB Integration</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
Follow below steps to install elastic search, assuming mongoldb is already installed.&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
1)curl -O &lt;a href=&quot;https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.zip&quot;&gt;https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.zip&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
2) export ES_HOME=/Users/samaraarkotti/Documents/elasticsearch-1.7.2 &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
3) $ES_HOME/bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/2.7.1 &amp;nbsp; (&amp;nbsp; &lt;a href=&quot;https://github.com/elastic/elasticsearch-mapper-attachments&quot;&gt;https://github.com/elastic/elasticsearch-mapper-attachments&lt;/a&gt; )&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
4) $ES_HOME/bin/plugin -install com.github.richardwilly98.elasticsearch/elasticsearch-river-mongodb/2.0.9 ( &lt;a href=&quot;https://github.com/richardwilly98/elasticsearch-river-mongodb/&quot;&gt;https://github.com/richardwilly98/elasticsearch-river-mongodb/&lt;/a&gt; )&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
5) $ES_HOME/bin/plugin --install mobz/elasticsearch-head&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
6) $ES_HOME/bin/plugin -i elasticsearch/marvel/latest&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
7) start elastic search bin/elasticsearch&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
Optional Plugin to install&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
$ES_HOME/bin/plugin --install lukas-vlcek/bigdesk ( To access Inquisitor, open &lt;a href=&quot;http://localhost:9200/_plugin/bigdesk&quot;&gt;http://localhost:9200/_plugin/bigdesk&lt;/a&gt;)&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
$ES_HOME/bin/plugin -install polyfractal/elasticsearch-inquisitor &amp;nbsp; ( To access Inquisitor, open &lt;a href=&quot;http://localhost:9200/_plugin/inquisitor/&quot;&gt;http://localhost:9200/_plugin/inquisitor/&lt;/a&gt; )&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
curl -XPUT &#39;&lt;a href=&quot;http://localhost:9200/_river/mongodb/_meta&quot;&gt;http://localhost:9200/_river/mongodb/_meta&lt;/a&gt;&#39; -d &#39;{&quot;type&quot;: &quot;mongodb&quot;,&quot;mongodb&quot;: {&quot;db&quot;: &quot;analytics&quot;,&quot;collection&quot;: &quot;Article&quot;},&quot;index&quot;: {&quot;name&quot;: &quot;articleindex&quot;,&quot;type&quot;: &quot;article&quot;}}&#39;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
curl -XPUT &#39;&lt;a href=&quot;http://localhost:9200/_river/mongodb/_meta&quot;&gt;http://localhost:9200/_river/mongodb/_meta&lt;/a&gt;&#39; -d &#39;{&quot;type&quot;: &quot;mongodb&quot;,&quot;mongodb&quot;: {&quot;db&quot;: &quot;analytics&quot;,&quot;collection&quot;: &quot;ViewsAndRatingDetails&quot;},&quot;index&quot;: {&quot;name&quot;: &quot;viewindex&quot;,&quot;type&quot;: &quot;views&quot;}}&#39;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
-- DELETE Plugins using curl or directly on web both &lt;b&gt;articleindex&lt;/b&gt; and &lt;b&gt;_river , &lt;/b&gt;once done , run above curl command to index again .&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
curl -XDELETE &#39;&lt;a href=&quot;http://localhost:9200/_river/mongodb&quot;&gt;http://localhost:9200/_river/mongodb&lt;/a&gt;&#39;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
curl -XDELETE &#39;&lt;a href=&quot;http://localhost:9200/articleindex&quot;&gt;http://localhost:9200/articleindex&lt;/a&gt;&#39;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
Reference&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&lt;a href=&quot;http://localhost:9200/_plugin/river-mongodb/&quot;&gt;http://localhost:9200/_plugin/river-mongodb/&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&lt;a href=&quot;http://localhost:9200/_plugin/head/&quot;&gt;http://localhost:9200/_plugin/head/&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&lt;a href=&quot;http://localhost:9200/_plugin/marvel/sense/index.html&quot;&gt;http://localhost:9200/_plugin/marvel/sense/index.html&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&lt;a href=&quot;http://localhost:9200/_plugin/calaca/&quot;&gt;http://localhost:9200/_plugin/calaca/&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&lt;a href=&quot;https://www.elastic.co/guide/en/elasticsearch/reference/1.4/modules-plugins.html&quot;&gt;https://www.elastic.co/guide/en/elasticsearch/reference/1.4/modules-plugins.html&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
--- if getting any error&#39;s converting your standalone mongodb to replicaset , follow below steps&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
1)start the server in your usual way (single instance)&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
2)connect to the instance with a similar command : ./mongo --port 27017&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
3)look at your databases : &lt;b&gt;show dbs&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
4)if there is a db called local, connect to it:&amp;nbsp; &lt;b&gt;use local&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
drop that database : db.dropDatabase()&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
--- if you are getting error saying _mongodb RIVER FAILED to start ,&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
1) Then delete the _river plugin ( curl -XDELETE &#39;&lt;a href=&quot;http://localhost:9200/_river/mongodb&quot;&gt;http://localhost:9200/_river/mongodb&lt;/a&gt;&#39; )&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
2) shutdown ES and restart&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
-- disable dynamic mapping&amp;nbsp; -- NOT WORKING&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
curl -XDELETE localhost:9200/articleindex&amp;nbsp; &amp;nbsp; --- First delete the index&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
curl -XPUT localhost:9200/articleindex -d &#39;{&quot;index.mapper.dynamic&quot;: false}&#39;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
--added below in &lt;b&gt;elasticsearch.yml&lt;/b&gt; under &lt;b&gt;config&lt;/b&gt; folder&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
you will also need to configure elastic search to accept requests from the browser using CORS ( cross origin site scripting). To enable CORS, add the following to elasticsearch&#39;s config file. Usually, this file is located near the elasticsearch &amp;nbsp;at config/elasticsearch.yml&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
http.cors:&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; enabled: true&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; allow-origin: /https?:\/\/localhost(:[0-9]+)?/&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: normal; min-height: 14px;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/4401589613370076569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/4401589613370076569'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2015/10/elastic-search-mongodb-integration.html' title='Elastic Search MongoDB Integration'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-2510646511638735001</id><published>2015-04-16T13:32:00.003-07:00</published><updated>2015-04-16T13:41:15.650-07:00</updated><title type='text'>ElasticSearch and Mongo through river – scalable data store and search engine platform</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;b&gt;1. MONGODB&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;MongoDB is an open-source document database
with built in replication, high availability, auto-sharding and map/reduce
mechanisms.Install MongoDB from&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Times;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/&lt;/span&gt;&lt;span style=&quot;font-family: Times;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;b&gt;2. ELASTICSEARCH&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Times;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;Elastic search&amp;nbsp;is a&amp;nbsp;powerful open
source, real-time search and analytics engine, designed from the ground up to
be used in distributed environments with reliability and scalability as
a&amp;nbsp;must have. Looks great as a&amp;nbsp;search engine.&lt;/span&gt;&lt;span style=&quot;font-family: Times;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;Download Elastic Search from&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica; mso-bidi-font-family: Helvetica;&quot;&gt;: &lt;a href=&quot;https://www.elastic.co/&quot;&gt;&lt;span style=&quot;color: #0000e9;&quot;&gt;https://www.elastic.co&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;OR&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;
Use below command from terminal&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica; mso-bidi-font-family: Helvetica;&quot;&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;curl -O&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica; mso-bidi-font-family: Helvetica;&quot;&gt;&amp;nbsp;&lt;a href=&quot;https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.2.zip&quot;&gt;&lt;span style=&quot;color: #0000e9;&quot;&gt;https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.2.zip&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;Export ES_HOME=/Users/xxx/Downloads/elasticsearch-1.4.2&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica; mso-bidi-font-family: Helvetica;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Times;&quot;&gt;&lt;b&gt;3. MONGODB RIVER PLUGIN FOR ES&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;Elastic search provides ability to enhance the
basic functionality by plugins, which are easy to use and develop. They can be
used for analysis, discovery, monitoring, data synchronization and many others.
Rivers is a&amp;nbsp;group of plugins used for data synchronization between
database and elastic search&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-layout-grid-align: none; mso-list: l0 level1 lfo1; mso-pagination: none; text-autospace: none; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;b&gt;The
first is a dependency called Mapper Attachments. You can install via the ES
plugin script:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1.0in; mso-add-space: auto; mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;i&gt;$ES_HOME/bin/plugin
-install elasticsearch/elasticsearch-mapper-attachments/2.4.3&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-layout-grid-align: none; mso-list: l0 level1 lfo1; mso-pagination: none; text-autospace: none; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;b&gt;The
second plugin is the ES &#39;river&#39; for Mongo. The syntax to install it is slightly
different as it&#39;s a third-party plugin:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1.0in; mso-add-space: auto; mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;i&gt;$ES_HOME/bin/plugin
-install
com.github.richardwilly98.elasticsearch/elasticsearch-river-mongodb/2.0.9&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-layout-grid-align: none; mso-list: l0 level1 lfo1; mso-pagination: none; text-autospace: none; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;b&gt;Restart
the server&amp;nbsp;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;i&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;sh elastic search restart&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;Elastic Search is on board and running –
3 minutes in my case. It’s recommended to use the second machine to avoid sharing
resources, but for test deployments a&amp;nbsp;single one is good enough.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Helvetica; mso-bidi-font-family: Helvetica;&quot;&gt;Tell elastic search to index the “person”
collection in testmongo database by issuing the following command in your
terminal.&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Helvetica; mso-bidi-font-family: Helvetica;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;curl -XPUT &#39;&lt;a href=&quot;http://localhost:9200/_river/mongodb/_meta&quot;&gt;&lt;span style=&quot;color: windowtext; text-decoration: none; text-underline: none;&quot;&gt;http://localhost:9200/_river/mongodb/_meta&lt;/span&gt;&lt;/a&gt;&#39;
-d &#39;{ &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&quot;type&quot;: &quot;mongodb&quot;, &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&quot;mongodb&quot;: { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&quot;db&quot;: &quot;testmongo&quot;, &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&quot;collection&quot;: &quot;person&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&quot;index&quot;: {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&quot;name&quot;: &quot;mongoindex&quot;, &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&quot;type&quot;: &quot;person&quot; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;}&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;We’ve got ElasticSearch automatically synchronizing
data with MongoDB &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;2 minutes in my case.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Times;&quot;&gt;&lt;b&gt;4. Setup MONGODB As Replica Set.&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;MongoDB -- setting up replica set on the local host( Mac OS X) &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;mongod --port 27017
--dbpath /data/db --replSet rs0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;rs.initiate()&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;-- &amp;gt; this will initiate new replica set.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;Create a Mongo Database: &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;testmongo&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;Create a Mongo Collection under testmongo: &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;person&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Times;&quot;&gt;&lt;b&gt;5. Now finally start the Search.&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;Use this command to
search the data from terminal or go to URL directly to see below response&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;curl -XGET &#39;&lt;a href=&quot;http://localhost:9200/mongoindex/_search?q=firstName:John&quot;&gt;&lt;span style=&quot;color: windowtext; text-decoration: none; text-underline: none;&quot;&gt;http://localhost:9200/mongoindex/_search?q=firstName:John&lt;/span&gt;&lt;/a&gt;&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;Response from Elastic
Search : &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&quot;took&quot;: 42,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&quot;timed_out&quot;: false,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&quot;_shards&quot;: {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;total&quot;: 5,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;successful&quot;: 5,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;failed&quot;: 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;},&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&quot;hits&quot;: {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;total&quot;: 1,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;max_score&quot;: 1.4054651,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;hits&quot;: [&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;_index&quot;:
&quot;mongoindex&quot;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;_type&quot;: &quot;person&quot;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;_id&quot;:
&quot;552ee22d9f829d905d5f180f&quot;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;_score&quot;: 1.4054651,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;_source&quot;: {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;lastName&quot;:
&quot;Doe&quot;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;_id&quot;:
&quot;552ee22d9f829d905d5f180f&quot;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;firstName&quot;:
&quot;John&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;After inserting document in MongoDB configured
as replica set, it is also stored in oplog collection.The mentioned collection
is operations log configured as capped collection, which keeps a&amp;nbsp;rolling
record of all operations that modify the data stored in databases. River plugin
monitors this collection and forwards new operations to elasticsearch according
to its configuration. That means that all insert, update and delete operations
are forwarded to elasticsearch automatically..&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;We can easily check what we have in ES using head plugin, which can
be installed with the help of command:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;./plugin -install mobz/elasticsearch-head&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;Some elasticsearch plugins provide web interface that can be reached
using endpoint /_plugin:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;a href=&quot;http://localhost:9200/_plugin/river-mongodb/&quot;&gt;&lt;span style=&quot;color: windowtext; text-decoration: none; text-underline: none;&quot;&gt;http://localhost:9200/_plugin/river-mongodb/&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEginLxkUEwZp_hIJH9xcTPxfmu6m6oQPKVJPdNnOStvZhsOJjYii76q-V6MA88UuojmKcEpsksG5AziSxf-zpmKq8ecB9cS1FcYjLmxORXwU_MZOQ8cwaAYGfSG1or9RYrm9RZLVDyIKzQ/s1600/Screen+Shot+2015-04-16+at+10.51.48+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEginLxkUEwZp_hIJH9xcTPxfmu6m6oQPKVJPdNnOStvZhsOJjYii76q-V6MA88UuojmKcEpsksG5AziSxf-zpmKq8ecB9cS1FcYjLmxORXwU_MZOQ8cwaAYGfSG1or9RYrm9RZLVDyIKzQ/s1600/Screen+Shot+2015-04-16+at+10.51.48+AM.png&quot; height=&quot;212&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; mso-pagination: none; tab-stops: 28.0pt 56.0pt 84.0pt 112.0pt 140.0pt 168.0pt 196.0pt 224.0pt 3.5in 280.0pt 308.0pt 336.0pt; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;a href=&quot;http://localhost:9200/_plugin/head/&quot; style=&quot;font-family: &#39;PT Sans&#39;;&quot;&gt;&lt;span style=&quot;color: windowtext; text-decoration: none; text-underline: none;&quot;&gt;http://localhost:9200/_plugin/head/&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:OfficeDocumentSettings&gt;
  &lt;o:AllowPNG/&gt;
  &lt;o:PixelsPerInch&gt;96&lt;/o:PixelsPerInch&gt;
 &lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;

&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;JA&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:EnableOpenTypeKerning/&gt;
   &lt;w:DontFlipMirrorIndents/&gt;
   &lt;w:OverrideTableStyleHps/&gt;
   &lt;w:UseFELayout/&gt;
  &lt;/w:Compatibility&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;
   &lt;m:brkBin m:val=&quot;before&quot;/&gt;
   &lt;m:brkBinSub m:val=&quot;&amp;#45;-&quot;/&gt;
   &lt;m:smallFrac m:val=&quot;off&quot;/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val=&quot;0&quot;/&gt;
   &lt;m:rMargin m:val=&quot;0&quot;/&gt;
   &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;
   &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;
   &lt;m:intLim m:val=&quot;subSup&quot;/&gt;
   &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState=&quot;false&quot; DefUnhideWhenUsed=&quot;false&quot;
  DefSemiHidden=&quot;false&quot; DefQFormat=&quot;false&quot; DefPriority=&quot;99&quot;
  LatentStyleCount=&quot;380&quot;&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;0&quot; QFormat=&quot;true&quot; Name=&quot;Normal&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Normal Indent&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;footnote text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;annotation text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;header&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;footer&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index heading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;35&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;caption&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;table of figures&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;envelope address&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;envelope return&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;footnote reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;annotation reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;line number&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;page number&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;endnote reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;endnote text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;table of authorities&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;macro&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;toa heading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Bullet&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Number&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Bullet 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Bullet 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Bullet 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Bullet 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Number 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Number 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Number 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Number 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;10&quot; QFormat=&quot;true&quot; Name=&quot;Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Closing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Signature&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;Default Paragraph Font&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text Indent&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Continue&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Continue 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Continue 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Continue 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Continue 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Message Header&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;11&quot; QFormat=&quot;true&quot; Name=&quot;Subtitle&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Salutation&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Date&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text First Indent&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text First Indent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Heading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text Indent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text Indent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Block Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Hyperlink&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;FollowedHyperlink&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;22&quot; QFormat=&quot;true&quot; Name=&quot;Strong&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;20&quot; QFormat=&quot;true&quot; Name=&quot;Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Document Map&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Plain Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;E-mail Signature&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Top of Form&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Bottom of Form&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Normal (Web)&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Acronym&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Address&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Cite&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Code&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Definition&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Keyboard&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Preformatted&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Sample&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Typewriter&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Variable&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Normal Table&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;annotation subject&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;No List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Outline List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Outline List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Outline List 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Simple 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Simple 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Simple 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Classic 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Classic 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Classic 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Classic 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Colorful 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Colorful 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Colorful 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Columns 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Columns 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Columns 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Columns 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Columns 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table 3D effects 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table 3D effects 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table 3D effects 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Contemporary&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Elegant&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Professional&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Subtle 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Subtle 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Web 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Web 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Web 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Balloon Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;Table Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Theme&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Level 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Level 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Level 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Level 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Level 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Level 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Level 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Level 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Level 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; Name=&quot;Placeholder Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; QFormat=&quot;true&quot; Name=&quot;No Spacing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; Name=&quot;Revision&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;34&quot; QFormat=&quot;true&quot;
   Name=&quot;List Paragraph&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;29&quot; QFormat=&quot;true&quot; Name=&quot;Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;30&quot; QFormat=&quot;true&quot;
   Name=&quot;Intense Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;19&quot; QFormat=&quot;true&quot;
   Name=&quot;Subtle Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;21&quot; QFormat=&quot;true&quot;
   Name=&quot;Intense Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;31&quot; QFormat=&quot;true&quot;
   Name=&quot;Subtle Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;32&quot; QFormat=&quot;true&quot;
   Name=&quot;Intense Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;33&quot; QFormat=&quot;true&quot; Name=&quot;Book Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;37&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;Bibliography&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;TOC Heading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;41&quot; Name=&quot;Plain Table 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;42&quot; Name=&quot;Plain Table 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;43&quot; Name=&quot;Plain Table 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;44&quot; Name=&quot;Plain Table 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;45&quot; Name=&quot;Plain Table 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;40&quot; Name=&quot;Grid Table Light&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot; Name=&quot;Grid Table 1 Light&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot; Name=&quot;Grid Table 6 Colorful&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot; Name=&quot;Grid Table 7 Colorful&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot; Name=&quot;List Table 1 Light&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot; Name=&quot;List Table 6 Colorful&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot; Name=&quot;List Table 7 Colorful&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 6&quot;/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;

&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
table.MsoNormalTable
 {mso-style-name:&quot;Table Normal&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0in 5.4pt 0in 5.4pt;
 mso-para-margin:0in;
 mso-para-margin-bottom:.0001pt;
 mso-pagination:widow-orphan;
 font-size:12.0pt;
 font-family:Calibri;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;



&lt;!--StartFragment--&gt;



































































































































































































&lt;!--EndFragment--&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: PT Sans;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7IY6vt9YGDMXL6bCH7tXH_FsKc1fiCc9YAvq7SNKo-xoZnrZfjuA9aGdTXt9kxsDEUq3hs3CfBuH14EgCvEcx69CN3pCx9SOMjgKCQB7-CK2_IHXYy5B0x8eoYPtqZNxxtkCFW3z_Znw/s1600/Screen+Shot+2015-04-16+at+10.55.07+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7IY6vt9YGDMXL6bCH7tXH_FsKc1fiCc9YAvq7SNKo-xoZnrZfjuA9aGdTXt9kxsDEUq3hs3CfBuH14EgCvEcx69CN3pCx9SOMjgKCQB7-CK2_IHXYy5B0x8eoYPtqZNxxtkCFW3z_Znw/s1600/Screen+Shot+2015-04-16+at+10.55.07+AM.png&quot; height=&quot;92&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: PT Sans;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: PT Sans;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcQnRElljGphEoP_mHVBtInSXF3RnVpCzHZw2CnJl4C4FO30cQFQl3t0ENMJ3XnRCEnESYdnSYTqExFN8Ejvfv_u-9hQNXuBh28Eam504n61H9UT5n4jsD7PTte99O3-yvi5vm8vKnVy0/s1600/Screen+Shot+2015-04-16+at+10.54.53+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcQnRElljGphEoP_mHVBtInSXF3RnVpCzHZw2CnJl4C4FO30cQFQl3t0ENMJ3XnRCEnESYdnSYTqExFN8Ejvfv_u-9hQNXuBh28Eam504n61H9UT5n4jsD7PTte99O3-yvi5vm8vKnVy0/s1600/Screen+Shot+2015-04-16+at+10.54.53+AM.png&quot; height=&quot;212&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &#39;PT Sans&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 22px; text-align: start;&quot;&gt;Summarizing, we have MongoDB configured as replica set, Elasticsearch with River that pulls data from database to index, and finally everything is prepared for sharding and replication.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: PT Sans;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/2510646511638735001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/2510646511638735001'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2015/04/elasticsearch-and-mongo-through-river.html' title='ElasticSearch and Mongo through river – scalable data store and search engine platform'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEginLxkUEwZp_hIJH9xcTPxfmu6m6oQPKVJPdNnOStvZhsOJjYii76q-V6MA88UuojmKcEpsksG5AziSxf-zpmKq8ecB9cS1FcYjLmxORXwU_MZOQ8cwaAYGfSG1or9RYrm9RZLVDyIKzQ/s72-c/Screen+Shot+2015-04-16+at+10.51.48+AM.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-4554401022092915244</id><published>2015-04-14T23:09:00.001-07:00</published><updated>2015-04-14T23:10:23.003-07:00</updated><title type='text'>Singleton Pattern</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;Singleton Pattern in Java&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
Singleton Pattern ensures a class has only one instance and provides a global point of access to it.&lt;br /&gt;
The default constructor of the class is made private, which prevents the direct instantiation of the object by other classes.&lt;br /&gt;
&lt;br /&gt;
A static modifier is applied to the instance method that returns the object as it then makes this method a class level method that can be accessed without creating an object.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt; BookingFactory {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; BookingFactory &lt;span style=&quot;color: #0326cc;&quot;&gt;instance&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;/span&gt;// An instance attribute.&lt;/div&gt;
&lt;div style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;/span&gt;private&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;int&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0326cc;&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; BookingFactory() {&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;/span&gt;//initiate any other attributes if needed.&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; BookingFactory getInstance(){&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #0326cc;&quot;&gt;instance&lt;/span&gt; == &lt;span style=&quot;color: #931a68;&quot;&gt;null&lt;/span&gt;)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0326cc;&quot;&gt;instance&lt;/span&gt; = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; BookingFactory();&lt;/div&gt;
&lt;div style=&quot;color: #0326cc; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;instance&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; getData() {&lt;/div&gt;
&lt;div style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;/span&gt;return&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0326cc;&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;void&lt;/span&gt; setData(&lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; data) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;data&lt;/span&gt; = data;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;/span&gt;// other methods....&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
In future if you get a requirement for having more than one instance then singleton allows multiple instances without affecting a singleton class&#39;s clients. Just you need to do is make a small change in Singleton Class, which doesn&#39;t effect the client&#39;s code.&lt;br /&gt;
&lt;br /&gt;
Note that the singleton instance is only created when needed. This is called lazy instantiation.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt; SingletonDemo {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;void&lt;/span&gt; main(String args[]) {&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;/span&gt;// Get a reference to the single instance of Singleton.&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; BookingFactory bookingFactory = BookingFactory.getInstance();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;/span&gt;// Set the data value.&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; bookingFactory.setData(34);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; System.&lt;span style=&quot;color: #0326cc;&quot;&gt;out&lt;/span&gt;.println(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;First reference: &quot;&lt;/span&gt; + bookingFactory);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; System.&lt;span style=&quot;color: #0326cc;&quot;&gt;out&lt;/span&gt;.println(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;Singleton data value is: &quot;&lt;/span&gt; +bookingFactory.getData());&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;How can we break Singleton:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1.&lt;i&gt; It could happen that the access method may be called twice from 2 different classes at the same time and hence more than one object being created. This could violate the design patter principle.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In order to prevent the simultaneous invocation of the getter method by 2 threads or classes simultaneously we add the synchronized keyword to the method declaration.&lt;br /&gt;
&lt;br /&gt;
Make the Instance access method Synchronized to prevent concurrent thread access.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;synchronized&lt;/span&gt;&lt;span style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt; BookingFactory getInstance()&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Synchronization is expensive, however, and is really only needed the first time the unique instance is created.&lt;br /&gt;
&lt;br /&gt;
Do an eager instantiation of the instance rather than a lazy instantiation.&lt;br /&gt;
&lt;br /&gt;
You can also instantiate the Singleton as soon as the class loads. i.e You can place it in static block to ensure that it happens only once.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt; BookingFactory {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; BookingFactory &lt;span style=&quot;color: #0326cc;&quot;&gt;instance&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;/span&gt;// An instance attribute.&lt;/div&gt;
&lt;div style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;/span&gt;private&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;int&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0326cc;&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;/span&gt;static&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: #0326cc;&quot;&gt;instance&lt;/span&gt; = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; BookingFactory();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; BookingFactory() {&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;/span&gt;//initiate any other attributes if needed.&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; BookingFactory getInstance()&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #0326cc; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;instance&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; getData() {&lt;/div&gt;
&lt;div style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;/span&gt;return&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0326cc;&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;void&lt;/span&gt; setData(&lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; data) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;data&lt;/span&gt; = data;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;/span&gt;// other methods....&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Instead of synchronizing the whole method you can also make the instance variable as static final. It is thread-safe because static member variables created when declared are guaranteed to be created the first time they are accessed. You get a thread-safe implementation that automatically employs lazy instantiation.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt; BookingFactory {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; BookingFactory &lt;span style=&quot;color: #0326cc;&quot;&gt;instance&lt;/span&gt; = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; BookingFactory();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; BookingFactory() {&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;// Exists only to defeat instantiation.&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
But you loose the flexibility of having more than one instance in future without changing client&#39;s code.&lt;br /&gt;
&lt;br /&gt;
2.&lt;i&gt; if you are using multiple&amp;nbsp;class-loaders&amp;nbsp; this could defeat the Singleton implementation and result in multiple instances.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Because multiple class-loaders are commonly used in many situations—including servlet containers—you can wind up with multiple singleton instances no matter how carefully you&#39;ve implemented your singleton classes. If you want to make sure the same class-loader loads your singletons, you must specify the class-loader yourself; for example:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; Class getClass(String classname)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;throws&lt;/span&gt; ClassNotFoundException {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4abaeb;&quot;&gt;ClassLoader&lt;/span&gt; classLoader = Thread.currentThread().getContextClassLoader();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;if&lt;/span&gt;(classLoader == &lt;span style=&quot;color: #931a68;&quot;&gt;null&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;classLoader = Singleton.&lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt;.getClassLoader();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; (classLoader.loadClass(classname));&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&lt;/div&gt;
&lt;br /&gt;
The preceding method tries to associate the classloader with the current thread; if that classloader is null, the method uses the same classloader that loaded a singleton base class. The preceding method can be used instead of Class.forName().&lt;br /&gt;
&lt;br /&gt;
3. &lt;i&gt;If SingletonClass implements the java.io.Serializable interface, the class&#39;s instances can be serialized and deserialized. However, if you serialize a singleton object and subsequently deserialize that object more than once, you will have multiple singleton instances.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
To avoid the above you need to implement readResolve() method.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; Object readResolve() {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; INSTANCE;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
The previous singleton implementation returns the lone singleton instance from the readResolve() method; therefore, whenever the Singleton class is deserialized, it will return the same singleton instance.&lt;br /&gt;
&lt;br /&gt;
4. &lt;i&gt;We will be able to create a copy of the Object by cloning it using the Object’s clone method.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Override the Object clone method to prevent cloning, this can be done as shown below&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
SingletonDemo clonedObject = (SingletonDemo) obj.clone();&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
This again violates the Singleton Design Pattern’s objective. So to deal with this we need to override the Object’s clone method which throws a CloneNotSupportedException exception.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; Object clone() &lt;span style=&quot;color: #931a68;&quot;&gt;throws&lt;/span&gt; CloneNotSupportedException {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; CloneNotSupportedException();&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;When to use:&lt;/b&gt;&lt;br /&gt;
We can use this while creating objects of thread pools, caches etc to avoid wasting resources.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/4554401022092915244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/4554401022092915244'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2015/04/singleton-pattern-in-java-singleton.html' title='Singleton Pattern'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-1482125365633369993</id><published>2015-04-14T14:03:00.001-07:00</published><updated>2015-04-14T14:03:12.593-07:00</updated><title type='text'>Java Server Side Templating using Mustache.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; java.util.ArrayList;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; java.util.HashMap;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; java.util.Iterator;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; java.util.List;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; java.util.Map;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; org.json.JSONArray;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; org.json.JSONException;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; org.json.JSONObject;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; com.samskivert.mustache.Mustache;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; com.samskivert.mustache.Template;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
/**&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;* Simple java server side &lt;span style=&quot;text-decoration: underline;&quot;&gt;templating&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;* &lt;span style=&quot;color: #91afcb;&quot;&gt;@author&lt;/span&gt; &lt;span style=&quot;text-decoration: underline;&quot;&gt;Samar&lt;/span&gt; &lt;span style=&quot;text-decoration: underline;&quot;&gt;Aarkotti&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;*&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;*/&lt;/div&gt;
&lt;div style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;
public&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;class&lt;span style=&quot;color: black;&quot;&gt; Sample {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;void&lt;/span&gt; main(String[] args) {&lt;/div&gt;
&lt;div style=&quot;color: #3933ff; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String template = &lt;/span&gt;&quot;{\&quot;products\&quot;: \&quot;iPhone\&quot;}&quot;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #3933ff; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String text = &lt;/span&gt;&quot;How do I get my {{products}} serviced?&quot;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Template tmpl = Mustache.compiler().compile(text);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;JSONObject jsonObj = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; JSONObject(template);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Map&amp;lt;String,Object&amp;gt; map = getTemplateFromJson(jsonObj);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.&lt;span style=&quot;color: #0326cc;&quot;&gt;out&lt;/span&gt;.println(tmpl.execute(map));&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} &lt;span style=&quot;color: #931a68;&quot;&gt;catch&lt;/span&gt; (JSONException e) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; Map&amp;lt;String, Object&amp;gt; getTemplateFromJson(JSONObject json) &lt;span style=&quot;color: #931a68;&quot;&gt;throws&lt;/span&gt; JSONException {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; Map&amp;lt;String,Object&amp;gt; out = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; HashMap&amp;lt;String,Object&amp;gt;();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; Iterator&amp;lt;?&amp;gt; it = json.keys();&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;while&lt;/span&gt; (it.hasNext()) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String key = (String)it.next();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;if&lt;/span&gt; (json.get(key) &lt;span style=&quot;color: #931a68;&quot;&gt;instanceof&lt;/span&gt; JSONArray) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;// Copy an array&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JSONArray arrayIn = json.getJSONArray(key);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List&amp;lt;Object&amp;gt; arrayOut = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; ArrayList&amp;lt;Object&amp;gt;();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; arrayIn.length(); i++) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JSONObject item = (JSONObject)arrayIn.get(i);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Map&amp;lt;String, Object&amp;gt; items = getTemplateFromJson(item);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; arrayOut.add(items);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; out.put(key, arrayOut);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;// Copy a primitive string&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; out.put(key, json.getString(key));&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; out;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;Expected Output : How do I get my iPhone serviced?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/1482125365633369993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/1482125365633369993'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2015/04/java-server-side-templating-using.html' title='Java Server Side Templating using Mustache.'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-589305137903280623</id><published>2014-04-16T10:21:00.000-07:00</published><updated>2014-04-16T10:21:08.330-07:00</updated><title type='text'>Restricts the contents of the documents based on information stored in the documents themselves.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; font-size: 12px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;MongoDB 2.6 has an API that Restricts the contents of the documents based on information stored in the documents themselves.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; font-size: 12px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; font-size: 12px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;em style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Evaluates Access at Every Document/Sub-Document Level&lt;/strong&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; font-size: 12px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;em style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; font-size: 12px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;A&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;docutils literal&quot; style=&quot;border: 0px; font-family: &#39;Source Code Pro&#39;, monospace; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;test&lt;/tt&gt;&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;collection contains documents of the following form where the&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;docutils literal&quot; style=&quot;border: 0px; font-family: &#39;Source Code Pro&#39;, monospace; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;tags&lt;/tt&gt;&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;field lists the different access values for that document/subdocument level; i.e. a value of&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;docutils literal&quot; style=&quot;border: 0px; font-family: &#39;Source Code Pro&#39;, monospace; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;pre&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;“public&quot;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;pre&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;“internal&quot;&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;pre&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&lt;/span&gt;&lt;/tt&gt;&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;specifies either&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;docutils literal&quot; style=&quot;border: 0px; font-family: &#39;Source Code Pro&#39;, monospace; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;“public&quot;&lt;/tt&gt;&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;or&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;docutils literal&quot; style=&quot;border: 0px; font-family: &#39;Source Code Pro&#39;, monospace; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;“internal&quot;&lt;/tt&gt;&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;can access the data:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; font-size: 12px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; font-size: 12px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Sample Example JSON Document below&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; font-size: 12px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; line-height: 1.5em; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; font-size: 12px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; height: 8pt; min-height: 8pt; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;_id&quot; : 1,&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;title&quot; : &quot;Document Formatting&quot;,&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;tags&quot; : [&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;PUBLIC&quot;,&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;SERVICE_PROVIDER&quot;,&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;INTERNAL&quot;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ],&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;year&quot; : 2014,&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;subsections&quot; : [&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;subtitle&quot; : &quot;Section 1: Overview&quot;,&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;tags&quot; : [&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;PUBLIC&quot;,&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;SERVICE_PROVIDER&quot;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ],&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;content&quot; : &quot;Section 1: This is PUBLIC and SERVICE PROVIDER content of section 1.&quot;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;subtitle&quot; : &quot;Section 2: SuperScript&quot;,&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;tags&quot; : [&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SERVICE_PROVIDER&quot;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ],&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;content&quot; : &quot;Section 2: This is SERVICE PROVIDER content of section 2.&quot;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;subtitle&quot; : &quot;Section 3: SubScript&quot;,&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;tags&quot; : [&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;PUBLIC&quot;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ],&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;content&quot; : {&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;text&quot; : &quot;Section 3: This is INTERNAL content of section3.&quot;,&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;tags&quot; : [&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INTERNAL&quot;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ]&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;A user has access to view information with either the tag&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;docutils literal&quot; style=&quot;border: 0px; color: black; font-family: &#39;Source Code Pro&#39;, monospace; font-style: inherit; line-height: 24px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;“public&quot;&lt;/tt&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;docutils literal&quot; style=&quot;border: 0px; color: black; font-family: &#39;Source Code Pro&#39;, monospace; font-style: inherit; line-height: 24px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;“internal&quot;&lt;/tt&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;. To run a query on all documents with year&lt;/span&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;docutils literal&quot; style=&quot;border: 0px; color: black; font-family: &#39;Source Code Pro&#39;, monospace; font-style: inherit; line-height: 24px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2014&lt;/tt&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;for this user, include a&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;xref mongodb mongodb-pipeline docutils literal&quot; style=&quot;border: 0px; color: black; font-family: &#39;Source Code Pro&#39;, monospace; font-style: inherit; line-height: 24px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$redact&lt;/tt&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;stage as in the following:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; height: 8pt; line-height: 24px; min-height: 8pt; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; line-height: 24px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; height: 8pt; min-height: 8pt; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;var userAccess = [&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INTERNAL&quot;,&quot;PUBLIC&quot;&lt;/strong&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;db.test.aggregate(&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp; [&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { $match: { year: 2014 } },&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { $redact:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $cond:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if: { $gt: [ { $size: { $setIntersection: [ &quot;$tags&quot;, userAccess ] } }, 0 ] },&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then: &quot;$$DESCEND&quot;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: &quot;$$PRUNE&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp; ]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;border: 0px; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
The aggregation operation returns the following “redacted” document, which&amp;nbsp;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;does not include SERVICE_PROVIDER&lt;/strong&gt;&amp;nbsp;subsection.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 0px; height: 8pt; min-height: 8pt; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; height: 8pt; min-height: 8pt; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;result&quot; : [&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;_id&quot; : 1,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;title&quot; : &quot;Document Formatting&quot;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;tags&quot; : [&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;PUBLIC&quot;,&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp; &quot;SERVICE_PROVIDER&quot;,&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;INTERNAL&quot;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ],&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;year&quot; : 2014,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;subsections&quot; : [&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;subtitle&quot; : &quot;Section 1: Overview&quot;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;tags&quot; : [&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;PUBLIC&quot;,&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;SERVICE_PROVIDER&quot;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ],&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;content&quot; : &quot;Section 1: This is PUBLIC and SERVICE PROVIDER content of section 1.&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;subtitle&quot; : &quot;Section 3: SubScript&quot;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;tags&quot; : [&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;PUBLIC&quot;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ],&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;content&quot; : {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;text&quot; : &quot;Section 3: This is INTERNAL content of section3.&quot;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;tags&quot; : [&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INTERNAL&quot;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ],&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;ok&quot; : 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: inherit; font-style: inherit; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/589305137903280623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/589305137903280623'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2014/04/restricts-contents-of-documents-based.html' title='Restricts the contents of the documents based on information stored in the documents themselves.'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-5205235110726010782</id><published>2014-04-16T10:08:00.003-07:00</published><updated>2014-08-23T22:44:07.710-07:00</updated><title type='text'>Apache Mahout for Document Similarity.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;Using Apache Mahout for Document Similarity.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Below are steps to run on the text file collection.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;sh mahout seqdirectory -c UTF-8 -i /Users/xxxx/myfiles/ -o seqfiles&lt;/li&gt;
&lt;li&gt;sh mahout seq2sparse -i seqfiles/ -o vectors/ &amp;nbsp;-ow -chunk 100 &amp;nbsp;-x 90 &amp;nbsp;-seq &amp;nbsp;-ml 50 &amp;nbsp;-n 2 &amp;nbsp;-s 5 -md 5 &amp;nbsp;-ng 3 &amp;nbsp;-nv&lt;/li&gt;
&lt;li&gt;sh mahout rowid -i vectors/tfidf-vectors/part-r-00000 -o matrix&lt;/li&gt;
&lt;li&gt;sh mahout rowsimilarity -i matrix/matrix -o similarity &amp;nbsp;--similarityClassname SIMILARITY_COSINE -m 10 -ess&lt;/li&gt;
&lt;li&gt;sh mahout seqdumper -i similarity &amp;gt; similarity.txt&lt;/li&gt;
&lt;li&gt;sh mahout seqdumper -i matrix/docIndex &amp;gt; docIndex.txt&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;i&gt;Apache Mahout does following Steps&amp;nbsp;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Tokenize and Transform&lt;/li&gt;
&lt;li&gt;Generate word vectors and weights&lt;/li&gt;
&lt;li&gt;Find Document similarity based on TF-IDF( Term Frequence - Inverted Document Frequency) using COSINE_SIMILARITY&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;Tokenization&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The first step is to convert the text document into sequence of tokens. Content is tokenized based on single word. All the tokens are then transformed to lower cases so that the content is standardized.&lt;/div&gt;
&lt;div&gt;
Create N-Grams : A term n-Gram is defined as a series of consecutive tokens of length n. n-Gram consists of all series of consecutive tokens of length n.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Generate Vectors and Weights&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Each document is converted to a word vector of n-Grams with weight assigned to each n-Gram. This weight is assigned based on TF-IDF (Term Frequency - Inverse Document Frequency), This is a measure of importance of a term in a document. it is measured by the frequency of the term in the document but is offset by the total frequency of the term in the whole document set. &amp;nbsp;this creates a balance in weighing terms, as some terms can occur more commonly than other and can be less significant in arriving at similarity.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Document Similarity&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Each Document word vector is compared to every other document’s vector. Document similarity is based on cosine similarity measure between the word vector’s. &amp;nbsp;two vectors with the same orientation have a cosine similarity of 1 , two vectors at 90 have similarity of 0. A matrix similarity between each document with every other document is generated.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Sample docIndex.txt Below&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Key: 0: Value: /File558&lt;/div&gt;
&lt;div&gt;
Key: 1: Value: /File4340&lt;/div&gt;
&lt;div&gt;
Key: 2: Value: /File4208&lt;/div&gt;
&lt;div&gt;
Key: 3: Value: /File471&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Sample Similarity.txt Below&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;Key: 0: Value: &lt;/b&gt;{&lt;b&gt;0&lt;/b&gt;:1.0000000000000002,&lt;b&gt;3865&lt;/b&gt;:0.15434639725421775,&lt;b&gt;318&lt;/b&gt;:0.16924612516623572,&lt;b&gt;558&lt;/b&gt;:0.24384373237418783,&lt;b&gt;471&lt;/b&gt;:0.16826200999114294,&lt;b&gt;4340&lt;/b&gt;:0.16651713654958472,&lt;b&gt;7&lt;/b&gt;:0.164357811310303,&lt;b&gt;1841&lt;/b&gt;:0.15904628827648598,&lt;b&gt;4208&lt;/b&gt;:0.16296041411613846,&lt;b&gt;14&lt;/b&gt;:0.14043468960009342}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Key: 1: Value: &lt;/b&gt;{1615:0.3312716794782159,2181:0.2840451034186393,2126:0.32415666313248037,3188:0.1628119850871482,1496:0.24775558568026784,1:1.0,1575:0.13525396149776772,1269:0.13286526354605824,28:0.45703740702783774,1866:0.3262754564949865}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Key: 2: Value: &lt;/b&gt;{2:1.0,4350:0.13571272853930183,348:0.12600225826696973,3210:0.13949921190207168,560:0.15234464042319912,3294:0.2889578044491356,802:0.17942407070282945,1633:0.1964965769704117,3355:0.1298340236494648,495:0.12627029072308343}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Key: 3: Value: &lt;/b&gt;{1990:0.17193706865160252,3700:0.1302978723523794,2082:0.16196813164388732,2227:0.12561545966019144,665:0.15584753719122243,1163:0.19345501767136697,6:0.22582692114456704,3:1.0,1555:0.1742692199362734,4:0.1818170186646791}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Key: 4: Value: &lt;/b&gt;{1990:0.13213250264185705,3:0.1818170186646791,2082:0.1349661297563062,1163:0.15679941310702006,1555:0.18261523201994426,6:0.1981917938129962,738:0.29646182670818444,1684:0.21050749439902763,4:0.9999999999999999,3150:0.1397676584929176}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
you can see above similarity matrix with scores&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;e;g [ &amp;nbsp;&lt;/b&gt;&lt;b&gt;558&lt;/b&gt;:0.24384373237418783,&lt;b&gt;471&lt;/b&gt;:0.16826200999114294 &lt;b&gt;]&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
docIndex &amp;nbsp;key 0 maps to&amp;nbsp;&lt;b&gt;0&lt;/b&gt;:1.0000000000000002 &amp;nbsp;in similarity.txt output.&lt;/div&gt;
&lt;div&gt;
Similarly docIndex key 558 maps to&amp;nbsp;&lt;b&gt;558&lt;/b&gt;:0.24384373237418783. in similarity.txt output.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
--- Sample&lt;br /&gt;
&lt;br /&gt;
sh mahout seqdumper -i vectors/tfidf-vectors &amp;gt; vectors.txt&lt;br /&gt;
sh mahout seqdumper -i vectors/tf-vectors &amp;gt; vectors.txt&lt;/div&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/5205235110726010782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/5205235110726010782'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2014/04/apache-mahout-for-document-similarity.html' title='Apache Mahout for Document Similarity.'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-1157165452663685926</id><published>2013-10-11T17:11:00.004-07:00</published><updated>2013-10-11T17:11:56.314-07:00</updated><title type='text'>MongoDB Real-Time Analytics Part-2</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;Here is another schema sample for storing Daily,Hourly and Minutes data&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;/div&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &quot;_id&quot; : &quot;daily&quot;, ---&amp;gt; should be unique date for the day&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &quot;article&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;HT97&quot; : 100,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;HT98&quot; : 100,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;HT99&quot; : 100&lt;br /&gt;
&amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &quot;daily&quot; : 300,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &quot;hourly&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;15&quot; : 200,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;16&quot; : 100&lt;br /&gt;
&amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &quot;minutely&quot; : {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;957&quot; : 100,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;958&quot; : 100,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;960&quot; : 100&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;package&lt;/span&gt; com.realtime;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; java.text.SimpleDateFormat;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; java.util.Date;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; com.mongodb.BasicDBObject;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; com.mongodb.DB;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; com.mongodb.DBCollection;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; com.mongodb.DBObject;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt; com.mongodb.Mongo;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;
public&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;class&lt;span style=&quot;color: black;&quot;&gt; test {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;void&lt;/span&gt; main(String[] args) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; DBCollection collection = getCollection();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; i=0;i&amp;lt;100;i++){&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; Date now = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; Date();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &amp;nbsp; &amp;nbsp; String format&amp;nbsp; = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; SimpleDateFormat(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;yyyy-MM-dd-HH-mm&quot;&lt;/span&gt;).format(now);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; Request1 r = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; Request1(format,&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;HT&quot;&lt;/span&gt;+i);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; upsert(r.getArticleId(),r,collection);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; System.&lt;span style=&quot;color: #0326cc;&quot;&gt;out&lt;/span&gt;.println(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;upsert request: HT&quot;&lt;/span&gt;+i);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;void&lt;/span&gt; upsert(String id, Request1 request,&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DBCollection collection) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BasicDBObject query = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; BasicDBObject();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; query.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;_id&quot;&lt;/span&gt;, &lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;monthly&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DBObject dbo = createUpsert(request);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; collection.update(query, dbo, &lt;span style=&quot;color: #931a68;&quot;&gt;true&lt;/span&gt;, &lt;span style=&quot;color: #931a68;&quot;&gt;false&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;/**&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * increment the &lt;span style=&quot;text-decoration: underline;&quot;&gt;stats&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * &lt;span style=&quot;color: #91afcb;&quot;&gt;@param&lt;/span&gt; request&lt;/div&gt;
&lt;div style=&quot;color: #91afcb; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #4f76cb;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * &lt;/span&gt;@return&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; */&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; DBObject createUpsert(Request1 request) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DBObject upsert = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; BasicDBObject();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DBObject inc = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; BasicDBObject();&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;// Count total hits&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inc.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;daily&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inc.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;minutely.&quot;&lt;/span&gt;+getMinutes(request),1);&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inc.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;hourly.&quot;&lt;/span&gt;+getHour(request), 1);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inc.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;article.&quot;&lt;/span&gt;+request.getArticleId(),1);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; upsert.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;$inc&quot;&lt;/span&gt;, inc);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; upsert;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4f76cb;&quot;&gt;/**&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; * get the current minute in day&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; * &lt;span style=&quot;color: #91afcb;&quot;&gt;@param&lt;/span&gt; r&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; * &lt;span style=&quot;color: #91afcb;&quot;&gt;@return&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; */&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; getMinutes(Request1 r ){&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;String format = r.getTime();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;String sMinutes = format.substring(format.lastIndexOf(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;-&quot;&lt;/span&gt;)+1);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; minutes= Integer.parseInt(sMinutes);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;String sHour = getHour(r);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; hour = Integer.parseInt(sHour);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;minutes = hour * 60 + minutes;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; minutes;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4f76cb;&quot;&gt;/**&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; * get current hour in a day&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; * &lt;span style=&quot;color: #91afcb;&quot;&gt;@param&lt;/span&gt; r&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; * &lt;span style=&quot;color: #91afcb;&quot;&gt;@return&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4f76cb; font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; */&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; String getHour(Request1 r){&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String format = r.getTime();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;format = format.substring(format.lastIndexOf(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;-&quot;&lt;/span&gt;)-2,format.length()-3);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; format;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt; DBCollection getCollection() {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Mongo mongo;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mongo = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; Mongo();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #931a68;&quot;&gt;catch&lt;/span&gt; (Exception e) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; RuntimeException(e);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB db = mongo.getDB(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;analytics&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; db.getCollection(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;metrics&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/1157165452663685926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samarasimha.blogspot.com/2013/10/mongodb-real-time-analytics-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/1157165452663685926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/1157165452663685926'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2013/10/mongodb-real-time-analytics-part-2.html' title='MongoDB Real-Time Analytics Part-2'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-6205538909495003650</id><published>2013-09-24T12:07:00.004-07:00</published><updated>2013-09-24T12:07:58.482-07:00</updated><title type='text'>MongoDB Real Time Analytics.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 10pt; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;MongoDB makes it super easy to implement real-time analytics, while the natural tendency is to use Map Reduce feature provided my mongoDB to aggregate data, thought on using upsert feature and $inc operator to see how complex aggregation and groupings can be&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 10pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;performed in real-time.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 10pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;we can update total counts , averages and find distinct entities for a given period( per/sec , per/min, per/hour) in a single upsert statement. this data is then immediately available to draw real-time charts.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; height: 8pt; min-height: 8pt; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 10pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Let&#39;s say we want to obtain the following information every second for our application.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 10pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1. Total Hits&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 10pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2. Unique Users&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 10pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;3. Unique IP Address&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 10pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;4. Average Response time for each URL ..etc&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 10pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 10pt; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;We will start by setting up some sample requests. Here, I am hardcoding them. In real world, we can tail and parse a log file. Alternatively, this information can be sent directly from the application to our analytics system.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; font-family: Helvetica; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date d =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Date();&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SimpleDateFormat dt1 =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;SimpleDateFormat(&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;yyyyy_mm_dd_hh_mm_ss&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp; Request r1 =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/apple/support1&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;user1&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp; Request r2 =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/apple/support1&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;user2&quot;&lt;/span&gt;, 2);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp; Request r3 =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/apple/support2&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;user1&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp; Request r4 =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/apple/support2&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;user2&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp; Request r5 =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/apple/support1&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;user1&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp; Request r6 =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;192_168_1_20&quot;&lt;/span&gt;,&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/apple/support1&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;user3&quot;&lt;/span&gt;, 4);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp; Request r7 =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/apple/support3&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;user1&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; height: 8pt; min-height: 8pt; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; margin-bottom: 1em; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
Note that the periods in IP Address have been replaced with underscores. This is done because we will be using them as the keys in our JSON documents and having periods in there will cause undesirable effects.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; margin-bottom: 1em; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
Next, we need to decide the aggregation interval. This determines how we choose our document id’s.&lt;br /&gt;In this example, we have decided to aggregate every second, so we can choose our id as the request time that includes second level information(2013_09_23_02_29_28). If we were aggregating at an hourly interval, we could have simply used the id that contains only hour level information; such as ”2013_09_23_02″.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; margin-bottom: 1em; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
Based on the chosen id, all requests coming within a second will update&amp;nbsp; a single document. While there may be hundreds of request per second, we will end up having one document per second, that will represent the aggregated view for that second.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; margin-bottom: 1em; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
This has a very nice side effect. MongoDB index sizes are directly propotional to the number of documents.&amp;nbsp; Since we maintain one record per second instead of storing each request as a separate document, we greatly reduce the required index size and its much easier to fit the index in memory.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; margin-bottom: 1em; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
So, let us see how does aggregation and counts happen. Following is the function that creates the upsert request for each record.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1 public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;static&lt;/span&gt;&amp;nbsp;DBObject createUpsert(Request request) {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
2&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBObject upsert =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;BasicDBObject();&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBObject inc =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;BasicDBObject();&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #4e9072; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: black; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// Count total hits&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inc.put(&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;hits&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #4e9072; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: black; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// Get distinct IP&#39;s &amp;amp; Count hits per IP&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inc.put(&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ip.&quot;&lt;/span&gt;&amp;nbsp;+ request.getIp() +&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;.hits&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #4e9072; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: black; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// Get Distinct Users &amp;amp; Count hits per user&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inc.put(&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;users.&quot;&lt;/span&gt;&amp;nbsp;+ request.getUser() +&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;.hits&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
11&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #4e9072; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: black; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// Get Distinct URL&#39;s &amp;amp; Count hits per URL&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
13&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inc.put(&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;urls.&quot;&lt;/span&gt;&amp;nbsp;+ request.getUrl() +&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;.hits&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #4e9072; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: black; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// Total time taken to process &#39;n&#39; requests.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #4e9072; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: black; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// Divide it by the count obtained above to get the average processing time for each URL.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inc.put(&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;urls.&quot;&lt;/span&gt;&amp;nbsp;+ request.getUrl() +&amp;nbsp;&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;.totalTime&quot;&lt;/span&gt;,request.getProcessTime());&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; upsert.put(&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$inc&quot;&lt;/span&gt;, inc);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;return&lt;/span&gt;&amp;nbsp;upsert;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
19&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; height: 8pt; min-height: 8pt; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; margin-bottom: 1em; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
Line Number 6 simply increments the ‘hits’ field, giving us the total hits in a second.&lt;br /&gt;In Line Number 8, we get more creative. For the current request, if the field ip.’ip_address’ (e.g. ip.localhost) exists, then its ‘hits’ field is incremented. Otherwise, the field&amp;nbsp; ip.’ip_address’ get added to the ‘ip’ field. At the end of the second, we have collected all distinct IPs from which the application got the requests as well as the number of requests received from each IP.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; margin-bottom: 1em; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
We do the same for users and URL’s. Finally, in line number 16, we accumulate the total processing time for all requests for each ‘url’ in the field urls.’url’.totalTime.&lt;br /&gt;By simply dividing the accumulated time by the ‘hits’ count later, we can get the average response time.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; margin-bottom: 1em; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
Here’s the function that gets invoked for each request, updating/inserting the records in database.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;void&lt;/span&gt;&amp;nbsp;upsert(String id, Request request,&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBCollection collection) {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BasicDBObject query =&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&amp;nbsp;BasicDBObject();&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.put(&lt;span style=&quot;border: 0px; color: #3933ff; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;_id&quot;&lt;/span&gt;, id);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBObject dbo = createUpsert(request);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; collection.update(query, dbo,&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;true&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;border: 0px; color: #931a68; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;false&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; height: 8pt; line-height: 19px; min-height: 8pt; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Monaco; font-size: 11px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;As each request is received and upserted, our data keeps on getting aggregated immediately. Below is the final aggregated document at the end of processing requests for the time period represented by ’&lt;span style=&quot;border: 0px; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2013_09_23_02_29_28&lt;/span&gt;′.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; margin-bottom: 1em; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
{&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;_id&quot; : &quot;2013_09_23_02_29_28&quot;,&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;hits&quot; : 7,&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;ip&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;192_168_1_20&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;hits&quot; : 1&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;127_0_0_1&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;hits&quot; : 6&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;urls&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;/apple/support1&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;hits&quot; : 4,&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;totalTime&quot; : 8&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;/apple/support2&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;hits&quot; : 2,&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;totalTime&quot; : 2&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;/apple/support3&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;hits&quot; : 1,&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;totalTime&quot; : 1&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;users&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;user1&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;hits&quot; : 4&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;user2&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;hits&quot; : 2&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;user3&quot; : {&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;hits&quot; : 1&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; height: 8pt; line-height: 19px; min-height: 8pt; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;In this approach, each request is a single write operation. With each write we do multiple aggregations and generate the latest aggregated view with almost no delay. There is absolutely no need to run any batch processes or expensive Map-Reduce to get this information. It is right there and can be read from the database and presented to the UI in less than a second&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;If you chose to implement sharding, then the document id’s would have to be chosen differently.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;For example, in the current scenario, we might append host name to the time, effectively storing data for each host in a different shard. At runtime, we can do a simple aggregation at the application level to present a unified view, while equally distributing the load to multiple database servers.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;Complete Code for below.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;Aggregator.java&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 13px; line-height: 19px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; font-family: Helvetica, Arial, &#39;Lucida Grande&#39;, Verdana, sans-serif; font-size: 12px; font-style: inherit; margin: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;package&lt;/span&gt;&amp;nbsp;com.realtime;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt;&amp;nbsp;java.text.SimpleDateFormat;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt;&amp;nbsp;java.util.Date;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br type=&quot;_moz&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt;&amp;nbsp;com.mongodb.BasicDBObject;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt;&amp;nbsp;com.mongodb.DB;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt;&amp;nbsp;com.mongodb.DBCollection;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt;&amp;nbsp;com.mongodb.DBObject;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;import&lt;/span&gt;&amp;nbsp;com.mongodb.Mongo;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt;&amp;nbsp;Aggregator {&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br type=&quot;_moz&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;void&lt;/span&gt;&amp;nbsp;main(String[] args) {&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Date d =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Date();&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; SimpleDateFormat dt1 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;SimpleDateFormat(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;yyyy_MM_dd_hh_mm_ss&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Request r1 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;/apple/support1&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;user1&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Request r2 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;/apple/support1&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;user2&quot;&lt;/span&gt;, 2);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Request r3 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;/apple/support2&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;user1&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Request r4 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;/apple/support2&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;user2&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Request r5 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;/apple/support1&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;user1&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Request r6 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;192_168_1_20&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;/apple/support1&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;user3&quot;&lt;/span&gt;, 4);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Request r7 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt1.format(d),&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;/apple/support3&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;user1&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;try&lt;/span&gt;&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Thread.sleep(1000);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; }&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;catch&lt;/span&gt;&amp;nbsp;(InterruptedException e) {&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Date d1 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Date();&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; SimpleDateFormat dt2 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;SimpleDateFormat(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;yyyy_MM_dd_hh_mm_ss&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br type=&quot;_moz&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; Request r8 =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Request(dt2.format(d1),&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;127_0_0_1&quot;&lt;/span&gt;,&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;/apple/support1&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;user4&quot;&lt;/span&gt;, 2);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Request requests[] = { r1, r2, r3, r4, r5, r6, r7, r8 };&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DBCollection collection = getCollection();&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;for&lt;/span&gt;&amp;nbsp;(Request request : requests) {&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; upsert(request.getTime(), request, collection);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;void&lt;/span&gt;&amp;nbsp;upsert(String id, Request request,&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DBCollection collection) {&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BasicDBObject query =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;BasicDBObject();&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; query.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;_id&quot;&lt;/span&gt;, id);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DBObject dbo = createUpsert(request);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; collection.update(query, dbo,&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;true&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;false&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt;&amp;nbsp;DBObject createUpsert(Request request) {&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DBObject upsert =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;BasicDBObject();&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DBObject inc =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;BasicDBObject();&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;// Count total hits&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inc.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;hits&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;// Get distinct IP&#39;s &amp;amp; Count hits per IP&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inc.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;ip.&quot;&lt;/span&gt;&amp;nbsp;+ request.getIp() +&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;.hits&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;// Get Distinct Users &amp;amp; Count hits per user&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inc.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;users.&quot;&lt;/span&gt;&amp;nbsp;+ request.getUser() +&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;.hits&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;// Get Distinct URL&#39;s &amp;amp; Count hits per URL&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inc.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;urls.&quot;&lt;/span&gt;&amp;nbsp;+ request.getUrl() +&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;.hits&quot;&lt;/span&gt;, 1);&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;// Total time taken to process &#39;n&#39; requests.&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;// Divide it by the count obtained above to get the average processing&lt;/div&gt;
&lt;div style=&quot;color: #4e9072; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;// time for each URL.&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inc.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;urls.&quot;&lt;/span&gt;&amp;nbsp;+ request.getUrl() +&amp;nbsp;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;.totalTime&quot;&lt;/span&gt;,&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; request.getProcessTime());&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; upsert.put(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;$inc&quot;&lt;/span&gt;, inc);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt;&amp;nbsp;upsert;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;static&lt;/span&gt;&amp;nbsp;DBCollection getCollection() {&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Mongo mongo;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;try&lt;/span&gt;&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mongo =&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Mongo();&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;catch&lt;/span&gt;&amp;nbsp;(Exception e) {&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;throw&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt;&amp;nbsp;RuntimeException(e);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB db = mongo.getDB(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;realtime&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt;&amp;nbsp;db.getCollection(&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;requests&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
Below is the code for Request.java&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;package&lt;/span&gt; com.realtime;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #575757; font-family: Monaco; font-size: 11px; line-height: 20px; padding: 0px; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt; Request {&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; String &lt;span style=&quot;color: #0326cc;&quot;&gt;time&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; String &lt;span style=&quot;color: #0326cc;&quot;&gt;ip&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; String &lt;span style=&quot;color: #0326cc;&quot;&gt;url&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; String &lt;span style=&quot;color: #0326cc;&quot;&gt;user&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;color: #0326cc; line-height: normal;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;processTime&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; Request(String time, String ip, String url, String user,&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; processTime) {&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;ip&lt;/span&gt; = ip;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;time&lt;/span&gt; = time;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;user&lt;/span&gt; = user;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;url&lt;/span&gt; = url;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;processTime&lt;/span&gt; = processTime;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; String getTime() {&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0326cc;&quot;&gt;time&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; String getIp() {&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0326cc;&quot;&gt;ip&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; String getUrl() {&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0326cc;&quot;&gt;url&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; String getUser() {&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0326cc;&quot;&gt;user&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;int&lt;/span&gt; getProcessTime() {&lt;/div&gt;
&lt;div style=&quot;color: #0326cc; line-height: normal;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;processTime&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;line-height: normal; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;
}&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/6205538909495003650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samarasimha.blogspot.com/2013/09/mongodb-real-time-analytics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/6205538909495003650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/6205538909495003650'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2013/09/mongodb-real-time-analytics.html' title='MongoDB Real Time Analytics.'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-1888705019052134272</id><published>2013-08-09T13:30:00.003-07:00</published><updated>2013-08-09T13:36:53.630-07:00</updated><title type='text'>XmlAdapter - JAXB&#39;s Secret Ninja.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px; text-align: -webkit-auto;&quot;&gt;The XmlAdapter mechanism in JAXB ensures that there is no such thing as an unmappable class. However there appears to be some confusion on how to use XmlAdapter, below is the general concept:&lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px; text-align: -webkit-auto;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 0.25em; padding: 0px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Identify the unmappable class&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin: 0px 0px 0.25em; padding: 0px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Create an equivalent class that is mappable&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin: 0px 0px 0.25em; padding: 0px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Create an XmlAdapter to convert between unmappable and mappable objects&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin: 0px 0px 0.25em; padding: 0px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Specify the XmlAdapte&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Recently i ran into a problem where i need to Store/Retrieve data from MongoDB using ApacheCXF and Spring-Data for MongoDB.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Storing data was easy i had no complaints when using Map&#39;s. As shown below.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #777777;&quot;&gt;
@XmlRootElement&lt;span style=&quot;color: black;&quot;&gt;(name = &lt;/span&gt;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;article&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt; Article &lt;span style=&quot;color: #931a68;&quot;&gt;implements&lt;/span&gt; Serializable{&lt;br /&gt;
&lt;div style=&quot;min-height: 15px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #931a68;&quot;&gt;
private&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;static&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;final&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;long&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0326cc;&quot;&gt;serialVersionUID&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = 1L;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #777777;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; Map&amp;lt;String,Map&amp;lt;String,String&amp;gt;&amp;gt; &lt;span style=&quot;color: #0326cc;&quot;&gt;map&lt;/span&gt; = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; HashMap&amp;lt;String,Map&amp;lt;String,String&amp;gt;&amp;gt;();&lt;/div&gt;
&lt;div style=&quot;min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; Article(){}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; Article(Map&amp;lt;String,Map&amp;lt;String,String&amp;gt;&amp;gt; m){&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;map&lt;/span&gt; = m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; Map&amp;lt;String,Map&amp;lt;String,String&amp;gt;&amp;gt; getMap() {&lt;br /&gt;
&lt;div style=&quot;color: #931a68;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0326cc;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;void&lt;/span&gt; setMap(Map&amp;lt;String,Map&amp;lt;String,String&amp;gt;&amp;gt;&amp;nbsp; map) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;map&lt;/span&gt; = map;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;/div&gt;
&lt;div style=&quot;color: #777777; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Above class was good enough for Create Operation, however when i was trying to&amp;nbsp;retrieve&amp;nbsp;data it was throwing exception that unable to convert Map to XML , JAXB exception all over.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;that&#39;s when i decided to extend XMLAdapter.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;1. Identify the Unmappable Class&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;In this example the unmappable class is java.util.Map.&lt;/span&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;2.&amp;nbsp; Create an Equivalent Class that is Mappable&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;Map could be represented by an object ,that contained a list of objects with two properties: key and value . Below are the classes that i implemented to achieve this.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt; MapType {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; List&lt;mapentrytype&gt; &lt;span style=&quot;color: #0326cc;&quot;&gt;element&lt;/span&gt; = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; ArrayList&lt;mapentrytype&gt;();&lt;/mapentrytype&gt;&lt;/mapentrytype&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt; MapEntryType {&lt;/span&gt;&lt;br /&gt;

&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span style=&quot;color: #777777;&quot;&gt;@XmlAttribute&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; String &lt;span style=&quot;color: #0326cc;&quot;&gt;name&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span style=&quot;color: #777777;&quot;&gt;@XmlElement&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; List&amp;lt;LinkCountMapType&amp;gt; &lt;span style=&quot;color: #0326cc;&quot;&gt;attribute&lt;/span&gt; = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; ArrayList&amp;lt;LinkCountMapType&amp;gt;();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
}&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt; LinkCountMapType {&lt;/div&gt;
&lt;div style=&quot;color: #777777; font-family: Monaco; font-size: 11px;&quot;&gt;
@XmlAttribute&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; String &lt;span style=&quot;color: #0326cc;&quot;&gt;name&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span style=&quot;color: #777777;&quot;&gt;@XmlValue&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; String &lt;span style=&quot;color: #0326cc;&quot;&gt;count&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
} &amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;3. Create an XmlAdapter to Convert Between Unmappable and Mappable Objects&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;The XmlAdapter&lt;valuetype boundtype=&quot;&quot;&gt; class is responsible for converting between instances of the unmappable and mappable classes. Most people get confused between the value and bound types. The value type is the mappable class, and the bound type is the unmappable class.&lt;/valuetype&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt; MapAdapter &lt;span style=&quot;color: #931a68;&quot;&gt;extends&lt;/span&gt; XmlAdapter&amp;lt;MapType, Map&amp;lt;String, Map&amp;lt;String, String&amp;gt;&amp;gt;&amp;gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #777777; font-family: Monaco; font-size: 11px;&quot;&gt;
@Override&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; Map&amp;lt;String, Map&amp;lt;String, String&amp;gt;&amp;gt; unmarshal(MapType v) &lt;span style=&quot;color: #931a68;&quot;&gt;throws&lt;/span&gt; Exception {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; Map&amp;lt;String, Map&amp;lt;String, String&amp;gt;&amp;gt; mainMap = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; HashMap&amp;lt;String, Map&amp;lt;String, String&amp;gt;&amp;gt;();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; List&amp;lt;MapEntryType&amp;gt; myMapEntryTypes = v.&lt;span style=&quot;color: #0326cc;&quot;&gt;element&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;for&lt;/span&gt; (MapEntryType myMapEntryType : myMapEntryTypes) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Map&amp;lt;String, String&amp;gt; linkCountMap = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; HashMap&amp;lt;String, String&amp;gt;();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;for&lt;/span&gt; (LinkCountMapType myLinkCountMapType : myMapEntryType.&lt;span style=&quot;color: #0326cc;&quot;&gt;attribute&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; linkCountMap.put(myLinkCountMapType.&lt;span style=&quot;color: #0326cc;&quot;&gt;name&lt;/span&gt;, myLinkCountMapType.&lt;span style=&quot;color: #0326cc;&quot;&gt;count&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mainMap.put(myMapEntryType.&lt;span style=&quot;color: #0326cc;&quot;&gt;name&lt;/span&gt;, linkCountMap);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; } &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; mainMap;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #777777; font-family: Monaco; font-size: 11px;&quot;&gt;
@Override&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; MapType marshal(Map&amp;lt;String, Map&amp;lt;String, String&amp;gt;&amp;gt; v) &lt;span style=&quot;color: #931a68;&quot;&gt;throws&lt;/span&gt; Exception {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; MapType myMapType = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; MapType();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; List&amp;lt;MapEntryType&amp;gt; entry = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; ArrayList&amp;lt;MapEntryType&amp;gt;();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;for&lt;/span&gt; (String name : v.keySet()) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MapEntryType myMapEntryType = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; MapEntryType();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Map&amp;lt;String, String&amp;gt; linkCountMap = v.get(name);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List&amp;lt;LinkCountMapType&amp;gt; linkCountList = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; ArrayList&amp;lt;LinkCountMapType&amp;gt;();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;for&lt;/span&gt; (String link : linkCountMap.keySet()) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LinkCountMapType myLinkCountMapType = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; LinkCountMapType();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String count = linkCountMap.get(link);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myLinkCountMapType.&lt;span style=&quot;color: #0326cc;&quot;&gt;count&lt;/span&gt; = count;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myLinkCountMapType.&lt;span style=&quot;color: #0326cc;&quot;&gt;name&lt;/span&gt; = link;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; linkCountList.add(myLinkCountMapType);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myMapEntryType.&lt;span style=&quot;color: #0326cc;&quot;&gt;name&lt;/span&gt; = name;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myMapEntryType.&lt;span style=&quot;color: #0326cc;&quot;&gt;attribute&lt;/span&gt; = linkCountList;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; entry.add(myMapEntryType);&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; myMapType.&lt;span style=&quot;color: #0326cc;&quot;&gt;element&lt;/span&gt; = entry;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;return&lt;/span&gt; myMapType;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;4. Specify the XmlAdapter&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;The @XmlJavaTypeAdapter annotation is used to specify the use of the XmlAdapter. Below it is specified on the map field on the Article class. Now during marshal/unmarshal operations the instance of Map is treated as an instance of My MapType.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;min-height: 15px;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #777777; font-family: Monaco; font-size: 11px;&quot;&gt;
@XmlRootElement&lt;span style=&quot;color: black;&quot;&gt;(name = &lt;/span&gt;&lt;span style=&quot;color: #3933ff;&quot;&gt;&quot;article&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #777777;&quot;&gt;@XmlAccessorType&lt;/span&gt;(XmlAccessType.&lt;span style=&quot;color: #0326cc;&quot;&gt;FIELD&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt; Article &lt;span style=&quot;color: #931a68;&quot;&gt;implements&lt;/span&gt; Serializable{&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;
private&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;static&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;final&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;long&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0326cc;&quot;&gt;serialVersionUID&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = 1L;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #777777; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;@XmlJavaTypeAdapter&lt;span style=&quot;color: black;&quot;&gt;(MapAdapter.&lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: #931a68;&quot;&gt;private&lt;/span&gt; Map&amp;lt;String,Map&amp;lt;String,String&amp;gt;&amp;gt; &lt;span style=&quot;color: #0326cc;&quot;&gt;map&lt;/span&gt; = &lt;span style=&quot;color: #931a68;&quot;&gt;new&lt;/span&gt; HashMap&amp;lt;String,Map&amp;lt;String,String&amp;gt;&amp;gt;();&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px; min-height: 15px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; Article(){}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; Article(Map&amp;lt;String,Map&amp;lt;String,String&amp;gt;&amp;gt; m){&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;map&lt;/span&gt; = m;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; Map&amp;lt;String,Map&amp;lt;String,String&amp;gt;&amp;gt; getMap() {&lt;/div&gt;
&lt;div style=&quot;color: #931a68; font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;return&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0326cc;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #931a68;&quot;&gt;void&lt;/span&gt; setMap(Map&amp;lt;String,Map&amp;lt;String,String&amp;gt;&amp;gt;&amp;nbsp; map) {&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #931a68;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0326cc;&quot;&gt;map&lt;/span&gt; = map;&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div style=&quot;font-family: Monaco; font-size: 11px;&quot;&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #777777;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/1888705019052134272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samarasimha.blogspot.com/2013/08/xmladapter-jaxbs-secret-ninja.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/1888705019052134272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/1888705019052134272'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2013/08/xmladapter-jaxbs-secret-ninja.html' title='XmlAdapter - JAXB&#39;s Secret Ninja.'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-1356827066675840915</id><published>2013-05-02T10:04:00.001-07:00</published><updated>2016-01-28T14:10:58.308-08:00</updated><title type='text'>Mac OSX - install mod_jk</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;Steps to install mod_jk on OSX&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Download source from apache site&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;http://apache.mirrors.hoobly.com//tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.41-src.tar.gz&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Extract file and start building&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;background-color: white; color: #565555; font-family: &amp;quot;lucida grande&amp;quot; , &amp;quot;lucida sans unicode&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; font-style: italic; line-height: 20px;&quot;&gt;cd native&lt;/span&gt;&lt;/div&gt;
&lt;blockquote style=&quot;background-color: white; border: none; color: #565555; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Arial, sans-serif; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 0px 40px; padding: 0px; text-align: -webkit-auto;&quot;&gt;
&lt;div&gt;
make clean&lt;/div&gt;
&lt;/blockquote&gt;
&lt;blockquote style=&quot;background-color: white; border: none; color: #565555; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Arial, sans-serif; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 0px 40px; padding: 0px; text-align: -webkit-auto;&quot;&gt;
./configure CFLAGS=&#39;-arch x86_64&#39; APXSLDFLAGS=&#39;-arch x86_64&#39; --with-apxs=/usr/sbin/apxs&lt;/blockquote&gt;
&lt;blockquote style=&quot;background-color: white; border: none; color: #565555; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Arial, sans-serif; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 0px 40px; padding: 0px; text-align: -webkit-auto;&quot;&gt;
&lt;div&gt;
make&lt;/div&gt;
&lt;div&gt;
sudo make install&lt;/div&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;If you are seeing a compiler issues , follow below steps&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
The C compiler (&quot;cc&quot;) is located inside of that xctoolchain directory.&lt;br /&gt;
I created a symlink for OSX10.8.xctoolchain to point to XcodeDefault.xctoolchain&lt;br /&gt;
and that fixed the issue of compiler issue.&lt;br /&gt;
&lt;br /&gt;
cd /Applications/Xcode.app/Contents/Developer/Toolchains&lt;br /&gt;
sudo ln -s XcodeDefault.xctoolchain OSX10.11.xctoolchain&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal;&quot;&gt;
&lt;b&gt;If internal directory doesn&#39;t exist. There was no MacOSX10.11.Internal.sdk intead the directory was MacOSX10.11.sdk. So to create a symlink:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal;&quot;&gt;
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.Internal.sdk&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal;&quot;&gt;
Disable System Integrity by restarting the machine and holding [ Command + R ] until apple logo comes up.&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal;&quot;&gt;
then open the terminal from utilities and enter below command&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal;&quot;&gt;
csrutil disable &amp;nbsp; --&amp;gt; this is done because when installing apache &lt;a href=&quot;http://mod_jk.so/&quot;&gt;mod_jk.so&lt;/a&gt; file is not getting installed in /usr/libexec/apache2 folder, throwing error permission denied.&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal;&quot;&gt;
again to enable enter below command&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal; min-height: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; line-height: normal;&quot;&gt;
csrutil enable.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;b&gt;Configure Apache &amp;nbsp;&lt;/b&gt;&lt;/span&gt;mod_jk.conf ( /etc/apache2/other/mod_jk.conf )&lt;br /&gt;
&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
ps=/&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
LoadModule &amp;nbsp; &amp;nbsp;jk_module &amp;nbsp;/usr/libexec/apache2/mod_jk.so&lt;br /&gt;
JkShmFile &amp;nbsp; &amp;nbsp;/var/log/apache2/mod_jk.shm&lt;br /&gt;
JkWorkersFile /etc/apache2/workers.properties&lt;br /&gt;
JkLogFile &amp;nbsp; &amp;nbsp; /var/log/apache2/mod_jk.log&lt;br /&gt;
JkLogLevel &amp;nbsp; &amp;nbsp;info&lt;br /&gt;
JkLogStampFormat &quot;[%a %b %d %H:%M:%S %Y] &quot;&lt;br /&gt;
JkRequestLogFormat &quot;%w %V %T&quot;&lt;br /&gt;
&amp;lt;Location /status&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; JkMount status&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Order deny,allow&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Deny from all&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Allow from 127.0.0.1 192.168.2.%&lt;br /&gt;
&amp;lt;/Location&amp;gt;&lt;br /&gt;
# app2 Worker&lt;br /&gt;
JkMount /*.jsp worker1&lt;br /&gt;
JkMount /* worker1&lt;br /&gt;
## lb test - Worker&lt;br /&gt;
JkMount /lb lbloadbalancer&lt;br /&gt;
JkMount /lb/* lbloadbalancer&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;workers.properties (&lt;/span&gt;&lt;/b&gt;cd /etc/apache2/)&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;ps=/&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.list=worker1, lbloadbalancer&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.default.port=8009&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.default.host=localhost&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.default.type=ajp13&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.default.lbfactor=1&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;# worker1&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.port=8009&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.host=localhost&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.type=ajp13&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.lbfactor=1&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; min-height: 14px;&quot;&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.socket_connect_timeout=10000&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.socket_keepalive=True&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.ping_mode=A&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.ping_timeout=10000&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.connection_pool_minsize=0&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.connection_pool_timeout=600&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.retries=1&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.recovery_options=7&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.worker1.reply_timeout=10000&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; min-height: 14px;&quot;&gt;
&lt;i&gt;&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; min-height: 14px;&quot;&gt;
&lt;i&gt;&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;# LB - Loadbalancer&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.lbloadbalancer.type=lb&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.lbloadbalancer.balance_workers=worker1&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;worker.lbloadbalancer.sticky_session=True&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; min-height: 14px;&quot;&gt;
&lt;i&gt;&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;&amp;nbsp;•Change Tomcat-server config&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;i&gt;Edit file:&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;$TOMCAT_INSTALL/conf/server.xml&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Change&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;Engine name=&quot;Catalina&quot; defaultHost=&quot;localhost&quot;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Into:&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;Engine name=&quot;Catalina&quot; defaultHost=&quot;localhost&quot; jvmRoute=&quot;worker1&quot;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;&lt;engine defaulthost=&quot;localhost&quot; jvmroute=&quot;worker1&quot; name=&quot;Catalina&quot;&gt;&lt;/engine&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #990000;&quot;&gt;That&#39;s it.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
starting apache&lt;br /&gt;
cd /etc/apache2/&lt;br /&gt;
sudo apachectl start/stop&lt;br /&gt;
&lt;br /&gt;
logs for mod_jk&lt;br /&gt;
cd /var/log/apache2&lt;br /&gt;
tail -f mod_jk.log&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;To enable server status for apache on Mac OSX.&lt;/b&gt;&lt;br /&gt;
This is the solution if you are running Mac OS X 10.11 El Capitan. Note: You need administrator privileges. (sudo)&lt;br /&gt;
&amp;nbsp;In your /etc/apache2/httpd.conf uncomment these lines&lt;br /&gt;
&amp;nbsp;LoadModule status_module libexec/apache2/mod_status.so&lt;br /&gt;
Include /private/etc/apache2/extra/httpd-info.conf&lt;br /&gt;
&lt;br /&gt;
Now open /etc/apache2/extra/httpd-info.conf and make changes as below.&lt;br /&gt;
&amp;lt;Location /server-status&amp;gt;&lt;br /&gt;
&amp;nbsp; SetHandler server-status&lt;br /&gt;
&amp;nbsp; Require host localhost&lt;br /&gt;
&amp;nbsp; &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can open the URL http://localhost/server-status with your web browser and see the apache status.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Include below to see &quot; It Works&quot; when you enter localhost in your browser, however localhost/status page throws error now.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Virtual hosts&lt;br /&gt;
Include /private/etc/apache2/extra/httpd-vhosts.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
ServerName localhost&lt;br /&gt;
DocumentRoot /Library/WebServer/Documents/&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/1356827066675840915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/1356827066675840915'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2013/05/mac-osx-install-modjk.html' title='Mac OSX - install mod_jk'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-6660018381189458547</id><published>2011-04-24T21:06:00.000-07:00</published><updated>2013-02-11T14:05:01.845-08:00</updated><title type='text'>Setting up Coherence in Tomcat Clustered Environment</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;Update catalina.sh&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;XXX_OPTS=&quot;-Dtangosol.coherence.distributed.localstorage=false -Dtangosol.coherence.cacheconfig=$PROP_PATH/coherence_cache.xml -Dtangosol.coherence.override=$PROP_PATH/coherence_cache_override.xml&quot;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;export CATALINA_OPTS=&quot;-server -d64 -Xloggc:xxxx/gc.log -XX:+PrintGCDetails -Xms2048m -Xmx2048m -Dfile.encoding=UTF-8 -DKMSERVICES_HOME=$PROP_PATH $XXX_OPTS&quot;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;echo &quot;Catalina OPTS &quot; &amp;nbsp;$CATALINA_OPTS&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;below is the coherence_cache_override.xml&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZmDu_Zz3wKQGJr5MDiww6cAMkoQZPuEtqXKU3Nr_hEIe_X6XaC7JlXNFBaPacXe-iHiLdffO3mpxq9OZyTaaEkKb6pCvDzc15BTwBh1sA9myZRps8lYYBDoPao7Fplk0bdZRZzM2TQ3w/s1600/Screen+shot+2011-04-24+at+9.16.12+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;433&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZmDu_Zz3wKQGJr5MDiww6cAMkoQZPuEtqXKU3Nr_hEIe_X6XaC7JlXNFBaPacXe-iHiLdffO3mpxq9OZyTaaEkKb6pCvDzc15BTwBh1sA9myZRps8lYYBDoPao7Fplk0bdZRZzM2TQ3w/s640/Screen+shot+2011-04-24+at+9.16.12+PM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;below is the coherence_cache.xml&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHruSc_y21kD-eZlRQNNsvkaUKYdKXANc6xbK015Z-2OD5XKPMDvbTlOwc2oy_O0glyMHx42IPuFkUpvpyajIhUq4LcQBD7R8D1wbHHcXPoGLYDefrpT2afAHDU5Z50iRZG0SA9sBmiPI/s1600/Screen+shot+2011-04-24+at+9.12.51+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;564&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHruSc_y21kD-eZlRQNNsvkaUKYdKXANc6xbK015Z-2OD5XKPMDvbTlOwc2oy_O0glyMHx42IPuFkUpvpyajIhUq4LcQBD7R8D1wbHHcXPoGLYDefrpT2afAHDU5Z50iRZG0SA9sBmiPI/s640/Screen+shot+2011-04-24+at+9.12.51+PM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/6660018381189458547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samarasimha.blogspot.com/2011/04/setting-up-coherence-in-tomcat.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/6660018381189458547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/6660018381189458547'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2011/04/setting-up-coherence-in-tomcat.html' title='Setting up Coherence in Tomcat Clustered Environment'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZmDu_Zz3wKQGJr5MDiww6cAMkoQZPuEtqXKU3Nr_hEIe_X6XaC7JlXNFBaPacXe-iHiLdffO3mpxq9OZyTaaEkKb6pCvDzc15BTwBh1sA9myZRps8lYYBDoPao7Fplk0bdZRZzM2TQ3w/s72-c/Screen+shot+2011-04-24+at+9.16.12+PM.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-6795977625442595745</id><published>2011-04-16T20:34:00.000-07:00</published><updated>2013-02-11T14:07:06.894-08:00</updated><title type='text'>How to install/Test Coherence*WEB for Weblogic</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;Coherence Based Session Management&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;Assumptions&lt;/span&gt;&lt;/b&gt;: you have downloaded latest web logic server 10.3.3 and Coherence Web 3.6&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; from Oracle&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;Instructions&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
First we will create weblogic domains : something like  DOMAIN_A and DOMAIN_B. &lt;br /&gt;
To configure those domains with coherence based session management, then the &lt;br /&gt;
changing of session variable value in one domain will propagate to another domain.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;Main  Steps&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;Application Server (WebLogic) &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1) Create DOMAIN_A and DOMAIN_B&lt;br /&gt;
2) Copy coherence.jar to DOMAIN_A\lib and DOMAIN_B\lib&lt;br /&gt;
3) Start both the Domains&lt;br /&gt;
4) Deploy coherence-web-spi.war as a shared library&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;Coherence&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1) duplicate cache-server.cmd at the same folder in the coherence and rename &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;it to web-cache-server.cmd&lt;br /&gt;
2) modify web-cache-server.cmd as shown below &lt;br /&gt;
3) set java_opts=&quot;-Xms%memory% -Xmx%memory%&quot;&lt;br /&gt;
&lt;br /&gt;
&quot;%java_exec%&quot; -server -showversion &quot;%java_opts%&quot; -cp  &lt;br /&gt;
c:\coherence\lib\coherence.jar;c:\coherence\lib\coherence-web-spi.war - &lt;br /&gt;
Dtangosol.coherence.management.remote=true -Dtangosol.coherence.cacheconfig=WEB-&lt;br /&gt;
INF/classes/session-cache-config.xml -Dtangosol.coherence.session.localstorage=true   &lt;br /&gt;
com.tangosol.net.DefaultCacheServer %1&lt;br /&gt;
&lt;br /&gt;
4) startup web-cache-server.cmd&lt;br /&gt;
5) Modify weblogic.xml to add a reference to coherence-web-spi as shown below &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; in you application&lt;br /&gt;
&lt;wls:library-ref&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;!--StartFragment--&gt;  &lt;/wls:library-ref&gt;&lt;br /&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-left: .75in; mso-add-space: auto;&quot;&gt;
&lt;i&gt;&amp;nbsp;wls:library-ref&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: .75in; mso-add-space: auto;&quot;&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;wls:library-name&lt;b&gt; &amp;nbsp; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;coherence-web-spi&lt;/span&gt; &amp;nbsp;&lt;/b&gt;wls:library-name&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: .75in; mso-add-space: auto;&quot;&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;wls:specification-version &amp;nbsp;&lt;b&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;1.0.0.0 &amp;nbsp;&lt;/span&gt;&lt;/b&gt;wls:specification-version&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: .75in; mso-add-space: auto;&quot;&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;wls:exact &lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;true &lt;/span&gt;&lt;/b&gt;&amp;nbsp;wls:exact&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left: .75in; mso-add-space: auto;&quot;&gt;
&lt;i&gt;wls:library-ref&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;!--EndFragment--&gt;         &lt;br /&gt;
&lt;br /&gt;
deploy the webapp to DOMAIN_A and DOMAIN_B&lt;br /&gt;
&lt;br /&gt;
Now test Session variable value at DOMAIN_A and check wether it is changed at DOMAIN_B, As show in the below figure&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh57AT6hYpVt6sUfKpzUySUMRjnI1PyV2jKohX7QC3ZKDbu627isiQwOnjJjJOj9jLa5BQKRQZFuQyxj86ZQXPM-ICc8ps07lyUPtcGflgz5EYRAJL8xkZDDSzJs_atcXF9Ha4BRoueVZg/s1600/cohWeblogic.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh57AT6hYpVt6sUfKpzUySUMRjnI1PyV2jKohX7QC3ZKDbu627isiQwOnjJjJOj9jLa5BQKRQZFuQyxj86ZQXPM-ICc8ps07lyUPtcGflgz5EYRAJL8xkZDDSzJs_atcXF9Ha4BRoueVZg/s1600/cohWeblogic.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px;&quot;&gt;Coherence In Action&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/6795977625442595745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samarasimha.blogspot.com/2011/04/how-to-installtest-coherenceweb-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/6795977625442595745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/6795977625442595745'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2011/04/how-to-installtest-coherenceweb-for.html' title='How to install/Test Coherence*WEB for Weblogic'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh57AT6hYpVt6sUfKpzUySUMRjnI1PyV2jKohX7QC3ZKDbu627isiQwOnjJjJOj9jLa5BQKRQZFuQyxj86ZQXPM-ICc8ps07lyUPtcGflgz5EYRAJL8xkZDDSzJs_atcXF9Ha4BRoueVZg/s72-c/cohWeblogic.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-1948497536950411537</id><published>2011-04-12T20:56:00.000-07:00</published><updated>2013-02-11T14:07:16.622-08:00</updated><title type='text'>Setting Up Tomcat Multiple Instances</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;Setting up tomcat multiple instances&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1) First Original Instance, download apache-tomcat-5.5.33 ( any version) this will be the original  &lt;br /&gt;
Instance and change nothing here.&lt;br /&gt;
&lt;br /&gt;
2) For the instance 2 ... to N do the following as mentioned below&lt;br /&gt;
&lt;br /&gt;
a) Create a new Folder (TomcatInstance1….N) as many as you instances as you want&lt;br /&gt;
b) Copy following folders over to TomcatInstance1… to N&lt;br /&gt;
&lt;b&gt;&lt;i&gt;conf&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;logs&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;temp&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;webapps&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;work&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
c)  Write a script to startup/shutdown the second instance(name it as startup.sh &lt;br /&gt;
and shutdown.sh) and place under  TomcatInstance1..N folders&lt;br /&gt;
d)  Add following to the newly created startup.sh&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;CATALINA_HOME=~/Documents/apache-tomcat-5.5.33&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;CATALINA_BASE=~/Documents/TomcatInstance1&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;export CATALINA_HOME CATALINA_BASE&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;$CATALINA_HOME/bin/catalina.sh start&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
e) Add the following to the newly created shutdown.sh&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;CATALINA_HOME=~/Documents/apache-tomcat-5.5.33&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;CATALINA_BASE=~/Documents/TomcatInstance1&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;export CATALINA_HOME CATALINA_BASE&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;$CATALINA_HOME/bin/catalina.sh stop&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
f) Modify the server.xml file in TomcatInstance1/conf/server.xml and change the port  &lt;br /&gt;
number to 8180&lt;br /&gt;
&lt;connector acceptcount=&quot;100&quot; connectiontimeout=&quot;20000&quot; disableuploadtimeout=&quot;true&quot; enablelookups=&quot;false&quot; maxhttpheadersize=&quot;8192&quot; maxsparethreads=&quot;75&quot; maxthreads=&quot;150&quot; minsparethreads=&quot;25&quot; port=&quot;8180&quot; redirectport=&quot;8443&quot;&gt; &lt;br /&gt;
AND change port number to 8109 for the Connector Port of &quot;AJP/1.3&quot;&lt;br /&gt;
&lt;br /&gt;
That&#39;s it now start the server with following command &quot; sh startup.sh&quot; and login to  &lt;br /&gt;
http://localhost:8180 and you should see the tomcat page, do the same for as many instances as you want&lt;/connector&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/1948497536950411537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samarasimha.blogspot.com/2011/04/setting-up-tomcat-multiple-instances.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/1948497536950411537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/1948497536950411537'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2011/04/setting-up-tomcat-multiple-instances.html' title='Setting Up Tomcat Multiple Instances'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-8719095734212394810</id><published>2011-04-12T20:48:00.000-07:00</published><updated>2013-02-11T14:07:26.520-08:00</updated><title type='text'>How to install/Test Coherence*WEB for Tomcat</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;Steps to Create &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;First Install Coherence*Web in your local directory&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1) Complete the application inspection step by running the following command. &lt;br /&gt;
Specify the full    path to your application and the name of your server &lt;br /&gt;
(replacing the &lt;app-path&gt; and &lt;server-type&gt; with them in the command line below):&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
java -jar webInstaller.jar &lt;/i&gt;&lt;app-path&gt;&lt;i&gt; -inspect -server:&lt;/i&gt;&lt;server-type&gt;&lt;i&gt;&lt;br /&gt;
&lt;br /&gt;
e;g java -jar WebInstaller.jar c:\MyCoherenceWeb -inspect -server:Tomcat/5.5&lt;/i&gt; &lt;br /&gt;
&lt;br /&gt;
The system will create the coherence-web.xml&lt;br /&gt;
&lt;br /&gt;
2) Complete the Coherence Web application installation step by running the following command,    &lt;br /&gt;
replacing &lt;app-path&gt; with the full path to your application:&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
java -jar webInstaller.jar &lt;/i&gt;&lt;app-path&gt;&lt;i&gt; -install&lt;br /&gt;
e;g java -jar webInstaller.jar c:\MyCoherenceWeb -install&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The installer requires a valid coherence-web.xml configuration file to reside&lt;br /&gt;
in the same directory as the application&lt;br /&gt;
&lt;br /&gt;
checking if this process is correctly installed or not by verifying the application.war file.&lt;br /&gt;
&lt;br /&gt;
1) Make sure you have a coherence-web.xml in you META-INF file.&lt;br /&gt;
2) Installer will Add the following directive to each JSP Page that you have in application &lt;br /&gt;
&lt;br /&gt;
3) Installer will modify and add Coherence Web configuration context parameters in web.xml&lt;br /&gt;
descriptor and also add&#39;s a listener classes at the end of the web.xml file&lt;br /&gt;
4) Make sure you classes folder will have &quot;session-cache-config.xml&quot; file generated.&lt;br /&gt;
5) Make sure you lib folder contain coherence.jar and coherence-web.jar&lt;/app-path&gt;&lt;/app-path&gt;&lt;/server-type&gt;&lt;/app-path&gt;&lt;/server-type&gt;&lt;/app-path&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/8719095734212394810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samarasimha.blogspot.com/2011/04/how-to-install-coherenceweb.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/8719095734212394810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/8719095734212394810'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2011/04/how-to-install-coherenceweb.html' title='How to install/Test Coherence*WEB for Tomcat'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-2209121507445430925</id><published>2009-07-24T17:25:00.000-07:00</published><updated>2009-07-27T12:44:18.209-07:00</updated><title type='text'>Portlet IPC using JBOSS Portal</title><content type='html'>&lt;pre&gt;&lt;br /&gt;Portlet 2.0 is the recently finalized latest version of the Java portlet&lt;br /&gt;specification. One of the shortcomings of the previous version of the spec&lt;br /&gt;(JSR168)was lack of support for inter-portlet communication.As a result, &lt;br /&gt;developers had to resort to all kinds of fancy workarounds using Dojo Toolkit&lt;br /&gt;&lt;br /&gt;I am not going to explain what is JSR286 , but try to &lt;br /&gt;achieve IPC for JBOSS Portal&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Defining events&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To define an event, you would have to declare it in&lt;br /&gt;portlet.xml, as shown  below&lt;br /&gt;&lt;br /&gt;   &amp;lt;event-definition&amp;gt;&lt;br /&gt;      &amp;lt;qname&lt;br /&gt;      xmlns:mycomp=&#39;http://www.something.com/jsr286&#39;&amp;gt;&lt;br /&gt;      something:AppEvent&amp;lt/qname&amp;gt;&lt;br /&gt;      &amp;lt;value-type&amp;gt;com.ceon.ocp.portlet.WrapperEvent&amp;lt;/value-type&amp;gt;&lt;br /&gt;      &amp;lt;/event-definition&amp;gt;&lt;br /&gt;&lt;br /&gt; &lt;span style=&quot;font-weight:bold;&quot;&gt;Publishing an Event&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;portlet&amp;gt;&lt;br /&gt;....&lt;br /&gt;&amp;lt;portlet-name&amp;gt;pubEventPortlet&amp;lt;/portlet-name&amp;gt;&lt;br /&gt;&amp;lt;supported-publishing-event&amp;gt;&lt;br /&gt;   &amp;lt;qname &lt;br /&gt;    xmlns:something=&#39;http://www.something.com/jsr286&#39;&amp;gt;&lt;br /&gt;    something:AppEvent&amp;lt;/qname&amp;gt;&lt;br /&gt;&amp;lt;/supported-publishing-event&amp;gt;&lt;br /&gt;....&lt;br /&gt;&amp;lt;/portlet&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Processing an Event&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;portlet&gt;&lt;br /&gt;....&lt;br /&gt;&amp;lt;portlet-name&amp;gt;subEventPortlet&amp;lt;/portlet-name&amp;gt;&lt;br /&gt;&amp;lt;supported-processing-event&amp;gt;&lt;br /&gt; &amp;lt;qname xmlns:something=&#39;http://www.something.com/jsr286&#39;&amp;gt;&lt;br /&gt; something:AppEvent&amp;lt;/qname&amp;gt;&lt;br /&gt;&amp;lt;/supported-processing-event&amp;gt;&lt;br /&gt;....&lt;br /&gt;&amp;lt;/portlet&amp;gt;&lt;br /&gt;&lt;br /&gt;Each portlet definition can have both publishing and processing tags&lt;br /&gt;and you could define multiple events within each portlet definition&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Coding events&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An Example event class &lt;br /&gt;&lt;br /&gt;@XmlRootElement&lt;br /&gt;public class WrapperEvent implements Serializable {&lt;br /&gt;    ...&lt;br /&gt;    public static final QName QNAME = new QName(&lt;br /&gt;   &quot;http://www.something.com/jsr286&quot;, &quot;AppEvent&quot;);&lt;br /&gt;    private String name;&lt;br /&gt;        private String zipcode;&lt;br /&gt;        ...&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;An event class must implement the Serializable interface and be annotated with &lt;br /&gt;@XmlRootElement, I am using Java 5,so I used jaxb-api-2.1.jar from the JBoss portlet &lt;br /&gt;container 2.0 lib directory&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;subscriber ( receiving portlet )&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt; protected void doView(RenderRequest request, RenderResponse renderResponse)&lt;br /&gt;   throws PortletException, IOException {&lt;br /&gt;  renderResponse.setContentType(request.getResponseContentType());&lt;br /&gt;  // setting the attributes for JSP&lt;br /&gt;  request.setAttribute(QUOTE_ATTR, quoteId);&lt;br /&gt;  getPortletContext().getRequestDispatcher(VIEW_JSP).include(request,renderResponse);&lt;br /&gt; }&lt;br /&gt; @Override&lt;br /&gt; public void processEvent(EventRequest eventRequest, EventResponse response)&lt;br /&gt;   throws PortletException, IOException {&lt;br /&gt;        Event event = eventRequest.getEvent();&lt;br /&gt;        if(event.getQName().equals(WrapperEvent.QNAME))&lt;br /&gt;        {&lt;br /&gt;         com.ceon.ocp.portlet.WrapperEvent&lt;br /&gt;         wrapEvent=(com.ceon.ocp.portlet.WrapperEvent)event.getValue();&lt;br /&gt;         quoteId = wrapEvent.getQuoteID();&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Publisher( trigger event portlet) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;  protected void doView(RenderRequest request, RenderResponse renderResponse)&lt;br /&gt;   throws PortletException, IOException {&lt;br /&gt;   renderResponse.setContentType(request.getResponseContentType());&lt;br /&gt;   getPortletContext().getRequestDispatcher(VIEW_JSP)&lt;br /&gt;   .include(request,renderResponse);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;  public void processAction(ActionRequest request, ActionResponse response)&lt;br /&gt; throws PortletException, IOException {&lt;br /&gt; String quoteParam = request.getParameter(&quot;QuoteID&quot;);&lt;br /&gt; if ( quoteParam == null || quoteParam.trim().equals(&quot;&quot;)) {&lt;br /&gt; quoteParam = &quot;No Quote ID Specified&quot;;&lt;br /&gt; }&lt;br /&gt; com.ceon.ocp.portlet.WrapperEvent event&lt;br /&gt;        = new  com.ceon.ocp.portlet.WrapperEvent();&lt;br /&gt; event.setQuoteID(quoteParam);&lt;br /&gt; response.setEvent(com.ceon.ocp.portlet.WrapperEvent.QNAME, event);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;And simple JSPs for both subscriber and publisher.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;reciever.jsp &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%@taglib uri=&quot;http://java.sun.com/portlet_2_0&quot; prefix=&quot;portlet&quot;%&amp;gt;&lt;br /&gt;&amp;lt;portlet:defineObjects /&amp;gt;&lt;br /&gt; Here are the details of Quote State:&lt;br /&gt;QuoteState: &amp;lt;%= renderRequest.getAttribute(&quot;QuoteID&quot;)%&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;publisher.jsp&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%@taglib uri=&quot;http://java.sun.com/portlet_2_0&quot; prefix=&quot;portlet&quot;%&amp;gt;&lt;br /&gt;&amp;lt;portlet:defineObjects /&amp;gt;&lt;br /&gt;Please enter Quote ID and click submit,you should&lt;br /&gt;see the Quote State in OCP Portlet&lt;br /&gt;&lt;br /&gt;&amp;lt;form method=&#39;post&#39; action=&quot;&amp;lt;portlet:actionURL /&amp;gt;&quot; &amp;gt;&lt;br /&gt;  QuoteID: &amp;lt;input type=text name=QuoteID&amp;gt;&lt;br /&gt;  &amp;lt;input type=submit&amp;gt; &lt;br /&gt;  &amp;lt;/form&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;One final step is go to &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After you have installed and configured the container,look at its core Web &lt;br /&gt;application, called simple-portal.This Web application holds the framework that &lt;br /&gt;displays the portlets. You could either add your own page by modifying &lt;br /&gt;layouts/nav/main.jsp, or modify one of the existing pages. I modified one of the &lt;br /&gt;existing pages, demo/demo.jsp, by removing its portlets and adding my own custom &lt;br /&gt;portlets. The JBoss portlet container uses a very simple tag library to include &lt;br /&gt;portlets, which requires the portlet name as defined in portlet.xml and the&lt;br /&gt;context name of the portlet Web application&lt;br /&gt;&lt;br /&gt;&amp;lt;xportal:portlet name=&quot;pubEventPortlet&quot; applicationName=&quot;JbossSample&quot;/&amp;gt;               &lt;br /&gt;&amp;lt;xportal:portlet name=&quot;subEventPortlet&quot; applicationName=&quot;JbossSample&quot;/&amp;gt;  &lt;br /&gt;&lt;br /&gt;As you can see, it&#39;s quite easy for a portlet to receive events from another portlet,&lt;br /&gt;whether the two portlets reside in the same or separate Web applications.&lt;br /&gt;You just have to make sure to include the common event classes in all portlet Web &lt;br /&gt;applications.If you would like to deploy this application to an other Portlet 2.0 &lt;br /&gt;container, make sure to check that container&#39;s requirements for web.xml,as some &lt;br /&gt;containers expect specific elements in the web.xml files of Portlet 2.0 applications             &lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/2209121507445430925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samarasimha.blogspot.com/2009/07/portlet-ipc-using-jboss-portal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/2209121507445430925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/2209121507445430925'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2009/07/portlet-ipc-using-jboss-portal.html' title='Portlet IPC using JBOSS Portal'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-9004772626931062443</id><published>2009-07-24T12:51:00.000-07:00</published><updated>2009-07-24T15:23:08.930-07:00</updated><title type='text'>How to configure a Jboss Datasource?</title><content type='html'>&lt;pre&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Configuring a Datasource in Jboss very easy&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Step 1: &lt;/span&gt;copy the original oracle-ds.xml from $jboss-home\docs\examples\jca\oracle-ds.xml to &lt;br /&gt;$jboss-home\server\default\deploy\&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Step 2: &lt;/span&gt;modify the XML file as follows&lt;br /&gt;&amp;lt;datasources&amp;gt;&lt;br /&gt; &amp;lt;local-tx-datasource&amp;gt;&lt;br /&gt; &amp;lt;jndi-name&gt;OracleDS&amp;lt;/jndi-name&amp;gt;&lt;br /&gt; &amp;lt;connection-url&amp;gt;jdbc:oracle:thin:@IP:PORT:SID&amp;lt;/connection-url&amp;gt;&lt;br /&gt;&amp;lt;use-java-context&amp;gt;false&amp;lt;/use-java-context&amp;gt; &lt;br /&gt;&amp;lt;!-- this is required if u want to connect to DB remotely  from Main method-- &amp;gt;&lt;br /&gt;&amp;lt;driver-class&amp;gt;oracle.jdbc.driver.OracleDriver&amp;lt;/driver-class&amp;gt;&lt;br /&gt;   &amp;lt;user-name&amp;gt;user&amp;lt;/user-name&amp;gt;&lt;br /&gt;   &amp;lt;password&amp;gt;password&amp;lt;/password&amp;gt;&lt;br /&gt;   &amp;lt;min-pool-size&amp;gt;5&amp;lt;/min-pool-size&amp;gt;&lt;br /&gt;   &amp;lt;max-pool-size&amp;gt;100&amp;lt;/max-pool-size&amp;gt;&lt;br /&gt;   &amp;lt;query-timeout&amp;gt;60&amp;lt;/query-timeout&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;exception-sorter-class-name&amp;gt;org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter&amp;lt;/exception-sorter-class-name&amp;gt;&lt;br /&gt;   &amp;lt;metadata&amp;gt;&lt;br /&gt;    &amp;lt;type-mapping&amp;gt;Oracle9i&amp;lt;/type-mapping&amp;gt;&lt;br /&gt;   &amp;lt;/metadata&amp;gt;&lt;br /&gt;  &amp;lt;/local-tx-datasource&amp;gt;&lt;br /&gt;  &amp;lt;/datasources&amp;gt;&lt;br /&gt; &lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Step 3&lt;/span&gt;. Drop the JDBC driver jar into Jboss classpath (easiest approach - drop the jar file in to /server/default/lib)&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/9004772626931062443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samarasimha.blogspot.com/2009/07/how-to-configure-jboss-datasource_24.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/9004772626931062443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/9004772626931062443'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2009/07/how-to-configure-jboss-datasource_24.html' title='How to configure a Jboss Datasource?'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5895727818503045962.post-6534569501239883975</id><published>2009-07-24T12:16:00.000-07:00</published><updated>2009-07-27T12:46:32.441-07:00</updated><title type='text'>Invoking Datasource Remotely for JBOSS</title><content type='html'>&lt;pre&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;DataSources are not exposed remotely by default&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;In JBoss4 and above, you can set the following attribute to false in the datasource &lt;br /&gt;definition: in oracle-ds.xml to lookup datasource remotely ( typically from external&lt;br /&gt;java class from main method as shown below) &amp;lt;use-java-context&amp;gt;false&amp;lt;/use-&lt;br /&gt;java-context&amp;gt; if datasource is not invoked remotely then you can&lt;br /&gt;comment the above line in oracle-ds.xml&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;pre&gt; public static void main(String[] args) {&lt;br /&gt;  try {&lt;br /&gt;        Properties props = new Properties();&lt;br /&gt;        props.setProperty(&quot;java.naming.factory.initial&quot;,&lt;br /&gt;        &quot;org.jnp.interfaces.NamingContextFactory&quot;);&lt;br /&gt;        props.setProperty(&quot;java.naming.factory.url.pkgs&quot;&lt;br /&gt;        ,&quot;org.jboss.naming&quot;);&lt;br /&gt;        props.setProperty(&quot;java.naming.provider.url&quot;,&lt;br /&gt;        &quot;127.0.0.1:1099&quot;);&lt;br /&gt;        &lt;br /&gt;        InitialContext ctx = new InitialContext(props);&lt;br /&gt;        MyBeanRemote bean=(MyBeanRemote)ctx.lookup(&quot;MyBean/remote&quot;);&lt;br /&gt;        bean.doSomething();&lt;br /&gt;        DataSource ds = (DataSource)ctx.lookup(&quot;OracleDS&quot;);&lt;br /&gt;        Connection con = ds.getConnection(); &lt;br /&gt;        ResultSet rs = con.createStatement()&lt;br /&gt;          .executeQuery(&quot;SELECT NAME FROM EMPLOYEE&quot;);  &lt;br /&gt;        while (rs.next()) {  &lt;br /&gt;          System.out.println(&quot;I got &quot; + rs.getString(1));  &lt;br /&gt;        }  &lt;br /&gt;        rs.close();  &lt;br /&gt;        con.close();&lt;br /&gt;        } catch (Exception e) {&lt;br /&gt;            .......&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Note &lt;/span&gt;: if the datasource is not looked-up &lt;br /&gt;remotely then the look-up might change to ctx.lookup(&quot;java:OracleDS&quot;) or &lt;br /&gt;ctx.lookup(&quot;java:/OracleDS&quot;) depends on whatever DS is bound to , check the server &lt;br /&gt;start up log&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://samarasimha.blogspot.com/feeds/6534569501239883975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samarasimha.blogspot.com/2009/07/invoking-datasource-remotely-for-jboss.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/6534569501239883975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5895727818503045962/posts/default/6534569501239883975'/><link rel='alternate' type='text/html' href='http://samarasimha.blogspot.com/2009/07/invoking-datasource-remotely-for-jboss.html' title='Invoking Datasource Remotely for JBOSS'/><author><name>Technology Blog</name><uri>http://www.blogger.com/profile/06125602330462153549</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>