Saturday, February 26, 2011

Apache Solr : How can i used Apache Solr to implement search functionaly in my web project

Here we are going to study about search libray called apache solr. Basically using apache solr you can implement the functionality demostrated by following future. I think this future gives better idea of what you can get out of it rather than explaining it using words.



Ok, now we have small idea about it's power. As a first step to get the concepts behind apache solr, lets start by starting it on apache tomcat server.

Since i am following this totorial , i preffere using jetty server to run solr. But running it on apahe tomcat is not a big deal, just copy war file in to web apps directory in your tomcat folder.

To do this you need to download extract solr server then to goto examples folder and run java -jar starup.jar . Thats all you need to do to get it running on jetty server.

Friday, February 25, 2011

How to configure your application on the start up using Constretto

Since i am new to using Constretto, i thought of sharing my experince in understanding the usage of Constretto.

First i sarted following following tutorila to write helloworld time application and then to move towords more advanced topics.

Opps , at the start of the tutorila seems a problems

Totorial is written using MVN automated build system. I am new to MVN as well. But i have little understanding of its behaviour , so it will help me to contitune this tutorial successfully.

Following line at the begining of the tutorial might means something similart to following.

"It allows you to “tag” configuration values, so that Constretto could choose the correct value at runtime."

Constretto gives tag for each and every configuration value. So during hte runtime using the this tag value , it can deside which configuration value to be used. i am wondering why they have mentioned at the begining of the torrorial. Because, we know that, if there is a configuration file with lot of values , then there should be some mechanisum to identify each and every configuration value identically. So this is nothing strange right :\

But next line says something very important for me, it says that , Constretto supports different configuration mechanisums. Hmm, before looking in to tutorial , i didn't know even one configuration mechanisums. So it says development community is already following different configuration mechanisums.

"It also works as a bridge between different configuration formats, and currently Java property files, Ini files, and Java Beans are
supported."

I usually prefere reading introduction when ever i am about to something new. So here no different :)

First step is to crete mvn project. i have used eclipse IDE and m2eclipse plugin installed on it. Alos you can take any other path as you wish.

When you are done with crating project skelton using MVN , you will find System.out.println("Helloworld"); Line at sample class created by you using mvn simple project skelton.

OK, now we are going to have fun with Constretto technique of configuring the project.

OK i added following code in to App.java class

ConstrettoConfiguration config =
new ConstrettoBuilder()
.createPropertiesStore()
.addResource(new DefaultResourceLoader().getResource("classpath:test.properties"))
.addResource(new DefaultResourceLoader().getResource("file:test2.properties"))
.done()
.createIniFileConfigurationStore()
.addResource(new DefaultResourceLoader().getResource("classpath:test.ini"))
.done()
.createObjectConfigurationStore()
.addObject(new Object())
.done()
.createSystemPropertiesStore()
.getConfiguration();

This is not a big deal, just copy this code segment from this tutorial https://github.com/constretto/constretto-core

Now in the above code sample you can see that configuration file is given in so many different ways, So i would like to know how classpath.test.propeties gives the path to property file.

Ok putting classpath.test.properties file in so many different places helped us to resolve this issue. Now comes the most interesting part of this problem. I want to put this file in the location that i am interested reather than in the place it is given still using classpath.test.properties method.

Thursday, February 10, 2011

How to use maven for your project.


In this part of the tutorial , we will be looking at how to use MVN as a build tool for a web project.

Since i am new to MVN , i have many problems with regards to usage of MVN as you would. So
When i was browsing the internet for "MVN totorial" first thing i found was Thils.

Since i have downloaded MVN and started following 5 min guide at here. i was faced with following problems.
When i was followng this tutorila using eclipse , it gave me more visual information about following command if you are using command line to genearate MVN project structure.

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

M2Eclipse plugin provides visual interfaces during project strucutre generation phase to select thise options. Following option took my interest to investigate more since that does not mean any thing to me when i was looking at it for the first time. Following is the screen short for M2Eclipse page.



it asks you to select appropriate archetype plugin. hemm, in my vocabulary there is no such name. That is software engineering. it is full of such strange terms. Lets try to get this term in to our terminology.



Saturday, February 5, 2011

First JSP applicatoin

Here i am giving you basics of developing JSP web application from scratch.

i will be using MVN as the build tool and Git as the source control system. First this application will be developed using traditional database integration tool. At later stage same application will be developed using Hibernate. I will also be using Spring framework when this application is getting mature ;).

Thats all for now. so lets start moving to other sections.

I already have account at http://www.github.com.
Now follow the steps given in above figure after creating repository at github.com

ok , you are done, following above steps is easy. Also make sure that you have added your public key to the github to follow above steps with out problem :)

Now , what is the next problem. it is MVN right. we have decided to use MVN as our build tool. so how to go about integrating MVN in to our project.

Now , what should be our next movement. it is creating project structure using MVN.

Now here are the problems comes in to my mind.

I am developing web application. So how would i go about developing MVN build infrastructure for Web Project. Since i didn't have idea about how mvn works. i started writing following simple application to understand its behavior following the tutorial at