git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorSweidan Omar <TFS\sweidan.omar>
Wed, 8 Dec 2021 13:12:23 +0000 (13:12 +0000)
committerSweidan Omar <TFS\sweidan.omar>
Wed, 8 Dec 2021 13:12:23 +0000 (13:12 +0000)
server/user.jobengine.osgi.server/src/user/jobengine/server/IJobEngineConfiguration.java
server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngineConfiguration.java

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