Class SkinService

All Implemented Interfaces:
org.picocontainer.Startable

public class SkinService extends AbstractResourceService implements org.picocontainer.Startable
  • Field Details

    • log

      protected static org.exoplatform.services.log.Log log
    • DEFAULT_SKIN_PARAM_NAME

      public static final String DEFAULT_SKIN_PARAM_NAME
      See Also:
    • CUSTOM_MODULE_ID

      public static final String CUSTOM_MODULE_ID
      See Also:
    • MAX_AGE

      public static final long MAX_AGE
  • Constructor Details

    • SkinService

      public SkinService(org.exoplatform.container.xml.InitParams initParams, org.exoplatform.container.ExoContainerContext context, ResourceCompressor compressor)
  • Method Details

    • addSkinConfig

      public void addSkinConfig(SkinConfigPlugin skinConfigPlugin)
    • getDefaultSkin

      public String getDefaultSkin()
    • addCategoryTheme

      public void addCategoryTheme(String categoryName)
      Add a new category for portlet themes if it does not exist
      Parameters:
      categoryName - the category name
    • addPortalSkin

      @Deprecated public void addPortalSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext)
      Deprecated.
    • addPortalSkin

      public void addPortalSkin(String module, String skinName, String cssPath)
      Add a portal skin with the priority is Integer.MAX_VALUE and the overwrite is false by default
      Parameters:
      module -
      skinName -
      cssPath -
    • addPortalSkin

      @Deprecated public void addPortalSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext, boolean overwrite)
    • addPortalSkin

      public void addPortalSkin(String module, String skinName, String cssPath, boolean overwrite)
      Add a portal skin with the priority is Integer.MAX_VALUE by default
      Parameters:
      module -
      skinName -
      cssPath -
      overwrite -
    • addPortalSkin

      public void addPortalSkin(String module, String skinName, String cssPath, int priority, boolean overwrite)
      Register a portal skin
      Parameters:
      module - skin module identifier
      skinName - skin name
      cssPath - path uri to the css file. This is relative to the root context, use leading '/'
      priority - priority to support sorting in skin list
      overwrite - if any previous skin should be replaced by that one
    • addPortalSkin

      public void addPortalSkin(String module, String skinName, String cssPath, int priority, boolean overwrite, boolean filtered)
      Register a portal skin
      Parameters:
      module - skin module identifier
      skinName - skin name
      cssPath - path uri to the css file. This is relative to the root context, use leading '/'
      priority - priority to support sorting in skin list
      overwrite - if any previous skin should be replaced by that one
      filtered - if true, then the portal skin will be loaded only when required by a portlet
    • addPortalSkin

      @Deprecated public void addPortalSkin(String module, String skinName, String cssPath, String cssData)
      Deprecated.
      This method is not supported anymore. The resource resolver pluggability mechanism should be used somehow
      Register a portal skin with the specific cssData
      Parameters:
      module - skin module identifier
      skinName - skin name
      cssPath - path uri to the css file. This is relative to the root context, use leading '/'
      cssData - the content of css
    • addSkin

      @Deprecated public void addSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext)
      Deprecated.
    • addSkin

      public void addSkin(String module, String skinName, String cssPath)
      Add a skin with the priority is Integer.MAX_VALUE and the overwrite is false by default
      Parameters:
      module -
      skinName -
      cssPath -
    • addSkin

      @Deprecated public void addSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext, boolean overwrite)
    • addSkin

      public void addSkin(String module, String skinName, String cssPath, boolean overwrite)
      Add a portal skin with the priority is Integer.MAX_VALUE
      Parameters:
      module -
      skinName -
      cssPath -
      overwrite -
    • addSkin

      public void addSkin(String module, String skinName, String cssPath, int priority, boolean overwrite)
      Register the Skin for available portal Skins. Support priority
      Parameters:
      module - skin module identifier
      skinName - skin name
      cssPath - path uri to the css file. This is relative to the root context, use leading '/'
      priority - priority to support sorting in skin list
      overwrite - if any previous skin should be replaced by that one
    • addSkin

      public void addSkin(String module, String skinName, String cssPath, int priority, boolean overwrite, List<String> additionalModules)
    • addSkin

      @Deprecated public void addSkin(String module, String skinName, String cssPath, String cssData)
      Deprecated.
      Register the Skin for available portal Skins. Do not replace existed Skin
      Parameters:
      module - skin module identifier
      skinName - skin name
      cssPath - path uri to the css file. This is relative to the root context, use leading '/'
      cssData -
    • merge

      public Skin merge(Collection<SkinConfig> skins)
      Merge several skins into one single skin.
      Parameters:
      skins - the skins to merge
      Returns:
      the merged skin
    • merge

      public Skin merge(Collection<SkinConfig> skins, String id)
    • addTheme

      public void addTheme(String categoryName, List<String> themesName)
      Registry theme category with its themes for portlet Theme
      Parameters:
      categoryName - category name that will be registried
      themesName - list theme name of categoryName
    • getAvailableSkinNames

      public Set<String> getAvailableSkinNames()
      Get names of all the currently registered skins.
      Returns:
      an unmodifiable Set of the currently registered skins
    • getCSS

      public String getCSS(org.exoplatform.web.ControllerContext context, boolean compress)
      Return the CSS content of the file specified by the given URI.
      Parameters:
      context -
      compress -
      Returns:
      the css contet or null if not found.
    • renderCSS

      public boolean renderCSS(org.exoplatform.web.ControllerContext context, ResourceRenderer renderer, boolean compress) throws RenderingException, IOException
      Render css content of the file specified by the given URI
      Parameters:
      context -
      renderer - the webapp's ResourceRenderer
      compress -
      Returns:
      true if the CSS resource is found and rendered; false otherwise.
      Throws:
      RenderingException
      IOException
    • getMergedCSS

      @Deprecated public String getMergedCSS(org.exoplatform.web.ControllerContext context, String path)
      Deprecated.
      Return CSS data corresponding to the path
      Parameters:
      context -
      path - path uri to the css file
      Returns:
      css content of URI file or null if not found
    • getPortalSkins

      public Collection<SkinConfig> getPortalSkins(String skinName)
      Return a collection of Portal Skins that its elements are ordered by CSS priority
      Parameters:
      skinName - name of Portal Skin
      Returns:
      all org.exoplatform.portal.resource.SkinConfig of Portal Skin
    • findSkins

      public Collection<SkinConfig> findSkins(SkinVisitor visitor)
      Return a collection of SkinConfig based on SkinVisitor provided as the argument
      Parameters:
      visitor -
      Returns:
    • getCustomPortalSkins

      public Collection<SkinConfig> getCustomPortalSkins(String skinName)
      Return the collection of custom portal skins
      Parameters:
      skinName -
      Returns:
      the map of custom portal skins
    • getPortletThemes

      public Map<String,Set<String>> getPortletThemes()
      Return the map of portlet themes
      Returns:
      the map of portlet themes
    • getSkin

      public SkinConfig getSkin(String module, String skinName)
      Return a SkinConfig mapping by the module and skin name
      Parameters:
      module -
      skinName -
      Returns:
      SkinConfig by SkinKey(module, skinName), or SkinConfig by SkinKey(module, defaultSkin)
    • getPortalSkin

      public SkinConfig getPortalSkin(String module, String skinName)
      Return a Portal SkinConfig mapping by the module and skin name
      Parameters:
      module -
      skinName -
      Returns:
      SkinConfig by SkinKey(module, skinName), or SkinConfig by SkinKey(module, SkinService.DEFAULT_SKIN)
    • invalidatePortalSkinCache

      @Deprecated public void invalidatePortalSkinCache(String portalName, String skinName)
      Deprecated.
      the method name is wrong to the behaviour it does. Use removeSkin(String, String) instead
      Remove SkinKey from SkinCache by portalName and skinName
      Parameters:
      portalName -
      skinName -
    • invalidateCachedSkin

      public void invalidateCachedSkin(String path)
      Invalidate skin from the cache
      Parameters:
      path - the key
    • getLastModified

      public long getLastModified(org.exoplatform.web.ControllerContext context)
      Returns last modified date of cached css.

      In development mode, it always returns Long.MAX_VALUE. Return null if cached css can not be found

      Parameters:
      context -
    • remove

      @Deprecated public void remove(String module, String skinName)
      Deprecated.
      The method name is not clear. Using removeSkin(String, String) instead
    • removeSkin

      public void removeSkin(String module, String skinName)
      Remove a Skin from the service as well as its cache
      Parameters:
      module -
      skinName -
    • removeSkin

      public void removeSkin(SkinKey key)
      Remove a Skin mapped to the key
      Parameters:
      key - key whose mapping skin is to be removed from the service
    • removePortalSkin

      public void removePortalSkin(String module, String skinName)
      Remove a Skin from the service as well as its cache
      Parameters:
      module -
      skinName -
    • removePortalSkin

      public void removePortalSkin(SkinKey key)
      Remove a Skin mapped to the key
      Parameters:
      key - key whose mapping skin is to be removed from the service
    • remove

      @Deprecated public void remove(List<SkinKey> keys) throws Exception
      Deprecated.
      This is deprecated as its name was not clear. Use removeSkins(List) instead
      Throws:
      Exception
    • removeSkins

      public void removeSkins(List<SkinKey> keys)
      Remove SkinConfig from Portal Skin Config by SkinKey
      Parameters:
      keys - SkinKey list these will be removed
    • removeSupportedSkin

      public void removeSupportedSkin(String skinName)
      Remove Skin from Portal available Skin by skin name
      Parameters:
      skinName - name of skin that will be removed
    • size

      public int size()
      Return the number of skin config maintaining in this SkinService
      Returns:
      the number of skin config maintaining in this SkinService
    • getSkinList

      public String[] getSkinList()
      Get all available skin
      Returns:
      all available skin
    • reloadSkins

      public void reloadSkins()
      Clean cache, reload all Skins
    • reloadSkin

      public void reloadSkin(String skinId)
      reload skin by skin ID
      Parameters:
      skinId - the skin ID that will be reloaded
    • start

      public void start()
      Start service. Registry org.exoplatform.portal.resource.GateInSkinConfigDeployer and org.exoplatform.portal.resource.GateInSkinConfigRemoval into ServletContainer.
      Specified by:
      start in interface org.picocontainer.Startable
      See Also:
      • Startable.start()
    • stop

      public void stop()
      Stop service Remove org.exoplatform.portal.resource.GateInSkinConfigDeployer and org.exoplatform.portal.resource.GateInSkinConfigRemoval from ServletContainer.
      Specified by:
      stop in interface org.picocontainer.Startable
      See Also:
      • Startable.stop()