You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by aa...@apache.org on 2012/07/18 09:36:38 UTC
svn commit: r1362792 -
/incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/
Author: aaf
Date: Wed Jul 18 07:36:38 2012
New Revision: 1362792
URL: http://svn.apache.org/viewvc?rev=1362792&view=rev
Log:
Updated to Openmeetings style
Modified:
incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/EncryptionEngine.java
incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigManager.java
incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigPanel.java
incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginActivator.java
incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginMenuItem.java
incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginSoapClient.java
Modified: incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/EncryptionEngine.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/EncryptionEngine.java?rev=1362792&r1=1362791&r2=1362792&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/EncryptionEngine.java (original)
+++ incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/EncryptionEngine.java Wed Jul 18 07:36:38 2012
@@ -11,41 +11,45 @@ import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.Cipher;
-public class EncryptionEngine {
-
-// private static byte[] iv =
-// { 0x0a, 0x01, 0x02, 0x03, 0x04, 0x0b, 0x0c, 0x0d };
-
- public static IvParameterSpec iv = new IvParameterSpec(new
- byte[]{1,2,3,4,5,6,7,8});
-
- private static String xform = "DES/CBC/PKCS5Padding";
- //private static SecretKey key;
-
- public static SecretKey key = new SecretKeySpec(new
- byte[]{1,1,1,1,1,1,1,1},"DES");
-
- private static SecretKey getKey() throws NoSuchAlgorithmException{
-
- KeyGenerator kg = KeyGenerator.getInstance("DES");
- kg.init(56); // 56 is the keysize. Fixed for DES
-// key = kg.generateKey();
-//
-// SecretKeyFactory kf = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
-// SecretKey key = kf.generateSecret(keySpec);
-
- return key;
- }
-
-
- public String encrypt(String message) throws Exception {
- final MessageDigest md =
- MessageDigest.getInstance("md5");
- final byte[] digestOfPassword = md.digest("HG58YZ3CR9"
- .getBytes("utf-8"));
+public class EncryptionEngine
+{
+
+ // private static byte[] iv =
+ // { 0x0a, 0x01, 0x02, 0x03, 0x04, 0x0b, 0x0c, 0x0d };
+
+ public static IvParameterSpec iv = new IvParameterSpec(new byte[]
+ { 1, 2, 3, 4, 5, 6, 7, 8 });
+
+ private static String xform = "DES/CBC/PKCS5Padding";
+
+ // private static SecretKey key;
+
+ public static SecretKey key = new SecretKeySpec(new byte[]
+ { 1, 1, 1, 1, 1, 1, 1, 1 }, "DES");
+
+ private static SecretKey getKey() throws NoSuchAlgorithmException
+ {
+
+ KeyGenerator kg = KeyGenerator.getInstance("DES");
+ kg.init(56); // 56 is the keysize. Fixed for DES
+ // key = kg.generateKey();
+ //
+ // SecretKeyFactory kf =
+ // SecretKeyFactory.getInstance("PBEWithMD5AndDES");
+ // SecretKey key = kf.generateSecret(keySpec);
+
+ return key;
+ }
+
+ public String encrypt(String message) throws Exception
+ {
+ final MessageDigest md = MessageDigest.getInstance("md5");
+ final byte[] digestOfPassword =
+ md.digest("HG58YZ3CR9".getBytes("utf-8"));
final byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);
- for (int j = 0, k = 16; j < 8;) {
- keyBytes[k++] = keyBytes[j++];
+ for (int j = 0, k = 16; j < 8;)
+ {
+ keyBytes[k++] = keyBytes[j++];
}
final SecretKey key = new SecretKeySpec(keyBytes, "DESede");
@@ -55,21 +59,23 @@ public class EncryptionEngine {
final byte[] plainTextBytes = message.getBytes("utf-8");
final byte[] cipherText = cipher.doFinal(plainTextBytes);
-
- final String encodedCipherText = new sun.misc.BASE64Encoder()
- .encode(cipherText);
+
+ final String encodedCipherText =
+ new sun.misc.BASE64Encoder().encode(cipherText);
return encodedCipherText;
}
- public String decrypt( String messageStr ) throws Exception {
- byte[] message = new sun.misc.BASE64Decoder().decodeBuffer(messageStr);
+ public String decrypt(String messageStr) throws Exception
+ {
+ byte[] message = new sun.misc.BASE64Decoder().decodeBuffer(messageStr);
final MessageDigest md = MessageDigest.getInstance("md5");
- final byte[] digestOfPassword = md.digest("HG58YZ3CR9"
- .getBytes("utf-8"));
+ final byte[] digestOfPassword =
+ md.digest("HG58YZ3CR9".getBytes("utf-8"));
final byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);
- for (int j = 0, k = 16; j < 8;) {
- keyBytes[k++] = keyBytes[j++];
+ for (int j = 0, k = 16; j < 8;)
+ {
+ keyBytes[k++] = keyBytes[j++];
}
final SecretKey key = new SecretKeySpec(keyBytes, "DESede");
@@ -83,24 +89,23 @@ public class EncryptionEngine {
return new String(plainText, "UTF-8");
}
-
-
-// public static String encrypt( String input ) throws Exception {
-// byte[] inpBytes = input.getBytes();
-// Cipher cipher = Cipher.getInstance(xform);
-// // IvParameterSpec ips = new IvParameterSpec(iv);
-// cipher.init(Cipher.ENCRYPT_MODE, key, iv);
-// String out = cipher.doFinal(inpBytes).toString();
-// return out;
-// }
-// public static String decrypt(String input ) throws Exception {
-// byte[] inpBytes = input.getBytes();
-// Cipher cipher = Cipher.getInstance(xform);
-// // IvParameterSpec ips = new IvParameterSpec(iv);
-// cipher.init(Cipher.DECRYPT_MODE, key, iv);
-// byte[] outb = cipher.doFinal(inpBytes);
-// String out = cipher.doFinal(inpBytes).toString();
-// return out;
-// }
-
+
+ // public static String encrypt( String input ) throws Exception {
+ // byte[] inpBytes = input.getBytes();
+ // Cipher cipher = Cipher.getInstance(xform);
+ // // IvParameterSpec ips = new IvParameterSpec(iv);
+ // cipher.init(Cipher.ENCRYPT_MODE, key, iv);
+ // String out = cipher.doFinal(inpBytes).toString();
+ // return out;
+ // }
+ // public static String decrypt(String input ) throws Exception {
+ // byte[] inpBytes = input.getBytes();
+ // Cipher cipher = Cipher.getInstance(xform);
+ // // IvParameterSpec ips = new IvParameterSpec(iv);
+ // cipher.init(Cipher.DECRYPT_MODE, key, iv);
+ // byte[] outb = cipher.doFinal(inpBytes);
+ // String out = cipher.doFinal(inpBytes).toString();
+ // return out;
+ // }
+
}
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=1362792&r1=1362791&r2=1362792&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 Wed Jul 18 07:36:38 2012
@@ -1,4 +1,5 @@
package net.java.sip.communicator.plugin.openmeetings;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -13,156 +14,200 @@ import java.security.*;
import javax.xml.soap.SOAPException;
-//import net.java.sip.communicator.impl.protocol.zeroconf.MessageZeroconfImpl;
+// import net.java.sip.communicator.impl.protocol.zeroconf.MessageZeroconfImpl;
import net.java.sip.communicator.service.configuration.ConfigurationService;
import net.java.sip.communicator.util.Logger;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+public class OpenmeetingsConfigManager
+{
+ Logger logger = Logger.getLogger(OpenmeetingsPluginActivator.class);
+
+ private String server;
-public class OpenmeetingsConfigManager {
- Logger logger = Logger.getLogger(OpenmeetingsPluginActivator.class);
- private String server;
private String protoPrefix;
+
private String omUriContext;
- private String login;
- private String password;
- private String stringForHash = "user:";
- private String hash;
- OpenmeetingsPluginSoapClient soapClient;
- private static BundleContext bundleContext;
- private static ConfigurationService configurationService = null;
-
- private static OpenmeetingsConfigManager instance;
- private EncryptionEngine encryptionEngine;
-
- private OpenmeetingsConfigManager(){
-
- super();
- soapClient = new OpenmeetingsPluginSoapClient();
- encryptionEngine = new EncryptionEngine();
- }
-
- public static OpenmeetingsConfigManager getInstance(){
- if( instance == null ){
- instance = new 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 = "http://"+ getServer() + "/openmeetings/?invitationHash=" + hash;
- System.out.println( "INVITATION URL = " + url );
- return url;
- }
-
- public String getInvitationUrl(String displayedName) throws Exception {
+
+ private String login;
+
+ private String password;
+
+ private String stringForHash = "user:";
+
+ private String hash;
+
+ OpenmeetingsPluginSoapClient soapClient;
+
+ private static BundleContext bundleContext;
+
+ private static ConfigurationService configurationService = null;
+
+ private static OpenmeetingsConfigManager instance;
+
+ private EncryptionEngine encryptionEngine;
+
+ private OpenmeetingsConfigManager()
+ {
+
+ super();
+ soapClient = new OpenmeetingsPluginSoapClient();
+ encryptionEngine = new EncryptionEngine();
+ }
+
+ public static OpenmeetingsConfigManager getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new 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 =
+ "http://" + getServer() + "/openmeetings/?invitationHash=" + hash;
+ System.out.println("INVITATION URL = " + url);
+ return url;
+ }
+
+ public String getInvitationUrl(String displayedName) throws Exception
+ {
String protoPrefix = getProtoPrefix();
- String server = getServer();
+ String server = getServer();
String uriContext = getOmUriContext();
- soapClient.setServerUrl(protoPrefix + server + uriContext);
-
- String invitationHash = null;
-
- try {
- invitationHash = soapClient.getInvitationHash(getLogin(), getPassword(), displayedName);
- } catch (Exception e) {
- logger.error(e);
- }
-
- 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();
+ soapClient.setServerUrl(protoPrefix + server + uriContext);
+
+ String invitationHash = null;
+
+ try
+ {
+ invitationHash =
+ soapClient.getInvitationHash(getLogin(), getPassword(),
+ displayedName);
+ }
+ catch (Exception e)
+ {
+ logger.error(e);
+ }
+
+ 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();
@@ -171,100 +216,134 @@ public class OpenmeetingsConfigManager {
BufferedReader br = new BufferedReader(isr);
String line = null;
String response = null;
- while ( (line = br.readLine()) != null)
+ while ((line = br.readLine()) != null)
{
System.out.println("line: " + line);
- response += line;
+ response += line;
}
-
- out.close();
- hash = null;
-
- return response;
- }
-
- public static ConfigurationService getConfigurationService()
- {
- if (configurationService == null)
- {
- ServiceReference confReference
- = bundleContext.getServiceReference(
- ConfigurationService.class.getName());
- configurationService
- = (ConfigurationService) bundleContext
- .getService(confReference);
- }
- return configurationService;
- }
-
- public void setServer(String server){
- this.server = server;
- getConfigurationService().setProperty( "plugin.openmeetings.SERVER", server);
- }
- public String getServer() {
- String value = (String)getConfigurationService().getProperty( "plugin.openmeetings.SERVER" );
- if (null == value) {
+
+ out.close();
+ hash = null;
+
+ return response;
+ }
+
+ public static ConfigurationService getConfigurationService()
+ {
+ if (configurationService == null)
+ {
+ ServiceReference confReference =
+ bundleContext.getServiceReference(ConfigurationService.class
+ .getName());
+ configurationService =
+ (ConfigurationService) bundleContext.getService(confReference);
+ }
+ return configurationService;
+ }
+
+ public void setServer(String server)
+ {
+ this.server = server;
+ getConfigurationService().setProperty("plugin.openmeetings.SERVER",
+ server);
+ }
+
+ public String getServer()
+ {
+ String value =
+ (String) getConfigurationService().getProperty(
+ "plugin.openmeetings.SERVER");
+ if (null == value)
+ {
value = "";
}
- server = value;
- return server;
- }
-
- public void setProtoPrefix(String protoPrefix){
- this.protoPrefix = protoPrefix;
- getConfigurationService().setProperty("plugin.openmeetings.PROTOCOL_PREFIX", protoPrefix);
- }
- public String getProtoPrefix() {
- String value = (String)getConfigurationService().getProperty("plugin.openmeetings.PROTOCOL_PREFIX");
- if (null == value) {
+ server = value;
+ return server;
+ }
+
+ public void setProtoPrefix(String protoPrefix)
+ {
+ this.protoPrefix = protoPrefix;
+ getConfigurationService().setProperty(
+ "plugin.openmeetings.PROTOCOL_PREFIX", protoPrefix);
+ }
+
+ public String getProtoPrefix()
+ {
+ String value =
+ (String) getConfigurationService().getProperty(
+ "plugin.openmeetings.PROTOCOL_PREFIX");
+ if (null == value)
+ {
value = "";
}
- protoPrefix = value;
- return protoPrefix;
- }
-
- public void setOmUriContext(String omUriContext){
- this.omUriContext = omUriContext;
- getConfigurationService().setProperty("plugin.openmeetings.OM_URI_CONTEXT", omUriContext);
- }
- public String getOmUriContext() {
- String value = (String)getConfigurationService().getProperty("plugin.openmeetings.OM_URI_CONTEXT");
- if (null == value) {
+ protoPrefix = value;
+ return protoPrefix;
+ }
+
+ public void setOmUriContext(String omUriContext)
+ {
+ this.omUriContext = omUriContext;
+ getConfigurationService().setProperty(
+ "plugin.openmeetings.OM_URI_CONTEXT", omUriContext);
+ }
+
+ public String getOmUriContext()
+ {
+ String value =
+ (String) getConfigurationService().getProperty(
+ "plugin.openmeetings.OM_URI_CONTEXT");
+ if (null == value)
+ {
value = "";
}
- if (!value.endsWith("/")) {
+ if (!value.endsWith("/"))
+ {
value += "/";
}
- omUriContext = value;
- return omUriContext;
- }
-
- public void setLogin( String login ){
- this.login = login;
- getConfigurationService().setProperty( "plugin.openmeetings.LOGIN", login);
- }
- public String getLogin() {
- String value = (String)getConfigurationService().getProperty("plugin.openmeetings.LOGIN");
- login = value;
- return login;
- }
-
- public void setPassword(String password) throws Exception {
- this.password = password;
- if( password == null )
- return;
- String encrypted = encryptionEngine.encrypt( password );
- getConfigurationService().setProperty( "plugin.openmeetings.ENCRYPTED_PASSWORD", encrypted );
- }
- public String getPassword() throws Exception {
- String value = (String)getConfigurationService().getProperty( "plugin.openmeetings.ENCRYPTED_PASSWORD" );
- if( value == null )
- return null;
- password = encryptionEngine.decrypt( value );
- return password;
- }
-
- public void setContext(BundleContext bc_) {
- this.bundleContext = bc_;
- }
+ omUriContext = value;
+ return omUriContext;
+ }
+
+ public void setLogin(String login)
+ {
+ this.login = login;
+ getConfigurationService().setProperty("plugin.openmeetings.LOGIN",
+ login);
+ }
+
+ public String getLogin()
+ {
+ String value =
+ (String) getConfigurationService().getProperty(
+ "plugin.openmeetings.LOGIN");
+ login = value;
+ return login;
+ }
+
+ public void setPassword(String password) throws Exception
+ {
+ this.password = password;
+ if (password == null)
+ return;
+ String encrypted = encryptionEngine.encrypt(password);
+ getConfigurationService().setProperty(
+ "plugin.openmeetings.ENCRYPTED_PASSWORD", encrypted);
+ }
+
+ public String getPassword() throws Exception
+ {
+ String value =
+ (String) getConfigurationService().getProperty(
+ "plugin.openmeetings.ENCRYPTED_PASSWORD");
+ if (value == null)
+ return null;
+ password = encryptionEngine.decrypt(value);
+ return password;
+ }
+
+ public void setContext(BundleContext bc_)
+ {
+ this.bundleContext = bc_;
+ }
}
Modified: incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigPanel.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigPanel.java?rev=1362792&r1=1362791&r2=1362792&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigPanel.java (original)
+++ incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsConfigPanel.java Wed Jul 18 07:36:38 2012
@@ -8,176 +8,218 @@ import net.java.sip.communicator.util.sw
import org.osgi.framework.*;
-
public class OpenmeetingsConfigPanel
- extends TransparentPanel
-{
-
+ extends TransparentPanel
+{
+
/**
*
*/
- private static final long serialVersionUID = 1L;
-
- private final JTextField teServer = new JTextField( 20 );
- private final JTextField teLogin = new JTextField( 20 );
- private final JPasswordField tePassword = new JPasswordField( 20 );
- private final JTextField fakeField = new JTextField( 20 );
- private final JButton btOk = new JButton(OpenmeetingsPluginActivator.resourceService.
- getI18NString("plugin.openmeetings.BUTTON_OK"));
-
- private String server;
+ private static final long serialVersionUID = 1L;
+
+ private final JTextField teServer = new JTextField(20);
+
+ private final JTextField teLogin = new JTextField(20);
+
+ private final JPasswordField tePassword = new JPasswordField(20);
+
+ private final JTextField fakeField = new JTextField(20);
+
+ private final JButton btOk = new JButton(
+ OpenmeetingsPluginActivator.resourceService
+ .getI18NString("plugin.openmeetings.BUTTON_OK"));
+
+ private String server;
+
private String login;
+
private String password;
-
- public OpenmeetingsConfigPanel() throws Exception
+
+ public OpenmeetingsConfigPanel()
+ throws Exception
{
super(new BorderLayout());
- Dimension prefSize = new Dimension( 105, 30 );
+ Dimension prefSize = new Dimension(105, 30);
JPanel headerPanel = new TransparentPanel();
headerPanel.setLayout(new BoxLayout(headerPanel, BoxLayout.LINE_AXIS));
- JLabel lblHeader = new JLabel(OpenmeetingsPluginActivator.resourceService.
- getI18NString("plugin.openmeetings.CONFIG_HEADER"));
-
- headerPanel.setAlignmentX( Component.LEFT_ALIGNMENT );
- headerPanel.add( lblHeader );
- lblHeader.setPreferredSize( new Dimension( 200, 30 ));
-
+ JLabel lblHeader =
+ new JLabel(
+ OpenmeetingsPluginActivator.resourceService
+ .getI18NString("plugin.openmeetings.CONFIG_HEADER"));
+
+ headerPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
+ headerPanel.add(lblHeader);
+ lblHeader.setPreferredSize(new Dimension(200, 30));
+
JPanel serverPanel = new TransparentPanel();
- serverPanel.setLayout(new BoxLayout(serverPanel, BoxLayout.LINE_AXIS));
- JLabel lblServer = new JLabel(OpenmeetingsPluginActivator.resourceService.
- getI18NString("plugin.openmeetings.SERVER"));
+ serverPanel.setLayout(new BoxLayout(serverPanel, BoxLayout.LINE_AXIS));
+ JLabel lblServer =
+ new JLabel(
+ OpenmeetingsPluginActivator.resourceService
+ .getI18NString("plugin.openmeetings.SERVER"));
lblServer.setPreferredSize(prefSize);
serverPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
- serverPanel.add(lblServer);
- serverPanel.add( teServer );
-
+ serverPanel.add(lblServer);
+ serverPanel.add(teServer);
+
JPanel loginPanel = new TransparentPanel();
- loginPanel.setLayout(new BoxLayout(loginPanel, BoxLayout.LINE_AXIS));
- JLabel lblLogin = new JLabel(OpenmeetingsPluginActivator.resourceService.
- getI18NString("plugin.openmeetings.LOGIN"));
+ loginPanel.setLayout(new BoxLayout(loginPanel, BoxLayout.LINE_AXIS));
+ JLabel lblLogin =
+ new JLabel(
+ OpenmeetingsPluginActivator.resourceService
+ .getI18NString("plugin.openmeetings.LOGIN"));
lblLogin.setPreferredSize(prefSize);
loginPanel.setAlignmentX(LEFT_ALIGNMENT);
loginPanel.add(lblLogin);
- loginPanel.add( teLogin );
-
+ loginPanel.add(teLogin);
+
JPanel passwordPanel = new TransparentPanel();
- passwordPanel.setLayout(new BoxLayout(passwordPanel, BoxLayout.LINE_AXIS));
- JLabel lblPassword = new JLabel(OpenmeetingsPluginActivator.resourceService.
- getI18NString("plugin.openmeetings.PASWWORD"));
+ passwordPanel.setLayout(new BoxLayout(passwordPanel,
+ BoxLayout.LINE_AXIS));
+ JLabel lblPassword =
+ new JLabel(
+ OpenmeetingsPluginActivator.resourceService
+ .getI18NString("plugin.openmeetings.PASWWORD"));
lblPassword.setPreferredSize(prefSize);
passwordPanel.setAlignmentX(LEFT_ALIGNMENT);
- passwordPanel.add( lblPassword );
- passwordPanel.add( tePassword );
-
+ passwordPanel.add(lblPassword);
+ passwordPanel.add(tePassword);
+
OpenmeetingsConfigManager cfg = OpenmeetingsConfigManager.getInstance();
String serverUri = cfg.getServer();
- if (!serverUri.isEmpty()) {
- serverUri = cfg.getProtoPrefix() + serverUri + cfg.getOmUriContext();
+ if (!serverUri.isEmpty())
+ {
+ serverUri =
+ cfg.getProtoPrefix() + serverUri + cfg.getOmUriContext();
}
teServer.setText(serverUri);
- teLogin.setText( OpenmeetingsConfigManager.getInstance().getLogin() );
- tePassword.setText( OpenmeetingsConfigManager.getInstance().getPassword() );
-
+ teLogin.setText(OpenmeetingsConfigManager.getInstance().getLogin());
+ tePassword.setText(OpenmeetingsConfigManager.getInstance()
+ .getPassword());
+
JPanel buttonPanel = new TransparentPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
- buttonPanel.setAlignmentX( LEFT_ALIGNMENT );
+ buttonPanel.setAlignmentX(LEFT_ALIGNMENT);
btOk.addActionListener(new ButtonOkListener());
btOk.setAlignmentX(LEFT_ALIGNMENT);
- btOk.setPreferredSize(new Dimension( 50, 30 ) );
- //buttonPanel.add( Box.createRigidArea( new Dimension( 60, 5)));
+ btOk.setPreferredSize(new Dimension(50, 30));
+ // buttonPanel.add( Box.createRigidArea( new Dimension( 60, 5)));
buttonPanel.add(btOk);
buttonPanel.add(fakeField);
- fakeField.setVisible( false );
+ fakeField.setVisible(false);
- JPanel omPanel = new TransparentPanel();
+ JPanel omPanel = new TransparentPanel();
omPanel.setLayout(new BoxLayout(omPanel, BoxLayout.PAGE_AXIS));
- omPanel.add( headerPanel );
- omPanel.add( Box.createRigidArea( new Dimension(20, 5)));
- omPanel.add( serverPanel, BorderLayout.WEST );
- omPanel.add( Box.createRigidArea( new Dimension(20, 5)));
- omPanel.add( loginPanel );
- omPanel.add( Box.createRigidArea( new Dimension(20, 5)));
- omPanel.add( passwordPanel );
- omPanel.add( Box.createRigidArea( new Dimension(20, 5)));
- omPanel.add( buttonPanel );
-
- add( omPanel, BorderLayout.PAGE_START);
- }
- public String getTest(){
-
- return "Hello!!!!";
- }
-
- public void setServer(String server) {
-
- this.server = server;
- }
-
- public String getServer() {
- return server;
- }
-
- public void setLogin(String login) {
- this.login = login;
- }
- public String getLogin() {
- return login;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
- public String getPassword() {
- return password;
- }
+ omPanel.add(headerPanel);
+ omPanel.add(Box.createRigidArea(new Dimension(20, 5)));
+ omPanel.add(serverPanel, BorderLayout.WEST);
+ omPanel.add(Box.createRigidArea(new Dimension(20, 5)));
+ omPanel.add(loginPanel);
+ omPanel.add(Box.createRigidArea(new Dimension(20, 5)));
+ omPanel.add(passwordPanel);
+ omPanel.add(Box.createRigidArea(new Dimension(20, 5)));
+ omPanel.add(buttonPanel);
+
+ add(omPanel, BorderLayout.PAGE_START);
+ }
+
+ public String getTest()
+ {
+
+ return "Hello!!!!";
+ }
+
+ public void setServer(String server)
+ {
+
+ this.server = server;
+ }
+
+ public String getServer()
+ {
+ return server;
+ }
+
+ public void setLogin(String login)
+ {
+ this.login = login;
+ }
+
+ public String getLogin()
+ {
+ return login;
+ }
- private class ButtonOkListener implements ActionListener
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ private class ButtonOkListener
+ implements ActionListener
{
/**
* Invoked when an action occurs.
+ *
* @param e <tt>ActionEvent</tt>.
*/
public void actionPerformed(ActionEvent e)
{
- String protoPrefix = "http://";
+ String protoPrefix = "http://";
String serverUri = teServer.getText();
String uriContext = "/";
- if (serverUri.startsWith("http://")) {
+ if (serverUri.startsWith("http://"))
+ {
protoPrefix = "http://";
serverUri = serverUri.substring(protoPrefix.length());
- } else if (serverUri.startsWith("https://")) {
+ }
+ else if (serverUri.startsWith("https://"))
+ {
protoPrefix = "https://";
serverUri = serverUri.substring(protoPrefix.length());
}
int slashPos = serverUri.indexOf('/');
- if (slashPos >= 0) {
+ if (slashPos >= 0)
+ {
uriContext = serverUri.substring(slashPos);
serverUri = serverUri.substring(0, slashPos);
}
- OpenmeetingsConfigManager cfg = OpenmeetingsConfigManager.getInstance();
- cfg.setServer(serverUri);
+ OpenmeetingsConfigManager cfg =
+ OpenmeetingsConfigManager.getInstance();
+ cfg.setServer(serverUri);
cfg.setProtoPrefix(protoPrefix);
cfg.setOmUriContext(uriContext);
- cfg.setLogin( teLogin.getText() );
- try {
- cfg.setPassword(new String(tePassword.getPassword()));
- } catch (Exception e1) {
- e1.printStackTrace();
- }
+ cfg.setLogin(teLogin.getText());
+ try
+ {
+ cfg.setPassword(new String(tePassword.getPassword()));
+ }
+ catch (Exception e1)
+ {
+ e1.printStackTrace();
+ }
}
}
- private class ButtonCancelListener implements ActionListener
+
+ private class ButtonCancelListener
+ implements ActionListener
{
/**
* Invoked when an action occurs.
+ *
* @param e <tt>ActionEvent</tt>.
*/
public void actionPerformed(ActionEvent e)
{
-
+
}
- }
+ }
}
Modified: incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginActivator.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginActivator.java?rev=1362792&r1=1362791&r2=1362792&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginActivator.java (original)
+++ incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginActivator.java Wed Jul 18 07:36:38 2012
@@ -1,8 +1,7 @@
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.openmeetings;
@@ -22,60 +21,55 @@ import org.osgi.framework.*;
public class OpenmeetingsPluginActivator
implements BundleActivator
{
- public static BundleContext bundleContext;
-
+ public static BundleContext bundleContext;
+
public static ResourceManagementService resourceService;
-
- Logger logger = Logger.getLogger(OpenmeetingsPluginActivator.class);
+
+ Logger logger = Logger.getLogger(OpenmeetingsPluginActivator.class);
/**
* Called when this bundle is started so the Framework can perform the
- * bundle-specific activities necessary to start this bundle. In the case
- * of our example plug-in we create our menu item and register it as a
- * plug-in component in the right button menu of the contact list.
+ * bundle-specific activities necessary to start this bundle. In the case of
+ * our example plug-in we create our menu item and register it as a plug-in
+ * component in the right button menu of the contact list.
*/
- public void start(BundleContext bc)
- throws Exception
+ public void start(BundleContext bc) throws Exception
{
- bundleContext = bc;
- resourceService = ResourceManagementServiceUtils.getService(OpenmeetingsPluginActivator.bundleContext);
-
- OpenmeetingsPluginMenuItem openMeetingsPlugin = new OpenmeetingsPluginMenuItem( bc );
-
- Hashtable<String, String> containerFilter
- = new Hashtable<String, String>();
- containerFilter.put(
- Container.CONTAINER_ID,
- Container.CONTAINER_CONTACT_RIGHT_BUTTON_MENU.getID());
-
- bc.registerService( PluginComponent.class.getName(),
- openMeetingsPlugin,
- containerFilter);
-
+ bundleContext = bc;
+ resourceService =
+ ResourceManagementServiceUtils
+ .getService(OpenmeetingsPluginActivator.bundleContext);
+
+ OpenmeetingsPluginMenuItem openMeetingsPlugin =
+ new OpenmeetingsPluginMenuItem(bc);
+
+ Hashtable<String, String> containerFilter =
+ new Hashtable<String, String>();
+ containerFilter.put(Container.CONTAINER_ID,
+ Container.CONTAINER_CONTACT_RIGHT_BUTTON_MENU.getID());
+
+ bc.registerService(PluginComponent.class.getName(), openMeetingsPlugin,
+ containerFilter);
+
Dictionary<String, String> properties = new Hashtable<String, String>();
- properties.put( ConfigurationForm.FORM_TYPE,
- ConfigurationForm.ADVANCED_TYPE);
+ properties.put(ConfigurationForm.FORM_TYPE,
+ ConfigurationForm.ADVANCED_TYPE);
bc.registerService(
ConfigurationForm.class.getName(),
new LazyConfigurationForm(
"net.java.sip.communicator.plugin.openmeetings.OpenmeetingsConfigPanel",
- getClass().getClassLoader(),
- "plugin.skinmanager.PLUGIN_ICON",
- "plugin.openmeetings.PLUGIN_NAME",
- 1002, true),
- properties);
-
- }
+ getClass().getClassLoader(), "plugin.skinmanager.PLUGIN_ICON",
+ "plugin.openmeetings.PLUGIN_NAME", 1002, true), properties);
+
+ }
/**
* Called when this bundle is stopped so the Framework can perform the
- * bundle-specific activities necessary to stop the bundle. In the case
- * of our example plug-in we have nothing to do here.
+ * bundle-specific activities necessary to stop the bundle. In the case of
+ * our example plug-in we have nothing to do here.
*/
- public void stop(BundleContext bc)
- throws Exception
+ public void stop(BundleContext bc) throws Exception
{
-
-
+
}
}
Modified: incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginMenuItem.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginMenuItem.java?rev=1362792&r1=1362791&r2=1362792&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginMenuItem.java (original)
+++ incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginMenuItem.java Wed Jul 18 07:36:38 2012
@@ -1,8 +1,7 @@
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.openmeetings;
@@ -33,142 +32,177 @@ public class OpenmeetingsPluginMenuItem
private JMenuItem menuItem;
private MetaContact metaContact;
-
+
private BundleContext bc;
/**
* Creates an instance of <tt>OpenmeetingsPluginMenuItem</tt>.
- * @param
+ *
+ * @param
*/
- public OpenmeetingsPluginMenuItem( BundleContext bc_)
+ public OpenmeetingsPluginMenuItem(BundleContext bc_)
{
- super(Container.CONTAINER_CONTACT_RIGHT_BUTTON_MENU);
+ super(Container.CONTAINER_CONTACT_RIGHT_BUTTON_MENU);
this.bc = bc_;
- OpenmeetingsConfigManager.getInstance().setContext( bc_ );
+ OpenmeetingsConfigManager.getInstance().setContext(bc_);
}
-
+
/**
- * Listens for events triggered by user clicks on this menu item. Opens
- * the <tt>PluginDialog</tt>.
+ * Listens for events triggered by user clicks on this menu item. Opens the
+ * <tt>PluginDialog</tt>.
*/
public void actionPerformed(ActionEvent e)
- {
- Logger logger = Logger.getLogger(OpenmeetingsPluginActivator.class);
+ {
+ Logger logger = Logger.getLogger(OpenmeetingsPluginActivator.class);
+
+ ServiceReference cRef[];
+ try
+ {
+ cRef =
+ bc.getServiceReferences(
+ ProtocolProviderService.class.getName(), null);
+ }
+ catch (InvalidSyntaxException e1)
+ {
+ logger.error(e1.getMessage());
+ return;
+ }
+ ProtocolProviderService jabberProvider = null;
+
+ for (int i = 0; i < cRef.length; i++)
+ {
+ ProtocolProviderService provider =
+ (ProtocolProviderService) bc.getService(cRef[i]);
+ logger.info("found " + provider.getClass().getName());
+ if (provider.getClass().getName().indexOf("Jabber") >= 0)
+ {
+ jabberProvider = provider;
+ break;
+ }
+ }
+ if (jabberProvider == null)
+ {
+ logger.error("cannot find jabber service");
+ return;
+ }
+
+ String invitationUrl = null;
+
+ // System.getProperties().put("http.proxyHost", "10.10.2.254");
+ // System.getProperties().put("http.proxyPort", "3128");
+ logger.info("getting invitation for "
+ + OpenmeetingsConfigManager.getInstance().getLogin());
+ try
+ {
+ invitationUrl =
+ OpenmeetingsConfigManager.getInstance().getInvitationUrl(
+ OpenmeetingsConfigManager.getInstance().getLogin());
+ }
+ catch (Exception e1)
+ {
+ logger.info(e1.getMessage());
+ }
+ if (invitationUrl == null)
+ {
+ logger.info("Can't get invitation URL");
+ return;
+ }
- ServiceReference cRef[];
- try {
- cRef = bc.getServiceReferences(ProtocolProviderService.class.getName(), null);
- } catch (InvalidSyntaxException e1) {
- logger.error(e1.getMessage());
- return;
- }
- ProtocolProviderService jabberProvider = null;
-
- for (int i = 0; i < cRef.length; i++) {
- ProtocolProviderService provider = (ProtocolProviderService) bc.getService(cRef[i]);
- logger.info("found " + provider.getClass().getName());
- if (provider.getClass().getName().indexOf("Jabber") >= 0) {
- jabberProvider = provider;
- break;
- }
- }
- if (jabberProvider == null) {
- logger.error("cannot find jabber service");
- return;
- }
-
- String invitationUrl = null;
-
-// System.getProperties().put("http.proxyHost", "10.10.2.254");
-// System.getProperties().put("http.proxyPort", "3128");
- logger.info("getting invitation for " + OpenmeetingsConfigManager.getInstance().getLogin());
- try {
- invitationUrl = OpenmeetingsConfigManager.getInstance().getInvitationUrl(
- OpenmeetingsConfigManager.getInstance().getLogin());
- } catch (Exception e1) {
- logger.info(e1.getMessage());
- }
- if (invitationUrl == null) {
- logger.info("Can't get invitation URL");
- return;
- }
-
- openUrl( invitationUrl );
+ openUrl(invitationUrl);
// bring main window to front
Window[] windows = Window.getWindows();
- for (Window w : windows) {
- if (null == w.getOwner() && w.isVisible()) {
+ for (Window w : windows)
+ {
+ if (null == w.getOwner() && w.isVisible())
+ {
w.toFront();
}
}
-
- Contact to = metaContact.getDefaultContact();
- String invitationUrlForSend = null;
- try {
- invitationUrlForSend = OpenmeetingsConfigManager.getInstance().getInvitationUrl(to.getDisplayName());
- } catch (Exception e1) {
- logger.info(e1.getMessage());
- }
- if( invitationUrl.equals(null)){
- logger.info("Can't get invitation URL For send");
- return;
- }
-// System.getProperties().remove("http.proxyHost");
-// System.getProperties().remove("http.proxyPort");
-
- OperationSetBasicInstantMessaging basicInstMsgImpl =
- (OperationSetBasicInstantMessaging)jabberProvider.getOperationSet(OperationSetBasicInstantMessaging.class);
-
- String message = OpenmeetingsPluginActivator.resourceService
+
+ Contact to = metaContact.getDefaultContact();
+ String invitationUrlForSend = null;
+ try
+ {
+ invitationUrlForSend =
+ OpenmeetingsConfigManager.getInstance().getInvitationUrl(
+ to.getDisplayName());
+ }
+ catch (Exception e1)
+ {
+ logger.info(e1.getMessage());
+ }
+ if (invitationUrl.equals(null))
+ {
+ logger.info("Can't get invitation URL For send");
+ return;
+ }
+ // System.getProperties().remove("http.proxyHost");
+ // System.getProperties().remove("http.proxyPort");
+
+ OperationSetBasicInstantMessaging basicInstMsgImpl =
+ (OperationSetBasicInstantMessaging) jabberProvider
+ .getOperationSet(OperationSetBasicInstantMessaging.class);
+
+ String message =
+ OpenmeetingsPluginActivator.resourceService
.getI18NString("plugin.openmeetings.INVITE_MESSAGE");
- message += "\n" + invitationUrlForSend;
-
- Message msg = basicInstMsgImpl.createMessage(message);
- basicInstMsgImpl.sendInstantMessage(to , msg);
- }
-
- private boolean conferenceCreated(String response) {
-
- if( response.contains("It works!"))
- return true;
-
- return false;
- }
-
- private void openUrl(String url){
-
- if( url == null )
- return;
-
- if( !java.awt.Desktop.isDesktopSupported() ) {
-
- System.err.println( "Desktop is not supported (fatal)" );
- System.exit( 1 );
- }
-
- if ( url.length() == 0 ) {
- System.out.println( "Usage: OpenURI [URI [URI ... ]]" );
- System.exit( 0 );
+ message += "\n" + invitationUrlForSend;
+
+ Message msg = basicInstMsgImpl.createMessage(message);
+ basicInstMsgImpl.sendInstantMessage(to, msg);
+ }
+
+ private boolean conferenceCreated(String response)
+ {
+
+ if (response.contains("It works!"))
+ return true;
+
+ return false;
+ }
+
+ private void openUrl(String url)
+ {
+
+ if (url == null)
+ return;
+
+ if (!java.awt.Desktop.isDesktopSupported())
+ {
+
+ System.err.println("Desktop is not supported (fatal)");
+ System.exit(1);
+ }
+
+ if (url.length() == 0)
+ {
+ System.out.println("Usage: OpenURI [URI [URI ... ]]");
+ System.exit(0);
}
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
- if( !desktop.isSupported( java.awt.Desktop.Action.BROWSE ) ) {
+ if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE))
+ {
- System.err.println( "Desktop doesn't support the browse action (fatal)" );
- System.exit( 1 );
+ System.err
+ .println("Desktop doesn't support the browse action (fatal)");
+ System.exit(1);
+ }
+
+ try
+ {
+ java.net.URI uri = new java.net.URI(url);
+ desktop.browse(uri);
+ }
+ catch (Exception e)
+ {
+ System.err.println(e.getMessage());
}
- try {
- java.net.URI uri = new java.net.URI( url );
- desktop.browse( uri );
- }
- catch (Exception e) {
- System.err.println( e.getMessage() );
- }
-
}
+
/*
* Implements PluginComponent#getComponent().
*/
@@ -187,12 +221,13 @@ public class OpenmeetingsPluginMenuItem
*/
public String getName()
{
- return OpenmeetingsPluginActivator.resourceService.getI18NString("plugin.openmeetings.MENU_ITEM");
+ return OpenmeetingsPluginActivator.resourceService
+ .getI18NString("plugin.openmeetings.MENU_ITEM");
}
/**
* Sets the current <tt>MetaContact</tt>. This in the case of the contact
- * right button menu container would be the underlying contact in the
+ * right button menu container would be the underlying contact in the
* contact list.
*
* @param metaContact the <tt>MetaContact</tt> to set.
Modified: incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginSoapClient.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginSoapClient.java?rev=1362792&r1=1362791&r2=1362792&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginSoapClient.java (original)
+++ incubator/openmeetings/trunk/plugins/jitsi/src/net/java/sip/communicator/plugin/openmeetings/OpenmeetingsPluginSoapClient.java Wed Jul 18 07:36:38 2012
@@ -32,273 +32,338 @@ import org.w3c.dom.NodeList;
import net.java.sip.communicator.util.Logger;
-public class OpenmeetingsPluginSoapClient {
+public class OpenmeetingsPluginSoapClient
+{
- String serverUrl;
- Logger logger = Logger.getLogger(OpenmeetingsPluginActivator.class);
+ String serverUrl;
-
- private static final String NAMESPACE_PREFIX = "openmeetings";
-
- public OpenmeetingsPluginSoapClient(){
- super();
- }
-
- public String getSID( String username, String password ) throws Exception {
- final SOAPMessage soapMessage = getSoapMessage();
- final SOAPBody soapBody = soapMessage.getSOAPBody();
- final SOAPElement sessionElement = soapBody.addChildElement("getSession", NAMESPACE_PREFIX);
-
- soapMessage.saveChanges();
-
- logger.info("\n Soap request to " + getUserServiceUrl() + "\n");
- logMessage(soapMessage);
-
- final SOAPConnection soapConnection = getSoapConnection();
- final SOAPMessage soapMessageReply = soapConnection.call(soapMessage, getUserServiceUrl());
- logger.info("\n Soap response:\n");
-// soapMessageReply.writeTo(System.out);
-// System.out.println();
-
- //final String textContent = soapMessageReply.getSOAPBody().getChildElement();
- //logger.info( "SID = " + textContent);
-
- soapConnection.close();
-
- SOAPBody responseBody = soapMessageReply.getSOAPBody();
-
- String sid = null;
-
-
- final Node getSessionResponse = responseBody.getFirstChild();
- final Node returnResult = getSessionResponse.getFirstChild();
-
- final NodeList childNodes = returnResult.getChildNodes();
- sid = childNodes.item(5).getTextContent();
-
- return sid;
- }
-
- public void logMessage(SOAPMessage msg) {
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- msg.writeTo(out);
- logger.info(new String(out.toByteArray()) + "\n\n");
- } catch (Exception e) {
- logger.error(e);
- }
- }
-
-
- private String login(final String sid, final String username, final String password) throws SOAPException, IOException {
- final SOAPMessage soapMessage = getSoapMessage();
- final SOAPBody soapBody = soapMessage.getSOAPBody();
- final SOAPElement loginElement = soapBody.addChildElement("loginUser", NAMESPACE_PREFIX);
-
- loginElement.addChildElement("SID", NAMESPACE_PREFIX).addTextNode(sid);
- loginElement.addChildElement("username", NAMESPACE_PREFIX).addTextNode(username);
- loginElement.addChildElement("userpass", NAMESPACE_PREFIX).addTextNode(password);
-
-// System.out.println("\nLOGIN REQUEST:\n");
-// soapMessage.writeTo(System.out);
-// System.out.println();
-
- soapMessage.saveChanges();
-
- final SOAPConnection soapConnection = getSoapConnection();
- final SOAPMessage soapMessageReply = soapConnection.call(soapMessage, getUserServiceUrl());
- final String textContent = soapMessageReply.getSOAPBody().getFirstChild().getTextContent();
-
-// System.out.println("\nLOGIN RESPONSE:\n");
-// soapMessageReply.writeTo(System.out);
-// System.out.println();
-//
-// System.out.println( "LOGIN = " + textContent);
-//
- if( !textContent.equals("1") )
- JOptionPane.showMessageDialog(null,OpenmeetingsPluginActivator.resourceService.
- getI18NString("plugin.openmeetings.ERROR_LOGIN_MSG"));
-
- soapConnection.close();
-
- return textContent;
- }
- public String getInvitationHash(final String username, final String password, final String displayedName) throws Exception {
- final SOAPMessage soapMessage = getSoapMessage();
- final SOAPBody soapBody = soapMessage.getSOAPBody();
- final SOAPElement requestElement = soapBody.addChildElement("getInvitationHash", NAMESPACE_PREFIX);
-
- logger.info(username + ":" + password + ":" + displayedName);
-
- String sid = getSID(username, password);
- String error_id = null;
- try {
- error_id = login(sid, username, password);
- } catch (Exception e) {
- logger.info(e.getMessage());
- }
-
- if( !error_id.equals( "1" ) ){
- logger.info("User cant login!");
- return null;
- }
-
- String room_id = getAvailableRooms(sid);
-
- requestElement.addChildElement("SID", NAMESPACE_PREFIX).addTextNode(sid);
- requestElement.addChildElement("username", NAMESPACE_PREFIX).addTextNode( displayedName );
- requestElement.addChildElement("room_id", NAMESPACE_PREFIX).addTextNode(room_id);
-
- soapMessage.saveChanges();
-
- logger.info("\nGET INVITATION REQUEST:\n");
-// soapMessage.writeTo(System.out);
-// System.out.println();
-
- final SOAPConnection soapConnection = getSoapConnection();
- final SOAPMessage soapMessageReply = soapConnection.call(soapMessage, getJabberServiceUrl());
-
- logger.info("\nGET INVITATION RESPONSE:\n");
-// soapMessageReply.writeTo(System.out);
-// System.out.println();
-
- final String textContent = soapMessageReply.getSOAPBody().getFirstChild().getTextContent();
-
- logger.info( "INVITATION RESPONSE = " + textContent);
- soapConnection.close();
-
- return textContent;
- }
-
- private String getAvailableRooms( final String sid ) throws SOAPException, IOException, TransformerException {
- final SOAPMessage soapMessage = getSoapMessage();
- final SOAPBody soapBody = soapMessage.getSOAPBody();
-
- final SOAPElement elemCodeElement = soapBody.addChildElement("getAvailableRooms",NAMESPACE_PREFIX);
-
- elemCodeElement.addChildElement("SID", "rooms").addTextNode(sid);
-
-// System.out.println("\nGET_AVAILABLE_ROOMS REQUEST:\n");
-// soapMessage.writeTo(System.out);
-// System.out.println();
-
- soapMessage.saveChanges();
-
- final SOAPConnection soapConnection = getSoapConnection();
- final SOAPMessage soapMessageReply = soapConnection.call(soapMessage, getJabberServiceUrl());
- final String textContent = soapMessageReply.getSOAPBody().getTextContent();
-
-// System.out.println("\nGET_AVAILABLE_ROOMS RESPONSE:\n");
-// soapMessageReply.writeTo(System.out);
-// System.out.println();
-
-
- final Node getRoomsResponse = soapMessageReply.getSOAPBody();
- final Node getFirstRoomResult = getRoomsResponse.getFirstChild().getFirstChild();
-
- String rooms_id = new String();
- final NodeList childNodes = getFirstRoomResult.getChildNodes();
- int count = childNodes.getLength();
- for( int i = 0; i < count; ++i ){
- String nodeName = childNodes.item( i ).getNodeName();
- if( nodeName.contains("rooms_id")){
- rooms_id = childNodes.item(i).getTextContent();
- }
- }
-
-// System.out.println( "GET_AVAILABLE_ROOMS RESULT = " + rooms_id );
- soapConnection.close();
-
- return rooms_id;
- }
-
-
- private String getErrorCode( final String sid, final String error_id ) throws SOAPException, IOException {
- final SOAPMessage soapMessage = getSoapMessage();
- final SOAPBody soapBody = soapMessage.getSOAPBody();
- final SOAPElement errorCodeElement = soapBody.addChildElement("getErrorByCode", NAMESPACE_PREFIX);
-
- errorCodeElement.addChildElement("SID", NAMESPACE_PREFIX).addTextNode(sid);
- errorCodeElement.addChildElement("errorid", NAMESPACE_PREFIX).addTextNode(error_id);
- errorCodeElement.addChildElement("language_id", NAMESPACE_PREFIX).addTextNode("0");
-
-// System.out.println("\nERROR CODE REQUEST:\n");
-// soapMessage.writeTo(System.out);
-// System.out.println();
-
- soapMessage.saveChanges();
-
- final SOAPConnection soapConnection = getSoapConnection();
- final SOAPMessage soapMessageReply = soapConnection.call(soapMessage, getUserServiceUrl());
- final String textContent = soapMessageReply.getSOAPBody().getFirstChild().getTextContent();
-
-// System.out.println("\nERROR CODE RESPONSE:\n");
-// soapMessageReply.writeTo(System.out);
-// System.out.println();
-//
-// System.out.println( "ERROR RESULT = " + textContent);
- soapConnection.close();
-
- return textContent;
- }
-
- private SOAPConnection getSoapConnection() throws UnsupportedOperationException, SOAPException {
-
- final SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
- final SOAPConnection soapConnection = soapConnectionFactory.createConnection();
-
- return soapConnection;
- }
-
- private SOAPMessage getSoapMessage() throws SOAPException {
- final MessageFactory messageFactory = javax.xml.soap.MessageFactory.newInstance();
- final SOAPMessage soapMessage = messageFactory.createMessage();
-
- // Object for message parts
- final SOAPPart soapPart = soapMessage.getSOAPPart();
- final SOAPEnvelope envelope = soapPart.getEnvelope();
-
- envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");
- envelope.addNamespaceDeclaration("xsd", "http://basic.beans.data.app.openmeetings.org/xsd");
- envelope.addNamespaceDeclaration("xsd", "http://basic.beans.persistence.app.openmeetings.org/xsd");
- envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
- envelope.addNamespaceDeclaration("enc", "http://schemas.xmlsoap.org/soap/encoding/");
- envelope.addNamespaceDeclaration("env", "http://schemas.xmlsoap.org/soap/envelop/");
-
-
- envelope.addNamespaceDeclaration(NAMESPACE_PREFIX, "http://services.axis.openmeetings.org");
- envelope.addNamespaceDeclaration( "rooms", "http://rooms.beans.persistence.app.openmeetings.org/xsd");
-
- envelope.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
-
- return soapMessage;
- }
-
- private void addSID( final String sid, final SOAPMessage soapMessage)
- throws SOAPException {
- final SOAPHeader header = soapMessage.getSOAPHeader();
- final SOAPElement sidHeader = header.addChildElement("SID", NAMESPACE_PREFIX);
- sidHeader.addChildElement("SID", NAMESPACE_PREFIX).addTextNode(sid);
- }
-
-
-
- public void setServerUrl(String serverUrl_){
- serverUrl = serverUrl_;
- }
-
- private String getServerUrl(){
- return serverUrl;
- }
-
- private String getUserServiceUrl(){
- String url = getServerUrl() + "services/UserService?wsdl";
- System.out.println( "URL = " + url);
- return url;
- }
- private String getJabberServiceUrl(){
- String url = getServerUrl() + "services/JabberService?wsdl";
- System.out.println( "URL = " + url);
- return url;
- }
+ Logger logger = Logger.getLogger(OpenmeetingsPluginActivator.class);
+
+ private static final String NAMESPACE_PREFIX = "openmeetings";
+
+ public OpenmeetingsPluginSoapClient()
+ {
+ super();
+ }
+
+ public String getSID(String username, String password) throws Exception
+ {
+ final SOAPMessage soapMessage = getSoapMessage();
+ final SOAPBody soapBody = soapMessage.getSOAPBody();
+ final SOAPElement sessionElement =
+ soapBody.addChildElement("getSession", NAMESPACE_PREFIX);
+
+ soapMessage.saveChanges();
+
+ logger.info("\n Soap request to " + getUserServiceUrl() + "\n");
+ logMessage(soapMessage);
+
+ final SOAPConnection soapConnection = getSoapConnection();
+ final SOAPMessage soapMessageReply =
+ soapConnection.call(soapMessage, getUserServiceUrl());
+ logger.info("\n Soap response:\n");
+ // soapMessageReply.writeTo(System.out);
+ // System.out.println();
+
+ // final String textContent =
+ // soapMessageReply.getSOAPBody().getChildElement();
+ // logger.info( "SID = " + textContent);
+
+ soapConnection.close();
+
+ SOAPBody responseBody = soapMessageReply.getSOAPBody();
+
+ String sid = null;
+
+ final Node getSessionResponse = responseBody.getFirstChild();
+ final Node returnResult = getSessionResponse.getFirstChild();
+
+ final NodeList childNodes = returnResult.getChildNodes();
+ sid = childNodes.item(5).getTextContent();
+
+ return sid;
+ }
+
+ public void logMessage(SOAPMessage msg)
+ {
+ try
+ {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ msg.writeTo(out);
+ logger.info(new String(out.toByteArray()) + "\n\n");
+ }
+ catch (Exception e)
+ {
+ logger.error(e);
+ }
+ }
+
+ private String login(final String sid, final String username,
+ final String password) throws SOAPException, IOException
+ {
+ final SOAPMessage soapMessage = getSoapMessage();
+ final SOAPBody soapBody = soapMessage.getSOAPBody();
+ final SOAPElement loginElement =
+ soapBody.addChildElement("loginUser", NAMESPACE_PREFIX);
+
+ loginElement.addChildElement("SID", NAMESPACE_PREFIX).addTextNode(sid);
+ loginElement.addChildElement("username", NAMESPACE_PREFIX).addTextNode(
+ username);
+ loginElement.addChildElement("userpass", NAMESPACE_PREFIX).addTextNode(
+ password);
+
+ // System.out.println("\nLOGIN REQUEST:\n");
+ // soapMessage.writeTo(System.out);
+ // System.out.println();
+
+ soapMessage.saveChanges();
+
+ final SOAPConnection soapConnection = getSoapConnection();
+ final SOAPMessage soapMessageReply =
+ soapConnection.call(soapMessage, getUserServiceUrl());
+ final String textContent =
+ soapMessageReply.getSOAPBody().getFirstChild().getTextContent();
+
+ // System.out.println("\nLOGIN RESPONSE:\n");
+ // soapMessageReply.writeTo(System.out);
+ // System.out.println();
+ //
+ // System.out.println( "LOGIN = " + textContent);
+ //
+ if (!textContent.equals("1"))
+ JOptionPane.showMessageDialog(null,
+ OpenmeetingsPluginActivator.resourceService
+ .getI18NString("plugin.openmeetings.ERROR_LOGIN_MSG"));
+
+ soapConnection.close();
+
+ return textContent;
+ }
+
+ public String getInvitationHash(final String username,
+ final String password, final String displayedName) throws Exception
+ {
+ final SOAPMessage soapMessage = getSoapMessage();
+ final SOAPBody soapBody = soapMessage.getSOAPBody();
+ final SOAPElement requestElement =
+ soapBody.addChildElement("getInvitationHash", NAMESPACE_PREFIX);
+
+ logger.info(username + ":" + password + ":" + displayedName);
+
+ String sid = getSID(username, password);
+ String error_id = null;
+ try
+ {
+ error_id = login(sid, username, password);
+ }
+ catch (Exception e)
+ {
+ logger.info(e.getMessage());
+ }
+
+ if (!error_id.equals("1"))
+ {
+ logger.info("User cant login!");
+ return null;
+ }
+
+ String room_id = getAvailableRooms(sid);
+
+ requestElement.addChildElement("SID", NAMESPACE_PREFIX)
+ .addTextNode(sid);
+ requestElement.addChildElement("username", NAMESPACE_PREFIX)
+ .addTextNode(displayedName);
+ requestElement.addChildElement("room_id", NAMESPACE_PREFIX)
+ .addTextNode(room_id);
+
+ soapMessage.saveChanges();
+
+ logger.info("\nGET INVITATION REQUEST:\n");
+ // soapMessage.writeTo(System.out);
+ // System.out.println();
+
+ final SOAPConnection soapConnection = getSoapConnection();
+ final SOAPMessage soapMessageReply =
+ soapConnection.call(soapMessage, getJabberServiceUrl());
+
+ logger.info("\nGET INVITATION RESPONSE:\n");
+ // soapMessageReply.writeTo(System.out);
+ // System.out.println();
+
+ final String textContent =
+ soapMessageReply.getSOAPBody().getFirstChild().getTextContent();
+
+ logger.info("INVITATION RESPONSE = " + textContent);
+ soapConnection.close();
+
+ return textContent;
+ }
+
+ private String getAvailableRooms(final String sid)
+ throws SOAPException,
+ IOException,
+ TransformerException
+ {
+ final SOAPMessage soapMessage = getSoapMessage();
+ final SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ final SOAPElement elemCodeElement =
+ soapBody.addChildElement("getAvailableRooms", NAMESPACE_PREFIX);
+
+ elemCodeElement.addChildElement("SID", "rooms").addTextNode(sid);
+
+ // System.out.println("\nGET_AVAILABLE_ROOMS REQUEST:\n");
+ // soapMessage.writeTo(System.out);
+ // System.out.println();
+
+ soapMessage.saveChanges();
+
+ final SOAPConnection soapConnection = getSoapConnection();
+ final SOAPMessage soapMessageReply =
+ soapConnection.call(soapMessage, getJabberServiceUrl());
+ final String textContent =
+ soapMessageReply.getSOAPBody().getTextContent();
+
+ // System.out.println("\nGET_AVAILABLE_ROOMS RESPONSE:\n");
+ // soapMessageReply.writeTo(System.out);
+ // System.out.println();
+
+ final Node getRoomsResponse = soapMessageReply.getSOAPBody();
+ final Node getFirstRoomResult =
+ getRoomsResponse.getFirstChild().getFirstChild();
+
+ String rooms_id = new String();
+ final NodeList childNodes = getFirstRoomResult.getChildNodes();
+ int count = childNodes.getLength();
+ for (int i = 0; i < count; ++i)
+ {
+ String nodeName = childNodes.item(i).getNodeName();
+ if (nodeName.contains("rooms_id"))
+ {
+ rooms_id = childNodes.item(i).getTextContent();
+ }
+ }
+
+ // System.out.println( "GET_AVAILABLE_ROOMS RESULT = " + rooms_id );
+ soapConnection.close();
+
+ return rooms_id;
+ }
+
+ private String getErrorCode(final String sid, final String error_id)
+ throws SOAPException,
+ IOException
+ {
+ final SOAPMessage soapMessage = getSoapMessage();
+ final SOAPBody soapBody = soapMessage.getSOAPBody();
+ final SOAPElement errorCodeElement =
+ soapBody.addChildElement("getErrorByCode", NAMESPACE_PREFIX);
+
+ errorCodeElement.addChildElement("SID", NAMESPACE_PREFIX).addTextNode(
+ sid);
+ errorCodeElement.addChildElement("errorid", NAMESPACE_PREFIX)
+ .addTextNode(error_id);
+ errorCodeElement.addChildElement("language_id", NAMESPACE_PREFIX)
+ .addTextNode("0");
+
+ // System.out.println("\nERROR CODE REQUEST:\n");
+ // soapMessage.writeTo(System.out);
+ // System.out.println();
+
+ soapMessage.saveChanges();
+
+ final SOAPConnection soapConnection = getSoapConnection();
+ final SOAPMessage soapMessageReply =
+ soapConnection.call(soapMessage, getUserServiceUrl());
+ final String textContent =
+ soapMessageReply.getSOAPBody().getFirstChild().getTextContent();
+
+ // System.out.println("\nERROR CODE RESPONSE:\n");
+ // soapMessageReply.writeTo(System.out);
+ // System.out.println();
+ //
+ // System.out.println( "ERROR RESULT = " + textContent);
+ soapConnection.close();
+
+ return textContent;
+ }
+
+ private SOAPConnection getSoapConnection()
+ throws UnsupportedOperationException,
+ SOAPException
+ {
+
+ final SOAPConnectionFactory soapConnectionFactory =
+ SOAPConnectionFactory.newInstance();
+ final SOAPConnection soapConnection =
+ soapConnectionFactory.createConnection();
+
+ return soapConnection;
+ }
+
+ private SOAPMessage getSoapMessage() throws SOAPException
+ {
+ final MessageFactory messageFactory =
+ javax.xml.soap.MessageFactory.newInstance();
+ final SOAPMessage soapMessage = messageFactory.createMessage();
+
+ // Object for message parts
+ final SOAPPart soapPart = soapMessage.getSOAPPart();
+ final SOAPEnvelope envelope = soapPart.getEnvelope();
+
+ envelope.addNamespaceDeclaration("xsd",
+ "http://www.w3.org/2001/XMLSchema");
+ envelope.addNamespaceDeclaration("xsd",
+ "http://basic.beans.data.app.openmeetings.org/xsd");
+ envelope.addNamespaceDeclaration("xsd",
+ "http://basic.beans.persistence.app.openmeetings.org/xsd");
+ envelope.addNamespaceDeclaration("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance");
+ envelope.addNamespaceDeclaration("enc",
+ "http://schemas.xmlsoap.org/soap/encoding/");
+ envelope.addNamespaceDeclaration("env",
+ "http://schemas.xmlsoap.org/soap/envelop/");
+
+ envelope.addNamespaceDeclaration(NAMESPACE_PREFIX,
+ "http://services.axis.openmeetings.org");
+ envelope.addNamespaceDeclaration("rooms",
+ "http://rooms.beans.persistence.app.openmeetings.org/xsd");
+
+ envelope.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
+
+ return soapMessage;
+ }
+
+ private void addSID(final String sid, final SOAPMessage soapMessage)
+ throws SOAPException
+ {
+ final SOAPHeader header = soapMessage.getSOAPHeader();
+ final SOAPElement sidHeader =
+ header.addChildElement("SID", NAMESPACE_PREFIX);
+ sidHeader.addChildElement("SID", NAMESPACE_PREFIX).addTextNode(sid);
+ }
+
+ public void setServerUrl(String serverUrl_)
+ {
+ serverUrl = serverUrl_;
+ }
+
+ private String getServerUrl()
+ {
+ return serverUrl;
+ }
+
+ private String getUserServiceUrl()
+ {
+ String url = getServerUrl() + "services/UserService?wsdl";
+ System.out.println("URL = " + url);
+ return url;
+ }
+
+ private String getJabberServiceUrl()
+ {
+ String url = getServerUrl() + "services/JabberService?wsdl";
+ System.out.println("URL = " + url);
+ return url;
+ }
}
\ No newline at end of file