public class MojarraImplementation extends Object implements FacesImplementation
Constructor and Description |
---|
MojarraImplementation() |
Modifier and Type | Method and Description |
---|---|
Object |
getManagedBean(String beanName,
javax.faces.context.FacesContext fc)
Returns the parentComponent for a given ValueExpression.
|
javax.faces.component.UIComponent |
getValueParentComponent(javax.el.ValueExpression ve)
Return the parentComponent for a given ValueExpression.
|
void |
initApplication(FacesApplication application)
Init application
|
void |
registerManagedBean(String beanName,
String beanClass,
String scope)
Registers a managed bean
Implementation for Mojarra:
---------------------------
FacesContext fc = FacesContext.getCurrentInstance();
BeanManager bm = ApplicationAssociate.getInstance(fc.getExternalContext()).getBeanManager();
// check
if (bm.getRegisteredBeans().containsKey(beanName))
throw new ItemExistsException(beanName);
// register now
ManagedBeanInfo mbi = new ManagedBeanInfo(beanName, beanClass, "view", null, null, null, null);
bm.register(mbi);
Implementation for MyFaces:
---------------------------
FacesContext fc = FacesContext.getCurrentInstance();
RuntimeConfig rc = RuntimeConfig.getCurrentInstance(fc.getExternalContext());
// check
if (rc.getManagedBeans().containsKey(beanName))
throw new ItemExistsException(beanName);
// register now
ManagedBean mbi = new ManagedBean();
mbi.setName(beanName);
mbi.setBeanClass(beanClass);
mbi.setScope(scope);
rc.addManagedBean(beanName, mbi);
|
public void initApplication(FacesApplication application)
FacesImplementation
initApplication
in interface FacesImplementation
application
- the FacesApplication instance
Implementation example:
---------------------------
ApplicationFactoryImpl applFactoryImpl = new ApplicationFactoryImpl();
// set implementation
application.setImplementation(this, applFactoryImpl.getApplication());
applFactoryImpl.setApplication(application);public void registerManagedBean(String beanName, String beanClass, String scope)
FacesImplementation
registerManagedBean
in interface FacesImplementation
public Object getManagedBean(String beanName, javax.faces.context.FacesContext fc)
FacesImplementation
getManagedBean
in interface FacesImplementation
public javax.faces.component.UIComponent getValueParentComponent(javax.el.ValueExpression ve)
FacesImplementation
getValueParentComponent
in interface FacesImplementation
Copyright © 2008–2015 Apache Software Foundation. All rights reserved.