<setEntry value="com.ibm.db2.jcc@default:default"/>\r
<setEntry value="com.ibm.nosql@default:default"/>\r
<setEntry value="com.microsoft.sqlserver.sqljdbc@default:default"/>\r
+ <setEntry value="com.sun.jna.platform@default:default"/>\r
<setEntry value="com.sun.jna@default:default"/>\r
<setEntry value="groovy@default:default"/>\r
<setEntry value="io.humble.video-arch-x86_64-pc-linux-gnu6@default:default"/>\r
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console"/>\r
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>\r
- <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djavax.ws.rs.ext.RuntimeDelegate=org.jboss.resteasy.spi.ResteasyProviderFactory -Dorg.eclipse.epp.logging.aeri.skipReports=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dlog4j.configurationFile=settings/log4j2.xml -Djetty.home=settings -Djetty.etc.config.urls=jetty.xml -Dgosh.home=configuration -Djava.io.tmpdir=tmp"/>\r
+ <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djavax.ws.rs.ext.RuntimeDelegate=org.jboss.resteasy.spi.ResteasyProviderFactory -Dorg.eclipse.epp.logging.aeri.skipReports=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dlog4j.configurationFile=settings/log4j2.xml -Djetty.home=settings -Djetty.etc.config.urls=jetty.xml -Dgosh.home=configuration -Djava.io.tmpdir=tmp -Djna.library.path=C:\_workspace\USER\MediaCube\server"/>\r
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="C:\_workspace\USER\MediaCube\server\-product\production\LOCAL"/>\r
<stringAttribute key="pde.version" value="3.3"/>\r
<setAttribute key="selected_target_bundles">\r
<setEntry value="com.ibm.db2.jcc@default:default"/>\r
<setEntry value="com.ibm.nosql@default:default"/>\r
<setEntry value="com.microsoft.sqlserver.sqljdbc@default:default"/>\r
+ <setEntry value="com.sun.jna.platform@default:default"/>\r
<setEntry value="com.sun.jna@default:default"/>\r
<setEntry value="groovy@default:default"/>\r
<setEntry value="io.humble.video-arch-x86_64-pc-linux-gnu6@default:default"/>\r
<setEntry value="com.ibm.db2.jcc@default:default"/>\r
<setEntry value="com.ibm.nosql@default:default"/>\r
<setEntry value="com.microsoft.sqlserver.sqljdbc@default:default"/>\r
+ <setEntry value="com.sun.jna.platform@default:default"/>\r
<setEntry value="com.sun.jna@default:default"/>\r
<setEntry value="groovy@default:default"/>\r
<setEntry value="io.humble.video-arch-x86_64-pc-linux-gnu6@default:default"/>\r
<plugin id="org.objectweb.asm"/>\r
<plugin id="org.objectweb.asm.tree"/>\r
<plugin id="org.objectweb.asm.commons"/>\r
+ <plugin id="com.sun.jna.platform"/>\r
</includeBundles>\r
<environment>\r
<os>win32</os>\r
<id>org.eclipse.platform:org.eclipse.equinox.launcher:1.3.201</id>\r
</artifact>\r
<artifact>\r
- <id>net.java.dev.jna:jna:4.2.0</id>\r
+ <id>net.java.dev.jna:jna:5.8.0</id>\r
+ </artifact>\r
+ <artifact>\r
+ <id>net.java.dev.jna:jna-platform:5.8.0</id>\r
</artifact>\r
<artifact>\r
<id>io.humble:humble-video-all:0.2.1</id>\r
<windowImages/>\r
\r
<launcher name="mediacube">\r
- <solaris/>\r
<win useIco="false">\r
<bmp/>\r
</win>\r
<plugin id="com.ibm.nosql"/>\r
<plugin id="com.microsoft.sqlserver.sqljdbc"/>\r
<plugin id="com.sun.jna"/>\r
+ <plugin id="com.sun.jna.platform"/>\r
<plugin id="groovy"/>\r
<plugin id="io.humble.video-arch-x86_64-pc-linux-gnu6"/>\r
<plugin id="io.humble.video-arch-x86_64-w64-mingw32"/>\r
</execution>\r
</executions>\r
</plugin>\r
+<!-- \r
<plugin>\r
<groupId>org.apache.maven.plugins</groupId>\r
<artifactId>maven-resources-plugin</artifactId>\r
</execution>\r
</executions>\r
</plugin>\r
- \r
+--> \r
</plugins>\r
</build>\r
\r
<?xml version="1.0" encoding="UTF-8"?>\r
<executors>\r
+ <executor className="RundownFilesCollectorStep.java" maxConcurrent="1" isRemote="false" />\r
<executor className="ServerStatusReportStep.java" maxConcurrent="1" isRemote="false" />\r
<executor className="TransferStep.java" maxConcurrent="1" isRemote="false" />\r
<executor className="TSMTransferToStep.java" maxConcurrent="4" isRemote="false" />\r
{"joblist":[\r
{\r
+ "template": "sync-subtitles.xml",\r
+ "name" : "Feliratok szinkronizálása",\r
+ "parameters": [ \r
+ {"name": "sourceFolder", "value": "y:\\IBMS_Rundowns", "type": "java.lang.String"}, \r
+ { \r
+ "name": "filter", \r
+ "value": {\r
+ "fileName": ".*\\.(txt)$"\r
+ }, \r
+ "type": "com.ibm.nosql.json.api.BasicDBObject"\r
+ } \r
+ ]\r
+ },\r
+ {\r
"template": "server-status-report.xml",\r
"name" : "MediaCube státusz",\r
"active": true,\r
+++ /dev/null
-#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser\r
-#Sun Apr 18 21:25:34 CEST 2021\r
-osgi.bundles=reference\:file\:cglib_2.2.2.jar@4,reference\:file\:com.fasterxml.jackson.core.jackson-annotations_2.4.5.jar@4,reference\:file\:com.fasterxml.jackson.core.jackson-core_2.4.5.jar@4,reference\:file\:com.fasterxml.jackson.core.jackson-databind_2.4.5.jar@4,reference\:file\:com.fasterxml.jackson.dataformat.jackson-dataformat-yaml_2.4.5.jar@4,reference\:file\:com.fasterxml.jackson.datatype.jackson-datatype-joda_2.4.5.jar@4,reference\:file\:com.fasterxml.jackson.jaxrs.jackson-jaxrs-base_2.4.5.jar@4,reference\:file\:com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider_2.4.5.jar@4,reference\:file\:com.fasterxml.jackson.module.jackson-module-jaxb-annotations_2.4.5.jar@4,reference\:file\:com.ibm.db2.jcc_1.4.0.jar@4,reference\:file\:com.ibm.nosql_4.19.26.jar@4,reference\:file\:com.microsoft.sqlserver.sqljdbc_6.0.8112.100.jar@4,reference\:file\:com.sun.jna_4.2.0.jar@4,reference\:file\:groovy_3.0.3.jar@4,reference\:file\:io.humble.video-arch-x86_64-pc-linux-gnu6_0.2.1.jar@4,reference\:file\:io.humble.video-arch-x86_64-w64-mingw32_0.2.1.jar@4,reference\:file\:io.humble.video-noarch_0.2.1.jar@4,reference\:file\:javax.annotation-api_1.2.0.jar@4,reference\:file\:javax.mail_1.5.0.b01.jar@4,reference\:file\:javax.servlet-api_3.1.0.jar@4,reference\:file\:javax.ws.rs-api_2.0.1.jar@4,reference\:file\:jcifs_1.3.17.jar@4,reference\:file\:joda-time_2.2.0.jar@4,reference\:file\:junit_4.12.0.jar@4,reference\:file\:org.apache.aries.spifly.dynamic.bundle_1.0.8.jar@4,reference\:file\:org.apache.aries.util_1.0.0.jar@4,reference\:file\:org.apache.commons.beanutils_1.8.3.jar@4,reference\:file\:org.apache.commons.collections_3.2.2.jar@4,reference\:file\:org.apache.commons.digester_3.2.0.jar@4,reference\:file\:org.apache.commons.io_2.6.0.jar@4,reference\:file\:org.apache.commons.lang_2.6.0.jar@4,reference\:file\:org.apache.commons.net_3.6.0.jar@4,reference\:file\:org.apache.felix.gogo.command_0.12.0.jar@4,reference\:file\:org.apache.felix.gogo.runtime_0.12.0.jar@4,reference\:file\:org.apache.felix.gogo.shell_0.12.0.jar@4,reference\:file\:org.apache.httpcomponents.httpclient_4.2.6.jar@4,reference\:file\:org.apache.httpcomponents.httpcore_4.2.5.jar@4,reference\:file\:org.apache.logging.log4j.api_2.8.2.jar@1\:start,reference\:file\:org.apache.logging.log4j.core_2.8.2.jar@4,reference\:file\:org.apache.logging.log4j.slf4j-impl_2.8.2.jar@4,reference\:file\:org.apache.servicemix.bundles.quartz_2.3.0.2.jar@4,reference\:file\:org.eclipse.equinox.common_3.8.0.v20160509-1230.jar@2\:start,reference\:file\:org.eclipse.equinox.console_1.1.200.v20150929-1405.jar@4,reference\:file\:org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar@1\:start,reference\:file\:org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar@4,reference\:file\:org.eclipse.equinox.util_1.0.500.v20130404-1337.jar@4,reference\:file\:org.eclipse.jetty.client_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.deploy_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.http_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.io_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.osgi.boot_9.3.9.v20160517.jar@4\:start,reference\:file\:org.eclipse.jetty.schemas_3.1.0.jar@4,reference\:file\:org.eclipse.jetty.security_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.server_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.servlet_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.util_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.webapp_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.websocket.api_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.websocket.client_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.websocket.common_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.websocket.server_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.websocket.servlet_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.jetty.xml_9.3.9.v20160517.jar@4,reference\:file\:org.eclipse.osgi.services_3.2.100.v20100503.jar@4,reference\:file\:org.hamcrest.core_1.3.0.jar@4,reference\:file\:org.jboss.resteasy.client_3.0.11.Final.jar@4,reference\:file\:org.jboss.resteasy.jaxb-provider_3.0.11.Final.jar@4,reference\:file\:org.jboss.resteasy.jaxrs_3.0.11.Final.jar@4,reference\:file\:org.jboss.resteasy.jaxrs-api_3.0.11.Final.jar@4,reference\:file\:org.jmock_2.6.0.jar@4,reference\:file\:org.jmock.junit4_2.6.0.jar@4,reference\:file\:org.mybatis.mybatis_3.5.2.jar@4,reference\:file\:org.objectweb.asm_5.0.1.jar@4,reference\:file\:org.objectweb.asm.commons_5.0.1.jar@4,reference\:file\:org.objectweb.asm.tree_5.0.1.jar@4,reference\:file\:org.omnifaces_3.4.1.jar@4,reference\:file\:slf4j.api_1.7.24.jar@4,reference\:file\:slf4j.simple_1.7.2.jar@4,reference\:file\:user.commons.log4j2_1.0.0.jar@4,reference\:file\:user.commons.zk_8.0.3.jar@4,reference\:file\:user.jobengine.osgi.commons_1.0.0.jar@4\:start,reference\:file\:user.jobengine.osgi.db_1.0.0.jar@4,reference\:file\:user.jobengine.osgi.server_1.0.0.jar@4,reference\:file\:user.jobengine.osgi.services_1.0.0.jar@4,reference\:file\:user.mediacube.gui_1.0.0.jar@4,reference\:file\:user.mediacube.metadata_1.0.0.jar@4,reference\:file\:user.tsm.client_1.2.0.jar@4\r
-equinox.use.ds=true\r
-osgi.bundles.defaultStartLevel=4\r
-osgi.framework=file\:plugins/org.eclipse.osgi_3.11.2.v20161107-1947.jar\r
-osgi.framework.extensions=\r
-eclipse.p2.data.area=@config.dir/../p2\r
-eclipse.p2.profile=DefaultProfile\r
+++ /dev/null
-@echo off\r
-:CHCP 65001 log4j2 elszall tole\r
-if exist tmp rmdir tmp /s /q\r
-mkdir tmp\r
-java ^\r
--Dorg.eclipse.epp.logging.aeri.skipReports=true ^\r
--Declipse.ignoreApp=true ^\r
--Dosgi.noShutdown=true ^\r
--Dlog4j.configurationFile=settings/log4j2.xml ^\r
--Djetty.home=settings ^\r
--Djetty.etc.config.urls=jetty.xml ^\r
--Djava.io.tmpdir=tmp ^\r
--Dfile.encoding=UTF-8 ^\r
--Dgosh.home=configuration ^\r
--jar plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar ^\r
--Xms512m ^\r
--Xmx1024m ^\r
--console\r
-cd /opt/mediacube
+cd /opt/mediacube-new
rm -fr tmp/*
rm -fr configuration/org.eclipse.osgi
-export DSMI_CONFIG=/opt/mediacube/settings/dsm.opt
+export DSMI_CONFIG=/opt/mediacube-new/settings/dsm.opt
export DSMI_DIR=/opt/tivoli/tsm/client/api/bin64
-export DSMI_LOG=/opt/mediacube/log
+export DSMI_LOG=/opt/mediacube-new/log
export DSM_DIR=/opt/tivoli/tsm/client/api/bin64
-export LD_LIBRARY_PATH=/opt/tivoli/tsm/client/ba/bin:/opt/tivoli/tsm/client/api/bin64:/opt/mediacube
+export LD_LIBRARY_PATH=/opt/tivoli/tsm/client/ba/bin:/opt/tivoli/tsm/client/api/bin64:/opt/mediacube-new
export LIBPATH=/opt/tivoli/tsm/client/ba/bin:/opt/tivoli/tsm/client/api/bin64
export SHLIB_PATH=/opt/tivoli/tsm/client/ba/bin:/opt/tivoli/tsm/client/api/bin64
export TZ=NFT-1DFT,M3.5.0,M10.5.0
-Dorg.eclipse.epp.logging.aeri.skipReports=true \
-Declipse.ignoreApp=true \
-Dosgi.noShutdown=true \
--Dlog4j.configurationFile=configuration/log4j2.xml \
+-Dlog4j.configurationFile=settings/log4j2.xml \
+-Dorg.eclipse.jetty.LEVEL=INFO \
+-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog \
-Djetty.home=settings/jetty \
-Djetty.etc.config.urls=jetty.xml,jetty-ssl.xml,jetty-ssl-context.xml,jetty-http.xml,jetty-https.xml \
-Djava.io.tmpdir=tmp \
-Xms1024m \
-Xmx4096m \
-consoleLog \
--console 5555
+-console 5556
+#nohup ./mediacube </dev/null &>/dev/null &
host: 10.10.1.55\r
collection-name: test_nexioclips\r
use-mos-gateway: true\r
- disabled: false\r
+ disabled: true\r
octopus:\r
api:\r
address: http://10.10.1.11/api/v1\r
user: mama\r
password: napocska\r
- rundowns-collection-name: rundowns\r
- stories-collection-name: stories\r
- folders-collection-name: storyfolders\r
+ rundowns-collection-name: rundowns-test\r
+ stories-collection-name: stories1-test\r
+ folders-collection-name: storyfolders-test\r
jobs:\r
validate-transfers: false\r
copy-buffer-size: 32768\r
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
-
-<Configure id="Server" class="org.eclipse.jetty.server.Server">
- <Call name="addConnector">
- <Arg>
- <New class="org.eclipse.jetty.server.ServerConnector">
- <Arg name="server">
- <Ref refid="Server" />
- </Arg>
- <Set name="port">
- <Property name="jetty.http.port" default="9080" />
- </Set>
- </New>
- </Arg>
- </Call>
-
-<!-- <Set name="sessionIdManager"> -->
-<!-- <New id="idMgr" -->
-<!-- class="org.eclipse.jetty.server.session.DefaultSessionIdManager"> -->
-<!-- <Arg> -->
-<!-- <Ref refid="Server" /> -->
-<!-- </Arg> -->
-<!-- <Set name="workerName">node1</Set> -->
-<!-- </New> -->
-<!-- </Set> -->
-
- <Set name="handler">
- <New id="Handlers"
- class="org.eclipse.jetty.server.handler.HandlerCollection">
- <Set name="handlers">
- <Array type="org.eclipse.jetty.server.Handler">
- <Item>
- <New id="Contexts"
- class="org.eclipse.jetty.server.handler.ContextHandlerCollection" />
- </Item>
- <Item>
- <New id="DefaultHandler"
- class="org.eclipse.jetty.server.handler.DefaultHandler" />
- </Item>
- </Array>
- </Set>
- </New>
- </Set>
-</Configure>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>\r
<executors>\r
+ <executor className="QueryMissingProxyMediaStep.java" maxConcurrent="1" isRemote="false" />\r
+ <executor className="PrepareRemoteTranscodeJobParametersStep.java" maxConcurrent="1" isRemote="false" />\r
+ <executor className="TramsferStep.java" maxConcurrent="1" isRemote="false" />\r
+ <executor className="PrepareMediaRestoreStep.java" maxConcurrent="1" isRemote="false" />\r
+ <executor className="TranscodeFFMpegStep.java" maxConcurrent="1" isRemote="false" />\r
+ <executor className="RemoteJobStep.java" maxConcurrent="1" isRemote="false" />\r
<executor className="PathItemsCollectorStep.java" maxConcurrent="1" isRemote="false" />\r
<executor className="TestForkCancelableStep.java" maxConcurrent="3" isRemote="false" />\r
<executor className="ArchiveRecursive.java" maxConcurrent="1" isRemote="false" />\r
{"joblist":[\r
{\r
+ "template": "remote-transcode.xml",\r
+ "parameters": [ \r
+ {"name": "remoteServer", "value": "http://localhost:9080", "type": "java.lang.String"}, \r
+ {"name": "transcodeTemplate", "value": "create-proxy-ffmpeg.xml", "type": "java.lang.String"}, \r
+ {"name": "jobName", "value": "Create proxy (slave process)", "type": "java.lang.String"}, \r
+ {"name": "profileName", "value": "proxy", "type": "java.lang.String"},\r
+ {"name": "tempStoreName", "value": "LOCAL", "type": "java.lang.String"},\r
+ {"name": "tempStoreProtocol", "value": "LOCAL", "type": "java.lang.String"}\r
+ ]\r
+ },\r
+ {\r
+ "template": "create-proxy-ffmpeg.xml",\r
+ "parameters": [ \r
+ {"name": "input", "value": "c:/_video/in.mxf", "type": "java.lang.String"}, \r
+ {"name": "output", "value": "c:/_video/out.mp4", "type": "java.lang.String"}, \r
+ {"name": "profile", "value": "proxy", "type": "java.lang.String"} \r
+ ]\r
+ },\r
+ {\r
"template": "sync-subtitles.xml",\r
"parameters": [ \r
{"name": "sourceFolder", "value": "/windows", "type": "java.lang.String"}, \r
for (int i = 0; i < count; i++) {\r
if (getJobRuntime().isWaitingCancel())\r
break;\r
- Thread.sleep(500);\r
+ Thread.sleep(1000);\r
/*\r
if (param==0)\r
throw new Exception();\r
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import java.io.BufferedReader;\r
+import java.io.InputStreamReader;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+public class ExternalCommand {\r
+ private static final Logger logger = LogManager.getLogger();\r
+ private ExternalProfile profile;\r
+\r
+ public ExternalCommand(ExternalProfile profile) {\r
+ this.profile = profile;\r
+ }\r
+\r
+ public String execute(String input, String output, boolean firstResponse, IExternalCallback responseCallBack) throws Exception {\r
+ List<String> arguments = getArguments(input, output);\r
+ List<String> command = new ArrayList<>();\r
+ command.add(profile.getExecutable());\r
+ command.addAll(arguments);\r
+\r
+ ProcessBuilder processBuilder = new ProcessBuilder();\r
+ processBuilder.command(command);\r
+\r
+ String result = null;\r
+ try {\r
+ logger.info("Executing : {}", processBuilder.command());\r
+\r
+ Process process = processBuilder.start();\r
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {\r
+ String line = null;\r
+ while ((line = reader.readLine()) != null) {\r
+ logger.debug("Process response: {}", line);\r
+ if (responseCallBack != null)\r
+ responseCallBack.onResponse(line);\r
+ //System.out.println(line);\r
+ if (line != null && line.length() > 0) {\r
+ result = line;\r
+ if (firstResponse)\r
+ break;\r
+ }\r
+ }\r
+ int exitCode = process.waitFor();\r
+ if (exitCode != 0) {\r
+ StringBuilder msg = new StringBuilder();\r
+ try (BufferedReader errReader = new BufferedReader(new InputStreamReader(process.getErrorStream()))) {\r
+ String errline = null;\r
+ while ((errline = errReader.readLine()) != null) {\r
+ msg.append(errline);\r
+ }\r
+ } catch (Exception ex) {\r
+ }\r
+\r
+ throw new Exception("Exited with error code : " + exitCode + ". " + msg);\r
+ }\r
+ } catch (Exception e) {\r
+ throw e;\r
+ }\r
+ } catch (Exception e) {\r
+ logger.error(e);\r
+ throw e;\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ private List<String> getArguments(String input, String output) {\r
+ List<String> result = new ArrayList<>();\r
+\r
+ profile.getArguments().forEach(i -> {\r
+ result.add(i.replace("%i", input).replace("%o", output));\r
+ });\r
+ return result;\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import user.commons.configuration.SystemConfiguration;\r
+\r
+public class ExternalCommandExecutor {\r
+\r
+ public void execute(String profileName, String input, String output, IExternalCallback responseCallBack) throws Exception {\r
+ ExternalCommand externalCommand = getExternalCommand(profileName);\r
+ externalCommand.execute(input, output, false, responseCallBack);\r
+ }\r
+\r
+ private ExternalCommand getExternalCommand(String profileName) throws Exception {\r
+ ExternalProfilesConfig config = SystemConfiguration.getInstance().load("settings/external-commands.yaml", ExternalProfilesConfig.class);\r
+\r
+ if (config == null)\r
+ throw new Exception("Missing external-commands.yaml configuration");\r
+\r
+ ExternalProfile selectedProfile = null;\r
+ for (ExternalProfile profile : config.getProfiles()) {\r
+ if (profileName.equals(profile.getName())) {\r
+ selectedProfile = profile;\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (selectedProfile == null)\r
+ throw new Exception("Missing profile " + profileName + " in external-commands.yaml configuration");\r
+\r
+ return new ExternalCommand(selectedProfile);\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import java.util.List;\r
+\r
+public class ExternalProfile {\r
+ private String executable;\r
+ private String name;\r
+ private List<String> arguments;\r
+\r
+ public List<String> getArguments() {\r
+ return arguments;\r
+ }\r
+\r
+ public String getExecutable() {\r
+ return executable;\r
+ }\r
+\r
+ public String getName() {\r
+ return name;\r
+ }\r
+\r
+ public void setArguments(List<String> arguments) {\r
+ this.arguments = arguments;\r
+ }\r
+\r
+ public void setExecutable(String executable) {\r
+ this.executable = executable;\r
+ }\r
+\r
+ public void setName(String name) {\r
+ this.name = name;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import java.util.List;\r
+\r
+public class ExternalProfilesConfig {\r
+ private List<ExternalProfile> profiles;\r
+\r
+ public List<ExternalProfile> getProfiles() {\r
+ return profiles;\r
+ }\r
+\r
+ public void setProfiles(List<ExternalProfile> profiles) {\r
+ this.profiles = profiles;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+public interface IExternalCallback {\r
+ void onResponse(String data);\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import javax.ws.rs.client.Entity;\r
+import javax.ws.rs.client.Invocation.Builder;\r
+import javax.ws.rs.core.MediaType;\r
+import javax.ws.rs.core.MultivaluedMap;\r
+import javax.ws.rs.core.Response;\r
+import javax.ws.rs.core.Response.Status;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+import org.jboss.resteasy.client.jaxrs.ResteasyClient;\r
+import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;\r
+import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;\r
+import org.jboss.resteasy.specimpl.MultivaluedMapImpl;\r
+\r
+import com.ibm.nosql.json.JSONUtil;\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+\r
+public class MediaCubeClient {\r
+ private static Logger logger = LogManager.getLogger();\r
+ private ResteasyWebTarget webTarget;\r
+\r
+ public MediaCubeClient(String address) {\r
+ ResteasyClient client = new ResteasyClientBuilder().build();\r
+ webTarget = client.target(address);\r
+ }\r
+\r
+ BasicDBObject getDbObject(String json) {\r
+ BasicDBObject result = (BasicDBObject) JSONUtil.jsonToDbObject(json);\r
+\r
+ if (result == null)\r
+ throw new NullPointerException("API Result is null!");\r
+\r
+ if (result.containsKey("exception")) {\r
+ BasicDBObject e = (BasicDBObject) result.get("exception");\r
+ throw new RuntimeException(e.getString("message"));\r
+ }\r
+ //{"exception":{"message":"Invalid credentials.","publicName":"AuthenticationFailedException"}}\r
+ return result;\r
+ }\r
+\r
+ public BasicDBObject getStatus(long jobId) {\r
+ MultivaluedMap<String, Object> vars = new MultivaluedMapImpl<>();\r
+ vars.add("jobId", jobId);\r
+ Response response = query("services/rest/jobengine/jobstatus", vars).get();\r
+ if (response.getStatus() != Status.OK.getStatusCode()) {\r
+ logger.error(response.readEntity(String.class));\r
+ System.out.println(response.readEntity(String.class));\r
+ return null;\r
+ }\r
+ String result = response.readEntity(String.class);\r
+ return getDbObject(result);\r
+ }\r
+\r
+ private Builder query(String path, MultivaluedMap<String, Object> vars) {\r
+ ResteasyWebTarget target = webTarget.path(path).queryParams(vars);\r
+ Builder result = target.request();\r
+ return result;\r
+ }\r
+\r
+ public long startjob(String template, String name, BasicDBObject jobParams) throws Exception {\r
+ MultivaluedMap<String, Object> vars = new MultivaluedMapImpl<>();\r
+ vars.add("template", template);\r
+ vars.add("name", name);\r
+ Response response = query("services/rest/jobengine/startjob", vars).post(Entity.entity(jobParams.toString(), MediaType.APPLICATION_JSON));\r
+\r
+ if (response.getStatus() != Status.OK.getStatusCode()) {\r
+ logger.error(response.readEntity(String.class));\r
+ return 0;\r
+ }\r
+\r
+ String resultObject = response.readEntity(String.class);\r
+ return Long.parseLong(resultObject);\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.nio.file.Paths;\r
+\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+\r
+public class PrepareRemoteTranscodeJobParametersStep extends JobStep {\r
+ @StepEntry\r
+ public Object[] execute(String profileName, String fileName) throws Exception {\r
+ String transcoderInputDir = "m:\";\r
+ String transcoderOutputDir = "m:\";\r
+ String outFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ".mp4";\r
+ BasicDBObject parameters = new BasicDBObject();\r
+ parameters.put("profile", profileName);\r
+ parameters.put("input", Paths.get(transcoderInputDir, fileName));\r
+ parameters.put("output", Paths.get(transcoderOutputDir, outFileName));\r
+ return new Object[] { parameters };\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\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.MediaCubeUndoMarker;\r
+import user.commons.nosql.NoSQLUtils;\r
+import user.jobengine.db.IItemManager;\r
+import user.jobengine.db.Media;\r
+\r
+public class QueryMissingProxyMediaStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ @StepEntry\r
+ public Object[] execute() throws Exception {\r
+ Object[] result = new Object[] { null };\r
+ DB db = NoSQLUtils.getNoSQLDB();\r
+ DBCollection collection = db.getCollection("missing_lowres");\r
+ Media media = getFirstUntranscodedMedia(collection);\r
+\r
+ try {\r
+ if (media == null) {\r
+ logger.info(new MediaCubeUndoMarker(getSessionMarker().getSessionID()), "Nincs feldolgozandó hiány.");\r
+ // throw new Exception("Nincs feldolgozandó hiány.");\r
+ cancel();\r
+ return null;\r
+ }\r
+\r
+ String name = media.getMediaFileRealName();\r
+ collection.save(new BasicDBObject("name", name));\r
+ logger.info(getSessionMarker(), "Processing mediaID: {}", media.getId());\r
+ result[0] = media;\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ logger.error(getSessionMarker(), e.getMessage());\r
+ throw e;\r
+ } finally {\r
+ setProgress(100);\r
+ }\r
+ return result;\r
+ }\r
+\r
+ private Media getFirstUntranscodedMedia(DBCollection collection) {\r
+ Media[] result = new Media[] { null };\r
+ //MV\r
+ String query = "SELECT mediaid FROM VW_MISSING_PROXY_IDS WHERE HOUSEID like 'M%' or HOUSEID like 'P%' or HOUSEID like 'R%' ORDER BY modified DESC";\r
+\r
+ //HTV\r
+ //String query = "SELECT mediaid FROM VW_MISSING_PROXY_IDS";\r
+ IItemManager manager = getManager();\r
+ manager.executeQuery(query, rs -> {\r
+ try {\r
+ long mediaId = rs.getLong(1);\r
+ Media media = manager.getMedia(mediaId);\r
+ //a nevgeneralas miatt az eredeti MediaFilesName nem jo, a pontos nev kell nekunk\r
+ String name = media.getMediaFileRealName();\r
+ logger.info(getSessionMarker(), "Checking {}", name);\r
+ long existing = collection.find(new BasicDBObject("name", name)).count();\r
+ if (existing > 0) {\r
+ logger.info(getSessionMarker(), "{} is on missing_lowres list", name);\r
+ return true;\r
+ }\r
+\r
+ result[0] = media;\r
+ } catch (Exception e) {\r
+ logger.error(e);\r
+ }\r
+ return false;\r
+ }, null);\r
+ return result[0];\r
+ }\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+\r
+/*\r
+import user.jobengine.server.steps.MediaCubeClient;\r
+*/\r
+public class RemoteJobStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ @StepEntry\r
+ public Object[] execute(String server, String template, String name, String profile) throws Exception {\r
+ try {\r
+ MediaCubeClient mc = new MediaCubeClient(server);\r
+ BasicDBObject params = new BasicDBObject();\r
+ params.put("profile", profile);\r
+ params.put("input", "c:/_workspace/data/video/proba1.mxf");\r
+ params.put("output", "c:/_video/proba1.mp4");\r
+\r
+ long jobId = mc.startjob(template, name, params);\r
+ logger.info(getMarker(), "Started {} on server {}", jobId, server);\r
+ while (true) {\r
+ BasicDBObject status = mc.getStatus(jobId);\r
+ if (status != null)\r
+ setProgress(status.getInt("progress"));\r
+\r
+ String jobStatus = status.getString("status");\r
+ if ("SUSPENDED".equals(jobStatus))\r
+ throw new Exception(status.getString("description"));\r
+\r
+ if ("FINISHED".equals(jobStatus))\r
+ break;\r
+ }\r
+\r
+ } catch (Exception e) {\r
+ throw e;\r
+ }\r
+ return new Object[] { null };\r
+ }\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+/*\r
+import user.jobengine.server.steps.shared.IExternalCallback;\r
+import user.jobengine.server.steps.shared.ExternalProfile;\r
+import user.jobengine.server.steps.shared.ExternalProfilesConfig;\r
+import user.jobengine.server.steps.shared.ExternalCommand;\r
+import user.jobengine.server.steps.shared.ExternalCommandExecutor;\r
+ */\r
+\r
+import java.nio.file.Paths;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+import user.commons.mediaarea.MediaArea;\r
+import user.jobengine.server.steps.shared.ExternalCommandExecutor;\r
+import user.jobengine.server.steps.shared.IExternalCallback;\r
+\r
+public class TranscodeFFMpegStep extends JobStep implements IExternalCallback {\r
+ private static final Logger logger = LogManager.getLogger();\r
+ private long allFrameCount;\r
+ private long processedFrameCount;\r
+\r
+ @StepEntry\r
+ public Object[] execute(String input, String output, String profile) throws Exception {\r
+ try {\r
+ MediaArea ma = new MediaArea(Paths.get(input));\r
+ ma.process();\r
+ allFrameCount = ma.getFrameCount();\r
+\r
+ ExternalCommandExecutor executor = new ExternalCommandExecutor();\r
+ executor.execute(profile, input, output, this);\r
+ } catch (Exception e) {\r
+ logger.error(getMarker(), "Media information not available. System message: {}", e.getMessage());\r
+ throw e;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ @Override\r
+ public void onResponse(String line) {\r
+ String[] values = line.split("=");\r
+ if ("frame".equals(values[0])) {\r
+ processedFrameCount = Integer.parseInt(values[1]);\r
+ int progress = (int) (processedFrameCount * 100 / allFrameCount);\r
+ if (progress > 0)\r
+ setProgress(progress);\r
+ }\r
+ }\r
+\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<jobtemplate multiInstance="true" useSessionLog="true">\r
+ <declarations>\r
+ <parameters>\r
+ <parameter name="input" type="java.lang.String" />\r
+ <parameter name="output" type="java.lang.String" />\r
+ <parameter name="profile" type="java.lang.String" />\r
+ </parameters>\r
+ </declarations>\r
+ <commands>\r
+ <calljobstep remote="true" type="TranscodeFFMpegStep.java" weight="1" >\r
+ <inputs>\r
+ <input>\r
+ <parameter name="input" />\r
+ </input>\r
+ <input>\r
+ <parameter name="output" />\r
+ </input>\r
+ <input>\r
+ <parameter name="profile" />\r
+ </input>\r
+ </inputs>\r
+ </calljobstep>\r
+ </commands>\r
+</jobtemplate>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<jobtemplate multiInstance="true" useSessionLog="true">\r
+ <declarations>\r
+ <parameters>\r
+ <!-- Slave server address for transcode -->\r
+ <parameter name="remoteServer" type="java.lang.String" />\r
+ <!-- Slave server template for transcode -->\r
+ <parameter name="transcodeTemplate" type="java.lang.String" />\r
+ <!-- Slave server job display name -->\r
+ <parameter name="jobName" type="java.lang.String" />\r
+ <!-- Slave server transcode job profile -->\r
+ <parameter name="profileName" type="java.lang.String" />\r
+ <!-- TEMP store for media retrieve -->\r
+ <parameter name="tempStoreName" type="java.lang.String" />\r
+ <!-- TEMP store protocol for media retrieve -->\r
+ <parameter name="tempStoreProtocol" type="java.lang.String" />\r
+ </parameters>\r
+ <variables>\r
+ <!-- Media to transcode -->\r
+ <variable name="media" type="user.jobengine.db.Media" />\r
+ <!-- Media file name -->\r
+ <variable name="fileName" type="java.lang.String" />\r
+ <!-- Media store uri -->\r
+ <variable name="mediaStoreUri" type="user.commons.StoreUri" />\r
+ <!-- TEMP store uri -->\r
+ <variable name="tempStoreUri" type="user.commons.StoreUri" />\r
+ <!-- Slave server remote job parameters -->\r
+ <variable name="remoteJobParameters" type="com.ibm.nosql.json.api.BasicDBObject" />\r
+ </variables>\r
+ </declarations>\r
+ <commands>\r
+ <calljobstep type="QueryMissingProxyMediaStep.java" weight="1" >\r
+ <outputs>\r
+ <output>\r
+ <variable name="media" />\r
+ </output>\r
+ </outputs>\r
+ </calljobstep> \r
+ <calljobstep type="PrepareMediaRestoreStep.java" weight="1" >\r
+ <inputs>\r
+ <input>\r
+ <variable name="media" />\r
+ </input>\r
+ <input>\r
+ <parameter name="tempStoreName" />\r
+ </input>\r
+ <input>\r
+ <parameter name="tempStoreProtocol" />\r
+ </input>\r
+ </inputs>\r
+ <outputs>\r
+ <output>\r
+ <variable name="mediaStoreUri" />\r
+ </output>\r
+ <output>\r
+ <variable name="tempStoreUri" />\r
+ </output>\r
+ <output>\r
+ <variable name="fileName" />\r
+ </output>\r
+ </outputs>\r
+ </calljobstep> \r
+ <calljobstep type="TransferStep.java" weight="5" >\r
+ <inputs>\r
+ <input>\r
+ <variable name="mediaStoreUri" />\r
+ </input>\r
+ <input>\r
+ <variable name="fileName" />\r
+ </input>\r
+ <input>\r
+ <variable name="tempStoreUri" />\r
+ </input>\r
+ <input>\r
+ <variable name="fileName" />\r
+ </input>\r
+ </inputs>\r
+ </calljobstep> \r
+ <calljobstep type="PrepareRemoteTranscodeJobParametersStep.java" weight="1" >\r
+ <inputs>\r
+ <input>\r
+ <parameter name="profileName" />\r
+ </input>\r
+ <input>\r
+ <variable name="fileName" />\r
+ </input>\r
+ </inputs>\r
+ <outputs>\r
+ <output>\r
+ <variable name="remoteJobParameters" />\r
+ </output>\r
+ </outputs>\r
+ </calljobstep> \r
+ <calljobstep type="RemoteJobStep.java" weight="10" >\r
+ <inputs>\r
+ <input>\r
+ <parameter name="remoteServer" />\r
+ </input>\r
+ <input>\r
+ <parameter name="transcodeTemplate" />\r
+ </input>\r
+ <input>\r
+ <parameter name="jobName" />\r
+ </input>\r
+ <input>\r
+ <variable name="remoteJobParameters" />\r
+ </input>\r
+ </inputs>\r
+ </calljobstep>\r
+ </commands>\r
+</jobtemplate>
\ No newline at end of file
+++ /dev/null
-jobtemplate:\r
- multiInstance: true\r
- useSessionLog: true\r
- declarations:\r
- parameters:\r
- - name: param1\r
- type: java.lang.Integer\r
- - name: param1\r
- type: java.lang.Integer\r
- variables:\r
- - name: var1\r
- type: java.lang.Integer\r
- - name: var1\r
- type: java.lang.Integer\r
- commands:\r
- - type: Step1.java\r
- weight: 1\r
- inputs:\r
- - name: param1\r
- - name: param2\r
- outputs:\r
- - name: var1\r
- - name: var2\r
- - type: StepS.java\r
- weight: 1\r
- inputs:\r
- - name: var1\r
- - name: var2\r
-Djava.io.tmpdir=tmp ^\r
-Dfile.encoding=UTF-8 ^\r
-Dgosh.home=configuration ^\r
--jar plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar ^\r
+-jar ../../target/products/MediaCube/linux/gtk/x86_64/plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar ^\r
-Xms512m ^\r
-Xmx1024m ^\r
-console\r
--- /dev/null
+datasource:\r
+ mediacube:\r
+# url: jdbc:db2://10.11.1.90:50000/mc\r
+# user: db2admin\r
+# password: password\r
+ url: jdbc:db2://192.168.100.2:50000/mc\r
+ user: db2inst1\r
+ password: password\r
+# url: jdbc:db2://10.10.1.27:50000/mc\r
+# user: db2admin\r
+# password: password\r
+ external-indexer: false\r
+ simple-search: true\r
+ login-timeout: 3\r
+ pool-size: 10\r
+ mediacube-nosql:\r
+# url: jdbc:db2://10.11.1.90:50000/mc\r
+# user: db2admin\r
+# password: password\r
+ url: jdbc:db2://192.168.100.2:50000/mc\r
+ user: db2inst1\r
+ password: password\r
+# url: jdbc:db2://10.10.1.27:50000/mc\r
+# user: db2admin\r
+# password: password\r
+ schema: test\r
+ login-timeout: 3\r
+ hsm: \r
+ url: jdbc:db2://10.11.1.89:51500/tsmdb1\r
+ user: tsminst1\r
+ password: tsminst1\r
+ planair: \r
+ url: jdbc:sqlserver://10.11.254.86;databaseName=PA_Vivantis;\r
+ user: MAM\r
+ password: VDani\r
+services:\r
+ ffmpeg:\r
+ execurable-location: /opt/ffmpeg/ffmpeg \r
+ mediacube:\r
+ proxy-root: /mediacube/data/lowres\r
+ nexio:\r
+# host: 10.10.1.55\r
+# collection-name: nexioclips\r
+# use-mos-gateway: true\r
+ disabled: true\r
+jobs:\r
+ validate-transfers: false\r
+ copy-buffer-size: 32768\r
+ scheduled-execution-disabled: true\r
+tsm:\r
+ randomize-archives: false \r
+ delimiter: /\r
+ node-name: JOBENGINE\r
+ fs-name: /JOBENGINE\r
+ alternate-fs-name: /JOBENGINE\r
+ hl-name: /JOBENGINE\r
+
\ No newline at end of file
--- /dev/null
+datasource:\r
+ mediacube:\r
+ url: jdbc:db2://10.11.1.90:50000/mc\r
+ user: db2admin\r
+ password: password\r
+ external-indexer: false\r
+ simple-search: true\r
+ login-timeout: 3\r
+ pool-size: 10\r
+ mediacube-nosql:\r
+ url: jdbc:db2://10.11.1.90:50000/mc\r
+ user: db2admin\r
+ password: password\r
+ schema: test\r
+ login-timeout: 3\r
+ hsm: \r
+ url: jdbc:db2://10.11.1.89:51500/tsmdb1\r
+ user: tsminst1\r
+ password: tsminst1\r
+ planair: \r
+ url: jdbc:sqlserver://10.11.254.86;databaseName=PA_Vivantis;\r
+ user: MAM\r
+ password: VDani\r
+services:\r
+ ffmpeg:\r
+ execurable-location: /opt/ffmpeg/ffmpeg \r
+ mediacube:\r
+ proxy-root: /mediacube/data/lowres\r
+ nexio:\r
+# host: 10.10.1.55\r
+# collection-name: nexioclips\r
+# use-mos-gateway: true\r
+ disabled: true\r
+jobs:\r
+ validate-transfers: false\r
+ copy-buffer-size: 32768\r
+ scheduled-execution-disabled: true\r
+tsm:\r
+ randomize-archives: false \r
+ delimiter: /\r
+ node-name: JOBENGINE\r
+ fs-name: /JOBENGINE\r
+ alternate-fs-name: /JOBENGINE\r
+ hl-name: /JOBENGINE\r
+
\ No newline at end of file
datasource:\r
mediacube:\r
- url: jdbc:db2://192.168.100.2:50000/mc\r
- user: db2inst1\r
+ url: jdbc:db2://10.11.1.90:50000/mc\r
+ user: db2admin\r
password: password\r
-# url: jdbc:db2://10.10.1.27:50000/mc\r
-# user: db2admin\r
-# password: password\r
external-indexer: false\r
simple-search: true\r
login-timeout: 3\r
pool-size: 10\r
mediacube-nosql:\r
- url: jdbc:db2://192.168.100.2:50000/mc\r
- user: db2inst1\r
+ url: jdbc:db2://10.11.1.90:50000/mc\r
+ user: db2admin\r
password: password\r
-# url: jdbc:db2://10.10.1.27:50000/mc\r
-# user: db2admin\r
-# password: password\r
schema: test\r
login-timeout: 3\r
hsm: \r
mediacube:\r
proxy-root: /mediacube/data/lowres\r
nexio:\r
- host: 10.10.1.55\r
- collection-name: nexioclips\r
- use-mos-gateway: true\r
+# host: 10.10.1.55\r
+# collection-name: nexioclips\r
+# use-mos-gateway: true\r
disabled: true\r
jobs:\r
validate-transfers: false\r
--- /dev/null
+profiles:
+-
+ name: proxy
+ executable: /Programs/ffmpeg/bin/ffmpeg.exe
+ arguments:
+ - -y
+ - -v
+ - error
+ - -progress
+ - pipe:1
+ - -i
+ - "%i"
+ - "%o"
+-
+ name: length
+ executable: /Programs/ffmpeg/bin/ffprobe.exe
+ arguments:
+ - -v
+ - error
+ - -select_streams
+ - v:0
+ - -show_entries
+ - stream=nb_frames
+ - -of
+ - default=noprint_wrappers=1:nokey=1
+ - "%i"
+
\ No newline at end of file
+++ /dev/null
-location: /Programs/ffmpeg/bin/ffmpeg.exe
-default:
- - -v panic
- - -stats
- - -y
-profiles:
-- name: profile1
- settings:
- - setting1
- - setting2
-- name: profile2
- settings:
- - setting3
- - setting4
<?xml version="1.0" encoding="UTF-8"?>\r
<executors>\r
+ <executor className="QueryMissingProxyMediaStep.java" maxConcurrent="1" isRemote="false" />\r
+ <executor className="PrepareRemoteTranscodeJobParametersStep.java" maxConcurrent="1" isRemote="false" />\r
+ <executor className="TramsferStep.java" maxConcurrent="1" isRemote="false" />\r
+ <executor className="PrepareMediaRestoreStep.java" maxConcurrent="1" isRemote="false" />\r
+ <executor className="RemoteJobStep.java" maxConcurrent="1" isRemote="false" />\r
<executor className="TestForkCancelableStep.java" maxConcurrent="3" isRemote="false" />\r
<executor className="ArchiveRecursive.java" maxConcurrent="1" isRemote="false" />\r
<executor className="ArchiveListBuilderStep.java" maxConcurrent="1" isRemote="false" />\r
{"joblist":[\r
{\r
+ "template": "remote-transcode.xml",\r
+ "parameters": [ \r
+ {"name": "remoteServer", "value": "http://10.11.1.111:9080", "type": "java.lang.String"}, \r
+ {"name": "transcodeTemplate", "value": "create-proxy-ffmpeg.xml", "type": "java.lang.String"}, \r
+ {"name": "jobName", "value": "Create proxy (slave process)", "type": "java.lang.String"}, \r
+ {"name": "profileName", "value": "proxy", "type": "java.lang.String"},\r
+ {"name": "tempStoreName", "value": "LOCAL", "type": "java.lang.String"},\r
+ {"name": "tempStoreProtocol", "value": "LOCAL", "type": "java.lang.String"}\r
+ ]\r
+ },\r
+ {\r
"template": "test-fork-cancelable.xml",\r
"parameters": [ {"name": "itemID", "value": 1, "type": "java.lang.Long"} ]\r
},\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.io.ByteArrayInputStream;\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.io.OutputStream;\r
+import java.io.StringWriter;\r
+import java.io.UnsupportedEncodingException;\r
+import java.nio.file.Files;\r
+import java.nio.file.Path;\r
+import java.nio.file.Paths;\r
+import java.nio.file.attribute.FileAttribute;\r
+import java.nio.file.attribute.PosixFilePermission;\r
+import java.nio.file.attribute.PosixFilePermissions;\r
+import java.text.SimpleDateFormat;\r
+import java.util.Calendar;\r
+import java.util.Date;\r
+import java.util.Set;\r
+\r
+import javax.xml.parsers.DocumentBuilder;\r
+import javax.xml.parsers.DocumentBuilderFactory;\r
+import javax.xml.transform.OutputKeys;\r
+import javax.xml.transform.Transformer;\r
+import javax.xml.transform.TransformerConfigurationException;\r
+import javax.xml.transform.TransformerException;\r
+import javax.xml.transform.TransformerFactory;\r
+import javax.xml.transform.TransformerFactoryConfigurationError;\r
+import javax.xml.transform.dom.DOMSource;\r
+import javax.xml.transform.stream.StreamResult;\r
+\r
+import org.apache.commons.lang.StringUtils;\r
+import org.apache.commons.net.ftp.FTPClient;\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.w3c.dom.DOMImplementation;\r
+import org.w3c.dom.Document;\r
+import org.w3c.dom.Element;\r
+\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+import com.ibm.nosql.json.util.JSON;\r
+\r
+import user.commons.CalendarUtils;\r
+import user.commons.MediaCubeMarker;\r
+import user.commons.StoreUri;\r
+import user.commons.remotestore.FtpDirectoryLister;\r
+\r
+public class EscortFiles {\r
+ private static final String RECORDTIMESTAMP = "RecordTimeStamp";\r
+ private static final String MODIFIEDTIMESTAMP = "ModifiedTimeStamp";\r
+ public static final String DOT_CATCHED = ".catched";\r
+ public static final String DOT_JSON = ".json";\r
+ private static final Logger logger = LogManager.getLogger();\r
+ private static final String EXTENDEDAGENCY = "ExtendedAgency";\r
+ private static final String EXTENDEDDESCRIPTION = "ExtendedDescription";\r
+ private static final String KILLDATE = "KillDate";\r
+ private static final String FORMAT_KILLDATE = "MM-dd-yyyy";\r
+ private static final String EXTENDEDID = "extendedId";\r
+ private static final String ID = "ID";\r
+ private static final String KILLDATE_FILENAME = "%s.%s.killdate";\r
+ private static final String FORMAT_KILLDATENAME = "yyyyMMdd";\r
+ public static final String STATUSFOLDER = ".STATUS";\r
+ public static final String CONFLICTFOLDER = ".CONFLICT";\r
+\r
+ public static String composeKillDate(int days) {\r
+ Calendar killDate = Calendar.getInstance();\r
+ killDate.add(Calendar.DAY_OF_YEAR, days);\r
+ SimpleDateFormat dateFormat = new SimpleDateFormat(FORMAT_KILLDATENAME);\r
+ return dateFormat.format(killDate.getTime());\r
+ }\r
+ /*\r
+ * <?xml version="1.0" encoding="UTF-16"?> <ID extendedId="aaaaaaa">\r
+ * <KillDate>02-02-2018</KillDate> <ExtendedDescription>TEST\r
+ * TEST</ExtendedDescription> <ExtendedAgency>AGENT AGENT</ExtendedAgency>\r
+ * </ID>\r
+ */\r
+\r
+ private static String composeKillDateFileName(String fileName, int days) {\r
+ return String.format(KILLDATE_FILENAME, fileName, composeKillDate(days));\r
+ }\r
+\r
+ public static void createCatchedFile(Path escortFile) throws IOException {\r
+ Path catchedFilePath = Paths.get(escortFile.toString() + DOT_CATCHED);\r
+ Files.createFile(catchedFilePath);\r
+ }\r
+\r
+ public static void createFellow(String escortFile, String extension) throws IOException {\r
+ Files.copy(Paths.get(escortFile), Paths.get(escortFile + "." + extension));\r
+ }\r
+\r
+ /***\r
+ * A media eleresi utjan alapjan a .STATUS almappaban letrehozza a .catch fajlt.\r
+ *\r
+ * @param mediaFile\r
+ * @throws IOException\r
+ */\r
+ public static void createMediaCatch(Path mediaFile) throws IOException {\r
+ Path catchedFile = createMediaCathFilePath(mediaFile);\r
+ ensureUNCFolder(catchedFile.getParent());\r
+ Files.createFile(catchedFile);\r
+ }\r
+\r
+ private static Path createMediaCathFilePath(Path mediaFile) {\r
+ return Paths.get(mediaFile.getParent().toString(), STATUSFOLDER, mediaFile.getFileName() + DOT_CATCHED);\r
+ }\r
+\r
+ public static void createMetadata(String filePath, String fileName, String metadata) throws IOException {\r
+ ensureUNCFolder(filePath, STATUSFOLDER);\r
+ String metadataFileName = fileName + DOT_JSON;\r
+ Path metadataPath = Paths.get(filePath, STATUSFOLDER, metadataFileName);\r
+ Files.write(metadataPath, metadata.getBytes());\r
+ }\r
+\r
+ public static boolean createMetadataIfNotExists(String filePath, String fileName, String metadata) throws IOException {\r
+ boolean result = false;\r
+ if (!EscortFiles.isMetadataExists(filePath, fileName)) {\r
+ EscortFiles.createMetadata(filePath, fileName, metadata);\r
+ result = true;\r
+ }\r
+ return result;\r
+ }\r
+\r
+ public static void createMorpheusXML(String filePath, String fileName, String content) throws IOException {\r
+ ensureUNCFolder(filePath, STATUSFOLDER);\r
+ Path xmlPath = Paths.get(filePath, fileName);\r
+ if (Files.exists(xmlPath))\r
+ throw new IOException(String.format("Az '%s' állomány már létezik.", xmlPath));\r
+ Files.write(xmlPath, content.getBytes());\r
+ }\r
+\r
+ public static byte[] createNEXIODatesMeta(String fileName, Date recorded, Date modified) throws Exception {\r
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r
+ DocumentBuilder db = dbf.newDocumentBuilder();\r
+ DOMImplementation impl = db.getDOMImplementation();\r
+ Document xmlDocument = impl.createDocument(null, null, null);\r
+\r
+ Element root = xmlDocument.createElement(ID);\r
+ root.setAttribute(EXTENDEDID, fileName);\r
+ // <ModifiedTimeStamp>07-13-2020 (19:36:52)</ModifiedTimeStamp>\r
+ // <RecordTimeStamp>05-18-2013 (18:52:24)</RecordTimeStamp>\r
+ SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy (HH:mm:ss)");\r
+ root.appendChild(xmlDocument.createElement(MODIFIEDTIMESTAMP)).appendChild(xmlDocument.createTextNode(df.format(modified)));\r
+ root.appendChild(xmlDocument.createElement(RECORDTIMESTAMP)).appendChild(xmlDocument.createTextNode(df.format(recorded)));\r
+ xmlDocument.appendChild(root);\r
+\r
+ return xmDocumentToString(xmlDocument);\r
+ }\r
+\r
+ public static byte[] createNEXIOKillDateFile(String fileName, Date killDate, String description, String agency) throws Exception {\r
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r
+ DocumentBuilder db = dbf.newDocumentBuilder();\r
+ DOMImplementation impl = db.getDOMImplementation();\r
+ Document xmlDocument = impl.createDocument(null, null, null);\r
+\r
+ Element root = xmlDocument.createElement(ID);\r
+ root.setAttribute(EXTENDEDID, fileName);\r
+ if (killDate != null) {\r
+ String sKillDate = CalendarUtils.toString(CalendarUtils.createCalendar(killDate), FORMAT_KILLDATE);\r
+ root.appendChild(xmlDocument.createElement(KILLDATE)).appendChild(xmlDocument.createTextNode(sKillDate));\r
+ }\r
+\r
+ if (StringUtils.isNotBlank(description))\r
+ root.appendChild(xmlDocument.createElement(EXTENDEDDESCRIPTION)).appendChild(xmlDocument.createTextNode(description));\r
+ if (StringUtils.isNotBlank(agency))\r
+ root.appendChild(xmlDocument.createElement(EXTENDEDAGENCY)).appendChild(xmlDocument.createTextNode(agency));\r
+ xmlDocument.appendChild(root);\r
+\r
+ return xmDocumentToString(xmlDocument);\r
+ }\r
+\r
+ public static Document createNEXIOMeta(byte[] content) throws Exception {\r
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r
+ DocumentBuilder db = dbf.newDocumentBuilder();\r
+ DOMImplementation impl = db.getDOMImplementation();\r
+ Document xmlDocument = null;\r
+\r
+ try (InputStream is = new ByteArrayInputStream(content)) {\r
+ xmlDocument = db.parse(is);\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ }\r
+\r
+ return xmlDocument;\r
+ }\r
+\r
+ public static void createUNCKillDate(String filePath, String fileName, int days, Marker marker) throws IOException {\r
+ ensureUNCFolder(filePath, STATUSFOLDER);\r
+ String killDateFileName = composeKillDateFileName(fileName, days);\r
+ Path killDatePath = Paths.get(filePath, STATUSFOLDER, killDateFileName);\r
+ if (Files.exists(killDatePath))\r
+ logger.warn(marker, "Az '{}' állomány már létezik.", killDatePath);\r
+ else\r
+ Files.createFile(killDatePath);\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ public static <T> T decode(Path escortFile) {\r
+ T result = null;\r
+ try {\r
+ byte[] bytes = Files.readAllBytes(escortFile);\r
+ String content = new String(bytes);\r
+ result = (T) JSON.parse(content);\r
+ } catch (Exception e) {\r
+ logger.error("Decode error. System message is: ", e.getMessage());\r
+ }\r
+ return result;\r
+ }\r
+\r
+ public static void ensureUNCFolder(Path filePath) throws IOException {\r
+ File folder = filePath.toFile();\r
+ if (!folder.exists() || !folder.isDirectory()) {\r
+ Set<PosixFilePermission> perms = PosixFilePermissions.fromString("rwxrwxrwx");\r
+ FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perms);\r
+ try {\r
+ Files.createDirectories(filePath, attr);\r
+ } catch (Exception e) {\r
+ // logger.catching(e);\r
+ try {\r
+ Files.createDirectories(filePath);\r
+ } catch (Exception e1) {\r
+ logger.catching(e);\r
+ throw e;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ public static void ensureUNCFolder(String filePath, String folderName) throws IOException {\r
+ Path statusPath = Paths.get(filePath, folderName);\r
+ ensureUNCFolder(statusPath);\r
+ }\r
+\r
+ public static boolean isCatchedFileExists(Path escortFile) {\r
+ Path catchedFilePath = Paths.get(escortFile.toString() + DOT_CATCHED);\r
+ return catchedFilePath.toFile().exists();\r
+ }\r
+\r
+ /***\r
+ * A media eleresi utjan alapjan a .STATUS almappaban vizsgalja .catch fajl letezeset.\r
+ *\r
+ * @param mediaFile\r
+ * @return\r
+ */\r
+ public static boolean isMediaCatched(Path mediaFile) {\r
+ Path catchedFile = createMediaCathFilePath(mediaFile);\r
+ return catchedFile.toFile().exists();\r
+ }\r
+\r
+ public static boolean isMetadataExists(String filePath, String fileName) throws IOException {\r
+ boolean result = false;\r
+ String metadataFileName = fileName + DOT_JSON;\r
+ Path metadataPath = Paths.get(filePath, STATUSFOLDER, metadataFileName);\r
+ result = metadataPath.toFile().exists();\r
+ return result;\r
+ }\r
+\r
+ public static void notifyRecipient(Path escortFile, Logger logger, Message msg) {\r
+ if (escortFile.toFile().exists()) {\r
+ try {\r
+ BasicDBObject downloadable = EscortFiles.decode(escortFile);\r
+ String recipientKey = "recipient";\r
+ if (downloadable.containsKey(recipientKey)) {\r
+ String recipient = downloadable.getString(recipientKey);\r
+ logger.info(new MediaCubeMarker(recipient, "MediaCube rendszerüzenet"), msg);\r
+ }\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ }\r
+\r
+ }\r
+ }\r
+\r
+ public static void remove(Path file) {\r
+ try {\r
+ file.toFile().delete();\r
+ } catch (Exception e) {\r
+ logger.error("Unable to delete {}", file.toAbsolutePath().toString());\r
+ }\r
+ }\r
+\r
+ public static void removeCatchedFile(Path escortFile) {\r
+ remove(Paths.get(escortFile.toString() + DOT_CATCHED));\r
+ }\r
+\r
+ /***\r
+ * A media eleresi utjan alapjan a .STATUS almappabol torli a .catch fajlt.\r
+ *\r
+ * @param mediaFile\r
+ * @throws IOException\r
+ */\r
+ public static void removeMediaCatch(Path mediaFile) {\r
+ Path catchedFile = createMediaCathFilePath(mediaFile);\r
+ remove(catchedFile);\r
+ }\r
+\r
+ public static void setNEXIOKillDate(int killDateDays, String targetFileName, String nexioAgency, StoreUri targetUri) throws Exception {\r
+ OutputStream outStream = null;\r
+ try {\r
+ FTPClient targetFTP = ((FtpDirectoryLister) targetUri.getLister()).connect();\r
+ Calendar killDate = CalendarUtils.createCalendar(new Date());\r
+ killDate.add(Calendar.DAY_OF_YEAR, killDateDays);\r
+ if (targetFileName.toLowerCase().contains(".mxf"))\r
+ targetFileName = targetFileName.substring(0, targetFileName.lastIndexOf('.'));\r
+ byte[] killDateFile = EscortFiles.createNEXIOKillDateFile(targetFileName, killDate.getTime(), null, nexioAgency);\r
+ String xml = targetFileName + ".xml";\r
+ outStream = targetFTP.storeFileStream(xml);\r
+ if (outStream == null) {\r
+ throw new NullPointerException("Can not open: " + targetFileName.substring(0, targetFileName.lastIndexOf('.')) + ".xml" + " Reply:"\r
+ + targetFTP.getReplyString());\r
+ }\r
+ outStream.write(killDateFile);\r
+ outStream.flush();\r
+ } catch (Exception e) {\r
+ throw e;\r
+ } finally {\r
+ if (outStream != null)\r
+ outStream.close();\r
+ targetUri.cleanUp();\r
+ }\r
+ }\r
+\r
+ private static byte[] xmDocumentToString(Document xmlDocument)\r
+ throws TransformerFactoryConfigurationError, TransformerConfigurationException, TransformerException, IOException, UnsupportedEncodingException {\r
+ DOMSource domSource = new DOMSource(xmlDocument);\r
+ TransformerFactory tf = TransformerFactory.newInstance();\r
+ Transformer transformer = tf.newTransformer();\r
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");\r
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-16");\r
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");\r
+ StringWriter sw = new StringWriter();\r
+ StreamResult sr = new StreamResult(sw);\r
+ transformer.transform(domSource, sr);\r
+ String result = sw.toString();\r
+ sw.close();\r
+ return result.getBytes("UTF-16");\r
+ }\r
+}\r
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import java.io.BufferedReader;\r
+import java.io.InputStreamReader;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+public class ExternalCommand {\r
+ private static final Logger logger = LogManager.getLogger();\r
+ private ExternalProfile profile;\r
+\r
+ public ExternalCommand(ExternalProfile profile) {\r
+ this.profile = profile;\r
+ }\r
+\r
+ public String execute(String input, String output, boolean firstResponse, IExternalCallback responseCallBack) throws Exception {\r
+ List<String> arguments = getArguments(input, output);\r
+ List<String> command = new ArrayList<>();\r
+ command.add(profile.getExecutable());\r
+ command.addAll(arguments);\r
+\r
+ ProcessBuilder processBuilder = new ProcessBuilder();\r
+ processBuilder.command(command);\r
+\r
+ String result = null;\r
+ try {\r
+ logger.info("Executing : {}", processBuilder.command());\r
+\r
+ Process process = processBuilder.start();\r
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {\r
+ String line = null;\r
+ while ((line = reader.readLine()) != null) {\r
+ logger.debug("Process response: {}", line);\r
+ if (responseCallBack != null)\r
+ responseCallBack.onResponse(line);\r
+ //System.out.println(line);\r
+ if (line != null && line.length() > 0) {\r
+ result = line;\r
+ if (firstResponse)\r
+ break;\r
+ }\r
+ }\r
+ int exitCode = process.waitFor();\r
+ if (exitCode != 0) {\r
+ StringBuilder msg = new StringBuilder();\r
+ try (BufferedReader errReader = new BufferedReader(new InputStreamReader(process.getErrorStream()))) {\r
+ String errline = null;\r
+ while ((errline = errReader.readLine()) != null) {\r
+ msg.append(errline);\r
+ }\r
+ } catch (Exception ex) {\r
+ }\r
+\r
+ throw new Exception("Exited with error code : " + exitCode + ". " + msg);\r
+ }\r
+ } catch (Exception e) {\r
+ throw e;\r
+ }\r
+ } catch (Exception e) {\r
+ logger.error(e);\r
+ throw e;\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ private List<String> getArguments(String input, String output) {\r
+ List<String> result = new ArrayList<>();\r
+\r
+ profile.getArguments().forEach(i -> {\r
+ result.add(i.replace("%i", input).replace("%o", output));\r
+ });\r
+ return result;\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import user.commons.configuration.SystemConfiguration;\r
+\r
+public class ExternalCommandExecutor {\r
+\r
+ public void execute(String profileName, String input, String output, IExternalCallback responseCallBack) throws Exception {\r
+ ExternalCommand externalCommand = getExternalCommand(profileName);\r
+ externalCommand.execute(input, output, false, responseCallBack);\r
+ }\r
+\r
+ private ExternalCommand getExternalCommand(String profileName) throws Exception {\r
+ ExternalProfilesConfig config = SystemConfiguration.getInstance().load("settings/external-commands.yaml", ExternalProfilesConfig.class);\r
+\r
+ if (config == null)\r
+ throw new Exception("Missing external-commands.yaml configuration");\r
+\r
+ ExternalProfile selectedProfile = null;\r
+ for (ExternalProfile profile : config.getProfiles()) {\r
+ if (profileName.equals(profile.getName())) {\r
+ selectedProfile = profile;\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (selectedProfile == null)\r
+ throw new Exception("Missing profile " + profileName + " in external-commands.yaml configuration");\r
+\r
+ return new ExternalCommand(selectedProfile);\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import java.util.List;\r
+\r
+public class ExternalProfile {\r
+ private String executable;\r
+ private String name;\r
+ private List<String> arguments;\r
+\r
+ public List<String> getArguments() {\r
+ return arguments;\r
+ }\r
+\r
+ public String getExecutable() {\r
+ return executable;\r
+ }\r
+\r
+ public String getName() {\r
+ return name;\r
+ }\r
+\r
+ public void setArguments(List<String> arguments) {\r
+ this.arguments = arguments;\r
+ }\r
+\r
+ public void setExecutable(String executable) {\r
+ this.executable = executable;\r
+ }\r
+\r
+ public void setName(String name) {\r
+ this.name = name;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import java.util.List;\r
+\r
+public class ExternalProfilesConfig {\r
+ private List<ExternalProfile> profiles;\r
+\r
+ public List<ExternalProfile> getProfiles() {\r
+ return profiles;\r
+ }\r
+\r
+ public void setProfiles(List<ExternalProfile> profiles) {\r
+ this.profiles = profiles;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+public interface IExternalCallback {\r
+ void onResponse(String data);\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+\r
+import user.jobengine.db.IItemManager;\r
+import user.jobengine.db.IResultSetConsumer;\r
+\r
+public class ItemManagerExtensions {\r
+\r
+ public static BasicDBObject getArchiveInfo(IItemManager manager, long houseid) {\r
+ final BasicDBObject[] result = { null };\r
+ StringBuilder query = new StringBuilder();\r
+ query.append("select count(*) as count, sum(length) as duration FROM media");\r
+ query.append(" ");\r
+ query.append(String.format("where houseid='%d' and itemtypeid = 82", houseid));\r
+ query.append(" ");\r
+ query.append("group by houseid");\r
+ IResultSetConsumer consumer = rs -> {\r
+ BasicDBObject o = new BasicDBObject();\r
+ o.put("count", rs.getLong("count"));\r
+ o.put("duration", rs.getLong("duration"));\r
+ result[0] = o;\r
+ return false;\r
+ };\r
+ manager.executeQuery(query.toString(), consumer, null);\r
+ return result[0];\r
+ }\r
+\r
+ public static long getExistingRundownMedia(IItemManager manager, String houseid) {\r
+ final long[] result = { 0 };\r
+ final String[] idToCheck = { houseid };\r
+ int pos = houseid.lastIndexOf("-");\r
+ //a hivas a CopyForArchiveNEXIOMaterialsStep-bol is johet, ott meg nincs idobelyegezve a nev!\r
+ if (pos > 0 && houseid.length() - pos > 4)\r
+ idToCheck[0] = houseid.substring(0, pos);\r
+ MetadataType metadataType = MetadataTypeDetector.GuessMetadataType(idToCheck[0]);\r
+ if (metadataType == MetadataType.OctopusPlaceholder) {\r
+ StringBuilder query = new StringBuilder();\r
+ query.append("select mediaid, mediafilehouseid, filename");\r
+ query.append(" ");\r
+ query.append(String.format("from vw_rundown_items where mediafilehouseid like '%s%%'", idToCheck[0]));\r
+ query.append(" ");\r
+ query.append("order by filename, mediaid");\r
+ IResultSetConsumer consumer = rs -> {\r
+ String fileName = rs.getString("filename");\r
+ if (idToCheck[0].equals(fileName)) {\r
+ result[0] = rs.getLong("mediaid");\r
+ return false;\r
+ } else\r
+ return true;\r
+ };\r
+ manager.executeQuery(query.toString(), consumer, null);\r
+ }\r
+\r
+ return result[0];\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import javax.ws.rs.client.Entity;\r
+import javax.ws.rs.client.Invocation.Builder;\r
+import javax.ws.rs.core.MediaType;\r
+import javax.ws.rs.core.MultivaluedMap;\r
+import javax.ws.rs.core.Response;\r
+import javax.ws.rs.core.Response.Status;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+import org.jboss.resteasy.client.jaxrs.ResteasyClient;\r
+import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;\r
+import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;\r
+import org.jboss.resteasy.specimpl.MultivaluedMapImpl;\r
+\r
+import com.ibm.nosql.json.JSONUtil;\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+\r
+public class MediaCubeClient {\r
+ private static Logger logger = LogManager.getLogger();\r
+ private ResteasyWebTarget webTarget;\r
+\r
+ public MediaCubeClient(String address) {\r
+ ResteasyClient client = new ResteasyClientBuilder().build();\r
+ webTarget = client.target(address);\r
+ }\r
+\r
+ BasicDBObject getDbObject(String json) {\r
+ BasicDBObject result = (BasicDBObject) JSONUtil.jsonToDbObject(json);\r
+\r
+ if (result == null)\r
+ throw new NullPointerException("API Result is null!");\r
+\r
+ if (result.containsKey("exception")) {\r
+ BasicDBObject e = (BasicDBObject) result.get("exception");\r
+ throw new RuntimeException(e.getString("message"));\r
+ }\r
+ //{"exception":{"message":"Invalid credentials.","publicName":"AuthenticationFailedException"}}\r
+ return result;\r
+ }\r
+\r
+ public BasicDBObject getStatus(long jobId) {\r
+ MultivaluedMap<String, Object> vars = new MultivaluedMapImpl<>();\r
+ vars.add("jobId", jobId);\r
+ Response response = query("services/rest/jobengine/jobstatus", vars).get();\r
+ if (response.getStatus() != Status.OK.getStatusCode()) {\r
+ logger.error(response.readEntity(String.class));\r
+ System.out.println(response.readEntity(String.class));\r
+ return null;\r
+ }\r
+ String result = response.readEntity(String.class);\r
+ return getDbObject(result);\r
+ }\r
+\r
+ private Builder query(String path, MultivaluedMap<String, Object> vars) {\r
+ ResteasyWebTarget target = webTarget.path(path).queryParams(vars);\r
+ Builder result = target.request();\r
+ return result;\r
+ }\r
+\r
+ public long startjob(String template, String name, BasicDBObject jobParams) throws Exception {\r
+ MultivaluedMap<String, Object> vars = new MultivaluedMapImpl<>();\r
+ vars.add("template", template);\r
+ vars.add("name", name);\r
+ Response response = query("services/rest/jobengine/startjob", vars).post(Entity.entity(jobParams.toString(), MediaType.APPLICATION_JSON));\r
+\r
+ if (response.getStatus() != Status.OK.getStatusCode()) {\r
+ logger.error(response.readEntity(String.class));\r
+ return 0;\r
+ }\r
+\r
+ String resultObject = response.readEntity(String.class);\r
+ return Long.parseLong(resultObject);\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+public enum MetadataType {\r
+ TrafficMaterial, TrafficPromo, TrafficAD, OctopusStory, OctopusPlaceholder, Generic\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import org.apache.commons.lang.StringUtils;\r
+\r
+public class MetadataTypeDetector {\r
+\r
+ private static final String HYPHEN = "-";\r
+ private static final String DOT = ".";\r
+\r
+ private static final String REGEXP_TRAFFICMATERIALID = "^M{1}[0-9]{6}[A-Z]{1}$";\r
+ private static final String REGEXP_TRAFFICADID = "^R{1}[0-9]{6}[A-Z]{1}$";\r
+ private static final String REGEXP_TRAFFICPROMOID = "^P{1}[0-9]{6}[A-Z]{1}$";\r
+ private static final String REGEXP_OCTOPUSSTORYID = "^[0-9]+$";\r
+ private static final String REGEXP_OCTOPUSPLACEHOLDERID = "^[0-9]+_[0-9]+$";\r
+ private static final String REGEXP_OCTOPUSPLACEHOLDERVERSIONEDID = "^[0-9]+_[0-9]+-[0-9]{3}$";\r
+\r
+ public static MetadataType GuessMetadataType(String id) {\r
+ if (StringUtils.isBlank(id))\r
+ return MetadataType.Generic;\r
+ if (id.matches(REGEXP_TRAFFICMATERIALID))\r
+ return MetadataType.TrafficMaterial;\r
+ if (id.matches(REGEXP_TRAFFICPROMOID))\r
+ return MetadataType.TrafficPromo;\r
+ if (id.matches(REGEXP_TRAFFICADID))\r
+ return MetadataType.TrafficAD;\r
+ if (id.matches(REGEXP_OCTOPUSSTORYID))\r
+ return MetadataType.OctopusStory;\r
+ if (id.matches(REGEXP_OCTOPUSPLACEHOLDERID))\r
+ return MetadataType.OctopusPlaceholder;\r
+ if (id.matches(REGEXP_OCTOPUSPLACEHOLDERVERSIONEDID))\r
+ return MetadataType.OctopusPlaceholder;\r
+ return MetadataType.Generic;\r
+ }\r
+\r
+ public static String truncateExtension(String name) {\r
+ String result = name;\r
+ if (result != null && result.contains(DOT))\r
+ result = result.substring(0, result.lastIndexOf(DOT));\r
+ return result;\r
+ }\r
+\r
+ public static String truncateVersion(String name) {\r
+ String result = name;\r
+ if (result != null && result.contains(HYPHEN))\r
+ result = result.split(HYPHEN)[0];\r
+ return result;\r
+ }\r
+\r
+}\r
import user.jobengine.server.IJobEngine;\r
import user.jobengine.server.IJobRuntime;\r
\r
+/*\r
+package user.jobengine.server.steps.MetadataType;\r
+package user.jobengine.server.steps.MetadataTypeDetector;\r
+package user.jobengine.server.steps.EscortFiles;\r
+*/\r
+\r
public class OutputPathAndNameSelectorStep extends JobStep {\r
\r
private static final String TARGETNAMEPATTERN = "-ARCH-%s";\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+import user.commons.StoreUri;\r
+import user.commons.remotestore.RemoteStoreProtocol;\r
+import user.jobengine.db.Media;\r
+import user.jobengine.db.MediaFile;\r
+\r
+public class PrepareMediaRestoreStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ @StepEntry\r
+ public Object[] execute(Media media, String mediaStoreProtocol, String tempStoreName, String tempStoreProtocol) throws Exception {\r
+ StoreUri mediaStoreUri = null;\r
+ for (MediaFile mediaFile : media.getMediaFiles()) {\r
+ if (mediaFile.getStore().isSystem() && !mediaFile.getStore().isLowres()) {\r
+ mediaStoreUri = mediaFile.getStore().getStoreUri(Enum.valueOf(RemoteStoreProtocol.class, mediaStoreProtocol));\r
+ if (mediaStoreUri != null)\r
+ break;\r
+ }\r
+ }\r
+\r
+ StoreUri tempStoreUri = getManager().getStoreUri(tempStoreName, Enum.valueOf(RemoteStoreProtocol.class, tempStoreProtocol));\r
+\r
+ return new Object[] { mediaStoreUri, tempStoreUri, media.getMediaFileRealName() };\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.nio.file.Paths;\r
+\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+\r
+public class PrepareRemoteTranscodeJobParametersStep extends JobStep {\r
+ @StepEntry\r
+ public Object[] execute(String profileName, String fileName) throws Exception {\r
+ String transcoderInputDir = "m:\";\r
+ String transcoderOutputDir = "m:\";\r
+ String outFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ".mp4";\r
+ BasicDBObject parameters = new BasicDBObject();\r
+ parameters.put("profile", profileName);\r
+ parameters.put("input", Paths.get(transcoderInputDir, fileName));\r
+ parameters.put("output", Paths.get(transcoderOutputDir, outFileName));\r
+ return new Object[] { parameters };\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\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.MediaCubeUndoMarker;\r
+import user.commons.nosql.NoSQLUtils;\r
+import user.jobengine.db.IItemManager;\r
+import user.jobengine.db.Media;\r
+\r
+public class QueryMissingProxyMediaStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ @StepEntry\r
+ public Object[] execute() throws Exception {\r
+ Object[] result = new Object[] { null };\r
+ DB db = NoSQLUtils.getNoSQLDB();\r
+ DBCollection collection = db.getCollection("missing_lowres");\r
+ Media media = getFirstUntranscodedMedia(collection);\r
+\r
+ try {\r
+ if (media == null) {\r
+ logger.info(new MediaCubeUndoMarker(getSessionMarker().getSessionID()), "Nincs feldolgozandó hiány.");\r
+ // throw new Exception("Nincs feldolgozandó hiány.");\r
+ cancel();\r
+ return null;\r
+ }\r
+\r
+ String name = media.getMediaFileRealName();\r
+ collection.save(new BasicDBObject("name", name));\r
+ logger.info(getSessionMarker(), "Processing mediaID: {}", media.getId());\r
+ result[0] = media;\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ logger.error(getSessionMarker(), e.getMessage());\r
+ throw e;\r
+ } finally {\r
+ setProgress(100);\r
+ }\r
+ return result;\r
+ }\r
+\r
+ private Media getFirstUntranscodedMedia(DBCollection collection) {\r
+ Media[] result = new Media[] { null };\r
+ //MV\r
+ String query = "SELECT mediaid FROM VW_MISSING_PROXY_IDS WHERE HOUSEID like 'M%' or HOUSEID like 'P%' or HOUSEID like 'R%' ORDER BY modified DESC";\r
+\r
+ //HTV\r
+ //String query = "SELECT mediaid FROM VW_MISSING_PROXY_IDS";\r
+ IItemManager manager = getManager();\r
+ manager.executeQuery(query, rs -> {\r
+ try {\r
+ long mediaId = rs.getLong(1);\r
+ Media media = manager.getMedia(mediaId);\r
+ //a nevgeneralas miatt az eredeti MediaFilesName nem jo, a pontos nev kell nekunk\r
+ String name = media.getMediaFileRealName();\r
+ logger.info(getSessionMarker(), "Checking {}", name);\r
+ long existing = collection.find(new BasicDBObject("name", name)).count();\r
+ if (existing > 0) {\r
+ logger.info(getSessionMarker(), "{} is on missing_lowres list", name);\r
+ return true;\r
+ }\r
+\r
+ result[0] = media;\r
+ } catch (Exception e) {\r
+ logger.error(e);\r
+ }\r
+ return false;\r
+ }, null);\r
+ return result[0];\r
+ }\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+\r
+/*\r
+import user.jobengine.server.steps.MediaCubeClient;\r
+*/\r
+public class RemoteJobStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ @StepEntry\r
+ public Object[] execute(String server, String template, String name, String profile) throws Exception {\r
+ try {\r
+ MediaCubeClient mc = new MediaCubeClient(server);\r
+ BasicDBObject params = new BasicDBObject();\r
+ params.put("profile", profile);\r
+ params.put("input", "c:/_workspace/data/video/proba1.mxf");\r
+ params.put("output", "c:/_video/proba1.mp4");\r
+\r
+ long jobId = mc.startjob(template, name, params);\r
+ logger.info(getMarker(), "Started {} on server {}", jobId, server);\r
+ while (true) {\r
+ BasicDBObject status = mc.getStatus(jobId);\r
+ if (status != null)\r
+ setProgress(status.getInt("progress"));\r
+\r
+ String jobStatus = status.getString("status");\r
+ if ("SUSPENDED".equals(jobStatus))\r
+ throw new Exception(status.getString("description"));\r
+\r
+ if ("FINISHED".equals(jobStatus))\r
+ break;\r
+ }\r
+\r
+ } catch (Exception e) {\r
+ throw e;\r
+ }\r
+ return new Object[] { null };\r
+ }\r
+}\r
\r
import java.io.IOException;\r
import java.nio.file.Paths;\r
+import java.text.Normalizer;\r
import java.util.List;\r
+import java.util.regex.Pattern;\r
\r
import org.apache.commons.lang.StringUtils;\r
import org.apache.logging.log4j.LogManager;\r
import user.jobengine.server.IJobRuntime;\r
\r
public class TSMRestoreStep extends JobStep {\r
+ private static final String DOT = ".";\r
+ public static final Pattern DIACRITICS_AND_FRIENDS = Pattern.compile("[\\p{InCombiningDiacriticalMarks}\\p{IsLm}\\p{IsSk}]+");\r
private static final Logger logger = LogManager.getLogger();\r
private IItemManager manager;\r
private StoreUri targetUri;\r
marker = jobRuntime.getSessionMarker();\r
setAndCheck(mediaCubeMedia, targetPath, targetNamePattern, localRetrievePath, globalRetrievePath, jobEngine);\r
String targetFileName = String.format(targetNamePattern, sourceFileName);\r
+ //20210129\r
+ //targetFileName = getMaximizedFileName(mediaCubeMedia, targetFileName, 120);\r
+\r
Timecode timecode = new Timecode(mediaCubeMedia.getLength(), Type.PAL);\r
try {\r
String details = String.format("%s (%s)", sourceFileName, timecode.toString());\r
return null;\r
}\r
\r
+ private String getMaximizedFileName(Media mediaCubeMedia, String targetFileName, int limit) {\r
+ String name = targetFileName;\r
+ String extension = "";\r
+ if (name.contains(DOT)) {\r
+ extension = DOT + name.substring(name.lastIndexOf(DOT) + 1);\r
+ name = name.substring(0, name.lastIndexOf(DOT));\r
+ }\r
+ String typeName = Normalizer.normalize(mediaCubeMedia.getItemType().getName(), Normalizer.Form.NFD);\r
+ typeName = DIACRITICS_AND_FRIENDS.matcher(typeName).replaceAll("");\r
+ typeName = typeName.replace(" ", "_");\r
+\r
+ int allowedSize = limit - typeName.length() - 1 - extension.length();\r
+ if (name.length() > allowedSize)\r
+ name = name.substring(0, allowedSize);\r
+\r
+ return String.format("%s_%s%s", name, typeName, extension);\r
+ }\r
+\r
private String getSourceFileName(Media mediaCubeMedia, Store store) {\r
List<MediaFile> mediaFiles = mediaCubeMedia.getMediaFiles();\r
if (mediaFiles == null)\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<jobtemplate multiInstance="true" useSessionLog="true">\r
+ <declarations>\r
+ <parameters>\r
+ <!-- Slave server address for transcode -->\r
+ <parameter name="remoteServer" type="java.lang.String" />\r
+ <!-- Slave server template for transcode -->\r
+ <parameter name="transcodeTemplate" type="java.lang.String" />\r
+ <!-- Slave server job display name -->\r
+ <parameter name="jobName" type="java.lang.String" />\r
+ <!-- Slave server transcode job profile -->\r
+ <parameter name="profileName" type="java.lang.String" />\r
+ <!-- TEMP store for media retrieve -->\r
+ <parameter name="tempStoreName" type="java.lang.String" />\r
+ <!-- TEMP store protocol for media retrieve -->\r
+ <parameter name="tempStoreProtocol" type="java.lang.String" />\r
+ </parameters>\r
+ <variables>\r
+ <!-- Media to transcode -->\r
+ <variable name="media" type="user.jobengine.db.Media" />\r
+ <!-- Media file name -->\r
+ <variable name="fileName" type="java.lang.String" />\r
+ <!-- Media store uri -->\r
+ <variable name="mediaStoreUri" type="user.commons.StoreUri" />\r
+ <!-- TEMP store uri -->\r
+ <variable name="tempStoreUri" type="user.commons.StoreUri" />\r
+ <!-- Slave server remote job parameters -->\r
+ <variable name="remoteJobParameters" type="com.ibm.nosql.json.api.BasicDBObject" />\r
+ </variables>\r
+ </declarations>\r
+ <commands>\r
+ <calljobstep type="QueryMissingProxyMediaStep.java" weight="1" >\r
+ <outputs>\r
+ <output>\r
+ <variable name="media" />\r
+ </output>\r
+ </outputs>\r
+ </calljobstep> \r
+ <calljobstep type="PrepareMediaRestoreStep.java" weight="1" >\r
+ <inputs>\r
+ <input>\r
+ <variable name="media" />\r
+ </input>\r
+ <input>\r
+ <parameter name="tempStoreName" />\r
+ </input>\r
+ <input>\r
+ <parameter name="tempStoreProtocol" />\r
+ </input>\r
+ </inputs>\r
+ <outputs>\r
+ <output>\r
+ <variable name="mediaStoreUri" />\r
+ </output>\r
+ <output>\r
+ <variable name="tempStoreUri" />\r
+ </output>\r
+ <output>\r
+ <variable name="fileName" />\r
+ </output>\r
+ </outputs>\r
+ </calljobstep> \r
+ <calljobstep type="TransferStep.java" weight="5" >\r
+ <inputs>\r
+ <input>\r
+ <variable name="mediaStoreUri" />\r
+ </input>\r
+ <input>\r
+ <variable name="fileName" />\r
+ </input>\r
+ <input>\r
+ <variable name="tempStoreUri" />\r
+ </input>\r
+ <input>\r
+ <variable name="fileName" />\r
+ </input>\r
+ </inputs>\r
+ </calljobstep> \r
+ <calljobstep type="PrepareRemoteTranscodeJobParametersStep.java" weight="1" >\r
+ <inputs>\r
+ <input>\r
+ <parameter name="profileName" />\r
+ </input>\r
+ <input>\r
+ <variable name="fileName" />\r
+ </input>\r
+ </inputs>\r
+ <outputs>\r
+ <output>\r
+ <variable name="remoteJobParameters" />\r
+ </output>\r
+ </outputs>\r
+ </calljobstep> \r
+ <calljobstep type="RemoteJobStep.java" weight="10" >\r
+ <inputs>\r
+ <input>\r
+ <parameter name="remoteServer" />\r
+ </input>\r
+ <input>\r
+ <parameter name="transcodeTemplate" />\r
+ </input>\r
+ <input>\r
+ <parameter name="jobName" />\r
+ </input>\r
+ <input>\r
+ <variable name="remoteJobParameters" />\r
+ </input>\r
+ </inputs>\r
+ </calljobstep>\r
+ </commands>\r
+</jobtemplate>
\ No newline at end of file
+++ /dev/null
-jobtemplate:\r
- multiInstance: true\r
- useSessionLog: true\r
- declarations:\r
- parameters:\r
- - name: param1\r
- type: java.lang.Integer\r
- - name: param1\r
- type: java.lang.Integer\r
- variables:\r
- - name: var1\r
- type: java.lang.Integer\r
- - name: var1\r
- type: java.lang.Integer\r
- commands:\r
- - type: Step1.java\r
- weight: 1\r
- inputs:\r
- - name: param1\r
- - name: param2\r
- outputs:\r
- - name: var1\r
- - name: var2\r
- - type: StepS.java\r
- weight: 1\r
- inputs:\r
- - name: var1\r
- - name: var2\r
user: MAM\r
password: VDani\r
services:\r
- ffmpeg:\r
- execurable-location: /opt/ffmpeg/ffmpeg \r
mediacube:\r
proxy-root: /mediacube/data/lowres\r
- nexio:\r
- host: 10.10.1.55\r
- collection-name: nexioclips\r
- use-mos-gateway: true\r
- disabled: true\r
jobs:\r
validate-transfers: false\r
copy-buffer-size: 32768\r
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.commons.io.filefilter;version="2.2.0",
org.apache.commons.io.output;version="2.2.0",
+ org.apache.commons.logging,
+ org.apache.commons.logging.impl,
org.apache.ibatis.jdbc;version="3.5.2",
org.codehaus.groovy.control;version="3.0.3",
org.junit
--- /dev/null
+profiles:
+-
+ name: profile1
+ executable: /Programs/ffmpeg/bin/ffmpeg.exe
+ arguments:
+ - -y
+ - -v
+ - error
+ - -progress
+ - pipe:1
+ - -i
+ - "%i"
+ - "%o"
+-
+ name: length
+ executable: /Programs/ffmpeg/bin/ffprobe.exe
+ arguments:
+ - -v
+ - error
+ - -select_streams
+ - v:0
+ - -show_entries
+ - stream=nb_frames
+ - -of
+ - default=noprint_wrappers=1:nokey=1
+ - "%i"
+
\ No newline at end of file
import user.commons.StoreUri;\r
import user.commons.configuration.IConfiguration;\r
import user.commons.configuration.SystemConfiguration;\r
+import user.commons.mediaarea.MediaArea;\r
import user.commons.mediaarea.StreamKind;\r
import user.commons.mediatool.Timecode;\r
import user.commons.mediatool.Timecode.Type;\r
import user.jobengine.server.steps.ArchiveItem;\r
import user.jobengine.server.steps.EscortFiles;\r
import user.jobengine.server.steps.FFMpeg;\r
+import user.jobengine.server.steps.MediaCubeClient;\r
import user.jobengine.server.steps.TSMExtendedRetrieveStep;\r
+import user.jobengine.server.steps.shared.ExternalCommandExecutor;\r
\r
public class SmallTests {\r
class Pojo extends PojoRoot {\r
}\r
}\r
\r
+ //MediaCube client\r
+ @Test\r
+ public void test999994() throws Exception {\r
+ MediaCubeClient mc = new MediaCubeClient("http://localhost:9080");\r
+ BasicDBObject params = new BasicDBObject("param", 10L);\r
+ long jobId = mc.startjob("cancelable.xml", "Teszt job", params);\r
+ System.out.println("Started " + jobId);\r
+ while (true) {\r
+ BasicDBObject status = mc.getStatus(jobId);\r
+ String jobStatus = status.getString("status");\r
+ System.out.println(jobStatus + ", " + status.getString("progress"));\r
+ Thread.sleep(1000);\r
+ if ("SUSPENDED".equals(jobStatus) || "FINISHED".equals(jobStatus))\r
+ break;\r
+ }\r
+ }\r
+\r
+ @Test\r
+ public void test999995() throws Exception {\r
+ long progress[] = { 0, 0 };\r
+ System.setProperty("user.dir", "c:\\temp");\r
+ System.setProperty("jna.library.path", "c:\\temp");\r
+ System.setProperty("java.library.path", "c:\\temp");\r
+ MediaArea ma = new MediaArea(Paths.get("c:\\_workspace\\data\\video\\1.mxf"));\r
+ System.out.println(ma.inform());\r
+ ma.process();\r
+ System.out.println(ma.getFrameCount());\r
+\r
+ ExternalCommandExecutor executor = new ExternalCommandExecutor();\r
+ executor.execute("profile1", "c:\\_workspace\\data\\video\\1.mxf", "c:\\_video\\test1.mp4", e -> {\r
+ String[] values = e.split("=");\r
+ if ("frame".equals(values[0])) {\r
+ progress[1] = Integer.parseInt(values[1]);\r
+\r
+ long p = (int) (progress[1] * 100) / progress[0];\r
+ if (p > 0)\r
+ System.out.println(p);\r
+ }\r
+ });\r
+ }\r
+\r
}\r
<?xml version="1.0" encoding="UTF-8"?>\r
<classpath>\r
+ <classpathentry exported="true" kind="lib" path="lib/datahandler-syntax-highlight-1.0.0.jar"/>\r
<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.10.jar"/>\r
<classpathentry exported="true" kind="lib" path="lib/commons-fileupload-1.2.1.jar"/>\r
<classpathentry exported="true" kind="lib" path="lib/commons-io-1.4.jar"/>\r
lib/zsoup.jar,
lib/zul.jar,
lib/zuti.jar,
- lib/zweb.jar
+ lib/zweb.jar,
+ lib/datahandler-syntax-highlight-1.0.0.jar
Export-Package: bsh,
bsh.classpath,
bsh.collection,
lib/zsoup.jar,\\r
lib/zul.jar,\\r
lib/zuti.jar,\\r
- lib/zweb.jar\r
+ lib/zweb.jar,\\r
+ lib/datahandler-syntax-highlight-1.0.0.jar\r
<classpath>\r
<classpathentry kind="src" path="src"/>\r
<classpathentry kind="src" path="amc"/>\r
- <classpathentry kind="src" path="mediavivantis"/>\r
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
<classpathentry kind="output" path="bin"/>\r
if (Math.abs(frames - expectedFrameNumber) > 3) {\r
Message msg = new ParameterizedMessage("Validációs hiba miatt a {} fájl másolása nem lehetséges.", filePath.getFileName());\r
EscortFiles.notifyRecipient(Paths.get(escortFile), logger, msg);\r
-\r
- //200924 komment, mert a mar TSM-bol letoltott mozikat hagyjuk ott, a download irany ugyis felulir\r
- //EscortFiles.remove(filePath);\r
- //EscortFiles.remove(Paths.get(escortFile));\r
-\r
- //200911 a kommentet kivettem, mert ezeket is torolni kell\r
- EscortFiles.remove(Paths.get(escortFile + EscortFiles.DOT_CATCHED));\r
+ getJobRuntime().setDisableRetry(true);\r
throw new Exception("Length mismatch in " + filePath + ". Expected: " + expectedFrameNumber + ", found: " + frames);\r
}\r
- if (frames != expectedFrameNumber)\r
- logger.warn(getSessionMarker(), "A {} fájl másolása lehetséges, de a képkockaszám nem egyezik. Várt: {}, aktuális: {}",\r
- expectedFrameNumber, frames);\r
}\r
\r
if (StringUtils.isNotBlank(exceptedColorSpace)) {\r
for (int i = 0; i < count; i++) {\r
if (getJobRuntime().isWaitingCancel())\r
break;\r
+\r
Thread.sleep(200);\r
int progress = (i + 1) * 100 / count;\r
setProgress(progress);\r
import user.commons.StoreUri;\r
import user.commons.remotestore.RemoteStoreProtocol;\r
import user.jobengine.db.Store;\r
-import user.jobengine.server.IJobEngine;\r
-import user.jobengine.server.IJobRuntime;\r
\r
public class CleanupMountedLocationStep extends JobStep implements FileVisitor<Path> {\r
\r
private Path sourcePath;\r
private SimpleDateFormat dateFormat;\r
private StoreUri tsmStoreUri;\r
+ private boolean skipArchiveCheck;\r
\r
private Date checkExpiration(List<Path> killDateFiles) {\r
Date killDate = null;\r
}\r
\r
@StepEntry\r
- public Object[] execute(String sourceFolder, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception {\r
+ public Object[] execute(String sourceFolder, boolean skipArchiveCheck) throws Exception {\r
+ this.skipArchiveCheck = skipArchiveCheck;\r
marker = getSessionMarker();\r
sourcePath = Paths.get(sourceFolder);\r
DirectoryStream<Path> directoryStream = null;\r
if (killDate == null)\r
return;\r
\r
- if (filePath.toFile().length() > 0) {\r
+ if (!skipArchiveCheck && filePath.toFile().length() > 0) {\r
if (!isArchived(filePath)) {\r
logger.error(marker, "A(z) {} anyag törlésre van kijelölve, de nem található az archívumban.", filePath);\r
return;\r
import user.commons.configuration.SystemConfiguration;\r
\r
public class Cmd {\r
- interface IResponseCallback {\r
+ public interface IResponseCallback {\r
void onResponse(String line);\r
}\r
\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.nio.file.Path;\r
+import java.nio.file.Paths;\r
+\r
+import user.commons.StoreUri;\r
+import user.commons.remotestore.RemoteStoreProtocol;\r
+\r
+public class EnsureProxyPathExistanceStep extends JobStep {\r
+ @StepEntry\r
+ public Object[] execute(String tempStoreName, String tempStoreProtocol, String fileName) throws Exception {\r
+ StoreUri tempStoreUri = getManager().getStoreUri(tempStoreName, Enum.valueOf(RemoteStoreProtocol.class, tempStoreProtocol));\r
+ Path webPath = Paths.get(tempStoreUri.toString(true));\r
+ if (fileName.length() > 2) {\r
+ Path subdir = Paths.get(fileName.substring(0, 1), fileName.substring(1, 2), fileName.substring(2, 3));\r
+ EscortFiles.ensureUNCFolder(webPath.toString(), subdir.toString());\r
+ } else {\r
+ EscortFiles.ensureUNCFolder(webPath.toString(), fileName);\r
+ }\r
+ return new Object[] { null };\r
+ }\r
+\r
+}\r
import org.apache.logging.log4j.LogManager;\r
import org.apache.logging.log4j.Logger;\r
\r
-import com.ibm.nosql.json.api.BasicDBObject;\r
-\r
-import user.commons.configuration.SystemConfiguration;\r
import user.commons.mediatool.MediaInfo;\r
\r
public class FFMpeg {\r
+\r
public interface IProgressChanged {\r
void onProgressChanged(long progress);\r
}\r
Files.write(Paths.get(output, "index.m3u8"), indexLines);\r
}\r
\r
+\r
+\r
static public void withProfile(String input, String output, String profile, IProgressChanged progressCallback) throws Exception {\r
- BasicDBObject config = SystemConfiguration.getInstance().load("ffmpeg.yaml", BasicDBObject.class);\r
+\r
\r
StringBuilder sb = new StringBuilder();\r
sb.append("-v panic -stats -y")\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.nio.file.Path;\r
+import java.nio.file.Paths;\r
+import java.util.concurrent.CountDownLatch;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+import user.commons.ListUtils;\r
+import user.jobengine.db.ArchivedMedia;\r
+import user.jobengine.db.Item;\r
+import user.jobengine.db.Media;\r
+\r
+public class IntegrationTestStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ @StepEntry\r
+ public Object[] execute() throws Exception {\r
+ try {\r
+ //test_cancelable(finishLatch);\r
+ ArchivedMedia archivedMedia = new ArchivedMedia();\r
+ Media media = getManager().getMedia(15285);\r
+ Item item = getManager().getItem(media.getItemId());\r
+ archivedMedia.setItem(item);\r
+ archivedMedia.setMedia(media);\r
+ test_retrieve_ondemand(archivedMedia);\r
+ Path output = Paths.get("/mediacube/data", archivedMedia.getMedia().getHouseId(),\r
+ archivedMedia.getMedia().getHouseId() + "-ARCH-" + archivedMedia.getMedia().getMediaFileRealName());\r
+ if (!output.toFile().exists())\r
+ throw new Exception("File not exists: " + output);\r
+\r
+ test_delete_materials(output.getParent().toString());\r
+\r
+ if (output.toFile().exists())\r
+ throw new Exception("File exists: " + output);\r
+\r
+ } catch (Exception e) {\r
+ logger.info(e.getMessage());\r
+ throw e;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ private void test_cancelable() throws Exception {\r
+ CountDownLatch finishLatch = new CountDownLatch(1);\r
+ getEngine().submit(null, e -> {\r
+ if (e.isRuntimeTerminated())\r
+ finishLatch.countDown();\r
+ }, "cancelable.xml", "Test cancelable", ListUtils.asMap("param", 1));\r
+ finishLatch.await();\r
+ }\r
+\r
+ private void test_delete_materials(String source) throws Exception {\r
+ CountDownLatch finishLatch = new CountDownLatch(1);\r
+ getEngine().submit(null, e -> {\r
+ if (e.isRuntimeTerminated())\r
+ finishLatch.countDown();\r
+ }, "delete-materials.xml", "Test delete-materials", ListUtils.asMap("sourcePath", source, "skipArchiveCheck", true));\r
+ finishLatch.await();\r
+ }\r
+\r
+ private void test_retrieve_ondemand(ArchivedMedia archivedMedia) throws Exception {\r
+\r
+ CountDownLatch finishLatch = new CountDownLatch(1);\r
+ getEngine().submit(null, e -> {\r
+ if (e.isRuntimeTerminated())\r
+ finishLatch.countDown();\r
+\r
+ }, "retrieve-ondemand.xml", "Test retrieve-ondemand",\r
+ ListUtils.asMap("globalRetrievePath", "file://10.11.1.100", "localRetrievePath", "/mediacube/data", "materialOutputFolder", "/",\r
+ "promoOutputFolder", "/", "advertisementOutputFolder", "/", "octopusOutputFolder", "/", "genericOutputFolder", "/",\r
+ "onlineOutputFolder", "/", "killDateDays", -1, "nexioAgency", "ARCHIVE_RESTORE", "nexioPort", 2098, "nexioUserName", "administrator",\r
+ "nexioPassword", "system", "archivedMedia", archivedMedia, "successRecipient", "vasary@elgekko.net", "houseId",\r
+ archivedMedia.getMedia().getHouseId(), "targetPathType", "0"));\r
+\r
+ finishLatch.await();\r
+\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import javax.ws.rs.client.Entity;\r
+import javax.ws.rs.client.Invocation.Builder;\r
+import javax.ws.rs.core.MediaType;\r
+import javax.ws.rs.core.MultivaluedMap;\r
+import javax.ws.rs.core.Response;\r
+import javax.ws.rs.core.Response.Status;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+import org.jboss.resteasy.client.jaxrs.ResteasyClient;\r
+import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;\r
+import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;\r
+import org.jboss.resteasy.specimpl.MultivaluedMapImpl;\r
+\r
+import com.ibm.nosql.json.JSONUtil;\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+\r
+public class MediaCubeClient {\r
+ private static Logger logger = LogManager.getLogger();\r
+ private ResteasyWebTarget webTarget;\r
+\r
+ public MediaCubeClient(String address) {\r
+ ResteasyClient client = new ResteasyClientBuilder().build();\r
+ webTarget = client.target(address);\r
+ }\r
+\r
+ BasicDBObject getDbObject(String json) {\r
+ BasicDBObject result = (BasicDBObject) JSONUtil.jsonToDbObject(json);\r
+\r
+ if (result == null)\r
+ throw new NullPointerException("API Result is null!");\r
+\r
+ if (result.containsKey("exception")) {\r
+ BasicDBObject e = (BasicDBObject) result.get("exception");\r
+ throw new RuntimeException(e.getString("message"));\r
+ }\r
+ //{"exception":{"message":"Invalid credentials.","publicName":"AuthenticationFailedException"}}\r
+ return result;\r
+ }\r
+\r
+ public BasicDBObject getStatus(long jobId) {\r
+ MultivaluedMap<String, Object> vars = new MultivaluedMapImpl<>();\r
+ vars.add("jobId", jobId);\r
+ Response response = query("services/rest/jobengine/jobstatus", vars).get();\r
+ if (response.getStatus() != Status.OK.getStatusCode()) {\r
+ logger.error(response.readEntity(String.class));\r
+ System.out.println(response.readEntity(String.class));\r
+ return null;\r
+ }\r
+ String result = response.readEntity(String.class);\r
+ return getDbObject(result);\r
+ }\r
+\r
+ private Builder query(String path, MultivaluedMap<String, Object> vars) {\r
+ ResteasyWebTarget target = webTarget.path(path).queryParams(vars);\r
+ Builder result = target.request();\r
+ return result;\r
+ }\r
+\r
+ public long startjob(String template, String name, BasicDBObject jobParams) throws Exception {\r
+ MultivaluedMap<String, Object> vars = new MultivaluedMapImpl<>();\r
+ vars.add("template", template);\r
+ vars.add("name", name);\r
+ Response response = query("services/rest/jobengine/startjob", vars).post(Entity.entity(jobParams.toString(), MediaType.APPLICATION_JSON));\r
+\r
+ if (response.getStatus() != Status.OK.getStatusCode()) {\r
+ logger.error(response.readEntity(String.class));\r
+ return 0;\r
+ }\r
+\r
+ String resultObject = response.readEntity(String.class);\r
+ return Long.parseLong(resultObject);\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+import user.commons.StoreUri;\r
+import user.commons.remotestore.RemoteStoreProtocol;\r
+import user.jobengine.db.Media;\r
+import user.jobengine.db.MediaFile;\r
+import user.jobengine.db.Store;\r
+\r
+public class PrepareMediaRestoreStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ @StepEntry\r
+ public Object[] execute(Media media, String tempStoreName, String tempStoreProtocol) throws Exception {\r
+ StoreUri mediaStoreUri = null;\r
+ for (MediaFile mediaFile : media.getMediaFiles()) {\r
+ Store store = mediaFile.getStore();\r
+ if (store.isSystem() && !store.isLowres()) {\r
+ mediaStoreUri = store.getStoreUri(RemoteStoreProtocol.TSM);\r
+ if (mediaStoreUri != null)\r
+ break;\r
+ }\r
+ }\r
+\r
+ StoreUri tempStoreUri = getManager().getStoreUri(tempStoreName, Enum.valueOf(RemoteStoreProtocol.class, tempStoreProtocol));\r
+\r
+ return new Object[] { mediaStoreUri, tempStoreUri, media.getMediaFileRealName() };\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.nio.file.Path;\r
+import java.nio.file.Paths;\r
+\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+\r
+import user.commons.StoreUri;\r
+import user.commons.remotestore.RemoteStoreProtocol;\r
+\r
+public class PrepareRemoteTranscodeJobParametersStep extends JobStep {\r
+ @StepEntry\r
+ public Object[] execute(String profileName, String tempStoreName, String tempStoreProtocol, String fileName) throws Exception {\r
+ Path inputPath = Paths.get("m:/", fileName);\r
+\r
+ StoreUri tempStoreUri = getManager().getStoreUri(tempStoreName, Enum.valueOf(RemoteStoreProtocol.class, tempStoreProtocol));\r
+ String outFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ".mp4";\r
+ Path outputPath = null;\r
+ if (fileName.length() > 2) {\r
+ outputPath = Paths.get(tempStoreUri.toString(true), fileName.substring(0, 1), fileName.substring(1, 2), fileName.substring(2, 3), outFileName);\r
+ } else {\r
+ outputPath = Paths.get(tempStoreUri.toString(true), fileName, outFileName);\r
+ }\r
+\r
+ BasicDBObject parameters = new BasicDBObject();\r
+ parameters.put("profile", profileName);\r
+ parameters.put("input", inputPath.toString());\r
+ parameters.put("output", outputPath.toString());\r
+ return new Object[] { parameters };\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\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.MediaCubeUndoMarker;\r
+import user.commons.nosql.NoSQLUtils;\r
+import user.jobengine.db.IItemManager;\r
+import user.jobengine.db.Media;\r
+\r
+public class QueryMissingProxyMediaStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ @StepEntry\r
+ public Object[] execute() throws Exception {\r
+ Object[] result = new Object[] { null };\r
+ DB db = NoSQLUtils.getNoSQLDB();\r
+ DBCollection collection = db.getCollection("missing_lowres");\r
+ Media media = getFirstUntranscodedMedia(collection);\r
+\r
+ try {\r
+ if (media == null) {\r
+ logger.info(new MediaCubeUndoMarker(getSessionMarker().getSessionID()), "Nincs feldolgozandó hiány.");\r
+ // throw new Exception("Nincs feldolgozandó hiány.");\r
+ cancel();\r
+ return null;\r
+ }\r
+\r
+ String name = media.getMediaFileRealName();\r
+ collection.save(new BasicDBObject("name", name));\r
+ logger.info(getSessionMarker(), "Processing mediaID: {}", media.getId());\r
+ result[0] = media;\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ logger.error(getSessionMarker(), e.getMessage());\r
+ throw e;\r
+ } finally {\r
+ setProgress(100);\r
+ }\r
+ return result;\r
+ }\r
+\r
+ private Media getFirstUntranscodedMedia(DBCollection collection) {\r
+ Media[] result = new Media[] { null };\r
+ //MV\r
+ String query = "SELECT mediaid FROM VW_MISSING_PROXY_IDS WHERE HOUSEID like 'M%' or HOUSEID like 'P%' or HOUSEID like 'R%' ORDER BY modified DESC";\r
+\r
+ //HTV\r
+ //String query = "SELECT mediaid FROM VW_MISSING_PROXY_IDS";\r
+ IItemManager manager = getManager();\r
+ manager.executeQuery(query, rs -> {\r
+ try {\r
+ long mediaId = rs.getLong(1);\r
+ Media media = manager.getMedia(mediaId);\r
+ //a nevgeneralas miatt az eredeti MediaFilesName nem jo, a pontos nev kell nekunk\r
+ String name = media.getMediaFileRealName();\r
+ logger.info(getSessionMarker(), "Checking {}", name);\r
+ long existing = collection.find(new BasicDBObject("name", name)).count();\r
+ if (existing > 0) {\r
+ logger.info(getSessionMarker(), "{} is on missing_lowres list", name);\r
+ return true;\r
+ }\r
+\r
+ result[0] = media;\r
+ } catch (Exception e) {\r
+ logger.error(e);\r
+ }\r
+ return false;\r
+ }, null);\r
+ return result[0];\r
+ }\r
+}\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+import com.ibm.nosql.json.api.BasicDBObject;\r
+\r
+/*\r
+import user.jobengine.server.steps.MediaCubeClient;\r
+*/\r
+public class RemoteJobStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ @StepEntry\r
+ public Object[] execute(String remoteServer, String template, String name, BasicDBObject remoteJobParameters) throws Exception {\r
+ try {\r
+ MediaCubeClient mc = new MediaCubeClient(remoteServer);\r
+ long jobId = mc.startjob(template, name, remoteJobParameters);\r
+ logger.info(getMarker(), "Started {} on server {}", jobId, remoteServer);\r
+ while (true) {\r
+ BasicDBObject status = mc.getStatus(jobId);\r
+ if (status != null)\r
+ setProgress(status.getInt("progress"));\r
+\r
+ Thread.sleep(3000);\r
+\r
+ String jobStatus = status.getString("status");\r
+ if ("SUSPENDED".equals(jobStatus))\r
+ throw new Exception(status.getString("description"));\r
+\r
+ if ("FINISHED".equals(jobStatus))\r
+ break;\r
+ }\r
+\r
+ } catch (Exception e) {\r
+ throw e;\r
+ }\r
+ return new Object[] { null };\r
+ }\r
+}\r
//jobEngine.submit(jobRuntime, null, CHILD_TEMPLATE, CHILD_TITLE, ListUtils.asMap("itemID", i));\r
// IJobRuntime runtime = jobEngine.submit(jobRuntime, null, CHILD_TEMPLATE, "JOB " + i, ListUtils.asMap("param", i));\r
IJobRuntime runtime = getEngine().submit(getJobRuntime(), e -> {\r
+ IJobRuntime r = (IJobRuntime) e.getSource();\r
+ if (r.isDisableRetry())\r
+ return;\r
if (e.getStatus().equals(JobStatus.CANCELED) || e.getStatus().equals(JobStatus.SUSPENDED))\r
logger.info("Cleanup occured because status is {} {}", e.getStatus(), ((IJob) e.getSource()).getId());\r
}, CHILD_TEMPLATE, "JOB " + i, 0, IJobEngine.DEFAULT_OWNER, ListUtils.asMap("param", i));\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.nio.file.Paths;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+import user.commons.mediaarea.MediaArea;\r
+import user.jobengine.server.steps.shared.ExternalCommandExecutor;\r
+import user.jobengine.server.steps.shared.IExternalCallback;\r
+\r
+/*\r
+import user.jobengine.server.steps.shared.ExternalProfile;\r
+import user.jobengine.server.steps.shared.ExternalProfilesConfig;\r
+ */\r
+public class TranscodeFFMpegStep extends JobStep implements IExternalCallback {\r
+ private static final Logger logger = LogManager.getLogger();\r
+ private long allFrameCount;\r
+ private long processedFrameCount;\r
+\r
+ @StepEntry\r
+ public Object[] execute(String input, String output, String profile) throws Exception {\r
+ try {\r
+ MediaArea ma = new MediaArea(Paths.get(input));\r
+ ma.process();\r
+ allFrameCount = ma.getFrameCount();\r
+\r
+ ExternalCommandExecutor executor = new ExternalCommandExecutor();\r
+ executor.execute(profile, input, output, this);\r
+ } catch (Exception e) {\r
+ logger.error(getMarker(), "Media information not available. System message: {}", e.getMessage());\r
+ throw e;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ @Override\r
+ public void onResponse(String line) {\r
+ String[] values = line.split("=");\r
+ if ("frame".equals(values[0])) {\r
+ processedFrameCount = Integer.parseInt(values[1]);\r
+ int progress = (int) (processedFrameCount * 100 / allFrameCount);\r
+ if (progress > 0)\r
+ setProgress(progress);\r
+ }\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import java.io.BufferedReader;\r
+import java.io.InputStreamReader;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+public class ExternalCommand {\r
+ private static final Logger logger = LogManager.getLogger();\r
+ private ExternalProfile profile;\r
+\r
+ public ExternalCommand(ExternalProfile profile) {\r
+ this.profile = profile;\r
+ }\r
+\r
+ public String execute(String input, String output, boolean firstResponse, IExternalCallback responseCallBack) throws Exception {\r
+ List<String> arguments = getArguments(input, output);\r
+ List<String> command = new ArrayList<>();\r
+ command.add(profile.getExecutable());\r
+ command.addAll(arguments);\r
+\r
+ ProcessBuilder processBuilder = new ProcessBuilder();\r
+ processBuilder.command(command);\r
+\r
+ String result = null;\r
+ try {\r
+ logger.info("Executing : {}", processBuilder.command());\r
+\r
+ Process process = processBuilder.start();\r
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {\r
+ String line = null;\r
+ while ((line = reader.readLine()) != null) {\r
+ logger.debug("Process response: {}", line);\r
+ if (responseCallBack != null)\r
+ responseCallBack.onResponse(line);\r
+ //System.out.println(line);\r
+ if (line != null && line.length() > 0) {\r
+ result = line;\r
+ if (firstResponse)\r
+ break;\r
+ }\r
+ }\r
+ int exitCode = process.waitFor();\r
+ if (exitCode != 0) {\r
+ StringBuilder msg = new StringBuilder();\r
+ try (BufferedReader errReader = new BufferedReader(new InputStreamReader(process.getErrorStream()))) {\r
+ String errline = null;\r
+ while ((errline = errReader.readLine()) != null) {\r
+ msg.append(errline);\r
+ }\r
+ } catch (Exception ex) {\r
+ }\r
+\r
+ throw new Exception("Exited with error code : " + exitCode + ". " + msg);\r
+ }\r
+ } catch (Exception e) {\r
+ throw e;\r
+ }\r
+ } catch (Exception e) {\r
+ logger.error(e);\r
+ throw e;\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ private List<String> getArguments(String input, String output) {\r
+ List<String> result = new ArrayList<>();\r
+\r
+ profile.getArguments().forEach(i -> {\r
+ result.add(i.replace("%i", input).replace("%o", output));\r
+ });\r
+ return result;\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import user.commons.configuration.SystemConfiguration;\r
+\r
+/*\r
+ package user.jobengine.server.steps.IExternalCallback;\r
+ package user.jobengine.server.steps.ExternalProfile;\r
+ package user.jobengine.server.steps.ExternalProfilesConfig;\r
+ package user.jobengine.server.steps.ExternalCommand;\r
+\r
+ */\r
+public class ExternalCommandExecutor {\r
+\r
+ public void execute(String profileName, String input, String output, IExternalCallback responseCallBack) throws Exception {\r
+ ExternalCommand externalCommand = getExternalCommand(profileName);\r
+ externalCommand.execute(input, output, false, responseCallBack);\r
+ }\r
+\r
+ private ExternalCommand getExternalCommand(String profileName) throws Exception {\r
+ ExternalProfilesConfig config = SystemConfiguration.getInstance().load("settings/external-commands.yaml", ExternalProfilesConfig.class);\r
+\r
+ if (config == null)\r
+ throw new Exception("Missing external-commands.yaml configuration");\r
+\r
+ ExternalProfile selectedProfile = null;\r
+ for (ExternalProfile profile : config.getProfiles()) {\r
+ if (profileName.equals(profile.getName())) {\r
+ selectedProfile = profile;\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (selectedProfile == null)\r
+ throw new Exception("Missing profile " + profileName + " in external-commands.yaml configuration");\r
+\r
+ return new ExternalCommand(selectedProfile);\r
+ }\r
+\r
+}\r
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import java.util.List;\r
+\r
+public class ExternalProfile {\r
+ private String executable;\r
+ private String name;\r
+ private List<String> arguments;\r
+\r
+ public List<String> getArguments() {\r
+ return arguments;\r
+ }\r
+\r
+ public String getExecutable() {\r
+ return executable;\r
+ }\r
+\r
+ public String getName() {\r
+ return name;\r
+ }\r
+\r
+ public void setArguments(List<String> arguments) {\r
+ this.arguments = arguments;\r
+ }\r
+\r
+ public void setExecutable(String executable) {\r
+ this.executable = executable;\r
+ }\r
+\r
+ public void setName(String name) {\r
+ this.name = name;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+import java.util.List;\r
+\r
+public class ExternalProfilesConfig {\r
+ private List<ExternalProfile> profiles;\r
+\r
+ public List<ExternalProfile> getProfiles() {\r
+ return profiles;\r
+ }\r
+\r
+ public void setProfiles(List<ExternalProfile> profiles) {\r
+ this.profiles = profiles;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+package user.jobengine.server.steps.shared;\r
+\r
+public interface IExternalCallback {\r
+ void onResponse(String data);\r
+}
\ No newline at end of file
if (!result.getClass().isAssignableFrom(defValue.getClass()))\r
throw new ClassCastException(result.getClass() + " ? " + defValue.getClass());\r
} catch (Exception e) {\r
- logger.error("{} read error. {}", fqn, e.getMessage());\r
+ if (e instanceof NullPointerException)\r
+ logger.warn("{} variable is not defined in configuration.", fqn);\r
+ else\r
+ logger.warn("{} read error. {}", fqn, e.getMessage());\r
result = defValue;\r
}\r
return result;\r
private int height;\r
private String displayAspect;\r
private String formatProfile = "";\r
+ private long frameCount;\r
\r
public MediaArea(Path filePath) {\r
this.filePath = filePath;\r
return height;\r
}\r
\r
+ public String inform() {\r
+ String result = null;\r
+ //auto closable\r
+ try (MediaInfo mi = new MediaInfo(filePath.toAbsolutePath().toString())) {\r
+ result = mi.inform();\r
+ } catch (Exception ex) {\r
+ throw new RuntimeException(ex);\r
+ }\r
+ return result;\r
+ }\r
+\r
public void process() {\r
//auto closable\r
try (MediaInfo mi = new MediaInfo(filePath.toAbsolutePath().toString())) {\r
height = Integer.parseInt(mi.get(StreamKind.Video, 0, "Height"));\r
displayAspect = mi.get(StreamKind.Video, 0, "DisplayAspectRatio/String");\r
formatProfile = mi.get(StreamKind.Video, 0, "Format_Profile").toUpperCase();\r
+ frameCount = Integer.parseInt(mi.get(StreamKind.Video, 0, "FrameCount"));\r
} catch (Exception ex) {\r
throw new RuntimeException(ex);\r
}\r
\r
}\r
\r
+ public long getFrameCount() {\r
+ return frameCount;\r
+ }\r
}\r
\r
@Override\r
public NexioDispatcher getDispatcher() {\r
- if (dispatcher == null)\r
- dispatcher = new NexioDispatcher();\r
+ try {\r
+ if (dispatcher == null)\r
+ dispatcher = new NexioDispatcher();\r
+\r
+ } catch (Exception e) {\r
+ logger.warn(e.getMessage());\r
+ }\r
return dispatcher;\r
}\r
\r
private static final String EXTAGENCY = "extagency";\r
private static final String RECORDDATE = "recorddate";\r
private static final String LONGNAMEID = "longnameid";\r
- public static final String CLIP_COLLECTION_NAME = SystemConfiguration.getInstance().value("services.nexio.collection-name");\r
- private static String NEXIO_HOST = SystemConfiguration.getInstance().value("services.nexio.host");\r
- private static boolean disabled = SystemConfiguration.getInstance().value("services.nexio.disabled", true);\r
- private static boolean[] useMOSGateways = new boolean[] { SystemConfiguration.getInstance().value("services.nexio.use-mos-gateway") };\r
+ public static String CLIP_COLLECTION_NAME;\r
+ private static String NEXIO_HOST;\r
+ private static boolean disabled;\r
+ private static boolean useMOSGateways;\r
\r
static private final byte[] GET_SPECIAL_ID_ATTRIBUTES_REQ = { (byte) 0xC8, (byte) 0x84 };\r
static private final char[] hexArray = "0123456789ABCDEF".toCharArray();\r
private MediaListener mediaListener;\r
\r
public NexioDispatcher() {\r
+\r
+ NEXIO_HOST = SystemConfiguration.getInstance().value("services.nexio.host");\r
+ CLIP_COLLECTION_NAME = SystemConfiguration.getInstance().value("services.nexio.collection-name");\r
+ disabled = SystemConfiguration.getInstance().value("services.nexio.disabled", true);\r
+ useMOSGateways = SystemConfiguration.getInstance().value("services.nexio.use-mos-gateway", false);\r
+\r
this.db = NoSQLUtils.getNoSQLDB();\r
\r
// Runtime.getRuntime().addShutdownHook(new Thread() {\r
}\r
\r
private void innerStartup() {\r
-\r
+ final boolean gw = useMOSGateways;\r
worker = new Thread(() -> {\r
try {\r
logger.info("Initial clip import started");\r
- if (useMOSGateways[0]) {\r
+ if (gw) {\r
NexioDataMiner dm = new NexioDataMiner();\r
dm.transferClips();\r
} else {\r
}\r
\r
/*\r
-\r
+ \r
int c = connection.read(buffer, 0, 2);\r
//2 bytes hosszan az idokozben hozzaadott id-k szamossaga\r
if (c < 2) {\r
throw new ProtocolException("c, 2, 2");\r
}\r
//MSB, LSB\r
-\r
+ \r
return nofIds;\r
*/\r
return ret;\r
--- /dev/null
+/*@lineinfo:filename=BreakDAO*//*@lineinfo:user-code*//*@lineinfo:1^1*/package user.jobengine.db;
+
+import user.commons.IEntityBase;
+import sqlj.runtime.ref.*;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.List;
+import java.util.ArrayList;
+
+/*@lineinfo:generated-code*//*@lineinfo:10^2*/
+
+// ************************************************************
+// SQLJ iterator declaration:
+// ************************************************************
+
+class BreakIter
+extends sqlj.runtime.ref.ResultSetIterImpl
+implements sqlj.runtime.NamedIterator
+{
+ private int thumbnailNdx;
+ private int createdNdx;
+ private int mediaIdNdx;
+ private int inPointNdx;
+ private int breakTypeNdx;
+ private int idNdx;
+ public BreakIter(sqlj.runtime.profile.RTResultSet resultSet)
+ throws java.sql.SQLException
+ {
+ super(resultSet);
+ idNdx = findColumn("id");
+ breakTypeNdx = findColumn("breakType");
+ inPointNdx = findColumn("inPoint");
+ mediaIdNdx = findColumn("mediaId");
+ createdNdx = findColumn("created");
+ thumbnailNdx = findColumn("thumbnail");
+ }
+ public BreakIter(sqlj.runtime.profile.RTResultSet resultSet, int fetchSize, int maxRows)
+ throws java.sql.SQLException
+ {
+ super(resultSet, fetchSize, maxRows);
+ idNdx = findColumn("id");
+ breakTypeNdx = findColumn("breakType");
+ inPointNdx = findColumn("inPoint");
+ mediaIdNdx = findColumn("mediaId");
+ createdNdx = findColumn("created");
+ thumbnailNdx = findColumn("thumbnail");
+ }
+ public long id()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(idNdx);
+ }
+ public String breakType()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(breakTypeNdx);
+ }
+ public long inPoint()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(inPointNdx);
+ }
+ public long mediaId()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(mediaIdNdx);
+ }
+ public Timestamp created()
+ throws java.sql.SQLException
+ {
+ return resultSet.getTimestamp(createdNdx);
+ }
+ public byte[] thumbnail()
+ throws java.sql.SQLException
+ {
+ return resultSet.getBytes(thumbnailNdx);
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:10^114*/
+
+@SuppressWarnings("unused")
+class BreakDAO extends EntityBaseDAO {
+
+ public BreakDAO(ItemManager manager) {
+ super(manager);
+ }
+
+ @Override
+ protected List<IEntityBase> entities(DefaultContext context, ResultSetIterImpl iter, boolean isChunked) throws SQLException {
+ List<IEntityBase> result = null;
+ BreakIter iterator = (BreakIter) iter;
+ while (iterator.next()) {
+ Break entity = new Break();
+ entity.setId(iterator.id());
+ entity.setBreakType(ItemManagerData.toBreakType(iterator.breakType()));
+ entity.setInPoint(iterator.inPoint());
+ entity.setMediaId(iterator.mediaId());
+ entity.setCreated(iterator.created());
+ entity.setThumbnail(iterator.thumbnail());
+
+ if (result == null)
+ result = new ArrayList<IEntityBase>();
+ result.add(entity);
+ }
+ iterator.close();
+ return result;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectByKey(DefaultContext context, long id) throws SQLException{
+ BreakIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:43^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, BREAKTYPE, INPOINT, MEDIAID, CREATED, THUMBNAIL FROM BREAK WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, BreakDAO_SJProfileKeys.getKey(0), 0);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ iter = new BreakIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:43^111*/
+ return iter;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectByForeignKey(DefaultContext context, long id) throws SQLException{
+ BreakIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:50^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, BREAKTYPE, INPOINT, MEDIAID, CREATED, THUMBNAIL FROM BREAK WHERE MEDIAID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, BreakDAO_SJProfileKeys.getKey(0), 1);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ iter = new BreakIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:50^116*/
+ return iter;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectAll(DefaultContext context) throws SQLException{
+ BreakIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:57^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, BREAKTYPE, INPOINT, MEDIAID, CREATED, THUMBNAIL FROM BREAK };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, BreakDAO_SJProfileKeys.getKey(0), 2);
+ try
+ {
+ iter = new BreakIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:57^96*/
+ return iter;
+ }
+
+ @Override
+ protected void delete(DefaultContext context, long id) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:63^2*/
+
+// ************************************************************
+// #sql [context] { DELETE FROM BREAK WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, BreakDAO_SJProfileKeys.getKey(0), 3);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:63^52*/
+ }
+
+ @Override
+ protected void truncateTable(DefaultContext context) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:68^2*/
+
+// ************************************************************
+// #sql [context] { TRUNCATE TABLE BREAK DROP STORAGE IGNORE DELETE TRIGGERS IMMEDIATE };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, BreakDAO_SJProfileKeys.getKey(0), 4);
+ try
+ {
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:68^86*/
+ }
+
+ @Override
+ protected void update(DefaultContext context, IEntityBase entity) throws SQLException{
+ Break obj = (Break) entity;
+ long id = obj.getId();
+ String breakType = obj.getBreakType().toString();
+ long inPoint = obj.getInPoint();
+ long mediaId = obj.getMediaId();
+ byte[] thumbnail = obj.getThumbnail();
+
+ /*@lineinfo:generated-code*//*@lineinfo:80^2*/
+
+// ************************************************************
+// #sql [context] { UPDATE BREAK SET BREAKTYPE = :breakType, INPOINT = :inPoint, MEDIAID = :mediaId, THUMBNAIL = :thumbnail WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, BreakDAO_SJProfileKeys.getKey(0), 5);
+ try
+ {
+ __sJT_stmt.setString(1, breakType);
+ __sJT_stmt.setLong(2, inPoint);
+ __sJT_stmt.setLong(3, mediaId);
+ __sJT_stmt.setBytes(4, thumbnail);
+ __sJT_stmt.setLong(5, id);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:80^138*/
+ }
+
+ @Override
+ protected void insert(DefaultContext context, IEntityBase entity) throws SQLException{
+ Break obj = (Break) entity;
+ String breakType = obj.getBreakType().toString();
+ long inPoint = obj.getInPoint();
+ long mediaId = obj.getMediaId();
+ byte[] thumbnail = obj.getThumbnail();
+
+ /*@lineinfo:generated-code*//*@lineinfo:91^2*/
+
+// ************************************************************
+// #sql [context] { INSERT INTO BREAK (BREAKTYPE, INPOINT, MEDIAID, THUMBNAIL) VALUES (:breakType, :inPoint, :mediaId, :thumbnail) };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, BreakDAO_SJProfileKeys.getKey(0), 6);
+ try
+ {
+ __sJT_stmt.setString(1, breakType);
+ __sJT_stmt.setLong(2, inPoint);
+ __sJT_stmt.setLong(3, mediaId);
+ __sJT_stmt.setBytes(4, thumbnail);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:91^130*/
+ }
+
+}/*@lineinfo:generated-code*/class BreakDAO_SJProfileKeys
+{
+ private java.lang.Object[] keys;
+ private final sqlj.runtime.profile.Loader loader = sqlj.runtime.RuntimeContext.getRuntime().getLoaderForClass(getClass());
+ private static BreakDAO_SJProfileKeys inst = null;
+ public static java.lang.Object getKey(int keyNum)
+ throws java.sql.SQLException
+ {
+ synchronized(user.jobengine.db.BreakDAO_SJProfileKeys.class) {
+ if (inst == null)
+ {
+ inst = new BreakDAO_SJProfileKeys();
+ }
+ }
+ return inst.keys[keyNum];
+ }
+ private BreakDAO_SJProfileKeys()
+ throws java.sql.SQLException
+ {
+ keys = new java.lang.Object[1];
+ keys[0] = DefaultContext.getProfileKey(loader, "user.jobengine.db.BreakDAO_SJProfile0");
+ }
+}
--- /dev/null
+/*@lineinfo:filename=FolderDAO*//*@lineinfo:user-code*//*@lineinfo:1^1*/package user.jobengine.db;
+
+import user.commons.IEntityBase;
+import sqlj.runtime.ref.*;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/*@lineinfo:generated-code*//*@lineinfo:9^2*/
+
+// ************************************************************
+// SQLJ iterator declaration:
+// ************************************************************
+
+class FolderIter
+extends sqlj.runtime.ref.ResultSetIterImpl
+implements sqlj.runtime.NamedIterator
+{
+ private int childIdNdx;
+ private int parentIdNdx;
+ private int idNdx;
+ public FolderIter(sqlj.runtime.profile.RTResultSet resultSet)
+ throws java.sql.SQLException
+ {
+ super(resultSet);
+ idNdx = findColumn("id");
+ parentIdNdx = findColumn("parentId");
+ childIdNdx = findColumn("childId");
+ }
+ public FolderIter(sqlj.runtime.profile.RTResultSet resultSet, int fetchSize, int maxRows)
+ throws java.sql.SQLException
+ {
+ super(resultSet, fetchSize, maxRows);
+ idNdx = findColumn("id");
+ parentIdNdx = findColumn("parentId");
+ childIdNdx = findColumn("childId");
+ }
+ public long id()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(idNdx);
+ }
+ public long parentId()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(parentIdNdx);
+ }
+ public long childId()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(childIdNdx);
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:9^61*/
+
+@SuppressWarnings("unused")
+public class FolderDAO extends EntityBaseDAO {
+
+ public FolderDAO(ItemManager manager) {
+ super(manager);
+ }
+
+ @Override
+ protected List<IEntityBase> entities(DefaultContext context, ResultSetIterImpl iter, boolean isChunked) throws SQLException {
+ List<IEntityBase> result = null;
+ FolderIter iterator = (FolderIter) iter;
+ while (iterator.next()) {
+ Folder entity = new Folder();
+ entity.setId(iterator.id());
+ entity.setParentId(iterator.parentId());
+ entity.setChildId(iterator.childId());
+ if (result == null)
+ result = new ArrayList<IEntityBase>();
+ result.add(entity);
+ }
+ iterator.close();
+ return result;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectByKey(DefaultContext context, long id) throws SQLException{
+ FolderIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:38^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, PARENTID, CHILDID FROM FOLDER WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, FolderDAO_SJProfileKeys.getKey(0), 0);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ iter = new FolderIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:38^82*/
+ return iter;
+ }
+
+ protected ResultSetIterImpl selectByForeignKey(DefaultContext context, long id) throws SQLException{
+ FolderIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:44^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, PARENTID, CHILDID FROM FOLDER WHERE CHILDID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, FolderDAO_SJProfileKeys.getKey(0), 1);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ iter = new FolderIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:44^87*/
+ return iter;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectAll(DefaultContext context) throws SQLException{
+ FolderIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:51^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, PARENTID, CHILDID FROM FOLDER };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, FolderDAO_SJProfileKeys.getKey(0), 2);
+ try
+ {
+ iter = new FolderIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:51^67*/
+ return iter;
+ }
+
+ @Override
+ protected void delete(DefaultContext context, long id) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:57^2*/
+
+// ************************************************************
+// #sql [context] { DELETE FROM FOLDER WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, FolderDAO_SJProfileKeys.getKey(0), 3);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:57^53*/
+ }
+
+ @Override
+ protected void truncateTable(DefaultContext context) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:62^2*/
+
+// ************************************************************
+// #sql [context] { TRUNCATE TABLE FOLDER DROP STORAGE IGNORE DELETE TRIGGERS IMMEDIATE };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, FolderDAO_SJProfileKeys.getKey(0), 4);
+ try
+ {
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:62^87*/
+ }
+
+ @Override
+ protected void insert(DefaultContext context, IEntityBase entity) throws SQLException{
+ Folder obj = (Folder) entity;
+ long parentId = obj.getParentId();
+ long childId = obj.getChildId();
+
+ /*@lineinfo:generated-code*//*@lineinfo:71^2*/
+
+// ************************************************************
+// #sql [context] { INSERT INTO FOLDER (PARENTID, CHILDID) VALUES (:parentId, :childId) };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, FolderDAO_SJProfileKeys.getKey(0), 5);
+ try
+ {
+ __sJT_stmt.setLong(1, parentId);
+ __sJT_stmt.setLong(2, childId);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:71^87*/
+ }
+
+}/*@lineinfo:generated-code*/class FolderDAO_SJProfileKeys
+{
+ private java.lang.Object[] keys;
+ private final sqlj.runtime.profile.Loader loader = sqlj.runtime.RuntimeContext.getRuntime().getLoaderForClass(getClass());
+ private static FolderDAO_SJProfileKeys inst = null;
+ public static java.lang.Object getKey(int keyNum)
+ throws java.sql.SQLException
+ {
+ synchronized(user.jobengine.db.FolderDAO_SJProfileKeys.class) {
+ if (inst == null)
+ {
+ inst = new FolderDAO_SJProfileKeys();
+ }
+ }
+ return inst.keys[keyNum];
+ }
+ private FolderDAO_SJProfileKeys()
+ throws java.sql.SQLException
+ {
+ keys = new java.lang.Object[1];
+ keys[0] = DefaultContext.getProfileKey(loader, "user.jobengine.db.FolderDAO_SJProfile0");
+ }
+}
--- /dev/null
+/*@lineinfo:filename=ItemIter*//*@lineinfo:user-code*//*@lineinfo:1^1*/package user.jobengine.db;
+
+import java.sql.Timestamp;
+
+/*@lineinfo:generated-code*//*@lineinfo:5^2*/
+
+// ************************************************************
+// SQLJ iterator declaration:
+// ************************************************************
+
+public class ItemIter
+extends sqlj.runtime.ref.ResultSetIterImpl
+implements sqlj.runtime.NamedIterator
+{
+ private int isFolderNdx;
+ private int createdNdx;
+ private int houseIdNdx;
+ private int itemTypeIdNdx;
+ private int descriptionNdx;
+ private int titleNdx;
+ private int idNdx;
+ public ItemIter(sqlj.runtime.profile.RTResultSet resultSet)
+ throws java.sql.SQLException
+ {
+ super(resultSet);
+ idNdx = findColumn("id");
+ titleNdx = findColumn("title");
+ descriptionNdx = findColumn("description");
+ itemTypeIdNdx = findColumn("itemTypeId");
+ houseIdNdx = findColumn("houseId");
+ createdNdx = findColumn("created");
+ isFolderNdx = findColumn("isFolder");
+ }
+ public ItemIter(sqlj.runtime.profile.RTResultSet resultSet, int fetchSize, int maxRows)
+ throws java.sql.SQLException
+ {
+ super(resultSet, fetchSize, maxRows);
+ idNdx = findColumn("id");
+ titleNdx = findColumn("title");
+ descriptionNdx = findColumn("description");
+ itemTypeIdNdx = findColumn("itemTypeId");
+ houseIdNdx = findColumn("houseId");
+ createdNdx = findColumn("created");
+ isFolderNdx = findColumn("isFolder");
+ }
+ public long id()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(idNdx);
+ }
+ public String title()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(titleNdx);
+ }
+ public String description()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(descriptionNdx);
+ }
+ public long itemTypeId()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(itemTypeIdNdx);
+ }
+ public String houseId()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(houseIdNdx);
+ }
+ public Timestamp created()
+ throws java.sql.SQLException
+ {
+ return resultSet.getTimestamp(createdNdx);
+ }
+ public String isFolder()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isFolderNdx);
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:5^140*//*@lineinfo:generated-code*/
\ No newline at end of file
--- /dev/null
+/*@lineinfo:filename=MasterIdDAO*//*@lineinfo:user-code*//*@lineinfo:1^1*/package user.jobengine.db;
+
+import user.commons.IEntityBase;
+import sqlj.runtime.ref.*;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.List;
+import java.util.ArrayList;
+
+/*@lineinfo:generated-code*//*@lineinfo:11^2*/
+
+// ************************************************************
+// SQLJ iterator declaration:
+// ************************************************************
+
+class MasterIdIter
+extends sqlj.runtime.ref.ResultSetIterImpl
+implements sqlj.runtime.NamedIterator
+{
+ private int createdNdx;
+ private int idNdx;
+ public MasterIdIter(sqlj.runtime.profile.RTResultSet resultSet)
+ throws java.sql.SQLException
+ {
+ super(resultSet);
+ idNdx = findColumn("id");
+ createdNdx = findColumn("created");
+ }
+ public MasterIdIter(sqlj.runtime.profile.RTResultSet resultSet, int fetchSize, int maxRows)
+ throws java.sql.SQLException
+ {
+ super(resultSet, fetchSize, maxRows);
+ idNdx = findColumn("id");
+ createdNdx = findColumn("created");
+ }
+ public long id()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(idNdx);
+ }
+ public Timestamp created()
+ throws java.sql.SQLException
+ {
+ return resultSet.getTimestamp(createdNdx);
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:11^53*/
+
+@SuppressWarnings("unused")
+class MasterIdDAO extends EntityBaseDAO {
+
+ public MasterIdDAO(ItemManager manager) {
+ super(manager);
+ }
+
+ @Override
+ protected List<IEntityBase> entities(DefaultContext context, ResultSetIterImpl iter, boolean isChunked) throws SQLException {
+ List<IEntityBase> result = null;
+ ShotIter iterator = (ShotIter) iter;
+ while (iterator.next()) {
+ MasterId entity = new MasterId();
+ entity.setId(iterator.id());
+ entity.setCreated(iterator.created());
+
+ if (result == null)
+ result = new ArrayList<IEntityBase>();
+ result.add(entity);
+ }
+ iterator.close();
+ return result;
+ }
+
+
+ @Override
+ protected void insert(DefaultContext context, IEntityBase entity) throws SQLException{
+ MasterId obj = (MasterId) entity;
+ obj.setCreated(new Timestamp(new Date().getTime()));
+ Timestamp created = obj.getCreated();
+
+ /*@lineinfo:generated-code*//*@lineinfo:44^2*/
+
+// ************************************************************
+// #sql [context] { INSERT INTO MASTERID (CREATED) VALUES (:created) };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MasterIdDAO_SJProfileKeys.getKey(0), 0);
+ try
+ {
+ __sJT_stmt.setTimestamp(1, created);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:44^68*/
+ }
+
+ @Override
+ protected void truncateTable(DefaultContext context) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:49^2*/
+
+// ************************************************************
+// #sql [context] { TRUNCATE TABLE MASTERID DROP STORAGE IGNORE DELETE TRIGGERS IMMEDIATE };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MasterIdDAO_SJProfileKeys.getKey(0), 1);
+ try
+ {
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:49^89*/
+ }
+}/*@lineinfo:generated-code*/class MasterIdDAO_SJProfileKeys
+{
+ private java.lang.Object[] keys;
+ private final sqlj.runtime.profile.Loader loader = sqlj.runtime.RuntimeContext.getRuntime().getLoaderForClass(getClass());
+ private static MasterIdDAO_SJProfileKeys inst = null;
+ public static java.lang.Object getKey(int keyNum)
+ throws java.sql.SQLException
+ {
+ synchronized(user.jobengine.db.MasterIdDAO_SJProfileKeys.class) {
+ if (inst == null)
+ {
+ inst = new MasterIdDAO_SJProfileKeys();
+ }
+ }
+ return inst.keys[keyNum];
+ }
+ private MasterIdDAO_SJProfileKeys()
+ throws java.sql.SQLException
+ {
+ keys = new java.lang.Object[1];
+ keys[0] = DefaultContext.getProfileKey(loader, "user.jobengine.db.MasterIdDAO_SJProfile0");
+ }
+}
--- /dev/null
+/*@lineinfo:filename=MetadataDAO*//*@lineinfo:user-code*//*@lineinfo:1^1*/package user.jobengine.db;
+
+import user.commons.IEntityBase;
+import sqlj.runtime.ref.*;
+import user.jobengine.db.ItemManagerData.SignalType;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.List;
+import java.util.ArrayList;
+
+/*@lineinfo:generated-code*//*@lineinfo:12^2*/
+
+// ************************************************************
+// SQLJ iterator declaration:
+// ************************************************************
+
+class MetadataIter
+extends sqlj.runtime.ref.ResultSetIterImpl
+implements sqlj.runtime.NamedIterator
+{
+ private int metadataElementIdNdx;
+ private int itemTypeIdNdx;
+ private int parameterNdx;
+ private int staticTableNdx;
+ private int sqlFieldNdx;
+ private int pojoFieldNdx;
+ private int listTypeNdx;
+ private int guiTypeNdx;
+ private int isSearchableNdx;
+ private int isGeneratedNdx;
+ private int isListableNdx;
+ private int isEditableNdx;
+ private int isDbNullableNdx;
+ private int isDbUniqueNdx;
+ private int isDbIndexNdx;
+ private int idNdx;
+ public MetadataIter(sqlj.runtime.profile.RTResultSet resultSet)
+ throws java.sql.SQLException
+ {
+ super(resultSet);
+ idNdx = findColumn("id");
+ isDbIndexNdx = findColumn("isDbIndex");
+ isDbUniqueNdx = findColumn("isDbUnique");
+ isDbNullableNdx = findColumn("isDbNullable");
+ isEditableNdx = findColumn("isEditable");
+ isListableNdx = findColumn("isListable");
+ isGeneratedNdx = findColumn("isGenerated");
+ isSearchableNdx = findColumn("isSearchable");
+ guiTypeNdx = findColumn("guiType");
+ listTypeNdx = findColumn("listType");
+ pojoFieldNdx = findColumn("pojoField");
+ sqlFieldNdx = findColumn("sqlField");
+ staticTableNdx = findColumn("staticTable");
+ parameterNdx = findColumn("parameter");
+ itemTypeIdNdx = findColumn("itemTypeId");
+ metadataElementIdNdx = findColumn("metadataElementId");
+ }
+ public MetadataIter(sqlj.runtime.profile.RTResultSet resultSet, int fetchSize, int maxRows)
+ throws java.sql.SQLException
+ {
+ super(resultSet, fetchSize, maxRows);
+ idNdx = findColumn("id");
+ isDbIndexNdx = findColumn("isDbIndex");
+ isDbUniqueNdx = findColumn("isDbUnique");
+ isDbNullableNdx = findColumn("isDbNullable");
+ isEditableNdx = findColumn("isEditable");
+ isListableNdx = findColumn("isListable");
+ isGeneratedNdx = findColumn("isGenerated");
+ isSearchableNdx = findColumn("isSearchable");
+ guiTypeNdx = findColumn("guiType");
+ listTypeNdx = findColumn("listType");
+ pojoFieldNdx = findColumn("pojoField");
+ sqlFieldNdx = findColumn("sqlField");
+ staticTableNdx = findColumn("staticTable");
+ parameterNdx = findColumn("parameter");
+ itemTypeIdNdx = findColumn("itemTypeId");
+ metadataElementIdNdx = findColumn("metadataElementId");
+ }
+ public long id()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(idNdx);
+ }
+ public String isDbIndex()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isDbIndexNdx);
+ }
+ public String isDbUnique()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isDbUniqueNdx);
+ }
+ public String isDbNullable()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isDbNullableNdx);
+ }
+ public String isEditable()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isEditableNdx);
+ }
+ public String isListable()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isListableNdx);
+ }
+ public String isGenerated()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isGeneratedNdx);
+ }
+ public String isSearchable()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isSearchableNdx);
+ }
+ public String guiType()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(guiTypeNdx);
+ }
+ public String listType()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(listTypeNdx);
+ }
+ public String pojoField()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(pojoFieldNdx);
+ }
+ public String sqlField()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(sqlFieldNdx);
+ }
+ public String staticTable()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(staticTableNdx);
+ }
+ public String parameter()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(parameterNdx);
+ }
+ public long itemTypeId()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(itemTypeIdNdx);
+ }
+ public long metadataElementId()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(metadataElementIdNdx);
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:12^318*/
+
+@SuppressWarnings("unused")
+class MetadataDAO extends EntityBaseDAO {
+
+ public MetadataDAO(ItemManager manager) {
+ super(manager);
+ }
+
+ @Override
+ protected void afterAdd(DefaultContext context, IEntityBase entity) throws SQLException {
+ Metadata metadata = (Metadata) entity;
+ if (metadata.requireDataTable())
+ createTable(context.getConnection(), entity);
+ manager.notifyItemTypeChange(entity, SignalType.CREATE);
+ }
+
+ @Override
+ protected void afterModify(DefaultContext context, IEntityBase entity) throws SQLException {
+ Metadata metadata = (Metadata) entity;
+ if (metadata.requireDataTable()) {
+ dropTable(context.getConnection(), entity);
+ createTable(context.getConnection(), entity);
+ }
+ manager.notifyItemTypeChange(entity, SignalType.UPDATE);
+ }
+
+ @Override
+ protected void afterDelete(DefaultContext context, IEntityBase entity) throws SQLException {
+ Metadata metadata = (Metadata) entity;
+ if (metadata.requireDataTable())
+ dropTable(context.getConnection(), entity);
+ manager.notifyItemTypeChange(entity, SignalType.DELETE);
+ }
+
+ @Override
+ protected List<IEntityBase> entities(DefaultContext context, ResultSetIterImpl iter, boolean isChunked) throws SQLException {
+ List<IEntityBase> result = null;
+ MetadataIter iterator = (MetadataIter) iter;
+ while (iterator.next()) {
+ Metadata entity = new Metadata();
+ entity.setId(iterator.id());
+ entity.setIsDbIndex(iterator.isDbIndex().equals("Y") ? true : false);
+ entity.setIsDbUnique(iterator.isDbUnique().equals("Y") ? true : false);
+ entity.setIsDbNullable(iterator.isDbNullable().equals("Y") ? true : false);
+ entity.setIsEditable(iterator.isEditable().equals("Y") ? true : false);
+ entity.setIsListable(iterator.isListable().equals("Y") ? true : false);
+ entity.setIsGenerated(iterator.isGenerated().equals("Y") ? true : false);
+ entity.setIsSearchable(iterator.isSearchable().equals("Y") ? true : false);
+ entity.setGuiType(ItemManagerData.toGuiType(iterator.guiType()));
+ entity.setListType(ItemManagerData.toListType(iterator.listType()));
+ entity.setPojoField(iterator.pojoField());
+ entity.setSqlField(iterator.sqlField());
+ entity.setStaticTable(ItemManagerData.toStaticTable(iterator.staticTable()));
+ entity.setParameter(iterator.parameter());
+ entity.setItemTypeId(iterator.itemTypeId());
+ entity.setMetadataElementId(iterator.metadataElementId());
+
+ if (result == null)
+ result = new ArrayList<IEntityBase>();
+ result.add(entity);
+ }
+ iterator.close();
+ return result;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectByKey(DefaultContext context, long id) throws SQLException{
+ MetadataIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:81^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, ISDBINDEX, ISDBUNIQUE, ISDBNULLABLE, ISEDITABLE, ISLISTABLE, ISGENERATED, ISSEARCHABLE, GUITYPE, LISTTYPE, POJOFIELD, SQLFIELD, STATICTABLE, PARAMETER, ITEMTYPEID, METADATAELEMENTID FROM METADATA WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 0);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ iter = new MetadataIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:81^248*/
+ return iter;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectByForeignKey(DefaultContext context, long id) throws SQLException{
+ MetadataIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:88^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, ISDBINDEX, ISDBUNIQUE, ISDBNULLABLE, ISEDITABLE, ISLISTABLE, ISGENERATED, ISSEARCHABLE,GUITYPE, LISTTYPE, POJOFIELD, SQLFIELD, STATICTABLE, PARAMETER, ITEMTYPEID, METADATAELEMENTID FROM METADATA WHERE ITEMTYPEID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 1);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ iter = new MetadataIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:88^255*/
+ return iter;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectAll(DefaultContext context) throws SQLException{
+ MetadataIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:95^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, ISDBINDEX, ISDBUNIQUE, ISDBNULLABLE, ISEDITABLE, ISLISTABLE, ISGENERATED, ISSEARCHABLE, GUITYPE, LISTTYPE, POJOFIELD, SQLFIELD, STATICTABLE, PARAMETER, ITEMTYPEID, METADATAELEMENTID FROM METADATA };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 2);
+ try
+ {
+ iter = new MetadataIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:95^233*/
+ return iter;
+ }
+
+ @Override
+ protected void delete(DefaultContext context, long id) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:101^2*/
+
+// ************************************************************
+// #sql [context] { DELETE FROM METADATA WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 3);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:101^55*/
+ }
+
+ @Override
+ protected void truncateTable(DefaultContext context) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:106^2*/
+
+// ************************************************************
+// #sql [context] { TRUNCATE TABLE METADATA DROP STORAGE IGNORE DELETE TRIGGERS IMMEDIATE };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 4);
+ try
+ {
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:106^89*/
+ }
+
+ @Override
+ protected void update(DefaultContext context, IEntityBase entity) throws SQLException{
+ Metadata obj = (Metadata) entity;
+ long id = obj.getId();
+ String isDbIndex = obj.getIsDbIndex() == true ? "Y" : "N";
+ String isDbUnique = obj.getIsDbUnique() == true ? "Y" : "N";
+ String isDbNullable = obj.getIsDbNullable() == true ? "Y" : "N";
+ String isEditable = obj.getIsEditable() == true ? "Y" : "N";
+ String isListable = obj.getIsListable() == true ? "Y" : "N";
+ String isGenerated = obj.getIsGenerated() == true ? "Y" : "N";
+ String isSearchable = obj.getIsSearchable() == true ? "Y" : "N";
+ String guiType = obj.getGuiType().toString();
+ String listType = obj.getListType().toString();
+ String pojoField = obj.getPojoField();
+ String sqlField = obj.getSqlField();
+ String staticTable = obj.getStaticTable() == null ? null : obj.getStaticTable().toString();
+ String parameter = obj.getParameter();
+ long itemTypeId = obj.getItemTypeId();
+ long metadataElementId = obj.getMetadataElementId();
+
+ /*@lineinfo:generated-code*//*@lineinfo:129^2*/
+
+// ************************************************************
+// #sql [context] { UPDATE METADATA SET ISDBINDEX = :isDbIndex, ISDBUNIQUE = :isDbUnique, ISDBNULLABLE = :isDbNullable, ISEDITABLE = :isEditable, ISLISTABLE = :isListable, ISGENERATED = :isGenerated, ISSEARCHABLE = :isSearchable, GUITYPE = :guiType, LISTTYPE = :listType, POJOFIELD = :pojoField, SQLFIELD = :sqlField, STATICTABLE = :staticTable, PARAMETER = :parameter, ITEMTYPEID = :itemTypeId, METADATAELEMENTID = :metadataElementId WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 5);
+ try
+ {
+ __sJT_stmt.setString(1, isDbIndex);
+ __sJT_stmt.setString(2, isDbUnique);
+ __sJT_stmt.setString(3, isDbNullable);
+ __sJT_stmt.setString(4, isEditable);
+ __sJT_stmt.setString(5, isListable);
+ __sJT_stmt.setString(6, isGenerated);
+ __sJT_stmt.setString(7, isSearchable);
+ __sJT_stmt.setString(8, guiType);
+ __sJT_stmt.setString(9, listType);
+ __sJT_stmt.setString(10, pojoField);
+ __sJT_stmt.setString(11, sqlField);
+ __sJT_stmt.setString(12, staticTable);
+ __sJT_stmt.setString(13, parameter);
+ __sJT_stmt.setLong(14, itemTypeId);
+ __sJT_stmt.setLong(15, metadataElementId);
+ __sJT_stmt.setLong(16, id);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:129^449*/
+ }
+
+ @Override
+ protected void insert(DefaultContext context, IEntityBase entity) throws SQLException{
+ Metadata obj = (Metadata) entity;
+ String isDbIndex = obj.getIsDbIndex() == true ? "Y" : "N";
+ String isDbUnique = obj.getIsDbUnique() == true ? "Y" : "N";
+ String isDbNullable = obj.getIsDbNullable() == true ? "Y" : "N";
+ String isEditable = obj.getIsEditable() == true ? "Y" : "N";
+ String isListable = obj.getIsListable() == true ? "Y" : "N";
+ String isGenerated = obj.getIsGenerated() == true ? "Y" : "N";
+ String isSearchable = obj.getIsSearchable() == true ? "Y" : "N";
+ String guiType = obj.getGuiType().toString();
+ String listType = obj.getListType().toString();
+ String pojoField = obj.getPojoField();
+ String sqlField = obj.getSqlField();
+ String staticTable = obj.getStaticTable() == null ? null : obj.getStaticTable().toString();
+ String parameter = obj.getParameter();
+ long itemTypeId = obj.getItemTypeId();
+ long metadataElementId = obj.getMetadataElementId();
+
+ /*@lineinfo:generated-code*//*@lineinfo:151^2*/
+
+// ************************************************************
+// #sql [context] { INSERT INTO METADATA (ISDBINDEX, ISDBUNIQUE, ISDBNULLABLE, ISEDITABLE, ISLISTABLE, ISGENERATED, ISSEARCHABLE, GUITYPE, LISTTYPE, POJOFIELD, SQLFIELD, STATICTABLE, PARAMETER, ITEMTYPEID, METADATAELEMENTID)
+// VALUES (:isDbIndex, :isDbUnique, :isDbNullable, :isEditable, :isListable, :isGenerated, :isSearchable, :guiType, :listType, :pojoField, :sqlField, :staticTable, :parameter, :itemTypeId, :metadataElementId) };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 6);
+ try
+ {
+ __sJT_stmt.setString(1, isDbIndex);
+ __sJT_stmt.setString(2, isDbUnique);
+ __sJT_stmt.setString(3, isDbNullable);
+ __sJT_stmt.setString(4, isEditable);
+ __sJT_stmt.setString(5, isListable);
+ __sJT_stmt.setString(6, isGenerated);
+ __sJT_stmt.setString(7, isSearchable);
+ __sJT_stmt.setString(8, guiType);
+ __sJT_stmt.setString(9, listType);
+ __sJT_stmt.setString(10, pojoField);
+ __sJT_stmt.setString(11, sqlField);
+ __sJT_stmt.setString(12, staticTable);
+ __sJT_stmt.setString(13, parameter);
+ __sJT_stmt.setLong(14, itemTypeId);
+ __sJT_stmt.setLong(15, metadataElementId);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:152^208*/
+ }
+
+ public IEntityBase get(String name) {
+ manager.traceIn();
+ DefaultContext context = manager.getDbContext();
+ IEntityBase entity = null;
+ try {
+ MetadataIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:161^3*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, ISDBINDEX, ISDBUNIQUE, ISDBNULLABLE, ISEDITABLE, ISLISTABLE, ISGENERATED, ISSEARCHABLE, GUITYPE, LISTTYPE, POJOFIELD, SQLFIELD, STATICTABLE, PARAMETER, ITEMTYPEID, METADATAELEMENTID FROM METADATA WHERE NAME = :name };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 7);
+ try
+ {
+ __sJT_stmt.setString(1, name);
+ iter = new MetadataIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:161^253*/
+ List<IEntityBase> result = entities(context, iter, false);
+ if (result != null && result.size() == 1)
+ entity = result.get(0);
+ /*@lineinfo:generated-code*//*@lineinfo:165^3*/
+
+// ************************************************************
+// #sql [context] { COMMIT };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 8);
+ try
+ {
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:165^27*/
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ try {
+ /*@lineinfo:generated-code*//*@lineinfo:169^4*/
+
+// ************************************************************
+// #sql [context] { ROLLBACK };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 9);
+ try
+ {
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:169^30*/
+ } catch(Exception e1) {
+ }
+ } finally {
+ manager.putDbContext(context);
+ }
+ manager.traceOut();
+ return entity;
+ }
+
+ /**
+ * Besz\ufffdrja az ItemType objektumhoz kapcsol\ufffdd\ufffd Metadata adatokat.
+ */
+ void addAll(DefaultContext context, ItemType itemType) throws SQLException {
+ List<Metadata> metadatas = itemType.getMetadatas();
+ if (metadatas != null) {
+ for (Metadata metadata: metadatas) {
+ metadata.setItemTypeId(itemType.getId());
+ add(context, metadata);
+ }
+ }
+ }
+
+ /**
+ * T\ufffdrli a param\ufffdterk\ufffdnt kapott ItemType azonos\ufffdt\ufffdhoz tartoz\ufffd Metadata bejegyz\ufffdseket.
+ */
+ void removeAll(DefaultContext context, long filterId) throws SQLException {
+ manager.traceIn();
+ /*@lineinfo:generated-code*//*@lineinfo:197^2*/
+
+// ************************************************************
+// #sql [context] { DELETE FROM METADATA WHERE ITEMTYPEID = :filterId };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, MetadataDAO_SJProfileKeys.getKey(0), 10);
+ try
+ {
+ __sJT_stmt.setLong(1, filterId);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:197^69*/
+ manager.traceOut();
+ }
+
+// void addColumn(Connection connection, Metadata metadata) throws SQLException {
+// Statement st = null;
+// try {
+// ItemType itemType = ItemManager.getInstance().getItemType(metadata.getItemTypeId());
+// String tableName = itemType.getTableName();
+// String create = metadata.getCreateSQL();
+// List<String> commands = new ArrayList<String>();
+// if (create != null) {
+// commands.add("ALTER TABLE " + tableName + " ADD COLUMN " + create);
+// String index = metadata.getIndexSQL();
+// if (index != null)
+// commands.add(index);
+// commands.add("call SYSPROC.ADMIN_CMD ('REORG TABLE " + tableName + "')");
+// }
+// st = connection.createStatement();
+// for (String sql: commands)
+// st.execute(sql);
+// }
+// catch (SQLException e) {
+// throw new SQLException(e);
+// } finally {
+// try{
+// if (st != null)
+// st.close();
+// } catch (Exception e1) { }
+// }
+// }
+//
+// void modifyColumn(Connection connection, Metadata metadata) throws SQLException {
+// Statement st = null;
+// try {
+// ItemType itemType = ItemManager.getInstance().getItemType(metadata.getItemTypeId());
+// String tableName = itemType.getTableName();
+// String columnName = metadata.getColumnName();
+// List<String> commands = new ArrayList<String>();
+// commands.add("ALTER TABLE " + tableName + " DROP COLUMN " + columnName);
+// String create = metadata.getCreateSQL();
+// if (create != null) {
+// commands.add("ALTER TABLE " + tableName + " ADD COLUMN " + create);
+// String index = metadata.getIndexSQL();
+// if (index != null) {
+// commands.add("call SYSPROC.ADMIN_CMD ('REORG TABLE " + tableName + "')");
+// commands.add(index);
+// }
+// commands.add("call SYSPROC.ADMIN_CMD ('REORG TABLE " + tableName + "')");
+// }
+// st = connection.createStatement();
+// for (String sql: commands) {
+// System.out.println(sql);
+// st.execute(sql);
+// }
+// }
+// catch (SQLException e) {
+// throw new SQLException(e);
+// } finally {
+// try{
+// if (st != null)
+// st.close();
+// } catch (Exception e1) { }
+// }
+// }
+//
+// void removeColumn(Connection connection, Metadata metadata) throws SQLException {
+// Statement st = null;
+// try {
+// ItemType itemType = ItemManager.getInstance().getItemType(metadata.getItemTypeId());
+// String tableName = itemType.getTableName();
+// String columnName = metadata.getColumnName();
+// List<String> commands = new ArrayList<String>();
+// commands.add("ALTER TABLE " + tableName + " DROP COLUMN " + columnName);
+// commands.add("call SYSPROC.ADMIN_CMD ('REORG TABLE " + tableName + "')");
+// st = connection.createStatement();
+// for (String sql: commands)
+// st.execute(sql);
+// }
+// catch (SQLException e) {
+// throw new SQLException(e);
+// } finally {
+// try{
+// if (st != null)
+// st.close();
+// } catch (Exception e1) { }
+// }
+// }
+
+// void dropMetadataTable(Connection connection, ItemType itemType) throws SQLException {
+// manager.traceIn();
+// String tableName = itemType.getTableName().toString();
+// Statement st = null;
+// try {
+// st = connection.createStatement();
+// st.execute("DROP TABLE " + tableName);
+// }
+// catch (SQLException e) {
+// throw new SQLException(e);
+// } finally {
+// try{
+// if (st != null)
+// st.close();
+// } catch (Exception e1) { }
+// }
+// manager.traceOut();
+// }
+//
+// void createMetadataTable(Connection connection, ItemType itemType) throws SQLException {
+// manager.traceIn();
+// List<String> commands = new ArrayList<String>();
+// List<String> indexes = new ArrayList<String>();
+// String tableName = itemType.getTableName().toString();
+// StringBuilder sb = new StringBuilder();
+// sb.append("CREATE TABLE " + tableName + "(");
+// sb.append("ID BIGINT NOT NULL PRIMARY KEY,");
+// sb.append("CONSTRAINT FK_" + tableName + "_ID FOREIGN KEY (ID) REFERENCES MASTERID (ID)");
+//
+// List<Metadata> metadatas = itemType.getMetadatas();
+// if (metadatas != null) {
+// for (Metadata md : metadatas) {
+// String create = md.getCreateSQL();
+// if (create != null) {
+// sb.append(", ");
+// sb.append(create);
+// }
+// String index = md.getIndexSQL();
+// if (index != null)
+// indexes.add(index);
+// }
+// }
+// sb.append(")");
+// commands.add(sb.toString());
+// commands.addAll(indexes);
+//
+// Statement st = null;
+// try {
+// st = connection.createStatement();
+// for (String sql: commands)
+// st.execute(sql);
+// }
+// catch (SQLException e) {
+// throw new SQLException(e);
+// } finally {
+// try{
+// if (st != null)
+// st.close();
+// } catch (Exception e1) { }
+// }
+// manager.traceOut();
+// }
+
+ void createTable(Connection connection, IEntityBase entity) throws SQLException {
+ manager.traceIn();
+ Statement st = null;
+ Metadata metadata = (Metadata) entity;
+ try {
+ String tableName = metadata.getTableName();
+ String columnSql = metadata.getCreateSQL();
+ String sql = String.format("CREATE TABLE %1$s (ID BIGINT NOT NULL PRIMARY KEY, %2$s, CONSTRAINT FK_%1$s_ID FOREIGN KEY (ID) REFERENCES MASTERID (ID))", tableName, columnSql);
+ st = connection.createStatement();
+ logger.debug(sql);
+ st.execute(sql);
+ String index = metadata.getIndexSQL();
+ if (index != null) {
+ logger.debug(index);
+ st.execute(index);
+ }
+ }
+ catch (SQLException e) {
+ throw new SQLException(e);
+ } finally {
+ try{
+ if (st != null)
+ st.close();
+ } catch (Exception e1) { }
+ }
+ manager.traceOut();
+ }
+
+ void dropTable(Connection connection, IEntityBase entity) throws SQLException {
+ manager.traceIn();
+ Metadata metadata = (Metadata) entity;
+ String tableName = metadata.getTableName();
+ Statement st = null;
+ try {
+ st = connection.createStatement();
+ String sql = "DROP TABLE " + tableName;
+ logger.debug(sql);
+ st.execute(sql);
+ }
+ catch (SQLException e) {
+ throw new SQLException(e);
+ } finally {
+ try{
+ if (st != null)
+ st.close();
+ } catch (Exception e1) { }
+ }
+ manager.traceOut();
+ }
+}/*@lineinfo:generated-code*/class MetadataDAO_SJProfileKeys
+{
+ private java.lang.Object[] keys;
+ private final sqlj.runtime.profile.Loader loader = sqlj.runtime.RuntimeContext.getRuntime().getLoaderForClass(getClass());
+ private static MetadataDAO_SJProfileKeys inst = null;
+ public static java.lang.Object getKey(int keyNum)
+ throws java.sql.SQLException
+ {
+ synchronized(user.jobengine.db.MetadataDAO_SJProfileKeys.class) {
+ if (inst == null)
+ {
+ inst = new MetadataDAO_SJProfileKeys();
+ }
+ }
+ return inst.keys[keyNum];
+ }
+ private MetadataDAO_SJProfileKeys()
+ throws java.sql.SQLException
+ {
+ keys = new java.lang.Object[1];
+ keys[0] = DefaultContext.getProfileKey(loader, "user.jobengine.db.MetadataDAO_SJProfile0");
+ }
+}
--- /dev/null
+/*@lineinfo:filename=StoreDAO*//*@lineinfo:user-code*//*@lineinfo:1^1*/package user.jobengine.db;
+
+import user.commons.IEntityBase;
+import sqlj.runtime.ref.*;
+import user.commons.StoreUri;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/*@lineinfo:generated-code*//*@lineinfo:10^2*/
+
+// ************************************************************
+// SQLJ iterator declaration:
+// ************************************************************
+
+class StoreIter
+extends sqlj.runtime.ref.ResultSetIterImpl
+implements sqlj.runtime.NamedIterator
+{
+ private int isLowresNdx;
+ private int isSystemNdx;
+ private int nameNdx;
+ private int idNdx;
+ public StoreIter(sqlj.runtime.profile.RTResultSet resultSet)
+ throws java.sql.SQLException
+ {
+ super(resultSet);
+ idNdx = findColumn("id");
+ nameNdx = findColumn("name");
+ isSystemNdx = findColumn("isSystem");
+ isLowresNdx = findColumn("isLowres");
+ }
+ public StoreIter(sqlj.runtime.profile.RTResultSet resultSet, int fetchSize, int maxRows)
+ throws java.sql.SQLException
+ {
+ super(resultSet, fetchSize, maxRows);
+ idNdx = findColumn("id");
+ nameNdx = findColumn("name");
+ isSystemNdx = findColumn("isSystem");
+ isLowresNdx = findColumn("isLowres");
+ }
+ public long id()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(idNdx);
+ }
+ public String name()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(nameNdx);
+ }
+ public String isSystem()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isSystemNdx);
+ }
+ public String isLowres()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isLowresNdx);
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:10^78*/
+
+@SuppressWarnings("unused")
+class StoreDAO extends EntityBaseDAO {
+
+ public StoreDAO(ItemManager manager) {
+ super(manager);
+ }
+
+ @Override
+ protected void afterAdd(DefaultContext context, IEntityBase entity) throws SQLException {
+ StoreUriDAO dao = (StoreUriDAO) manager.getBaseDAO(StoreUri.class);
+ dao.addAll(context, entity);
+ }
+
+ @Override
+ protected void beforeDelete(DefaultContext context, IEntityBase entity) throws SQLException {
+ StoreUriDAO dao = (StoreUriDAO) manager.getBaseDAO(StoreUri.class);
+ dao.removeAll(context, entity.getId());
+ }
+
+ @Override
+ protected List<IEntityBase> entities(DefaultContext context, ResultSetIterImpl iter, boolean isChunked) throws SQLException {
+ List<IEntityBase> result = null;
+ StoreIter iterator = (StoreIter) iter;
+ while (iterator.next()) {
+ Store entity = new Store();
+ entity.setId(iterator.id());
+ entity.setName(iterator.name());
+ entity.setSystem(iterator.isSystem().equals("Y") ? true : false);
+ entity.setLowres(iterator.isLowres().equals("Y") ? true : false);
+
+ if (result == null)
+ result = new ArrayList<IEntityBase>();
+ result.add(entity);
+ }
+ iterator.close();
+ return result;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectByKey(DefaultContext context, long id) throws SQLException{
+ StoreIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:53^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, NAME, ISSYSTEM, ISLOWRES FROM STORE WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreDAO_SJProfileKeys.getKey(0), 0);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ iter = new StoreIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:53^88*/
+ return iter;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectAll(DefaultContext context) throws SQLException{
+ StoreIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:60^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, NAME, ISSYSTEM, ISLOWRES FROM STORE };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreDAO_SJProfileKeys.getKey(0), 1);
+ try
+ {
+ iter = new StoreIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:60^73*/
+ return iter;
+ }
+
+ protected ResultSetIterImpl selectByName(DefaultContext context, String name) throws SQLException{
+ StoreIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:66^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, NAME, ISSYSTEM, ISLOWRES FROM STORE WHERE NAME = :name };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreDAO_SJProfileKeys.getKey(0), 2);
+ try
+ {
+ __sJT_stmt.setString(1, name);
+ iter = new StoreIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:66^92*/
+ return iter;
+ }
+
+ protected ResultSetIterImpl selectBySystem(DefaultContext context, String lowres) throws SQLException{
+ StoreIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:72^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, NAME, ISSYSTEM, ISLOWRES FROM STORE WHERE ISSYSTEM = 'Y' AND ISLOWRES = :lowres };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreDAO_SJProfileKeys.getKey(0), 3);
+ try
+ {
+ __sJT_stmt.setString(1, lowres);
+ iter = new StoreIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:72^117*/
+ return iter;
+ }
+
+ @Override
+ protected void delete(DefaultContext context, long id) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:78^2*/
+
+// ************************************************************
+// #sql [context] { DELETE FROM STORE WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreDAO_SJProfileKeys.getKey(0), 4);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:78^52*/
+ }
+
+ @Override
+ protected void truncateTable(DefaultContext context) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:83^2*/
+
+// ************************************************************
+// #sql [context] { TRUNCATE TABLE STORE DROP STORAGE IGNORE DELETE TRIGGERS IMMEDIATE };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreDAO_SJProfileKeys.getKey(0), 5);
+ try
+ {
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:83^86*/
+ }
+
+ @Override
+ protected void update(DefaultContext context, IEntityBase entity) throws SQLException{
+ Store obj = (Store) entity;
+ long id = obj.getId();
+ String name = obj.getName();
+ String isSystem = obj.isSystem() == true ? "Y" : "N";
+ String isLowres = obj.isLowres() == true ? "Y" : "N";
+
+ /*@lineinfo:generated-code*//*@lineinfo:94^2*/
+
+// ************************************************************
+// #sql [context] { UPDATE STORE SET NAME = :name, ISSYSTEM = :isSystem, ISLOWRES = :isLowres WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreDAO_SJProfileKeys.getKey(0), 6);
+ try
+ {
+ __sJT_stmt.setString(1, name);
+ __sJT_stmt.setString(2, isSystem);
+ __sJT_stmt.setString(3, isLowres);
+ __sJT_stmt.setLong(4, id);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:94^108*/
+ }
+
+ @Override
+ protected void insert(DefaultContext context, IEntityBase entity) throws SQLException{
+ Store obj = (Store) entity;
+ String name = obj.getName();
+ String isSystem = obj.isSystem() == true ? "Y" : "N";
+ String isLowres = obj.isLowres() == true ? "Y" : "N";
+
+ /*@lineinfo:generated-code*//*@lineinfo:104^2*/
+
+// ************************************************************
+// #sql [context] { INSERT INTO STORE (NAME, ISSYSTEM, ISLOWRES) VALUES (:name, :isSystem, :isLowres) };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreDAO_SJProfileKeys.getKey(0), 7);
+ try
+ {
+ __sJT_stmt.setString(1, name);
+ __sJT_stmt.setString(2, isSystem);
+ __sJT_stmt.setString(3, isLowres);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:104^101*/
+ }
+
+ public IEntityBase getByName(String name) {
+ manager.traceIn();
+ IEntityBase entity = null;
+ DefaultContext context = manager.getDbContext();
+ try {
+ ResultSetIterImpl iter = selectByName(context, name);
+ checkNull(iter, ResultSetIterImpl.class);
+ entity = getEntity(context, iter);
+ } catch (Exception e) {
+ throw new ItemManagerException(e);
+ } finally {
+ manager.putDbContext(context);
+ }
+ manager.traceOut();
+ return entity;
+ }
+
+
+ public IEntityBase getSystemStore(boolean lowres) {
+ manager.traceIn();
+ IEntityBase entity = null;
+ DefaultContext context = manager.getDbContext();
+ try {
+ ResultSetIterImpl iter = selectBySystem(context, lowres ? "Y" : "N");
+ checkNull(iter, ResultSetIterImpl.class);
+ entity = getEntity(context, iter);
+ } catch (Exception e) {
+ throw new ItemManagerException(e);
+ } finally {
+ manager.putDbContext(context);
+ }
+ manager.traceOut();
+ return entity;
+ }
+
+}/*@lineinfo:generated-code*/class StoreDAO_SJProfileKeys
+{
+ private java.lang.Object[] keys;
+ private final sqlj.runtime.profile.Loader loader = sqlj.runtime.RuntimeContext.getRuntime().getLoaderForClass(getClass());
+ private static StoreDAO_SJProfileKeys inst = null;
+ public static java.lang.Object getKey(int keyNum)
+ throws java.sql.SQLException
+ {
+ synchronized(user.jobengine.db.StoreDAO_SJProfileKeys.class) {
+ if (inst == null)
+ {
+ inst = new StoreDAO_SJProfileKeys();
+ }
+ }
+ return inst.keys[keyNum];
+ }
+ private StoreDAO_SJProfileKeys()
+ throws java.sql.SQLException
+ {
+ keys = new java.lang.Object[1];
+ keys[0] = DefaultContext.getProfileKey(loader, "user.jobengine.db.StoreDAO_SJProfile0");
+ }
+}
--- /dev/null
+/*@lineinfo:filename=StoreUriDAO*//*@lineinfo:user-code*//*@lineinfo:1^1*/package user.jobengine.db;
+
+import user.commons.IEntityBase;
+import sqlj.runtime.ref.*;
+import user.commons.StoreUri;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.ArrayList;
+import user.commons.remotestore.RemoteStoreProtocol;
+import user.commons.remotestore.DeliveryMethod;
+
+/*@lineinfo:generated-code*//*@lineinfo:12^2*/
+
+// ************************************************************
+// SQLJ iterator declaration:
+// ************************************************************
+
+class StoreUriIter
+extends sqlj.runtime.ref.ResultSetIterImpl
+implements sqlj.runtime.NamedIterator
+{
+ private int protocolNdx;
+ private int deliveryNdx;
+ private int portNumberNdx;
+ private int rootPathNdx;
+ private int passwordNdx;
+ private int userNameNdx;
+ private int isTargetNdx;
+ private int isSourceNdx;
+ private int isStreamNdx;
+ private int uriNdx;
+ private int storeIdNdx;
+ private int idNdx;
+ public StoreUriIter(sqlj.runtime.profile.RTResultSet resultSet)
+ throws java.sql.SQLException
+ {
+ super(resultSet);
+ idNdx = findColumn("id");
+ storeIdNdx = findColumn("storeId");
+ uriNdx = findColumn("uri");
+ isStreamNdx = findColumn("isStream");
+ isSourceNdx = findColumn("isSource");
+ isTargetNdx = findColumn("isTarget");
+ userNameNdx = findColumn("userName");
+ passwordNdx = findColumn("password");
+ rootPathNdx = findColumn("rootPath");
+ portNumberNdx = findColumn("portNumber");
+ deliveryNdx = findColumn("delivery");
+ protocolNdx = findColumn("protocol");
+ }
+ public StoreUriIter(sqlj.runtime.profile.RTResultSet resultSet, int fetchSize, int maxRows)
+ throws java.sql.SQLException
+ {
+ super(resultSet, fetchSize, maxRows);
+ idNdx = findColumn("id");
+ storeIdNdx = findColumn("storeId");
+ uriNdx = findColumn("uri");
+ isStreamNdx = findColumn("isStream");
+ isSourceNdx = findColumn("isSource");
+ isTargetNdx = findColumn("isTarget");
+ userNameNdx = findColumn("userName");
+ passwordNdx = findColumn("password");
+ rootPathNdx = findColumn("rootPath");
+ portNumberNdx = findColumn("portNumber");
+ deliveryNdx = findColumn("delivery");
+ protocolNdx = findColumn("protocol");
+ }
+ public long id()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(idNdx);
+ }
+ public long storeId()
+ throws java.sql.SQLException
+ {
+ return resultSet.getLongNoNull(storeIdNdx);
+ }
+ public String uri()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(uriNdx);
+ }
+ public String isStream()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isStreamNdx);
+ }
+ public String isSource()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isSourceNdx);
+ }
+ public String isTarget()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(isTargetNdx);
+ }
+ public String userName()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(userNameNdx);
+ }
+ public String password()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(passwordNdx);
+ }
+ public String rootPath()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(rootPathNdx);
+ }
+ public Integer portNumber()
+ throws java.sql.SQLException
+ {
+ return resultSet.getIntWrapper(portNumberNdx);
+ }
+ public String delivery()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(deliveryNdx);
+ }
+ public String protocol()
+ throws java.sql.SQLException
+ {
+ return resultSet.getString(protocolNdx);
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:12^216*/
+
+@SuppressWarnings("unused")
+
+class StoreUriDAO extends EntityBaseDAO {
+
+ public StoreUriDAO(ItemManager manager) {
+ super(manager);
+ }
+
+ @Override
+ protected List<IEntityBase> entities(DefaultContext context, ResultSetIterImpl iter, boolean isChunked) throws SQLException {
+ List<IEntityBase> result = null;
+ StoreUriIter iterator = (StoreUriIter) iter;
+ while (iterator.next()) {
+ StoreUri entity = new StoreUri();
+ entity.setId(iterator.id());
+ entity.setStoreId(iterator.storeId());
+ entity.setUri(iterator.uri());
+ entity.setStream(iterator.isStream().equals("Y") ? true : false);
+ entity.setSource(iterator.isSource().equals("Y") ? true : false);
+ entity.setTarget(iterator.isTarget().equals("Y") ? true : false);
+ entity.setUserName(iterator.userName());
+ entity.setPassword(iterator.password());
+ entity.setRootPath(iterator.rootPath());
+ entity.setPortNumber(iterator.portNumber());
+ entity.setDelivery(ItemManagerData.toDeliveryMethod(iterator.delivery()));
+ entity.setProtocol(ItemManagerData.toRemoteStoreProtocol(iterator.protocol()));
+
+ if (result == null)
+ result = new ArrayList<IEntityBase>();
+ result.add(entity);
+ }
+ iterator.close();
+ return result;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectByKey(DefaultContext context, long id) throws SQLException{
+ StoreUriIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:52^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, STOREID, URI, ISSTREAM, ISSOURCE, ISTARGET, USERNAME, PASSWORD, ROOTPATH, PORTNUMBER, DELIVERY, PROTOCOL FROM STOREURI WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreUriDAO_SJProfileKeys.getKey(0), 0);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ iter = new StoreUriIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:52^171*/
+ return iter;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectByForeignKey(DefaultContext context, long id) throws SQLException{
+ StoreUriIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:59^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, STOREID, URI, ISSTREAM, ISSOURCE, ISTARGET, USERNAME, PASSWORD, ROOTPATH, PORTNUMBER, DELIVERY, PROTOCOL FROM STOREURI WHERE STOREID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreUriDAO_SJProfileKeys.getKey(0), 1);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ iter = new StoreUriIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:59^176*/
+ return iter;
+ }
+
+ @Override
+ protected ResultSetIterImpl selectAll(DefaultContext context) throws SQLException{
+ StoreUriIter iter = null;
+ /*@lineinfo:generated-code*//*@lineinfo:66^2*/
+
+// ************************************************************
+// #sql [context] iter = { SELECT ID, STOREID, URI, ISSTREAM, ISSOURCE, ISTARGET, USERNAME, PASSWORD, ROOTPATH, PORTNUMBER, DELIVERY, PROTOCOL FROM STOREURI };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreUriDAO_SJProfileKeys.getKey(0), 2);
+ try
+ {
+ iter = new StoreUriIter(__sJT_execCtx.executeQuery(), __sJT_execCtx.getFetchSize(), __sJT_execCtx.getMaxRows());
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:66^156*/
+ return iter;
+ }
+
+ @Override
+ protected void delete(DefaultContext context, long id) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:72^2*/
+
+// ************************************************************
+// #sql [context] { DELETE FROM STOREURI WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreUriDAO_SJProfileKeys.getKey(0), 3);
+ try
+ {
+ __sJT_stmt.setLong(1, id);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:72^55*/
+ }
+
+ @Override
+ protected void truncateTable(DefaultContext context) throws SQLException{
+ /*@lineinfo:generated-code*//*@lineinfo:77^2*/
+
+// ************************************************************
+// #sql [context] { TRUNCATE TABLE STOREURI DROP STORAGE IGNORE DELETE TRIGGERS IMMEDIATE };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreUriDAO_SJProfileKeys.getKey(0), 4);
+ try
+ {
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:77^89*/
+ }
+
+ @Override
+ protected void update(DefaultContext context, IEntityBase entity) throws SQLException{
+ StoreUri obj = (StoreUri) entity;
+ long id = obj.getId();
+ long storeId = obj.getStoreId();
+ String uri = obj.getUri();
+ String isStream = obj.isStream() == true ? "Y" : "N";
+ String isSource = obj.isSource() == true ? "Y" : "N";
+ String isTarget = obj.isTarget() == true ? "Y" : "N";
+ String userName = obj.getUserName();
+ String password = obj.getPassword();
+ String rootPath = obj.getRootPath();
+ Integer portNumber = obj.getPortNumber();
+ String delivery = obj.getDelivery() == null ? null : obj.getDelivery().toString();
+ String protocol = obj.getProtocol() == null ? null : obj.getProtocol().toString();
+
+ /*@lineinfo:generated-code*//*@lineinfo:96^2*/
+
+// ************************************************************
+// #sql [context] { UPDATE STOREURI SET STOREID = :storeId, URI = :uri, ISSTREAM = :isStream, ISSOURCE = :isSource, ISTARGET = :isTarget, USERNAME = :userName, PASSWORD = :password, ROOTPATH = :rootPath, PORTNUMBER = :portNumber, DELIVERY = :delivery, PROTOCOL = :protocol WHERE ID = :id };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreUriDAO_SJProfileKeys.getKey(0), 5);
+ try
+ {
+ __sJT_stmt.setLong(1, storeId);
+ __sJT_stmt.setString(2, uri);
+ __sJT_stmt.setString(3, isStream);
+ __sJT_stmt.setString(4, isSource);
+ __sJT_stmt.setString(5, isTarget);
+ __sJT_stmt.setString(6, userName);
+ __sJT_stmt.setString(7, password);
+ __sJT_stmt.setString(8, rootPath);
+ __sJT_stmt.setIntWrapper(9, portNumber);
+ __sJT_stmt.setString(10, delivery);
+ __sJT_stmt.setString(11, protocol);
+ __sJT_stmt.setLong(12, id);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:96^287*/
+ }
+
+ @Override
+ protected void insert(DefaultContext context, IEntityBase entity) throws SQLException{
+ StoreUri obj = (StoreUri) entity;
+ long storeId = obj.getStoreId();
+ String uri = obj.getUri();
+ String isStream = obj.isStream() == true ? "Y" : "N";
+ String isSource = obj.isSource() == true ? "Y" : "N";
+ String isTarget = obj.isTarget() == true ? "Y" : "N";
+ String userName = obj.getUserName();
+ String password = obj.getPassword();
+ String rootPath = obj.getRootPath();
+ Integer portNumber = obj.getPortNumber();
+ String delivery = obj.getDelivery() == null ? null : obj.getDelivery().toString();
+ String protocol = obj.getProtocol() == null ? null : obj.getProtocol().toString();
+
+ /*@lineinfo:generated-code*//*@lineinfo:114^2*/
+
+// ************************************************************
+// #sql [context] { INSERT INTO STOREURI (STOREID, URI, ISSTREAM, ISSOURCE, ISTARGET, USERNAME, PASSWORD, ROOTPATH, PORTNUMBER, DELIVERY, PROTOCOL) VALUES (:storeId, :uri, :isStream, :isSource, :isTarget, :userName, :password, :rootPath, :portNumber, :delivery, :protocol) };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreUriDAO_SJProfileKeys.getKey(0), 6);
+ try
+ {
+ __sJT_stmt.setLong(1, storeId);
+ __sJT_stmt.setString(2, uri);
+ __sJT_stmt.setString(3, isStream);
+ __sJT_stmt.setString(4, isSource);
+ __sJT_stmt.setString(5, isTarget);
+ __sJT_stmt.setString(6, userName);
+ __sJT_stmt.setString(7, password);
+ __sJT_stmt.setString(8, rootPath);
+ __sJT_stmt.setIntWrapper(9, portNumber);
+ __sJT_stmt.setString(10, delivery);
+ __sJT_stmt.setString(11, protocol);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:114^272*/
+ }
+
+ void addAll(DefaultContext context, IEntityBase entity) throws SQLException {
+ manager.traceIn();
+ Store store = (Store) entity;
+ if (store != null && store.getStoreUris() != null) {
+ for (StoreUri su: store.getStoreUris()) {
+ su.setStoreId(store.getId());
+ add(context, su);
+ }
+ }
+ manager.traceOut();
+ }
+
+ /**
+ * T\ufffdrli a param\ufffdterk\ufffdnt kapott Store azonos\ufffdt\ufffdhoz tartoz\ufffd StoreUri bejegyz\ufffdseket.
+ */
+ void removeAll(DefaultContext context, long filterId) throws SQLException {
+ manager.traceIn();
+ /*@lineinfo:generated-code*//*@lineinfo:134^2*/
+
+// ************************************************************
+// #sql [context] { DELETE FROM STOREURI WHERE STOREID = :filterId };
+// ************************************************************
+
+{
+ sqlj.runtime.ConnectionContext __sJT_connCtx = context;
+ if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_DEFAULT_CONN_CTX();
+ sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
+ if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
+ synchronized (__sJT_execCtx) {
+ sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, StoreUriDAO_SJProfileKeys.getKey(0), 7);
+ try
+ {
+ __sJT_stmt.setLong(1, filterId);
+ __sJT_execCtx.executeUpdate();
+ }
+ finally
+ {
+ __sJT_execCtx.releaseStatement();
+ }
+ }
+}
+
+
+// ************************************************************
+
+/*@lineinfo:user-code*//*@lineinfo:134^66*/
+ manager.traceOut();
+ }
+
+}/*@lineinfo:generated-code*/class StoreUriDAO_SJProfileKeys
+{
+ private java.lang.Object[] keys;
+ private final sqlj.runtime.profile.Loader loader = sqlj.runtime.RuntimeContext.getRuntime().getLoaderForClass(getClass());
+ private static StoreUriDAO_SJProfileKeys inst = null;
+ public static java.lang.Object getKey(int keyNum)
+ throws java.sql.SQLException
+ {
+ synchronized(user.jobengine.db.StoreUriDAO_SJProfileKeys.class) {
+ if (inst == null)
+ {
+ inst = new StoreUriDAO_SJProfileKeys();
+ }
+ }
+ return inst.keys[keyNum];
+ }
+ private StoreUriDAO_SJProfileKeys()
+ throws java.sql.SQLException
+ {
+ keys = new java.lang.Object[1];
+ keys[0] = DefaultContext.getProfileKey(loader, "user.jobengine.db.StoreUriDAO_SJProfile0");
+ }
+}
-- // Alter missing proxy view, select video only
-- Migration SQL that makes the change goes here.
-DROP VIEW VW_MISSING_PROXY_IDS
-@
-
-CREATE VIEW VW_MISSING_PROXY_IDS AS
-select m.id as mediaid
+CREATE OR REPLACE VIEW VW_MISSING_PROXY_IDS AS
+select m.id as mediaid, m.archived, m.modified, mf.houseid
from vw_mediafiles v, mediafile mf, filetype ft, media m
where
m.id = mf.mediaid and
-- //@UNDO
-- SQL to undo the change goes here.
-DROP VIEW VW_MISSING_PROXY_IDS
-@
-
-CREATE VIEW VW_MISSING_PROXY_IDS AS
- select m.id as mediaid
- from vw_mediafiles v, mediafile mf, filetype ft, media m
- where
- m.id = mf.mediaid and
- mf.mediaid = v.mediaid and
- v.mediafilecount = 1 and
- mf.filetypeid = ft.id and
- ft.name = 'High-res'
-@
+--No undo
--- /dev/null
+-- // Creates PASAPOOL as mounted store
+-- Migration SQL that makes the change goes here.
+
+INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES
+('LOCAL','N','N')
+@
+
+INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES
+((SELECT ID FROM STORE WHERE NAME='LOCAL'),'LOCAL',null,'/mediacube/data','N','Y','Y',null,null,null,null)
+@
+
+-- //@UNDO
+-- SQL to undo the change goes here.
+DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='LOCAL')
+@
+DELETE FROM STORE WHERE NAME='LOCAL'
+@
\r
void loadSchedules() throws Exception;\r
\r
+ String loadTemplateXml(String template);\r
+\r
}\r
@Override
public void addJobChangedEventListener(IJobChangedListener listener) {
- if (listener != null) {
+ if (listener != null && !keepAliveJobChangedListeners.containsKey(listener)) {
jobChangedListenerList.add(listener);
}
}
if (listener != null) {
jobChangedListenerList.add(listener);
keepAliveJobChangedListeners.put(listener, System.currentTimeMillis());
- logger.info("Managed listener added");
+ logger.info("Managed listener added {}", listener);
}
}
@Override
public void keepAliveJobChangedListener(IJobChangedListener listener) {
- if (keepAliveJobChangedListeners != null)
- keepAliveJobChangedListeners.put(listener, System.currentTimeMillis());
+ if (keepAliveJobChangedListeners != null) {
+ long now = System.currentTimeMillis();
+ //ha mar hozza van adva, nem adja hozza
+ addJobChangedEventListener(listener);
+ keepAliveJobChangedListeners.put(listener, now);
+ //logger.info("Refreshing listener {}, now {} ({})", listener, now, keepAliveJobChangedListeners.size());
+ }
}
@Deprecated
synchronized protected void removeJobChangedListenerGarbage() {
List<IJobChangedListener> toBeRemoved = new ArrayList<>();
-
for (IJobChangedListener listener : keepAliveJobChangedListeners.keySet()) {
long lastMod = keepAliveJobChangedListeners.get(listener);
- if (System.currentTimeMillis() - lastMod > 5 * 1000)
+ long now = System.currentTimeMillis();
+ if ((now - lastMod) > 5 * 1000) {
+
toBeRemoved.add(listener);
+ logger.info("{} refreshed {}, now {}", listener, lastMod, now);
+ }
}
toBeRemoved.forEach(r -> {
- logger.info("Removing listener");
+ logger.info("Removing listener {}", r);
removeJobChangedEventListener(r);
keepAliveJobChangedListeners.remove(r);
});
\r
boolean isGroovyClass = stepUnitName.toLowerCase().endsWith(".java") || stepUnitName.toLowerCase().endsWith(".groovy");\r
\r
- String stepClassesDir = systemConfig.getConfig(DIR_CLASSES);\r
- Path path = Paths.get(stepClassesDir);\r
- URL[] urls = { path.toUri().toURL() };\r
- URLClassLoader stepsClassLoader = URLClassLoader.newInstance(urls, Thread.currentThread().getContextClassLoader());\r
+ URLClassLoader stepsClassLoader = null;\r
+ try {\r
+ String stepClassesDir = systemConfig.getConfig(DIR_CLASSES);\r
+ Path path = Paths.get(stepClassesDir);\r
+ URL[] urls = { path.toUri().toURL() };\r
+ stepsClassLoader = URLClassLoader.newInstance(urls, Thread.currentThread().getContextClassLoader());\r
+ } catch (FileNotFoundException e) {\r
+ //nincs jobs/classes mappa\r
+ URL[] urls = {};\r
+ stepsClassLoader = URLClassLoader.newInstance(urls, Thread.currentThread().getContextClassLoader());\r
+ }\r
\r
Class<IJobStep> stepClass = null;\r
\r
} else\r
stepClass = (Class<IJobStep>) stepsClassLoader.loadClass(stepUnitName);\r
\r
+ if (stepClass == null) {\r
+ throw new Exception("Missing " + stepUnitName);\r
+ }\r
result = stepClass.newInstance();\r
\r
return result;\r
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
stream = Files.newInputStream(config);\r
String fileName = config.getFileName().toString();\r
Parser parser = new Parser(stream);\r
}\r
}\r
\r
+ @Override\r
+ public String loadTemplateXml(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
+ } catch (Exception e) {\r
+ logger.error(e.getClass().getSimpleName() + ": " + e.getMessage());\r
+ }\r
+ return result;\r
+ }\r
+\r
private Class<?> parseClassHierarchy(GroovyClassLoader cl, String root, String className) throws IOException {\r
Path path = Paths.get(root, className);\r
\r
logger.info("Executing locally {}", jobRuntime.getId());
//jobRuntime.setDescription(PROCESSING_LOCALLY);
Object[] inputs = jobEngine.getInputsFromStack(jobRuntime);
+
IJobStep stepObject = runStep(jobRuntime, inputs);
if (stepObject.isTest()) {
logger.trace("Finishing test worker");
this.expression = expression;\r
}\r
\r
+ @Override\r
+ public String toString() {\r
+ return expression.getName();\r
+ }\r
+\r
@Override\r
public Object visit(Visitor v, Object o) {\r
v.visitInputParameter(this, o);\r
ParameterSequence inputParameterSequence = ((CallJobStepCommand) command).getInputParameterSequence();\r
if (inputParameterSequence != null) {\r
for (Parameter parameter : inputParameterSequence.getParameters()) {\r
+ if (!(parameter instanceof InputParameter))\r
+ throw new Exception(((CallJobStepCommand) command).getType() + ": class cast problem with input parameter name "\r
+ + parameter.toString());\r
+\r
Expression expression = ((InputParameter) parameter).getExpression();\r
if (expression instanceof VariableExpression) {\r
if (!inputvariables.contains(expression.getName()))\r
ParameterSequence outputParameterSequence = ((CallJobStepCommand) command).getOutputParameterSequence();\r
if (outputParameterSequence != null) {\r
for (Parameter parameter : outputParameterSequence.getParameters()) {\r
+ if (!(parameter instanceof OutputParameter))\r
+ throw new Exception(((CallJobStepCommand) command).getType() + ": class cast problem with output parameter name "\r
+ + parameter.toString());\r
VariableName name = ((OutputParameter) parameter).getVariableName();\r
if (!inputvariables.contains(name.getName()))\r
inputvariables.add(name.getName());\r
package user.jobengine.server.ast;\r
\r
/**\r
- * Kimeneti paraméter osztály.\r
+ * Kimeneti param�ter oszt�ly.\r
*/\r
public class OutputParameter extends Parameter {\r
\r
}\r
\r
/**\r
- * Példányosítás változónév megadásával.\r
- * \r
+ * P�ld�nyos�t�s v�ltoz�n�v megad�s�val.\r
+ *\r
* @param vn\r
- * Változónév.\r
+ * V�ltoz�n�v.\r
*/\r
public OutputParameter(VariableName vn) {\r
this.setVariableName(vn);\r
}\r
\r
/**\r
- * Változónév lekérdezése.\r
- * \r
- * @return Változónév.\r
+ * V�ltoz�n�v lek�rdez�se.\r
+ *\r
+ * @return V�ltoz�n�v.\r
*/\r
public VariableName getVariableName() {\r
return variableName;\r
}\r
\r
/**\r
- * Változónév beállítása.\r
- * \r
+ * V�ltoz�n�v be�ll�t�sa.\r
+ *\r
* @param variableName\r
- * Változónév.\r
+ * V�ltoz�n�v.\r
*/\r
public void setVariableName(VariableName variableName) {\r
this.variableName = variableName;\r
}\r
\r
+ @Override\r
+ public String toString() {\r
+ return variableName.getName();\r
+ }\r
+\r
@Override\r
public Object visit(Visitor v, Object o) {\r
v.visitOutputParameter(this, o);\r
package user.jobengine.server.ast;\r
\r
/**\r
- * Paraméter abstract osztály.\r
+ * Param�ter abstract oszt�ly.\r
*/\r
public abstract class Parameter extends AST {\r
}\r
\r
import java.lang.annotation.Annotation;\r
import java.lang.reflect.Method;\r
+import java.lang.reflect.Type;\r
+import java.util.ArrayList;\r
import java.util.Arrays;\r
import java.util.List;\r
\r
logger.error("Invokation error in {}. Invoke parameters:\r\n{}", getClass().getSimpleName(), Arrays.toString(extendedInputs));\r
if (method.getParameterCount() != extendedInputs.length) {\r
logger.error("Expected parameter count: {}, invoke parameter count: {}", method.getGenericParameterTypes().length, extendedInputs.length);\r
+ } else {\r
+ List<String> currentTypes = new ArrayList<>();\r
+ for (Object input : extendedInputs) {\r
+ if (input == null)\r
+ currentTypes.add("null");\r
+ else\r
+ currentTypes.add(input.getClass().getCanonicalName());\r
+ }\r
+ int i = 0;\r
+ for (Type input : method.getGenericParameterTypes()) {\r
+ if (!input.getTypeName().equals(currentTypes.get(i))) {\r
+ logger.error("Expected parameter {}. is {} got {}", i, input.getTypeName(), currentTypes.get(i));\r
+ break;\r
+ }\r
+ i++;\r
+ }\r
+\r
}\r
}\r
\r
import com.ibm.nosql.json.api.BasicDBObject;\r
import com.ibm.nosql.json.util.JSON;\r
\r
+import user.commons.Job;\r
import user.commons.MediaCubeMarker;\r
import user.jobengine.db.IItemManager;\r
import user.jobengine.db.IResultSetConsumer;\r
private static final Logger logger = LogManager.getLogger();\r
\r
public MediaCubeService() {\r
- logger.info("Created");\r
+ //logger.info("Created");\r
}\r
\r
@GET\r
public Response jobStatus(@QueryParam("jobId") long jobId) {\r
Response result = null;\r
try {\r
- IItemManager itemManager = ComponentBinder.getItemManager();\r
- if (itemManager == null)\r
- throw new Exception("No ItemManager found");\r
- if (jobId == 0)\r
- throw new Exception("The 'jobId' parameter is not provided!");\r
- String status[] = { null };\r
- String sql = String.format("select status from JOB where id=%d", jobId);\r
- IResultSetConsumer consumer = rs -> {\r
- status[0] = rs.getString("status");\r
- return false;\r
- };\r
- itemManager.executeQuery(sql, consumer, null);\r
- result = Response.ok(status[0]).build();\r
+ IJobEngine jobEngine = ComponentBinder.getJobengine();\r
+ Job job = jobEngine.getJob(jobId);\r
+ BasicDBObject status = new BasicDBObject();\r
+ if (job != null) {\r
+ status.put("status", job.getStatus().toString());\r
+ status.put("progress", job.getProgress());\r
+ status.put("description", job.getDescription());\r
+ } else {\r
+\r
+ IItemManager itemManager = ComponentBinder.getItemManager();\r
+ if (itemManager == null)\r
+ throw new Exception("No ItemManager found");\r
+ if (jobId == 0)\r
+ throw new Exception("The 'jobId' parameter is not provided!");\r
+ String sql = String.format("select status, progress, description from JOB where id=%d", jobId);\r
+ IResultSetConsumer consumer = rs -> {\r
+ status.put("status", rs.getString("status"));\r
+ status.put("progress", rs.getInt("progress"));\r
+ status.put("description", rs.getString("description"));\r
+ return false;\r
+ };\r
+ itemManager.executeQuery(sql, consumer, null);\r
+ }\r
+\r
+ result = Response.ok(status).build();\r
} catch (Exception e) {\r
result = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();\r
}\r
\r
public void start() {\r
NexioDispatcher dispatcher = nexioAPI.getDispatcher();\r
- dispatcher.setNexioChangeListener(nexioServlet);\r
- dispatcher.startup();\r
+ if (dispatcher != null) {\r
+ dispatcher.setNexioChangeListener(nexioServlet);\r
+ dispatcher.startup();\r
+ }\r
\r
logger.info(MarkerManager.getMarker(MEDIACUBE), "A MediaCube server elindult.");\r
// Marker m = MarkerManager.getMarker("MEDIACUBE_DAILY");\r
<custom-attributes org.zkoss.zul.listbox.preloadSize="50" />\r
<custom-attributes org.zkoss.zul.listbox.selectOnHighlight.disabled="true" />\r
\r
- <div id="scdiv" width="100%" height="100%" viewModel="@id('jlm') @init('user.jobengine.zk.model.JobListModel')">\r
+ <div width="100%" height="100%" viewModel="@id('jlm') @init('user.jobengine.zk.model.JobListModel')" onClientInfo="@command('onClientInfo', event=event)">\r
<timer id="timer" delay="500" repeats="true" onTimer="@command('uiTick')" />\r
\r
<toolbar>\r
</div>\r
\r
</div>\r
-\r
</zk>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>\r
-<window id="resultWin" title="Folyamat futtatása" width="900px" border="normal" viewModel="@id('jlm') @init('user.jobengine.zk.model.JobSelectorModel')" forward="onCancel=closeButton.onClick">\r
- <borderlayout height="450px">\r
- <center border="none" flex="true">\r
- <listbox model="@load(jlm.jobs)" selectedItem="@bind(jlm.selectedJob)">\r
- <listhead>\r
- <listheader hflex="1" label="Név" align="left" />\r
- </listhead>\r
+<zk xmlns:ca="client/attribute">\r
+ <window id="resultWin" title="Folyamat futtatása" sizable="true" width="70%" height="70%" border="normal"\r
+ viewModel="@id('jlm') @init('user.jobengine.zk.model.JobSelectorModel')" forward="onCancel=closeButton.onClick">\r
+ <vlayout height="100%">\r
+ <borderlayout vflex="true">\r
+ <center border="none" vflex="true">\r
+ <listbox vflex="true" model="@load(jlm.jobs)" selectedItem="@bind(jlm.selectedJob)">\r
+ <listhead>\r
+ <listheader hflex="1" label="Név" align="left" />\r
+ </listhead>\r
\r
- <template name="model">\r
- <listitem onDoubleClick="@command('execute')">\r
- <listcell label="@load(empty each.name ? each.template : each.name)" />\r
- </listitem>\r
- </template>\r
- </listbox>\r
- </center>\r
- <east size="60%" flex="true" splittable="true" collapsible="true">\r
- <borderlayout>\r
- <north size="50%" splittable="true">\r
- <grid visible="@bind(not empty jlm.selectedJob)" sizedByContent="false" span="true" vflex="true"\r
- style="border: none; background: #e3e3e3 !important;" oddRowSclass="listbox-odd-style" sclass="listbox-normal-style"\r
- emptyMessage="A részletek megtekintéséhez jelöljön ki egy folyamatot.">\r
- <columns>\r
- <column hflex="min"></column>\r
- <column hflex="true"></column>\r
- </columns>\r
- <rows>\r
- <row>\r
- <label value="Name"></label>\r
- <label value="@bind(jlm.selectedJob.name)"></label>\r
- </row>\r
- <row>\r
- <label value="Template"></label>\r
- <label value="@bind(jlm.selectedJob.template)"></label>\r
- </row>\r
- <row>\r
- <label value="Active"></label>\r
- <label value="@bind(empty jlm.selectedJob.active ? false : jlm.selectedJob.active)"></label>\r
- </row>\r
- <row>\r
- <label value="Execute immediate"></label>\r
- <label value="@bind(empty jlm.selectedJob.executeimmediate ? false : jlm.selectedJob.executeimmediate)"></label>\r
- </row>\r
- <row>\r
- <label value="Cron expression"></label>\r
- <label value="@bind(jlm.selectedJob.cronexpression)"></label>\r
- </row>\r
- <row>\r
- <label value="Next execution"></label>\r
- <label value="@bind(jlm.selectedJob.nextTime)"></label>\r
- </row>\r
- </rows>\r
- </grid>\r
+ <template name="model">\r
+ <listitem onDoubleClick="@command('execute')">\r
+ <listcell label="@load(empty each.name ? each.template : each.name)" />\r
+ </listitem>\r
+ </template>\r
+ </listbox>\r
+ </center>\r
+ <east size="60%" flex="true" splittable="true" collapsible="true">\r
+ <tabbox id="pagesTab" vflex="true" hflex="true" orient="top">\r
+ <tabs visible="true">\r
+ <tab id="tab0" label="Paraméterek" selected="true" />\r
+ <tab id="tab1" label="Részletek" />\r
+ </tabs>\r
+ <tabpanels>\r
+ <tabpanel>\r
\r
- </north>\r
- <center border="none" flex="true">\r
- <grid model="@load(jlm.selectedJob.parameters)" style="border: none; background: #e3e3e3 !important;" oddRowSclass="listbox-odd-style"\r
- sclass="listbox-normal-style">\r
- <columns sizable="true">\r
- <column label="Name" hflex="1"></column>\r
- <column label="Value" hflex="3"></column>\r
- <column label="Type" hflex="1"></column>\r
- </columns>\r
- <rows>\r
- <template name="model">\r
- <row>\r
- <label value="@load(each.name)"></label>\r
- <label value="@load(each.value)"></label>\r
- <label value="@load(each.type)"></label>\r
- </row>\r
- </template>\r
- </rows>\r
- </grid>\r
+ <borderlayout>\r
+ <north size="50%" splittable="true">\r
+ <grid visible="@bind(not empty jlm.selectedJob)" sizedByContent="false" span="true" vflex="true"\r
+ style="border: none; background: #e3e3e3 !important;" oddRowSclass="listbox-odd-style" sclass="listbox-normal-style"\r
+ emptyMessage="A részletek megtekintéséhez jelöljön ki egy folyamatot.">\r
+ <columns>\r
+ <column hflex="min"></column>\r
+ <column hflex="true"></column>\r
+ </columns>\r
+ <rows>\r
+ <row>\r
+ <label value="Name"></label>\r
+ <label value="@bind(jlm.selectedJob.name)"></label>\r
+ </row>\r
+ <row>\r
+ <label value="Template"></label>\r
+ <label value="@bind(jlm.selectedJob.template)"></label>\r
+ </row>\r
+ <row>\r
+ <label value="Active"></label>\r
+ <label value="@bind(empty jlm.selectedJob.active ? false : jlm.selectedJob.active)"></label>\r
+ </row>\r
+ <row>\r
+ <label value="Execute immediate"></label>\r
+ <label value="@bind(empty jlm.selectedJob.executeimmediate ? false : jlm.selectedJob.executeimmediate)"></label>\r
+ </row>\r
+ <row>\r
+ <label value="Cron expression"></label>\r
+ <label value="@bind(jlm.selectedJob.cronexpression)"></label>\r
+ </row>\r
+ <row>\r
+ <label value="Next execution"></label>\r
+ <label value="@bind(jlm.selectedJob.nextTime)"></label>\r
+ </row>\r
+ </rows>\r
+ </grid>\r
\r
- </center>\r
- </borderlayout>\r
+ </north>\r
+ <center border="none" flex="true">\r
+ <grid model="@load(jlm.selectedJob.parameters)" style="border: none; background: #e3e3e3 !important;"\r
+ oddRowSclass="listbox-odd-style" sclass="listbox-normal-style">\r
+ <columns sizable="true">\r
+ <column label="Name" hflex="1"></column>\r
+ <column label="Value" hflex="3"></column>\r
+ <column label="Type" hflex="1"></column>\r
+ </columns>\r
+ <rows>\r
+ <template name="model">\r
+ <row>\r
+ <label value="@load(each.name)"></label>\r
+ <label value="@load(each.value)"></label>\r
+ <label value="@load(each.type)"></label>\r
+ </row>\r
+ </template>\r
+ </rows>\r
+ </grid>\r
+\r
+ </center>\r
+ </borderlayout>\r
\r
- </east>\r
- </borderlayout>\r
- \r
- <hbox width="100%" pack="center" align="center">\r
- <button id="reloadButton" label="Frissítés" onClick="@command('reload')" />\r
- <button id="closeButton" label="Mégsem" onClick="@command('close')" />\r
- <button id="executeButton" label="Futtatás" onClick="@command('execute')" />\r
- </hbox>\r
-</window>\r
+\r
+ </tabpanel>\r
+ <tabpanel>\r
+ <label height="100%" ca:data-syntax-highlight="true" multiline="true" pre="true" value="@bind(jlm.selectedJob['xml'])" />\r
+ </tabpanel>\r
+ </tabpanels>\r
+ </tabbox>\r
+\r
+ </east>\r
+ </borderlayout>\r
+ <div hflex="true" vflex="min" align="center">\r
+ <!-- <button id="reloadButton" label="Frissítés" onClick="@command('reload')" /> -->\r
+ <button id="closeButton" label="Mégsem" onClick="@command('close')" />\r
+ <button id="executeButton" label="Futtatás" onClick="@command('execute')" />\r
+ </div>\r
+ </vlayout>\r
+ \r
+ </window>\r
+</zk>\r
--- /dev/null
+<zk xmlns:w="client">\r
+<window id="metadataEditorWnd" title="Leírás szerkesztése" width="50%" height="50%" mode="overlapped" closable="true" maximizable="true" minimizable="false"\r
+ sizable="true" position="left,top" viewModel="@id('vm') @init('user.jobengine.zk.model.MetadataDetailsModel')" forward="onCancel=closeButton.onClick">\r
+\r
+<!-- <script type="text/javascript" src="/js/jquery.maskedinput.min.js" /> -->\r
+<!-- <script type="text/javascript"> -->\r
+\r
+<!-- $.mask.definitions['a']='[012]'; -->\r
+<!-- $.mask.definitions['b']='[0123]'; -->\r
+<!-- </script> -->\r
+ <vlayout height="100%">\r
+ <tabbox id="pagesTab" vflex="true" hflex="true" orient="top">\r
+ <tabs visible="true">\r
+ <tab id="tab0" label="Adatok" selected="true" />\r
+ <tab id="tab1" label="Média leírása" />\r
+ </tabs>\r
+ <tabpanels>\r
+ <tabpanel>\r
+ <listbox vflex="true" style="border: none; background: white !important;">\r
+ <listhead>\r
+ <listheader hflex="min" />\r
+ <listheader width="90%" />\r
+ </listhead>\r
+ <listitem id="item_houseid">\r
+ <listcell label="Gyűjtő azonosítója" />\r
+ <listcell label="@load(vm.archivedMedia.item.houseId)" />\r
+ </listitem>\r
+ <listitem id="item_title">\r
+ <listcell label="Gyűjtő címe" />\r
+ <listcell label="@load(vm.archivedMedia.item.title)" />\r
+ </listitem>\r
+ <listitem id="item_type">\r
+ <listcell label="Gyűjtő típusa" />\r
+ <listcell label="@load(vm.archivedMedia.item.itemType.name)" />\r
+ </listitem>\r
+ <listitem id="item_description">\r
+ <listcell label="Gyűjtő leírása" style="vertical-align: top;" />\r
+ <listcell label="@load(vm.archivedMedia.item.description)" />\r
+ </listitem>\r
+ <listitem id="media_houseid">\r
+ <listcell label="Média azonosítója" />\r
+ <listcell>\r
+ <textbox hflex="true" value="@load(vm.archivedMedia.media.houseId) @save(vm.archivedMedia.media.houseId,before='save')"></textbox>\r
+ </listcell>\r
+ </listitem>\r
+ <listitem id="media_creation">\r
+ <listcell label="Média dátuma" />\r
+ <listcell>\r
+ <datebox value="@load(vm.archivedMedia.media.creation) @save(vm.archivedMedia.media.creation,before='save')" />\r
+ </listcell>\r
+ </listitem>\r
+ <listitem id="media_length">\r
+ <listcell label="Média hossz" />\r
+ <listcell>\r
+<!-- <textbox value="@load(vm.archivedMedia.media.length) @save(vm.archivedMedia.media.length,before='save') @converter('user.jobengine.zk.model.TCConverter')" constraint="/^([0-1]\d|2[0-3]):([0-5]\d):([0-5]\d):([0-1]\d|2[0-4])$/: Timecode formátum kötelező (HH:MM:SS:FF)!" w:onBind="jq(this).mask('[0-2][0-3]:[0-5]9:[0-5]9:[0-2][0-4]');"/> -->\r
+ <longbox constraint="no empty, no negative" value="@load(vm.archivedMedia.media.length) @save(vm.archivedMedia.media.length,before='save')"/>\r
+ </listcell>\r
+ </listitem>\r
+ \r
+ <listitem id="media_title">\r
+ <listcell label="Média címe" />\r
+ <listcell>\r
+ <textbox hflex="true" value="@load(vm.archivedMedia.media.title) @save(vm.archivedMedia.media.title,before='save')" />\r
+ </listcell>\r
+ </listitem>\r
+ <listitem id="media_type">\r
+ <listcell label="Média típusa" />\r
+ <listcell>\r
+ <combobox id="mediatypes" hflex="true" model="@load(vm.itemTypes)"\r
+ selectedItem="@load(vm.archivedMedia.media.itemType)@save(vm.archivedMedia.media.itemType,before='save')">\r
+ <template name="model">\r
+ <comboitem label="${each.name}" value="${each}"></comboitem>\r
+ </template>\r
+ </combobox>\r
+ </listcell>\r
+ </listitem>\r
+ </listbox>\r
+ </tabpanel>\r
+ <tabpanel>\r
+ <textbox id="media_description_hidden" multiline="true" hflex="true" vflex="true"\r
+ value="@load(vm.archivedMedia.media.description) @save(vm.archivedMedia.media.description,before='save')" />\r
+ </tabpanel>\r
+ </tabpanels>\r
+ </tabbox>\r
+\r
+\r
+ <div hflex="true" vflex="min" align="center">\r
+ <button id="saveButton" label="Mentés" onClick="@command('save')" />\r
+ <button id="closeButton" label="Mégse" onClick="@command('close')" />\r
+ </div>\r
+ </vlayout>\r
+ <!-- \r
+ <h:script defer="true">\r
+ var text = document.getElementById("media_description"); \r
+ \r
+ function setDescription(val) {\r
+ text.value = val;\r
+ }\r
+ \r
+ // https://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize\r
+ var observe;\r
+ if (window.attachEvent) {\r
+ observe = function (element, event, handler) {\r
+ element.attachEvent('on'+event, handler);\r
+ };\r
+ }\r
+ else {\r
+ observe = function (element, event, handler) {\r
+ element.addEventListener(event, handler, false);\r
+ };\r
+ } \r
+ \r
+ \r
+ function resize() {\r
+ text.style.height = 'auto';\r
+ text.style.height = text.scrollHeight + 10 + 'px';\r
+ }\r
+ \r
+ function delayedResize() {\r
+ window.setTimeout(resize(), 0);\r
+ }\r
+ \r
+ \r
+ observe(text, 'change', delayedResize);\r
+ observe(text, 'cut', delayedResize);\r
+ observe(text, 'paste', delayedResize);\r
+ observe(text, 'drop', delayedResize);\r
+ observe(text, 'keydown', delayedResize);\r
+ \r
+ \r
+ \r
+ text.focus();\r
+ text.select();\r
+ resize();\r
+ \r
+ </h:script>\r
+ -->\r
+</window>\r
+</zk>
\ No newline at end of file
import java.util.Arrays;\r
import java.util.List;\r
\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
import org.zkoss.bind.BindUtils;\r
import org.zkoss.bind.annotation.Command;\r
\r
public class AsyncBaseModel extends BaseModel {\r
-\r
+ private static final Logger logger = LogManager.getLogger();\r
private List<UITask> uiTasks = new ArrayList<>();\r
\r
protected void doKeepAlive() {\r
\r
@Command\r
public void uiTick() {\r
+ //logger.info("{} tick {}", this.getClass().getSimpleName(), System.currentTimeMillis());\r
doKeepAlive();\r
synchronized (uiTasks) {\r
for (UITask task : uiTasks) {\r
import org.zkoss.bind.annotation.NotifyChange;\r
import org.zkoss.zk.ui.Component;\r
import org.zkoss.zk.ui.Executions;\r
+import org.zkoss.zk.ui.event.ClientInfoEvent;\r
import org.zkoss.zk.ui.event.Event;\r
import org.zkoss.zk.ui.event.EventListener;\r
import org.zkoss.zk.ui.select.Selectors;\r
import org.zkoss.zul.ListModelList;\r
import org.zkoss.zul.Listbox;\r
import org.zkoss.zul.Messagebox;\r
+import org.zkoss.zul.Timer;\r
import org.zkoss.zul.Window;\r
\r
import user.commons.IJob;\r
private String searchText;\r
private JobStatus searchStatus;\r
private List<JobStatus> searchStatuses;\r
+\r
// @Wire\r
// Charts chart;\r
@Wire\r
Listbox jobsListBox;\r
\r
+ @Wire\r
+ Timer timer;\r
+\r
//new LinkedBlockingQueue<IJobMessage>()\r
\r
public JobListModel() {\r
}\r
}\r
\r
+ @Command\r
+ public void onClientInfo(@BindingParam("event") ClientInfoEvent event) {\r
+ logger.info("{}", event.getDesktopWidth());\r
+ }\r
+\r
+ // private void updateJobsChart() {\r
+ // chart.getSeries().addPoint(new Point(Calendar.getInstance().getTimeInMillis(), jobList.size()), true, true, true);\r
+ // }\r
+\r
private void onJobCreated(IJobRuntime job) {\r
jobList.add(job);\r
notifyChange("jobList");\r
//updateJobsChart();\r
}\r
\r
+ // @Command\r
+ // public void restart() {\r
+ // startupDisabled = true;\r
+ // try {\r
+ // jobEngine.startup();\r
+ // } catch (Exception e) {\r
+ // }\r
+ // shutdownDisabled = false;\r
+ // initializeList();\r
+ // }\r
+\r
private void onJobDeleted(IJobRuntime job) {\r
// selectedJobs.remove(job);\r
// NotifyChange("selectedJobs");\r
//updateJobsChart();\r
}\r
\r
- // @Command\r
- // public void restart() {\r
- // startupDisabled = true;\r
- // try {\r
- // jobEngine.startup();\r
- // } catch (Exception e) {\r
- // }\r
- // shutdownDisabled = false;\r
- // initializeList();\r
- // }\r
-\r
private void onJobUpdated(IJobRuntime job) {\r
//List<IJobRuntime> savedSelectedJobs = new ArrayList<>(selectedJobs);\r
jobList.notifyChange(job);\r
initializeList();\r
}\r
\r
- // private void updateJobsChart() {\r
- // chart.getSeries().addPoint(new Point(Calendar.getInstance().getTimeInMillis(), jobList.size()), true, true, true);\r
- // }\r
-\r
}\r
import user.jobengine.server.scheduler.SchedulerService;\r
\r
public class JobSelectorModel extends BaseModel {\r
+ private static final String XML = "xml";\r
private static final String NEXT_TIME = "nextTime";\r
+ private static final String TEMPLATE = "template";\r
private static final Logger logger = LogManager.getLogger();\r
private static final String CRONEXPRESSION = "cronexpression";\r
@Wire("#resultWin")\r
if (selectedJob == null)\r
return;\r
\r
+ String template = selectedJob.getString(TEMPLATE);\r
+ String xml = jobEngine.getJobEngineConfiguration().loadTemplateXml(template);\r
+ selectedJob.put(XML, xml);\r
+\r
String cronExpression = selectedJob.getString(CRONEXPRESSION);\r
if (StringUtils.isBlank(cronExpression))\r
return;\r