Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

This proposal introduces DI in Roller in a pretty limited way. The idea is to get a DI framework into Roller so we can start rooting out our various factories and singletons, making the code easier to test, manage and providing more extension points.

But as As it stands today it's only benefits are that it 1) allows a customizer to easily switch out Roller manager classes and replace them with his or her their own implementations and 2) make it possible for RollerFactory to instantiate other Roller-dependent classes created by folks who are customizing Roller.

...

List and describe new manager methods, Struts actions, JSP pages, macros, etc.

Changes to

...

Roller Weblogger bootstrapping

To select a back-end implementation, you set the property 'guice.backend.module' in the Roller configuration file the the class name of a Guice module that specifies the Roller interfaces. The RollerFactory will instantiate that Guice module and will use it to create and inject the Roller implementation specified by that module.

...

Roller implementation and

...

Roller implementation and all manager implementations use constructor injection. The are all declared as singletons.

Changes to Roller Planet bootstrapping

Roller Planet uses the very same setup as Roller Weblogger. As you'd expect there is a PlanetFactory, which uses a PlanetModule to initialize Guice and create injected instances.

Planet implementation and all manager implementations use constructor injection. The are all declared as singletons.

Changes to Roller Weblogger's Planet integration

The PlanetFactory uses the Guice back-end specified in the planet.properties file. In To use Planet in Roller we need simply provide a special different PlanetModule, one with a Planet implementation that can read reads database parameters from the Roller properties file instead of the Planet one.

...

Status

This proposal is implemented in the roller_guice branch and as of June 21, 2007 is completely in-sync with the code in the Roller trunk. It's ready to merge.

Guice DI is implemented in both Weblogger and Planet and for both the Hibernate and JPA implementations and passing 100% of tests. Both Weblogger and Planet apps start, run and pass sanity testing.

Comments

Please comment on the Roller dev list.