What is the appfuse

sponsored links
First, Appfuse brief introduction

Matt Raible are Appfuse developed a guiding entry-level J2EE framework, how to integrate its popular Spring, Hibernate, ibatis, struts, Xdcolet, junit, etc. give the basic framework of the model, the latest version 1.7 is provided on Taperstry and JSF support. In the persistence layer, AppFuse uses Hibernate O / R mapping tools (http://www.hibernate.org); in containers, it uses Spring Framework (http://www.springframework.org). Users can freely select Struts, Spring / MVC, Webwork, Taperstry, JSF several web framework. The use of TDD development mode, the use of JUnit tests on each floor, and even test jsp output w / o error. In order to simplify the development of a set of predefined good directory structure, base class, used to create databases, configure the Tomcat, the deployment of applications to test Ant tasks to help Express automatically generated source code and automatic maintenance of some configuration files.

References:
At https: / / appfuse.dev.java.net / can download Appfuse, the current version is 1.7.
Appfuse reference materials and documentation can http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse view.

Second, Appfuse Framework Quick Start

AppFuse project's main objective is to help developers reduce the time a project at the beginning of the work to be done. The following is a use it to create a new project of the basic steps:

1, download or from CVS (cvs-d: pserver: guest@cvs.dev.java.net: / cvs co appfuse) detected in the latest version of appfuse source.

2, install J2SE 1.4 +, set the JAVA_HOME environment variable correctly, install Ant 1.6.2 +, set the ANT_HOME environment variable.

3, the installation of MySQL 3.23.x + (recommended version 4.1.7) and Tomcat 4.1.x + (recommended version 5.0.28), set the CATALINA_HOME environment variable to point to your Tomcat installation directory.

Note: If you are ready to use MySQL 4.1.7, then you must be the default character set is set to UTF-8 character set and its default table type to InnoDB type. In other words, you want in your c: \ Windows \ my.ini or / etc / my.cnf file add the following lines:
[mysqld]
default-character-set = utf8
[mysqld]
default-table-type = innodb

4, install a local SMTP server, or if you already have an available SMTP server, you can modify the mail.properties (in web / WEB-INF / classes directory) and build.properties (in the root directory -- - information for log4j) to point to your SMTP server - by default it is the point to your local SMTP server.

5, lib/junit3.8.1/junit.jar documents will be copied to the $ ANT_HOME / lib directory.

6, the implementation of ant new-Dapp.name = YOURAPPNAME-Ddb.name = YOURDBNAME command. This will create a file called "YOURAPPNAME" directory.

Warning: the order for some values will not implement the app.name - Do not use "test", containing "appfuse" in the name of one of you, or any figure, two book No. (-) and so on mixed up the names of .

7, to the new directory, the implementation of ant's mission to create a database setup, at the same time your application will be posted to the Tomcat server. Only when the root of your password database user does not have the mission will work. You can also open in the time required to change the build.properties file root user's password. If you want to test and would like to know whether all were able to work well, then you can run ant the test-all mission to conduct a comprehensive test - of course the premise that when you first make the time to test Tomcat server to stop.

8, implementation of test-reports of ant mission - when the mission after the implementation, there will be a message to tell you how to view those generated test reports.

When you sure you step through the above-configured your development environment after the AppFuse - below you need to do is study guide to learn about how to use AppFuse for your development.

Optional installation

If you are willing to choose to use iBATIS as the persistence layer framework for you, please take a look specifically extras / ibatis directory README.txt file.
If you are willing to choose to use Spring as your WEB layer framework, please take a look specifically extras / spring directory README.txt file.
If you are willing to choose to use WebWork as your WEB layer framework, please take a look specifically extras / webwork directory README.txt file.
Choose if you are willing to Tapestry as your web tier framework, please take a look specifically extras / tapestry directory README.txt file.
If you are willing to select JSF as your web tier framework, please take a look specifically extras / jsf directory README.txt file.

If you want you can through the script to automatically complete the creation and testing, you can refer to the following script:
rm-r .. / appfuse-spring
ant new-Dapp.name = appfuse-spring-Ddb.name = ibatis
cd .. / appfuse-spring
ant install-ibatis install-springmvc
cd extras / ibatis
ant uninstall-hibernate
cd ../..
ant setup
ant test-all test-reports

If you do not want to install iBATIS, Spring MVC or WebWork, you will be in your items before the warehouse code control, you should remove them in extras directory of the installation content.

-------------------------------------------------- ------------------------------

Typically, when you have completed all of the above steps and they can work, the most likely thing you would want to put "org.appfuse" package names changed to a similar "com.company" this kind of package names. Does this matter now has been very easy, all you need to do is to download a package of tools, take a look at its README file, in order to understand its installation and use.

Note: before you use this tool it is best to do your project will be a backup to ensure it is able to resume.

If you will read org.appfuse.webapp.form packages such as test.web.form such a package name, you have to go simultaneously tinkering src / service package ConverterUtil category, getOpposingObject Ways are your friends, let us look at click:

name = StringUtils.replace (name, "model", "webapp.form");
name = StringUtils.replace (name, "webapp.form", "model");

Three, AppFuse Development Guide

If you have already downloaded and AppFuse want in your machine to install it, you'd better get started quickly in accordance with the steps to install. Once you have installed all of the content, the following guidelines are studying how to use AppFuse you develop the best tutorials.

NOTE: AppFuse guide the development of the release contains a version of same, if you want to update your copy that works (which in the docs directory), can be through the implementation of "ant wiki" to complete.

For AppFuse 1.6.1, you can tell in this Guide Ways to generate most of your code. If you're using Struts + Hibernate such a combination, you can even generate them completely. And if you select the web tier framework of the Spring or WebWork is not so fortunate for them to write an automated installation scripts exist many difficulties, so you have to configure it yourself Controllers and Actions of those. This is mainly because I do not have the framework of these web layer using XDoclet, but also because of the use of Ant tools as the limitations caused by the installation tool. A tool for automatic generation of code called me AppGen, I explain in Part I of how to use it.

Part I: in AppFuse to create new DAOs and Objects - This is a about how to create a table based on data for the Java object and thus how to create Java persistent object category to the database in the tutorial.

1, with regard to this guide:

This guide will show you how to create a new database table, and how to access the table to create Java code.

We will create an object and some other categories to this object will be persistent (save, load, delete) to a database. Using Java language, we call this object is a POJO object (Plain Old Java Object), this object is basically a database tables are corresponding to the other categories will be:

A data access object (also known as a DAO), an interface, implementation of a Hibernate type.
A JUnit class to test whether the U.S. DAO job correctly.
Note: If you are using MySQL and if you want to use the Service (Generally you will certainly choose to use), then you must be table-type set to InnoDB. You can do so, add the following contents of your mysql configuration file (/ etc / my.cnf or c: \ Windows \ my.ini) Medium. The second set (used to set UTF-8 character set) mysql 4.1.7 + are required.

[mysqld]
default-table-type = innodb
default-character-set = utf8

If you use PostgreSQL Batch confusion encountered an error, you can try in your src / dao / ** / hibernate / applicationContext-hibernate.xml add 0 configuration file to turn off the batch.

AppFuse using Hibernate as its default persistence layer. Hibernate is an object-relational mapping framework, which allows you to your Java objects and database tables to establish a mapping. So you can easily implement your object CRUD (Create, Retrieve, Update, Delete) operations.

You can use the same iBATIS persistence layer as another possible choice. If you want to AppFuse install iBATIS, look extras / ibatis directory README.txt file. If you want to use iBATIS to replace Hibernate, I hope you are have enough reason and you should be familiar with it. I also hope that you can on how to use iBATIS in AppFuse-based guide to make good recommendations. ;-)

I will use the following language to tell you the actual development process is how I do.
Let us start at AppFuse project structure to create a new object, a DAO and a test case to start.

Table of Contents

[1] to create a new Object and add XDoclet tags
[2] the use of Ant, based on our new object to create a new database table
[3] to create a new order for DAOTest to JUnit test DAO
[4] to create a new DAO object for the implementation of our CRUD operations
[5] for the Person object and configure the Spring configuration file PersonDAO
[6] to run test DAOTest

[1] to create a new Object and add XDoclet tags

We need to do first thing is to create an object go of it lasting. Let us create a simple "Person" objects (to create the src / dao / ** / model directory), we let it have an id, a firstName and a lastName (as the object of property).

package org.appfuse.model;

public class Person extends BaseObject (
private Long id;
private String firstName;
private String lastName;

/ *
Generate your getters and setters using your favorite IDE:
In Eclipse:
Right-click -> Source -> Generate Getters and Setters
* /
)

This class should be inherited from BaseObject, because BaseObject has three abstract methods: (equals (), hashCode () and toString ()), so you have to type in the Person of their implementation. The first two methods are required by Hibernate, the simplest way is to use tools (such as: Commonclipse) to complete it, if you want to know about using this tool more information you can go to find the website of Lee Grey. Another tool you can use are Commons4E, it is an Eclipse Plugin, I have not used, so I can not tell you what features it has.

If you are using IntelliJ IDEA, you can generate equals () and hashCode (), but can not generate toString (), of course, have a ToStringPlugin, but I have never personally used.

