Hi 2010/8/4 <[email protected]>
> Hi guys, > > Would you like to see MyFaces Core ship with JBoss AS6? If so, read on. > > This is top priority for me. > If you've been around MyFaces awhile, you probably remember that JBoass AS > used to ship with MyFaces instead of Mojarra. It was regrettable, but at > the time Mojarra was far ahead spec-wise and the powers that be decided my > time would be better spent integrating Mojarra instead of improving MyFaces. > > However, with JBoss AS6 M4, this is no longer an "either or" proposition. > Both MyFaces and Mojarra can live side-by-side. The application can decide > which implementation to use: http://community.jboss.org/wiki/JSFonJBossAS6 > > What's more, changing the default JSF implementation for AS6 is just a > matter of changing the defaultJSFConfig property in an XML file. > > I've talked internally at JBoss about adding MyFaces to the JBoss AS > community distribution. Some were for it, and some were very, very for it. > Nobody so far is against it. > > The good part is that I don't think it's a lot of work. It's probably just > three or four classes that implement SPI's that I'm guessing MyFaces already > has. > > So this is where the MyFaces Dev group comes in. MyFaces Core 2.0 will run > OK on JBoss AS6 right now. However, there is some integration work that is > needed for full JEE5 and JEE6 compliance. We need: > * An injection provider SPI similar to Mojarra's > com.sun.faces.spi.InjectionProvider. > * The JBoss/MyFaces implementation of the SPI. I expect this will be very > similar to > org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider. > In myfaces we have a factory called org.apache.myfaces.config.annotation.LifecycleProviderFactory. We have also an interface called LifecycleProvider2 with these methods: /** * 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) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException, InvocationTargetException; /** * 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) throws IllegalAccessException, InvocationTargetException; /** * Call a postConstruct method as appropriate. * * @param o object to initialize */ void postConstruct(Object o) throws IllegalAccessException, InvocationTargetException; Checking com.sun.faces.spi package, it is similar to InjectionProvider. Note com.sun.faces.spi has a method called: public void inject(Object managedBean) throws InjectionProviderException but myfaces has: public Object newInstance(String className) > * An AnnotationProvider SPI similar to Mojarra's > com.sun.faces.spi.AnnotationProvider. > * A JBoss/MyFaces implementation of the SPI similar to > org.jboss.web.jsf.integration.config.JBossAnnotationProvider. > We don't have anything similar to AnnotationProvider. I'll create an issue for this one. > * A ServletContextListener class to call for initialization. I expect this > will extend from MyFacesServletContextListener and be very similar to > org.jboss.web.jsf.integration.config.JBossMojarra20ConfigureListener. > > The class you are looking for is org.apache.myfaces.webapp.StartupServletContextListener regards, Leonardo Uribe > If MyFaces Dev decides to take this on, then the code will probably live at > Apache and I'll bring it into JBoss AS using Maven. I don't have time to > write and maintain the code myself but I'm happy to help out with guidance > and to do some refactoring of my code to make this easier. BTW, the > JBoss/Mojarra integration code lives here: > http://anonsvn.jboss.org/repos/jbossas/projects/jboss-jsf-int/trunk/jboss-faces/ > > Lastly, let me say that I can't make hard promises right now. I don't know > if someone at JBoss/RedHat will come along and nix the idea. However, even > if we can't ship MyFaces you will have all the integration points ready and > have an easy way to "drop in" MyFaces whenever you want to use it with JBoss > AS. > > WDYT?? > > > >
