From: Sweidan Omar Date: Wed, 8 Dec 2021 13:31:56 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=ff12014c3ec2752c863272db77bfa0fcc9356f8e;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C32519 --- diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/server/IJobEngineConfiguration.java b/server/user.jobengine.osgi.server/src/user/jobengine/server/IJobEngineConfiguration.java index 2d9bdbd3..9c18761e 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/server/IJobEngineConfiguration.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/server/IJobEngineConfiguration.java @@ -31,7 +31,7 @@ public interface IJobEngineConfiguration { void loadSchedules() throws Exception; - String loadTemplateJson(String template); + String loadTemplateXml(String template); void resetStepClassLoader(); diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngineConfiguration.java b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngineConfiguration.java index c4873390..dc591b01 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngineConfiguration.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngineConfiguration.java @@ -74,9 +74,9 @@ public class JobEngineConfiguration implements IJobEngineConfiguration { Set libFiles = getJavaFileList(Paths.get(stepsDir), null); libFiles.addAll(sharedFiles); - // for (File f : libFiles) { - // logger.info("GroovyClassLoader source {}", f.getAbsolutePath()); - // } + // for (File f : libFiles) { + // logger.info("GroovyClassLoader source {}", f.getAbsolutePath()); + // } GroovyClassLoader gcl = new GroovyClassLoader(stepsClassLoader) { @@ -84,8 +84,8 @@ public class JobEngineConfiguration implements IJobEngineConfiguration { protected CompilationUnit createCompilationUnit(CompilerConfiguration config, CodeSource source) { CompilationUnit result = new CompilationUnit(config, source, this); libFiles.forEach(f -> result.addSource(f)); - // loadStepSources(result, Paths.get(stepsDir, "shared")); - // loadStepSources(result, Paths.get(stepsDir)); + //loadStepSources(result, Paths.get(stepsDir, "shared")); + //loadStepSources(result, Paths.get(stepsDir)); return result; } @@ -151,7 +151,7 @@ public class JobEngineConfiguration implements IJobEngineConfiguration { URL[] urls = { path.toUri().toURL() }; stepsClassLoader = URLClassLoader.newInstance(urls, Thread.currentThread().getContextClassLoader()); } catch (FileNotFoundException e) { - // nincs jobs/classes mappa + //nincs jobs/classes mappa URL[] urls = {}; stepsClassLoader = URLClassLoader.newInstance(urls, Thread.currentThread().getContextClassLoader()); } @@ -253,10 +253,9 @@ public class JobEngineConfiguration implements IJobEngineConfiguration { Path path = Paths.get(stepsDir, className); File classFile = null; - // Windows alatt az eleresi utak irasmodja egyforma kell legyen. - // A GroovyClassLoader - // ld. createGroovyClassLoader a new File(path.toFile().getCanonicalPath())-al - // operal. + //Windows alatt az eleresi utak irasmodja egyforma kell legyen. + //A GroovyClassLoader + //ld. createGroovyClassLoader a new File(path.toFile().getCanonicalPath())-al operal. classFile = new File(path.toFile().getCanonicalPath()); logger.info("Class path is normalized to {}", classFile.getCanonicalPath()); @@ -286,11 +285,11 @@ public class JobEngineConfiguration implements IJobEngineConfiguration { if (!executors.containsKey(unitName)) { logger.info("Executor now registered for {}", unitName); executors.put(unitName, executor); - // az uj vegrehajtokat el is kell inditani + //az uj vegrehajtokat el is kell inditani if (autoStart) executor.startup(); } else { - // logger.info("Executor already registered for {}", unitName); + //logger.info("Executor already registered for {}", unitName); IJobStepExecutor stepExecutor = executors.get(unitName); int currentMaxConcurrent = stepExecutor.getMaxConcurrent(); int newMaxConcurrent = executor.getMaxConcurrent(); @@ -317,7 +316,7 @@ public class JobEngineConfiguration implements IJobEngineConfiguration { @Override public void loadSchedules() throws Exception { - // a kulcs nem lehet a template, mert kulonbozo parameterekkel is benne lehet! + //a kulcs nem lehet a template, mert kulonbozo parameterekkel is benne lehet! schedules.clear(); String configFilePath = systemConfig.getConfig(JobEngineConfiguration.CONF_SCHEDULES); logger.info("Loading scheduler configuration file {}", configFilePath); @@ -327,9 +326,9 @@ public class JobEngineConfiguration implements IJobEngineConfiguration { scheduleJobs.forEach(o -> { try { BasicDBObject j = (BasicDBObject) o; - String template = j.getString("schedules"); - String json = loadTemplateJson(template); - j.put("json", json); + String template = j.getString("template"); + String xml = loadTemplateXml(template); + j.put("xml", xml); schedules.put(template, j); } catch (Exception e) { logger.error("Scheduled job error! {}", e.getMessage()); @@ -354,9 +353,8 @@ public class JobEngineConfiguration implements IJobEngineConfiguration { try { if (add) { - // ha a betoltendo osztaly eleresi utja korabban mas kapitalissal kerul - // feldolgozasra, hibat kapunk - // ld. loadClassFromSourceCode + //ha a betoltendo osztaly eleresi utja korabban mas kapitalissal kerul feldolgozasra, hibat kapunk + //ld. loadClassFromSourceCode File classFile = new File(p.toFile().getCanonicalPath()); result.add(classFile); } @@ -375,9 +373,9 @@ public class JobEngineConfiguration implements IJobEngineConfiguration { private void loadTemplate(Path config) { InputStream stream = null; try { - // byte[] xmlBytes = Files.readAllBytes(config); - // String xml = new String(xmlBytes); - // stream = new ByteArrayInputStream(xmlBytes); + // byte[] xmlBytes = Files.readAllBytes(config); + // String xml = new String(xmlBytes); + // stream = new ByteArrayInputStream(xmlBytes); stream = Files.newInputStream(config); String fileName = config.getFileName().toString(); Parser parser = new Parser(stream); @@ -421,12 +419,12 @@ public class JobEngineConfiguration implements IJobEngineConfiguration { } @Override - public String loadTemplateJson(String template) { + public String loadTemplateXml(String template) { String result = null; try { Path templatesPath = Paths.get(systemConfig.getConfig(DIR_TEMPLATES)); - byte[] jsonBytes = Files.readAllBytes(Paths.get(templatesPath.toString(), template)); - result = new String(jsonBytes); + byte[] xmlBytes = Files.readAllBytes(Paths.get(templatesPath.toString(), template)); + result = new String(xmlBytes); } catch (Exception e) { logger.error(e.getClass().getSimpleName() + ": " + e.getMessage()); }