Monday, September 01, 2008

AppFuse First Impression (An Introduction to MVC Design Pattern)

Now, we have learned about Tapestry, Hibernate, and Spring. So, let me introduce a MVC architecture. An architecture such as MVC is a design pattern that describes a recurring problem and its solution that used 3 main components. MVC, They are Model (business logic goes here), View (presentation logic goes here), and Controller (application logic goes here). One of MVC framework is Brick/ AppFuse Framework. By default, AppFuse use Hibernate framework as Model (object persisting framework), Tapestry framework as View (web presentation), and Spring framework as Controller. So, here it is...

All that we need are AppFuse framework, Apache Ant, MySQL as database, Apache Tomcat as application server, Eclipse as IDE and JUnit as testing tools. Extract Apache Ant in a specific location, as example in /home/ndung/Java/ant/apache-ant-1.7.0. Configure our environment variables.
~$ sudo gedit /etc/bash.bashrc

Add these lines in that file:
export ANT_HOME=/home/ndung/Java/ant/apache-ant-1.7.0
export PATH=$PATH:$ANT_HOME/bin


To configure Apache Tomcat and Eclipse read this. Extract Junit in specific folder and copy junit-x.x.jar into Apache Ant libraries (apache-ant-1.7.0/lib). Extract AppFuse in our eclipse workspace as example /home/ndung/workspace/appfuse. Open properties.xml and edit tomcat properties (line 37-40) based on our tomcat configuration mainly in user name and password. Also edit our database properties (line 43-59) based on our MySQL or our other database configuration mainly in user name and password. Open terminal and run:
~$ ant new


After that enter our project workspace folder. Run setup and test-all.
~$ cd /home/ndung/workspace/AppfuseExample
~$ ant setup test-all


Finish! Now start our tomcat. We will start it manually by using terminal. Enter Tomcat installation bin folder.
~$ cd /opt/apache-tomcat-5.5.26/bin

Add the execute permission to all of the .sh files in the $CATALINA_HOME/bin directory.
~$ sudo chmod u+x startup.sh
~$ sudo chmod u+x catalina.sh
~$ sudo chmod u+x setclasspath.sh
~$ sudo chmod u+x shutdown.sh


Start our engine (tomcat) by using this command:
~$ ./startup.sh

Now, point our browser into http://localhost:8080/AppfuseExample. Use our tomcat user name and password to log in as user, as example in my tomcat configuration, user name: tomcat; password: tomcat. To log in as administrator use mraible as user name and tomcat as password.
Here is some screen shot:


Don't forget to shut down our engine:
~$ ./shutdown.sh

Now, how to edit this project by using IDE. Open our Eclipse. Click File -> Import. Select Existing Projects into workspace under General item as an import source. Click next. Select our eclipse workspace (example:/home/ndung/workspace) as root directory. Check AppfuseExample in Projects then click Finish. Now, we can easily to add whatever in our project. In the next posts we will add other feature in this our project.

2 comments:

Anonymous said...

Good day !.
You may , probably curious to know how one can manage to receive high yields .
There is no need to invest much at first. You may begin to get income with as small sum of money as 20-100 dollars.

AimTrust is what you need
AimTrust incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

It is based in Panama with structures everywhere: In USA, Canada, Cyprus.
Do you want to become a happy investor?
That`s your chance That`s what you really need!

I feel good, I started to get real money with the help of this company,
and I invite you to do the same. It`s all about how to select a correct partner utilizes your money in a right way - that`s AimTrust!.
I make 2G daily, and what I started with was a funny sum of 500 bucks!
It`s easy to join , just click this link http://yvikytuj.s-enterprize.com/ipykexi.html
and go! Let`s take this option together to feel the smell of real money

Anonymous said...

Hi!
You may probably be very interested to know how one can make real money on investments.
There is no initial capital needed.
You may commense earning with a money that usually is spent
on daily food, that's 20-100 dollars.
I have been participating in one project for several years,
and I'll be glad to share my secrets at my blog.

Please visit blog and send me private message to get the info.

P.S. I earn 1000-2000 per daily now.

http://theinvestblog.com [url=http://theinvestblog.com]Online Investment Blog[/url]