You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Manjuka Soysa <ma...@visto.com> on 2001/03/26 01:45:29 UTC

Simple application framework

Hi all,
I have been writing some simple applications, and I found some of the tasks repititive. So I thought of a simple framework within jetspeed/turbine which can really accelerate application development.
This framework has the following benefits:
a. Applications are segregated, and described in XML files
b. Authorisation is checked automatically at screen and action levels.
c. Web actions are mapped to object (bean) methods automatically
d. Objects (beans) needed are created and initialised automatically.
Please read and let me know what you think.. 

Simple Application Framework

An Application consists of:
a. Some SCREENS (say JSPs), one of which is the default screen.
b. Some BEANS, which contain the business logic, and whose information is displayed on the screens.
c. Some ACTIONS, which are methods in the beans, and which can be invoked from the screens.

The first time an application is invoked, the beans are instantiated, initialized with the RunData, and added to the session variables, and the default screen is shown.
Screens can contain a JSP tag which maps to an action (which is a method of a bean, unlike jetspeed/turbine). 
When the action is invoked through the browser, the parameters are marshalled and the method is invoked in the relevant bean.
Authorisations can be set for each screen and action.

An application is described by an application descriptor xml file. An example:
<Application>
<Name>MyApp</Name>
<Screens>
  <Screen default=true>
    <Name>MyDefaultScreen</Name>
    <Authorisation></Authorisation>
  </Screen>
  <Screen>
    <Name>AnotherScreen</Name>
    <Authorisation><Role>Admin</Role></Authorisation>
  </Screen>
</Screens>
<Beans>
  <Bean>
    <Name>MyBean</Bean>
    <Class>my.com.MyBean</Class>
  </Bean>
</Beans>
<Actions>
  <Action>
    <Name>MyAction</Name>
    <BeanName>MyBean</BeanName>
    <Method>myMethod</Method>
    <Authorisation><Role>Any</Role></Authorisation>
    <Parameters>
      <Parameter>
        <ParameterName>myParamName</ParameterName>
        <ParameterType>i4</ParameterType>
      </Parameter>
      <Parameter>
        <ParameterName>myParamNameToo</ParameterName>
        <ParameterType>String</ParameterType>
      </Parameter>
    </Action>
</Actions>
</Application>

Note that parameters can be described in an xml-rpc compatible format. The parameter names given here should be used in the screens. When a post or get is received from the screen, the action interceptor has to convert request parameters to the relevant type, retrieve the relevant bean, and invoke the method.
eg: the uri xxx.com/Application/MyApp/Screen/AnotherScreen/Action/MyAction?myParamName=2%myParamNameToo=Hello will invoke the method myMethod of an instance of MyBean.
The beans could even be wrappers for EJBs. I think this could provide a clean link between the presentation and business logic layers of J2EE.
Ideally, applications could be developed and packaged seperately, and deployed (as jars) within jetspeed. Or even be run remotely, and used by jetspeed.

cheers,
Manjuka
___________________________________________________________________________
Visit http://www.visto.com/info, your free web-based communications center.
Visto.com. Life on the Dot.


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org