From 2e0cae957f18f3d78d1ef40cf5d4a1394436ba82 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Wed, 2 May 2018 07:18:24 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31075 --- server/-product/pom.xml | 3 + .../config/config.xml | 3 +- .../jobtemplates/archive-recording.xml | 3 - .../jobtemplates/recreate-lowres.xml | 94 ++++++++++++++++++- .../server/steps/CreateMissingLowresStep.java | 52 ++++------ .../jobengine/server/steps/MediaToolStep.java | 16 +++- .../RecordingsArchiveItemBuilderStep.java | 2 +- .../server/steps/TranscodeFFAStranStep.java | 3 +- .../test-deploy-steps-to-bsh-main.bat | 11 +++ .../META-INF/MANIFEST.MF | 1 - .../src/user/commons/nexio/INexioAPI.java | 3 +- .../src/user/commons/nexio/NexioAPI.java | 8 ++ .../META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/component.xml | 2 +- .../OSGI-INF/componentBinder.xml | 5 + .../pages/joblist.zul | 3 + .../osgi/server/ComponentBinder.java | 34 +++++++ .../user/jobengine/zk/model/JobListModel.java | 16 ++-- .../jobengine/zk/model/JobSelectorModel.java | 27 +++++- .../META-INF/MANIFEST.MF | 3 +- .../{component.xml => componentBinder.xml} | 2 + .../jobengine/osgi/rest/ComponentBinder.java | 61 +++++++----- .../osgi/rest/jobengine/JobengineService.java | 4 +- .../osgi/rest/octopus/OctopusRESTService.java | 2 +- .../osgi/ws/nexio/NexioWSServlet.java | 26 +---- .../osgi/ws/nexio/NexioWSSocket.java | 6 +- 26 files changed, 279 insertions(+), 113 deletions(-) create mode 100644 server/user.jobengine.osgi.server/OSGI-INF/componentBinder.xml create mode 100644 server/user.jobengine.osgi.server/src/user/jobengine/osgi/server/ComponentBinder.java rename server/user.jobengine.osgi.services/OSGI-INF/{component.xml => componentBinder.xml} (82%) diff --git a/server/-product/pom.xml b/server/-product/pom.xml index 86ba36fb..211fe116 100644 --- a/server/-product/pom.xml +++ b/server/-product/pom.xml @@ -239,6 +239,9 @@ "lcd ${local.location}/plugins" "cd ${remote.location}/plugins" "synchronize remote" + "lcd ${local.location}/configuration" + "cd ${remote.location}/configuration" + "synchronize remote -filemask=config.ini" "exit" diff --git a/server/user.jobengine.executors/config/config.xml b/server/user.jobengine.executors/config/config.xml index e2277770..d4677b2f 100644 --- a/server/user.jobengine.executors/config/config.xml +++ b/server/user.jobengine.executors/config/config.xml @@ -21,7 +21,8 @@ - + + diff --git a/server/user.jobengine.executors/jobtemplates/archive-recording.xml b/server/user.jobengine.executors/jobtemplates/archive-recording.xml index 1b22d263..440285af 100644 --- a/server/user.jobengine.executors/jobtemplates/archive-recording.xml +++ b/server/user.jobengine.executors/jobtemplates/archive-recording.xml @@ -122,9 +122,6 @@ - - - diff --git a/server/user.jobengine.executors/jobtemplates/recreate-lowres.xml b/server/user.jobengine.executors/jobtemplates/recreate-lowres.xml index a7e33e0f..5a617a21 100644 --- a/server/user.jobengine.executors/jobtemplates/recreate-lowres.xml +++ b/server/user.jobengine.executors/jobtemplates/recreate-lowres.xml @@ -2,14 +2,104 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/CreateMissingLowresStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/CreateMissingLowresStep.java index ca0d2f83..d1092deb 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/CreateMissingLowresStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/CreateMissingLowresStep.java @@ -1,11 +1,11 @@ package user.jobengine.server.steps; -import java.nio.file.Files; import java.nio.file.Paths; import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; import user.jobengine.db.ItemDAOEx; import user.jobengine.db.ItemManager; @@ -15,41 +15,29 @@ import user.jobengine.server.IJobRuntime; public class CreateMissingLowresStep extends JobStep { private static final Logger logger = LogManager.getLogger(); - private static final String targetNamePattern = "%s"; - private String workPath = "/mnt/ISILON/ARCHIVE_RESTORE"; - private String transcoderPath = "/mnt/SELENIO"; - private String webPath = "/mediacube/data/lowres/www/video"; + private Marker marker; @StepEntry - public Object[] execute(IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { + public Object[] execute(String localHiresPath, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { + Object[] result = { null, null, "%s", null, 0, true }; + marker = jobRuntime.getMarker(); ItemDAOEx dao = new ItemDAOEx((ItemManager) jobEngine.getItemManager()); List medias = dao.getUntranscodedMedias(); - if (medias == null) - return null; - - int i = 1; - for (Media media : medias) { - String name = media.getMediaFilesName(); - logger.info("Processing {}", name); - restore(jobEngine, jobRuntime, media); - transcode(jobEngine, jobRuntime, media); - Files.delete(Paths.get(workPath, name)); - setProgress(i * 100 / medias.size()); - i++; + try { + if (medias == null || medias.size() == 0) { + throw new Exception("Nincs feldolgozandó hiány."); + } + + result[0] = medias.get(0); + ArchiveItem archiveItem = new ArchiveItem(); + archiveItem.setMediaFile(Paths.get(localHiresPath, medias.get(0).getMediaFilesName()).toString()); + result[1] = archiveItem; + } catch (Exception e) { + logger.catching(e); + logger.error(marker, e.getMessage()); + } finally { + setProgress(100); } - - return null; - } - - private void restore(IJobEngine jobEngine, IJobRuntime jobRuntime, Media media) throws Exception { - TSMRestoreStep restore = new TSMRestoreStep(); - restore.execute(media, workPath, targetNamePattern, null, 0, jobEngine, jobRuntime); - } - - private void transcode(IJobEngine jobEngine, IJobRuntime jobRuntime, Media media) throws Exception { - TranscodeSELENIOStep selenio = new TranscodeSELENIOStep(); - ArchiveItem archiveItem = new ArchiveItem(); - archiveItem.setMediaFile(media.getMediaFilesName()); - selenio.execute(workPath, archiveItem, media, transcoderPath, webPath, jobEngine, jobRuntime); + return result; } } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/MediaToolStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/MediaToolStep.java index f7c9bf6c..69810a4b 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/MediaToolStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/MediaToolStep.java @@ -1,5 +1,6 @@ package user.jobengine.server.steps; +import java.nio.file.Path; import java.nio.file.Paths; import org.apache.logging.log4j.LogManager; @@ -7,6 +8,7 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; import user.commons.mediatool.MediaInfo; +import user.jobengine.db.Media; import user.jobengine.server.IJobEngine; import user.jobengine.server.IJobRuntime; @@ -15,11 +17,21 @@ public class MediaToolStep extends JobStep { private Marker marker; @StepEntry - public Object[] execute(String filePath, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { + public Object[] execute(ArchiveItem archiveItem, Media mediaCubeMedia, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { marker = jobRuntime.getMarker(); - MediaInfo mi = new MediaInfo(Paths.get(filePath)); + + if (mediaCubeMedia.getLength() > 0) + return null; + + Path filePath = Paths.get(archiveItem.getMediaFile()); + MediaInfo mi = new MediaInfo(filePath); try { mi.process(); + long frames = mi.getFrames(); + if (frames > 0) { + mediaCubeMedia.setLength(frames); + mediaCubeMedia.modify(); + } } catch (Exception e) { logger.catching(e); logger.error(marker, "A '{}' média analizálása sikertelen. A rendszer üzenete: {}", filePath, e.getMessage()); diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/RecordingsArchiveItemBuilderStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/RecordingsArchiveItemBuilderStep.java index 2e0bfd0e..b476a20d 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/RecordingsArchiveItemBuilderStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/RecordingsArchiveItemBuilderStep.java @@ -174,7 +174,7 @@ public class RecordingsArchiveItemBuilderStep extends JobStep { int extPos = name.toLowerCase().lastIndexOf(LXFEXT); targetFileName = String.format("20%s-%s", Paths.get(mediaFile).getParent().getFileName(), name.substring(0, extPos)); if (targetFileName.length() > 32) { - targetFileName = targetFileName.substring(0, 27) + "_PGM"; + targetFileName = targetFileName.substring(0, 28) + "_PGM"; } logger.info(marker, "Az archiváló folyamat az '{}' anyagot archiválja.", mediaFile); } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/TranscodeFFAStranStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/TranscodeFFAStranStep.java index ae3802d8..3be025a2 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/TranscodeFFAStranStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/TranscodeFFAStranStep.java @@ -33,7 +33,7 @@ public class TranscodeFFAStranStep extends JobStep { private Marker marker; @StepEntry - public Object[] execute(ArchiveItem archiveItem, Media mediaCubeMedia, String transcoderAddress, String transcoderTemplateName, String localHiresTargetPath, + public Object[] execute(ArchiveItem archiveItem, Media mediaCubeMedia, String transcoderAddress, String transcoderTemplateName, String globalHiresSourcePath, String localLowresTargetPath, String webPath, boolean deleteSource, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { this.marker = jobRuntime.getMarker(); @@ -44,7 +44,6 @@ public class TranscodeFFAStranStep extends JobStep { check(archiveItem, "archiveItem"); check(transcoderAddress, "transcoderAddress"); check(transcoderTemplateName, "transcoderTemplateName"); - check(localHiresTargetPath, "localHiresTargetPath"); check(globalHiresSourcePath, "globalHiresSourcePath"); check(localLowresTargetPath, "localLowresTargetPath"); check(webPath, "webPath"); diff --git a/server/user.jobengine.executors/test-deploy-steps-to-bsh-main.bat b/server/user.jobengine.executors/test-deploy-steps-to-bsh-main.bat index 4ad3d7ef..aa3f6524 100644 --- a/server/user.jobengine.executors/test-deploy-steps-to-bsh-main.bat +++ b/server/user.jobengine.executors/test-deploy-steps-to-bsh-main.bat @@ -9,6 +9,9 @@ SET REMOTE_STEPS_LOCATION=/opt/test-mediacube/configuration/executors/user SET LOCAL_TEMPLATES_LOCATION=jobtemplates SET REMOTE_TEMPLATES_LOCATION=/opt/test-mediacube/configuration/jobtemplates + +SET LOCAL_CONFIG_LOCATION=config +SET REMOTE_CONFIG_LOCATION=/opt/test-mediacube/configuration/executors ECHO *** Deploy steps to server %REMOTE_HOST% *** WinSCP.com /command ^ @@ -26,5 +29,13 @@ SET REMOTE_TEMPLATES_LOCATION=/opt/test-mediacube/configuration/jobtemplates "synchronize remote" ^ "exit" + ECHO *** Deploy config to server %REMOTE_HOST% *** + WinSCP.com /command ^ + "open %REMOTE_SERVER_ADDRESS% -hostkey=""%REMOTE_SERVER_HOSTKEY%"" -timeout=60" ^ + "lcd %LOCAL_CONFIG_LOCATION%" ^ + "cd %REMOTE_CONFIG_LOCATION%" ^ + "synchronize remote -filemask=config.xml" ^ + "exit" + @ECHO ON \ No newline at end of file diff --git a/server/user.jobengine.osgi.commons/META-INF/MANIFEST.MF b/server/user.jobengine.osgi.commons/META-INF/MANIFEST.MF index 025f6868..331c6fe3 100644 --- a/server/user.jobengine.osgi.commons/META-INF/MANIFEST.MF +++ b/server/user.jobengine.osgi.commons/META-INF/MANIFEST.MF @@ -25,7 +25,6 @@ Export-Package: user.commons, user.commons.mediatool, user.commons.morpheus, user.commons.nexio, - user.commons.nexio.api, user.commons.nosql, user.commons.octopus, user.commons.rcc, diff --git a/server/user.jobengine.osgi.commons/src/user/commons/nexio/INexioAPI.java b/server/user.jobengine.osgi.commons/src/user/commons/nexio/INexioAPI.java index 8501e898..dc4256aa 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/nexio/INexioAPI.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/nexio/INexioAPI.java @@ -8,6 +8,7 @@ import com.ibm.nosql.json.api.DBObject; public interface INexioAPI { final String ENCODING = "ISO-8859-2"; - List getItems(Date modified, boolean itemsWithAgency); + NexioDispatcher getDispatcher(); + List getItems(Date modified, boolean itemsWithAgency); } diff --git a/server/user.jobengine.osgi.commons/src/user/commons/nexio/NexioAPI.java b/server/user.jobengine.osgi.commons/src/user/commons/nexio/NexioAPI.java index b8c95520..ba4306d0 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/nexio/NexioAPI.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/nexio/NexioAPI.java @@ -18,6 +18,14 @@ import user.commons.nosql.NoSQLUtils; public class NexioAPI implements INexioAPI { private static final Logger logger = LogManager.getLogger(); private static final String MODIFIEDTIMESTAMP = "modifiedtimestamp"; + private NexioDispatcher dispatcher; + + @Override + public NexioDispatcher getDispatcher() { + if (dispatcher == null) + dispatcher = new NexioDispatcher(); + return dispatcher; + } @Override public List getItems(Date modified, boolean itemsWithAgency) { diff --git a/server/user.jobengine.osgi.server/META-INF/MANIFEST.MF b/server/user.jobengine.osgi.server/META-INF/MANIFEST.MF index 78fa4bc5..c0fcecad 100644 --- a/server/user.jobengine.osgi.server/META-INF/MANIFEST.MF +++ b/server/user.jobengine.osgi.server/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Server Bundle-SymbolicName: user.jobengine.osgi.server;singleton:=true Bundle-Version: 1.0.0 -Service-Component: OSGI-INF/component.xml +Service-Component: OSGI-INF/component.xml, OSGI-INF/componentBinder.xml Import-Package: javax.servlet;version="3.1.0", javax.servlet.http;version="3.1.0", org.apache.logging.log4j;version="2.8.2", diff --git a/server/user.jobengine.osgi.server/OSGI-INF/component.xml b/server/user.jobengine.osgi.server/OSGI-INF/component.xml index 6e03ccbe..02af0a3f 100644 --- a/server/user.jobengine.osgi.server/OSGI-INF/component.xml +++ b/server/user.jobengine.osgi.server/OSGI-INF/component.xml @@ -1,5 +1,5 @@ - +