From: Vásáry Dániel Date: Thu, 28 Sep 2017 14:03:09 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=5ec9544b4e990be2d9fcd98dbcfab9fc4a516738;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30483 --- diff --git a/server/-configuration/build-mediacube-modules.launch b/server/-configuration/build-mediacube-modules.launch index 92c41509..9224ace2 100644 --- a/server/-configuration/build-mediacube-modules.launch +++ b/server/-configuration/build-mediacube-modules.launch @@ -3,7 +3,7 @@ - + diff --git a/server/-configuration/dashboard-remote-debug.launch b/server/-configuration/dashboard-remote-debug.launch new file mode 100644 index 00000000..4baf1a2f --- /dev/null +++ b/server/-configuration/dashboard-remote-debug.launch @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/server/-configuration/debug-mediacube-remote.launch b/server/-configuration/debug-mediacube-remote.launch new file mode 100644 index 00000000..f534e3bf --- /dev/null +++ b/server/-configuration/debug-mediacube-remote.launch @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/server/-configuration/build-mediacube-product.launch b/server/-configuration/deploy-mediacube-modules.launch similarity index 89% rename from server/-configuration/build-mediacube-product.launch rename to server/-configuration/deploy-mediacube-modules.launch index 2b855886..0ea55e61 100644 --- a/server/-configuration/build-mediacube-product.launch +++ b/server/-configuration/deploy-mediacube-modules.launch @@ -1,7 +1,7 @@ - + @@ -15,5 +15,5 @@ - + diff --git a/server/-configuration/deploy-mediacube-product.launch b/server/-configuration/deploy-mediacube-product.launch deleted file mode 100644 index acea32c8..00000000 --- a/server/-configuration/deploy-mediacube-product.launch +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/server/-configuration/run-mediacube-server-bsh.launch b/server/-configuration/run-mediacube-server-bsh.launch index bcec7a0c..1dec536d 100644 --- a/server/-configuration/run-mediacube-server-bsh.launch +++ b/server/-configuration/run-mediacube-server-bsh.launch @@ -19,10 +19,10 @@ - + - + diff --git a/server/-configuration/run-mediacube-server-localhost.launch b/server/-configuration/run-mediacube-server-localhost.launch index 8053e4d0..f4c11208 100644 --- a/server/-configuration/run-mediacube-server-localhost.launch +++ b/server/-configuration/run-mediacube-server-localhost.launch @@ -19,7 +19,7 @@ - + diff --git a/server/-configuration/run-mediacube-server.launch b/server/-configuration/run-mediacube-server.launch index 2ba898e1..2b4ae63c 100644 --- a/server/-configuration/run-mediacube-server.launch +++ b/server/-configuration/run-mediacube-server.launch @@ -19,7 +19,7 @@ - + diff --git a/server/-modules/pom.xml b/server/-modules/pom.xml index 1e9380c9..fedf35ba 100644 --- a/server/-modules/pom.xml +++ b/server/-modules/pom.xml @@ -1,7 +1,6 @@ - + 4.0.0 user.jobengine MediaCube @@ -13,32 +12,28 @@ ../user.jobengine.osgi.db ../user.jobengine.osgi.server ../user.jobengine.osgi.services - ../user.commons.log4j2 + ../user.commons.log4j2 ../user.tsm.client ../-product + 1.0.0 1.0.0 UTF-8 - + scp://root:password@10.10.1.26 ssh-ed25519 256 ea:ab:67:70:79:63:2f:6a:34:81:48:e2:b9:dd:ca:d4 - ${project.build.directory} - /opt/mediacube/plugins - eclipse-neon http://download.eclipse.org/releases/neon - + p2 - + dependencies p2 @@ -65,7 +60,7 @@ - org.eclipse.tycho + org.eclipse.tycho tycho-maven-plugin ${tycho.version} true @@ -76,28 +71,26 @@ consider - - win32 - win32 - x86_64 - linux gtk x86_64 - + + + + + + + + + + + + + + + @@ -109,7 +102,7 @@ target-platform-configuration ${tycho.version} - + org.eclipse.m2e lifecycle-mapping @@ -167,6 +160,6 @@ - + diff --git a/server/-product/mediacube.product b/server/-product/mediacube.product index 67ff3587..c600e857 100644 --- a/server/-product/mediacube.product +++ b/server/-product/mediacube.product @@ -9,7 +9,9 @@ -consoleLog -console - #System + -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888 + +#System -Dorg.eclipse.equinox.http.jetty.http.port=8080 -Dorg.eclipse.epp.logging.aeri.skipReports=true -Declipse.ignoreApp=true @@ -19,46 +21,52 @@ -Dlog4j.configurationFile=./configuration/log4j2.xml -Djobengine.loglevel=INFO -Djobengine.jobsteps.root=./configuration/executors --Djobengine.jobtemplates.root=./configuration/templates +-Djobengine.jobtemplates.root=./configuration/jobtemplates -Djobengine.jobscheduling.config=./configuration/scheduledjobs.json - #Database --Djobengine.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true; --Djobengine.db.user=db2admin --Djobengine.db.password=password --Djobengine.nosql.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true; --Djobengine.nosql.db.user=db2admin --Djobengine.nosql.db.password=password --Djobengine.nosql.db.schema=test - -#Octopus --Djobengine.octopus.api.address=http://10.10.1.21/api/v1 --Djobengine.octopus.api.user=mam --Djobengine.octopus.api.password=napocska - -#Selenio --Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl --Djobengine.selenio.projectfilepath=\\10.10.1.71\Data\Blueprints\MP4_H264_AAC_v4.zenium + #Database +-Djobengine.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true; +-Djobengine.db.user=db2admin +-Djobengine.db.password=password +-Djobengine.nosql.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true; +-Djobengine.nosql.db.user=db2admin +-Djobengine.nosql.db.password=password +-Djobengine.nosql.db.schema=test + +#Octopus +-Djobengine.octopus.api.address=http://10.10.1.21/api/v1 +-Djobengine.octopus.api.user=mam +-Djobengine.octopus.api.password=napocska + +#Selenio +-Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl +-Djobengine.selenio.projectfilepath=\\10.10.1.71\Data\Blueprints\MP4_H264_AAC_v4.zenium + +#Nexio +-Dnexio.host=10.10.1.55 -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts - #Database --Djobengine.db.url=jdbc:db2://10.228.198.1:50000/mediaarc:retrieveMessagesFromServerOnGetMessage=true; --Djobengine.db.user=db2admin --Djobengine.db.password=password --Djobengine.nosql.db.url=jdbc:db2://10.228.198.1:50000/mccache:retrieveMessagesFromServerOnGetMessage=true; --Djobengine.nosql.db.user=db2admin --Djobengine.nosql.db.password=password --Djobengine.nosql.db.schema=test - -#Octopus --Djobengine.octopus.api.address=http://10.10.1.21/api/v1 --Djobengine.octopus.api.user=mam --Djobengine.octopus.api.password=napocska - -#Selenio --Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl --Djobengine.selenio.projectfilepath=\\10.10.1.71\Data\Blueprints\MP4_H264_AAC_v4.zenium + #Database +-Djobengine.db.url=jdbc:db2://10.228.198.1:50000/mediaarc:retrieveMessagesFromServerOnGetMessage=true; +-Djobengine.db.user=db2admin +-Djobengine.db.password=password +-Djobengine.nosql.db.url=jdbc:db2://10.228.198.1:50000/mccache:retrieveMessagesFromServerOnGetMessage=true; +-Djobengine.nosql.db.user=db2admin +-Djobengine.nosql.db.password=password +-Djobengine.nosql.db.schema=test + +#Octopus +-Djobengine.octopus.api.address=http://10.10.1.21/api/v1 +-Djobengine.octopus.api.user=mam +-Djobengine.octopus.api.password=napocska + +#Selenio +-Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl +-Djobengine.selenio.projectfilepath=\\10.10.1.71\Data\Blueprints\MP4_H264_AAC_v4.zenium + +#Nexio +-Dnexio.host=10.10.1.55 diff --git a/server/-product/pom.xml b/server/-product/pom.xml index eb5d55d3..bdb789e7 100644 --- a/server/-product/pom.xml +++ b/server/-product/pom.xml @@ -151,10 +151,10 @@ copy-resources - ${project.build.directory}/products/MediaCube/win32/win32/x86_64/configuration/templates + ${project.build.directory}/products/MediaCube/win32/win32/x86_64/configuration/jobtemplates - ${basedir}/../-configuration/jobtemplates + ${basedir}/../user.jobengine.executors/jobtemplates @@ -166,10 +166,10 @@ copy-resources - ${project.build.directory}/products/MediaCube/linux/gtk/x86_64/configuration/templates + ${project.build.directory}/products/MediaCube/linux/gtk/x86_64/configuration/jobtemplates - ${basedir}/../-configuration/jobtemplates + ${basedir}/../user.jobengine.executors/jobtemplates @@ -237,6 +237,7 @@ + ${project.build.directory}/products/MediaCube/linux/gtk/x86_64 /opt/mediacube diff --git a/server/user.jobengine.executors/deploy.xml b/server/user.jobengine.executors/deploy.xml deleted file mode 100644 index 1741cf6c..00000000 --- a/server/user.jobengine.executors/deploy.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/server/-configuration/jobtemplates/archive-item.xml b/server/user.jobengine.executors/jobtemplates/archive-item.xml similarity index 100% rename from server/-configuration/jobtemplates/archive-item.xml rename to server/user.jobengine.executors/jobtemplates/archive-item.xml diff --git a/server/-configuration/jobtemplates/archive-ondemand.xml b/server/user.jobengine.executors/jobtemplates/archive-ondemand.xml similarity index 100% rename from server/-configuration/jobtemplates/archive-ondemand.xml rename to server/user.jobengine.executors/jobtemplates/archive-ondemand.xml diff --git a/server/-configuration/jobtemplates/fake-concurrent.xml b/server/user.jobengine.executors/jobtemplates/fake-concurrent.xml similarity index 100% rename from server/-configuration/jobtemplates/fake-concurrent.xml rename to server/user.jobengine.executors/jobtemplates/fake-concurrent.xml diff --git a/server/-configuration/jobtemplates/fake.xml b/server/user.jobengine.executors/jobtemplates/fake.xml similarity index 100% rename from server/-configuration/jobtemplates/fake.xml rename to server/user.jobengine.executors/jobtemplates/fake.xml diff --git a/server/user.jobengine.executors/pom.xml b/server/user.jobengine.executors/pom.xml index 6624f7af..a957abcb 100644 --- a/server/user.jobengine.executors/pom.xml +++ b/server/user.jobengine.executors/pom.xml @@ -12,4 +12,47 @@ user.jobengine.executors eclipse-plugin 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveItemSubmitStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveItemSubmitStep.java index 83e58aa8..da19d1ef 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveItemSubmitStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveItemSubmitStep.java @@ -25,7 +25,7 @@ public class ArchiveItemSubmitStep extends JobStep { public Object[] execute(ArrayList archiveList, IJobEngine jobEngine, IJobRuntime jobRuntime) { try { for (ArchiveItem archiveItem : archiveList) { - String title = "Archiválás: " + archiveItem.getMediaFile(); + String title = "Archiválás: " + archiveItem.getMediaFile().toFile().getName(); try { jobEngine.submit(JOBTEMPLATE, title, ListUtils.asMap(ARCHIVE_ITEM, archiveItem)); } catch (Exception e) { diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveListBuilderStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveListBuilderStep.java index f47ab859..9278fe02 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveListBuilderStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/ArchiveListBuilderStep.java @@ -36,9 +36,9 @@ public class ArchiveListBuilderStep extends JobStep { private static final String CATCHEDEXT = ".catched"; public static final String ITEM_TITLE = "itemTitle"; - public static final String ITEM_HOUSEID = "itemHouseID"; + public static final String ITEM_HOUSEID = "itemHouseId"; public static final String ITEM_DESCRIPTION = "itemDescription"; - public static final String MEDIA_HOUSEID = "mediaHouseID"; + public static final String MEDIA_HOUSEID = "mediaHouseId"; public static final String MEDIA_TITLE = "mediaTitle"; public static final String MEDIA_DESCRIPTION = "mediaDescription"; @@ -51,12 +51,12 @@ public class ArchiveListBuilderStep extends JobStep { if (dbObject == null) throw new NullPointerException("Can not parse JSON file: " + jsonFilePath); result = new ArchiveItem(); - fillMetadata(result, dbObject, ITEM_HOUSEID); - fillMetadata(result, dbObject, ITEM_TITLE); - fillMetadata(result, dbObject, ITEM_DESCRIPTION); - fillMetadata(result, dbObject, MEDIA_HOUSEID); - fillMetadata(result, dbObject, MEDIA_TITLE); - fillMetadata(result, dbObject, MEDIA_DESCRIPTION); + result.setItemHouseId(getMetadata(dbObject, ITEM_HOUSEID)); + result.setItemTitle(getMetadata(dbObject, ITEM_TITLE)); + result.setItemDescription(getMetadata(dbObject, ITEM_DESCRIPTION)); + result.setMediaHouseId(getMetadata(dbObject, MEDIA_HOUSEID)); + result.setMediaTitle(getMetadata(dbObject, MEDIA_TITLE)); + result.setMediaDescription(getMetadata(dbObject, MEDIA_DESCRIPTION)); result.setMediaFile(mediaFilePath); result.setCatchedFile(catchedFilePath); @@ -95,9 +95,11 @@ public class ArchiveListBuilderStep extends JobStep { return new Object[] { archiveList }; } - private void fillMetadata(ArchiveItem archiveItem, BasicDBObject dbObject, String fieldName) { + private String getMetadata(BasicDBObject dbObject, String fieldName) { + String result = null; if (dbObject.containsKey(fieldName)) - archiveItem.setItemTitle(dbObject.getString(fieldName)); + result = dbObject.getString(fieldName); + return result; } private void processPathItem(Path mediaFilePath, final List archiveList) { @@ -108,14 +110,14 @@ public class ArchiveListBuilderStep extends JobStep { } Path dotStorePath = Paths.get(mediaFilePath.getParent().toString(), STOREFOLDER); - Path catchedFilePath = Paths.get(dotStorePath.toString(), mediaFile.getName(), CATCHEDEXT); + Path catchedFilePath = Paths.get(dotStorePath.toString(), mediaFile.getName() + CATCHEDEXT); File catchedFile = catchedFilePath.toFile(); if (catchedFile.exists()) { logger.warn("{} file is already catched.", mediaFile.getName()); return; } - Path jsonFilePath = Paths.get(dotStorePath.toString(), mediaFile.getName(), JSONEXT); + Path jsonFilePath = Paths.get(dotStorePath.toString(), mediaFile.getName() + JSONEXT); File jsonFile = jsonFilePath.toFile(); if (!jsonFile.exists()) { logger.warn("{} has no json metadata.", mediaFile.getName()); @@ -148,11 +150,7 @@ public class ArchiveListBuilderStep extends JobStep { logger.warn("{} has no Media Title specified in metadata.", mediaFile.getName()); return; } - storeArchiveItem(archiveList, archiveItem, mediaFile, catchedFile); - createCatchedFile(catchedFilePath); - } - - private void storeArchiveItem(final List archiveList, ArchiveItem archiveItem, File mediaFile, File catchedFile) { archiveList.add(archiveItem); + createCatchedFile(catchedFilePath); } } diff --git a/server/user.jobengine.osgi.commons/deploy.launch b/server/user.jobengine.osgi.commons/deploy.launch index 492a1866..0ffa54aa 100644 --- a/server/user.jobengine.osgi.commons/deploy.launch +++ b/server/user.jobengine.osgi.commons/deploy.launch @@ -3,7 +3,7 @@ - + diff --git a/server/user.jobengine.osgi.commons/src/user/commons/nexio/NexioClipEventDispatcher.java b/server/user.jobengine.osgi.commons/src/user/commons/nexio/NexioClipEventDispatcher.java index 2ae78ece..15dd700c 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/nexio/NexioClipEventDispatcher.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/nexio/NexioClipEventDispatcher.java @@ -1,25 +1,14 @@ package user.commons.nexio; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; import javax.swing.event.EventListenerList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.joda.time.DateTime; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; import com.ibm.nosql.json.api.BasicDBObject; import com.ibm.nosql.json.api.DB; @@ -32,31 +21,29 @@ import user.commons.nexio.api.ClipEvent; import user.commons.nexio.api.ClipEventListener; import user.commons.nexio.api.ClipEventType; import user.commons.nexio.api.Controller; -import user.commons.nexio.server.protocol.GetExtendedFieldCommand; import user.commons.nexio.server.protocol.Connection; +import user.commons.nexio.server.protocol.GetExtendedFieldCommand; import user.commons.nosql.NoSQLUtils; import user.commons.remotestore.IProgressEventListener; import user.commons.remotestore.ProgressEvent; /** - * NexioWSServlet hozza letre. - * Indulaskor betolti a teljes nexio clip listat mongodb-be. - * Beregisztralja magat ClipEventListener-nek. - * Az erkezo esemenyekkel updateli a mongo adatbazist (es a memoriat is) - * Az erkezo esemenyekrol eldonti, hogy add, update, vagy delete esemeny volt e - * Az uj, atalakitott esemenyt tovabbkuldi a feliratkozoknak (NexioWSServlet) + * NexioWSServlet hozza letre. Indulaskor betolti a teljes nexio clip listat mongodb-be. Beregisztralja magat ClipEventListener-nek. Az erkezo esemenyekkel + * updateli a mongo adatbazist (es a memoriat is) Az erkezo esemenyekrol eldonti, hogy add, update, vagy delete esemeny volt e Az uj, atalakitott esemenyt + * tovabbkuldi a feliratkozoknak (NexioWSServlet) + * * @author robi */ -public class NexioClipEventDispatcher implements ClipEventListener{ - +public class NexioClipEventDispatcher implements ClipEventListener { + private static final Logger logger = LogManager.getLogger(); - + private static final String ID = "id"; private static final String VIDEO_FORMAT = "videoformat"; private static final String VIDEO_BITRATE = "videobitrate"; private static final String FILESIZE = "filesize"; - + private static final String SQLSERVER_JDBC_SQL_SERVER_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; private static final String JOBENGINE_NEXIO_DB_PASSWORD = "jobengine.nexio.db.password"; private static final String JOBENGINE_NEXIO_DB_USER = "jobengine.nexio.db.user"; @@ -68,60 +55,96 @@ public class NexioClipEventDispatcher implements ClipEventListener{ private static final String RECORDDATE = "recorddate"; private static final String LONGNAMEID = "longnameid"; public static final String CLIP_COLLECTION_NAME = "nexioclips"; + static private final byte[] GET_SPECIAL_ID_ATTRIBUTES_REQ = { (byte) 0xC8, (byte) 0x84 }; + static private final char[] hexArray = "0123456789ABCDEF".toCharArray(); + + public static String bytesToHex(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for (int j = 0; j < bytes.length; j++) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = hexArray[v >>> 4]; + hexChars[j * 2 + 1] = hexArray[v & 0x0F]; + } + return new String(hexChars); + } + private EventListenerList progressListenerList; private ProgressEvent progressEvent = new ProgressEvent(this, 0); private INexioChangeListener nexioChangeListener; private DB db; - //R - private String NEXIO_HOST = System.getProperty("nexio.host"); //"10.228.43.18"; //echo: "10.10.1.55"; vmware: "10.228.43.18" - private Controller controller = null; - static private final byte[] GET_SPECIAL_ID_ATTRIBUTES_REQ = { (byte) 0xC8, (byte)0x84}; - + //BEGIN OF R - + + //R + private String NEXIO_HOST = System.getProperty("nexio.host"); //"10.228.43.18"; //echo: "10.10.1.55"; vmware: "10.228.43.18" + + private Controller controller = null; + //KONSTRUKTOR public NexioClipEventDispatcher() { - try{ + try { //nexio init this.controller = new Controller(NEXIO_HOST); this.controller.connect(); this.controller.getMediabase().getMediaListener().addClipEventListener(this); logger.info("NexioClipEventDispatcher nexio server is connected."); - + this.progressListenerList = new EventListenerList(); this.db = NoSQLUtils.getDB(); this.dropAllClipsFromMongo(); this.ensureIndexes(); - + //load clips into mongo - this.copyClipsIntoMongo(); - - }catch(Exception exc){ - logger.error("", exc); + + Thread importThread = new Thread(new Runnable() { + + @Override + public void run() { + try { + copyClipsIntoMongo(); + } catch (Exception e) { + logger.catching(e); + } + } + }); + + importThread.start(); + + } catch (Exception exc) { + logger.error("", exc); } } - - /** - * Nexio-bol kezdeti clip attoltes mongodb-be. - * @throws Exception - */ - private void copyClipsIntoMongo() throws Exception{ - Map emptyMap = new HashMap(); - Iterator clips = controller.getMediabase().getClips(); - while (clips.hasNext()) { - Clip clip = clips.next(); - BasicDBObject jsonClip = convertClipToJSON(clip); - this.saveClipIntoMongo(jsonClip, emptyMap); + + public void addProgressListener(IProgressEventListener listener) { + progressListenerList.add(IProgressEventListener.class, listener); + } + + @Override + public void clipEventPerformed(ClipEvent evt) { + try { + if (isValidClip(evt.getClip())) { + BasicDBObject jsClip = convertClipToJSON(evt.getClip()); + if (evt.getEventType() == ClipEventType.CLIP_ADDED) { + //cache??? + Map mongoClips = loadClipsFromMongo(); + saveClipIntoMongo(jsClip, mongoClips); + } else if (evt.getEventType() == ClipEventType.CLIP_DELETED) { + removeDeleted(jsClip); + } + } + } catch (Exception exc) { + logger.error("", exc); } } - - - private BasicDBObject convertClipToJSON(Clip clip) throws Exception{ + + //END OF R + + private BasicDBObject convertClipToJSON(Clip clip) throws Exception { BasicDBObject jsClip = new BasicDBObject(); - jsClip.put(ID, clip.getId().get()); //Unique internal ID - jsClip.put(LONGNAMEID, clip.getXid().get()); //Extended ID (Filename) + jsClip.put(ID, clip.getId().get()); //Unique internal ID + jsClip.put(LONGNAMEID, clip.getXid().get()); //Extended ID (Filename) jsClip.put(DURATION, clip.getDuration()); - jsClip.put(MODIFIEDTIMESTAMP, new DateTime(clip.getModifiedTimestamp().getTimeInMillis())); + jsClip.put(MODIFIEDTIMESTAMP, clip.getModifiedTimestamp().getTime()); jsClip.put(VIDEO_FORMAT, clip.getVideoFormat()); jsClip.put(VIDEO_BITRATE, clip.getVideoBitrate()); jsClip.put(FILESIZE, clip.getFileSize()); @@ -133,90 +156,77 @@ public class NexioClipEventDispatcher implements ClipEventListener{ return jsClip; } - - @Override - public void clipEventPerformed(ClipEvent evt){ - try{ - if(isValidClip(evt.getClip())){ - BasicDBObject jsClip = convertClipToJSON(evt.getClip()); - if(evt.getEventType() == ClipEventType.CLIP_ADDED){ - //cache??? - Map mongoClips = loadClipsFromMongo(); - saveClipIntoMongo(jsClip, mongoClips); - }else - if(evt.getEventType() == ClipEventType.CLIP_DELETED){ - removeDeleted(jsClip); - } - } - }catch(Exception exc){ - logger.error("", exc); + /** + * Nexio-bol kezdeti clip attoltes mongodb-be. + * + * @throws Exception + */ + private void copyClipsIntoMongo() throws Exception { + Map emptyMap = new HashMap(); + Iterator clips = controller.getMediabase().getClips(); + while (clips.hasNext()) { + Clip clip = clips.next(); + BasicDBObject jsonClip = convertClipToJSON(clip); + this.saveClipIntoMongo(jsonClip, emptyMap); } } - - /* + public void dropAllClipsFromMongo() { + db.getCollection(CLIP_COLLECTION_NAME).drop(); + } + + //create mongo index on longnameid + private void ensureIndexes() { + DBCollection collection = db.getCollection(CLIP_COLLECTION_NAME); + if (collection.count() == 0) + collection.ensureIndex(LONGNAMEID); + } + + /* Nem foglalkozunk a clippel ha: - C8 84 Get Special ID Attributes - REQ: C8 84 + 8-byte(ID), - RESP: D284 MASK(2 byte, unsigned int, MSB first) vagy D0 84 if no matching ID handle is found + C8 84 Get Special ID Attributes + REQ: C8 84 + 8-byte(ID), + RESP: D284 MASK(2 byte, unsigned int, MSB first) vagy D0 84 if no matching ID handle is found 0x0200 Not Ready to Play Indicates the first audio buffer of the media has not yet been written to disk. A controller should wait to load and play any clips with this attribute set. 0x0400 Not Ready to Transfer Indicates the ID is currently in record or being written to disk 0x0800 Not Ready to Archive Indicates the ID is currently in record or being written to disk - 0x1000 Transfer in Progress Indicates the ID is currently being transferred or imported into the system -*/ - private boolean isValidClip(Clip clip) throws Exception{ + 0x1000 Transfer in Progress Indicates the ID is currently being transferred or imported into the system + */ + private boolean isValidClip(Clip clip) throws Exception { boolean ret = false; - try{ + try { Connection connection = this.controller.getConnection(); connection.write(GET_SPECIAL_ID_ATTRIBUTES_REQ); connection.flush(); byte[] buffer = new byte[2]; connection.read(buffer, 0, 2); - if("D284".equals(bytesToHex(buffer))){ + if ("D284".equals(bytesToHex(buffer))) { buffer = new byte[2]; - int c= connection.read(buffer, 0, 2); - if(c == 2){ + int c = connection.read(buffer, 0, 2); + if (c == 2) { int mask = ((buffer[0] << 8) & 0xFF00) | (buffer[1] & 0x00FF); - if((mask & 0x1E00) == 0){ //0x0200 + 0x0400 + 0x0800 + 0x1000 + if ((mask & 0x1E00) == 0) { //0x0200 + 0x0400 + 0x0800 + 0x1000 ret = true; } - + } } - }catch(Exception exc){ + } catch (Exception exc) { logger.error("", exc); } - -/* - - int c = connection.read(buffer, 0, 2); - //2 bytes hosszan az idokozben hozzaadott id-k szamossaga - if (c < 2) { - throw new ProtocolException("c, 2, 2"); - } - //MSB, LSB - - return nofIds; - */ - return ret; - } - - //END OF R - - - //create mongo index on longnameid - private void ensureIndexes() { - DBCollection collection = db.getCollection(CLIP_COLLECTION_NAME); - if (collection.count() == 0) - collection.ensureIndex(LONGNAMEID); - } + /* - - private void removeDeleted(BasicDBObject clipToDelete){ - DBCollection collection = db.getCollection(NexioClipEventDispatcher.CLIP_COLLECTION_NAME); - collection.remove(clipToDelete); - onDelete(clipToDelete); + int c = connection.read(buffer, 0, 2); + //2 bytes hosszan az idokozben hozzaadott id-k szamossaga + if (c < 2) { + throw new ProtocolException("c, 2, 2"); + } + //MSB, LSB + + return nofIds; + */ + return ret; } private Map loadClipsFromMongo() { @@ -232,63 +242,36 @@ public class NexioClipEventDispatcher implements ClipEventListener{ return result; } - - private void saveClipIntoMongo(BasicDBObject clip, Map localClips) { - DBCollection collection = db.getCollection(CLIP_COLLECTION_NAME); - String name = clip.getString(LONGNAMEID); - BasicDBObject localClip = localClips.get(name); - if (localClip == null) { - collection.save(clip); - onCreate(clip); - } else { - clip.put("_id", localClip.get("_id")); - if (!clip.equals(localClip)) { - collection.save(clip); - onUpdate(clip); - } - } - } - - public void dropAllClipsFromMongo() { - db.getCollection(CLIP_COLLECTION_NAME).drop(); - } - - - - public void setNexioChangeListener(INexioChangeListener nexioChangeListener) { - this.nexioChangeListener = nexioChangeListener; - } - - //dispatch events to NexioWSServlet public void onCreate(BasicDBObject data) { logger.debug("onCreate clip: " + data); if (nexioChangeListener != null) nexioChangeListener.onCreate(data); } - + public void onDelete(BasicDBObject data) { logger.debug("onDelete clip: " + data); if (nexioChangeListener != null) nexioChangeListener.onDelete(data); } - + public void onUpdate(BasicDBObject data) { logger.debug("onUpdate clip: " + data); if (nexioChangeListener != null) nexioChangeListener.onUpdate(data); } - public void addProgressListener(IProgressEventListener listener) { - progressListenerList.add(IProgressEventListener.class, listener); + private void removeDeleted(BasicDBObject clipToDelete) { + DBCollection collection = db.getCollection(NexioClipEventDispatcher.CLIP_COLLECTION_NAME); + collection.remove(clipToDelete); + onDelete(clipToDelete); } public void removeProgressListener(IProgressEventListener listener) { progressListenerList.remove(IProgressEventListener.class, listener); } - - /* + /* BasicDBObject clip = new BasicDBObject(); clip.put(LONGNAMEID, rs.getString(i++)); clip.put(RECORDDATE, new DateTime(rs.getString(i++)).toDate()); @@ -302,18 +285,26 @@ public class NexioClipEventDispatcher implements ClipEventListener{ progressEvent.setProgress(progress); fireProgressEvent(progressEvent); } -*/ + */ - static private final char[] hexArray = "0123456789ABCDEF".toCharArray(); - public static String bytesToHex(byte[] bytes) { - char[] hexChars = new char[bytes.length * 2]; - for ( int j = 0; j < bytes.length; j++ ) { - int v = bytes[j] & 0xFF; - hexChars[j * 2] = hexArray[v >>> 4]; - hexChars[j * 2 + 1] = hexArray[v & 0x0F]; - } - return new String(hexChars); + private void saveClipIntoMongo(BasicDBObject clip, Map localClips) { + DBCollection collection = db.getCollection(CLIP_COLLECTION_NAME); + String name = clip.getString(LONGNAMEID); + BasicDBObject localClip = localClips.get(name); + if (localClip == null) { + collection.save(clip); + onCreate(clip); + } else { + clip.put("_id", localClip.get("_id")); + if (!clip.equals(localClip)) { + collection.save(clip); + onUpdate(clip); + } + } } - - + + public void setNexioChangeListener(INexioChangeListener nexioChangeListener) { + this.nexioChangeListener = nexioChangeListener; + } + } diff --git a/server/user.jobengine.osgi.server/deploy.launch b/server/user.jobengine.osgi.server/deploy.launch index 9e855386..21dbc544 100644 --- a/server/user.jobengine.osgi.server/deploy.launch +++ b/server/user.jobengine.osgi.server/deploy.launch @@ -1,9 +1,9 @@ - + - + diff --git a/server/user.jobengine.osgi.server/deploy/pom.xml b/server/user.jobengine.osgi.server/deploy/pom.xml new file mode 100644 index 00000000..9dba4032 --- /dev/null +++ b/server/user.jobengine.osgi.server/deploy/pom.xml @@ -0,0 +1,51 @@ + + + + ../-modules + user.jobengine + MediaCube + 1.0.0 + + 4.0.0 + user.jobengine.osgi.server + eclipse-plugin + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/server/user.jobengine.osgi.server/pom.xml b/server/user.jobengine.osgi.server/pom.xml index 966ab079..9dba4032 100644 --- a/server/user.jobengine.osgi.server/pom.xml +++ b/server/user.jobengine.osgi.server/pom.xml @@ -12,40 +12,40 @@ user.jobengine.osgi.server eclipse-plugin 1.0.0 - - - - org.codehaus.mojo - exec-maven-plugin - 1.5.0 - - - remote-deploy - deploy - - exec - - - ${project.build.directory} - winscp.com - - /command - "open ${remote.address} -hostkey=""${remote.hostkey}""" - "lcd ${local.location}" - "cd ${remote.location}" - "synchronize remote -filemask=*.jar|*/" - "exit" - - - - - - - - - scp://root:password@10.10.1.26 - ssh-ed25519 256 ea:ab:67:70:79:63:2f:6a:34:81:48:e2:b9:dd:ca:d4 - ${project.build.directory} - /opt/mediacube/plugins - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngine.java b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngine.java index c64544a7..033e7a4e 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngine.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngine.java @@ -161,8 +161,7 @@ public class JobEngine implements IJobEngine { private ArrayList jobChangedListenerList = new ArrayList(); /** - * A MAM motor példányosítása. Ennek során létrejönnek a várakozási sorok, - * az ütemező szál, az üzenet kezelő szál. + * A MAM motor példányosítása. Ennek során létrejönnek a várakozási sorok, az ütemező szál, az üzenet kezelő szál. */ public JobEngine() { runQueue = new PriorityBlockingQueue(); @@ -287,7 +286,6 @@ public class JobEngine implements IJobEngine { @Override public void executeCallConcurrentJobStepInstruction(IJobRuntime jobRuntime, IProgram subProgram) { JobRuntime c = new JobRuntime(this, jobRuntime, subProgram); - c.setName("Concurrent task"); jobRuntime.addChild(c); submit(c); } @@ -665,10 +663,9 @@ public class JobEngine implements IJobEngine { } /** - * Job prioritasa megvaltozott. Job main queue-ban es a JobStepExecutorok soraiban is - * ujra kell rendezni a jobokat. - * Az ujrarendezes a put-nal is megy automatikusan, mivel eltero prioritasu jobot dobhatnak be - * vagy default prioritasut a korabban atrendezett listaba. + * Job prioritasa megvaltozott. Job main queue-ban es a JobStepExecutorok soraiban is ujra kell rendezni a jobokat. Az ujrarendezes a put-nal is megy + * automatikusan, mivel eltero prioritasu jobot dobhatnak be vagy default prioritasut a korabban atrendezett listaba. + * * @param jobRuntime */ @Override diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobRuntime.java b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobRuntime.java index e59c4626..a5ffc301 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/server/JobRuntime.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/server/JobRuntime.java @@ -107,7 +107,7 @@ public class JobRuntime extends Job implements IJobRuntime { if (children == null) children = new ArrayList<>(); children.add(c); - Message m = logger.getMessageFactory().newMessage("Child {}. of {}-{}", children.size(), this.getId(), this.getName()); + Message m = logger.getMessageFactory().newMessage("Child {}. of {}", children.size(), this.getId()); c.setName(m.getFormattedMessage()); c.setParentJobId(this.getId()); } diff --git a/server/user.jobengine.osgi.services/pom.xml b/server/user.jobengine.osgi.services/pom.xml index 6bb47996..7c73ea01 100644 --- a/server/user.jobengine.osgi.services/pom.xml +++ b/server/user.jobengine.osgi.services/pom.xml @@ -12,34 +12,4 @@ user.jobengine.osgi.services eclipse-plugin 1.0.0 - - - - org.codehaus.mojo - exec-maven-plugin - 1.5.0 - - - remote-deploy - deploy - - exec - - - ${project.build.directory} - winscp.com - - /command - "open ${remote.address} -hostkey=""${remote.hostkey}""" - "lcd ${local.location}" - "cd ${remote.location}" - "synchronize remote -filemask=*.jar|*/" - "exit" - - - - - - - \ No newline at end of file