private void purgeConfiguration() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Method purgeMethod; Class[] emptyParameterList = new Class[]{}; ApplicationFactory applicationFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); purgeMethod = applicationFactory.getClass().getMethod("purgeApplication", emptyParameterList); purgeMethod.invoke(applicationFactory, emptyParameterList); RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY); purgeMethod = renderKitFactory.getClass().getMethod("purgeRenderKit", emptyParameterList); purgeMethod.invoke(renderKitFactory, emptyParameterList); RuntimeConfig.getCurrentInstance(_externalContext).purge(); LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); purgeMethod = lifecycleFactory.getClass().getMethod("purgeLifecycle", emptyParameterList); purgeMethod.invoke(lifecycleFactory, emptyParameterList); // factories and serial factory need not be purged... }
private void purgeConfiguration() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { final Class<?>[] NO_PARAMETER_TYPES = new Class[]{}; final Object[] NO_PARAMETERS = new Object[]{}; Method appFactoryPurgeMethod; Method renderKitPurgeMethod; Method lifecyclePurgeMethod; // Check that we have access to all of the necessary purge methods before purging anything // ApplicationFactory applicationFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); appFactoryPurgeMethod = applicationFactory.getClass().getMethod("purgeApplication", NO_PARAMETER_TYPES); RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY); renderKitPurgeMethod = renderKitFactory.getClass().getMethod("purgeRenderKit", NO_PARAMETER_TYPES); LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); lifecyclePurgeMethod = lifecycleFactory.getClass().getMethod("purgeLifecycle", NO_PARAMETER_TYPES); // If there was no exception so far, now we can purge // appFactoryPurgeMethod.invoke(applicationFactory, NO_PARAMETERS); renderKitPurgeMethod.invoke(renderKitFactory, NO_PARAMETERS); RuntimeConfig.getCurrentInstance(_externalContext).purge(); lifecyclePurgeMethod.invoke(lifecycleFactory, NO_PARAMETERS); // factories and serial factory need not be purged... }
private void purgeConfiguration() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { final Class<?>[] NO_PARAMETER_TYPES = new Class[]{}; final Object[] NO_PARAMETERS = new Object[]{}; Method appFactoryPurgeMethod; Method renderKitPurgeMethod; Method lifecyclePurgeMethod; // Check that we have access to all of the necessary purge methods before purging anything // ApplicationFactory applicationFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); appFactoryPurgeMethod = applicationFactory.getClass().getMethod("purgeApplication", NO_PARAMETER_TYPES); RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY); renderKitPurgeMethod = renderKitFactory.getClass().getMethod("purgeRenderKit", NO_PARAMETER_TYPES); LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); lifecyclePurgeMethod = lifecycleFactory.getClass().getMethod("purgeLifecycle", NO_PARAMETER_TYPES); // If there was no exception so far, now we can purge // appFactoryPurgeMethod.invoke(applicationFactory, NO_PARAMETERS); renderKitPurgeMethod.invoke(renderKitFactory, NO_PARAMETERS); RuntimeConfig.getCurrentInstance(_externalContext).purge(); lifecyclePurgeMethod.invoke(lifecycleFactory, NO_PARAMETERS); // factories and serial factory need not be purged... }
RuntimeConfig.getCurrentInstance(_externalContext).purge(); lifecyclePurgeMethod.invoke(lifecycleFactory, NO_PARAMETERS); facesContextPurgeMethod.invoke(facesContext, NO_PARAMETERS);