You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "David Jencks (JIRA)" <de...@myfaces.apache.org> on 2007/03/12 16:44:09 UTC

[jira] Created: (MYFACES-1559) Proposal for dependency injection and lifecycle method handling

Proposal for dependency injection and lifecycle method handling
---------------------------------------------------------------

                 Key: MYFACES-1559
                 URL: https://issues.apache.org/jira/browse/MYFACES-1559
             Project: MyFaces Core
          Issue Type: New Feature
          Components: General
    Affects Versions: 1.2.0-SNAPSHOT
            Reporter: David Jencks
             Fix For: 1.2.0-SNAPSHOT


I'm opening this jira as a convenient place to put code samples in support of discussion on the dev list

Based on my experience implementing dependency injection and lifecyle methods in the geronimo app client container and the geronimo-jetty integration, and inspired by the openejb3 code for this purpose, I'd like to propose that MyFaces consider using an interface similar to this for object creation and shutdown:

public interface LifecycleProvider {

    /**
     * Create an object of the class with the supplied name, inject dependencies as appropriate,
     * and call a postContruct method as appropriate.
     *
     * @param className name of the class of the desired object
     * @return a fully constructed, dependency-injected, and initialized object.
     */
    Object newInstance(String className);

    /**
     * Take whatever steps are needed to shut down the object, including calling a preDestroy method.
     *
     * @param o object to shut down.
     */
    void destroyInstance(Object o);
}

It's easy to write an adapter between this and the AnnotationProcessor interface currently implemented.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-1559) Proposal for dependency injection and lifecycle method handling

Posted by "David Jencks (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-1559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481195 ] 

David Jencks commented on MYFACES-1559:
---------------------------------------

Thanks for implementing this, I've hooked it up to geronimo and it seems to be working great!

> Proposal for dependency injection and lifecycle method handling
> ---------------------------------------------------------------
>
>                 Key: MYFACES-1559
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1559
>             Project: MyFaces Core
>          Issue Type: New Feature
>          Components: General
>    Affects Versions: 1.2.0-SNAPSHOT
>            Reporter: David Jencks
>         Assigned To: Bernd Bohmann
>             Fix For: 1.2.0-SNAPSHOT
>
>         Attachments: MYFACES-1559-1.patch, MYFACES-1559-2.patch, MYFACES-1559-3.patch
>
>
> I'm opening this jira as a convenient place to put code samples in support of discussion on the dev list
> Based on my experience implementing dependency injection and lifecyle methods in the geronimo app client container and the geronimo-jetty integration, and inspired by the openejb3 code for this purpose, I'd like to propose that MyFaces consider using an interface similar to this for object creation and shutdown:
> public interface LifecycleProvider {
>     /**
>      * Create an object of the class with the supplied name, inject dependencies as appropriate,
>      * and call a postContruct method as appropriate.
>      *
>      * @param className name of the class of the desired object
>      * @return a fully constructed, dependency-injected, and initialized object.
>      */
>     Object newInstance(String className);
>     /**
>      * Take whatever steps are needed to shut down the object, including calling a preDestroy method.
>      *
>      * @param o object to shut down.
>      */
>     void destroyInstance(Object o);
> }
> It's easy to write an adapter between this and the AnnotationProcessor interface currently implemented.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.