You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jakob Praher <jp...@hapra.at> on 2002/12/18 23:54:04 UTC

XMLForm: FormModel lifecycle interception

hi all, (again)

[ hope that someone reads my previous post ... ]

I would like to intercept the lifecycle of the Form Model object.

if I understand the architecture right, then the Action (which extends
AbstractXMLFormAction), when started creates a new Form instance and
stores it in the request attribute or in the Session, depending on the
configuration.

--- form creation --------------------------------------

* AbstractXMLFormAction.getForm( )

and the model is created using 

* AbstractXMLFormAction.getFormModel( )

which looks up the class form the parameters and does a Class.forName( )

-- form deletion ----------------------------------------

Form.remove( objectModel, id );


now what I would like to do is the following:

a) in the START state: intercept FormModel initialization 

b) in the END state: intercept FormModel disposal

mechanisms would be:

--- extend the listeners and add: -----------------------
 

interface FormModelLifecycleListener
{
	void beforeInitialize( );
	void afterInitialize( Object amodel );
	void beforeDispose( int formstate, Object amodel );
	void afterDispose( );
}

which can be registered.
registeration should also be able to 

--- let the model implement avalon activity interfaces ---

class MyModel implements Disposable, Initializable
{
	....
	void initialize( ) { /* do soemthing here .. */ }
	void dispose( )    { /* do something here .. */ }
} 

With these interceptors I could load the model with data from an
appserver prior to using it in the form .... 

also important would be something like:

/* AWT ActionListener ... */
interface ActionListener {
	void actionPerformed( ActionEvent e ) {

	}
} 

With such an interface the business logic could intercept the outcome of
the form handling and could take appropriate steps (like use the
formModel to change data ). 

I need something like the above in order to application server handling.

I am just getting started with XMLForm - so please bear with me.
Also it is already pretty late, but nevertheless I post my initial ideas
on that.

I look forward to hearing any resposne ...

thanks

-- Jakob


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: XMLForm: FormModel lifecycle interception

Posted by Jakob Praher <jp...@yahoo.de>.
Am Don, 2002-12-19 um 10.39 schrieb Konstantin Piroumian:
> From: "Jakob Praher" <jp...@hapra.at>
> 
> > hi all, (again)
> >
> > [ hope that someone reads my previous post ... ]
> 
> Don't worry about it even if you don't get any response, this doesn't mean
> that nobody reads your messages.
> I read at least ;)
> 
thank you ;-)

> What you are proposing sounds useful and it'd be great if you could provide
> a patch for it (as described in
> http://xml.apache.org/cocoon/howto/howto-bugzilla.html).
> 

ok I'll see what I can do. I will test various implementations, as it
should be a good designed patch.

I'll inform you about my work on this ....

> Regards,
>   Konstantin
> 
> >
> > I would like to intercept the lifecycle of the Form Model object.
> >
> > if I understand the architecture right, then the Action (which extends
> > AbstractXMLFormAction), when started creates a new Form instance and
> > stores it in the request attribute or in the Session, depending on the
> > configuration.
> >
> > --- form creation --------------------------------------
> >
> > * AbstractXMLFormAction.getForm( )
> >
> > and the model is created using
> >
> > * AbstractXMLFormAction.getFormModel( )
> >
> > which looks up the class form the parameters and does a Class.forName( )
> >
> > -- form deletion ----------------------------------------
> >
> > Form.remove( objectModel, id );
> >
> >
> > now what I would like to do is the following:
> >
> > a) in the START state: intercept FormModel initialization
> >
> > b) in the END state: intercept FormModel disposal
> >
> > mechanisms would be:
> >
> > --- extend the listeners and add: -----------------------
> >
> >
> > interface FormModelLifecycleListener
> > {
> > void beforeInitialize( );
> > void afterInitialize( Object amodel );
> > void beforeDispose( int formstate, Object amodel );
> > void afterDispose( );
> > }
> >
> > which can be registered.
> > registeration should also be able to
> >
> > --- let the model implement avalon activity interfaces ---
> >
> > class MyModel implements Disposable, Initializable
> > {
> > ....
> > void initialize( ) { /* do soemthing here .. */ }
> > void dispose( )    { /* do something here .. */ }
> > }
> >
> > With these interceptors I could load the model with data from an
> > appserver prior to using it in the form ....
> >
> > also important would be something like:
> >
> > /* AWT ActionListener ... */
> > interface ActionListener {
> > void actionPerformed( ActionEvent e ) {
> >
> > }
> > }
> >
> > With such an interface the business logic could intercept the outcome of
> > the form handling and could take appropriate steps (like use the
> > formModel to change data ).
> >
> > I need something like the above in order to application server handling.
> >
> > I am just getting started with XMLForm - so please bear with me.
> > Also it is already pretty late, but nevertheless I post my initial ideas
> > on that.
> >
> > I look forward to hearing any resposne ...
> >
> > thanks
> >
> > -- Jakob
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: XMLForm: FormModel lifecycle interception

Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Jakob Praher" <jp...@hapra.at>

> hi all, (again)
>
> [ hope that someone reads my previous post ... ]

Don't worry about it even if you don't get any response, this doesn't mean
that nobody reads your messages.
I read at least ;)

What you are proposing sounds useful and it'd be great if you could provide
a patch for it (as described in
http://xml.apache.org/cocoon/howto/howto-bugzilla.html).

Regards,
  Konstantin

>
> I would like to intercept the lifecycle of the Form Model object.
>
> if I understand the architecture right, then the Action (which extends
> AbstractXMLFormAction), when started creates a new Form instance and
> stores it in the request attribute or in the Session, depending on the
> configuration.
>
> --- form creation --------------------------------------
>
> * AbstractXMLFormAction.getForm( )
>
> and the model is created using
>
> * AbstractXMLFormAction.getFormModel( )
>
> which looks up the class form the parameters and does a Class.forName( )
>
> -- form deletion ----------------------------------------
>
> Form.remove( objectModel, id );
>
>
> now what I would like to do is the following:
>
> a) in the START state: intercept FormModel initialization
>
> b) in the END state: intercept FormModel disposal
>
> mechanisms would be:
>
> --- extend the listeners and add: -----------------------
>
>
> interface FormModelLifecycleListener
> {
> void beforeInitialize( );
> void afterInitialize( Object amodel );
> void beforeDispose( int formstate, Object amodel );
> void afterDispose( );
> }
>
> which can be registered.
> registeration should also be able to
>
> --- let the model implement avalon activity interfaces ---
>
> class MyModel implements Disposable, Initializable
> {
> ....
> void initialize( ) { /* do soemthing here .. */ }
> void dispose( )    { /* do something here .. */ }
> }
>
> With these interceptors I could load the model with data from an
> appserver prior to using it in the form ....
>
> also important would be something like:
>
> /* AWT ActionListener ... */
> interface ActionListener {
> void actionPerformed( ActionEvent e ) {
>
> }
> }
>
> With such an interface the business logic could intercept the outcome of
> the form handling and could take appropriate steps (like use the
> formModel to change data ).
>
> I need something like the above in order to application server handling.
>
> I am just getting started with XMLForm - so please bear with me.
> Also it is already pretty late, but nevertheless I post my initial ideas
> on that.
>
> I look forward to hearing any resposne ...
>
> thanks
>
> -- Jakob
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org