Now we have a good create a POJO, we need to add XDoclet tags inside it in order to generate Hibernate mapping file. This mapping file is to allow Hibernate to map objects to tables, maps to the property listed in the table.

First, we add a @ hibernate.class tags, the tags tell Hibernate mapping which this object will be a table:

/ **
* @ Hibernate.class table = "person"
* /
public class Person extends BaseObject (

We must also add a primary key mapping, otherwise, when the generated mapping file when an error will occur XDoclet. Attention to all of these @ hibernate .* tags should be placed in your POJO object getter methods Javadocs location.

/ **
* @ Return Returns the id.
* @ Hibernate.id column = "id"
* Generator-class = "increment" unsaved-value = "null"
* /

public Long getId () (
return this.id;
)

I use a generator-class = "increment" in lieu of generate-class = "native", because I found that when the database in some other use "native" when there are some problems. If you only intend to use MySQL, I recommend you use "native", and our guide to the use of the "increment".

[2] the use of Ant, based on our new object to create a new database table

You can by running "ant setup-db" to create the person table. On the one hand, this task will be to create Person.hbm.xml create documents, on the other hand, can be in the database to create a "person" table. From the ant console, you can see Hibernate to create the table for your model:

[schemaexport] create table person (
[schemaexport] id bigint not null,
[schemaexport] primary key (id)
[schemaexport]);

If you want to see what Hibernate generated Person.hbm.xml for your document, you can go build / dao / gen / ** / model directory of view, I have listed the contents of the following:

"- / / Hibernate / Hibernate Mapping DTD 2.0 / / EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

name = "org.appfuse.model.Person"
table = "person"
dynamic-update = "false"
dynamic-insert = "false"
>

name = "id"
column = "id"
type = "java.lang.Long"
unsaved-value = "null"
>

Original connection: http://blog.csdn.net/abeetle/archive/2007/06/14/1651588.aspx
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of What is the appfuse

  • Study Application hibernate (1)

    Basic configurations: Environment: myeclipse Version: 5.5.1 tomcat version: 5.5 1, myEclipse to adjust to the MyEclipse Database Explorer mode; a new database connection, the need for database-driven 2, myEclipse to adjust to the MyEclipse Hibernate ...

  • About rails install mysql driver error problem

    My local wamp server using one of the key package, only used mysql functions, today in the use of rake db: migrate when First reported a month can not be implemented, the next inquiry and found no mysql installed a gem, to install gem install mysql i ...

  • In the Linux platform to install and configure Ruby on Rails Detailed

    ruby on rails recommend the production environment is running Linux / FreeBSD / Unix, or Unix family of operating systems, using lighttpd + FCGI solution. The following will be my Linux operating system, lighttpd + FCGI, MySQL database as an example, comp

  • spring of the jar package Detailed

    Excerpt from: http://blog.csdn.net/exceljava/archive/2007/10/05/1811925.aspx Download the spring package of documents and a variety of packages large projects are often at only some of which we must, if not sure what package when necessary, then take a lo

  • Built environment using appfuse2.0 Express (myeclipse)

    http://blog.csdn.net/ljah/archive/2008/06/06/2516187.aspx Usually we use APPFUSE2.0 project into eclipse, the compiler can not be normal, can only use maven I feel very uncomfortable, after exploring and found that after such a configuration, it will make

  • Answer: After 2.2 upgrade mysql question-driven

    windows installed after the mysql gem error, error is approximately: ArgumentError (NULL pointer given): (eval): 3: in `each_hash ' (eval): 3: in `all_hashes' This is feeling under the windows of the question if the mysql gem version libmysql ...

  • Spring jar package Detailed

    AspectJ directory are in the Spring framework to use AspectJ source code and test program files. AspectJ is the first java application framework provided by the AOP. dist directory is a Spring release package, regarding release package described below in

  • What is the JPA

    Same, JDO, also started compatible JPA. At the field of ORM, it seems that JPA is a benevolent government, is the normative specification. At the support of major manufacturers, JPA use became widespread. 2 Spring Spring + Hibernate often referred to as t

  • Choose Hibernate or iBATIS has its reasons

    Hibernate features: Hibernate powerful database has nothing to do with good, O / R mapping ability, and if you are very proficient in Hibernate, but also for Hibernate to conduct an appropriate package, then your project will be the entire persistence lay

  • Nan-Jing 5: When IBatis.Hibernate mixed affairs, pay attention to your SQL

    [Problem] Now, in the development of the so-called multi-storey JavaEE applications, data persistence layer is always essential, and "Automatic" of ORM - Hibernate, and "all-manual-type" of SqlMap - IBatis, equivalent data are Per ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries