Package com.hybris.backoffice
Class BackofficeModulesManager
java.lang.Object
com.hybris.backoffice.BackofficeModulesManager
A tooling class capable of finding and reading module's libraries and holding information about them.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBackofficeModulesManager(com.hybris.cockpitng.core.modules.LibraryFetcher libraryFetcher, com.hybris.cockpitng.modules.ModulesEnumeration modules) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDeprecated, for removal: This API element is subject to removal in a future version.since 1808, introduce only to ease upgrade process - remove all occurrences when removedprotected voidfetchModules(File libdir, Properties libsURLs) Gets a root directory for data filesprotected com.hybris.cockpitng.core.modules.LibraryFetcherprotected URIgetManuallyRegisteredModuleUrl(String moduleName) Optional<com.hybris.cockpitng.core.modules.ModuleInfo>getModuleInfo(File moduleLibFile) Gets information about a specified module that is stored in specified libraryOptional<com.hybris.cockpitng.core.modules.ModuleInfo>getModuleInfo(String moduleName) Gets information about a specified module.Gets a root directory, where module's libraries are kept.getModuleLib(String moduleName) Gets specified module's library.protected StringgetModuleLibFileName(String moduleName) getModuleName(File moduleLibFile) Gets name of module that is stored in specified librarygetModuleName(URI moduleURI) Provides a name of module that origines from provided URIprotected <R> Optional<R>getModulePath(File moduleLib, Properties moduleLibsURLS, Function<String, R> pathConverter) protected <R> Optional<R>getModulePath(String moduleName, Properties moduleLibsURLS, Function<String, R> pathConverter) Provides a list of attached backoffice modules.protected com.hybris.cockpitng.modules.ModulesEnumerationgetModuleSource(File moduleLib) Gets the origin URI of module that is stored in specified librarygetModuleSource(String moduleName) Gets the origin URI of specified moduleprotected FilegetRootDir(String configuredRootDir, Function<String, String>... processors) protected booleanisModuleFetched(File moduleLibFile) booleanisModuleRegistered(String moduleName) Checks if specified module is registered.protected PropertiesloadModuleLibsURLS(File libRoot) Loads information about libraries mapping: library -> module URLprotected StringprocessDir(String dir, Function<String, String>... processors) Deprecated, for removal: This API element is subject to removal in a future version.since 2105, not used any moreprotected booleanqualifiesForRemoval(File moduleLibFile, Properties moduleLibsURLs) protected booleanqualifiesForUnregistering(File moduleLibFile, Properties moduleLibsURLs) voidReloads all informations about registered backoffice modules.protected voidregisterExistingModules(Properties libsURLs) protected voidregisterNewModuleImmediately(com.hybris.cockpitng.core.modules.ModuleInfo moduleInfo, URI source) registerNewModuleJar(String moduleName) Creates and attaches new module libraryprotected voidregisterNewModuleJarImmediately(String moduleName, File moduleLibFile, URI source, Properties moduleLibsURLs) protected voidremoveModuleJarImmediately(String moduleName, File moduleLibFile, Properties moduleLibsURLs) protected voidstoreModuleLibsURLS(Properties props, File libRoot) voidunregisterModuleJar(String moduleName) Detaches previously attached moduleprotected voidunregisterModuleJar(String moduleName, File moduleLibFile)
-
Field Details
-
CONFIG_KEY_ROOT_DIR
- See Also:
-
-
Constructor Details
-
BackofficeModulesManager
public BackofficeModulesManager(com.hybris.cockpitng.core.modules.LibraryFetcher libraryFetcher, com.hybris.cockpitng.modules.ModulesEnumeration modules)
-
-
Method Details
-
refreshAndFetch
public void refreshAndFetch() throws com.hybris.cockpitng.core.CockpitApplicationExceptionReloads all informations about registered backoffice modules.All currently loaded modules are detached, newly initialized, modules libraries are being recreated and modules reattached.
- Throws:
com.hybris.cockpitng.core.CockpitApplicationException- throws if modules could not be reattached or libraries could not be recreated
-
isModuleRegistered
Checks if specified module is registered.- Parameters:
moduleName- name of module- Returns:
trueif module with specified name is already registered
-
getModules
Provides a list of attached backoffice modules. Returned list contains both fetched modules and manually registered.- Returns:
- list of modules names
- See Also:
-
getModuleName
Provides a name of module that origines from provided URI- Parameters:
moduleURI- module origin- Returns:
- name of module originated from specified URI
-
getModuleLib
Gets specified module's library.- Parameters:
moduleName- name of module- Returns:
- library of a module
-
getModuleSource
Gets the origin URI of specified module- Parameters:
moduleName- name of module- Returns:
- origin URI of module
-
getModuleSource
Gets the origin URI of module that is stored in specified library- Parameters:
moduleLib- module's library- Returns:
- origin URI of module
-
getModuleInfo
Gets information about a specified module.Please bear in mind that manager cannot provide module information about manually registerd modules. In this case
Optional.empty()is returned.- Parameters:
moduleName- name of module- Returns:
- information about module
- See Also:
-
getModuleInfo
Gets information about a specified module that is stored in specified library- Parameters:
moduleLibFile- module's library- Returns:
- information about module
-
getModuleName
Gets name of module that is stored in specified library- Parameters:
moduleLibFile- module's library- Returns:
- module name
-
getDataRootDir
Gets a root directory for data files- Returns:
- data root directory
-
getModuleJarsRootDir
Gets a root directory, where module's libraries are kept.- Returns:
- module's libraries directory
-
registerNewModuleJar
public File registerNewModuleJar(String moduleName) throws IOException, com.hybris.cockpitng.core.CockpitApplicationException Creates and attaches new module library- Parameters:
moduleName- name of module- Returns:
- module's library
- Throws:
IOException- thrown is a library could not be created (i.e. file already exists)com.hybris.cockpitng.core.CockpitApplicationException- thrown if a library for this module is already attached
-
registerNewModuleJarImmediately
protected void registerNewModuleJarImmediately(String moduleName, File moduleLibFile, URI source, Properties moduleLibsURLs) throws com.hybris.cockpitng.core.CockpitApplicationException - Throws:
com.hybris.cockpitng.core.CockpitApplicationException
-
unregisterModuleJar
public void unregisterModuleJar(String moduleName) throws IOException, com.hybris.cockpitng.core.CockpitApplicationException Detaches previously attached module- Parameters:
moduleName- module name- Throws:
IOException- thrown if library could not be deletedcom.hybris.cockpitng.core.CockpitApplicationException- thrown if module cannot be detached (i.e. is a built in module)
-
unregisterModuleJar
protected void unregisterModuleJar(String moduleName, File moduleLibFile) throws IOException, com.hybris.cockpitng.core.CockpitApplicationException - Throws:
IOExceptioncom.hybris.cockpitng.core.CockpitApplicationException
-
removeModuleJarImmediately
protected void removeModuleJarImmediately(String moduleName, File moduleLibFile, Properties moduleLibsURLs) throws IOException - Throws:
IOException
-
qualifiesForUnregistering
-
qualifiesForRemoval
-
getModulePath
protected <R> Optional<R> getModulePath(String moduleName, Properties moduleLibsURLS, Function<String, R> pathConverter) -
getModulePath
protected <R> Optional<R> getModulePath(File moduleLib, Properties moduleLibsURLS, Function<String, R> pathConverter) -
getLibraryFetcher
protected com.hybris.cockpitng.core.modules.LibraryFetcher getLibraryFetcher() -
getModulesEnumeration
protected com.hybris.cockpitng.modules.ModulesEnumeration getModulesEnumeration() -
getDirProcessors
-
getRootDir
-
processDir
@Deprecated(since="2105", forRemoval=true) protected String processDir(String dir, Function<String, String>... processors) Deprecated, for removal: This API element is subject to removal in a future version.since 2105, not used any moreReplace variables in target dir string.- Parameters:
dir-processors-
-
loadModuleLibsURLS
Loads information about libraries mapping: library -> module URL- Parameters:
libRoot- root directory for local modules libraries- Returns:
- map <
library path;module URL>
-
registerExistingModules
-
isModuleFetched
-
assureCorrectExistingModulesStructure
Deprecated, for removal: This API element is subject to removal in a future version.since 1808, introduce only to ease upgrade process - remove all occurrences when removed -
fetchModules
-
getModuleLibFileName
-
storeModuleLibsURLS
-
registerNewModuleImmediately
protected void registerNewModuleImmediately(com.hybris.cockpitng.core.modules.ModuleInfo moduleInfo, URI source) -
getManuallyRegisteredModuleUrl
-