[Sent to the incorrect address the first time. Resent now including the list. This could be
more of a roller-dev question, but I'll avoid the cross-post.]

Here are some very quick, somewhat sketchy tips.   Free though.

Greg Hamer wrote:

I am wondering if someone on the Roller development team, or someone who may have done customizations such as the following might be able to provide us a bit of guidance? We are exploring adding another database table to extend Roller for a requirement that we have. We need to be able to display the data from the new table in Roller weblog pages. We would like to do all of our customization consistent with Roller 2.0's existing architecture and build processes.

We understand creating Velocimacros on the UI end. And on the persistence end, we understand creating the POJOs with HibernateDoclet tasks.

We are unclear on the mechanics of getting the new data object into the Velocity context for the PageServlet.

Either of the following might be helpful:
1) an outline of how data from an existing Roller table is loaded into the Velocity context, or
My suggestion is to take a good IDE (IDEA or Eclipse) and look at what happens with WeblogEntryData as an example.
Some key points:
(1) org.roller.presentation.velocity.PageModel is basically the bridge between Velocity and the model pojos. You may want to subclass this for what you are doing. The implementation used is determined by the configuration (roller.properties). (2) Model pojos are wrapped to prevent modification from the view (or at least make it hard). The wrappers are generated by XDoclet as part of the gen-wrappers target in the build. You'll probably want to add yours to this task. (3) org.roller.presentation.velocity.ContextLoader is what sets the context up. Use your IDE to find usages and follow call references back to see where these are called. You'll get a pretty good idea of the flow.

2) a quick sketch outlining of the requirements for implementing logic for a new table.
Elements are:

(1) Db table.

(2) A pojo representing the object, relations to other objects.

(3) On top of that, the model-level logic for manipulating the model objects is in "managers." Depending on what you are introducing, either a new manager or an extension of the WeblogManager implementation would be appropriate. Roughly speaking, a manager ( interface, base generic implementation, Hibernate-specific implementation) manages instances, sets, and relationships around one or more classes of model objects. Continuing the example, take a look at WeblogEntryData, and WeblogEntryManager, WeblogEntryManagerImpl, and WeblogEntryHibernateManagerImpl.

(4) JSPs and Struts actions. Roller uses Velocity for the various weblog views, RSS, etc. For the application pages in which one actually manipulates and changes the model objects, Roller uses JSPs (for views) and Struts actions (for creating, updating, deleting). The actions operate on the model using the managers. They populate subsequent JSP views by populating Request attributes. You'll probably need to do this to populate and maintain the content of your new table.

Any assistance would be greatly appreciated.
           Thanks,

           g


Reply via email to