Author: eschwert
Date: Fri Feb 24 00:17:58 2012
New Revision: 1293038

URL: http://svn.apache.org/viewvc?rev=1293038&view=rev
Log:
OPENMEETINGS-60 Dynamic URL,Port configuration for roomlink. Organize code.

Modified:
    
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/OmPluginSettings.java
    
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java
    
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java
    
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/AdminServlet.java
    
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/RoomsServlet.java

Modified: 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/OmPluginSettings.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/OmPluginSettings.java?rev=1293038&r1=1293037&r2=1293038&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/OmPluginSettings.java
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/OmPluginSettings.java
 Fri Feb 24 00:17:58 2012
@@ -1,6 +1,5 @@
 package org.openmeetings.jira.plugin.ao.adminconfiguration;
 
-import org.openmeetings.jira.plugin.servlet.AdminServlet;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java?rev=1293038&r1=1293037&r2=1293038&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java
 Fri Feb 24 00:17:58 2012
@@ -2,22 +2,15 @@ package org.openmeetings.jira.plugin.gat
 
 import java.io.IOException;
 import java.util.LinkedHashMap;
-
 import javax.servlet.ServletException;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.xpath.XPathExpressionException;
-
 import org.openmeetings.jira.plugin.ao.adminconfiguration.OmPluginSettings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
-
-import org.dom4j.Document;
 import org.dom4j.DocumentException;
 import org.dom4j.Element;
