Author: sebawagner
Date: Fri Jan 18 01:19:59 2013
New Revision: 1435001
URL: http://svn.apache.org/viewvc?rev=1435001&view=rev
Log:
OPENMEETINGS-460 Remove methods and objects that are not needed for cluster mode
Added:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/SlaveHTTPConnectionManager.java
- copied, changed from r1433278,
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/quartz/scheduler/ClusterSlaveJob.java
Removed:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/sync/IRestClientObserver.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/conference/room/ISharedSessionStore.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/conference/room/SlaveClientDto.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/quartz/scheduler/ClusterSlaveJob.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/test/cluster/
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/WEB-INF/openmeetings-applicationContext.xml
incubator/openmeetings/trunk/singlewebapp/docs/RoomService.html
incubator/openmeetings/trunk/singlewebapp/docs/ServerService.html
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/RoomWebService.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/RoomWebServiceFacade.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/ServerWebService.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/ServerWebServiceFacade.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/sync/RestClient.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/conference/room/ClientListHashMapStore.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/ServerDao.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/UserService.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/WEB-INF/openmeetings-applicationContext.xml
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/WEB-INF/openmeetings-applicationContext.xml?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/WEB-INF/openmeetings-applicationContext.xml
(original)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/WEB-INF/openmeetings-applicationContext.xml
Fri Jan 18 01:19:59 2013
@@ -94,36 +94,9 @@
class="org.apache.openmeetings.data.flvrecord.converter.FlvInterviewConverter"
/>
<bean id="openmeetings.FlvRecorderConverter"
class="org.apache.openmeetings.data.flvrecord.converter.FlvRecorderConverter" />
+ <bean id="openmeetings.SlaveHTTPConnectionManager"
+
class="org.apache.openmeetings.cluster.SlaveHTTPConnectionManager" />
- <!--
- #####################################################################
- Comment this in to enable the OpenMeetings instance to act as Master
- #####################################################################
- -->
-
- <bean id="openmeetings.ClusterSlaveJob"
class="org.apache.openmeetings.quartz.scheduler.ClusterSlaveJob" />
- <bean id="clusterSlaveJob"
-
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
- <property name="targetObject">
- <ref bean="openmeetings.ClusterSlaveJob" />
- </property>
- <property name="targetMethod">
- <value>doIt</value>
- </property>
- <property name="concurrent" value="false" />
- </bean>
- <bean id="triggerClusterSlaveJob"
class="org.springframework.scheduling.quartz.SimpleTriggerBean">
- <property name="jobDetail">
- <ref bean="clusterSlaveJob" />
- </property>
- <property name="startDelay">
- <value>5000</value>
- </property>
- <property name="repeatInterval">
- <value>3000</value>
- </property>
- </bean>
-
<bean id="openmeetings.SessionClearJob"
class="org.apache.openmeetings.quartz.scheduler.SessionClearJob" />
<bean id="sessionClearJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
@@ -204,7 +177,6 @@
<ref local="triggerSessionClear" />
<ref local="triggerMeetingReminder" />
<ref local="triggerTestSetupCleanup" />
- <ref local="triggerClusterSlaveJob" />
</list>
</property>
</bean>
Modified: incubator/openmeetings/trunk/singlewebapp/docs/RoomService.html
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/docs/RoomService.html?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/docs/RoomService.html (original)
+++ incubator/openmeetings/trunk/singlewebapp/docs/RoomService.html Fri Jan 18
01:19:59 2013
@@ -239,10 +239,6 @@ limitations under the License.
<a
href="#modifyRoomParameter"><b>modifyRoomParameter</b></a><br/>
<div class="navigation_comment"><i >Method to update arbitrary
room parameter.</i></div>
</div>
- <div>
- <a
href="#syncUploadCompleteMessage"><b>syncUploadCompleteMessage</b></a><br/>
- <div class="navigation_comment"><i >This method is used in
cluster mode to send the sync event from the master to the slave</i></div>
- </div>
</div>
<h3>Methods Details in RoomService</h3>
@@ -5148,168 +5144,6 @@ limitations under the License.
REST Sample Call/URL:<br/>
<a
href="http://localhost:5080/openmeetings/services/RoomService/modifyRoomParameter?SID=VALUE&room_id=VALUE¶mName=VALUE¶mValue=VALUE">http://localhost:5080/openmeetings/services/RoomService/modifyRoomParameter?SID=VALUE&room_id=VALUE&paramName=VALUE&paramValue=VALUE</a>
</div>
- <div
class="method">
- <div class="method_header">
- <div style="margin-left:10px">
- <a name="syncUploadCompleteMessage"
><b>syncUploadCompleteMessage</b></a>
- </div>
- </div>
-
- Method: <i>syncUploadCompleteMessage (
-
String SID
-
,
- String publicSID
-
,
- Long userId
-
,
- String message
-
,
- String action
-
,
- String error
-
,
- boolean hasError
-
,
- String fileName
-
,
- String fileSystemName
-
,
- boolean isPresentation
-
,
- boolean isImage
-
,
- boolean isVideo
-
,
- String fileHash
- )
- </i><br/>
- <p>
- This method is used in cluster mode to send the sync
event from the master to the slave
- </p>
- <p>
- Return Type: boolean
- </p>
- <p>Params:</p>
-
- <table rules="all"
border="1">
- <thead>
- <tr>
- <th width="200" align="left">Type</th>
- <th width="200" align="left">Fieldname</th>
- <th width="400"
align="left">Description</th>
- </tr>
- </thead>
- <tbody>
-
<tr>
- <td valign="top">
- String
- </td>
- <td valign="top">SID</td>
- <td valign="top">The SID of the User. This SID
must be marked as logged'in</td>
- </tr>
-
-
<tr>
- <td valign="top">
- String
- </td>
- <td valign="top">publicSID</td>
- <td valign="top">The publicSID that will receive
the message</td>
- </tr>
-
-
<tr>
- <td valign="top">
- Long
- </td>
- <td valign="top">userId</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
<tr>
- <td valign="top">
- String
- </td>
- <td valign="top">message</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
<tr>
- <td valign="top">
- String
- </td>
- <td valign="top">action</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
<tr>
- <td valign="top">
- String
- </td>
- <td valign="top">error</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
<tr>
- <td valign="top">
- boolean
- </td>
- <td valign="top">hasError</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
<tr>
- <td valign="top">
- String
- </td>
- <td valign="top">fileName</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
<tr>
- <td valign="top">
- String
- </td>
- <td valign="top">fileSystemName</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
<tr>
- <td valign="top">
- boolean
- </td>
- <td valign="top">isPresentation</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
<tr>
- <td valign="top">
- boolean
- </td>
- <td valign="top">isImage</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
<tr>
- <td valign="top">
- boolean
- </td>
- <td valign="top">isVideo</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
<tr>
- <td valign="top">
- String
- </td>
- <td valign="top">fileHash</td>
- <td valign="top">part of sync message of document
upload</td>
- </tr>
-
-
</tbody>
- </table>
- <br/>
- REST Sample Call/URL:<br/>
-
<a
href="http://localhost:5080/openmeetings/services/RoomService/syncUploadCompleteMessage?SID=VALUE&publicSID=VALUE&userId=VALUE&message=VALUE&action=VALUE&error=VALUE&hasError=VALUE&fileName=VALUE&fileSystemName=VALUE&isPresentation=VALUE&isImage=VALUE&isVideo=VALUE&fileHash=VALUE">http://localhost:5080/openmeetings/services/RoomService/syncUploadCompleteMessage?SID=VALUE&publicSID=VALUE&userId=VALUE&message=VALUE&action=VALUE&error=VALUE&hasError=VALUE&fileName=VALUE&fileSystemName=VALUE&isPresentation=VALUE&isImage=VALUE&isVideo=VALUE&fileHash=VALUE</a>
- </div>
</body>
Modified: incubator/openmeetings/trunk/singlewebapp/docs/ServerService.html
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/docs/ServerService.html?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/docs/ServerService.html (original)
+++ incubator/openmeetings/trunk/singlewebapp/docs/ServerService.html Fri Jan
18 01:19:59 2013
@@ -64,14 +64,6 @@ limitations under the License.
<a href="#deleteServer"><b>deleteServer</b></a><br/>
<div class="navigation_comment"><i >Method to delete
server</i></div>
</div>
- <div>
- <a href="#ping"><b>ping</b></a><br/>
- <div class="navigation_comment"><i >Load a ping from the
slave, see <a
- href="http://incubator.apache.org/openmeetings/ClusteringManual.html"
- target
- ="_BLANK">http://incubator.apache.org/openmeetings/ClusteringManual.
- html</a></i></div>
- </div>
</div>
<h3>Methods Details in ServerService</h3>
@@ -375,53 +367,6 @@ limitations under the License.
REST Sample Call/URL:<br/>
<a
href="http://localhost:5080/openmeetings/services/ServerService/deleteServer?SID=VALUE&id=VALUE">http://localhost:5080/openmeetings/services/ServerService/deleteServer?SID=VALUE&id=VALUE</a>
</div>
- <div
class="method">
- <div class="method_header">
- <div style="margin-left:10px">
- <a name="ping" ><b>ping</b></a>
- </div>
- </div>
-
- Method: <i>ping (
-
String SID
- )
- </i><br/>
- <p>
- Load a ping from the slave, see <a
- href="http://incubator.apache.org/openmeetings/ClusteringManual.html"
- target
- ="_BLANK">http://incubator.apache.org/openmeetings/ClusteringManual.
- html</a>
- </p>
- <p>
- Return Type: java.util.List
- </p>
- <p>Params:</p>
-
- <table rules="all"
border="1">
- <thead>
- <tr>
- <th width="200" align="left">Type</th>
- <th width="200" align="left">Fieldname</th>
- <th width="400"
align="left">Description</th>
- </tr>
- </thead>
- <tbody>
-
<tr>
- <td valign="top">
- String
- </td>
- <td valign="top">SID</td>
- <td valign="top">- session id to identify the user
making request, WebService
- Level required</td>
- </tr>
-
-
</tbody>
- </table>
- <br/>
- REST Sample Call/URL:<br/>
-
<a
href="http://localhost:5080/openmeetings/services/ServerService/ping?SID=VALUE">http://localhost:5080/openmeetings/services/ServerService/ping?SID=VALUE</a>
- </div>
</body>
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/RoomWebService.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/RoomWebService.java?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/RoomWebService.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/RoomWebService.java
Fri Jan 18 01:19:59 2013
@@ -41,7 +41,6 @@ import org.apache.openmeetings.data.conf
import org.apache.openmeetings.data.conference.Roommanagement;
import org.apache.openmeetings.data.flvrecord.FlvRecordingDao;
import org.apache.openmeetings.data.user.Usermanagement;
-import org.apache.openmeetings.documents.beans.UploadCompleteMessage;
import org.apache.openmeetings.persistence.beans.calendar.Appointment;
import org.apache.openmeetings.persistence.beans.flvrecord.FlvRecording;
import org.apache.openmeetings.persistence.beans.invitation.Invitations;
@@ -2506,50 +2505,4 @@ public class RoomWebService {
}
}
- /**
- * This method is used in cluster mode to send the sync event from the
master to the slave
- *
- * @param SID The SID of the User. This SID must be marked as logged'in
- * @param publicSID The publicSID that will receive the message
- * @param userId part of sync message of document upload
- * @param message part of sync message of document upload
- * @param action part of sync message of document upload
- * @param error part of sync message of document upload
- * @param hasError part of sync message of document upload
- * @param fileName part of sync message of document upload
- * @param fileSystemName part of sync message of document upload
- * @param isPresentation part of sync message of document upload
- * @param isImage part of sync message of document upload
- * @param isVideo part of sync message of document upload
- * @param fileHash part of sync message of document upload
- * @return true in case there were no errors, false otherwise
- * @throws AxisFault if any error occurred
- */
- public boolean syncUploadCompleteMessage(String SID, String publicSID,
- Long userId, String message, String action, String
error,
- boolean hasError, String fileName, String
fileSystemName,
- boolean isPresentation, boolean isImage, boolean
isVideo,
- String fileHash) throws AxisFault {
-
- try {
- Long users_id = sessionManagement.checkSession(SID);
- Long user_level =
userManagement.getUserLevelByID(users_id);
- if
(authLevelManagement.checkWebServiceLevel(user_level)) {
-
-
scopeApplicationAdapter.sendMessageWithClientByPublicSID(
- new
UploadCompleteMessage(userId, message, action,
- error,
hasError, fileName, fileSystemName,
- isPresentation,
isImage, isVideo, fileHash),
- publicSID);
-
- return true;
- }
- } catch (Exception err) {
- log.error("[syncUploadCompleteMessage] ", err);
-
- throw new AxisFault(err.getMessage());
- }
- return false;
- }
-
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/RoomWebServiceFacade.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/RoomWebServiceFacade.java?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/RoomWebServiceFacade.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/RoomWebServiceFacade.java
Fri Jan 18 01:19:59 2013
@@ -676,14 +676,4 @@ public class RoomWebServiceFacade {
paramName, paramValue);
}
- public boolean syncUploadCompleteMessage(String SID, String publicSID,
- Long userId, String message, String action, String
error,
- boolean hasError, String fileName, String
fileSystemName,
- boolean isPresentation, boolean isImage, boolean
isVideo,
- String fileHash) throws AxisFault {
- return getRoomServiceProxy().syncUploadCompleteMessage(SID,
publicSID,
- userId, message, action, error, hasError,
fileName,
- fileSystemName, isPresentation, isImage,
isVideo, fileHash);
- }
-
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/ServerWebService.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/ServerWebService.java?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/ServerWebService.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/ServerWebService.java
Fri Jan 18 01:19:59 2013
@@ -18,12 +18,8 @@
*/
package org.apache.openmeetings.axis.services;
-import java.util.List;
-
import org.apache.axis2.AxisFault;
import org.apache.openmeetings.OpenmeetingsVariables;
-import org.apache.openmeetings.conference.room.ISharedSessionStore;
-import org.apache.openmeetings.conference.room.SlaveClientDto;
import org.apache.openmeetings.data.basic.AuthLevelmanagement;
import org.apache.openmeetings.data.basic.Sessionmanagement;
import org.apache.openmeetings.data.basic.dao.ServerDao;
@@ -53,8 +49,6 @@ public class ServerWebService {
private AuthLevelmanagement authLevelManagement;
@Autowired
private ServerDao serversDao;
- @Autowired
- private ISharedSessionStore clientListManager;
/**
* Method to retrieve the list of the servers participating in cluster
@@ -182,33 +176,4 @@ public class ServerWebService {
return false;
}
- /**
- * Load a ping from the slave, see <a
- * href="http://incubator.apache.org/openmeetings/ClusteringManual.html"
- * target
- * ="_BLANK">http://incubator.apache.org/openmeetings/ClusteringManual.
- * html</a>
- *
- * @param SID
- * - session id to identify the user making request,
WebService
- * Level required
- * @return List of
- * @throws AxisFault
- */
- public List<SlaveClientDto> ping(String SID)
- throws AxisFault {
- Long users_id = sessionManagement.checkSession(SID);
- Long user_level = userManagement.getUserLevelByID(users_id);
-
- if (authLevelManagement.checkWebServiceLevel(user_level)) {
-
- //sync the sessions to the masters session store
- return clientListManager.getCurrentSlaveSessions();
-
- } else {
- log.warn("Insuffisient permissions");
- throw new AxisFault("Insuffisient permissions");
- }
- }
-
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/ServerWebServiceFacade.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/ServerWebServiceFacade.java?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/ServerWebServiceFacade.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/axis/services/ServerWebServiceFacade.java
Fri Jan 18 01:19:59 2013
@@ -18,15 +18,12 @@
*/
package org.apache.openmeetings.axis.services;
-import java.util.List;
-
import javax.servlet.ServletContext;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.openmeetings.OpenmeetingsVariables;
-import org.apache.openmeetings.conference.room.SlaveClientDto;
import org.apache.openmeetings.persistence.beans.basic.Server;
import org.apache.openmeetings.remote.red5.ScopeApplicationAdapter;
import org.red5.logging.Red5LoggerFactory;
@@ -93,12 +90,4 @@ public class ServerWebServiceFacade {
return getServerServiceProxy().deleteServer(SID, id);
}
- /**
- * Proxy method please see {@link ServerWebService#ping(String)}
- */
- public List<SlaveClientDto> ping(String SID)
- throws AxisFault {
- return getServerServiceProxy().ping(SID);
- }
-
}
Copied:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/SlaveHTTPConnectionManager.java
(from r1433278,
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/quartz/scheduler/ClusterSlaveJob.java)
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/SlaveHTTPConnectionManager.java?p2=incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/SlaveHTTPConnectionManager.java&p1=incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/quartz/scheduler/ClusterSlaveJob.java&r1=1433278&r2=1435001&rev=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/quartz/scheduler/ClusterSlaveJob.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/SlaveHTTPConnectionManager.java
Fri Jan 18 01:19:59 2013
@@ -16,35 +16,30 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.openmeetings.quartz.scheduler;
+package org.apache.openmeetings.cluster;
-import java.util.Calendar;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.apache.openmeetings.OpenmeetingsVariables;
-import org.apache.openmeetings.cluster.sync.IRestClientObserver;
import org.apache.openmeetings.cluster.sync.RestClient;
-import org.apache.openmeetings.conference.room.ISharedSessionStore;
-import org.apache.openmeetings.conference.room.SlaveClientDto;
-import org.apache.openmeetings.data.basic.dao.ServerDao;
-import org.apache.openmeetings.documents.beans.UploadCompleteMessage;
import org.apache.openmeetings.persistence.beans.basic.Server;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-public class ClusterSlaveJob implements IRestClientObserver {
+/**
+ * Manages connections to the other nodes of the cluster.
+ *
+ * Use-case: When you kick a user via the admin-panel, it is probably on
anther server.
+ * So you need to perform a REST call to the node and let that node do the
actual disconnect.
+ *
+ * @author sebawagner
+ *
+ */
+public class SlaveHTTPConnectionManager {
private static Logger log = Red5LoggerFactory.getLogger(
- ClusterSlaveJob.class,
OpenmeetingsVariables.webAppRootKey);
-
- @Autowired
- private ServerDao serverDao;
- @Autowired
- private ISharedSessionStore clientListManager;
-
+ SlaveHTTPConnectionManager.class,
OpenmeetingsVariables.webAppRootKey);
/**
* We store the list of RestClients in the memory, so that we can simply
@@ -75,55 +70,12 @@ public class ClusterSlaveJob implements
}
if (restClient == null) {
- restClient = new RestClient(this, server);
+ restClient = new RestClient(server);
restClientsSessionStore.put(server.getId(), restClient);
}
return restClient;
}
- public void doIt() {
- try {
-
- for (Server server : serverDao.getActiveServers()) {
-
- RestClient rClient = getRestClient(server);
-
- //If the ping is still running, we don't ping
the client in this session
- if (rClient.getPingRunning()) {
- log.warn("The ping for the server " +
server
- + " takes longer then
the ping interval!");
- continue;
- }
-
- log.debug("ClusterSlaveJob. Ping server: " +
server);
-
- rClient.ping();
-
- }
-
- } catch (Exception e) {
- log.error("Unexpected exception while doRoundTrip
cluster.", e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- *
org.apache.openmeetings.cluster.sync.IRestClientObserverEvent#pingComplete
- * (org.apache.openmeetings.persistence.beans.basic.Server,
java.util.List)
- */
- public void pingComplete(Server server, List<SlaveClientDto>
slaveClients) {
-
- log.debug("-- pingComplete -- For server: " + server+ " Size:
"+slaveClients.size());
-
- clientListManager.syncSlaveClientSession(server, slaveClients);
-
- server.setLastPing(Calendar.getInstance());
- serverDao.update(server, -1L);
-
- }
-
/**
* Gets the current {@link RestClient} from the session store and then
* performs a kickUser on that. It is not possible that there is no
@@ -147,27 +99,4 @@ public class ClusterSlaveJob implements
}
- /**
- * Gets the current {@link RestClient} from the session store and then
- * performs a kickUser on that. It is not possible that there is no
- * {@link RestClient}, because if you want to kick a user from a slave,
the
- * master <i>must</i> already have loaded the sessions from the slave,
so
- * there logically <i>must</i> by a {@link RestClient} available that
has an
- * open connection to that slave / {@link Server}
- *
- * @param server
- * @param publicSID
- * @param uploadCompleteMessage
- * @throws Exception
- */
- public void syncMessageToClientOnSlave(Server server, String publicSID,
UploadCompleteMessage uploadCompleteMessage) throws Exception {
- RestClient rClient = getRestClient(server);
-
- if (rClient == null) {
- throw new Exception("No RestClient found for server " +
server);
- }
-
- rClient.syncMessage(publicSID, uploadCompleteMessage);
- }
-
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/sync/RestClient.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/sync/RestClient.java?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/sync/RestClient.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cluster/sync/RestClient.java
Fri Jan 18 01:19:59 2013
@@ -19,9 +19,7 @@
package org.apache.openmeetings.cluster.sync;
import java.lang.reflect.Constructor;
-import java.util.ArrayList;
import java.util.Iterator;
-import java.util.List;
import javax.xml.namespace.QName;
@@ -35,9 +33,6 @@ import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.openmeetings.OpenmeetingsVariables;
-import org.apache.openmeetings.conference.room.RoomClient;
-import org.apache.openmeetings.conference.room.SlaveClientDto;
-import org.apache.openmeetings.documents.beans.UploadCompleteMessage;
import org.apache.openmeetings.persistence.beans.basic.Server;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
@@ -56,19 +51,10 @@ public class RestClient {
RestClient.class, OpenmeetingsVariables.webAppRootKey);
private enum Action {
- //send a ping to the user
- PING,
//kick the user from the server
KICK_USER,
- //send a sync message to a client on that server
- SYNC_MESSAGE
}
- /**
- * The observerInstance will be notified whenever a ping was completed
- */
- private IRestClientObserver observerInstance;
-
private Server server;
private final String host;
private final int port;
@@ -80,12 +66,8 @@ public class RestClient {
private boolean loginSuccess = false;
private String sessionId;
- private boolean pingRunning = false;
-
private String publicSID;
- private UploadCompleteMessage uploadCompleteMessage;
-
/**
* there are two publicSIDs, one for the kickUser REST call and one for
the syncMessage call
* theoretically they could be performed at the same time but to
different users, so we don't want
@@ -95,15 +77,6 @@ public class RestClient {
private static String nameSpaceForSlaveDto =
"http://room.conference.openmeetings.apache.org/xsd";
- /**
- * returns true as long as the RestClient performs a ping and parses
the result
- *
- * @return
- */
- public boolean getPingRunning() {
- return pingRunning;
- }
-
private static String NAMESPACE_PREFIX =
"http://services.axis.openmeetings.apache.org";
private String getUserServiceEndPoint() {
@@ -111,11 +84,6 @@ public class RestClient {
+ "/services/UserService";
}
- private String getServerServiceEndPoint() {
- return protocol + "://" + host + ":" + port + "/" + webapp
- + "/services/ServerService";
- }
-
private String getRoomServiceEndPoint() {
return protocol + "://" + host + ":" + port + "/" + webapp
+ "/services/RoomService";
@@ -132,8 +100,7 @@ public class RestClient {
* @param user
* @param pass
*/
- public RestClient(IRestClientObserver observerInstance, Server server) {
- this.observerInstance = observerInstance;
+ public RestClient(Server server) {
this.server = server;
this.host = server.getAddress();
this.port = server.getPort();
@@ -152,8 +119,7 @@ public class RestClient {
RestClient rClient = new RestClient("127.0.0.1", 5080, "http",
"openmeetings", "swagner", "qweqwe");
try {
- rClient.loginUser(Action.PING);
- rClient.ping();
+ rClient.loginUser(Action.KICK_USER);
} catch (Exception e) {
e.printStackTrace();
}
@@ -231,12 +197,12 @@ public class RestClient {
loginSuccess = loginSuccessFromResult(loginUserResult);
- if (action == Action.PING) {
- ping();
- } else if (action == Action.KICK_USER) {
- kickUserInternl();
- } else if (action == Action.SYNC_MESSAGE) {
- syncMessageInternl();
+ switch (action) {
+ case KICK_USER:
+ kickUserInternl();
+ break;
+ default:
+ throw new Exception("No action defined");
}
}
@@ -266,82 +232,6 @@ public class RestClient {
return omElement;
}
-
- /**
- * set s the publicSID the message object and sends it to the slave by
calling a REST service
- *
- * @param publicSID
- * @param uploadCompleteMessage
- */
- public void syncMessage(String publicSID, UploadCompleteMessage
uploadCompleteMessage) {
- this.publicSIDSync = publicSID;
- this.uploadCompleteMessage = uploadCompleteMessage;
- syncMessageInternl();
- }
-
- private void syncMessageInternl() {
- try {
-
- if (!loginSuccess) {
- loginUser(Action.SYNC_MESSAGE);
- }
-
- ServiceClient sender =
createServiceClient(getRoomServiceEndPoint());
- OMElement syncMessageResult = sender
-
.sendReceive(getPayloadMethodSyncMessage());
- Boolean result =
syncMessageResultFromResult(syncMessageResult);
-
- if (!result) {
- throw new Exception("Could not sync message to
slave host");
- }
-
- } catch (Exception err) {
- log.error("[syncMessage failed]", err);
- }
- }
-
- private Boolean syncMessageResultFromResult(OMElement result) throws
Exception {
- QName kickUserResult = new QName(NAMESPACE_PREFIX, "return");
-
- @SuppressWarnings("unchecked")
- Iterator<OMElement> elements =
result.getChildrenWithName(kickUserResult);
- if (elements.hasNext()) {
- OMElement resultElement = elements.next();
- if (resultElement.getText().equals("true")) {
- return true;
- } else {
- throw new Exception("Could not delete user from
slave host, returns: "
- + resultElement.getText());
- }
- } else {
- throw new Exception("Could not parse
kickUserByPublicSID result");
- }
- }
-
- private OMElement getPayloadMethodSyncMessage() {
-
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace omNs = fac.createOMNamespace(NAMESPACE_PREFIX,
"pre");
- OMElement method =
fac.createOMElement("syncUploadCompleteMessage", omNs);
-
- method.addChild(createOMElement(fac, omNs, "SID", sessionId));
- method.addChild(createOMElement(fac, omNs, "publicSID",
publicSIDSync));
- method.addChild(createOMElement(fac, omNs, "userId", ""+
uploadCompleteMessage.getUserId()));
- method.addChild(createOMElement(fac, omNs, "message",
uploadCompleteMessage.getMessage()));
- method.addChild(createOMElement(fac, omNs, "action",
uploadCompleteMessage.getAction()));
- method.addChild(createOMElement(fac, omNs, "error",
uploadCompleteMessage.getError()));
- method.addChild(createOMElement(fac, omNs, "hasError",
""+uploadCompleteMessage.isHasError()));
- method.addChild(createOMElement(fac, omNs, "fileName",
uploadCompleteMessage.getFileName()));
-
- method.addChild(createOMElement(fac, omNs, "fileSystemName",
uploadCompleteMessage.getFileSystemName()));
- method.addChild(createOMElement(fac, omNs, "isPresentation",
""+uploadCompleteMessage.getIsPresentation()));
- method.addChild(createOMElement(fac, omNs, "isImage",
""+uploadCompleteMessage.getIsImage()));
- method.addChild(createOMElement(fac, omNs, "isVideo",
""+uploadCompleteMessage.getIsVideo()));
- method.addChild(createOMElement(fac, omNs, "fileHash",
uploadCompleteMessage.getFileHash()));
-
- return method;
- }
-
/**
* sets the publicSID and removes a user from a slave host by calling a
REST service
*
@@ -402,52 +292,6 @@ public class RestClient {
}
/**
- * verifies if the user is logged in, if yes, it will try to load the
- * current list of sessions from the slave
- *
- * @throws Exception
- */
- public void ping() {
- try {
- //flag this ping flow as active, so that the scheduler
does not run multiple ping's
- //on the same instance, at the same time, cause a ping
could take longer then the
- //scheduler interval, for example because of the server
load
- pingRunning = true;
-
- if (!loginSuccess) {
- loginUser(Action.PING);
- } else {
-
- ServiceClient sender =
createServiceClient(getServerServiceEndPoint());
- OMElement pingResult = sender
-
.sendReceive(getPayloadMethodPingTemp());
-
- List<SlaveClientDto> slaveClients =
pingFromResult(pingResult);
-
- if (this.observerInstance != null) {
-
this.observerInstance.pingComplete(server, slaveClients);
- }
-
- //flag this flow as complete
- pingRunning = false;
-
- }
- // Catches all errors to make sure the observer is
notified that the
- // ping was performed (even when performed badly)
- } catch (Exception ex) {
-
- //Clear the list of clients if there are any for this
server
- if (this.observerInstance != null) {
- this.observerInstance.pingComplete(server, new
ArrayList<SlaveClientDto>(0));
- }
-
- //flag this flow as complete
- pingRunning = false;
- log.error("[ping failed]", ex);
- }
- }
-
- /**
* Create the REST request to get a new session Id
*
* @return
@@ -481,7 +325,7 @@ public class RestClient {
}
/**
- * create the payload to login to another openmeetings instance via REST
+ * create the payload to login to another OpenMeetings instance via REST
*
* @return
*/
@@ -523,55 +367,6 @@ public class RestClient {
}
/**
- * Create the REST request for the ping method to load the users
- *
- * @return
- */
- private OMElement getPayloadMethodPingTemp() throws Exception {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace omNs = fac.createOMNamespace(NAMESPACE_PREFIX,
"pre");
- OMElement method = fac.createOMElement("ping", omNs);
- method.addChild(createOMElement(fac, omNs, "SID", sessionId));
- return method;
- }
-
- /**
- * Parses the result of the rest request and returns a list of
- * {@link RoomClient}s
- *
- * @param result
- * the result of the REST request
- * @return list of {@link RoomClient}s
- * @throws Exception
- */
- private List<SlaveClientDto> pingFromResult(OMElement result) throws
Exception {
-
- QName pingResult = new QName(NAMESPACE_PREFIX, "return");
-
- @SuppressWarnings("unchecked")
- Iterator<OMElement> elements =
result.getChildrenWithName(pingResult);
- List<SlaveClientDto> clients = new ArrayList<SlaveClientDto>();
- while (elements.hasNext()) {
- OMElement resultElement = elements.next();
- SlaveClientDto slaveDto = new SlaveClientDto( //
- getElementTextByName(resultElement,
"streamid", String.class), //
- getElementTextByName(resultElement,
"publicSID", String.class), //
- getElementTextByName(resultElement,
"roomId", Long.class), //
- getElementTextByName(resultElement,
"userId", Long.class), //
- getElementTextByName(resultElement,
"firstName", String.class), //
- getElementTextByName(resultElement,
"lastName", String.class), //
- getElementTextByName(resultElement,
"AVClient", Boolean.class), //
- getElementTextByName(resultElement,
"scope", String.class), //
- getElementTextByName(resultElement,
"username", String.class), //
- getElementTextByName(resultElement,
"connectedSince", String.class)
- ); //
- log.debug(slaveDto.toString());
- clients.add(slaveDto);
- }
- return clients;
- }
-
- /**
* Get and cast the element's text (if there is any)
*
* @param resultElement
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/conference/room/ClientListHashMapStore.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/conference/room/ClientListHashMapStore.java?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/conference/room/ClientListHashMapStore.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/conference/room/ClientListHashMapStore.java
Fri Jan 18 01:19:59 2013
@@ -47,7 +47,7 @@ import org.springframework.beans.factory
* @author sebawagner
*
*/
-public class ClientListHashMapStore implements IClientList,
ISharedSessionStore {
+public class ClientListHashMapStore implements IClientList {
protected static final Logger log = Red5LoggerFactory.getLogger(
ClientListHashMapStore.class,
OpenmeetingsVariables.webAppRootKey);
@@ -341,53 +341,6 @@ public class ClientListHashMapStore impl
return numberOfPublishingUsers;
}
- public void cleanSessionsOfDeletedOrDeactivatedServer(Server server) {
- //we need to summarize those clients in a second list first,
cause there are
- //multiple lists to be cleaned up and an iterator will not work
- ArrayList<RoomClient> serverList = new ArrayList<RoomClient>();
- serverList.addAll(cache.getClientsByServer(server).values());
-
- for (RoomClient rcl : serverList) {
- cache.remove(server, rcl.getStreamid());
- }
- }
-
- public void syncSlaveClientSession(Server server,
- List<SlaveClientDto> clients) {
-
- // delete all existing client sessions by that slave, updating
existing ones
- // makes no sense, we don't know anything about the start or
end date
- // so at this point we can just remove them all and add them new
- cleanSessionsOfDeletedOrDeactivatedServer(server);
-
- for (SlaveClientDto slaveClientDto : clients) {
- cache.put(
- server, slaveClientDto.getStreamid(),
- new RoomClient(
-
slaveClientDto.getStreamid(),
-
slaveClientDto.getPublicSID(),
-
slaveClientDto.getRoomId(),
-
slaveClientDto.getUserId(),
-
slaveClientDto.getFirstName(),
-
slaveClientDto.getLastName(),
-
slaveClientDto.isAVClient(),
-
slaveClientDto.getUsername(),
-
slaveClientDto.getConnectedSince(),
-
slaveClientDto.getScope()
- ));
- }
-
- }
-
- public List<SlaveClientDto> getCurrentSlaveSessions() {
- List<SlaveClientDto> clients = new ArrayList<SlaveClientDto>(
- cache.size());
- for (RoomClient rcl : cache.getClientsByServer(null).values()) {
- clients.add(new SlaveClientDto(rcl));
- }
- return clients;
- }
-
public Set<Long> getActiveRoomIdsByServer(Server server) {
if (cache.getClientsByServerAndRoom(server) == null) {
return EMPTY_HASH_SET;
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/ServerDao.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/ServerDao.java?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/ServerDao.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/ServerDao.java
Fri Jan 18 01:19:59 2013
@@ -27,7 +27,6 @@ import javax.persistence.PersistenceCont
import javax.persistence.TypedQuery;
import org.apache.openmeetings.OpenmeetingsVariables;
-import org.apache.openmeetings.conference.room.ISharedSessionStore;
import org.apache.openmeetings.data.IDataProviderDao;
import org.apache.openmeetings.data.user.dao.UsersDao;
import org.apache.openmeetings.persistence.beans.basic.Server;
@@ -56,9 +55,6 @@ public class ServerDao implements IDataP
@Autowired
private UsersDao usersDao;
- @Autowired
- private ISharedSessionStore clientListManager;
-
/**
* Get a list of all available servers
*
@@ -164,10 +160,6 @@ public class ServerDao implements IDataP
* .beans.OmEntity, long)
*/
public Server update(Server entity, long userId) {
- if (entity.getActive() != null && !entity.getActive()) {
-
clientListManager.cleanSessionsOfDeletedOrDeactivatedServer(entity);
- }
-
entity.setDeleted(false);
if (entity.getId() > 0) {
if (userId > 0) {
@@ -194,7 +186,6 @@ public class ServerDao implements IDataP
*/
public void delete(Server entity, long userId) {
if (entity.getId() > 0) {
-
clientListManager.cleanSessionsOfDeletedOrDeactivatedServer(entity);
entity.setUpdated(new Date());
entity.setUpdatedby(usersDao.get(userId));
entity.setDeleted(true);
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/UserService.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/UserService.java?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/UserService.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/UserService.java
Fri Jan 18 01:19:59 2013
@@ -28,6 +28,7 @@ import java.util.List;
import java.util.TimeZone;
import org.apache.openmeetings.OpenmeetingsVariables;
+import org.apache.openmeetings.cluster.SlaveHTTPConnectionManager;
import org.apache.openmeetings.conference.room.IClientList;
import org.apache.openmeetings.conference.room.RoomClient;
import org.apache.openmeetings.data.basic.AuthLevelmanagement;
@@ -59,7 +60,6 @@ import org.apache.openmeetings.persisten
import org.apache.openmeetings.persistence.beans.user.Salutations;
import org.apache.openmeetings.persistence.beans.user.UserContacts;
import org.apache.openmeetings.persistence.beans.user.Users;
-import org.apache.openmeetings.quartz.scheduler.ClusterSlaveJob;
import org.apache.openmeetings.remote.red5.ScopeApplicationAdapter;
import org.apache.openmeetings.templates.RequestContactConfirmTemplate;
import org.apache.openmeetings.templates.RequestContactTemplate;
@@ -135,7 +135,7 @@ public class UserService {
@Autowired
private ServerDao serverDao;
@Autowired
- private ClusterSlaveJob clusterSlaveJob;
+ private SlaveHTTPConnectionManager slaveHTTPConnectionManager;
/**
* get your own user-object
@@ -565,7 +565,7 @@ public class UserService {
Server server = serverDao.get(serverId);
RoomClient rcl =
clientListManager.getClientByStreamId(
streamid, server);
- clusterSlaveJob.kickSlaveUser(server,
rcl.getPublicSID());
+
slaveHTTPConnectionManager.kickSlaveUser(server, rcl.getPublicSID());
// true means only the REST call is
performed, it is no
// confirmation that the user is really
kicked from the
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java?rev=1435001&r1=1435000&r2=1435001&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
Fri Jan 18 01:19:59 2013
@@ -30,7 +30,6 @@ import java.util.Map;
import java.util.Set;
import org.apache.openmeetings.OpenmeetingsVariables;
-import org.apache.openmeetings.conference.room.ClientSessionInfo;
import org.apache.openmeetings.conference.room.IClientList;
import org.apache.openmeetings.conference.room.RoomClient;
import org.apache.openmeetings.conference.whiteboard.BrowserStatus;
@@ -52,7 +51,6 @@ import org.apache.openmeetings.persisten
import org.apache.openmeetings.persistence.beans.calendar.MeetingMember;
import org.apache.openmeetings.persistence.beans.rooms.Rooms;
import org.apache.openmeetings.persistence.beans.user.Users;
-import org.apache.openmeetings.quartz.scheduler.ClusterSlaveJob;
import org.apache.openmeetings.remote.FLVRecorderService;
import org.apache.openmeetings.remote.WhiteBoardService;
import org.apache.openmeetings.utils.OmFileHelper;
@@ -107,8 +105,6 @@ public class ScopeApplicationAdapter ext
@Autowired
private MeetingMemberDao meetingMemberDao;
@Autowired
- private ClusterSlaveJob clusterSlaveJob;
- @Autowired
private ServerDao serverDao;
public static String lineSeperator =
System.getProperty("line.separator");
@@ -2517,30 +2513,13 @@ public class ScopeApplicationAdapter ext
if (currentClient != null) {
sendMessageWithClientByPublicSID(message,
publicSID);
- return;
- }
-
- //Check if the client is on any slave host
- ClientSessionInfo clientSessionInfo =
this.clientListManager.getClientByPublicSIDAnyServer(publicSID, false);
-
- if (clientSessionInfo == null) {
+ } else {
throw new Exception(
"Could not Find RoomClient on
List publicSID: "+ publicSID);
}
- Server s = clientSessionInfo.getServerId() != null ?
serverDao
- .get(clientSessionInfo.getServerId()) :
null;
- if (s == null) {
- throw new Exception("Found session has the
server null rcl: "
- + clientSessionInfo.getRcl() +
" serverId: "
- +
clientSessionInfo.getServerId() + " publicSID: "
- + publicSID);
- }
-
- clusterSlaveJob.syncMessageToClientOnSlave(s,
clientSessionInfo.getRcl().getPublicSID() , message);
-
} catch (Exception err) {
- log.error("[sendMessageWithClient] ", err);
+ log.error("[sendUploadCompletMessageByPublicSID] ",
err);
}
}