You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/03/14 16:52:28 UTC
svn commit: r1786925 [2/2] - in /openmeetings/application:
branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/
branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/
branches/3.2.x/o...
Copied: openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardCache.java (from r1786924, openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteBoardObjectListManagerById.java)
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardCache.java?p2=openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardCache.java&p1=openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteBoardObjectListManagerById.java&r1=1786924&r2=1786925&rev=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteBoardObjectListManagerById.java (original)
+++ openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardCache.java Tue Mar 14 16:52:27 2017
@@ -22,8 +22,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.openmeetings.db.dto.room.WhiteboardObject;
-import org.apache.openmeetings.db.dto.room.WhiteboardObjectList;
+import org.apache.openmeetings.db.dto.room.Whiteboard;
+import org.apache.openmeetings.db.dto.room.Whiteboards;
/**
* Memory based cache, configured as singleton in spring configuration
@@ -31,51 +31,56 @@ import org.apache.openmeetings.db.dto.ro
* @author sebawagner
*
*/
-public class WhiteBoardObjectListManagerById {
- private Map<Long, WhiteboardObjectList> whiteBoardObjectList = new ConcurrentHashMap<>();
+public class WhiteboardCache {
+ private Map<Long, Whiteboards> cache = new ConcurrentHashMap<>();
private volatile AtomicLong whiteboardId = new AtomicLong(0);
public long getNewWhiteboardId(Long roomId, String name) {
long wbId = whiteboardId.getAndIncrement();
- setWhiteBoardObjectListRoomObjAndWhiteboardId(roomId, new WhiteboardObject(name), wbId);
+ set(roomId, new Whiteboard(name), wbId);
return wbId;
}
/*
* Room items a Whiteboard
*/
- public WhiteboardObjectList getWhiteBoardObjectListByRoomId(Long roomId) {
- if (whiteBoardObjectList.containsKey(roomId)) {
- return whiteBoardObjectList.get(roomId);
+ public Whiteboards get(Long roomId) {
+ if (roomId == null) {
+ return null;
+ }
+ if (cache.containsKey(roomId)) {
+ return cache.get(roomId);
} else {
- WhiteboardObjectList whiteboardObjectList = new WhiteboardObjectList();
- whiteboardObjectList.setRoomId(roomId);
- return whiteboardObjectList;
+ Whiteboards whiteboards = new Whiteboards();
+ whiteboards.setRoomId(roomId);
+ set(roomId, whiteboards);
+ return whiteboards;
}
}
- public WhiteboardObject getWhiteBoardObjectListByRoomIdAndWhiteboard(Long roomId, Long whiteBoardId){
- WhiteboardObjectList whiteboardObjectList = getWhiteBoardObjectListByRoomId(roomId);
- WhiteboardObject whiteboardObjects = whiteboardObjectList.getWhiteboardObjects().get(whiteBoardId);
- if (whiteboardObjects == null) {
- whiteboardObjects = new WhiteboardObject();
+ public Whiteboard get(Long roomId, Long whiteBoardId) {
+ Whiteboards whiteboards = get(roomId);
+ Whiteboard wb = whiteboards.getWhiteboards().get(whiteBoardId);
+ if (wb == null) {
+ wb = new Whiteboard();
+ set(roomId, wb, whiteBoardId);
}
- return whiteboardObjects;
+ return wb;
}
/*
* Whiteboard Object List
*
*/
- public void setWhiteBoardObjectListRoomObj(Long roomId, WhiteboardObjectList whiteboardObjectList){
- whiteBoardObjectList.put(roomId, whiteboardObjectList);
+ public void set(Long roomId, Whiteboards whiteboards) {
+ cache.put(roomId, whiteboards);
}
- public void setWhiteBoardObjectListRoomObjAndWhiteboardId(Long roomId, WhiteboardObject whiteboardObjects, long whiteBoardId) {
- WhiteboardObjectList whiteboardObjectList = getWhiteBoardObjectListByRoomId(roomId);
- whiteboardObjects.setWhiteBoardId(whiteBoardId);
- whiteboardObjectList.getWhiteboardObjects().put(whiteBoardId, whiteboardObjects);
- whiteBoardObjectList.put(roomId, whiteboardObjectList);
+ public void set(Long roomId, Whiteboard wb, long whiteBoardId) {
+ Whiteboards whiteboards = get(roomId);
+ wb.setWhiteBoardId(whiteBoardId);
+ whiteboards.getWhiteboards().put(whiteBoardId, wb);
+ cache.put(roomId, whiteboards);
}
}
Modified: openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardManager.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardManager.java?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardManager.java (original)
+++ openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardManager.java Tue Mar 14 16:52:27 2017
@@ -24,21 +24,21 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import org.apache.openmeetings.db.dto.room.WhiteboardObject;
+import org.apache.openmeetings.db.dto.room.Whiteboard;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
public class WhiteboardManager {
private static final Logger log = Red5LoggerFactory.getLogger(WhiteboardManager.class, webAppRootKey);
-
+
@Autowired
- private WhiteBoardObjectListManagerById wbListManagerById;
+ private WhiteboardCache whitebardCache;
@SuppressWarnings("unchecked")
- public void addWhiteBoardObjectById(Long roomId, Map<Integer, Object> whiteboardObj, Long whiteBoardId) {
+ public void add(Long roomId, Map<Integer, Object> whiteboardObj, Long whiteBoardId) {
try {
- log.debug("addWhiteBoardObjectById: ", whiteboardObj);
+ log.debug("add: ", whiteboardObj);
String action = whiteboardObj.get(2).toString();
@@ -47,16 +47,11 @@ public class WhiteboardManager {
List<Object> actionObject = (List<Object>) whiteboardObj.get(3);
+ Whiteboard wb = whitebardCache.get(roomId, whiteBoardId);
if (action.equals("moveMap")) {
- WhiteboardObject whiteboardObject = wbListManagerById.getWhiteBoardObjectListByRoomIdAndWhiteboard(roomId, whiteBoardId);
-
- whiteboardObject.setX(Integer.valueOf(actionObject.get(1).toString()));
- whiteboardObject.setY(Integer.valueOf(actionObject.get(2).toString()));
-
- wbListManagerById.setWhiteBoardObjectListRoomObjAndWhiteboardId(roomId, whiteboardObject, whiteBoardId);
+ wb.setX(Integer.valueOf(actionObject.get(1).toString()));
+ wb.setY(Integer.valueOf(actionObject.get(2).toString()));
} else if (action.equals("draw") || action.equals("redo")) {
- WhiteboardObject whiteboardObject = wbListManagerById.getWhiteBoardObjectListByRoomIdAndWhiteboard(roomId, whiteBoardId);
-
// log.debug(actionObject);
// log.debug(actionObject.size()-1);
// log.debug(actionObject.get(actionObject.size()-1));
@@ -65,33 +60,26 @@ public class WhiteboardManager {
if (!objectType.equals("pointerWhiteBoard")) {
String objectOID = actionObject.get(actionObject.size() - 1).toString();
log.debug("objectOID: " + objectOID);
- whiteboardObject.add(objectOID, actionObject);
- wbListManagerById.setWhiteBoardObjectListRoomObjAndWhiteboardId(roomId, whiteboardObject, whiteBoardId);
+ wb.add(objectOID, actionObject);
}
}
} else if (action.equals("clear")) {
- WhiteboardObject whiteboardObject = wbListManagerById.getWhiteBoardObjectListByRoomIdAndWhiteboard(roomId, whiteBoardId);
- whiteboardObject.clear();
- wbListManagerById.setWhiteBoardObjectListRoomObjAndWhiteboardId(roomId, whiteboardObject, whiteBoardId);
+ wb.clear();
} else if (action.equals("delete") || action.equals("undo")) {
- WhiteboardObject whiteboardObject = wbListManagerById.getWhiteBoardObjectListByRoomIdAndWhiteboard(roomId, whiteBoardId);
- whiteboardObject.remove(actionObject);
-
- wbListManagerById.setWhiteBoardObjectListRoomObjAndWhiteboardId(roomId, whiteboardObject, whiteBoardId);
+ wb.remove(actionObject);
} else if (action.equals("size") || action.equals("editProp")
|| action.equals("editTextMindMapNode")
|| action.equals("editText") || action.equals("swf")
|| action.equals("flv")
|| action.equals("editTextMindMapColor")
|| action.equals("editTextMindMapFontColor")) {
- WhiteboardObject whiteboardObject = wbListManagerById.getWhiteBoardObjectListByRoomIdAndWhiteboard(roomId, whiteBoardId);
String objectOID = actionObject.get(actionObject.size() - 1).toString();
// List roomItem = roomList.get(objectOID);
- List<Object> currentObject = whiteboardObject.get(objectOID);
+ List<Object> currentObject = wb.get(objectOID);
if ("paint".equals(actionObject.get(0))) {
actionObject.set(1, currentObject.get(1));
}
- whiteboardObject.add(objectOID, actionObject);
+ wb.add(objectOID, actionObject);
if (action.equals("swf")) {
log.debug("actionObject " + actionObject);
@@ -102,7 +90,7 @@ public class WhiteboardManager {
log.debug("updateObjectsToSlideNumber :: " + baseObjectName + "," + slidesNumber);
- for (Entry<String, List<Object>> me : whiteboardObject.entrySet()) {
+ for (Entry<String, List<Object>> me : wb.entrySet()) {
List<Object> actionObjectStored = me.getValue();
if (actionObjectStored.get(0).equals("ellipse")
@@ -131,28 +119,18 @@ public class WhiteboardManager {
}
}
}
-
- wbListManagerById.setWhiteBoardObjectListRoomObjAndWhiteboardId(roomId, whiteboardObject, whiteBoardId);
} else if (action.equals("clearSlide")) {
- WhiteboardObject whiteboardObject = wbListManagerById.getWhiteBoardObjectListByRoomIdAndWhiteboard(roomId, whiteBoardId);
-
for (Object objectName : actionObject) {
- whiteboardObject.remove(objectName);
+ wb.remove(objectName);
}
-
- wbListManagerById.setWhiteBoardObjectListRoomObjAndWhiteboardId(roomId, whiteboardObject, whiteBoardId);
} else if (action.equals("whiteboardObj")) {
- WhiteboardObject whiteboardObject = wbListManagerById.getWhiteBoardObjectListByRoomIdAndWhiteboard(roomId, whiteBoardId);
-
- whiteboardObject.setFullFit((Boolean) actionObject.get(1));
- whiteboardObject.setZoom((Integer) actionObject.get(2));
-
- wbListManagerById.setWhiteBoardObjectListRoomObjAndWhiteboardId(roomId, whiteboardObject, whiteBoardId);
+ wb.setFullFit((Boolean) actionObject.get(1));
+ wb.setZoom((Integer) actionObject.get(2));
} else {
log.warn("Unkown Type: " + action + " actionObject: " + actionObject);
}
} catch (Exception err) {
- log.error("[addWhiteBoardObject]", err);
+ log.error("[add]", err);
}
}
}
Copied: openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardObjectSyncManager.java (from r1786924, openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteBoardObjectSyncManager.java)
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardObjectSyncManager.java?p2=openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardObjectSyncManager.java&p1=openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteBoardObjectSyncManager.java&r1=1786924&r2=1786925&rev=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteBoardObjectSyncManager.java (original)
+++ openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/whiteboard/WhiteboardObjectSyncManager.java Tue Mar 14 16:52:27 2017
@@ -33,11 +33,11 @@ import org.slf4j.Logger;
* @author sebawagner
*
*/
-public class WhiteBoardObjectSyncManager {
+public class WhiteboardObjectSyncManager {
private Map<Long, Map<String, WhiteboardSyncLockObject>> whiteBoardSyncList = new ConcurrentHashMap<>();
private Map<Long, Map<String, Map<String, WhiteboardSyncLockObject>>> whiteBoardObjectSyncList = new ConcurrentHashMap<>();
- private static final Logger log = Red5LoggerFactory.getLogger(WhiteBoardObjectSyncManager.class, webAppRootKey);
+ private static final Logger log = Red5LoggerFactory.getLogger(WhiteboardObjectSyncManager.class, webAppRootKey);
/*
* Initial Sync Process
Modified: openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java (original)
+++ openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java Tue Mar 14 16:52:27 2017
@@ -18,27 +18,22 @@
*/
package org.apache.openmeetings.core.remote;
-import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
-import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.io.FileUtils;
import org.apache.openmeetings.core.data.whiteboard.WhiteboardManager;
import org.apache.openmeetings.core.documents.LibraryChartLoader;
import org.apache.openmeetings.core.documents.LibraryDocumentConverter;
import org.apache.openmeetings.core.documents.LibraryWmlLoader;
-import org.apache.openmeetings.core.documents.LoadLibraryPresentation;
import org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter;
import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
import org.apache.openmeetings.db.dao.server.ISessionManager;
import org.apache.openmeetings.db.dao.server.SessiondataDao;
import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.dto.file.LibraryPresentation;
import org.apache.openmeetings.db.dto.server.ClientSessionInfo;
import org.apache.openmeetings.db.entity.file.FileExplorerItem;
import org.apache.openmeetings.db.entity.file.FileItem;
@@ -48,8 +43,6 @@ import org.apache.openmeetings.db.entity
import org.apache.openmeetings.db.util.AuthLevelUtil;
import org.apache.openmeetings.util.OmFileHelper;
import org.red5.logging.Red5LoggerFactory;
-import org.red5.server.api.IConnection;
-import org.red5.server.api.Red5;
import org.red5.server.api.service.IPendingServiceCall;
import org.red5.server.api.service.IPendingServiceCallback;
import org.slf4j.Logger;
@@ -72,35 +65,10 @@ public class ConferenceLibrary implement
@Autowired
private FileExplorerItemDao fileDao;
@Autowired
- private WhiteboardManager whiteboardManagement;
+ private WhiteboardManager whiteboardManager;
@Autowired
private ScopeApplicationAdapter scopeAdapter;
- public LibraryPresentation getPresentationPreviewFileExplorer(String sid, String parentFolder) {
- try {
- Sessiondata sd = sessionDao.check(sid);
-
- log.debug("#############users_id : " + sd.getUserId());
-
- if (AuthLevelUtil.hasUserLevel(userDao.getRights(sd.getUserId()))) {
- File working_dir = new File(OmFileHelper.getUploadFilesDir(), parentFolder);
- log.debug("############# working_dir : " + working_dir);
-
- File file = new File(working_dir, OmFileHelper.libraryFileName);
-
- if (!file.exists()) {
- throw new Exception(file.getCanonicalPath() + ": does not exist");
- }
- return LoadLibraryPresentation.parseLibraryFileToObject(file);
- } else {
- throw new Exception("not Authenticated");
- }
- } catch (Exception e) {
- log.error("[getListOfFilesByAbsolutePath]", e);
- return null;
- }
- }
-
/**
*
* Save an Object to the library and returns the file-explorer Id
@@ -165,7 +133,7 @@ public class ConferenceLibrary implement
wbClear.put(3, null);
Long roomId = client.getRoomId();
- whiteboardManagement.addWhiteBoardObjectById(roomId, wbClear, wbId);
+ whiteboardManager.add(roomId, wbClear, wbId);
for (int k = 0; k < roomItems.size(); k++) {
List<?> actionObject = (List<?>)roomItems.get(k);
@@ -174,7 +142,7 @@ public class ConferenceLibrary implement
whiteboardObj.put(2, "draw");
whiteboardObj.put(3, actionObject);
- whiteboardManagement.addWhiteBoardObjectById(roomId, whiteboardObj, wbId);
+ whiteboardManager.add(roomId, whiteboardObj, wbId);
}
Map<String, Object> sendObject = new HashMap<>();
@@ -206,40 +174,6 @@ public class ConferenceLibrary implement
return null;
}
- /**
- * @param sid
- * @param fileId
- * @return 1 in case of success, -1 otherwise
- */
- public Long copyFileToCurrentRoom(String sid, Long fileId) {
- try {
- Sessiondata sd = sessionDao.check(sid);
- if (AuthLevelUtil.hasUserLevel(userDao.getRights(sd.getUserId()))) {
- IConnection current = Red5.getConnectionLocal();
- String streamid = current.getClient().getId();
-
- Client client = sessionManager.getClientByStreamId(streamid, null);
- Long roomId = client.getRoomId();
-
- FileExplorerItem f = fileDao.get(fileId);
- if (roomId != null && f != null) {
- File mp4 = f.getFile(EXTENSION_MP4);
-
- File targetFolder = OmFileHelper.getStreamsSubDir(roomId);
-
- File target = new File(targetFolder, mp4.getName());
- if (mp4.exists() && !target.exists()) {
- FileUtils.copyFile(mp4, target, false);
- }
- return 1L;
- }
- }
- } catch (Exception err) {
- log.error("[copyFileToCurrentRoom] ", err);
- }
- return -1L;
- }
-
@Override
public void resultReceived(IPendingServiceCall arg0) {
// TODO Auto-generated method stub
Copied: openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/WhiteboardService.java (from r1786924, openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/WhiteBoardService.java)
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/WhiteboardService.java?p2=openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/WhiteboardService.java&p1=openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/WhiteBoardService.java&r1=1786924&r2=1786925&rev=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/WhiteBoardService.java (original)
+++ openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/WhiteboardService.java Tue Mar 14 16:52:27 2017
@@ -32,8 +32,8 @@ import java.util.LinkedList;
import java.util.Map;
import org.apache.commons.collections4.ComparatorUtils;
-import org.apache.openmeetings.core.data.whiteboard.WhiteBoardObjectListManagerById;
-import org.apache.openmeetings.core.data.whiteboard.WhiteBoardObjectSyncManager;
+import org.apache.openmeetings.core.data.whiteboard.WhiteboardCache;
+import org.apache.openmeetings.core.data.whiteboard.WhiteboardObjectSyncManager;
import org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter;
import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
import org.apache.openmeetings.db.dao.label.LabelDao;
@@ -41,9 +41,9 @@ import org.apache.openmeetings.db.dao.se
import org.apache.openmeetings.db.dao.server.SessiondataDao;
import org.apache.openmeetings.db.dao.user.UserDao;
import org.apache.openmeetings.db.dto.room.Cliparts;
-import org.apache.openmeetings.db.dto.room.WhiteboardObject;
-import org.apache.openmeetings.db.dto.room.WhiteboardObjectList;
+import org.apache.openmeetings.db.dto.room.Whiteboard;
import org.apache.openmeetings.db.dto.room.WhiteboardSyncLockObject;
+import org.apache.openmeetings.db.dto.room.Whiteboards;
import org.apache.openmeetings.db.entity.room.Client;
import org.apache.openmeetings.db.entity.server.Sessiondata;
import org.apache.openmeetings.db.entity.user.User;
@@ -63,8 +63,8 @@ import org.springframework.beans.factory
* @author sebastianwagner
*
*/
-public class WhiteBoardService implements IPendingServiceCallback {
- private static final Logger log = Red5LoggerFactory.getLogger(WhiteBoardService.class, webAppRootKey);
+public class WhiteboardService implements IPendingServiceCallback {
+ private static final Logger log = Red5LoggerFactory.getLogger(WhiteboardService.class, webAppRootKey);
@Autowired
private UserDao userDao;
@Autowired
@@ -72,9 +72,9 @@ public class WhiteBoardService implement
@Autowired
private ISessionManager sessionManager;
@Autowired
- private WhiteBoardObjectSyncManager wbListManager;
+ private WhiteboardObjectSyncManager wbListManager;
@Autowired
- private WhiteBoardObjectListManagerById wbListManagerById;
+ private WhiteboardCache wbCache;
@Autowired
private SessiondataDao sessionDao;
@Autowired
@@ -89,7 +89,7 @@ public class WhiteBoardService implement
Client currentClient = sessionManager.getClientByStreamId(streamid, null);
Long roomId = currentClient.getRoomId();
- Long whiteBoardId = wbListManagerById.getNewWhiteboardId(roomId, name);
+ Long whiteBoardId = wbCache.getNewWhiteboardId(roomId, name);
scopeAdapter.sendMessageAll(Arrays.asList("newWhiteboard", whiteBoardId, name));
} catch (Exception e) {
log.error("[getNewWhiteboardId]", e);
@@ -105,12 +105,12 @@ public class WhiteBoardService implement
Client currentClient = sessionManager.getClientByStreamId(streamid, null);
Long roomId = currentClient.getRoomId();
- WhiteboardObjectList whiteboardObjectList = wbListManagerById.getWhiteBoardObjectListByRoomId(roomId);
- Object returnValue = whiteboardObjectList.getWhiteboardObjects().remove(whiteBoardId);
+ Whiteboards whiteboards = wbCache.get(roomId);
+ Object returnValue = whiteboards.getWhiteboards().remove(whiteBoardId);
log.debug(" :: whiteBoardId :: " + whiteBoardId);
- wbListManagerById.setWhiteBoardObjectListRoomObj(roomId, whiteboardObjectList);
+ wbCache.set(roomId, whiteboards);
if (returnValue != null) {
return true;
@@ -121,8 +121,8 @@ public class WhiteBoardService implement
return false;
}
- public Map<Long, WhiteboardObject> getRoomItemsBy() {
- Map<Long, WhiteboardObject> result = new LinkedHashMap<>();
+ public Map<Long, Whiteboard> getRoomItemsBy() {
+ Map<Long, Whiteboard> result = new LinkedHashMap<>();
try {
IConnection current = Red5.getConnectionLocal();
String streamid = current.getClient().getId();
@@ -130,9 +130,9 @@ public class WhiteBoardService implement
Long roomId = currentClient.getRoomId();
log.debug("getRoomItems: " + roomId);
- WhiteboardObjectList whiteboardObjectList = wbListManagerById.getWhiteBoardObjectListByRoomId(roomId);
+ Whiteboards whiteboards = wbCache.get(roomId);
- if (whiteboardObjectList.getWhiteboardObjects().size() == 0) {
+ if (whiteboards.getWhiteboards().isEmpty()) {
Long langId = null;
{
Long userId = currentClient.getUserId();
@@ -142,12 +142,12 @@ public class WhiteBoardService implement
User u = userDao.get(userId);
langId = u == null ? cfgDao.getConfValue(CONFIG_DEFAULT_LANG_KEY, Long.class, "1") : u.getLanguageId();
}
- wbListManagerById.getNewWhiteboardId(roomId, labelDao.getString("615", langId));
+ wbCache.getNewWhiteboardId(roomId, labelDao.getString("615", langId));
log.debug("Init New Room List");
- whiteboardObjectList = wbListManagerById.getWhiteBoardObjectListByRoomId(roomId);
+ whiteboards = wbCache.get(roomId);
}
- whiteboardObjectList.getWhiteboardObjects().entrySet().stream()
- .sorted(Map.Entry.<Long, WhiteboardObject>comparingByKey().reversed())
+ whiteboards.getWhiteboards().entrySet().stream()
+ .sorted(Map.Entry.<Long, Whiteboard>comparingByKey().reversed())
.forEachOrdered(x -> result.put(x.getKey(), x.getValue()));
} catch (Exception err) {
log.error("[getRoomItemsBy]", err);
@@ -162,8 +162,8 @@ public class WhiteBoardService implement
Client currentClient = sessionManager.getClientByStreamId(streamid, null);
Long roomId = currentClient.getRoomId();
- WhiteboardObjectList whiteboardObjectList = wbListManagerById.getWhiteBoardObjectListByRoomId(roomId);
- WhiteboardObject wb = whiteboardObjectList.getWhiteboardObjects().get(wbId);
+ Whiteboards whiteboards = wbCache.get(roomId);
+ Whiteboard wb = whiteboards.getWhiteboards().get(wbId);
wb.setName(name);
log.debug(" :: rename whiteBoard :: id = {}, name = {}", wbId, name);
Modified: openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java (original)
+++ openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java Tue Mar 14 16:52:27 2017
@@ -18,9 +18,11 @@
*/
package org.apache.openmeetings.core.remote.red5;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import java.awt.Point;
+import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@@ -34,11 +36,13 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
+import org.apache.commons.io.FileUtils;
import org.apache.openmeetings.IApplication;
import org.apache.openmeetings.core.data.conference.RoomManager;
+import org.apache.openmeetings.core.data.whiteboard.WhiteboardCache;
import org.apache.openmeetings.core.data.whiteboard.WhiteboardManager;
import org.apache.openmeetings.core.remote.RecordingService;
-import org.apache.openmeetings.core.remote.WhiteBoardService;
+import org.apache.openmeetings.core.remote.WhiteboardService;
import org.apache.openmeetings.core.remote.util.SessionVariablesUtil;
import org.apache.openmeetings.core.util.WebSocketHelper;
import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
@@ -99,9 +103,11 @@ public class ScopeApplicationAdapter ext
@Autowired
private ISessionManager sessionManager;
@Autowired
- private WhiteBoardService whiteBoardService;
+ private WhiteboardService whiteBoardService;
@Autowired
- private WhiteboardManager whiteboardManagement;
+ private WhiteboardManager whiteboardManager;
+ @Autowired
+ private WhiteboardCache whiteboardCache;
@Autowired
private RecordingService recordingService;
@Autowired
@@ -1160,7 +1166,6 @@ public class ScopeApplicationAdapter ext
}
private static List<?> getWbObject(FileItem fi, String url) {
- String fuid = UUID.randomUUID().toString();
Point size = getSize(fi);
String type = "n/a";
switch (fi.getType()) {
@@ -1190,7 +1195,7 @@ public class ScopeApplicationAdapter ext
, size.x // initwidth //14
, size.y // initheight //15
, 100 // currentzoom //16 FIXME TODO
- , fuid // uniquObjectSyncName //17
+ , fi.getHash() // uniquObjectSyncName //17
, fi.getName() // standardFileName //18
, true // fullFit //19 FIXME TODO
, 0 // zIndex //-8
@@ -1200,18 +1205,17 @@ public class ScopeApplicationAdapter ext
, 0 // posy //-4
, size.x // width //-3
, size.y // height //-2
- , fuid // this.currentlayer.name //-1
+ , fi.getHash() // this.currentlayer.name //-1
);
}
- private static List<?> getFlvWbObject(FileItem fi) {
- String fuid = UUID.randomUUID().toString();
+ private static List<?> getMp4WbObject(FileItem fi, String url) {
Point size = getSize(fi);
return Arrays.asList(
"flv" // 0: 'flv'
, fi.getId() // 1: 7
, fi.getName() // 2: 'BigBuckBunny_512kb.mp4'
- , false // 3: false //playRemote
+ , url // 3: posterUrl
, size.x // 4: 416
, size.y // 5: 240
, 0 // 6: 1 // z-index
@@ -1221,10 +1225,27 @@ public class ScopeApplicationAdapter ext
, 0 // 10: 0 //TODO // y
, size.x // 11: 749 // width
, size.y // 12: 739 // height
- , fuid // 13: 'flv_1469602000351'
+ , fi.getHash() // 13: 'flv_1469602000351'
);
}
+ private static void copyFileToRoom(Long roomId, FileItem f) {
+ try {
+ if (roomId != null && f != null) {
+ File mp4 = f.getFile(EXTENSION_MP4);
+
+ File targetFolder = OmFileHelper.getStreamsSubDir(roomId);
+
+ File target = new File(targetFolder, mp4.getName());
+ if (mp4.exists() && !target.exists()) {
+ FileUtils.copyFile(mp4, target, false);
+ }
+ }
+ } catch (Exception err) {
+ log.error("[copyFileToCurrentRoom] ", err);
+ }
+ }
+
public void sendToWhiteboard(String uid, Long wbId, FileItem fi, String url, boolean clean) {
ClientSessionInfo csi = sessionManager.getClientByPublicSIDAnyServer(uid);
if (csi == null) {
@@ -1242,7 +1263,9 @@ public class ScopeApplicationAdapter ext
wbObject = getWbObject(fi, url);
break;
case Video:
- wbObject = getFlvWbObject(fi);
+ case Recording:
+ wbObject = getMp4WbObject(fi, url);
+ copyFileToRoom(client.getRoomId(), fi);
break;
default:
}
@@ -1251,6 +1274,7 @@ public class ScopeApplicationAdapter ext
wbClear.put("id", wbId);
wbClear.put("param", Arrays.asList("whiteboard", new Date(), "clear", null));
+ whiteboardCache.get(client.getRoomId(), wbId).clear();
sendToScope(client.getRoomId(), "sendVarsToWhiteboardById", Arrays.asList(null, wbClear));
}
sendToWhiteboard(client, Arrays.asList("whiteboard", new Date(), "draw", wbObject), wbId);
@@ -1300,10 +1324,10 @@ public class ScopeApplicationAdapter ext
whiteboardTempObj.put(3, tempActionObject);
- whiteboardManagement.addWhiteBoardObjectById(roomId, whiteboardTempObj, wbId);
+ whiteboardManager.add(roomId, whiteboardTempObj, wbId);
}
} else {
- whiteboardManagement.addWhiteBoardObjectById(roomId, whiteboardObj, wbId);
+ whiteboardManager.add(roomId, whiteboardObj, wbId);
}
Map<String, Object> sendObject = new HashMap<>();
Copied: openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java (from r1786924, openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/WhiteboardObject.java)
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java?p2=openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java&p1=openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/WhiteboardObject.java&r1=1786924&r2=1786925&rev=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/WhiteboardObject.java (original)
+++ openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java Tue Mar 14 16:52:27 2017
@@ -30,8 +30,8 @@ import java.util.concurrent.ConcurrentHa
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
-public class WhiteboardObject {
- private static final Logger log = Red5LoggerFactory.getLogger(WhiteboardObject.class, webAppRootKey);
+public class Whiteboard {
+ private static final Logger log = Red5LoggerFactory.getLogger(Whiteboard.class, webAppRootKey);
private long whiteBoardId;
private Integer x = 0;
private Integer y = 0;
@@ -42,9 +42,9 @@ public class WhiteboardObject {
private int zIndex = 1;
private String name;
- public WhiteboardObject() {}
+ public Whiteboard() {}
- public WhiteboardObject(String name) {
+ public Whiteboard(String name) {
this.name = name;
}
Copied: openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboards.java (from r1786924, openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/WhiteboardObjectList.java)
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboards.java?p2=openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboards.java&p1=openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/WhiteboardObjectList.java&r1=1786924&r2=1786925&rev=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/WhiteboardObjectList.java (original)
+++ openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboards.java Tue Mar 14 16:52:27 2017
@@ -19,13 +19,15 @@
package org.apache.openmeetings.db.dto.room;
import java.util.Map;
+import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
-public class WhiteboardObjectList {
+public class Whiteboards {
private Long roomId;
- private Map<Long, WhiteboardObject> whiteboardObjects = new ConcurrentHashMap<>();
+ private final String uid = UUID.randomUUID().toString();
+ private Map<Long, Whiteboard> whiteboards = new ConcurrentHashMap<>();
- public WhiteboardObjectList() {}
+ public Whiteboards() {}
public Long getRoomId() {
return roomId;
@@ -35,11 +37,15 @@ public class WhiteboardObjectList {
this.roomId = roomId;
}
- public Map<Long, WhiteboardObject> getWhiteboardObjects() {
- return whiteboardObjects;
+ public Map<Long, Whiteboard> getWhiteboards() {
+ return whiteboards;
}
- public void setWhiteboardObjects(Map<Long, WhiteboardObject> whiteboardObjects) {
- this.whiteboardObjects = whiteboardObjects;
+ public void setWhiteboards(Map<Long, Whiteboard> whiteboards) {
+ this.whiteboards = whiteboards;
+ }
+
+ public String getUid() {
+ return uid;
}
}
Modified: openmeetings/application/trunk/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/CleanupJob.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/CleanupJob.java?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/CleanupJob.java (original)
+++ openmeetings/application/trunk/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/CleanupJob.java Tue Mar 14 16:52:27 2017
@@ -29,11 +29,11 @@ import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.math.NumberUtils;
-import org.apache.openmeetings.core.data.whiteboard.WhiteBoardObjectListManagerById;
+import org.apache.openmeetings.core.data.whiteboard.WhiteboardCache;
import org.apache.openmeetings.core.session.SessionManager;
import org.apache.openmeetings.db.dao.server.SessiondataDao;
-import org.apache.openmeetings.db.dto.room.WhiteboardObject;
-import org.apache.openmeetings.db.dto.room.WhiteboardObjectList;
+import org.apache.openmeetings.db.dto.room.Whiteboard;
+import org.apache.openmeetings.db.dto.room.Whiteboards;
import org.apache.openmeetings.util.InitializationContainer;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
@@ -50,7 +50,7 @@ public class CleanupJob extends Abstract
@Autowired
private SessionManager sessionManager;
@Autowired
- private WhiteBoardObjectListManagerById wbManager;
+ private WhiteboardCache wbManager;
public long getSessionTimeout() {
return sessionTimeout;
@@ -122,8 +122,8 @@ public class CleanupJob extends Abstract
Long roomId = null;
if (NumberUtils.isCreatable(folder.getName())) {
roomId = Long.valueOf(folder.getName());
- WhiteboardObjectList wbList = wbManager.getWhiteBoardObjectListByRoomId(roomId);
- for (Map.Entry<Long, WhiteboardObject> e : wbList.getWhiteboardObjects().entrySet()) {
+ Whiteboards wbList = wbManager.get(roomId);
+ for (Map.Entry<Long, Whiteboard> e : wbList.getWhiteboards().entrySet()) {
if (!e.getValue().getRoomItems().isEmpty()) {
roomId = null;
break;
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LangPanel.html
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LangPanel.html?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LangPanel.html (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/labels/LangPanel.html Tue Mar 14 16:52:27 2017
@@ -27,7 +27,6 @@
, autoOpen: false
, resizable: false
});
- ADMIN_TABLE_SHIIFT = 172;
};
</script>
</wicket:head>
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java Tue Mar 14 16:52:27 2017
@@ -644,10 +644,25 @@ public class RoomPanel extends BasePanel
public void sendFileToWb(FileItem fi, boolean clean) {
if (activeWbId > -1 && fi.getId() != null && FileItem.Type.Folder != fi.getType()) {
- if (fi.getType() == FileItem.Type.WmlFile) {
+ if (FileItem.Type.WmlFile == fi.getType()) {
getBean(ConferenceLibrary.class).sendToWhiteboard(getClient().getUid(), activeWbId, fi);
} else {
- String url = urlFor(new RoomResourceReference(), new PageParameters().add("id", fi.getId())).toString();
+ String url = null;
+ PageParameters pp = new PageParameters();
+ pp.add("id", fi.getId())
+ .add("ruid", getBean(WhiteboardCache.class).get(r.getId()).getUid());
+ switch (fi.getType()) {
+ case Video:
+ pp.add("preview", true);
+ url = urlFor(new RoomResourceReference(), pp).toString();
+ break;
+ case Recording:
+ url = urlFor(new JpgRecordingResourceReference(), pp).toString();
+ break;
+ default:
+ url = urlFor(new RoomResourceReference(), pp).toString();
+ break;
+ }
getBean(ScopeApplicationAdapter.class).sendToWhiteboard(getClient().getUid(), activeWbId, fi, url, clean);
}
}
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java Tue Mar 14 16:52:27 2017
@@ -27,8 +27,13 @@ import static org.apache.openmeetings.we
import static org.apache.openmeetings.web.app.Application.getOnlineClient;
import java.io.File;
+import java.util.Map.Entry;
+import org.apache.directory.api.util.Strings;
+import org.apache.openmeetings.core.data.whiteboard.WhiteboardCache;
import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
+import org.apache.openmeetings.db.dto.room.Whiteboard;
+import org.apache.openmeetings.db.dto.room.Whiteboards;
import org.apache.openmeetings.db.entity.basic.Client;
import org.apache.openmeetings.db.entity.file.FileExplorerItem;
import org.apache.openmeetings.db.entity.file.FileItem;
@@ -93,10 +98,16 @@ public class RoomResourceReference exten
return null;
}
FileExplorerItem f = getBean(FileExplorerItemDao.class).get(id);
- // impossible to check file permission based on client, file can be dropped on WB
- // and should be accessible to whole room
- //FIXME TODO ADDITIONALLY CHECK Rights !! and room !!
- return f;
+ String ruid = params.get("ruid").toString();
+ Whiteboards wbs = getBean(WhiteboardCache.class).get(c.getRoomId());
+ if (!Strings.isEmpty(ruid) && ruid.equals(wbs.getUid())) {
+ for (Entry<Long, Whiteboard> e : wbs.getWhiteboards().entrySet()) {
+ if (e.getValue().getRoomItems().containsKey(f.getHash())) {
+ return f; // item IS on WB
+ }
+ }
+ }
+ return null;
}
protected File getFile(FileExplorerItem f, String ext) {
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/UploadDialog.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/UploadDialog.java?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/UploadDialog.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/UploadDialog.java Tue Mar 14 16:52:27 2017
@@ -181,6 +181,7 @@ public class UploadDialog extends Abstra
protected void onSubmit(AjaxRequestTarget target) {
List<FileUpload> ful = uploadField.getFileUploads();
if (ful != null) {
+ boolean clean = cleanWb.getModelObject();
for (FileUpload fu : ful) {
FileExplorerItem f = new FileExplorerItem();
f.setSize(fu.getSize());
@@ -208,7 +209,8 @@ public class UploadDialog extends Abstra
form.error(getString("convert.errors.file"));
} else {
if (toWb.getModelObject()) {
- room.sendFileToWb(f, cleanWb.getModelObject());
+ room.sendFileToWb(f, clean);
+ clean = false;
}
}
} catch (Exception e) {
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/RecordingResourceReference.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/RecordingResourceReference.java?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/RecordingResourceReference.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/RecordingResourceReference.java Tue Mar 14 16:52:27 2017
@@ -20,14 +20,22 @@ package org.apache.openmeetings.web.user
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import static org.apache.openmeetings.web.app.Application.getBean;
+import static org.apache.openmeetings.web.app.Application.getOnlineClient;
import static org.apache.openmeetings.web.app.WebSession.getExternalType;
import static org.apache.openmeetings.web.app.WebSession.getRecordingId;
import static org.apache.openmeetings.web.app.WebSession.getUserId;
import static org.red5.logging.Red5LoggerFactory.getLogger;
+import java.util.Map.Entry;
+
+import org.apache.directory.api.util.Strings;
+import org.apache.openmeetings.core.data.whiteboard.WhiteboardCache;
import org.apache.openmeetings.db.dao.record.RecordingDao;
import org.apache.openmeetings.db.dao.user.GroupUserDao;
import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.dto.room.Whiteboard;
+import org.apache.openmeetings.db.dto.room.Whiteboards;
+import org.apache.openmeetings.db.entity.basic.Client;
import org.apache.openmeetings.db.entity.file.FileItem.Type;
import org.apache.openmeetings.db.entity.record.Recording;
import org.apache.openmeetings.db.entity.user.User;
@@ -50,13 +58,15 @@ public abstract class RecordingResourceR
public String getMimeType(Recording r) {
return getMimeType();
}
-
+
public abstract String getMimeType();
-
+
@Override
protected Recording getFileItem(Attributes attributes) {
PageParameters params = attributes.getParameters();
StringValue _id = params.get("id");
+ String ruid = params.get("ruid").toString();
+ String uid = params.get("uid").toString();
Long id = null;
try {
id = _id.toOptionalLong();
@@ -68,12 +78,12 @@ public abstract class RecordingResourceR
id = getRecordingId();
}
if (id != null && ws.isSignedIn()) {
- return getRecording(id);
+ return getRecording(id, ruid, uid);
}
return null;
}
-
- private static Recording getRecording(Long id) {
+
+ private static Recording getRecording(Long id, String ruid, String uid) {
log.debug("Recording with id {} is requested", id);
Recording r = getBean(RecordingDao.class).get(id);
if (r == null || r.getType() == Type.Folder || r.isDeleted()) {
@@ -82,6 +92,17 @@ public abstract class RecordingResourceR
if (id.equals(getRecordingId())) {
return r;
}
+ Client c = getOnlineClient(uid);
+ if (c != null) {
+ Whiteboards wbs = getBean(WhiteboardCache.class).get(c.getRoomId());
+ if (wbs != null && !Strings.isEmpty(ruid) && ruid.equals(wbs.getUid())) {
+ for (Entry<Long, Whiteboard> e : wbs.getWhiteboards().entrySet()) {
+ if (e.getValue().getRoomItems().containsKey(r.getHash())) {
+ return r; // item IS on WB
+ }
+ }
+ }
+ }
//TODO should we check parentId here
if (r.getOwnerId() == null && r.getGroupId() == null) {
//public
Modified: openmeetings/application/trunk/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml Tue Mar 14 16:52:27 2017
@@ -64,9 +64,9 @@
<!-- Database cache -->
<bean id="openmeetings.DatabaseStore" class="org.apache.openmeetings.core.session.store.DatabaseStore" />
- <bean id="whiteBoardObjectListManagerById" scope="singleton" class="org.apache.openmeetings.core.data.whiteboard.WhiteBoardObjectListManagerById" />
- <!-- WhiteBoardObjectSyncManager can stay in the memory, even on cluster! -->
- <bean id="whiteBoardObjectSyncManager" scope="singleton" class="org.apache.openmeetings.core.data.whiteboard.WhiteBoardObjectSyncManager" />
+ <bean id="whiteboardCache" scope="singleton" class="org.apache.openmeetings.core.data.whiteboard.WhiteboardCache" />
+ <!-- WhiteboardObjectSyncManager can stay in the memory, even on cluster! -->
+ <bean id="whiteboardObjectSyncManager" scope="singleton" class="org.apache.openmeetings.core.data.whiteboard.WhiteboardObjectSyncManager" />
<!-- Cluster related config start -->
<bean id="openmeetings.ServerUtil" scope="singleton" class="org.apache.openmeetings.core.session.ServerUtil">
@@ -77,7 +77,7 @@
<!-- Start of Services -->
<bean id="xmlcrm.service" class="org.apache.openmeetings.core.remote.MainService" />
- <bean id="whiteboardservice.service" class="org.apache.openmeetings.core.remote.WhiteBoardService" />
+ <bean id="whiteboardservice.service" class="org.apache.openmeetings.core.remote.WhiteboardService" />
<bean id="userservice.service" class="org.apache.openmeetings.core.remote.UserService" />
<bean id="fileservice.service" class="org.apache.openmeetings.core.remote.ConferenceLibrary" />
<bean id="openmeetings.FileProcessor" class="org.apache.openmeetings.core.data.file.FileProcessor" />
@@ -209,7 +209,7 @@
<bean id="generateSWF" class="org.apache.openmeetings.core.converter.GenerateSWF" />
<bean id="ldapLoginManagement" class="org.apache.openmeetings.core.ldap.LdapLoginManagement" />
<bean id="timezoneUtil" class="org.apache.openmeetings.db.util.TimezoneUtil" />
- <bean id="whiteboardManagement" class="org.apache.openmeetings.core.data.whiteboard.WhiteboardManager" />
+ <bean id="whiteboardManager" class="org.apache.openmeetings.core.data.whiteboard.WhiteboardManager" />
<bean id="backupExport" class="org.apache.openmeetings.backup.BackupExport" />
<bean id="backupImport" class="org.apache.openmeetings.backup.BackupImport" />
<bean id="appointmentManager" class="org.apache.openmeetings.service.calendar.caldav.AppointmentManager" destroy-method="destroy"/>
Modified: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java?rev=1786925&r1=1786924&r2=1786925&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java (original)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java Tue Mar 14 16:52:27 2017
@@ -21,7 +21,6 @@ package org.apache.openmeetings.webservi
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import static org.apache.openmeetings.webservice.Constants.TNS;
-import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -43,7 +42,6 @@ import javax.ws.rs.core.MediaType;
import org.apache.cxf.feature.Features;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.apache.openmeetings.core.data.file.FileProcessor;
-import org.apache.openmeetings.core.documents.LoadLibraryPresentation;
import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
import org.apache.openmeetings.db.dao.server.SessiondataDao;
import org.apache.openmeetings.db.dao.user.UserDao;
@@ -51,12 +49,10 @@ import org.apache.openmeetings.db.dto.ba
import org.apache.openmeetings.db.dto.basic.ServiceResult.Type;
import org.apache.openmeetings.db.dto.file.FileExplorerItemDTO;
import org.apache.openmeetings.db.dto.file.FileExplorerObject;
-import org.apache.openmeetings.db.dto.file.LibraryPresentation;
import org.apache.openmeetings.db.entity.file.FileExplorerItem;
import org.apache.openmeetings.db.entity.server.Sessiondata;
import org.apache.openmeetings.db.entity.user.User.Right;
import org.apache.openmeetings.db.util.AuthLevelUtil;
-import org.apache.openmeetings.util.OmFileHelper;
import org.apache.openmeetings.util.process.ConverterProcessResultList;
import org.apache.openmeetings.webservice.error.ServiceException;
import org.red5.logging.Red5LoggerFactory;
@@ -216,44 +212,6 @@ public class FileWebService {
}
}
- /**
- * Get a LibraryPresentation-Object for a certain file
- *
- * @param sid
- * The SID of the User. This SID must be marked as logged in
- * @param parentFolder
- *
- * @return - LibraryPresentation-Object for a certain file
- * @throws ServiceException
- */
- public LibraryPresentation getPresentationPreviewFileExplorer(String sid, String parentFolder)
- throws ServiceException {
-
- try {
- Sessiondata sd = sessionDao.check(sid);
- if (AuthLevelUtil.hasWebServiceLevel(userDao.getRights(sd.getUserId()))) {
-
- File working_dir = new File(OmFileHelper.getUploadProfilesDir(), parentFolder);
- log.debug("############# working_dir : " + working_dir);
-
- File file = new File(working_dir, OmFileHelper.libraryFileName);
-
- if (!file.exists()) {
- throw new ServiceException(file.getCanonicalPath() + ": does not exist ");
- }
-
- return LoadLibraryPresentation.parseLibraryFileToObject(file);
- } else {
- throw new ServiceException("not Authenticated");
- }
- } catch (ServiceException e) {
- throw e;
- } catch (Exception e) {
- log.error("[getListOfFilesByAbsolutePath]", e);
- return null;
- }
- }
-
/**
* Get a File Explorer Object by a given Room
*