All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.dirigible.engine.job.synchronizer.JobClasspathContentHandler Maven / Gradle / Ivy

There is a newer version: 7.2.0
Show newest version
/*
 * Copyright (c) ${license.git.copyrightYears} SAP SE or an SAP affiliate company and Eclipse Dirigible contributors
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v2.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v20.html
 *
 * SPDX-FileCopyrightText: ${license.git.copyrightYears} SAP SE or an SAP affiliate company and Eclipse Dirigible contributors
 * SPDX-License-Identifier: EPL-2.0
 */
package org.eclipse.dirigible.engine.job.synchronizer;

import java.io.IOException;

import org.eclipse.dirigible.commons.api.content.AbstractClasspathContentHandler;
import org.eclipse.dirigible.commons.api.module.StaticInjector;
import org.eclipse.dirigible.core.scheduler.api.ISchedulerCoreService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * The Class JobClasspathContentHandler.
 */
public class JobClasspathContentHandler extends AbstractClasspathContentHandler {

	private static final Logger logger = LoggerFactory.getLogger(JobClasspathContentHandler.class);

	private JobSynchronizer jobSynchronizer = StaticInjector.getInjector().getInstance(JobSynchronizer.class);

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.dirigible.commons.api.content.AbstractClasspathContentHandler#isValid(java.lang.String)
	 */
	@Override
	protected boolean isValid(String path) {
		boolean isValid = false;

		try {
			if (path.endsWith(ISchedulerCoreService.FILE_EXTENSION_JOB)) {
				isValid = true;
				jobSynchronizer.registerPredeliveredJob(path);
			}
		} catch (IOException e) {
			logger.error("Predelivered Job is not valid", e);
		}

		return isValid;
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.dirigible.commons.api.content.AbstractClasspathContentHandler#getLogger()
	 */
	@Override
	protected Logger getLogger() {
		return logger;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy