Revision: 4123
Author:   seba.wagner
Date:     Sun Aug 28 09:08:20 2011
Log:      Catch Application Context Errors in Axis2 Services
http://code.google.com/p/openmeetings/source/detail?r=4123

Modified:
/branches/dev/injection/src/fileservice/org/openmeetings/axis/services/FileServiceAxis2Proxy.java /branches/dev/injection/src/roomservice/org/openmeetings/axis/services/RoomServiceAxis2Proxy.java /branches/dev/injection/src/userservice/org/openmeetings/axis/services/UserServiceAxis2Proxy.java

=======================================
--- /branches/dev/injection/src/fileservice/org/openmeetings/axis/services/FileServiceAxis2Proxy.java Sun Aug 28 01:56:14 2011 +++ /branches/dev/injection/src/fileservice/org/openmeetings/axis/services/FileServiceAxis2Proxy.java Sun Aug 28 09:08:20 2011
@@ -8,21 +8,32 @@
 import org.openmeetings.app.data.file.dto.FileExplorerObject;
 import org.openmeetings.app.data.file.dto.LibraryPresentation;
 import org.openmeetings.app.persistence.beans.files.FileExplorerItem;
+import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
 import org.springframework.context.ApplicationContext;
 import org.springframework.web.context.support.WebApplicationContextUtils;

 public class FileServiceAxis2Proxy {

-       private ServletContext getServletContext() {
+       private static final Logger log = Red5LoggerFactory.getLogger(
+                       FileServiceAxis2Proxy.class, 
ScopeApplicationAdapter.webAppRootKey);
+
+       private ServletContext getServletContext() throws Exception {
                MessageContext mc = MessageContext.getCurrentMessageContext();
                return (ServletContext) mc
                                
.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT);
        }

        private FileWebService geFileServiceProxy() {
-               ApplicationContext context = WebApplicationContextUtils
-                               .getWebApplicationContext(getServletContext());
-               return (FileWebService) context.getBean("fileServiceSoapProxy");
+               try {
+                       ApplicationContext context = WebApplicationContextUtils
+                                       
.getWebApplicationContext(getServletContext());
+                       return (FileWebService) 
context.getBean("fileServiceSoapProxy");
+               } catch (Exception err) {
+                       log.error("[geRoomServiceProxy]", err);
+               }
+               return null;
        }

        /**
=======================================
--- /branches/dev/injection/src/roomservice/org/openmeetings/axis/services/RoomServiceAxis2Proxy.java Sun Aug 28 01:56:14 2011 +++ /branches/dev/injection/src/roomservice/org/openmeetings/axis/services/RoomServiceAxis2Proxy.java Sun Aug 28 09:08:20 2011
@@ -12,21 +12,32 @@
 import org.openmeetings.app.persistence.beans.flvrecord.FlvRecording;
 import org.openmeetings.app.persistence.beans.rooms.RoomTypes;
 import org.openmeetings.app.persistence.beans.rooms.Rooms;
+import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
 import org.springframework.context.ApplicationContext;
 import org.springframework.web.context.support.WebApplicationContextUtils;

 public class RoomServiceAxis2Proxy {

-       private ServletContext getServletContext() {
+       private static final Logger log = Red5LoggerFactory.getLogger(
+                       RoomServiceAxis2Proxy.class, 
ScopeApplicationAdapter.webAppRootKey);
+
+       private ServletContext getServletContext() throws Exception {
                MessageContext mc = MessageContext.getCurrentMessageContext();
                return (ServletContext) mc
                                
.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT);
        }

        private RoomWebService geRoomServiceProxy() {
-               ApplicationContext context = WebApplicationContextUtils
-                               .getWebApplicationContext(getServletContext());
-               return (RoomWebService) context.getBean("roomServiceSoapProxy");
+               try {
+                       ApplicationContext context = WebApplicationContextUtils
+                                       
.getWebApplicationContext(getServletContext());
+                       return (RoomWebService) 
context.getBean("roomServiceSoapProxy");
+               } catch (Exception err) {
+                       log.error("[geRoomServiceProxy]", err);
+               }
+               return null;
        }

        // TODO: Not implemented yet
@@ -101,7 +112,8 @@
         * @return
         */
        @Deprecated
-       public Rooms getRoomWithCurrentUsersById(String SID, long rooms_id) {
+       public Rooms getRoomWithCurrentUsersById(String SID, long rooms_id)
+                       throws AxisFault {
                return 
this.geRoomServiceProxy().getRoomWithCurrentUsersById(SID,
                                rooms_id);
        }
@@ -113,13 +125,13 @@
        }

        public SearchResult getRooms(String SID, int start, int max,
-                       String orderby, boolean asc) {
+                       String orderby, boolean asc) throws AxisFault {
                return this.geRoomServiceProxy()
                                .getRooms(SID, start, max, orderby, asc);
        }

        public SearchResult getRoomsWithCurrentUsers(String SID, int start,
-                       int max, String orderby, boolean asc) {
+                       int max, String orderby, boolean asc) throws AxisFault {
                return this.geRoomServiceProxy().getRoomsWithCurrentUsers(SID, 
start,
                                max, orderby, asc);
        }
@@ -162,7 +174,7 @@
                        Integer whiteBoardPanelHeight, Integer 
whiteBoardPanelWidth,
                        Boolean showFilesPanel, Integer filesPanelXPosition,
                        Integer filesPanelYPosition, Integer filesPanelHeight,
-                       Integer filesPanelWidth) {
+                       Integer filesPanelWidth) throws AxisFault {
                return this.geRoomServiceProxy().addRoom(SID, name, 
roomtypes_id,
                                comment, numberOfPartizipants, ispublic, 
videoPodWidth,
                                videoPodHeight, videoPodXPosition, 
videoPodYPosition,
@@ -176,7 +188,7 @@
        public Long addRoomWithModeration(String SID, String name,
                        Long roomtypes_id, String comment, Long 
numberOfPartizipants,
                        Boolean ispublic, Boolean appointment, Boolean 
isDemoRoom,
-                       Integer demoTime, Boolean isModeratedRoom) {
+                       Integer demoTime, Boolean isModeratedRoom) throws 
AxisFault {
                return this.geRoomServiceProxy().addRoomWithModeration(SID, 
name,
                                roomtypes_id, comment, numberOfPartizipants, 
ispublic,
                                appointment, isDemoRoom, demoTime, 
isModeratedRoom);
@@ -204,7 +216,7 @@
                        Long roomtypes_id, String comment, Long 
numberOfPartizipants,
                        Boolean ispublic, Boolean appointment, Boolean 
isDemoRoom,
                        Integer demoTime, Boolean isModeratedRoom,
-                       Boolean allowUserQuestions) {
+                       Boolean allowUserQuestions) throws AxisFault {
                return 
this.geRoomServiceProxy().addRoomWithModerationAndQuestions(SID,
                                name, roomtypes_id, comment, 
numberOfPartizipants, ispublic,
                                appointment, isDemoRoom, demoTime, 
isModeratedRoom,
@@ -289,7 +301,7 @@
                        Integer whiteBoardPanelHeight, Integer 
whiteBoardPanelWidth,
                        Boolean showFilesPanel, Integer filesPanelXPosition,
                        Integer filesPanelYPosition, Integer filesPanelHeight,
-                       Integer filesPanelWidth, Boolean appointment) {
+                       Integer filesPanelWidth, Boolean appointment) throws 
AxisFault {
                return this.geRoomServiceProxy().updateRoom(SID, rooms_id, name,
                                roomtypes_id, comment, numberOfPartizipants, 
ispublic,
                                videoPodWidth, videoPodHeight, 
videoPodXPosition,
@@ -303,7 +315,7 @@
public Long updateRoomWithModeration(String SID, Long room_id, String name,
                        Long roomtypes_id, String comment, Long 
numberOfPartizipants,
                        Boolean ispublic, Boolean appointment, Boolean 
isDemoRoom,
-                       Integer demoTime, Boolean isModeratedRoom) {
+                       Integer demoTime, Boolean isModeratedRoom) throws 
AxisFault {
                return this.geRoomServiceProxy().updateRoomWithModeration(SID, 
room_id,
                                name, roomtypes_id, comment, 
numberOfPartizipants, ispublic,
                                appointment, isDemoRoom, demoTime, 
isModeratedRoom);
@@ -313,24 +325,25 @@
                        String name, Long roomtypes_id, String comment,
                        Long numberOfPartizipants, Boolean ispublic, Boolean 
appointment,
                        Boolean isDemoRoom, Integer demoTime, Boolean 
isModeratedRoom,
-                       Boolean allowUserQuestions) {
+                       Boolean allowUserQuestions) throws AxisFault {
                return this.geRoomServiceProxy().updateRoomWithModeration(SID, 
room_id,
                                name, roomtypes_id, comment, 
numberOfPartizipants, ispublic,
                                appointment, isDemoRoom, demoTime, 
isModeratedRoom);
        }

-       public Long deleteRoom(String SID, long rooms_id) {
+       public Long deleteRoom(String SID, long rooms_id) throws AxisFault {
                return this.geRoomServiceProxy().deleteRoom(SID, rooms_id);
        }

-       public Boolean kickUser(String SID_Admin, Long room_id) {
+       public Boolean kickUser(String SID_Admin, Long room_id) throws 
AxisFault {
                return this.geRoomServiceProxy().kickUser(SID_Admin, room_id);
        }

        public Long addRoomWithModerationAndExternalType(String SID, String 
name,
                        Long roomtypes_id, String comment, Long 
numberOfPartizipants,
                        Boolean ispublic, Boolean appointment, Boolean 
isDemoRoom,
-                       Integer demoTime, Boolean isModeratedRoom, String 
externalRoomType) {
+                       Integer demoTime, Boolean isModeratedRoom, String 
externalRoomType)
+                       throws AxisFault {
                return 
this.geRoomServiceProxy().addRoomWithModerationAndExternalType(
                                SID, name, roomtypes_id, comment, 
numberOfPartizipants,
                                ispublic, appointment, isDemoRoom, demoTime, 
isModeratedRoom,
@@ -342,7 +355,7 @@
                        Long numberOfPartizipants, Boolean ispublic, Boolean 
appointment,
                        Boolean isDemoRoom, Integer demoTime, Boolean 
isModeratedRoom,
                        String externalRoomType, Boolean allowUserQuestions,
-                       Boolean isAudioOnly) {
+                       Boolean isAudioOnly) throws AxisFault {
                return this.geRoomServiceProxy()
                                
.addRoomWithModerationExternalTypeAndAudioType(SID, name,
                                                roomtypes_id, comment, 
numberOfPartizipants, ispublic,
@@ -355,7 +368,7 @@
                        Boolean ispublic, Boolean appointment, Boolean 
isDemoRoom,
                        Integer demoTime, Boolean isModeratedRoom, String 
externalRoomType,
                        Boolean allowUserQuestions, Boolean isAudioOnly,
-                       Boolean waitForRecording, Boolean allowRecording) {
+                       Boolean waitForRecording, Boolean allowRecording) 
throws AxisFault {
                return this.geRoomServiceProxy()
                                .addRoomWithModerationAndRecordingFlags(SID, 
name,
                                                roomtypes_id, comment, 
numberOfPartizipants, ispublic,
@@ -370,7 +383,7 @@
                        Boolean isDemoRoom, Integer demoTime, Boolean 
isModeratedRoom,
                        String externalRoomType, Boolean allowUserQuestions,
                        Boolean isAudioOnly, Boolean waitForRecording,
-                       Boolean allowRecording, Boolean hideTopBar) {
+                       Boolean allowRecording, Boolean hideTopBar) throws 
AxisFault {
                return this.geRoomServiceProxy()
                                
.addRoomWithModerationExternalTypeAndTopBarOption(SID, name,
                                                roomtypes_id, comment, 
numberOfPartizipants, ispublic,
=======================================
--- /branches/dev/injection/src/userservice/org/openmeetings/axis/services/UserServiceAxis2Proxy.java Sun Aug 28 01:56:14 2011 +++ /branches/dev/injection/src/userservice/org/openmeetings/axis/services/UserServiceAxis2Proxy.java Sun Aug 28 09:08:20 2011
@@ -8,11 +8,17 @@
 import org.openmeetings.app.data.beans.basic.ErrorResult;
 import org.openmeetings.app.data.beans.basic.SearchResult;
 import org.openmeetings.app.persistence.beans.basic.Sessiondata;
+import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
 import org.springframework.context.ApplicationContext;
 import org.springframework.web.context.support.WebApplicationContextUtils;

 public class UserServiceAxis2Proxy {

+       private static final Logger log = Red5LoggerFactory.getLogger(
+                       UserServiceAxis2Proxy.class, 
ScopeApplicationAdapter.webAppRootKey);
+
        // private static final String SPRING_CONTEXT_XML =
        // "openmeetings-applicationContext.xml";
        //
@@ -33,16 +39,21 @@
        //
        // }

-       private ServletContext getServletContext() {
+       private ServletContext getServletContext() throws Exception {
                MessageContext mc = MessageContext.getCurrentMessageContext();
                return (ServletContext) mc
                                
.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT);
        }

        private UserWebService getUserServiceProxy() {
-               ApplicationContext context = WebApplicationContextUtils
-                               .getWebApplicationContext(getServletContext());
-               return (UserWebService) context.getBean("userServiceSoapProxy");
+               try {
+                       ApplicationContext context = WebApplicationContextUtils
+                                       
.getWebApplicationContext(getServletContext());
+                       return (UserWebService) 
context.getBean("userServiceSoapProxy");
+               } catch (Exception err) {
+                       log.error("[getUserServiceProxy]", err);
+               }
+               return null;
        }

        /**
@@ -50,7 +61,7 @@
         *
         * @return Sessiondata-Object
         */
-       public Sessiondata getSession() {
+       public Sessiondata getSession() throws AxisFault {
                return getUserServiceProxy().getSession();
        }

@@ -64,7 +75,8 @@
         *         invoke the Method getErrorByCode to get the Text-Description 
of
         *         that ErrorCode
         */
-       public Long loginUser(String SID, String username, String userpass) {
+       public Long loginUser(String SID, String username, String userpass)
+                       throws AxisFault {
                return getUserServiceProxy().loginUser(SID, username, userpass);
        }

@@ -227,7 +239,7 @@
                        String username, String firstname, String lastname,
                        String profilePictureUrl, String email, Long 
externalUserId,
                        String externalUserType, Long room_id, int 
becomeModeratorAsInt,
-                       int showAudioVideoTestAsInt) {
+                       int showAudioVideoTestAsInt) throws AxisFault {
                return 
getUserServiceProxy().setUserObjectAndGenerateRoomHashByURL(SID,
                                username, firstname, lastname, 
profilePictureUrl, email,
                                externalUserId, externalUserType, room_id,
@@ -238,7 +250,7 @@
                        String username, String firstname, String lastname,
                        String profilePictureUrl, String email, Long 
externalUserId,
                        String externalUserType, Long room_id, int 
becomeModeratorAsInt,
-                       int showAudioVideoTestAsInt, int allowRecording) {
+                       int showAudioVideoTestAsInt, int allowRecording) throws 
AxisFault {
                return getUserServiceProxy()
                                
.setUserObjectAndGenerateRoomHashByURLAndRecFlag(SID, username,
                                                firstname, lastname, 
profilePictureUrl, email,
@@ -249,7 +261,8 @@

        public String setUserObjectMainLandingZone(String SID, String username,
                        String firstname, String lastname, String 
profilePictureUrl,
-                       String email, Long externalUserId, String 
externalUserType) {
+                       String email, Long externalUserId, String 
externalUserType)
+                       throws AxisFault {
                return getUserServiceProxy().setUserObjectMainLandingZone(SID,
                                username, firstname, lastname, 
profilePictureUrl, email,
                                externalUserId, externalUserType);
@@ -259,7 +272,8 @@
                        String firstname, String lastname, String 
profilePictureUrl,
                        String email, Long externalUserId, String 
externalUserType,
                        Long room_id, int becomeModeratorAsInt,
-                       int showAudioVideoTestAsInt, int 
showNickNameDialogAsInt) {
+                       int showAudioVideoTestAsInt, int 
showNickNameDialogAsInt)
+                       throws AxisFault {
                return getUserServiceProxy().setUserAndNickName(SID, username,
                                firstname, lastname, profilePictureUrl, email, 
externalUserId,
                                externalUserType, room_id, becomeModeratorAsInt,
@@ -268,7 +282,8 @@

        public String setUserObjectAndGenerateRecordingHashByURL(String SID,
                        String username, String firstname, String lastname,
-                       Long externalUserId, String externalUserType, Long 
recording_id) {
+                       Long externalUserId, String externalUserType, Long 
recording_id)
+                       throws AxisFault {
                return getUserServiceProxy()
                                
.setUserObjectAndGenerateRecordingHashByURL(SID, username,
                                                firstname, lastname, 
externalUserId, externalUserType,
@@ -276,19 +291,21 @@
        }

        public Long addUserToOrganisation(String SID, Long user_id,
-                       Long organisation_id, Long insertedby, String comment) {
+                       Long organisation_id, Long insertedby, String comment)
+                       throws AxisFault {
                return getUserServiceProxy().addUserToOrganisation(SID, user_id,
                                organisation_id, insertedby, comment);
        }

        public SearchResult getUsersByOrganisation(String SID,
                        long organisation_id, int start, int max, String 
orderby,
-                       boolean asc) {
+                       boolean asc) throws AxisFault {
                return getUserServiceProxy().getUsersByOrganisation(SID,
                                organisation_id, start, max, orderby, asc);
        }

-       public Boolean kickUserByPublicSID(String SID, String publicSID) {
+       public Boolean kickUserByPublicSID(String SID, String publicSID)
+                       throws AxisFault {
                return getUserServiceProxy().kickUserByPublicSID(SID, 
publicSID);
        }

--
You received this message because you are subscribed to the Google Groups 
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/openmeetings-dev?hl=en.

Reply via email to