AppFuse

What is AppFuse?

AppFuse is an application for "kickstarting" webapp development. Download, extract and execute ant new to instantly be up and running with a Tomcat/MySQL app. Uses Ant, XDoclet, Spring, Hibernate (or iBATIS), JUnit, StrutsTestCase, Canoo's WebTest, Struts Menu, Display Tag Library, OSCache, JSTL and Struts (or Spring MVC). The Spring Framework has greatly enhanced AppFuse since February 2004. It's used throughout for its Hibernate/iBATIS support, declarative transactions, dependency binding and layer decoupling. This clean and simple framework has greatly reduced the complexity of AppFuse, and also eliminated
many lines of code. In short, for J2EE - it's the best thing since sliced bread. To learn more about what AppFuse is check out this wiki page.

April 29, 2005 - AppFuse 1.8

This release replaces Container Managed Authentication (CMA) with Acegi Security. Other major features include numerous bug fixes to AppGen and a refactoring of build.xml to use Ant 1.6 features. Eclipse and IDEA project files were also improved so you can easily run tests from within your IDE. A MyJavaPack all-in-one installer was also added so you can download everything you need for AppFuse at once. Eclipse and its plugins were not included in the initial release, but may be in a future release.

November 9, 2004 - AppFuse 1.6.1

This release is primarily a bug fix release, but it also contains a slick "AppGen" tool for generating full CRUD (with sample data and tests) from a POJO. AppGen essentially automates everything you do in the tutorials. I still encourage users to read through and do the tutorials in order to learn the code that is being generated. Learn more about AppGen.

October 9, 2004 - AppFuse 1.6 Released

This release's main features are swapping out Tiles for SiteMesh and adding WebWork as a web framework option. I also refactored the Struts Action tests to use MockStrutsTestCase and eliminated the need to use Cactus for running web tests. This reduced test execution time by over 50%. The relationship between users and roles was re-worked to take advantage of Hibernate's features as well.

Other notables include full i18n support (with translations in Dutch, Portuguese and Chinese), improved setup-tomcat target (no additional JARs needed now), and an option to use Spring's MVC framework instead of Struts - with full tutorials! If you'd like, you can read more about my conversion from Struts to Spring. Enjoy!

I also made the leap and moved the AppFuse project from SourceForge to java.net. This is mainly so I have more control over mailing lists and adding other developers. As of today, CVS files in SourceForge and Java.net are the same - but I'll only be updating Java.net from here on out. I also have released files in both projects, but will only use java.net in the future.

Added Spring to configure Hibernate, DAOs and Managers. Configured declarative transactions at the service and dao layers. Configured OpenSessionInViewFilter for guaranteeing one transaction per request. Read more...

Changed UserCounterListener to only record users that have logged in successfully. Also added a screen to show currently logged in users.

Added support for generating indexed property setters in ActionForms when generating Forms with XDoclet. This support includes adding Velocity JARs to the the list of 3rd party JARs. Currently, Velocity is only used by XDoclet.

Added "Account Information" e-mail as part of registration process. This e-mail gets sent the e-mail address the user entered on signup.

Dependent packages upgraded:

Cactus 1.6 Nightly (20030119) to support the "cactus" task and Resin 3.0.5

2004.01.16 - AppFuse 1.3 Released

This release fixes a few compatibility issues with Resin and other databases - specifically PostgreSQL and DB2. The major new functionality in this release is Easy Database Switching. Basically, you can very easily switch from using MySQL to PostgreSQL by only changing a few properties in your build.properties. I implemented this on my current project last week because I do most of my development (at the client) on a PowerBook. The client wants to deploy onto a DB2 database - and there is not DB2 install for the Mac. Since Hibernate allows you to easily switch between databases, I figured I could develop using MySQL on the Mac, but have the default (CVS version) use DB2. One of the things I didn't want to do was to have a build.properties.sample, because I love projects that "just work" when you type "ant". So I changed the the build process so that database.properties is generated from default settings (MySQL) or the settings in build.properties (if specified). As part of the build process, Ant looks for the following build.properties files:

${user.home}/.${ant.project.name}-build.properties

${user.home}/.build.properties

build.properties

What this allows you to do is to take your customized database settings and put them in ~/.build.properties and they'll be applied to any AppFuse-derived project. This makes it easy to keep the CVS version of your project tied to one database and a developer's local version tied to a different database.

While it's true that you'll most likely only talk to one database during the duration of your project, this exercise proves that it's easy to migrate from MySQL to another database. It also proves that AppFuse can easily integrate with other database (at least as of this release). Slick stuff IMO. Here's a specific rundown of all the changes from the changelog.

Many changes to database settings so that database.properties is generated at run-time from properties in build.properties (defaults to MySQL). This makes it easy for users to run a MySQL database in development and have a DB2 database (or any other) in production. Just customize your database settings and put them in ~/.build.properties or ~/.appname- build.properties and these settings will be used instead of the default.

As part of this process, I tested AppFuse on DB2 8.1 (on Windows) and PostgreSQL 7.4 (on OS X).

Testing on other servers caused me to change from generator-class="native" to generator-class="increment" - which still works fine on MySQL.

I also changed tomcat-context.xml to dynamically substitute database properties and defaultAutoCommit is now "true" by default.

Added error pages for 404 (page not found) and 403 (access denied), both with pretty pictures. ;0) Protected /editUser.do for admin role only.

Moved filter-mappings from Filter's JavaDocs (XDoclet) to metadata/web/filter-mappings.xml in order to control the order of execution.

Made RememberMe feature configurable via a "rememberMe.enabled" property in app-settings.xml. This won't kick on Resin until the filter is invoked at least once. Tomcat initializes filters on startup.

Upgraded oscache.jar in Hibernate 2.1.1 to OSCache 2.0.1 and configured OSCache to cache JSP changes. Also modified the oscache-2.0.1.jar to have a URI for the tag library. Turned off caching of JSP pages - to enable, uncomment filter-mapping in metadata/web/filter-mappings.xml.

2003.12.20 - AppFuse 1.2 Released

This is primarily a bug fix release. Here are the details from the release notes:

Backed out Http Post for Remember Me. It was not redirecting user to the page they originally requested. Using reponse.sendRedirect does send the user to the proper location. Turned on password encryption (SHA) to protect any passwords that end up in log files. Turned off encryption in Tomcat.

Changed configuration parameters in servlet context to be in a hashmap.

Improvements to StrutsGen tool to generate list screen as well and to fill in more missing elements.

Changed to close Hibernate session when object not found in BaseDaoHibernate.

Fixed bug in UserAction.save: when creating a new user, role defaults to "tomcat" regardless of what the user chooses.

2003.12.12 - AppFuse 1.1 Released

This biggest feature in this release is Documentation. I finally found the time to write up some Tutorials on developing with AppFuse. They're on this wiki and also in the "docs" folder of the binary and source downloads. In writing this documentation, I went through almost all aspects of the code with a fine-tooth comb made sure it's doing what I want it to do.

I was finally able to get things working with J2EE 1.4, which basically involved removing j2ee.jar from my MailUtil's classpath and just including activation.jar and mail.jar. If you're not there yet, simply change the paths for activation.jar and mail.jar in properties.xml (look for common.compile.classpath). You can use j2ee.jar instead of mail.jar and activation.jar with J2EE 1.3 and 1.4 B2.

I was also able to get all unit tests to pass on Tomcat 5, and the "setup-tomcat" target now supports Tomcat 5. I wasn't able to get "Remember Me" to work - see the tomcat-user mailing list for more details.

2003.11.30 - AppFuse 1.0 Released

I feel this release deserves the big 1.0 designation because it is an up-to-date representation of my learnings and my perceived
best practices in building web applications. Of course, as I learn more, I will continue to push out new releases.

In this release, I did a lot of refactoring and enhancements to existing features. The DAO and Manager interfaces are no longer tied
to Struts or Hibernate. Hibernate's Session object is now passed as an argument into Manager and DAO constructors, rather than
method signatures. The DAOFactory was refactored by Bear Giles to use reflection to
instantiate Hibernate DAO's. Now, if you add a new DAO, you don't have to edit DAOFactory and DAOFactoryHibernate. To insantiate a
new DAO, the code is now:

...where conn is a connection object retrieved from ServiceLocator or ActionFilter. When you add new POJOs, you still have to add them to ServiceLocator (for JUnit tests) and hibernate.cfg.xml, which is kindof a pain. I'd like to figure out a way to tell Hibernate to just look in appfuse-ejb.jar.

The Remember Me feature has been refactored so the username and password cookies are only available under
the /appfuse/security url-pattern. I also changed the posting to "j_security_check" in LoginServlet from response.sendRedirect to
an HTTP POST, using Jakarta Common's HttpClient. The reason I have a LoginServlet vs. just using action="j_security_check" in my <form> is to encrypt passwords.

I've developed 3 different applications using AppFuse (struts-resume is one of them), and I have found that it's a pain to
upgrade to new versions of AppFuse. Because of this, I don't recommend upgrading unless you really need to. I will be upgrading
struts-resume to AppFuse 1.0, but I doubt I'll upgrade it to any future AppFuse releases - it's just too much work for not much reward.