-import org.dom4j.io.SAXReader;
-
-import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory;
 
 public class OmGateway {
        

Modified: 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java?rev=1293038&r1=1293037&r2=1293038&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java
 Fri Feb 24 00:17:58 2012
@@ -5,43 +5,26 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 
 import javax.servlet.ServletException;
-import javax.xml.parsers.DocumentBuilderFactory;
+import javax.ws.rs.core.UriBuilder;
 import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.*;
-
-import org.w3c.dom.*;
-import org.xml.sax.SAXException;
+import javax.xml.xpath.XPathExpressionException;
 
 import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
 import org.dom4j.Document;
 import org.dom4j.DocumentException;
 import org.dom4j.Element;
 import org.dom4j.io.SAXReader;
-import org.openmeetings.jira.plugin.ao.adminconfiguration.OmPluginSettings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.representation.Form;
-
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriBuilder;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
+import org.xml.sax.SAXException;
 
 
 public class OmRestService {
@@ -55,14 +38,10 @@ public class OmRestService {
        
        private  String getEncodetURI(String url) throws MalformedURLException {
                return new URL(url).toString().replaceAll(" ","%20");
-       }
-       
-       
+       }       
        
        public LinkedHashMap<String, Element> call(String request, Object 
param)throws IOException, ServletException, SAXException, 
ParserConfigurationException, XPathExpressionException, DocumentException
-       {
-               
-               //String request= 
"http://localhost:5080/openmeetings/services/UserService/getSession";;
+       {                               
                HttpClient client = new HttpClient();
 
         GetMethod method = new GetMethod(getEncodetURI(request).toString());

Modified: 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/AdminServlet.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/AdminServlet.java?rev=1293038&r1=1293037&r2=1293038&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/AdminServlet.java
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/AdminServlet.java
 Fri Feb 24 00:17:58 2012
@@ -1,38 +1,20 @@
 package org.openmeetings.jira.plugin.servlet;
 
-
 import java.io.IOException;
-import java.io.PrintWriter;
 import java.net.URI;
-import java.util.List;
 import java.util.Map;
-
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import org.openmeetings.jira.plugin.ao.adminconfiguration.OmPluginSettings;
-import org.openmeetings.jira.plugin.ao.omrooms.Room;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import com.atlassian.activeobjects.external.ActiveObjects;
 import com.atlassian.crowd.embedded.api.User;
-import com.atlassian.jira.bc.issue.IssueService;
-import com.atlassian.jira.issue.Issue;
-import com.atlassian.jira.issue.IssueInputParameters;
-import com.atlassian.jira.issue.MutableIssue;
-import com.atlassian.jira.project.Project;
-import com.atlassian.sal.api.auth.LoginUriProvider;
-import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory;
-import com.atlassian.sal.api.transaction.TransactionCallback;
 import com.atlassian.sal.api.user.UserManager;
 import com.atlassian.templaterenderer.TemplateRenderer;
 import com.google.common.collect.Maps;
 
-import static com.google.common.base.Preconditions.*;
-
 public class AdminServlet extends HttpServlet
 {
        private static final Logger log = 
LoggerFactory.getLogger(AdminServlet.class);

Modified: 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/RoomsServlet.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/RoomsServlet.java?rev=1293038&r1=1293037&r2=1293038&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/RoomsServlet.java
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/RoomsServlet.java
 Fri Feb 24 00:17:58 2012
@@ -1,50 +1,34 @@
 package org.openmeetings.jira.plugin.servlet;
 
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.xpath.XPathExpressionException;
-
-
 import org.dom4j.DocumentException;
-import org.jfree.util.Log;
+import org.openmeetings.jira.plugin.ao.adminconfiguration.OmPluginSettings;
 import org.openmeetings.jira.plugin.ao.omrooms.Room;
 import org.openmeetings.jira.plugin.ao.omrooms.RoomService;
 import org.openmeetings.jira.plugin.gateway.OmGateway;
-import org.openmeetings.jira.plugin.gateway.OmRestService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
-
 import com.atlassian.crowd.embedded.api.User;
+import com.atlassian.jira.avatar.Avatar;
+import com.atlassian.jira.avatar.AvatarManager;
+import com.atlassian.jira.util.velocity.VelocityRequestContextFactory;
 import com.atlassian.sal.api.user.UserManager;
-import com.atlassian.jira.ComponentManager;
-import com.atlassian.jira.functest.framework.UserProfile;
-import com.atlassian.jira.issue.Issue;
-import com.atlassian.jira.user.util.DefaultUserManager;
 import com.atlassian.templaterenderer.TemplateRenderer;
 import com.google.common.collect.Maps;
 
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.URI;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.*;
-
-import com.atlassian.jira.util.velocity.VelocityRequestContextFactory;
-import com.atlassian.jira.avatar.Avatar;
-import com.atlassian.jira.avatar.Avatar.Type;
-import com.atlassian.jira.avatar.AvatarManager;
-import com.atlassian.jira.avatar.AvatarService;
-import com.atlassian.crowd.embedded.api.UserWithAttributes;
-
  
 public final class RoomsServlet extends HttpServlet
 {
@@ -57,6 +41,7 @@ public final class RoomsServlet extends 
     private com.atlassian.jira.user.util.UserManager jiraUserManager;
        private String roomURL;
        protected final VelocityRequestContextFactory requestContextFactory;
+       private OmPluginSettings omPluginSettings;
        
        private final AvatarManager avatarManager;      
        
@@ -67,7 +52,7 @@ public final class RoomsServlet extends 
     private static final String EDIT_BROWSER_TEMPLATE = 
"/templates/omrooms/edit.vm";
     private static final String ENTER_BROWSER_TEMPLATE = 
"/templates/omrooms/enter.vm";
  
-    public RoomsServlet(VelocityRequestContextFactory requestContextFactory, 
AvatarManager avatarManager, RoomService roomService, TemplateRenderer 
templateRenderer, OmGateway omGateway, com.atlassian.jira.user.util.UserManager 
jiraUserManager, UserManager userManager)
+    public RoomsServlet(OmPluginSettings omPluginSettings, 
VelocityRequestContextFactory requestContextFactory, AvatarManager 
avatarManager, RoomService roomService, TemplateRenderer templateRenderer, 
OmGateway omGateway, com.atlassian.jira.user.util.UserManager jiraUserManager, 
UserManager userManager)
     {
         this.roomService = checkNotNull(roomService);
         this.templateRenderer = templateRenderer;
@@ -76,6 +61,7 @@ public final class RoomsServlet extends 
         this.userManager = userManager;
         this.avatarManager = avatarManager;
         this.requestContextFactory = requestContextFactory;
+        this.omPluginSettings = omPluginSettings;
         
     }
  
@@ -93,10 +79,9 @@ public final class RoomsServlet extends 
     @Override
     protected void doGet(HttpServletRequest req, HttpServletResponse res) 
throws ServletException, IOException
     {
-       User currentUser = getCurrentUser(req);
-       System.out.println("currentUser: "+currentUser.getName());
-               User currentUser2 = 
ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser();
-       System.out.println("currentUser2: "+currentUser2.getName());
+       User currentUser = getCurrentUser(req);         
+               //User currentUser2 = 
ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser();
+       
         
         if ("y".equals(req.getParameter("new"))) {
                // Renders new.vm template if the "new" parameter is passed     
       
@@ -126,53 +111,31 @@ public final class RoomsServlet extends 
                try {
                                if(omGateway.loginUser()){
                                        
-                                       //authContext.getUser().getName();
-                                       
//com.atlassian.jira.ComponentManager.getInstance().getJiraAuthenticationContext().getUser();
+                                       String url = 
(String)omPluginSettings.getSomeInfo("url"); 
+                               String port = 
(String)omPluginSettings.getSomeInfo("port");  
                                                                                
-                                       Long directoryId = 
currentUser.getDirectoryId();
                                        String firsname = 
currentUser.getDisplayName();
                                        String email = 
currentUser.getEmailAddress();
                                        Long userId = new Date().getTime();
                                        String username = currentUser.getName();
                                        int becomeModeratorAsInt = 1;
                                        int showAudioVideoTestAsInt = 1;
-                                       
-                                       
-                                       System.out.println("directoryId: 
"+directoryId);
-                                       System.out.println("username: 
"+username);
                                                                                
                                         String avatarId = 
this.avatarManager.getDefaultAvatarId(Avatar.Type.USER).toString();             
                      
                                         //URI avatarUrl = 
avatarService.getAvatarURL(currentUser, avatarId, Avatar.Size.SMALL);
                                         //String profilePictureUrl = 
avatarUrl.toString();
                                         String profilePictureUrl = 
this.getCanonicalBaseUrl() + "/secure/projectavatar?avatarId=" + avatarId + 
"&size=small";
                                         
-
-                                        
-//                                     String userEmail;
-//                             UserProfile userProfile = 
userService.getUserProfile(reviewData.getAuthor().getUserName());
-//                             if (userProfile != null) {
-//                                     userEmail = userProfile.getEmail();
-//                             }
-                                        
                                        Long roomId = 
Long.valueOf(req.getParameter("roomId"));
                                        
-                                       String roomHash = 
omGateway.setUserObjectAndGenerateRoomHash(username, 
-                                                                               
                                                                                
firsname, 
-                                                                               
                                                                                
"", 
-                                                                               
                                                                                
profilePictureUrl, 
-                                                                               
                                                                                
email, 
-                                                                               
                                                                                
userId, 
-                                                                               
                                                                                
"jira", 
-                                                                               
                                                                                
roomId, 
-                                                                               
                                                                                
becomeModeratorAsInt, 
+                                       String roomHash = 
omGateway.setUserObjectAndGenerateRoomHash(username, firsname, "", 
profilePictureUrl, 
+                                                                               
                                                                                
email, userId, "jira",  roomId, 
+                                                                               
                                                                                
becomeModeratorAsInt,
                                                                                
                                                                                
showAudioVideoTestAsInt);
                                        
                                        
                                        if(!roomHash.isEmpty()){
-                                               
-                                               String url = "localhost"; 
-                                       String port = "5080"; 
-                                               
+                               
                                                this.roomURL = 
"http://"+url+":"+port+
                                                                
"/openmeetings/?"+
                                                                "scopeRoomId=" 
+ roomId +
@@ -219,12 +182,11 @@ public final class RoomsServlet extends 
     @Override
     protected void doPost(HttpServletRequest req, HttpServletResponse res) 
throws ServletException, IOException
     {
-       User currentUser = getCurrentUser(req);
-       System.out.println("currentUser: "+currentUser.getName());
-       User currentUser2 = 
ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser();
+       User currentUser = getCurrentUser(req);  
        //Second variant to get current user object. 
+       //User currentUser2 = 
ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser();
          
        //User user2 = (User) 
ComponentManager.getInstance().getJiraAuthenticationContext().getUser();
-       System.out.println("currentUser22: "+currentUser2);
+       
        
        if ("y".equals(req.getParameter("edit"))) {
                


Reply via email to