Package com.adobe.granite.contexthub.api
Interface ContextHub
-
@ProviderType public interface ContextHub
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ContextHub.ModeStatus
Defines possible states based on which modes can be filtered.static class
ContextHub.ModuleStatus
Defines possible states based on which modules can be filtered.static class
ContextHub.StoreStatus
Defines possible states based on which stores can be filtered.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<Module>
filterModules(Resource contextHub, java.util.EnumSet<ContextHub.ModuleStatus> flags)
Returns all modules matching to requested filter.java.util.List<Store>
filterStores(Resource contextHub, java.util.EnumSet<ContextHub.StoreStatus> flags)
Returns all stores matching to requested filter.java.util.List<Mode>
findModes(Resource contextHub)
Given a ContextHub configuration resource, return the correspondingMode
s as listjava.util.List<Module>
findModules(Resource contextHub)
Given a ContextHub configuration resource, return the correspondingModule
s as listjava.util.List<Store>
findStores(Resource contextHub)
Given a ContextHub configuration resource, return the correspondingStore
s as listjava.lang.String
getAnonymousPath()
Returns home path of anonymous user.java.util.List<Mode>
getDisabledModes(Resource contextHub)
Returns all hidden ContextHub modes.java.util.List<Module>
getDisabledModules(Resource contextHub)
Returns all hidden ContextHub modules.java.util.List<Store>
getDisabledStores(Resource contextHub)
Returns all disabled ContextHub's stores.java.util.List<Mode>
getEnabledModes(Resource contextHub)
Returns all visible ContextHub modes.java.util.List<Module>
getEnabledModules(Resource contextHub)
Returns all visible ContextHub modules.java.util.List<Store>
getEnabledStores(Resource contextHub)
Returns all enabled ContextHub's stores.java.util.List<java.lang.String>
getKernelCategories(SlingHttpServletRequest request)
Returns a list of kernel client library categories (including javascript part of ui libraries if includeUI is set totrue
).java.lang.String
getKernelCode(SlingHttpServletRequest request, SlingHttpServletResponse response)
Returns generated output of kernel.js.java.lang.String
getKernelCodeURL(SlingHttpServletRequest request)
Returns URL to ContextHub's kernel.jsjava.lang.String
getPath(SlingHttpServletRequest request)
Returns Path to ContextHubjava.lang.String
getPath(SlingHttpServletRequest request, boolean checkRequestResource)
Returns Path to ContextHubjava.util.Set<java.lang.String>
getRunModes()
Returns instance's run modes.java.lang.String
getStyles(SlingHttpServletRequest request)
Returns generated output of styles.css.java.util.List<java.lang.String>
getStylesCategories(SlingHttpServletRequest request)
Returns a list of ui (type: css) client library categories.java.lang.String
getStylesURL(SlingHttpServletRequest request)
Returns URL to ContextHub's styles.css (containing ui source code)java.lang.String
getTheme(Resource contextHub)
Returns ContextHub's UI theme name.java.util.List<java.lang.String>
getUICategories(SlingHttpServletRequest request)
Returns a list of ui (type: js) client library categories.java.lang.String
getUICode(SlingHttpServletRequest request, SlingHttpServletResponse response)
Returns generated output of ui.js.java.lang.String
getUICodeURL(SlingHttpServletRequest request)
Returns the URL to ContextHub's ui.jsjava.lang.String
getUIPageURL(SlingHttpServletRequest request)
Returns URL to ContextHub's UI page (which is "static", only the code is "dynamic")boolean
isConfigured(Resource contextHub)
Determines if ContextHub's instance is ready to use (it'sfalse
when ContextHub's resource wasn't found).boolean
isConfigured(SlingHttpServletRequest request)
Determines if ContextHub is configured for this request.boolean
isDebug(SlingHttpServletRequest request)
Returns whether debug is enabled for a given ContextHub instance.boolean
isDisabled(SlingHttpServletRequest request)
Returns whether a given ContextHub instance is disabled.boolean
isSilentMode()
Returns whether ContextHub should run in silent mode (takes priority over debug mode).boolean
showUi()
Returns whether to include the ContextHub UI or not.
-
-
-
Method Detail
-
getPath
java.lang.String getPath(SlingHttpServletRequest request)
Returns Path to ContextHub- Parameters:
request
- request- Returns:
- URL to contexthub
-
getPath
java.lang.String getPath(SlingHttpServletRequest request, boolean checkRequestResource)
Returns Path to ContextHub- Parameters:
request
- requestcheckRequestResource
- indicates whether request resource should be used to resolve ContextHub path- Returns:
- URL to contexthub
-
getRunModes
java.util.Set<java.lang.String> getRunModes()
Returns instance's run modes.- Returns:
- list of run modes
-
findStores
java.util.List<Store> findStores(Resource contextHub)
Given a ContextHub configuration resource, return the correspondingStore
s as list- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
- list of stores
-
findModules
java.util.List<Module> findModules(Resource contextHub)
Given a ContextHub configuration resource, return the correspondingModule
s as list- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
- list of modules
-
findModes
java.util.List<Mode> findModes(Resource contextHub)
Given a ContextHub configuration resource, return the correspondingMode
s as list- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
- list of modes
-
filterStores
java.util.List<Store> filterStores(Resource contextHub, java.util.EnumSet<ContextHub.StoreStatus> flags)
Returns all stores matching to requested filter.- Parameters:
contextHub
- the ContextHub configuration resourceflags
- filter (EnumSet
containing desired status of the store)- Returns:
- stores matching to requested filter
-
filterModules
java.util.List<Module> filterModules(Resource contextHub, java.util.EnumSet<ContextHub.ModuleStatus> flags)
Returns all modules matching to requested filter.- Parameters:
contextHub
- the ContextHub configuration resourceflags
- filter (EnumSet
containing desired status of the store)- Returns:
- modules matching to requested filter
-
getEnabledStores
java.util.List<Store> getEnabledStores(Resource contextHub)
Returns all enabled ContextHub's stores.- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
- enabled stores
-
getEnabledModules
java.util.List<Module> getEnabledModules(Resource contextHub)
Returns all visible ContextHub modules.- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
- enabled modules
-
getEnabledModes
java.util.List<Mode> getEnabledModes(Resource contextHub)
Returns all visible ContextHub modes.- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
- enabled modes
-
getDisabledStores
java.util.List<Store> getDisabledStores(Resource contextHub)
Returns all disabled ContextHub's stores.- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
- disabled stores
-
getDisabledModules
java.util.List<Module> getDisabledModules(Resource contextHub)
Returns all hidden ContextHub modules.- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
- hidden modules
-
getDisabledModes
java.util.List<Mode> getDisabledModes(Resource contextHub)
Returns all hidden ContextHub modes.- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
- hidden modes
-
getTheme
java.lang.String getTheme(Resource contextHub)
Returns ContextHub's UI theme name.- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
- UI theme name
-
isConfigured
boolean isConfigured(Resource contextHub)
Determines if ContextHub's instance is ready to use (it'sfalse
when ContextHub's resource wasn't found).- Parameters:
contextHub
- the ContextHub configuration resource- Returns:
true
if ContextHub was properly initialized
-
isConfigured
boolean isConfigured(SlingHttpServletRequest request)
Determines if ContextHub is configured for this request.- Parameters:
request
- request- Returns:
true
if ContextHub was properly initialized
-
getKernelCodeURL
java.lang.String getKernelCodeURL(SlingHttpServletRequest request)
Returns URL to ContextHub's kernel.js- Parameters:
request
- request- Returns:
- URL to kernel.js
-
getUICodeURL
java.lang.String getUICodeURL(SlingHttpServletRequest request)
Returns the URL to ContextHub's ui.js- Parameters:
request
- request- Returns:
- URL to ui.js
-
getStylesURL
java.lang.String getStylesURL(SlingHttpServletRequest request)
Returns URL to ContextHub's styles.css (containing ui source code)- Parameters:
request
- request- Returns:
- URL to styles.css
-
getUIPageURL
java.lang.String getUIPageURL(SlingHttpServletRequest request)
Returns URL to ContextHub's UI page (which is "static", only the code is "dynamic")- Parameters:
request
- request- Returns:
- URL to ui.html
-
getKernelCategories
java.util.List<java.lang.String> getKernelCategories(SlingHttpServletRequest request)
Returns a list of kernel client library categories (including javascript part of ui libraries if includeUI is set totrue
).- Parameters:
request
- request- Returns:
- list of categories required to build code.js
-
getUICategories
java.util.List<java.lang.String> getUICategories(SlingHttpServletRequest request)
Returns a list of ui (type: js) client library categories.- Parameters:
request
- request- Returns:
- list of categories required to build styles.css
-
getStylesCategories
java.util.List<java.lang.String> getStylesCategories(SlingHttpServletRequest request)
Returns a list of ui (type: css) client library categories.- Parameters:
request
- request- Returns:
- list of categories required to build styles.css
-
getKernelCode
java.lang.String getKernelCode(SlingHttpServletRequest request, SlingHttpServletResponse response)
Returns generated output of kernel.js. Output is built based on categories returned bygetKernelCategories(org.apache.sling.api.SlingHttpServletRequest)
and minimized if not set to debug.- Parameters:
request
- requestresponse
- response- Returns:
- ContextHub's kernel JavaScript code
-
getUICode
java.lang.String getUICode(SlingHttpServletRequest request, SlingHttpServletResponse response)
Returns generated output of ui.js. Output is build basing on categories returned bygetUICategories(org.apache.sling.api.SlingHttpServletRequest)
and minimized if not set to debug.- Parameters:
request
- requestresponse
- response- Returns:
- output of ui.js
-
getStyles
java.lang.String getStyles(SlingHttpServletRequest request)
Returns generated output of styles.css. Output is build basing on categories returned bygetUICategories(org.apache.sling.api.SlingHttpServletRequest)
and minimized if not set to debug.- Parameters:
request
- request- Returns:
- output of styles.css
-
showUi
boolean showUi()
Returns whether to include the ContextHub UI or not.- Returns:
true
if ContextHub UI is to be included
-
isSilentMode
boolean isSilentMode()
Returns whether ContextHub should run in silent mode (takes priority over debug mode).- Returns:
true
if debug is enabled
-
isDebug
boolean isDebug(SlingHttpServletRequest request)
Returns whether debug is enabled for a given ContextHub instance.- Returns:
true
if debug is enabled
-
isDisabled
boolean isDisabled(SlingHttpServletRequest request)
Returns whether a given ContextHub instance is disabled.- Parameters:
request
- - request- Returns:
true
if a given ContextHub instance is disabled.
-
getAnonymousPath
java.lang.String getAnonymousPath()
Returns home path of anonymous user.- Returns:
- {String|null}
-
-