Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-2311

Factories and caches are not stored as attributes in the PortletContext/ServletContext

    Details

      Description

      The com.liferay.faces.util.factory.internal.FactoryExtensionFinderImpl class keeps a cache of factory instances in a HashMap. In order to move towards the goal of supporting Liferay Faces jars in the global classpath, it is necessary to store the cache in a ServletContext attribute.

      This is also a concern in com.liferay.faces.bridge.config.internal.PortletConfigParamUtil and com.liferay.faces.util.config.WebConfigParamUtil, each of which keep a cache that depends on the ClassLoader rather than the ServletContext.

      The main problem is that the com.liferay.faces.util.factory.FactoryExtensionFinder and com.liferay.face.bridge.BridgeFactoryFinder API does not accommodate passing PortletContext, ExternalContext, or ServletContext during factory registration or lookup. In addition, there is no concept of releasing factories during context destruction or when a portlet is taken out of service. Because of this, it will be necessary to modify the API with the following:

      FactoryExtensionFinder.java
      @Deprecated
      public static Object getFactory(Class<?> factoryClass) {
      // Replacement
      public static Object getFactory(ExternalContext externalContext, Class<?> factoryClass) {
      
      @Deprecated
      public abstract Object getFactoryInstance(Class<?> factoryClass);
      // Replacement
      public abstract Object getFactoryInstance(ExternalContext externalContext, Class<?> factoryClass);
      
      @Deprecated
      public abstract void registerFactory(ConfiguredElement configuredFactoryExtension);
      // Replacement
      public abstract void registerFactory(ExternalContext externalContext, ConfiguredElement configuredFactoryExtension);
      
      // New
      public abstract void releaseFactories(ExternalContext externalContext);
      
      BridgeFactoryFinder.java
      @Deprecated
      public static Object getFactory(Class<?> factoryClass) {
      // Replacement
      public static Object getFactory(PortletContext portletContext, Class<?> factoryClass) {
      
      @Deprecated
      public abstract Object getFactoryInstance(Class<?> factoryClass);
      // Replacement
      public abstract Object getFactoryInstance(PortletContext portletContext, Class<?> factoryClass);
      
      // New
      public abstract void releaseFactories(PortletContext portletContext);
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                neil.griffin Neil Griffin
                Reporter:
                neil.griffin Neil Griffin
                Participants of an Issue:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: