RE: HOOKS

"Guijarro, Julio" <[email protected]>
Newsgroups gmane.comp.java.smartfrog.devel
Message-ID <8D5B24B83C6A2E4B9E7EE5FA82627DC9A43266@sdcexcea01.emea.cpqcorp.net>
Hi Rana,

You can have a look at org.smartfrog.services.trace.SFTrace.java for an
example that uses the lifecycle hooks.

There is one set of hooks per lifecycle method and the hooks are
available in any component implementing PrimImpl.

To add a hook inside a component you have to use:

//Deploy Hook
sfDeployHooks.addHook(sfDeployTracer);

//StartHook
sfStartHooks.addHook(sfStartTracer);
//TeminateWithHook
sfTerminateWithHooks.addHook(sfTerminateWithTracer);


The listener for the hook has to implement the interface PrimHook.
org.smartfrog.sfcore.prim.PrimHook;

An example can be:

    /**
     * Example of hook listener
     */
    private class SfDeployTracer implements PrimHook {
        public void sfHookAction(Prim prim, TerminationRecord tr)
            throws SmartFrogException {
	    //Your code.
            System.out.println(" ... ");
        }
    }

One more thing, the hooks are blocking.

Regards, 
	Julio Guijarro.

> -----Original Message-----
> From: smartfrog-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:smartfrog-
> developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of rana dabbu
> Sent: 13 April 2005 12:36
> To: smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Subject: [Smartfrog-developer] HOOKS
> 
> hello,
> 
> How does the smartfrog hooks mechanism work. What are the hooks API
> available and how to use them.
> 
> regards,
> rana
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real
users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_ide95&alloc_id396&op=ick
> _______________________________________________
> Smartfrog-developer mailing list
> Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/smartfrog-developer


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.