Class SetupUtil
- java.lang.Object
-
- com.composum.sling.core.setup.util.SetupUtil
-
public class SetupUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description SetupUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkBundles(org.apache.jackrabbit.vault.packaging.InstallContext ctx, Map<String,String> bundlesToCheck, int waitToStartSeconds, int timeoutSeconds)
check a list of bundles (symbolic name, version) for the right version and active statestatic <T> T
getService(Class<T> type)
retrieve a service during setupstatic void
setupGroupsAndUsers(org.apache.jackrabbit.vault.packaging.InstallContext ctx, Map<String,List<String>> groups, Map<String,List<String>> systemUsers, Map<String,List<String>> users)
Creates or updates a set of groups, users and system usersstatic void
updateNodeTypes(org.apache.jackrabbit.vault.packaging.InstallContext ctx)
Updates existing nodetypes.static void
updateNodeTypesConditionally(org.apache.jackrabbit.vault.packaging.InstallContext ctx, Callable<Boolean> upToDateCheck)
Updates existing nodetypes if an up to date check fails.
-
-
-
Method Detail
-
setupGroupsAndUsers
public static void setupGroupsAndUsers(org.apache.jackrabbit.vault.packaging.InstallContext ctx, Map<String,List<String>> groups, Map<String,List<String>> systemUsers, Map<String,List<String>> users) throws org.apache.jackrabbit.vault.packaging.PackageException
Creates or updates a set of groups, users and system users- Parameters:
ctx
- the installation contextgroups
- map of group names (including path, e.g. composum/plaform/composum-platform-users) to list of users (have to exist already)systemUsers
- map of system user names (including path, e.g. system/composum/platform/composum-platform-service) to list of group names (without path). The groups have to exist already, or be created with parameter groupsusers
- map of user names (including path) to list of group names (without path). The groups have to exist already, or be created with parameter groups- Throws:
org.apache.jackrabbit.vault.packaging.PackageException
-
checkBundles
public static void checkBundles(org.apache.jackrabbit.vault.packaging.InstallContext ctx, Map<String,String> bundlesToCheck, int waitToStartSeconds, int timeoutSeconds) throws org.apache.jackrabbit.vault.packaging.PackageException
check a list of bundles (symbolic name, version) for the right version and active state- Parameters:
ctx
- the package install contextbundlesToCheck
- the 'list' to check; key: symbolic name, value: versionwaitToStartSeconds
- the seconds to wait to check start; must be greater than 1timeoutSeconds
- the timeout for the bundle check in seconds- Throws:
org.apache.jackrabbit.vault.packaging.PackageException
- if the check fails
-
getService
public static <T> T getService(Class<T> type)
retrieve a service during setup
-
updateNodeTypes
public static void updateNodeTypes(org.apache.jackrabbit.vault.packaging.InstallContext ctx) throws org.apache.jackrabbit.vault.packaging.PackageException
Updates existing nodetypes. This might be neccesary for changes in nodetypes.cnd, since the normal package installation does not change existing node types. It's probably sensible to do this only after checking that the current definition in theNodeTypeManager
of the changed node type is not current.- Throws:
org.apache.jackrabbit.vault.packaging.PackageException
-
updateNodeTypesConditionally
public static void updateNodeTypesConditionally(org.apache.jackrabbit.vault.packaging.InstallContext ctx, Callable<Boolean> upToDateCheck) throws org.apache.jackrabbit.vault.packaging.PackageException
Updates existing nodetypes if an up to date check fails. This might be neccesary for changes in nodetypes.cnd, since the normal package installation does not change existing node types.- Parameters:
upToDateCheck
- if this does return true, the update is skipped. Probably involvesctx.getSession().getWorkspace().getNodeTypeManager()
.- Throws:
org.apache.jackrabbit.vault.packaging.PackageException
-
-