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 2016/04/02 07:58:44 UTC
svn commit: r1737461 - in /openmeetings/application:
branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/
branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/
trunk/openmee...
Author: solomax
Date: Sat Apr 2 05:58:44 2016
New Revision: 1737461
URL: http://svn.apache.org/viewvc?rev=1737461&view=rev
Log:
[OPENMEETINGS-1350] kick user from clustered server works as expected
Added:
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/Constants.java
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/UserService.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/Constants.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/UserService.java
Modified:
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ErrorWebService.java
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/GroupWebService.java
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RecordingWebService.java
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ErrorWebService.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/GroupWebService.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RecordingWebService.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java
Modified: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.util.Calendar;
import java.util.Date;
@@ -53,10 +54,9 @@ import org.springframework.beans.factory
* CalendarService contains methods to create, edit delete calendar meetings
*
* @author sebawagner
- * @webservice CalendarService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.CalendarWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.CalendarWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/calendar")
Added: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/Constants.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/Constants.java?rev=1737461&view=auto
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/Constants.java (added)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/Constants.java Sat Apr 2 05:58:44 2016
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.webservice;
+
+public class Constants {
+ public static final String TNS = "http://webservice.openmeetings.apache.org/";
+ public static final String USER_SERVICE_NAME = "org.apache.openmeetings.webservice.UserWebService";
+ public static final String USER_SERVICE_PORT_NAME = "UserService";
+}
Modified: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ErrorWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ErrorWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ErrorWebService.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ErrorWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@@ -46,10 +47,9 @@ import org.springframework.beans.factory
* The Service contains methods to get localized errors
*
* @author solomax
- * @webservice ErrorService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.ErrorWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.ErrorWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/error")
Modified: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.io.File;
import java.io.InputStream;
@@ -68,10 +69,9 @@ import org.springframework.beans.factory
* conference room and the personal drive of any user
*
* @author sebawagner
- * @webservice FileService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.FileWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.FileWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/file")
Modified: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/GroupWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/GroupWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/GroupWebService.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/GroupWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.util.ArrayList;
@@ -59,10 +60,9 @@ import org.springframework.beans.factory
* conference rooms, recordings or the application in general
*
* @author sebawagner
- * @webservice GroupService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.GroupWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.GroupWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/group")
Modified: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RecordingWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RecordingWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RecordingWebService.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RecordingWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.util.List;
@@ -49,10 +50,9 @@ import org.springframework.beans.factory
* The Service contains methods to work with recordings
*
* @author solomax
- * @webservice RecordingService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.RecordingWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.RecordingWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/record")
Modified: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.util.ArrayList;
import java.util.HashMap;
@@ -65,10 +66,9 @@ import org.springframework.beans.factory
* RoomService contains methods to manipulate rooms and create invitation hash
*
* @author sebawagner
- * @webservice RoomService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.RoomWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.RoomWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/room")
Modified: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.util.List;
@@ -53,10 +54,9 @@ import org.springframework.beans.factory
* participating in cluster.
*
* @author solomax, sebawagner
- * @webservice ServerService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.ServerWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.ServerWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/server")
Modified: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,9 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_NAME;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_PORT_NAME;
import java.util.Date;
@@ -55,6 +58,7 @@ import org.apache.openmeetings.db.entity
import org.apache.openmeetings.db.entity.user.User.Right;
import org.apache.openmeetings.db.util.AuthLevelUtil;
import org.apache.openmeetings.util.OmException;
+import org.apache.openmeetings.webservice.cluster.UserService;
import org.apache.openmeetings.webservice.error.ServiceException;
import org.apache.wicket.util.string.Strings;
import org.red5.logging.Red5LoggerFactory;
@@ -67,14 +71,13 @@ import org.springframework.beans.factory
* conference rooms, recordings or the application in general
*
* @author sebawagner
- * @webservice UserService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.UserWebService")
+@WebService(serviceName = USER_SERVICE_NAME, targetNamespace = TNS, portName = USER_SERVICE_PORT_NAME)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/user")
-public class UserWebService {
+public class UserWebService implements UserService {
private static final Logger log = Red5LoggerFactory.getLogger(UserWebService.class, webAppRootKey);
@Autowired
private ConfigurationDao cfgDao;
@@ -89,12 +92,10 @@ public class UserWebService {
@Autowired
private ConferenceService conferenceService;
- /**
- * @param user - login or email of Openmeetings user with admin or SOAP-rights
- * @param pass - password
- *
- * @return - {@link ServiceResult} with error code or SID and userId
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#login(java.lang.String, java.lang.String)
*/
+ @Override
@WebMethod
@GET
@Path("/login")
@@ -121,20 +122,10 @@ public class UserWebService {
}
}
- /**
- * Adds a new User like through the Frontend, but also does activates the
- * Account To do SSO see the methods to create a hash and use those ones!
- *
- * @param sid
- * The SID from getSession
- * @param user
- * user object
- * @param confirm
- * whatever or not to send email, leave empty for auto-send
- *
- * @return - id of the user added or error code
- * @throws ServiceException
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#add(java.lang.String, org.apache.openmeetings.db.dto.user.UserDTO, java.lang.Boolean)
*/
+ @Override
@WebMethod
@POST
@Path("/")
@@ -202,18 +193,10 @@ public class UserWebService {
//FIXME no update
- /**
- *
- * Delete a certain user by its id
- *
- * @param sid
- * The SID from getSession
- * @param id
- * the openmeetings user id
- *
- * @return - id of the user deleted, error code otherwise
- * @throws ServiceException
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#delete(java.lang.String, long)
*/
+ @Override
@WebMethod
@DELETE
@Path("/{id}")
@@ -234,20 +217,10 @@ public class UserWebService {
}
}
- /**
- *
- * Delete a certain user by its external user id
- *
- * @param sid
- * The SID from getSession
- * @param externalId
- * externalUserId
- * @param externalType
- * externalUserId
- *
- * @return - id of user deleted, or error code
- * @throws ServiceException
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#deleteExternal(java.lang.String, java.lang.String, java.lang.String)
*/
+ @Override
@DELETE
@Path("/{externaltype}/{externalid}")
public ServiceResult deleteExternal(
@@ -275,21 +248,10 @@ public class UserWebService {
}
}
- /**
- * Description: sets the SessionObject for a certain SID, after setting this
- * Session-Object you can use the SID + a RoomId to enter any Room. ...
- * Session-Hashs are deleted 15 minutes after the creation if not used.
- *
- * @param sid
- * The SID from getSession
- * @param user
- * user details to set
- * @param options
- * room options to set
- *
- * @return - secure hash or error code
- * @throws ServiceException
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#getRoomHash(java.lang.String, org.apache.openmeetings.db.dto.user.ExternalUserDTO, org.apache.openmeetings.db.dto.room.RoomOptionsDTO)
*/
+ @Override
@WebMethod
@POST
@Path("/hash")
@@ -337,16 +299,10 @@ public class UserWebService {
return new ServiceResult(-1L, "Unknown error", Type.ERROR);
}
- /**
- * Kick a user by its public SID
- *
- * @param sid
- * The SID from getSession
- * @param publicSID
- * the publicSID (you can get it from the call to get users in a
- * room)
- * @return - <code>true</code> if user was kicked
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#kick(java.lang.String, java.lang.String)
*/
+ @Override
@WebMethod
@POST
@Path("/kick/{publicsid}")
@@ -366,14 +322,10 @@ public class UserWebService {
}
}
- /**
- * Returns the count of users currently in the Room with given id
- * No admin rights are necessary for this call
- *
- * @param sid The SID from UserService.getSession
- * @param roomId id of the room to get users
- * @return number of users as int
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#count(java.lang.String, java.lang.Long)
*/
+ @Override
@WebMethod
@GET
@Path("/count/{roomid}")
Modified: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,9 @@
package org.apache.openmeetings.webservice.cluster;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_NAME;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_PORT_NAME;
import java.net.URL;
@@ -27,7 +30,6 @@ import javax.xml.ws.Service;
import org.apache.openmeetings.db.dto.basic.ServiceResult;
import org.apache.openmeetings.db.entity.server.Server;
-import org.apache.openmeetings.webservice.UserWebService;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
@@ -41,6 +43,8 @@ import org.slf4j.Logger;
*/
public class RestClient {
private static final Logger log = Red5LoggerFactory.getLogger(RestClient.class, webAppRootKey);
+ private final static QName USER_SERVICE_QNAME = new QName(TNS, USER_SERVICE_NAME);
+ private final static QName USER_SERVICE_PORT_QNAME = new QName(TNS, USER_SERVICE_PORT_NAME);
private enum Action {
//kick the user from the server
@@ -60,8 +64,7 @@ public class RestClient {
private String publicSID;
private String getUserServiceWsdl() {
- return protocol + "://" + host + ":" + port + "/" + webapp
- + "/services/UserService?wsdl";
+ return String.format("%s://%s:%s/%s/services/UserService?wsdl", protocol, host, port, webapp);
}
/**
@@ -76,7 +79,6 @@ public class RestClient {
* @param pass
*/
public RestClient(Server server) {
- //this.server = server;
this.host = server.getAddress();
this.port = server.getPort();
this.protocol = server.getProtocol();
@@ -91,8 +93,7 @@ public class RestClient {
* @param strings
*/
public static void main(String... strings) {
- RestClient rClient = new RestClient("127.0.0.1", 5080, "http",
- "openmeetings", "swagner", "qweqwe");
+ RestClient rClient = new RestClient("127.0.0.1", 5080, "http", "openmeetings", "admin", "12345");
try {
rClient.loginUser(Action.KICK_USER);
} catch (Exception e) {
@@ -114,8 +115,7 @@ public class RestClient {
* @param user
* @param pass
*/
- private RestClient(String host, int port, String protocol, String webapp,
- String user, String pass) {
+ private RestClient(String host, int port, String protocol, String webapp, String user, String pass) {
this.host = host;
this.port = port;
this.protocol = protocol;
@@ -131,46 +131,27 @@ public class RestClient {
* @return
*/
public boolean hasServerDetailsChanged(Server server2) {
-
- if (!host.equals(server2.getAddress())) {
- return true;
- }
- if (port != server2.getPort()) {
- return true;
- }
- if (!user.equals(server2.getUser())) {
- return true;
- }
- if (!pass.equals(server2.getPass())) {
- return true;
- }
- if (!webapp.equals(server2.getWebapp())) {
- return true;
- }
- if (!protocol.equals(server2.getProtocol())) {
- return true;
- }
-
- return false;
+ return !host.equals(server2.getAddress())
+ || port != server2.getPort()
+ || !user.equals(server2.getUser())
+ || !pass.equals(server2.getPass())
+ || !webapp.equals(server2.getWebapp())
+ || !protocol.equals(server2.getProtocol());
}
-
- /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- * TODO double check this
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- */
- private UserWebService getUserClient() throws Exception {
+
+ private UserService getUserClient() throws Exception {
URL wsdlURL = new URL(getUserServiceWsdl());
- QName SERVICE_NAME = new QName("UserService");
- Service service = Service.create(wsdlURL, SERVICE_NAME);
- return service.getPort(UserWebService.class);
+ Service service = Service.create(wsdlURL, USER_SERVICE_QNAME);
+ return service.getPort(USER_SERVICE_PORT_QNAME, UserService.class);
}
+
/**
* Login the user via REST
*
* @throws Exception
*/
public void loginUser(Action action) throws Exception {
- UserWebService client = getUserClient();
+ UserService client = getUserClient();
ServiceResult result = client.login(user, pass);
@@ -201,7 +182,7 @@ public class RestClient {
loginUser(Action.KICK_USER);
}
- UserWebService client = getUserClient();
+ UserService client = getUserClient();
ServiceResult result = client.kick(sessionId, publicSID);
if (result.getCode() == 0) {
Added: openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/UserService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/UserService.java?rev=1737461&view=auto
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/UserService.java (added)
+++ openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/UserService.java Sat Apr 2 05:58:44 2016
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.webservice.cluster;
+
+import static org.apache.openmeetings.webservice.Constants.TNS;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_NAME;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_PORT_NAME;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+
+import org.apache.openmeetings.db.dto.basic.ServiceResult;
+import org.apache.openmeetings.db.dto.room.RoomOptionsDTO;
+import org.apache.openmeetings.db.dto.user.ExternalUserDTO;
+import org.apache.openmeetings.db.dto.user.UserDTO;
+import org.apache.openmeetings.webservice.error.ServiceException;
+
+/**
+ * This interface is required for RestClient
+ */
+@WebService(serviceName = USER_SERVICE_NAME, targetNamespace = TNS, portName = USER_SERVICE_PORT_NAME)
+public interface UserService {
+
+ /**
+ * @param user - login or email of Openmeetings user with admin or SOAP-rights
+ * @param pass - password
+ *
+ * @return - {@link ServiceResult} with error code or SID and userId
+ */
+ ServiceResult login(@WebParam(name="user") @QueryParam("user") String user, @WebParam(name="pass") @QueryParam("pass") String pass);
+
+ /**
+ * Adds a new User like through the Frontend, but also does activates the
+ * Account To do SSO see the methods to create a hash and use those ones!
+ *
+ * @param sid
+ * The SID from getSession
+ * @param user
+ * user object
+ * @param confirm
+ * whatever or not to send email, leave empty for auto-send
+ *
+ * @return - id of the user added or error code
+ * @throws ServiceException
+ */
+ UserDTO add(
+ @WebParam(name="sid") @QueryParam("sid") String sid
+ , @WebParam(name="user") @QueryParam("user") UserDTO user
+ , @WebParam(name="confirm") @QueryParam("confirm") Boolean confirm
+ ) throws ServiceException;
+
+ /**
+ *
+ * Delete a certain user by its id
+ *
+ * @param sid
+ * The SID from getSession
+ * @param id
+ * the openmeetings user id
+ *
+ * @return - id of the user deleted, error code otherwise
+ * @throws ServiceException
+ */
+ ServiceResult delete(@WebParam(name="sid") @QueryParam("sid") String sid, @WebParam(name="id") @PathParam("id") long id) throws ServiceException;
+
+ /**
+ *
+ * Delete a certain user by its external user id
+ *
+ * @param sid
+ * The SID from getSession
+ * @param externalId
+ * externalUserId
+ * @param externalType
+ * externalUserId
+ *
+ * @return - id of user deleted, or error code
+ * @throws ServiceException
+ */
+ ServiceResult deleteExternal(
+ @WebParam(name="sid") @QueryParam("sid") String sid
+ , @WebParam(name="externaltype") @PathParam("externaltype") String externalType
+ , @WebParam(name="externalid") @PathParam("externalid") String externalId
+ ) throws ServiceException;
+
+ /**
+ * Description: sets the SessionObject for a certain SID, after setting this
+ * Session-Object you can use the SID + a RoomId to enter any Room. ...
+ * Session-Hashs are deleted 15 minutes after the creation if not used.
+ *
+ * @param sid
+ * The SID from getSession
+ * @param user
+ * user details to set
+ * @param options
+ * room options to set
+ *
+ * @return - secure hash or error code
+ * @throws ServiceException
+ */
+ ServiceResult getRoomHash(
+ @WebParam(name="sid") @QueryParam("sid") String sid
+ , @WebParam(name="user") @FormParam("user") ExternalUserDTO user
+ , @WebParam(name="options") @FormParam("options") RoomOptionsDTO options
+ ) throws ServiceException;
+
+ /**
+ * Kick a user by its public SID
+ *
+ * @param sid
+ * The SID from getSession
+ * @param publicSID
+ * the publicSID (you can get it from the call to get users in a
+ * room)
+ * @return - <code>true</code> if user was kicked
+ */
+ ServiceResult kick(@WebParam(name="sid") @QueryParam("sid") String sid, @WebParam(name="publicsid") @PathParam("publicsid") String publicSID) throws ServiceException;
+
+ /**
+ * Returns the count of users currently in the Room with given id
+ * No admin rights are necessary for this call
+ *
+ * @param sid The SID from UserService.getSession
+ * @param roomId id of the room to get users
+ * @return number of users as int
+ */
+ int count(@WebParam(name="sid") @QueryParam("sid") String sid, @WebParam(name="roomid") @PathParam("roomid") Long roomId);
+}
Modified: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java (original)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.util.Calendar;
import java.util.Date;
@@ -53,10 +54,9 @@ import org.springframework.beans.factory
* CalendarService contains methods to create, edit delete calendar meetings
*
* @author sebawagner
- * @webservice CalendarService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.CalendarWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.CalendarWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/calendar")
Added: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/Constants.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/Constants.java?rev=1737461&view=auto
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/Constants.java (added)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/Constants.java Sat Apr 2 05:58:44 2016
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.webservice;
+
+public class Constants {
+ public static final String TNS = "http://webservice.openmeetings.apache.org/";
+ public static final String USER_SERVICE_NAME = "org.apache.openmeetings.webservice.UserWebService";
+ public static final String USER_SERVICE_PORT_NAME = "UserService";
+}
Modified: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ErrorWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ErrorWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ErrorWebService.java (original)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ErrorWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@@ -46,10 +47,9 @@ import org.springframework.beans.factory
* The Service contains methods to get localized errors
*
* @author solomax
- * @webservice ErrorService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.ErrorWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.ErrorWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/error")
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=1737461&r1=1737460&r2=1737461&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 Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.io.File;
import java.io.InputStream;
@@ -68,10 +69,9 @@ import org.springframework.beans.factory
* conference room and the personal drive of any user
*
* @author sebawagner
- * @webservice FileService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.FileWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.FileWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/file")
Modified: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/GroupWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/GroupWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/GroupWebService.java (original)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/GroupWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.util.ArrayList;
@@ -59,10 +60,9 @@ import org.springframework.beans.factory
* conference rooms, recordings or the application in general
*
* @author sebawagner
- * @webservice GroupService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.GroupWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.GroupWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/group")
Modified: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RecordingWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RecordingWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RecordingWebService.java (original)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RecordingWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.util.List;
@@ -49,10 +50,9 @@ import org.springframework.beans.factory
* The Service contains methods to work with recordings
*
* @author solomax
- * @webservice RecordingService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.RecordingWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.RecordingWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/record")
Modified: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java (original)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/RoomWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.util.ArrayList;
import java.util.HashMap;
@@ -65,10 +66,9 @@ import org.springframework.beans.factory
* RoomService contains methods to manipulate rooms and create invitation hash
*
* @author sebawagner
- * @webservice RoomService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.RoomWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.RoomWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/room")
Modified: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java (original)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
import java.util.List;
@@ -53,10 +54,9 @@ import org.springframework.beans.factory
* participating in cluster.
*
* @author solomax, sebawagner
- * @webservice ServerService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.ServerWebService")
+@WebService(serviceName="org.apache.openmeetings.webservice.ServerWebService", targetNamespace = TNS)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/server")
Modified: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java (original)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,9 @@
package org.apache.openmeetings.webservice;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_NAME;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_PORT_NAME;
import java.util.Date;
@@ -55,6 +58,7 @@ import org.apache.openmeetings.db.entity
import org.apache.openmeetings.db.entity.user.User.Right;
import org.apache.openmeetings.db.util.AuthLevelUtil;
import org.apache.openmeetings.util.OmException;
+import org.apache.openmeetings.webservice.cluster.UserService;
import org.apache.openmeetings.webservice.error.ServiceException;
import org.apache.wicket.util.string.Strings;
import org.red5.logging.Red5LoggerFactory;
@@ -67,14 +71,13 @@ import org.springframework.beans.factory
* conference rooms, recordings or the application in general
*
* @author sebawagner
- * @webservice UserService
*
*/
-@WebService(serviceName="org.apache.openmeetings.webservice.UserWebService")
+@WebService(serviceName = USER_SERVICE_NAME, targetNamespace = TNS, portName = USER_SERVICE_PORT_NAME)
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/user")
-public class UserWebService {
+public class UserWebService implements UserService {
private static final Logger log = Red5LoggerFactory.getLogger(UserWebService.class, webAppRootKey);
@Autowired
private ConfigurationDao cfgDao;
@@ -89,12 +92,10 @@ public class UserWebService {
@Autowired
private ConferenceService conferenceService;
- /**
- * @param user - login or email of Openmeetings user with admin or SOAP-rights
- * @param pass - password
- *
- * @return - {@link ServiceResult} with error code or SID and userId
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#login(java.lang.String, java.lang.String)
*/
+ @Override
@WebMethod
@GET
@Path("/login")
@@ -121,20 +122,10 @@ public class UserWebService {
}
}
- /**
- * Adds a new User like through the Frontend, but also does activates the
- * Account To do SSO see the methods to create a hash and use those ones!
- *
- * @param sid
- * The SID from getSession
- * @param user
- * user object
- * @param confirm
- * whatever or not to send email, leave empty for auto-send
- *
- * @return - id of the user added or error code
- * @throws ServiceException
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#add(java.lang.String, org.apache.openmeetings.db.dto.user.UserDTO, java.lang.Boolean)
*/
+ @Override
@WebMethod
@POST
@Path("/")
@@ -202,18 +193,10 @@ public class UserWebService {
//FIXME no update
- /**
- *
- * Delete a certain user by its id
- *
- * @param sid
- * The SID from getSession
- * @param id
- * the openmeetings user id
- *
- * @return - id of the user deleted, error code otherwise
- * @throws ServiceException
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#delete(java.lang.String, long)
*/
+ @Override
@WebMethod
@DELETE
@Path("/{id}")
@@ -234,20 +217,10 @@ public class UserWebService {
}
}
- /**
- *
- * Delete a certain user by its external user id
- *
- * @param sid
- * The SID from getSession
- * @param externalId
- * externalUserId
- * @param externalType
- * externalUserId
- *
- * @return - id of user deleted, or error code
- * @throws ServiceException
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#deleteExternal(java.lang.String, java.lang.String, java.lang.String)
*/
+ @Override
@DELETE
@Path("/{externaltype}/{externalid}")
public ServiceResult deleteExternal(
@@ -275,21 +248,10 @@ public class UserWebService {
}
}
- /**
- * Description: sets the SessionObject for a certain SID, after setting this
- * Session-Object you can use the SID + a RoomId to enter any Room. ...
- * Session-Hashs are deleted 15 minutes after the creation if not used.
- *
- * @param sid
- * The SID from getSession
- * @param user
- * user details to set
- * @param options
- * room options to set
- *
- * @return - secure hash or error code
- * @throws ServiceException
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#getRoomHash(java.lang.String, org.apache.openmeetings.db.dto.user.ExternalUserDTO, org.apache.openmeetings.db.dto.room.RoomOptionsDTO)
*/
+ @Override
@WebMethod
@POST
@Path("/hash")
@@ -337,16 +299,10 @@ public class UserWebService {
return new ServiceResult(-1L, "Unknown error", Type.ERROR);
}
- /**
- * Kick a user by its public SID
- *
- * @param sid
- * The SID from getSession
- * @param publicSID
- * the publicSID (you can get it from the call to get users in a
- * room)
- * @return - <code>true</code> if user was kicked
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#kick(java.lang.String, java.lang.String)
*/
+ @Override
@WebMethod
@POST
@Path("/kick/{publicsid}")
@@ -366,14 +322,10 @@ public class UserWebService {
}
}
- /**
- * Returns the count of users currently in the Room with given id
- * No admin rights are necessary for this call
- *
- * @param sid The SID from UserService.getSession
- * @param roomId id of the room to get users
- * @return number of users as int
+ /* (non-Javadoc)
+ * @see org.apache.openmeetings.webservice.cluster.UserService#count(java.lang.String, java.lang.Long)
*/
+ @Override
@WebMethod
@GET
@Path("/count/{roomid}")
Modified: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java?rev=1737461&r1=1737460&r2=1737461&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java (original)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java Sat Apr 2 05:58:44 2016
@@ -19,6 +19,9 @@
package org.apache.openmeetings.webservice.cluster;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.webservice.Constants.TNS;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_NAME;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_PORT_NAME;
import java.net.URL;
@@ -27,7 +30,6 @@ import javax.xml.ws.Service;
import org.apache.openmeetings.db.dto.basic.ServiceResult;
import org.apache.openmeetings.db.entity.server.Server;
-import org.apache.openmeetings.webservice.UserWebService;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
@@ -41,6 +43,8 @@ import org.slf4j.Logger;
*/
public class RestClient {
private static final Logger log = Red5LoggerFactory.getLogger(RestClient.class, webAppRootKey);
+ private final static QName USER_SERVICE_QNAME = new QName(TNS, USER_SERVICE_NAME);
+ private final static QName USER_SERVICE_PORT_QNAME = new QName(TNS, USER_SERVICE_PORT_NAME);
private enum Action {
//kick the user from the server
@@ -60,8 +64,7 @@ public class RestClient {
private String publicSID;
private String getUserServiceWsdl() {
- return protocol + "://" + host + ":" + port + "/" + webapp
- + "/services/UserService?wsdl";
+ return String.format("%s://%s:%s/%s/services/UserService?wsdl", protocol, host, port, webapp);
}
/**
@@ -76,7 +79,6 @@ public class RestClient {
* @param pass
*/
public RestClient(Server server) {
- //this.server = server;
this.host = server.getAddress();
this.port = server.getPort();
this.protocol = server.getProtocol();
@@ -91,8 +93,7 @@ public class RestClient {
* @param strings
*/
public static void main(String... strings) {
- RestClient rClient = new RestClient("127.0.0.1", 5080, "http",
- "openmeetings", "swagner", "qweqwe");
+ RestClient rClient = new RestClient("127.0.0.1", 5080, "http", "openmeetings", "admin", "12345");
try {
rClient.loginUser(Action.KICK_USER);
} catch (Exception e) {
@@ -114,8 +115,7 @@ public class RestClient {
* @param user
* @param pass
*/
- private RestClient(String host, int port, String protocol, String webapp,
- String user, String pass) {
+ private RestClient(String host, int port, String protocol, String webapp, String user, String pass) {
this.host = host;
this.port = port;
this.protocol = protocol;
@@ -131,46 +131,27 @@ public class RestClient {
* @return
*/
public boolean hasServerDetailsChanged(Server server2) {
-
- if (!host.equals(server2.getAddress())) {
- return true;
- }
- if (port != server2.getPort()) {
- return true;
- }
- if (!user.equals(server2.getUser())) {
- return true;
- }
- if (!pass.equals(server2.getPass())) {
- return true;
- }
- if (!webapp.equals(server2.getWebapp())) {
- return true;
- }
- if (!protocol.equals(server2.getProtocol())) {
- return true;
- }
-
- return false;
+ return !host.equals(server2.getAddress())
+ || port != server2.getPort()
+ || !user.equals(server2.getUser())
+ || !pass.equals(server2.getPass())
+ || !webapp.equals(server2.getWebapp())
+ || !protocol.equals(server2.getProtocol());
}
-
- /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- * TODO double check this
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- */
- private UserWebService getUserClient() throws Exception {
+
+ private UserService getUserClient() throws Exception {
URL wsdlURL = new URL(getUserServiceWsdl());
- QName SERVICE_NAME = new QName("UserService");
- Service service = Service.create(wsdlURL, SERVICE_NAME);
- return service.getPort(UserWebService.class);
+ Service service = Service.create(wsdlURL, USER_SERVICE_QNAME);
+ return service.getPort(USER_SERVICE_PORT_QNAME, UserService.class);
}
+
/**
* Login the user via REST
*
* @throws Exception
*/
public void loginUser(Action action) throws Exception {
- UserWebService client = getUserClient();
+ UserService client = getUserClient();
ServiceResult result = client.login(user, pass);
@@ -201,7 +182,7 @@ public class RestClient {
loginUser(Action.KICK_USER);
}
- UserWebService client = getUserClient();
+ UserService client = getUserClient();
ServiceResult result = client.kick(sessionId, publicSID);
if (result.getCode() == 0) {
Added: openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/UserService.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/UserService.java?rev=1737461&view=auto
==============================================================================
--- openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/UserService.java (added)
+++ openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/UserService.java Sat Apr 2 05:58:44 2016
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.webservice.cluster;
+
+import static org.apache.openmeetings.webservice.Constants.TNS;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_NAME;
+import static org.apache.openmeetings.webservice.Constants.USER_SERVICE_PORT_NAME;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+
+import org.apache.openmeetings.db.dto.basic.ServiceResult;
+import org.apache.openmeetings.db.dto.room.RoomOptionsDTO;
+import org.apache.openmeetings.db.dto.user.ExternalUserDTO;
+import org.apache.openmeetings.db.dto.user.UserDTO;
+import org.apache.openmeetings.webservice.error.ServiceException;
+
+/**
+ * This interface is required for RestClient
+ */
+@WebService(serviceName = USER_SERVICE_NAME, targetNamespace = TNS, portName = USER_SERVICE_PORT_NAME)
+public interface UserService {
+
+ /**
+ * @param user - login or email of Openmeetings user with admin or SOAP-rights
+ * @param pass - password
+ *
+ * @return - {@link ServiceResult} with error code or SID and userId
+ */
+ ServiceResult login(@WebParam(name="user") @QueryParam("user") String user, @WebParam(name="pass") @QueryParam("pass") String pass);
+
+ /**
+ * Adds a new User like through the Frontend, but also does activates the
+ * Account To do SSO see the methods to create a hash and use those ones!
+ *
+ * @param sid
+ * The SID from getSession
+ * @param user
+ * user object
+ * @param confirm
+ * whatever or not to send email, leave empty for auto-send
+ *
+ * @return - id of the user added or error code
+ * @throws ServiceException
+ */
+ UserDTO add(
+ @WebParam(name="sid") @QueryParam("sid") String sid
+ , @WebParam(name="user") @QueryParam("user") UserDTO user
+ , @WebParam(name="confirm") @QueryParam("confirm") Boolean confirm
+ ) throws ServiceException;
+
+ /**
+ *
+ * Delete a certain user by its id
+ *
+ * @param sid
+ * The SID from getSession
+ * @param id
+ * the openmeetings user id
+ *
+ * @return - id of the user deleted, error code otherwise
+ * @throws ServiceException
+ */
+ ServiceResult delete(@WebParam(name="sid") @QueryParam("sid") String sid, @WebParam(name="id") @PathParam("id") long id) throws ServiceException;
+
+ /**
+ *
+ * Delete a certain user by its external user id
+ *
+ * @param sid
+ * The SID from getSession
+ * @param externalId
+ * externalUserId
+ * @param externalType
+ * externalUserId
+ *
+ * @return - id of user deleted, or error code
+ * @throws ServiceException
+ */
+ ServiceResult deleteExternal(
+ @WebParam(name="sid") @QueryParam("sid") String sid
+ , @WebParam(name="externaltype") @PathParam("externaltype") String externalType
+ , @WebParam(name="externalid") @PathParam("externalid") String externalId
+ ) throws ServiceException;
+
+ /**
+ * Description: sets the SessionObject for a certain SID, after setting this
+ * Session-Object you can use the SID + a RoomId to enter any Room. ...
+ * Session-Hashs are deleted 15 minutes after the creation if not used.
+ *
+ * @param sid
+ * The SID from getSession
+ * @param user
+ * user details to set
+ * @param options
+ * room options to set
+ *
+ * @return - secure hash or error code
+ * @throws ServiceException
+ */
+ ServiceResult getRoomHash(
+ @WebParam(name="sid") @QueryParam("sid") String sid
+ , @WebParam(name="user") @FormParam("user") ExternalUserDTO user
+ , @WebParam(name="options") @FormParam("options") RoomOptionsDTO options
+ ) throws ServiceException;
+
+ /**
+ * Kick a user by its public SID
+ *
+ * @param sid
+ * The SID from getSession
+ * @param publicSID
+ * the publicSID (you can get it from the call to get users in a
+ * room)
+ * @return - <code>true</code> if user was kicked
+ */
+ ServiceResult kick(@WebParam(name="sid") @QueryParam("sid") String sid, @WebParam(name="publicsid") @PathParam("publicsid") String publicSID) throws ServiceException;
+
+ /**
+ * Returns the count of users currently in the Room with given id
+ * No admin rights are necessary for this call
+ *
+ * @param sid The SID from UserService.getSession
+ * @param roomId id of the room to get users
+ * @return number of users as int
+ */
+ int count(@WebParam(name="sid") @QueryParam("sid") String sid, @WebParam(name="roomid") @PathParam("roomid") Long roomId);
+}