You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by gg...@apache.org on 2012/07/19 10:27:01 UTC
svn commit: r1363260 -
/incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigManager.java
Author: ggrekhov
Date: Thu Jul 19 08:27:01 2012
New Revision: 1363260
URL: http://svn.apache.org/viewvc?rev=1363260&view=rev
Log:
Jitsi: remove warnings
Modified:
incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigManager.java
Modified: incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigManager.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigManager.java?rev=1363260&r1=1363259&r2=1363260&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigManager.java (original)
+++ incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigManager.java Thu Jul 19 08:27:01 2012
@@ -1,19 +1,5 @@
package net.java.sip.communicator.plugin.openmeetings;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.*;
-
-import javax.xml.soap.SOAPException;
-
// import net.java.sip.communicator.impl.protocol.zeroconf.MessageZeroconfImpl;
import net.java.sip.communicator.service.configuration.ConfigurationService;
import net.java.sip.communicator.util.Logger;
@@ -35,11 +21,7 @@ public class OpenmeetingsConfigManager
private String password;
- private String stringForHash = "user:";
-
- private String hash;
-
- OpenmeetingsPluginSoapClient soapClient;
+ private OpenmeetingsPluginSoapClient soapClient;
private static BundleContext bundleContext;
@@ -66,79 +48,6 @@ public class OpenmeetingsConfigManager
return instance;
}
- private static String convertToHex(byte[] data)
- {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < data.length; i++)
- {
- int halfbyte = (data[i] >>> 4) & 0x0F;
- int two_halfs = 0;
- do
- {
- if ((0 <= halfbyte) && (halfbyte <= 9))
- buf.append((char) ('0' + halfbyte));
- else
- buf.append((char) ('a' + (halfbyte - 10)));
- halfbyte = data[i] & 0x0F;
- }
- while (two_halfs++ < 1);
- }
- return buf.toString();
- }
-
- private String getHash() throws Exception
- {
-
- if (hash != null)
- return hash;
-
- byte[] bytesOfMessage = null;
- try
- {
- bytesOfMessage = stringForHash.getBytes("UTF-8");
- }
- catch (UnsupportedEncodingException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] thedigest = md.digest(bytesOfMessage);
-
- final String hash = convertToHex(thedigest);
- return hash;
- }
-
- private String getMd5Hash(String str) throws Exception
- {
-
- byte[] bytesOfMessage = null;
- try
- {
- bytesOfMessage = str.getBytes("UTF-8");
- }
- catch (UnsupportedEncodingException e)
- {
- System.out.println(e.getMessage());
- }
-
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] thedigest = md.digest(bytesOfMessage);
-
- final String hash = convertToHex(thedigest);
- return hash;
- }
-
- public String getCreationUrl() throws Exception
- {
- final String url =
- getProtoPrefix() + getServer() + "/client/username=" + getLogin()
- + "&password=" + getPassword() + "&hash=" + getHash();
- System.out.println("CREATION URL = " + url);
- return url;
- }
-
public String createInvitationUrl(String hash) throws Exception
{
final String url =
@@ -170,62 +79,7 @@ public class OpenmeetingsConfigManager
if (invitationHash == null)
return null;
- String invitationUrl = createInvitationUrl(invitationHash);
- return invitationUrl;
- }
-
- public String sendUrl() throws Exception
- {
-
- String url = getCreationUrl();
- HttpURLConnection omURLConnection = null;
-
- try
- {
- URL omURL = new URL("http://" + getServer());
- omURLConnection = (HttpURLConnection) omURL.openConnection();
- omURLConnection.setRequestMethod("GET");
- omURLConnection.setDoInput(true);
- omURLConnection.setDoOutput(true);
- omURLConnection.connect();
-
- }
- catch (MalformedURLException e)
- { // new URL() failed
-
- return null;
-
- }
- catch (IOException e)
- { // openConnection() failed
- return null;
- }
-
- // write to url
- OutputStreamWriter out =
- new OutputStreamWriter(omURLConnection.getOutputStream());
- out.write(url);
- out.flush();
-
- out.close();
- System.out.println("After flushing output stream. ");
- System.out.println("Getting an input stream...");
- InputStream is = omURLConnection.getInputStream();
- // any response?
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line = null;
- String response = null;
- while ((line = br.readLine()) != null)
- {
- System.out.println("line: " + line);
- response += line;
- }
-
- out.close();
- hash = null;
-
- return response;
+ return createInvitationUrl(invitationHash);
}
public static ConfigurationService getConfigurationService()
@@ -314,10 +168,7 @@ public class OpenmeetingsConfigManager
public String getLogin()
{
- String value =
- (String) getConfigurationService().getProperty(
- "plugin.openmeetings.LOGIN");
- login = value;
+ login = (String) getConfigurationService().getProperty("plugin.openmeetings.LOGIN");
return login;
}
@@ -342,8 +193,8 @@ public class OpenmeetingsConfigManager
return password;
}
- public void setContext(BundleContext bc_)
+ public void setContext(BundleContext bc)
{
- this.bundleContext = bc_;
+ bundleContext = bc;
}
}