Search in sources :

Example 1 with LaJobRuntime

use of org.lastaflute.job.LaJobRuntime in project fess by codelibs.

the class ExecJob method createSystemProperties.

protected void createSystemProperties(final List<String> cmdList, final File propFile) {
    try (FileOutputStream out = new FileOutputStream(propFile)) {
        final Properties prop = new Properties();
        prop.putAll(ComponentUtil.getSystemProperties());
        final LaJobRuntime jobRuntime = ComponentUtil.getJobHelper().getJobRuntime();
        if (jobRuntime != null) {
            final ScheduledJob job = (ScheduledJob) jobRuntime.getParameterMap().get(Constants.SCHEDULED_JOB);
            if (job != null) {
                prop.setProperty("job.runtime.id", job.getId());
                prop.setProperty("job.runtime.name", job.getName());
            }
        }
        prop.store(out, cmdList.toString());
    } catch (final IOException e) {
        throw new IORuntimeException(e);
    }
}
Also used : IORuntimeException(org.lastaflute.di.exception.IORuntimeException) FileOutputStream(java.io.FileOutputStream) ScheduledJob(org.codelibs.fess.es.config.exentity.ScheduledJob) LaJobRuntime(org.lastaflute.job.LaJobRuntime) IOException(java.io.IOException) Properties(java.util.Properties)

Aggregations

FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 Properties (java.util.Properties)1 ScheduledJob (org.codelibs.fess.es.config.exentity.ScheduledJob)1 IORuntimeException (org.lastaflute.di.exception.IORuntimeException)1 LaJobRuntime (org.lastaflute.job.LaJobRuntime)1