protected void activate()

in src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java [209:259]


    protected void activate(final Map<String, Object> props, final Config config) {
        this.update(props, config);
        this.jobsBasePathWithSlash = PropertiesUtil.toString(props.get(PROPERTY_REPOSITORY_PATH),
                DEFAULT_REPOSITORY_PATH) + '/';

        // create initial resources
        this.assignedJobsPath = this.jobsBasePathWithSlash + "assigned";
        this.unassignedJobsPath = this.jobsBasePathWithSlash + "unassigned";

        this.localJobsPath = this.assignedJobsPath.concat("/").concat(Environment.APPLICATION_ID);
        this.localJobsPathWithSlash = this.localJobsPath.concat("/");

        this.previousVersionAnonPath = this.jobsBasePathWithSlash + "anon";
        this.previousVersionIdentifiedPath = this.jobsBasePathWithSlash + "identified";

        this.storedCancelledJobsPath = this.jobsBasePathWithSlash + "cancelled";
        this.storedSuccessfulJobsPath = this.jobsBasePathWithSlash + "finished";

        this.scheduledJobsPath = PropertiesUtil.toString(props.get(PROPERTY_SCHEDULED_JOBS_PATH),
            DEFAULT_SCHEDULED_JOBS_PATH);
        this.scheduledJobsPathWithSlash = this.scheduledJobsPath + "/";

        this.historyCleanUpRemovedJobs = config.cleanup_period();

        // create initial resources
        final ResourceResolver resolver = this.createResourceResolver();
        try {
            ResourceHelper.getOrCreateBasePath(resolver, this.getLocalJobsPath());
            ResourceHelper.getOrCreateBasePath(resolver, this.getUnassignedJobsPath());
        } catch ( final PersistenceException pe ) {
            logger.error("Unable to create default paths: " + pe.getMessage(), pe);
            throw new RuntimeException(pe);
        } finally {
            resolver.close();
        }
        this.active.set(true);

        // SLING-5560 : use an InitDelayingTopologyEventListener
        if (this.startupDelay > 0) {
            logger.debug("activate: job manager will start in {} sec. ({})", this.startupDelay, config.startup_delay());
            this.startupDelayListener = new InitDelayingTopologyEventListener(startupDelay, new TopologyEventListener() {

                @Override
                public void handleTopologyEvent(TopologyEvent event) {
                    doHandleTopologyEvent(event);
                }
            });
        } else {
            logger.debug("activate: job manager will start without delay. ({}:{})", config.startup_delay(), this.startupDelay);
        }
    }