From 126c8103b53013d3cc9b9fb97cada7227364958e Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Fri, 13 Oct 2017 15:07:45 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30620 --- server/-configuration/scheduledjobs.json | 5 +- server/-product/DEPLOY-README.txt | 6 +- server/-product/mediacube.product | 70 ++++++++-------- .../jobtemplates/archive-material.xml | 14 +++- .../jobtemplates/archive-ondemand.xml | 80 +++++++++++-------- .../steps/ArchiveMaterialSubmitStep.java | 14 ++-- .../jobengine/server/steps/TSMBackupStep.java | 4 +- .../server/steps/TranscodeSELENIOStep.java | 55 ++++++++----- .../pages/search_items.zul | 8 +- .../jobengine/server/steps/KillDateFile.java | 42 ++++++++++ .../user/jobengine/zk/model/SearchModel.java | 12 ++- 11 files changed, 201 insertions(+), 109 deletions(-) create mode 100644 server/user.jobengine.osgi.server/src/user/jobengine/server/steps/KillDateFile.java diff --git a/server/-configuration/scheduledjobs.json b/server/-configuration/scheduledjobs.json index 9347880f..8a436610 100644 --- a/server/-configuration/scheduledjobs.json +++ b/server/-configuration/scheduledjobs.json @@ -7,7 +7,10 @@ "cronexpression": "0 0 0/1 1/1 * ? *", "parameters": [ {"name": "sourcePath", "value": "/mnt/ISILON/ARCHIVE", "type": "java.lang.String"}, - {"name": "globalSourcePath", "value": "\\\\10.10.1.100\\BRAAVOS\\ARCHIVE", "type": "java.lang.String"} + {"name": "globalSourcePath", "value": "\\\\10.10.1.100\\BRAAVOS\\ARCHIVE", "type": "java.lang.String"}, + {"name": "transcoderTargetPath", "value": "/mnt/SELENIO", "type": "java.lang.String"}, + {"name": "webPath", "value": "/mediacube/data/lowres/www/video", "type": "java.lang.String"}, + {"name": "killDateDays", "value": 1, "type": "java.lang.Integer"} ] }, { diff --git a/server/-product/DEPLOY-README.txt b/server/-product/DEPLOY-README.txt index 2d12684e..508dba7f 100644 --- a/server/-product/DEPLOY-README.txt +++ b/server/-product/DEPLOY-README.txt @@ -68,4 +68,8 @@ ISILON Windows mapping net use i: \\10.10.1.100\braavos /user:mediacube Broadca5T /persistent:no net use r: \\10.10.1.100\braavos /user:readonly readonly /persistent:no - \ No newline at end of file + + +Selenio +------- + mount -t cifs -o username=root,password=Broadca5T //10.10.1.71/Data/Output/MP4_H264_AAC \ No newline at end of file diff --git a/server/-product/mediacube.product b/server/-product/mediacube.product index 6c6422cf..29ee557b 100644 --- a/server/-product/mediacube.product +++ b/server/-product/mediacube.product @@ -9,43 +9,43 @@ -consoleLog -console 5555 - -Dfile.encoding=UTF-8 --agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888 --Djavax.ws.rs.ext.RuntimeDelegate=org.jboss.resteasy.spi.ResteasyProviderFactory - -#System --Dorg.eclipse.equinox.http.jetty.http.port=80 --Dorg.eclipse.epp.logging.aeri.skipReports=true --Declipse.ignoreApp=true --Dosgi.noShutdown=true --Djetty.home=./configuration/jetty --Djetty.etc.config.urls=etc/user-jetty.xml,etc/user-jetty-ssl.xml,etc/user-jetty-ssl-context.xml,etc/user-jetty-http.xml,etc/user-jetty-https.xml --Dlog4j.configurationFile=./configuration/log4j2.xml --Djobengine.loglevel=INFO --Djobengine.jobsteps.root=./configuration/executors --Djobengine.jobtemplates.root=./configuration/jobtemplates + -Dfile.encoding=UTF-8 +-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888 +-Djavax.ws.rs.ext.RuntimeDelegate=org.jboss.resteasy.spi.ResteasyProviderFactory + +#System +-Dorg.eclipse.equinox.http.jetty.http.port=80 +-Dorg.eclipse.epp.logging.aeri.skipReports=true +-Declipse.ignoreApp=true +-Dosgi.noShutdown=true +-Djetty.home=./configuration/jetty +-Djetty.etc.config.urls=etc/user-jetty.xml,etc/user-jetty-ssl.xml,etc/user-jetty-ssl-context.xml,etc/user-jetty-http.xml,etc/user-jetty-https.xml +-Dlog4j.configurationFile=./configuration/log4j2.xml +-Djobengine.loglevel=INFO +-Djobengine.jobsteps.root=./configuration/executors +-Djobengine.jobtemplates.root=./configuration/jobtemplates -Djobengine.jobscheduling.config=./configuration/scheduledjobs.json - #Database --Djobengine.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true; --Djobengine.db.user=db2admin --Djobengine.db.password=password --Djobengine.nosql.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true; --Djobengine.nosql.db.user=db2admin --Djobengine.nosql.db.password=password --Djobengine.nosql.db.schema=test - -#Octopus --Djobengine.octopus.api.address=http://10.10.1.11/api/v1 --Djobengine.octopus.api.user=mam --Djobengine.octopus.api.password=napocska - -#Selenio --Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl --Djobengine.selenio.projectfilepath=\\10.10.1.71\Data\Blueprints\MP4_H264_AAC_v4.zenium - -#Nexio --Dnexio.host=10.10.1.55 + #Database +-Djobengine.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true; +-Djobengine.db.user=db2admin +-Djobengine.db.password=password +-Djobengine.nosql.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true; +-Djobengine.nosql.db.user=db2admin +-Djobengine.nosql.db.password=password +-Djobengine.nosql.db.schema=test + +#Octopus +-Djobengine.octopus.api.address=http://10.10.1.11/api/v1 +-Djobengine.octopus.api.user=mam +-Djobengine.octopus.api.password=napocska + +#Selenio +-Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl +-Djobengine.selenio.projectfilepath=\\10.10.1.71\Data\Blueprints\MP4_H264_AAC_v4.zenium + +#Nexio +-Dnexio.host=10.10.1.56 -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts diff --git a/server/user.jobengine.executors/jobtemplates/archive-material.xml b/server/user.jobengine.executors/jobtemplates/archive-material.xml index bb9fd2bf..d8ec58f4 100644 --- a/server/user.jobengine.executors/jobtemplates/archive-material.xml +++ b/server/user.jobengine.executors/jobtemplates/archive-material.xml @@ -4,6 +4,9 @@ + + + @@ -30,6 +33,9 @@ + + + @@ -43,9 +49,13 @@ + + + + + + - - diff --git a/server/user.jobengine.executors/jobtemplates/archive-ondemand.xml b/server/user.jobengine.executors/jobtemplates/archive-ondemand.xml index 9f38a3bb..fe104fc4 100644 --- a/server/user.jobengine.executors/jobtemplates/archive-ondemand.xml +++ b/server/user.jobengine.executors/jobtemplates/archive-ondemand.xml @@ -1,37 +1,49 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveMaterialSubmitStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveMaterialSubmitStep.java index 234332c9..7f9cb2c4 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveMaterialSubmitStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveMaterialSubmitStep.java @@ -15,19 +15,23 @@ import user.jobengine.server.IJobRuntime; * @author robi */ public class ArchiveMaterialSubmitStep extends JobStep { - private static final String ARCHIVE = "Archiválás"; - private static final String GLOBAL_SOURCE_PATH = "globalSourcePath"; private static final Logger logger = LogManager.getLogger(); private static final String JOBTEMPLATE = "archive-material.xml"; + private static final String KILL_DATE_DAYS = "killDateDays"; + private static final String WEB_PATH = "webPath"; + private static final String TRANSCODER_TARGET_PATH = "transcoderTargetPath"; + private static final String ARCHIVE = "Archiválás"; + private static final String GLOBAL_SOURCE_PATH = "globalSourcePath"; private static final String ARCHIVE_ITEM = "archiveItem"; @StepEntry - public Object[] execute(String globalSourcePath, ArrayList archiveList, IJobEngine jobEngine, IJobRuntime jobRuntime) { + public Object[] execute(String globalSourcePath, ArrayList archiveList, String transcoderTargetPath, String webPath, int killDateDays, + IJobEngine jobEngine, IJobRuntime jobRuntime) { try { for (ArchiveItem archiveItem : archiveList) { try { - IJobRuntime submit = jobEngine.submit(JOBTEMPLATE, ARCHIVE, - ListUtils.asMap(ARCHIVE_ITEM, archiveItem, GLOBAL_SOURCE_PATH, globalSourcePath)); + IJobRuntime submit = jobEngine.submit(JOBTEMPLATE, ARCHIVE, ListUtils.asMap(ARCHIVE_ITEM, archiveItem, GLOBAL_SOURCE_PATH, globalSourcePath, + TRANSCODER_TARGET_PATH, transcoderTargetPath, WEB_PATH, webPath, KILL_DATE_DAYS, killDateDays)); } catch (Exception e) { if (archiveItem != null) archiveItem.removeCatchedFile(); diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMBackupStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMBackupStep.java index b3fb5dbd..9f77a2fa 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMBackupStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMBackupStep.java @@ -33,7 +33,7 @@ public class TSMBackupStep extends JobStep { private FileType fileType; @StepEntry - public Object[] execute(ArchiveItem archiveItem, Media mediaCubeMedia, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { + public Object[] execute(ArchiveItem archiveItem, Media mediaCubeMedia, int killDateDays, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { try { setAndCheck(archiveItem, mediaCubeMedia, jobEngine); @@ -59,6 +59,8 @@ public class TSMBackupStep extends JobStep { saveMetadata(mediaCubeMedia, sourceFileName, name); logger.info(getMarker(), "A {} állomány archiválása sikeres.", archiveItem.getMediaFile().toFile().getName()); + KillDateFile killDateFile = new KillDateFile(sourceMediaFile.getParent().toString(), sourceMediaFile.getFileName().toString()); + killDateFile.create(killDateDays); } catch (Exception e) { logger.catching(e); logger.error(getMarker(), "A {} állomány archiválása sikertelen. A rendszer hibaüzenete: {}", archiveItem.getMediaFile().toFile().getName(), diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/TranscodeSELENIOStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/TranscodeSELENIOStep.java index 67461133..c3f65319 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/TranscodeSELENIOStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/TranscodeSELENIOStep.java @@ -1,9 +1,11 @@ package user.jobengine.server.steps; -import java.io.File; +import java.io.IOException; import java.net.URL; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.util.Arrays; import java.util.List; @@ -13,8 +15,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import user.commons.StoreUri; -import user.commons.remotestore.RemoteStoreProtocol; import user.commons.selenio.wsclient.AudioSource; import user.commons.selenio.wsclient.Clip; import user.commons.selenio.wsclient.ClipList; @@ -22,7 +22,6 @@ import user.commons.selenio.wsclient.Exception_Exception; import user.commons.selenio.wsclient.FileSnapshot; import user.commons.selenio.wsclient.MediaFile; import user.commons.selenio.wsclient.State; -import user.commons.selenio.wsclient.TranscodeDestination; import user.commons.selenio.wsclient.TranscodeMgrWS; import user.commons.selenio.wsclient.TranscodeMgrWSService; import user.commons.selenio.wsclient.TranscodeRequest; @@ -48,6 +47,8 @@ public class TranscodeSELENIOStep extends JobStep { private IItemManager manager; private Store store; private FileType fileType; + private String transcoderTargetPath; + private String webPath; public TranscodeSELENIOStep() throws Exception { try { @@ -67,7 +68,7 @@ public class TranscodeSELENIOStep extends JobStep { } } - private TranscodeRequest buildTranscodeRequest(String projectFilePath, String sourceFilePath, String targetPath) throws java.lang.Exception { + private TranscodeRequest buildTranscodeRequest(String projectFilePath, String sourceFilePath) throws java.lang.Exception { Clip clip = new Clip(); MediaFile mediaFile = new MediaFile(); mediaFile.setFile(sourceFilePath); @@ -91,18 +92,19 @@ public class TranscodeSELENIOStep extends JobStep { transcodeRequest.setProject(project); transcodeRequest.setTranscodeSource(transcodeSource); - TranscodeDestination transcodeDestination = new TranscodeDestination(); + // TranscodeDestination transcodeDestination = new TranscodeDestination(); //transcodeDestination.setOutputWriteDirectory(outputPath); - transcodeDestination.setOutputPostMoveDirectory(targetPath); - transcodeRequest.setTranscodeDestination(transcodeDestination); + // transcodeDestination.setOutputPostMoveDirectory(targetPath); + // transcodeRequest.setTranscodeDestination(transcodeDestination); return transcodeRequest; } @StepEntry - public Object[] execute(String globalInputFolder, ArchiveItem archiveItem, Media mediaCubeMedia, IJobEngine jobEngine, IJobRuntime jobRuntime) - throws Exception { - if (StringUtils.isBlank(globalInputFolder)) + public Object[] execute(String globalSourcePath, ArchiveItem archiveItem, Media mediaCubeMedia, String transcoderTargetPath, String webPath, + IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { + + if (StringUtils.isBlank(globalSourcePath)) throw new NullPointerException("System is not configured properly, 'globalInputFolder' parameter missing."); manager = jobEngine.getItemManager(); @@ -114,14 +116,22 @@ public class TranscodeSELENIOStep extends JobStep { if (fileType == null) throw new NullPointerException("System is not configured properly, low-res file type definition missing."); - StoreUri sourceStoreUri = store.getSourceStoreUri(RemoteStoreProtocol.SMB); - if (sourceStoreUri == null) - throw new NullPointerException("System is not configured properly, low-res system store SMB store URI definition missing."); + if (StringUtils.isBlank(transcoderTargetPath)) + throw new NullPointerException("System is not configured properly, 'transcoderTargetPath' parameter missing."); + this.transcoderTargetPath = transcoderTargetPath; + + if (StringUtils.isBlank(webPath)) + throw new NullPointerException("System is not configured properly, 'webPath' parameter missing."); + this.webPath = webPath; + + // StoreUri sourceStoreUri = store.getSourceStoreUri(RemoteStoreProtocol.SMB); + // if (sourceStoreUri == null) + // throw new NullPointerException("System is not configured properly, low-res system store SMB store URI definition missing."); - Path inputPath = Paths.get(globalInputFolder, archiveItem.getMediaFile().toFile().getName()); + Path inputPath = Paths.get(globalSourcePath, archiveItem.getMediaFile().toFile().getName()); String sourceFilePath = inputPath.toString(); - String outputPath = sourceStoreUri.getRootPath(); - TranscodeRequest transcodeRequest = buildTranscodeRequest(projectFilePath, sourceFilePath, outputPath); + // String outputPath = sourceStoreUri.getRootPath(); + TranscodeRequest transcodeRequest = buildTranscodeRequest(projectFilePath, sourceFilePath); TranscodeTask transcodeTask = transcoder.submitTranscodeTask(transcodeRequest); if (transcodeTask == null) @@ -161,9 +171,16 @@ public class TranscodeSELENIOStep extends JobStep { throw new IndexOutOfBoundsException("There are more than 1 file in the response: " + transcodeTask.getId()); user.commons.selenio.wsclient.MediaFile selenioMediaFile = outputs.get(0); - File outFile = new File(selenioMediaFile.getFile()); - user.jobengine.db.MediaFile mediaFile = manager.createMediaFile(outFile.getName(), fileType, store, mediaCubeMedia); + String outFile = selenioMediaFile.getFile(); + outFile = outFile.substring(outFile.lastIndexOf("\\") + 1); + user.jobengine.db.MediaFile mediaFile = manager.createMediaFile(outFile, fileType, store, mediaCubeMedia); mediaFile.add(); + try { + Files.move(Paths.get(transcoderTargetPath, outFile), Paths.get(webPath, outFile), StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + logger.catching(e); + logger.error(getMarker(), "A {} állomány mozgatása a {} mappába nem sikerült.", outFile, webPath); + } } @SuppressWarnings("incomplete-switch") diff --git a/server/user.jobengine.osgi.server/pages/search_items.zul b/server/user.jobengine.osgi.server/pages/search_items.zul index 63dd7158..31db0bb3 100644 --- a/server/user.jobengine.osgi.server/pages/search_items.zul +++ b/server/user.jobengine.osgi.server/pages/search_items.zul @@ -63,16 +63,16 @@
- + - +
- +