"cronexpression": "0 0 0/1 1/1 * ? *",\r
"parameters": [ \r
{"name": "sourcePath", "value": "\\\\10.10.254.74\\temp_isilon\\NEXIO", "type": "java.lang.String"},\r
+ {"name": "targetPath", "value": "\\\\10.10.1.74\\MAM-Proxy_input", "type": "java.lang.String"},\r
{"name": "nexioPort", "value": 2098, "type": "java.lang.Integer"},\r
{"name": "nexioUserName", "value": "administrator", "type": "java.lang.String"},\r
{"name": "nexioPassword", "value": "system", "type": "java.lang.String"}\r
<?xml version="1.0" encoding="UTF-8"?>\r
-<jobtemplate name="Anyag archiválása" multiInstance="true">\r
+<jobtemplate name="Anyag archiválása" multiInstance="true">\r
<declarations>\r
<parameters>\r
- <parameter name="sourcePath" type="java.lang.String"/>\r
- <parameter name="nexioPort" type="java.lang.Integer"/>\r
- <parameter name="nexioUserName" type="java.lang.String"/>\r
- <parameter name="nexioPassword" type="java.lang.String"/>\r
+ <parameter name="localSourcePath" type="java.lang.String" />\r
+ <parameter name="targetPath" type="java.lang.String" />\r
+ <parameter name="nexioPort" type="java.lang.Integer" />\r
+ <parameter name="nexioUserName" type="java.lang.String" />\r
+ <parameter name="nexioPassword" type="java.lang.String" />\r
+ <parameter name="transcoderAddress" type="java.lang.String" />\r
+ <parameter name="transcoderTemplateName" type="java.lang.String" />\r
+ <parameter name="globalSourcePath" type="java.lang.String" />\r
+ <parameter name="localTranscoderTargetPath" type="java.lang.String" />\r
+ <parameter name="webPath" type="java.lang.String" />\r
+ <parameter name="deleteSource" type="java.lang.Boolean" />\r
</parameters>\r
<variables>\r
<variable name="archiveItem" type="user.jobengine.server.steps.ArchiveItem" />\r
<variable name="targetFileName" type="java.lang.String" />\r
+ <variable name="mediaCubeMedia" type="user.jobengine.db.Media" />\r
+ <variable name="killDateDays" type="java.lang.Integer" />\r
</variables>\r
</declarations>\r
<commands>\r
<calljobstep type="user.jobengine.server.steps.RecordingsArchiveItemBuilderStep" weight="1">\r
<inputs>\r
<input>\r
- <parameter name="sourcePath" />\r
+ <parameter name="localSourcePath" />\r
</input>\r
</inputs>\r
<outputs>\r
<parameter name="nexioPassword" />\r
</input>\r
</inputs>\r
+ </calljobstep>\r
+ <calljobstep type="user.jobengine.server.steps.DownloadRecordingFromNexioStep" weight="2">\r
+ <inputs>\r
+ <input>\r
+ <variable name="archiveItem" />\r
+ </input>\r
+ <input>\r
+ <parameter name="targetPath" />\r
+ </input>\r
+ <input>\r
+ <variable name="targetFileName" />\r
+ </input>\r
+ <input>\r
+ <parameter name="nexioPort" />\r
+ </input>\r
+ <input>\r
+ <parameter name="nexioUserName" />\r
+ </input>\r
+ <input>\r
+ <parameter name="nexioPassword" />\r
+ </input>\r
+ </inputs>\r
<outputs>\r
<output>\r
+ <variable name="killDateDays" />\r
+ </output>\r
+ </outputs>\r
+ </calljobstep>\r
+ <calljobstep type="user.jobengine.server.steps.MetadataTransformStep" weight="1">\r
+ <inputs>\r
+ <input>\r
<variable name="archiveItem" />\r
+ </input>\r
+ </inputs>\r
+ <outputs>\r
+ <output>\r
+ <variable name="mediaCubeMedia" />\r
</output>\r
</outputs>\r
</calljobstep>\r
+<!-- <calljobstep type="user.jobengine.server.steps.TSMBackupStep" weight="2"> -->\r
+<!-- <inputs> -->\r
+<!-- <input> -->\r
+<!-- <variable name="archiveItem" /> -->\r
+<!-- </input> -->\r
+<!-- <input> -->\r
+<!-- <variable name="mediaCubeMedia" /> -->\r
+<!-- </input> -->\r
+<!-- <input> -->\r
+<!-- <variable name="killDateDays" /> -->\r
+<!-- </input> -->\r
+<!-- </inputs> -->\r
+<!-- </calljobstep> -->\r
+ <calljobstep type="user.jobengine.server.steps.TranscodeFFAStranStep" weight="1">\r
+ <inputs>\r
+ <input>\r
+ <variable name="archiveItem" />\r
+ </input>\r
+ <input>\r
+ <variable name="mediaCubeMedia" />\r
+ </input>\r
+ <input>\r
+ <parameter name="transcoderAddress" />\r
+ </input>\r
+ <input>\r
+ <parameter name="transcoderTemplateName" />\r
+ </input>\r
+ <input>\r
+ <parameter name="localSourcePath" />\r
+ </input>\r
+ <input>\r
+ <parameter name="globalSourcePath" />\r
+ </input>\r
+ <input>\r
+ <parameter name="localTranscoderTargetPath" />\r
+ </input>\r
+ <input>\r
+ <parameter name="webPath" />\r
+ </input>\r
+ <input>\r
+ <parameter name="deleteSource" />\r
+ </input>\r
+ </inputs>\r
+ </calljobstep>\r
</commands>\r
</jobtemplate>
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.io.File;\r
+import java.nio.file.Paths;\r
+\r
+import org.apache.commons.lang.StringUtils;\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+import org.apache.logging.log4j.Marker;\r
+import org.apache.logging.log4j.message.Message;\r
+import org.apache.logging.log4j.message.ParameterizedMessage;\r
+\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+import com.ibm.nosql.json.api.DB;\r
+import com.ibm.nosql.json.api.DBCollection;\r
+\r
+import user.commons.RemoteFile;\r
+import user.commons.StoreUri;\r
+import user.commons.nosql.NoSQLUtils;\r
+import user.commons.remotestore.IProgressEventListener;\r
+import user.commons.remotestore.IStatusEventListener;\r
+import user.commons.remotestore.ProgressEvent;\r
+import user.commons.remotestore.RemoteStoreProtocol;\r
+import user.commons.remotestore.StatusEvent;\r
+import user.jobengine.db.IItemManager;\r
+import user.jobengine.server.IJobEngine;\r
+import user.jobengine.server.IJobRuntime;\r
+\r
+public class DownloadRecordingFromNexioStep extends JobStep {\r
+ private static final String MXFEXT = ".MXF";\r
+ private static final String NEXIOCLIPS = "nexioclips";\r
+ private static final String LONGNAMEID = "longnameid";\r
+ private static final String DURATION = "duration";\r
+\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ private IItemManager manager;\r
+ private StoreUri targetUri;\r
+ private StoreUri sourceUri;\r
+ private Marker marker;\r
+ private DBCollection clipsCollection;\r
+\r
+ private int check(int value, String name) {\r
+ if (value == 0) {\r
+ logger.error(marker, "A folyamat '{}' bemeneti paramétere 0.", name);\r
+ throw new NullPointerException(String.format("System is not configured properly, missing '%s' input parameter.", name));\r
+ }\r
+ return value;\r
+ }\r
+\r
+ private String check(String value, String name) {\r
+ if (StringUtils.isBlank(value)) {\r
+ logger.error(marker, "A folyamat '{}' bemeneti paramétere üres.", name);\r
+ throw new NullPointerException(String.format("System is not configured properly, missing '%s' input parameter.", name));\r
+ }\r
+ return value;\r
+ }\r
+\r
+ @StepEntry\r
+ public Object[] execute(ArchiveItem archiveItem, String targetPath, String targetFileName, int nexioPort, String nexioUserName, String nexioPassword,\r
+ IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception {\r
+ marker = jobRuntime.getMarker();\r
+ manager = jobEngine.getItemManager();\r
+ setAndCheck(archiveItem, targetPath, targetFileName, nexioPort, nexioUserName, nexioPassword);\r
+ String sourceFileName = targetFileName;\r
+ try {\r
+ final IJobRuntime runtime = jobRuntime;\r
+ targetUri.addProgressListener(new IProgressEventListener() {\r
+ @Override\r
+ public void progressChanged(ProgressEvent evt) {\r
+ runtime.incrementProgress(evt.getProgress());\r
+ }\r
+ });\r
+ targetUri.addStatusListener(new IStatusEventListener() {\r
+ @Override\r
+ public void statusChanged(StatusEvent evt) {\r
+ evt.setCancel(!canContinue());\r
+ }\r
+ });\r
+\r
+ String targetName = targetFileName + MXFEXT;\r
+\r
+ File targetFile = Paths.get(targetPath, targetName).toFile();\r
+ if (targetFile.exists())\r
+ throw new Exception("Exists!");\r
+\r
+ RemoteFile remoteFile = sourceUri.transferFrom(targetUri, sourceFileName, targetName);\r
+\r
+ logger.info(marker, "Az '{}' állomány letöltése sikeres volt '{}' néven.", sourceFileName, targetFile);\r
+\r
+ BasicDBObject clip = (BasicDBObject) clipsCollection.findOne(new BasicDBObject(LONGNAMEID, sourceFileName));\r
+ if (clip == null)\r
+ throw new Exception("Clip not exists in NEXIO");\r
+\r
+ long duration = NoSQLUtils.asLong(clip, DURATION);\r
+ if (duration == 0)\r
+ throw new Exception("Clip duration is 0");\r
+\r
+ archiveItem.setDuration(duration);\r
+ archiveItem.setMediaFile(targetFile.toString());\r
+\r
+ RemoteFile sourceRemoteFile = sourceUri.getRemoteFile(sourceFileName);\r
+ sourceUri.delete(sourceRemoteFile);\r
+\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ if (!archiveItem.removeCatchedFile())\r
+ logger.error(getMarker(), "A {} állomány .catched jelző állománya nem törölhető.", new File(archiveItem.getMediaFile()).getName());\r
+ Message m = new ParameterizedMessage("Az '{}' állomány feldolgozása sikertelen. A rendszer hibaüzenete: {}", sourceFileName, e.getMessage());\r
+ logger.error(marker, m);\r
+ throw new Exception(m.getFormattedMessage());\r
+ }\r
+ return new Object[] { 0 };\r
+ }\r
+\r
+ private void setAndCheck(ArchiveItem archiveItem, String targetPath, String targetFileName, int nexioPort, String nexioUserName, String nexioPassword)\r
+ throws Exception {\r
+ DB db = NoSQLUtils.getNoSQLDB();\r
+ if (db == null) {\r
+ logger.error(marker, "Az NoSQL adatkezelő réteg nem elérhető.");\r
+ throw new NullPointerException("Internal error, missing NoSQL DB reference.");\r
+ }\r
+\r
+ clipsCollection = db.getCollection(NEXIOCLIPS);\r
+\r
+ if (archiveItem == null) {\r
+ logger.error(marker, "A folyamat 'archiveItem' bemeneti paramétere üres.");\r
+ throw new NullPointerException("Internal error, missing 'archiveItem'.");\r
+ }\r
+\r
+ if (archiveItem.getMediaFile() == null) {\r
+ logger.error(marker, "A folyamat 'archiveItem.mediaFile' paramétere üres.");\r
+ throw new NullPointerException("Internal error, missing 'archiveItem.mediaFile'.");\r
+ }\r
+\r
+ check(targetFileName, "targetFileName");\r
+ check(targetPath, "targetPath");\r
+\r
+ String nexioHost = System.getProperty("nexio.host");\r
+ if (StringUtils.isBlank(nexioHost)) {\r
+ logger.error(marker, "A 'nexio.host' rendszer paraméter nem található.");\r
+ throw new NullPointerException("System is not configured properly, 'jobengine.selenio.address' startup parameter missing.");\r
+ }\r
+ check(nexioPort, "nexioPort");\r
+ check(nexioUserName, "nexioUserName");\r
+ check(nexioPassword, "nexioPassword");\r
+\r
+ sourceUri = manager.createStoreUri(RemoteStoreProtocol.FTP, nexioHost);\r
+ sourceUri.setPortNumber(nexioPort);\r
+ sourceUri.setUserName(nexioUserName);\r
+ sourceUri.setPassword(nexioPassword);\r
+ if (sourceUri == null) {\r
+ logger.error(marker, "A forrás nem elérhető.");\r
+ throw new NullPointerException("Internal error, missing 'sourceUri'.");\r
+ }\r
+\r
+ targetUri = manager.createStoreUri(RemoteStoreProtocol.LOCAL, targetPath);\r
+ if (targetUri == null) {\r
+ logger.error(marker, "A cél nem elérhető.");\r
+ throw new NullPointerException("Internal error, missing 'targetUri'.");\r
+ }\r
+\r
+ }\r
+\r
+}\r
import user.jobengine.server.IJobRuntime;\r
\r
public class RecordingsArchiveItemBuilderStep extends JobStep {\r
- private static final String RECORDING = "Visszarögzítés";\r
+ private static final String MEDIATYPE = "Visszarögzített";\r
private static final Logger logger = LogManager.getLogger();\r
private static final String STATUSFOLDER = ".STATUS";\r
private static final String LXFEXT = ".lxf";\r
logger.error(marker, "A '{}' anyaghoz nem található tükör '{}' kezdéssel, ezért nem archiválható.", clipName, scheduledStart);\r
return null;\r
}\r
- //DB db = NoSQLUtils.getNoSQLDB();\r
-\r
- //\r
- // BasicDBObject dbObject = (BasicDBObject) JSONUtil.jsonToDbObject(new String(readAllBytes));\r
- // if (dbObject == null)\r
- // throw new NullPointerException("Can not parse JSON file: " + jsonFilePath);\r
result = processRundow(octopusAPI, rundown);\r
if (result == null)\r
return null;\r
\r
result.setMediaTitle(clipName);\r
- result.setMediaType(RECORDING);\r
+ result.setMediaType(MEDIATYPE);\r
result.setMediaFile(mediaFilePath.toString());\r
result.setCatchedFile(catchedFilePath.toString());\r
- // result.setDuration(NoSQLUtils.asLong(dbObject, DURATION));\r
} catch (Exception e) {\r
logger.catching(e);\r
logger.error(getJobRuntime().getMarker(), "A metaadat nem elérhető. A rendszer üzenete: {}", e.getMessage());\r
return result;\r
}\r
\r
- private void createCatchedFile(Path catchedFilePath) throws Exception {\r
+ private void createCatchedFile(Path catchedFilePath) throws IOException {\r
try {\r
EscortFiles.ensureUNCFolder(catchedFilePath.getParent());\r
Files.createFile(catchedFilePath);\r
- } catch (Exception e) {\r
+ } catch (IOException e) {\r
logger.catching(e);\r
logger.error(marker, "A '{}' jelzőfájl nem hozható létre. A rendszer üzenete: {}", catchedFilePath, e.getMessage());\r
throw e;\r
}\r
\r
@StepEntry\r
- public Object[] execute(String sourcePath, IJobEngine jobEngine, IJobRuntime jobRuntime) {\r
+ public Object[] execute(String sourcePath, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception {\r
final ArchiveItem[] archiveItems = { null };\r
marker = getJobRuntime().getMarker();\r
try {\r
ArchiveItem item = null;\r
try {\r
item = processPathItem(file);\r
- } catch (Exception e) {\r
+ } catch (IOException e) {\r
logger.catching(e);\r
logger.error(marker, "Az '{}' állomány feldolgozása sikertelen. A rendszer hibaüzenete: {}", file, e.getMessage());\r
+ throw e;\r
}\r
if (item == null) {\r
result = FileVisitResult.CONTINUE;\r
} catch (Exception e) {\r
logger.catching(e);\r
logger.error(marker, "Az '{}' mappa elérése sikertelen. A rendszer hibaüzenete: {}", sourcePath, e.getMessage());\r
+ throw e;\r
} finally {\r
}\r
ArchiveItem archiveItem = archiveItems[0];\r
String targetFileName = null;\r
\r
- if (archiveItem == null || archiveItem.getMediaFile() == null)\r
+ if (archiveItem == null || archiveItem.getMediaFile() == null) {\r
logger.warn(marker, "Az archiváló folyamat nem talált új anyagot.");\r
- else {\r
+ throw new Exception("No media to archive");\r
+ } else {\r
String mediaFile = archiveItem.getMediaFile();\r
String name = new File(mediaFile).getName();\r
int extPos = name.toLowerCase().lastIndexOf(LXFEXT);\r
return CalendarUtils.createCalendar(CalendarUtils.createCalendar(recordDate), timePart).getTime();\r
}\r
\r
- private ArchiveItem processPathItem(Path mediaFilePath) throws Exception {\r
+ private ArchiveItem processPathItem(Path mediaFilePath) throws IOException {\r
File mediaFile = mediaFilePath.toFile();\r
\r
Path dotStorePath = Paths.get(mediaFilePath.getParent().toString(), STATUSFOLDER);\r
}\r
result.setMediaHouseId(result.getItemHouseId());\r
result.setMediaDescription(sb.toString());\r
+ //TODO\r
+ if (result.getMediaDescription() != null && result.getMediaDescription().length() > 5000)\r
+ result.setMediaDescription(result.getMediaDescription().substring(0, 5000));\r
return result;\r
}\r
}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.nio.file.Files;\r
+import java.nio.file.Path;\r
+import java.nio.file.Paths;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+import org.apache.logging.log4j.Marker;\r
+import org.apache.logging.log4j.message.Message;\r
+import org.apache.logging.log4j.message.ParameterizedMessage;\r
+\r
+import user.commons.ffastrans.FFAStransAPI;\r
+import user.commons.ffastrans.IFFAStransAPI;\r
+import user.jobengine.db.FileType;\r
+import user.jobengine.db.IItemManager;\r
+import user.jobengine.db.Media;\r
+import user.jobengine.db.Store;\r
+import user.jobengine.server.IJobEngine;\r
+import user.jobengine.server.IJobRuntime;\r
+\r
+public class TranscodeFFAStranStep extends JobStep {\r
+ private static final String MP4EXT = ".mp4";\r
+ private static final String MXFEXT = ".MXF";\r
+ private static final String LOWRES_FILETYPE = "Low-res";\r
+ private static final Logger logger = LogManager.getLogger();\r
+ private IItemManager manager;\r
+ private Store store;\r
+ private FileType fileType;\r
+ private Media mediaCubeMedia;\r
+ private Marker marker;\r
+\r
+ @StepEntry\r
+ public Object[] execute(ArchiveItem archiveItem, Media mediaCubeMedia, String transcoderAddress, String transcoderTemplateName, String localHiresSourcePath,\r
+ String globalHiresSourcePath, String localLowresTargetPath, String webPath, String sourcePath, boolean deleteSource, IJobEngine jobEngine,\r
+ IJobRuntime jobRuntime) throws Exception {\r
+ marker = jobRuntime.getMarker();\r
+ manager = jobEngine.getItemManager();\r
+ store = check(manager.getSystemStore(true), "lowres Store");\r
+ fileType = check(manager.getFileType(LOWRES_FILETYPE), "lowres FileType");\r
+ mediaCubeMedia = check(mediaCubeMedia, "mediaCubeMedia");\r
+ check(archiveItem, "archiveItem");\r
+ check(transcoderAddress, "transcoderAddress");\r
+ check(transcoderTemplateName, "transcoderTemplateName");\r
+ check(localHiresSourcePath, "localHiresSourcePath");\r
+ check(globalHiresSourcePath, "globalHiresSourcePath");\r
+ check(localLowresTargetPath, "localLowresTargetPath");\r
+ check(webPath, "webPath");\r
+\r
+ File sourceMediaFile = new File(archiveItem.getMediaFile());\r
+ String sourceFileName = sourceMediaFile.getName();\r
+ String details = String.format("%s (%d bytes)", sourceFileName, sourceMediaFile.length());\r
+ try {\r
+ String sourceFile = sourceMediaFile.toString().replace(localHiresSourcePath, globalHiresSourcePath);\r
+ IFFAStransAPI api = new FFAStransAPI(transcoderAddress, p -> {\r
+ jobRuntime.incrementProgress(p);\r
+ });\r
+ api.submit(transcoderTemplateName, sourceFile);\r
+ jobRuntime.setDescription(String.format("%s: %s", jobRuntime.getDescription(), details));\r
+ api.monitor(1000);\r
+ Path targetPath = Paths.get(localLowresTargetPath, sourceFileName.replace(MXFEXT, MP4EXT));\r
+ postprocess(targetPath, webPath);\r
+ if (deleteSource)\r
+ sourceMediaFile.delete();\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ Message m = new ParameterizedMessage("Az '{}' állomány átkódolása sikertelen. A rendszer hibaüzenete: {}", details, e.getMessage());\r
+ logger.error(marker, m);\r
+ throw new Exception(m.getFormattedMessage());\r
+ }\r
+ return null;\r
+ }\r
+\r
+ private void postprocess(Path transcodedFilePath, String webPath) {\r
+ try {\r
+ String transcodedFileName = transcodedFilePath.getFileName().toString();\r
+ if (transcodedFileName.indexOf(".") > 2) {\r
+ Path subdir = Paths.get(transcodedFileName.substring(0, 1), transcodedFileName.substring(1, 2), transcodedFileName.substring(2, 3));\r
+ manager.createMediaFile(Paths.get(subdir.toString(), transcodedFileName).toString(), fileType, store, mediaCubeMedia).add();\r
+ EscortFiles.ensureUNCFolder(webPath, subdir.toString());\r
+ Files.move(transcodedFilePath, Paths.get(webPath, subdir.toString(), transcodedFileName));\r
+ } else {\r
+ manager.createMediaFile(transcodedFileName, fileType, store, mediaCubeMedia).add();\r
+ Files.move(transcodedFilePath, Paths.get(webPath, transcodedFileName));\r
+ }\r
+ } catch (IOException e) {\r
+ logger.catching(e);\r
+ logger.error(marker, "A '{}' állomány mozgatása a '{}' mappába nem sikerült.", transcodedFilePath, webPath);\r
+ }\r
+ }\r
+\r
+}\r
import user.commons.RemoteFile;\r
import user.commons.StoreUri;\r
import user.commons.nosql.NoSQLUtils;\r
-import user.commons.octopus.OctopusAPI;\r
import user.commons.remotestore.IProgressEventListener;\r
import user.commons.remotestore.IStatusEventListener;\r
import user.commons.remotestore.ProgressEvent;\r
public class UploadRecordingToNexioStep extends JobStep {\r
private static final Logger logger = LogManager.getLogger();\r
\r
- private OctopusAPI octopusAPI;\r
private IItemManager manager;\r
private DB db;\r
private StoreUri sourceUri;\r
marker = jobRuntime.getMarker();\r
manager = jobEngine.getItemManager();\r
setAndCheck(archiveItem, targetFileName, nexioPort, nexioUserName, nexioPassword);\r
- String sourceFileName = new File(archiveItem.getMediaFile()).getName();\r
+ File sourceFile = new File(archiveItem.getMediaFile());\r
+ String sourceFileName = sourceFile.getName();\r
try {\r
+ final IJobRuntime runtime = jobRuntime;\r
sourceUri.addProgressListener(new IProgressEventListener() {\r
@Override\r
public void progressChanged(ProgressEvent evt) {\r
- setProgress(evt.getProgress());\r
+ runtime.incrementProgress(evt.getProgress());\r
}\r
});\r
sourceUri.addStatusListener(new IStatusEventListener() {\r
\r
RemoteFile remoteFile = sourceUri.transferFrom(targetUri, sourceFileName, targetFileName);\r
\r
- logger.info(marker, "Az '{}' állomány feltöltése sikeres volt '{}' néven.", sourceFileName, targetFileName);\r
+ logger.info(marker, "Az '{}' állomány feltöltése sikeres volt '{}' néven.", sourceFile, targetFileName);\r
} catch (Exception e) {\r
logger.catching(e);\r
- Message m = new ParameterizedMessage("Az '{}' állomány feltöltése sikertelen. A rendszer hibaüzenete: {}", sourceFileName, e.getMessage());\r
+ if (!archiveItem.removeCatchedFile())\r
+ logger.error(getMarker(), "A {} állomány .catched jelző állománya nem törölhető.", new File(archiveItem.getMediaFile()).getName());\r
+ Message m = new ParameterizedMessage("Az '{}' állomány feltöltése '{}' néven sikertelen. A rendszer hibaüzenete: {}", sourceFile, targetFileName,\r
+ e.getMessage());\r
logger.error(marker, m);\r
throw new Exception(m.getFormattedMessage());\r
}\r
- return null;\r
+ return new Object[] {};\r
}\r
\r
private void setAndCheck(ArchiveItem archiveItem, String targetFileName, int nexioPort, String nexioUserName, String nexioPassword) throws Exception {\r
check(nexioPassword, "nexioPassword");\r
\r
targetUri = manager.createStoreUri(RemoteStoreProtocol.FTP, nexioHost);\r
+ targetUri.setRootPath("LXF");\r
targetUri.setPortNumber(nexioPort);\r
targetUri.setUserName(nexioUserName);\r
targetUri.setPassword(nexioPassword);\r
@ECHO OFF\r
\r
SET REMOTE_HOST=10.10.1.29\r
-SET REMOTE_LOCATION=/opt/test-mediacube/configuration/executors\r
SET REMOTE_SERVER_HOSTKEY=ssh-ed25519 256 ea:ab:67:70:79:63:2f:6a:34:81:48:e2:b9:dd:ca:d4\r
SET REMOTE_SERVER_ADDRESS=scp://root:password@%REMOTE_HOST%\r
+\r
SET LOCAL_STEPS_LOCATION=bin/user/jobengine/server/steps\r
-SET LOCAL_CONFIG_LOCATION=config\r
+SET REMOTE_STEPS_LOCATION=/opt/test-mediacube/configuration/executors\r
+\r
+SET LOCAL_TEMPLATES_LOCATION=jobtemplates\r
+SET REMOTE_TEMPLATES_LOCATION=/opt/test-mediacube/configuration/jobtemplates\r
\r
- ECHO *** Begin deploy steps to server %REMOTE_HOST% ***\r
- ECHO --- Deploying\r
- \r
+ ECHO *** Deploy steps to server %REMOTE_HOST% ***\r
WinSCP.com /command ^\r
"open %REMOTE_SERVER_ADDRESS% -hostkey=""%REMOTE_SERVER_HOSTKEY%"" -timeout=60" ^\r
- "cd %REMOTE_LOCATION%" ^\r
"lcd %LOCAL_STEPS_LOCATION%" ^\r
+ "cd %REMOTE_STEPS_LOCATION%" ^\r
"synchronize remote" ^\r
- "lcd ..\" ^\r
- "lcd ..\" ^\r
- "lcd ..\" ^\r
- "lcd ..\" ^\r
- "lcd ..\" ^\r
- "lcd %LOCAL_CONFIG_LOCATION%" ^\r
- "synchronize remote -filemask=config.xml" ^\r
"exit"\r
- \r
- ECHO *** Completed ***\r
-@ECHO ON\r
\r
-REM "cd .." ^\r
-REM "synchronize remote -filemask=scheduledjobs.json" ^\r
+ ECHO *** Deploy templates to server %REMOTE_HOST% ***\r
+ WinSCP.com /command ^\r
+ "open %REMOTE_SERVER_ADDRESS% -hostkey=""%REMOTE_SERVER_HOSTKEY%"" -timeout=60" ^\r
+ "lcd %LOCAL_TEMPLATES_LOCATION%" ^\r
+ "cd %REMOTE_TEMPLATES_LOCATION%" ^\r
+ "synchronize remote" ^\r
+ "exit"\r
+\r
+@ECHO ON\r
\r
Bundle-ClassPath: .
Service-Component: OSGI-INF/nexioAPI.xml, OSGI-INF/octopusAPI.xml
Export-Package: user.commons,
+ user.commons.ffastrans,
user.commons.ftp,
user.commons.logging,
user.commons.morpheus,
import javax.ws.rs.core.MediaType;\r
import javax.ws.rs.core.Response;\r
\r
+import org.apache.commons.lang.StringUtils;\r
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;\r
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;\r
\r
\r
public class FFAStransAPI implements IFFAStransAPI {\r
\r
- public static void main(String[] args) throws Exception {\r
+ public interface IProgressChangedListener {\r
+ void onProgressChanged(int progress);\r
+ }\r
\r
- IFFAStransAPI api = new FFAStransAPI("http://10.10.1.74:65445/api/json/v1/");\r
- List<BasicDBObject> workflows = api.getWorkflows();\r
- for (BasicDBObject workflow : workflows) {\r
- //System.out.println(workflow.toPrettyString(null));\r
- if (!"MAM-Proxy".equals(workflow.getString("wf_name")))\r
- continue;\r
- long wfID = workflow.getLong("wf_id");\r
- System.out.println("MAM-Proxy wf_id: " + wfID);\r
-\r
- String path = "\\\\PROXY-TRANSCODER-01\\MAM-Proxy_input\\test_09.mxf";\r
- String jobID = api.submit(wfID, path);\r
- System.out.println("Submited: " + jobID);\r
-\r
- String jobStart = null;\r
- while (true) {\r
- Thread.sleep(1000);\r
- BasicDBObject status = api.getStatus(jobID);\r
- if (status != null) {\r
- System.out.println("Status: " + status.toPrettyString(null));\r
- if (jobStart == null)\r
- jobStart = status.getString("job_start");\r
- } else {\r
- BasicDBObject history = api.getHistory(jobStart);\r
- System.out.println("History: " + history.toPrettyString(null));\r
- break;\r
- }\r
+ public static void main(String[] args) throws Exception {\r
\r
+ for (int i = 0; i < 1; i++) {\r
+ IFFAStransAPI api = new FFAStransAPI("http://10.10.1.74:65445/api/json/v1/", p -> {\r
+ System.out.println("Progress: " + p);\r
+ });\r
+\r
+ String inputFile = "\\\\10.10.254.74\\temp_isilon\\NEXIO\\HIRADO\\180201\\0700_hirado_CLN_-_CS.lxf";\r
+ api.submit("MAM_proxy_copy", inputFile);\r
+ try {\r
+ api.monitor(1000);\r
+ } catch (Exception e) {\r
+ System.out.println(e.getMessage());\r
}\r
+ // try {\r
+ //\r
+ // String outputFile = "\\\\10.10.1.74\\MAM-Proxy_output\\20180201-0700_hirado_TEST-_CS.mp4";\r
+ // Path outputFilePath = Paths.get(outputFile);\r
+ // File file = outputFilePath.toFile();\r
+ // if (!file.exists())\r
+ // Thread.sleep(2000);\r
+ // Files.delete(outputFilePath);\r
+ // } catch (Exception e) {\r
+ // System.out.println(e.getMessage());\r
+ // }\r
+\r
}\r
}\r
\r
private ResteasyWebTarget webTarget;\r
\r
- public FFAStransAPI(String apiAddress) {\r
+ private IProgressChangedListener listener;\r
+\r
+ private String inputFile;\r
+\r
+ private String jobId;\r
+\r
+ public FFAStransAPI(String apiAddress, IProgressChangedListener listener) {\r
+ this.listener = listener;\r
webTarget = new ResteasyClientBuilder().build().target(apiAddress);\r
}\r
\r
for (BasicDBObject job : jobs) {\r
if (job == null)\r
continue;\r
- if (jobStart.equals(job.getString("job_start"))) {\r
+\r
+ String job_start = NoSQLUtils.asString(job, "job_start");\r
+ if (jobStart.equals(job_start)) {\r
result = job;\r
break;\r
}\r
return result;\r
}\r
\r
+ private long getWorkflowId(String workflowName, List<BasicDBObject> workflows, long wfID) {\r
+ for (BasicDBObject workflow : workflows) {\r
+ if (!workflowName.equals(workflow.getString("wf_name")))\r
+ continue;\r
+ wfID = workflow.getLong("wf_id");\r
+ }\r
+ return wfID;\r
+ }\r
+\r
@Override\r
public List<BasicDBObject> getWorkflows() {\r
ResteasyWebTarget target = webTarget.path("workflows");\r
}\r
\r
@Override\r
- public String submit(long wfID, String path) {\r
- BasicDBObject job = new BasicDBObject("wf_id", wfID).append("inputfile", path);\r
+ public void monitor(int pollIntervall) throws InterruptedException, Exception {\r
+ String jobStart = null;\r
+ int progress = 0;\r
+ while (true) {\r
+ Thread.sleep(pollIntervall);\r
+ BasicDBObject status = getStatus(jobId);\r
+ if (status != null) {\r
+ //System.out.println("Status: " + status.toPrettyString(null));\r
+ if (jobStart == null)\r
+ jobStart = status.getString("job_start");\r
+\r
+ List<BasicDBObject> splits = NoSQLUtils.asList(status, "splits");\r
+ if (splits != null && splits.size() > 0) {\r
+ String processor = NoSQLUtils.asString(splits.get(0), "processor");\r
+ if (StringUtils.isNotBlank(processor) && "Generate text file".equals(processor))\r
+ continue;\r
+ String prg = NoSQLUtils.asString(splits.get(0), "progress");\r
+ int current = (int) Float.parseFloat(prg);\r
+ //System.out.println(String.format("%s %s %s", current, progress, current != progress));\r
+ if (current != progress) {\r
+ progress = current;\r
+ listener.onProgressChanged(progress);\r
+ }\r
+ }\r
+ //Status: {"job_id":"20180226-162821-217-A7E91DC625BD","job_start":"2018/02/26 16:28:21","file":"\\\\PROXY-TRANSCODER-01\\MAM-Proxy_input\\20180201-0700_hirado_TEST-_CS.MXF","wf_name":"MAM_proxy","splits":[{"steps":"4 / 5","processor":"Folder","status":"Waiting for next processor resources...","node":"PROXY-TRANSCODE","progress":"78.5"}]}\r
+\r
+ } else {\r
+ //System.out.println("Progress: " + 100);\r
+ listener.onProgressChanged(100);\r
+ BasicDBObject history = getHistory(jobStart);\r
+ //System.out.println("History: " + history.toPrettyString(null));\r
+ if (history == null || NoSQLUtils.asLong(history, "state") != 1) {\r
+ String error = NoSQLUtils.asString(history, "outcome");\r
+ throw new Exception("Transcode error: " + error);\r
+ } else {\r
+ //System.out.println("Transcode completed");\r
+ break;\r
+ }\r
+\r
+ //History: {"wf_name":"MAM_proxy","job_start":"2018/02/26 16:28:21","job_end":"2018/02/26 16:28:36","file":"20180201-0700_hirado_TEST-_CS.MXF","outcome":"Success","state":1}\r
+ }\r
+\r
+ }\r
+ }\r
+\r
+ @Override\r
+ public void submit(String workflowName, String inputFile) throws Exception {\r
+ this.inputFile = inputFile;\r
+ List<BasicDBObject> workflows = getWorkflows();\r
+ if (workflows == null)\r
+ throw new Exception("No workflows");\r
+\r
+ long wfID = -1;\r
+ wfID = getWorkflowId(workflowName, workflows, wfID);\r
+ if (wfID < 0)\r
+ throw new Exception("Workflow not exists: " + workflowName);\r
+\r
+ BasicDBObject job = new BasicDBObject("wf_id", wfID).append("inputfile", inputFile);\r
ResteasyWebTarget target = webTarget.path("jobs");\r
Response apiResponse = target.request().post(Entity.entity(job.toString(), MediaType.APPLICATION_JSON));\r
if (apiResponse.getStatus() != 202)\r
- return null;\r
+ throw new Exception("Can not submit, response status is: " + apiResponse.getStatus());\r
String json = apiResponse.readEntity(String.class);\r
+\r
+ if (StringUtils.isBlank(json))\r
+ throw new Exception("Can not submit, response JSON is empty");\r
BasicDBObject resultObject = (BasicDBObject) JSONUtil.jsonToDbObject(json);\r
- return resultObject.getString("job_id");\r
+ if (resultObject == null)\r
+ throw new Exception("Can not submit, response object is null");\r
+ jobId = resultObject.getString("job_id");\r
}\r
}\r
\r
List<BasicDBObject> getWorkflows();\r
\r
- String submit(long wfID, String path);\r
+ void monitor(int pollIntervall) throws InterruptedException, Exception;\r
+\r
+ void submit(String workflowName, String path) throws Exception;\r
}\r
db2ts "update index media_houseid for text connect to mc"\r
db2ts "update index mediafile_houseid for text connect to mc"\r
\r
+\r
+db2ts "create index media_title1 for text on clobmedia(title) UPDATE FREQUENCY D(*) H(*) M(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59) UPDATE MINIMUM 1 connect to mc"\r
+db2ts "create index media_desc1 for text on clobmedia(description) UPDATE FREQUENCY D(*) H(*) M(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59) UPDATE MINIMUM 1 connect to mc"\r
+db2ts "create index media_houseid1 for text on clobmedia(houseid) UPDATE FREQUENCY D(*) H(*) M(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59) UPDATE MINIMUM 1 connect to mc"\r
+db2ts "update index media_title1 for text connect to mc"\r
+db2ts "update index media_desc1 for text connect to mc"\r
+db2ts "update index media_houseid1 for text connect to mc"\r
+db2ts "drop index media_title1 for text connect to mc"\r
+db2ts "drop index media_desc1 for text connect to mc"\r
+db2ts "drop index media_houseid1 for text connect to mc"\r
select * from vw_items where mediacreated like '2018-01%'\r
select distinct(mediafilehouseid) from vw_items where mediacreated like '2018-01%'\r
select count(distinct(mediafilehouseid)) from vw_items where mediacreated like '2018-01%'\r
-select count(distinct(mediafilehouseid)) from vw_items\r
+\r
\r
--Octopus ID-hez rendelt klip \r
select * from vw_items where itemtitle like 'Echo TV%' and mediacreated like '2018-01%'\r
-select count(distinct(mediahouseid)) from vw_items where itemtitle like 'Echo TV%' and mediacreated like '2018-01%'\r
+select count(distinct(mediafilehouseid)) from vw_items where itemtitle like 'Echo TV%' and mediacreated like '2018-01%'\r
+\r
+\r
+select * from vw_items where mediacreated like '2018-01%'\r
\r
--Automatikusan archivált bejátszók\r
select * from vw_items where itemtitle like '%Echo TV%' and itemtitle like '2%' and mediatitle not like '%CLN%' and mediatitle not like '%PGM%' and mediacreated like '2018-01%' \r
select * from vw_items where itemtitle like 'MC-%' and mediahouseid like 'MC-%'and mediacreated like '2018-01%' \r
select count(distinct(mediafilehouseid)) from vw_items where itemtitle like 'MC-%' and mediahouseid like 'MC-%'and mediacreated like '2018-01%' \r
\r
+\r
+select archived, mediahouseid, mediatitle, mediafilehouseid from vw_items where MEDIAFILEHOUSEID in (\r
+ select mediafilehouseid from vw_items where mediahouseid like 'MC-%' and mediatitle not like 'MC-%'\r
+ group by mediafilehouseid having count(*) > 1\r
+)\r
+\r
+\r
--Migrált archívum\r
select i.created, i.houseid as ihouse, i.title as ititle, m.houseid as mhouse, m.title as mtitle from item i left outer join media m on (m.itemid = i.id) where i.houseid not like 'MC-%' and m.houseid like 'MC-%' \r
\r
select count(distinct(mediafilehouseid)) from vw_items where mediafilehouseid like 'M%' and mediafilehouseid not like 'MC%' and mediacreated like '2018-01%'\r
\r
-- Egyéb ?\r
-select * from vw_items where mediafilehouseid not like 'M%' and mediahouseid not like 'P%' and mediahouseid not like 'R%' and mediafilehouseid not like 'MC%' and mediacreated like '2018-01%'\r
+\r
+select mediafilehouseid, count(*) as c from vw_items where mediafilehouseid not like 'M%' and mediahouseid not like 'P%' and mediahouseid not like 'R%' and mediafilehouseid not like 'MC%' and mediacreated like '2018-01%'\r
and itemtitle not like '%Echo TV%' and itemtitle not like '2%' and mediatitle not like '%CLN%' and mediatitle not like '%PGM%'\r
+group by mediafilehouseid having count(*) > 1 order by c desc \r
+\r
+select archived, mediahouseid, mediatitle, mediafilehouseid from vw_items where MEDIAFILEHOUSEID in (\r
+ select mediafilehouseid from vw_items where mediafilehouseid not like 'M%' and mediahouseid not like 'P%' and mediahouseid not like 'R%' and mediafilehouseid not like 'MC%'\r
+ and itemtitle not like '%Echo TV%' and itemtitle not like '2%' and mediatitle not like '%CLN%' and mediatitle not like '%PGM%'\r
+ group by mediafilehouseid having count(*) > 1\r
+)\r
+\r
+--ID-k\r
+select x.archived, x.mediahouseid, x.mediatitle, x.mediafilehouseid, h.duplicates from vw_items x\r
+inner join (\r
+ select mediafilehouseid, count(*) as duplicates from vw_items group by mediafilehouseid order by mediafilehouseid\r
+) h on x.mediafilehouseid=h.mediafilehouseid and \r
+x.mediafilehouseid not like 'M%' and x.mediahouseid not like 'P%' and x.mediahouseid not like 'R%' and x.mediafilehouseid not like 'MC%' and x.mediacreated like '2018-01%'\r
+and x.itemtitle not like '%Echo TV%' and x.itemtitle not like '2%' and x.mediatitle not like '%CLN%' and x.mediatitle not like '%PGM%'\r
+\r
+select * from WORKFLOWACTION where started like '2018-01%'\r
+\r
+select min(started) from WORKFLOWACTION where USERNAME!='echotest' and started like '2018-02%'\r
\r
select count(distinct(mediafilehouseid)) from vw_items where mediafilehouseid not like 'M%' and mediahouseid not like 'P%' and mediahouseid not like 'R%' and mediafilehouseid not like 'MC%' and mediacreated like '2018-01%'\r
and itemtitle not like '%Echo TV%' and itemtitle not like '2%' and mediatitle not like '%CLN%' and mediatitle not like '%PGM%'\r
-----------------------------------------------------------------\r
\r
\r
+select archived, mediahouseid, mediatitle, mediafilehouseid from vw_items where MEDIAFILEHOUSEID in (\r
+ select mediafilehouseid, count(*) from vw_items where mediafilehouseid not like 'MC-%' and mediafilehouseid like 'M%'\r
+ group by mediafilehouseid having count(*) > 1\r
+)\r
+\r
\r
select * from vw_items where mediahouseid like 'P%'\r
select count(distinct(mediahouseid)) from vw_items where mediahouseid like 'P%'\r
import org.junit.BeforeClass;\r
import org.junit.Test;\r
\r
+import sqlj.runtime.ref.DefaultContext;\r
import user.commons.IEntityBase;\r
import user.commons.logging.LogUtils;\r
\r
return result;\r
}\r
\r
+ @Test\r
+ public void testClob() throws Exception {\r
+ ResultSet rs = null;\r
+ PreparedStatement st = null;\r
+ DefaultContext context = ((ItemManager) manager).getDbContext();\r
+ Connection connection = context.getConnection();\r
+ try {\r
+\r
+ String query = String.format("select text from ftclob");\r
+ st = connection.prepareStatement(query);\r
+ rs = st.executeQuery();\r
+ if (rs.next()) {\r
+ String text = rs.getString("text");\r
+ System.out.println(text);\r
+ }\r
+\r
+ connection.commit();\r
+ } catch (Exception e) {\r
+ try {\r
+ connection.rollback();\r
+ } catch (Exception e1) {\r
+ }\r
+ } finally {\r
+ try {\r
+ if (rs != null)\r
+ rs.close();\r
+ } catch (Exception e1) {\r
+ }\r
+ try {\r
+ if (st != null)\r
+ st.close();\r
+ } catch (Exception e1) {\r
+ }\r
+ ((ItemManager) manager).putDbContext(context);\r
+ }\r
+\r
+ }\r
+\r
}\r
return !jobRuntime.isWaiting();\r
}\r
\r
+ protected <T> T check(T value, String name) {\r
+ boolean empty = false;\r
+ if (value instanceof Long || value instanceof Integer) {\r
+ long i = (long) value;\r
+ if (i == 0)\r
+ empty = true;\r
+ }\r
+ if (value == null || empty) {\r
+ logger.error(getMarker(), "A folyamat '{}' bemeneti paramétere üres.", name);\r
+ throw new NullPointerException(String.format("System is not configured properly, missing '%s' input parameter.", name));\r
+ }\r
+ return value;\r
+ }\r
+\r
@Override\r
public void cleanup() {\r
}\r