Package org.exoplatform.portal.resource
Class SkinService
java.lang.Object
org.exoplatform.portal.resource.AbstractResourceService
org.exoplatform.portal.resource.SkinService
- All Implemented Interfaces:
org.picocontainer.Startable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected static final org.exoplatform.services.log.Logstatic final longFields inherited from class org.exoplatform.portal.resource.AbstractResourceService
compressor, contexts, mainResolver -
Constructor Summary
ConstructorsConstructorDescriptionSkinService(org.exoplatform.container.xml.InitParams initParams, org.exoplatform.container.ExoContainerContext context, ResourceCompressor compressor) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPortalSkin(String module, String skinName, String cssPath) Add a portal skin with thepriorityis Integer.MAX_VALUE and theoverwriteis false by defaultvoidaddPortalSkin(String module, String skinName, String cssPath, boolean overwrite) Add a portal skin with thepriorityis Integer.MAX_VALUE by defaultvoidaddPortalSkin(String module, String skinName, String cssPath, int priority, boolean overwrite) Register a portal skinaddPortalSkin(String module, String skinName, String cssPath, int priority, boolean overwrite, boolean filtered) Register a portal skinvoidAdd a skin with thepriorityis Integer.MAX_VALUE and theoverwriteis false by defaultvoidAdd a portal skin with thepriorityis Integer.MAX_VALUEvoidRegister the Skin for available portal Skins.addSkin(String module, String skinName, String cssPath, int priority, boolean overwrite, List<String> additionalModules) voidRegistry theme category with its themes for portlet ThemefindSkins(SkinVisitor visitor) Return a collection of SkinConfig based on SkinVisitor provided as the argumentGet names of all the currently registered skins.getCustomPortalSkins(String skinName) Return the collection of custom portal skinslonggetLastModified(org.exoplatform.web.ControllerContext context) Deprecated.CSS Caching is using files mechanism instead of InMemory cachegetPortalSkin(String module, String skinName) Return a Portal SkinConfig mapping by the module and skin namegetPortalSkins(String skinName) Return a collection of Portal Skins that its elements are ordered by CSS priorityReturn the map of portlet themesReturn a SkinConfig mapping by the module and skin nameString[]Get all available skingetSkinModuleContent(String fileWebAppPath, int fileContentHash, org.exoplatform.services.resources.Orientation orientation, boolean compress) getSkinModuleFileContent(String fileWebAppPath) Returns CSS file content switch file request pathvoidinitData()Cache data after startupvoidvoidinvalidateCachedSkin(String path) Invalidate skin from the cachevoidprocessCSSRecursively(String basePath, Reader sourceReader, Appendable appendable, org.exoplatform.services.resources.Orientation orientation) Apply CSS for Skin
If skin is null, do nothingvoidClean cache, reload all SkinsvoidremovePortalSkin(String module, String skinName) Remove a Skin from the service as well as its cachevoidremovePortalSkin(SkinKey key) Remove a Skin mapped to thekeyvoidremoveSkin(SkinKey key) Remove a Skin mapped to thekeyvoidremoveSkins(List<SkinKey> keys) Remove SkinConfig from Portal Skin Config by SkinKeyvoidremoveSupportedSkin(String skinName) Remove Skin from Portal available Skin by skin namebooleanrenderCSS(org.exoplatform.web.ControllerContext context, ResourceRenderer renderer, boolean compress) Deprecated, for removal: This API element is subject to removal in a future version.since not used for CSS content retrieval anymore.intsize()Return the number of skin config maintaining in this SkinServicevoidstart()voidstop()Methods inherited from class org.exoplatform.portal.resource.AbstractResourceService
addResourceResolver, registerContext, unregisterServletContext
-
Field Details
-
LOG
protected static final org.exoplatform.services.log.Log LOG -
DEFAULT_SKIN_PARAM_NAME
- See Also:
-
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
-
start
public void start()- Specified by:
startin interfaceorg.picocontainer.Startable
-
stop
public void stop()- Specified by:
stopin interfaceorg.picocontainer.Startable
-
initData
public void initData()Cache data after startup -
getSkinList
Get all available skin- Returns:
- all available skin
-
reloadSkins
public void reloadSkins()Clean cache, reload all Skins -
invalidateCachedSkin
Invalidate skin from the cache- Parameters:
path- the key
-
getSkinModuleContent
public String getSkinModuleContent(String fileWebAppPath, int fileContentHash, org.exoplatform.services.resources.Orientation orientation, boolean compress) throws IOException - Parameters:
fileWebAppPath- File Path including webapp context namefileContentHash- File Content Hashorientation-Orientationof UI requesting for the CSScompress- whether to compress the CSS or not- Returns:
Filerepresenting the CSS File content- Throws:
IOException- when an error happens while reading file
-
getSkinModuleFileContent
Returns CSS file content switch file request path- Parameters:
fileWebAppPath- file request path including context path- Returns:
- file content
- Throws:
IOException- if file not found or an error occurred while reading it
-
getDefaultSkin
-
addPortalSkin
Add a portal skin with thepriorityis Integer.MAX_VALUE and theoverwriteis false by default- Parameters:
module-skinName-cssPath-
-
addPortalSkin
Add a portal skin with thepriorityis 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 identifierskinName- skin namecssPath- path uri to the css file. This is relative to the root context, use leading '/'priority- priority to support sorting in skin listoverwrite- if any previous skin should be replaced by that one
-
addPortalSkin
public SkinConfig addPortalSkin(String module, String skinName, String cssPath, int priority, boolean overwrite, boolean filtered) Register a portal skin- Parameters:
module- skin module identifierskinName- skin namecssPath- path uri to the css file. This is relative to the root context, use leading '/'priority- priority to support sorting in skin listoverwrite- if any previous skin should be replaced by that onefiltered- if true, then the portal skin will be loaded only when required by a portlet- Returns:
-
addSkin
Add a skin with thepriorityis Integer.MAX_VALUE and theoverwriteis false by default- Parameters:
module-skinName-cssPath-
-
addSkin
Add a portal skin with thepriorityis 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 identifierskinName- skin namecssPath- path uri to the css file. This is relative to the root context, use leading '/'priority- priority to support sorting in skin listoverwrite- if any previous skin should be replaced by that one
-
addSkin
-
addTheme
Registry theme category with its themes for portlet Theme- Parameters:
categoryName- category name that will be registriedthemesName- list theme name of categoryName
-
getAvailableSkinNames
Get names of all the currently registered skins.- Returns:
- an unmodifiable Set of the currently registered skins
-
renderCSS
@Deprecated(forRemoval=true, since="7.0") public boolean renderCSS(org.exoplatform.web.ControllerContext context, ResourceRenderer renderer, boolean compress) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.since not used for CSS content retrieval anymore. Kept for retro compatibility with UIs making static reference to Portal Skin CSS pathsRender css content of the file specified by the given URI- Parameters:
context-renderer- the webapp'sResourceRenderercompress-- Returns:
trueif theCSS resourceis found and rendered;falseotherwise.- Throws:
IOException
-
getPortalSkins
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
Return a collection of SkinConfig based on SkinVisitor provided as the argument- Parameters:
visitor-- Returns:
-
getCustomPortalSkins
Return the collection of custom portal skins- Parameters:
skinName-- Returns:
- the map of custom portal skins
-
getPortletThemes
Return the map of portlet themes- Returns:
- the map of portlet themes
-
getSkin
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
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)
-
getLastModified
Deprecated.CSS Caching is using files mechanism instead of InMemory cacheReturns 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-
-
removeSkin
Remove a Skin mapped to thekey- Parameters:
key- key whose mapping skin is to be removed from the service
-
removePortalSkin
Remove a Skin from the service as well as its cache- Parameters:
module-skinName-
-
removePortalSkin
Remove a Skin mapped to thekey- Parameters:
key- key whose mapping skin is to be removed from the service
-
removeSkins
Remove SkinConfig from Portal Skin Config by SkinKey- Parameters:
keys- SkinKey list these will be removed
-
removeSupportedSkin
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
-
processCSSRecursively
public void processCSSRecursively(String basePath, Reader sourceReader, Appendable appendable, org.exoplatform.services.resources.Orientation orientation) throws IOException Apply CSS for Skin
If skin is null, do nothing- Parameters:
basePath-sourceReader-appendable-orientation-- Throws:
IOException
-
initSkinModuleCache
-