Class SetupUtil


  • public class SetupUtil
    extends Object
    • Constructor Detail

      • SetupUtil

        public SetupUtil()
    • 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 context
        groups - 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 groups
        users - 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 context
        bundlesToCheck - the 'list' to check; key: symbolic name, value: version
        waitToStartSeconds - the seconds to wait to check start; must be greater than 1
        timeoutSeconds - 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 the NodeTypeManager 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 involves ctx.getSession().getWorkspace().getNodeTypeManager().
        Throws:
        org.apache.jackrabbit.vault.packaging.PackageException