Appfuse is an open source project and application. It uses an Open Source Tool built on the Java platform to help us develop web applications quickly and efficiently. I initially developed it to reduce unnecessary time spent building new Web applications for customers. At the core, appfuse is a project skeleton, similar to what ide creates when a new web project is created through the wizard. When we use appfuse to create a project, it will prompt that we will use the open source framework before creating the project. It uses ant to drive testing, code generation, compilation, and deployment. It provides the Directory and package structure, as well as the library required to develop Java-based Web applications.
Unlike most of the new project wizard, the project created by appfuse contains many classes and files from the very beginning. These files are used to implement features, but they will also be used as examples when you develop applications. By using appfuse to start a new project, we can usually reduce the development time by one to two weeks. We don't have to worry about how to configure the open source framework together, because this is all done. Our projects have been configured in advance to interact with the database. It will be deployed on the application server and authenticate users. We don't have to implement security features, because they have already been integrated.
When I first developed appfuse, it only supported struts and hibernate. After several years of efforts, I found a better Web framework than struts, so I also added options for these Web frameworks. Currently, appfuse supports hibernate or ibatis as a persistent framework. For the Web framework, we can use JavaServer faces (JSF), spring MVC, struts, tapestry, or webwork.
Appfuse provides some features required by many applications, including:
- Authentication and authorization
- User Management
- Remember me (this will save your login information, so you do not have to log on again every time)
- Password reminder
- Registration and Registration
- SSL Conversion
- Email
- URL rewriting
- Skin
- Page Modification
- Templated Layout
- File Upload
This "out-of-the-box" function is provided by appfuse and otherCrud generationOne of the differences between frameworks (crud is taken fromCreate, search, and updateAndDeleteThe first letter of several operations), including Ruby on Rails, trails, and grails. The frameworks mentioned above and appfuse allow us to generate homepage/detail pages from database tables or existing model objects.
Figure 1 illustrates the conceptual design of a typical appfuse application:
Listing 1 shows how to createDevworksThe command line Interactive Operation used in the project, and the generated results are also given. This project uses webwork as its own Web Framework (refer to the link provided in the following references section ).
Listing 1. Use appfuse to create a new project
alotta:~/dev/appfuse mraible$ ant newBuildfile: build.xmlclean: [echo] Cleaning build and distribution directoriesinit:new: [echo] [echo] +-------------------------------------------------------------+ [echo] | -- Welcome to the AppFuse New Application Wizard! -- | [echo] | | [echo] | To create a new application, please answer the following | [echo] | questions. | [echo] +-------------------------------------------------------------+ [input] What would you like to name your application [myapp]?devworks [input] What would you like to name your database [mydb]?devworks [input] What package name would you like to use [org.appfuse]?com.ibm [input] What web framework would you like to use [webwork,tapestry,spring,jsf,struts]?webwork [echo] Creating new application named 'devworks'... [copy] Copying 359 files to /Users/mraible/Work/devworks [copy] Copying 181 files to /Users/mraible/Work/devworks/extras [copy] Copying 1 file to /Users/mraible/Work/devworks [copy] Copying 1 file to /Users/mraible/Work/devworksinstall: [echo] Copying WebWork JARs to ../../lib [copy] Copying 6 files to /Users/mraible/Work/devworks/lib [echo] Adding WebWork entries to ../../lib.properties [echo] Adding WebWork classpath entries [echo] Removing Struts-specific JARs [delete] Deleting directory /Users/mraible/Work/devworks/lib/struts-1.2.9 [delete] Deleting directory /Users/mraible/Work/devworks/lib/strutstest-2.1.3 [echo] Deleting struts_form.xdt for XDoclet [delete] Deleting directory /Users/mraible/Work/devworks/metadata/templates [echo] Deleting Struts merge-files in metadata/web [delete] Deleting 7 files from /Users/mraible/Work/devworks/metadata/web [echo] Deleting unused Tag Libraries and Utilities [delete] Deleting 2 files from /Users/mraible/Work/devworks/src/web/org/appfuse/webapp [echo] Modifying appgen for WebWork [copy] Copying 12 files to /Users/mraible/Work/devworks/extras/appgen [echo] Replacing source and test files [delete] Deleting directory /Users/mraible/Work/devworks/src/web/org/appfuse/webapp/form [delete] Deleting directory /Users/mraible/Work/devworks/src/web/org/appfuse/webapp/action [copy] Copying 13 files to /Users/mraible/Work/devworks/src [delete] Deleting directory /Users/mraible/Work/devworks/test/web/org/appfuse/webapp/form [delete] Deleting directory /Users/mraible/Work/devworks/test/web/org/appfuse/webapp/action [copy] Copying 5 files to /Users/mraible/Work/devworks/test [echo] Replacing web files (images, scripts, JSPs, etc.) [delete] Deleting 1 files from /Users/mraible/Work/devworks/web/scripts [copy] Copying 34 files to /Users/mraible/Work/devworks/web [delete] Deleting: /Users/mraible/Work/devworks/web/WEB-INF/validator-rules-custom.xml [echo] Modifying Eclipse .classpath file [echo] Refactoring build.xml [echo] ---------------------------------------------- [echo] NOTE: It's recommended you delete extras/webwork as you shouldn't need it anymore. [echo] ---------------------------------------------- [echo] Repackaging info written to rename.log [echo] [echo] +-------------------------------------------------------------+ [echo] | -- Application created successfully! -- | [echo] | | [echo] | Now you should be able to cd to your application and run: | [echo] | > ant setup test-all | [echo] +-------------------------------------------------------------+BUILD SUCCESSFULTotal time: 15 seconds
|
After creating a new project, we get a directory structure similar to Figure 2. Eclipse and intellij IDEA project files are created as part of this process.
This directory structure is very similar to the directory structure recommended by Sun for Java 2 Platform Enterprise Edition (J2EE) web applications. In appfuse 2.0, this structure is converted into a standard directory structure suitable for the Apache Maven project (for details about these two directories, see the link in references ). Appfuse will also migrate from ant to Maven 2 to obtain the download capability and support for generating ide project files. Currently, the ant-based system requires that the project file be maintained by the submitter. MAVEN 2 can generate idea, eclipse, and netbeans project files by simply using the Pom. xml file of the project. (This file is located in the root directory of your project and is the main component required to build an application using Maven ). It is very similar to the build. xml file used by Ant .)
Now we have a concept about what appfuse is. In the rest of this article, we will introduce seven reasons for using appfuse. Even if you choose not to use appfuse to start your project, you can see that appfuse provides you with a lot of sample code that can be used in Java-based Web applications. Because it is based on the Apache license, you are welcome to reuse this code in your own application.