[CompStrm Wiki] commands
Status: Beta
Brought to you by:
blaforge
From: Bill la F. <laf...@ya...> - 2006-05-10 04:07:28
|
OK, so we have a data proxy class which holds no data (data is either in the database or cached). But this data proxy class (really a rolon class) holds the API both for accessing/updating data and the low-level business logic, in the case of an application-specific rolon. Next step up are commands. There is a table in package org.agilewiki, commands.txt, which maps command names to the classes which implement them. Command objects are singltons and thread safe--they hold no data. Execution is also atomic for commands which perform database updates directly--they are invoked in a transactional context and only one update command can execute at a time. Commands which only query or which invoke other things to perform updates are multi-threaded, but do not run when an update command is executing. By default, a command is attached to the base rolon class, org.agilewiki.ark.Rolon, but you can add a method to override this--which means the command is only active when a rolon of the appropriate type is the current context. A command has a method which returns a help string. Most important, command classes have a method which further restricts when the command is active. For example, an update command is never allowed when the user does not have permission to modify the rolon which is the current context. Creating a new command takes 2 steps: 1. Write a command class with implements org.agilewiki.framework.CmdInterface. 2. Add the command name and class to the commands.txt file. __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new. http://in.answers.yahoo.com |