[sip-comm-dev] Applet patch


#1

Hi,

I have written a patch, that allows it to start SC as an applet within a
web page.

The patch has two files: one that's for the sources, and another one
that is for the build file.

I have extended the build file with an "applet" task, that will build SC
with an additional applet bundle and signs all the jars afterwards. For
that purpose, it is necessary that you have a keystore with a key in it.

The applet starter starts Felix embedded in the applet. At the moment it
will only load the protocols and wizards for sip and jabber, but the
others only need to be uncommented in the source.
This applet starter is still very basic (to be improved), but it works.

To run it as an applet, I have attached an example html file. On the
server, the folder structure has to be in the same way as the normal SC
folder structure. In the "sc-bundles" directory, the media.jar that you
want to use must be present.

I have tested the applet on my Ubuntu system with Firefox. It should run
on other systems/ browsers as well, as long as a java plugin is installed.

Regards,
Sebastian

applet.patch (23.3 KB)

build.xml.patch (3.47 KB)

sipcom.html.zip (820 Bytes)

···

--
/**
* Sebastian Heib
* Software Developer
*
* Synyx GmbH & Co. KG
* Business in Components
* Karlstr. 68
* 76137 Karlsruhe
*
* phone +49(0)721 66 24 866
* fax +49(0)721 66 48 877
* eMail heib@synyx.de
* www http://www.synyx.de
* irc irc.synyx.de
*
* Sitz der Gesellschaft: Karlsruhe
* Registergericht: Mannheim
* Handelsregisternummer: HRA 4793
* USt-IdNr.: DE249264296
*
* Komplement�rin: Elatech Verwaltungs GmbH
* Sitz der Gesellschaft: Karlsruhe
* Gesch�ftsf�hrer: Markus Daniel
* Registergericht: Mannheim
* Handelsregisternummer: HRB 7250
*/


#2

That applet patch is excellent news. Does the signed applet properly
make P2P network connections outside the sandbox?

  Do you think you could install a demo version of the applet at your
server, even if it doesn't actually carry calls/messages (ie. so it
doesn't use lots of your bandwidth)? I'd like to have a known-good
version to compare my installation against if mine doesn't work so well
at first try.

···

On Wed, 2008-03-26 at 15:10 +0100, Sebastian Heib wrote:

Hi,

I have written a patch, that allows it to start SC as an applet within a
web page.

The patch has two files: one that's for the sources, and another one
that is for the build file.

I have extended the build file with an "applet" task, that will build SC
with an additional applet bundle and signs all the jars afterwards. For
that purpose, it is necessary that you have a keystore with a key in it.

The applet starter starts Felix embedded in the applet. At the moment it
will only load the protocols and wizards for sip and jabber, but the
others only need to be uncommented in the source.
This applet starter is still very basic (to be improved), but it works.

To run it as an applet, I have attached an example html file. On the
server, the folder structure has to be in the same way as the normal SC
folder structure. In the "sc-bundles" directory, the media.jar that you
want to use must be present.

I have tested the applet on my Ubuntu system with Firefox. It should run
on other systems/ browsers as well, as long as a java plugin is installed.

Regards,
Sebastian

plain text document attachment (applet.patch)
Index: net/java/sip/communicator/impl/gui/GuiActivator.java

--- net/java/sip/communicator/impl/gui/GuiActivator.java (revision 3560)
+++ net/java/sip/communicator/impl/gui/GuiActivator.java (working copy)
@@ -9,6 +9,7 @@
import java.util.*;

import net.java.sip.communicator.impl.gui.utils.*;
+import net.java.sip.communicator.service.applet.AppletService;
import net.java.sip.communicator.service.audionotifier.*;
import net.java.sip.communicator.service.browserlauncher.*;
import net.java.sip.communicator.service.callhistory.*;
@@ -54,6 +55,8 @@
     private static SystrayService systrayService;

     private static Map providerFactoriesMap = new Hashtable();
+
+ private static AppletService appletService;

     /**
      * Called when this bundle is started.
@@ -200,6 +203,36 @@
         return msgHistoryService;
     }
     
+
+
+ /**
+ * Returns the <tt>AppletService</tt> obtained from the bundle
+ * context.
+ * @return the <tt>AppletService</tt> obtained from the bundle
+ * context
+ */
+ public static AppletService getAppletService()
+ {
+ if (appletService == null)
+ {
+ ServiceReference serviceReference = bundleContext
+ .getServiceReference(AppletService.class.getName());
+
+ appletService = (AppletService) bundleContext
+ .getService(serviceReference);
+
+ }
+
+ return appletService;
+ }
+
+ public static boolean isAppletGui()
+ {
+ return (getAppletService().getApplet() != null);
+ }
+
+
+
     /**
      * Returns the <tt>MetaContactListService</tt> obtained from the bundle
      * context.
Index: net/java/sip/communicator/impl/gui/main/MainFrame.java

--- net/java/sip/communicator/impl/gui/main/MainFrame.java (revision 3560)
+++ net/java/sip/communicator/impl/gui/main/MainFrame.java (working copy)
@@ -127,14 +127,7 @@
      * Initiates the content of this frame.
      */
     private void init()
- {
- this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0),
- new RenameAction());
- this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,
- KeyEvent.ALT_DOWN_MASK), new ForwordTabAction());
- this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,
- KeyEvent.ALT_DOWN_MASK), new BackwordTabAction());
-
+ {
         this.contactListPanel.add(tabbedPane, BorderLayout.CENTER);
         this.contactListPanel.add(callManager, BorderLayout.SOUTH);

@@ -143,7 +136,7 @@
         this.mainPanel.add(contactListPanel, BorderLayout.CENTER);
         this.mainPanel.add(statusPanel, BorderLayout.SOUTH);

- JPanel menusPanel = new JPanel(new BorderLayout(0, 5));
+ JPanel menusPanel = new JPanel(new BorderLayout(0, 5));

         menusPanel.add(menu, BorderLayout.CENTER);
         menusPanel.add(quickMenu, BorderLayout.SOUTH);
@@ -152,9 +145,28 @@

         northPanel.add(new LogoBar(), BorderLayout.NORTH);
         northPanel.add(menusPanel, BorderLayout.CENTER);
+

- this.getContentPane().add(northPanel, BorderLayout.NORTH);
- this.getContentPane().add(mainPanel, BorderLayout.CENTER);
+ // check whether we are running inside an applet
+ if (GuiActivator.isAppletGui())
+ {
+ JApplet applet = GuiActivator.getAppletService().getApplet();
+
+ applet.getContentPane().add(northPanel, BorderLayout.NORTH);
+ applet.getContentPane().add(mainPanel, BorderLayout.CENTER);
+
+ } else
+ {
+ this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0),
+ new RenameAction());
+ this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,
+ KeyEvent.ALT_DOWN_MASK), new ForwordTabAction());
+ this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,
+ KeyEvent.ALT_DOWN_MASK), new BackwordTabAction());
+
+ this.getContentPane().add(northPanel, BorderLayout.NORTH);
+ this.getContentPane().add(mainPanel, BorderLayout.CENTER);
+ }
     }
     
     /**
@@ -166,9 +178,15 @@
         int height = SizeProperties.getSize("mainWindowHeight");

         this.setSize(width, height);
-
- this.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width
+
+ if (GuiActivator.isAppletGui())
+ {
+ this.setLocation(0, 0);
+ } else
+ {
+ this.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width
                 - this.getWidth(), 50);
+ }
     }

     /**
@@ -1009,7 +1027,43 @@
             return this.statusPanel.getLastStatusString(protocolProvider);
     }

- /**
+ @Override
+ public void dispose()
+ {
+ // don't call dispose if we are in an applet
+ if (!GuiActivator.isAppletGui())
+ {
+ super.dispose();
+ }
+ }
+
+ @Override
+ public void setVisible(boolean isVisible)
+ {
+ // don't call setVisible if we are in an applet
+ if (!GuiActivator.isAppletGui())
+ {
+ super.setVisible(isVisible);
+ }
+ }
+
+
+
+ @Override
+ public void validate()
+ {
+ // call validate on the applet if we are in an applet
+ if (GuiActivator.isAppletGui())
+ {
+ GuiActivator.getAppletService().getApplet().validate();
+ // otherwise call the original method
+ } else
+ {
+ super.validate();
+ }
+ }
+
+ /**
      * <tt>RenameAction</tt> is invoked when user presses the F2 key. Depending
      * on the selection opens the appropriate form for renaming.
      */
Index: net/java/sip/communicator/impl/gui/main/menus/FileMenu.java

--- net/java/sip/communicator/impl/gui/main/menus/FileMenu.java (revision 3560)
+++ net/java/sip/communicator/impl/gui/main/menus/FileMenu.java (working copy)
@@ -104,10 +104,13 @@

         this.add(createChatRoomItem);
         this.add(searchForChatRoomsItem);
-
- this.addSeparator();
-
- this.add(closeMenuItem);
+
+ if (!GuiActivator.isAppletGui())
+ {
+ this.addSeparator();
+
+ this.add(closeMenuItem);
+ }

         //this.addContactItem.setIcon(new ImageIcon(ImageLoader
         // .getImage(ImageLoader.ADD_CONTACT_16x16_ICON)));
@@ -113,7 +116,10 @@
         // .getImage(ImageLoader.ADD_CONTACT_16x16_ICON)));

         this.newAccountMenuItem.setName("newAccount");
- this.closeMenuItem.setName("close");
+ if (!GuiActivator.isAppletGui())
+ {
+ this.closeMenuItem.setName("close");
+ }
         this.addContactItem.setName("addContact");
         this.createGroupItem.setName("createGroup");
         this.createChatRoomItem.setName("createChatRoom");
@@ -120,7 +126,10 @@
         this.searchForChatRoomsItem.setName("searchForChatRooms");

         this.newAccountMenuItem.addActionListener(this);
- this.closeMenuItem.addActionListener(this);
+ if (!GuiActivator.isAppletGui())
+ {
+ this.closeMenuItem.addActionListener(this);
+ }
         this.addContactItem.addActionListener(this);
         this.createGroupItem.addActionListener(this);
         this.createChatRoomItem.addActionListener(this);
@@ -127,7 +136,10 @@
         this.searchForChatRoomsItem.addActionListener(this);

         this.setMnemonic(fileString.getMnemonic());
- this.closeMenuItem.setMnemonic(closeString.getMnemonic());
+ if (!GuiActivator.isAppletGui())
+ {
+ this.closeMenuItem.setMnemonic(closeString.getMnemonic());
+ }
         this.newAccountMenuItem.setMnemonic(newAccountString.getMnemonic());
         this.addContactItem.setMnemonic(addContactString.getMnemonic());
         this.createGroupItem.setMnemonic(createGroupString.getMnemonic());
Index: net/java/sip/communicator/impl/gui/swing.ui.manifest.mf

--- net/java/sip/communicator/impl/gui/swing.ui.manifest.mf (revision 3560)
+++ net/java/sip/communicator/impl/gui/swing.ui.manifest.mf (working copy)
@@ -39,4 +39,5 @@
  javax.swing.undo,
  javax.swing.border,
  net.java.sip.communicator.service.audionotifier,
- org.jdesktop.jdic.desktop
+ org.jdesktop.jdic.desktop,
+ net.java.sip.communicator.service.applet
Index: net/java/sip/communicator/impl/applet/AppletImpl.java

--- net/java/sip/communicator/impl/applet/AppletImpl.java
+++ net/java/sip/communicator/impl/applet/AppletImpl.java
@@ -0,0 +1,35 @@
+package net.java.sip.communicator.impl.applet;
+
+import javax.swing.JApplet;
+
+import net.java.sip.communicator.service.applet.AppletService;
+
+/**
+ * Holds an applet.
+ * @author Sebastian Heib - <a href="mailto:heib@synyx.de">heib@synyx.de</a>
+ *
+ */
+public class AppletImpl implements AppletService
+{
+
+ private JApplet applet;
+
+ /**
+ * Creates a new instance.
+ * @param applet the applet to be used
+ */
+ public AppletImpl(JApplet applet)
+ {
+ this.applet = applet;
+ }
+
+ /**
+ * Returns the applet.
+ * @return the applet
+ */
+ public JApplet getApplet()
+ {
+ return applet;
+ }
+
+}
Index: net/java/sip/communicator/impl/applet/AppletActivator.java

--- net/java/sip/communicator/impl/applet/AppletActivator.java
+++ net/java/sip/communicator/impl/applet/AppletActivator.java
@@ -0,0 +1,72 @@
+package net.java.sip.communicator.impl.applet;
+
+
+import javax.swing.JApplet;
+
+import net.java.sip.communicator.service.applet.AppletService;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * Activates an AppletBundle, to make the calling applet available to the felix framework
+ * @author Sebastian Heib - <a href="mailto:heib@synyx.de">heib@synyx.de</a>
+ *
+ */
+public class AppletActivator implements BundleActivator
+{
+
+ private BundleContext m_context = null;
+ private ServiceRegistration m_registration = null;
+ private JApplet applet = null;
+
+ /**
+ * Creates a new AppletActivator without an applet (when running in
+ * standard mode)
+ */
+ public AppletActivator()
+ {
+ //do nothing
+ }
+
+ /**
+ * Creates a new AppletActivator
+ * @param applet the applet that is made available for the framework
+ */
+ public AppletActivator(JApplet applet)
+ {
+ // Save a reference to the applet
+ this.applet = applet;
+ }
+
+ /**
+ * starts the bundle
+ * @param context the bundleContext
+ */
+ public void start(BundleContext context)
+ {
+ // Save a reference to the bundle context.
+ m_context = context;
+
+ // Create a property applet service
+ AppletService appletImpl = new AppletImpl(applet);
+
+ // Register the applet service and save
+ // the service registration.
+ m_registration = m_context.registerService(
+ AppletService.class.getName(), appletImpl, null);
+ }
+
+ /**
+ * stops the bundle
+ * @param context the bundleContext
+ */
+ public void stop(BundleContext context)
+ {
+ // Unregister the applet service.
+ m_registration.unregister();
+ m_context = null;
+ }
+
+}
Index: net/java/sip/communicator/impl/applet/applet.manifest.mf

--- net/java/sip/communicator/impl/applet/applet.manifest.mf
+++ net/java/sip/communicator/impl/applet/applet.manifest.mf
@@ -0,0 +1,9 @@
+Bundle-Activator: net.java.sip.communicator.util.AppletHostActivator
+Bundle-Name: Applet Service Implementation
+Bundle-Description: An implementation of the Applet service.
+Bundle-Vendor: sip-communicator.org
+Bundle-Version: 0.0.1
+Export-Package: net.java.sip.communicator.service.applet
+Import-Package: org.osgi.framework,
+ net.java.sip.communicator.util
+ net.java.sip.communicator.service.applet
Index: net/java/sip/communicator/launcher/SIPCommunicatorApplet.java

--- net/java/sip/communicator/launcher/SIPCommunicatorApplet.java
+++ net/java/sip/communicator/launcher/SIPCommunicatorApplet.java
@@ -0,0 +1,320 @@
+package net.java.sip.communicator.launcher;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JApplet;
+
+import net.java.sip.communicator.impl.applet.AppletActivator;
+
+import org.apache.felix.framework.Felix;
+import org.apache.felix.framework.cache.BundleCache;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.framework.util.StringMap;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+
+
+/**
+ *
+ * @author Sebastian Heib - <a href="mailto:heib@synyx.de">heib@synyx.de</a>
+ *
+ */
+public class SIPCommunicatorApplet extends JApplet
+{
+ // the felix cache directory
+ private static final String CACHE_DIR = ".sip-communicator/bin";
+
+ // the old config file - sip-communicator.xml
+ private File oldConfigFile = null;
+
+ // the old contact list file - contactlist.xml
+ private File oldContactlistFile = null;
+
+ // the user's home dir
+ private String userHome = null;
+
+ private static final long serialVersionUID = -2876656913837180952L;
+
+ // the auto-start property for felix 1.0.3
+// private static final String AUTO_START_PROP = AutoActivator.AUTO_START_PROP;
+
+ // the auto-start property for felix 1.0.1
+ private static final String AUTO_START_PROP = FelixConstants.AUTO_START_PROP;
+
+ // the felix instance
+ private Felix felix = null;
+
+ // the activator for the applet bundle
+ private AppletActivator appletActivator = null;
+
+
+ public void init()
+ {
+ userHome = System.getProperty("user.home") + File.separator;
+ // remove the cache dir from a previous startup to make sure that the new bundles are loaded
+ File existingCacheDir = new File(userHome + CACHE_DIR);
+ if (existingCacheDir.exists())
+ {
+ boolean deleted = deleteDirectory(existingCacheDir);
+ }
+
+ //rename the config files - maybe there is a local instance of sipCom, we would otherwise overwrite the config files
+ oldConfigFile = new File(userHome + ".sip-communicator/sip-communicator.xml");
+ if (oldConfigFile.exists())
+ {
+ File newFile = new File(userHome + ".sip-communicator/sip-communicator.xml." + System.currentTimeMillis());
+ if (oldConfigFile.renameTo(newFile))
+ {
+ oldConfigFile = newFile;
+ }
+ }
+
+ oldContactlistFile = new File(userHome + ".sip-communicator/contactlist.xml");
+ if (oldContactlistFile.exists())
+ {
+ File newFile = new File(userHome + ".sip-communicator/contactlist.xml." + System.currentTimeMillis());
+ if (oldContactlistFile.renameTo(newFile))
+ {
+ oldContactlistFile = newFile;
+ }
+ }
+
+
+ // use the codeBase as the server we are running on
+ String server = getCodeBase().toString();
+
+ // Print welcome banner.
+ System.out.println("\nWelcome to Felix.");
+ System.out.println("=================\n");
+
+ Map<String, String> configMap = new StringMap(false);
+
+ // Configure the Felix instance to be embedded.
+ configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
+
+ // add all the framework system packages to the config map
+ configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
+ "org.osgi.framework; version=1.3.0," +
+
+// "org.osgi.service.packageadmin; version=1.2.0," +
+// "org.osgi.service.startlevel; version=1.0.0," +
+// "org.osgi.service.url; version=1.0.0," +
+// "org.osgi.util.tracker; version=1.3.2," +
+
+ "javax.swing;" +
+ "javax.swing.event;" +
+ "javax.swing.table;" +
+ "javax.swing.text;" +
+ "javax.swing.text.html;" +
+ "javax.accessibility;" +
+ "javax.swing.plaf;" +
+ "javax.swing.plaf.metal;" +
+ "javax.swing.plaf.basic;" +
+ "javax.imageio;" +
+ "javax.swing.tree;" +
+ "javax.swing.undo;" +
+ "javax.swing.event;" +
+ "javax.swing.border;" +
+ "javax.swing.filechooser;" +
+ "org.w3c.dom;" +
+ "org.xml.sax;" +
+ "org.xml.sax.ext;" +
+ "javax.xml.parsers;" +
+ "org.apache.xml.serialize;" +
+ "javax.xml.transform;" +
+ "javax.xml.transform.dom;" +
+ "javax.xml.transform.stream;" +
+ "sun.security.action;" +
+ "sun.misc;" +
+ "javax.net;" +
+ "javax.net.ssl;" +
+ "javax.naming;" +
+ "javax.naming.directory;" +
+ "javax.sound;" +
+ "javax.sound.sampled;" +
+ "org.jdesktop.jdic.tray;" +
+ "org.jdesktop.jdic.desktop;" +
+ "com.apple.eio;" +
+ "org.xml.sax.helpers;" +
+ "net.java.sip.communicator.service.applet;");
+
+
+ // add all the bundles we need to the config map
+ configMap.put(AUTO_START_PROP + ".10",
+ server + "lib/bundle/org.apache.felix.bundlerepository-1.0.0.jar " +
+ server + "lib/bundle/org.apache.felix.servicebinder-0.9.0-SNAPSHOT.jar");
+
+ configMap.put(AUTO_START_PROP + ".20",
+ server + "sc-bundles/util.jar " +
+ server + "lib/bundle/log4j.jar");
+
+ configMap.put(AUTO_START_PROP + ".30",
+ server + "sc-bundles/contacteventhandler.jar " +
+ server + "sc-bundles/fileaccess.jar");
+
+ configMap.put(AUTO_START_PROP + ".40",
+ server + "sc-bundles/configuration.jar " +
+ server + "sc-bundles/version.jar " +
+ server + "sc-bundles/version-impl.jar " +
+ server + "sc-bundles/branding.jar");
+
+ configMap.put(AUTO_START_PROP + ".50",
+ server + "sc-bundles/browserlauncher.jar " +
+ server + "sc-bundles/protocol.jar " +
+ server + "sc-bundles/contactlist.jar " +
+ server + "sc-bundles/media.jar " +
+ // server + "sc-bundles/protocol-icq.jar " +
+ server + "sc-bundles/protocol-sip.jar " +
+ server + "sc-bundles/smacklib.jar " +
+ server + "sc-bundles/protocol-jabber.jar " +
+ //server + "sc-bundles/protocol-msn.jar " +
+ //server + "sc-bundles/protocol-yahoo.jar " +
+ //server + "sc-bundles/protocol-gibberish.jar " +
+ server + "sc-bundles/netaddr.jar " +
+// server + "sc-bundles/protocol-rss.jar " +
+ //server + "sc-bundles/protocol-zeroconf.jar " +
+// server + "sc-bundles/protocol-irc.jar " +
+ server + "sc-bundles/meta-cl.jar");
+
+ configMap.put(AUTO_START_PROP + ".60",
+ server + "sc-bundles/accountinstaller.jar " +
+ server + "sc-bundles/history.jar " +
+ server + "sc-bundles/msghistory.jar " +
+ server + "sc-bundles/callhistory.jar " +
+ server + "sc-bundles/audionotifier.jar " +
+ server + "sc-bundles/notification.jar");
+
+ configMap.put(AUTO_START_PROP + ".66",
+ server + "sc-bundles/swing-ui.jar " +
+ server + "sc-bundles/systray.jar"
+ );
+
+ configMap.put(AUTO_START_PROP + ".67",
+// server + "sc-bundles/pluginmanager.jar " +
+ server + "sc-bundles/whiteboard.jar " +
+ //server + "sc-bundles/icqaccregwizz.jar " +
+ //server + "sc-bundles/aimaccregwizz.jar " +
+// server + "sc-bundles/sipaccregwizz.jar " +
+// server + "sc-bundles/jabberaccregwizz.jar " +
+ //server + "sc-bundles/msnaccregwizz.jar " +
+ //server + "sc-bundles/yahooaccregwizz.jar " +
+ //server + "sc-bundles/gibberishaccregwizz.jar " +
+ server + "sc-bundles/extendedcallhistorysearch.jar " +
+// server + "sc-bundles/rssaccregwizz.jar " +
+ //server + "sc-bundles/zeroconfaccregwizz.jar " +
+// server + "sc-bundles/ircaccregwizz.jar " +
+ //server + "sc-bundles/contacteventhandler.jar " +
+ server + "sc-bundles/minosaddresses.jar " +
+ server + "sc-bundles/shutdown.jar");
+
+
+
+ configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP,
+ CACHE_DIR);
+
+ configMap.put("felix.startlevel.framework", "100");
+
+ configMap.put("felix.startlevel.bundle", "100");
+
+ // this prevents felix from loading stream and content factories a second time
+ configMap.put("felix.service.urlhandlers", "false");
+
+
+ // create an AppletActivator to make this applet available to the framwork
+ appletActivator = new AppletActivator(this);
+
+ // add this appletActivator to the parameter list for felix
+ List list = new ArrayList();
+ list.add(appletActivator);
+
+ // add an autoActivator to start the bundles - only in Felix 1.0.3
+// list.add(new AutoActivator(configMap));
+
+ try
+ {
+ // Now create an instance of the framework.
+ felix = new Felix(configMap, list);
+ // and start it!
+ felix.start();
+ }
+ catch (Exception ex)
+ {
+ System.err.println("Could not create framework: " + ex);
+ ex.printStackTrace();
+ }
+ }
+
+ public void start()
+ {
+
+ }
+
+ public void stop()
+ {
+
+ }
+
+
+ public void destroy()
+ {
+
+ // Shut down the felix framework when stopping the
+ // host application.
+ try
+ {
+ felix.stop();
+ } catch (BundleException e)
+ {
+ e.printStackTrace();
+ }
+
+ //delete the applet config files
+ File configFile = new File(userHome + ".sip-communicator/sip-communicator.xml");
+ if (configFile.exists())
+ {
+ configFile.delete();
+ }
+
+ File contactListFile = new File(userHome + ".sip-communicator/contactlist.xml");
+ if (contactListFile.exists())
+ {
+ contactListFile.delete();
+ }
+
+ //rename the old config files
+ if (oldConfigFile.exists())
+ {
+ oldConfigFile.renameTo(new File(userHome + ".sip-communicator/sip-communicator.xml"));
+ }
+
+ if (oldContactlistFile.exists())
+ {
+ oldContactlistFile.renameTo(new File(userHome + ".sip-communicator/contactlist.xml"));
+ }
+ }
+
+
+ private boolean deleteDirectory(File path)
+ {
+ if (path.exists())
+ {
+ File[] files = path.listFiles();
+ for (int i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory())
+ {
+ deleteDirectory(files[i]);
+ } else
+ {
+ files[i].delete();
+ }
+ }
+ }
+ return (path.delete());
+ }
+
+
+}
Index: net/java/sip/communicator/service/applet/AppletService.java

--- net/java/sip/communicator/service/applet/AppletService.java
+++ net/java/sip/communicator/service/applet/AppletService.java
@@ -0,0 +1,18 @@
+package net.java.sip.communicator.service.applet;
+
+import javax.swing.JApplet;
+
+/**
+ * Service to provide access to the external applet object
+ * @author Sebastian Heib - <a href="mailto:heib@synyx.de">heib@synyx.de</a>
+ *
+ */
+public interface AppletService
+{
+ /**
+ *
+ * @return the applet
+ */
+ public JApplet getApplet();
+
+}
plain text document attachment (build.xml.patch)
Index: .

--- . (revision 3560)
+++ . (working copy)
@@ -12,6 +12,7 @@
     <property name="bundles.dest.win" value="${bundles.dest}/os-specific/windows"/>
     <property name="bundles.dest.lin" value="${bundles.dest}/os-specific/linux"/>
     <property name="bundles.dest.sol" value="${bundles.dest}/os-specific/solaris"/>
+ <property name="bundles.signed.dest" value="/opt/lampp/htdocs/sipcom/sc-bundles"/>
     <property name="doc" value="doc"/>
     <property name="java.doc" value="${doc}/api"/>
     <property name="lib" value="${sc.basedir}/lib"/>
@@ -39,6 +40,10 @@
     <property name="resources" value="${dest}/resources"/>
     <property name="inst.resrc" value="${sc.basedir}/resources/install"/>
     <property name="path" value="${lib}/native/windows;${system.PATH}"/>
+ <property name="keystore" value="sipcomkeystore"/>
+ <property name="keystore.alias" value="sipcom"/>
+ <property name="keystore.password" value="geheim"/>
+

     <!-- set the build label property and make it take the cc bild into account -->
     <condition property="build.label"
@@ -289,6 +294,7 @@
             includes="**/*.properties"/>
     </target>

+
     <!-- JAVADOC -->
     <target name="javadoc"
       description="Generates project javadoc.">
@@ -615,7 +621,7 @@
         bundle-irc,bundle-plugin-ircaccregwizz,
         bundle-pluginmanager,bundle-notification,
         bundle-ssh,bundle-plugin-sshaccregwizz,
- bundle-contacteventhandler,bundle-plugin-contactinfo,
+ bundle-contacteventhandler,bundle-plugin-contactinfo,
         bundle-plugin-accountinfo,bundle-plugin-chatalerter,
         bundle-updatecheckplugin"/>

@@ -1161,6 +1167,7 @@
         </jar>
     </target>

+
     <!-- BUNDLE-PLUGIN-AIMACCREGWIZZ -->
     <target name="bundle-plugin-aimaccregwizz">
         <!-- Creates a bundle for the plugin Aim Account Registration Wizard.-->
@@ -1620,5 +1627,40 @@
                 prefix="resources/languages/plugin/updatechecker"/>
         </jar>
     </target>
-
+
+
+ <!-- APPLET JAR -->
+ <target name="bundle-applet-starter">
+ <!-- Creates a jar with the applet bundle to start as an applet.-->
+ <jar compress="false" destfile="${bundles.dest}/applet-starter.jar"
+ manifest="${src}/net/java/sip/communicator/impl/applet/applet.manifest.mf">
+ <zipfileset dir="${dest}/net/java/sip/communicator/launcher"
+ prefix="net/java/sip/communicator/launcher"/>
+ <zipfileset dir="${dest}/net/java/sip/communicator/impl/applet"
+ prefix="net/java/sip/communicator/impl/applet"/>
+ <zipfileset dir="${dest}/net/java/sip/communicator/service/applet"
+ prefix="net/java/sip/communicator/service/applet"/>
+ </jar>
+ </target>
+
+
+ <!-- sign all the created jars -->
+ <target name="sign-copy-jars">
+ <signjar alias="${keystore.alias}" keystore="${keystore}" storepass="${keystore.password}"
+ lazy="true" destDir="${bundles.signed.dest}">
+ <path>
+ <fileset dir="${bundles.dest}" includes="**/*.jar">
+ <!-- exclude the windows media jar as it fails to sign it -->
+ <exclude name="**/windows/media.jar"/>
+ </fileset>
+ </path>
+ </signjar>
+ </target>
+
+
+ <!-- Rebuild the project, sign all the jars and copy to the server-->
+ <target name="applet" depends="rebuild, bundle-applet-starter, sign-copy-jars"
+ description="Rebuilds the project, signs all the jars and copys those">
+ </target>
+
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

--

(C) Matthew Rubenstein

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

Hi devs,

Hey Sebastian, it sounds great!
It is a feature that many users asked about ...
I'm gonna give this a try.
Concerning the OS it won't help to know on other systems cause i'm also on
ubuntu.

Cheers

Jean-Daniel

···

On Wed, Mar 26, 2008 at 3:10 PM, Sebastian Heib <heib@synyx.de> wrote:

Hi,

I have written a patch, that allows it to start SC as an applet within a
web page.

The patch has two files: one that's for the sources, and another one
that is for the build file.

I have extended the build file with an "applet" task, that will build SC
with an additional applet bundle and signs all the jars afterwards. For
that purpose, it is necessary that you have a keystore with a key in it.

The applet starter starts Felix embedded in the applet. At the moment it
will only load the protocols and wizards for sip and jabber, but the
others only need to be uncommented in the source.
This applet starter is still very basic (to be improved), but it works.

To run it as an applet, I have attached an example html file. On the
server, the folder structure has to be in the same way as the normal SC
folder structure. In the "sc-bundles" directory, the media.jar that you
want to use must be present.

I have tested the applet on my Ubuntu system with Firefox. It should run
on other systems/ browsers as well, as long as a java plugin is installed.

Regards,
Sebastian

--
/**
* Sebastian Heib
* Software Developer
*
* Synyx GmbH & Co. KG
* Business in Components
* Karlstr. 68
* 76137 Karlsruhe
*
* phone +49(0)721 66 24 866
* fax +49(0)721 66 48 877
* eMail heib@synyx.de
* www http://www.synyx.de
* irc irc.synyx.de
*
* Sitz der Gesellschaft: Karlsruhe
* Registergericht: Mannheim
* Handelsregisternummer: HRA 4793
* USt-IdNr.: DE249264296
*
* Komplementärin: Elatech Verwaltungs GmbH
* Sitz der Gesellschaft: Karlsruhe
* Geschäftsführer: Markus Daniel
* Registergericht: Mannheim
* Handelsregisternummer: HRB 7250
*/

Index: net/java/sip/communicator/impl/gui/GuiActivator.java

--- net/java/sip/communicator/impl/gui/GuiActivator.java (revision
3560)
+++ net/java/sip/communicator/impl/gui/GuiActivator.java (working
copy)
@@ -9,6 +9,7 @@
import java.util.*;

import net.java.sip.communicator.impl.gui.utils.*;
+import net.java.sip.communicator.service.applet.AppletService;
import net.java.sip.communicator.service.audionotifier.*;
import net.java.sip.communicator.service.browserlauncher.*;
import net.java.sip.communicator.service.callhistory.*;
@@ -54,6 +55,8 @@
    private static SystrayService systrayService;

    private static Map providerFactoriesMap = new Hashtable();
+
+ private static AppletService appletService;

    /**
     * Called when this bundle is started.
@@ -200,6 +203,36 @@
        return msgHistoryService;
    }

+
+
+ /**
+ * Returns the <tt>AppletService</tt> obtained from the bundle
+ * context.
+ * @return the <tt>AppletService</tt> obtained from the bundle
+ * context
+ */
+ public static AppletService getAppletService()
+ {
+ if (appletService == null)
+ {
+ ServiceReference serviceReference = bundleContext
+ .getServiceReference(AppletService.class.getName());
+
+ appletService = (AppletService) bundleContext
+ .getService(serviceReference);
+
+ }
+
+ return appletService;
+ }
+
+ public static boolean isAppletGui()
+ {
+ return (getAppletService().getApplet() != null);
+ }
+
+
+
    /**
     * Returns the <tt>MetaContactListService</tt> obtained from the
bundle
     * context.
Index: net/java/sip/communicator/impl/gui/main/MainFrame.java

--- net/java/sip/communicator/impl/gui/main/MainFrame.java (revision
3560)
+++ net/java/sip/communicator/impl/gui/main/MainFrame.java (working
copy)
@@ -127,14 +127,7 @@
     * Initiates the content of this frame.
     */
    private void init()
- {
- this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0),
- new RenameAction());
- this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,
- KeyEvent.ALT_DOWN_MASK), new ForwordTabAction());
- this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,
- KeyEvent.ALT_DOWN_MASK), new BackwordTabAction());
-
+ {
        this.contactListPanel.add(tabbedPane, BorderLayout.CENTER);
        this.contactListPanel.add(callManager, BorderLayout.SOUTH);

@@ -143,7 +136,7 @@
        this.mainPanel.add(contactListPanel, BorderLayout.CENTER);
        this.mainPanel.add(statusPanel, BorderLayout.SOUTH);

- JPanel menusPanel = new JPanel(new BorderLayout(0, 5));
+ JPanel menusPanel = new JPanel(new BorderLayout(0, 5));

        menusPanel.add(menu, BorderLayout.CENTER);
        menusPanel.add(quickMenu, BorderLayout.SOUTH);
@@ -152,9 +145,28 @@

        northPanel.add(new LogoBar(), BorderLayout.NORTH);
        northPanel.add(menusPanel, BorderLayout.CENTER);
+

- this.getContentPane().add(northPanel, BorderLayout.NORTH);
- this.getContentPane().add(mainPanel, BorderLayout.CENTER);
+ // check whether we are running inside an applet
+ if (GuiActivator.isAppletGui())
+ {
+ JApplet applet = GuiActivator.getAppletService
().getApplet();
+
+ applet.getContentPane().add(northPanel, BorderLayout.NORTH
);
+ applet.getContentPane().add(mainPanel, BorderLayout.CENTER
);
+
+ } else
+ {
+ this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F2,
0),
+ new RenameAction());
+ this.addKeyBinding(KeyStroke.getKeyStroke(
KeyEvent.VK_RIGHT,
+ KeyEvent.ALT_DOWN_MASK), new
ForwordTabAction());
+ this.addKeyBinding(KeyStroke.getKeyStroke(
KeyEvent.VK_LEFT,
+ KeyEvent.ALT_DOWN_MASK), new
BackwordTabAction());
+
+ this.getContentPane().add(northPanel,
BorderLayout.NORTH);
+ this.getContentPane().add(mainPanel, BorderLayout.CENTER);
+ }
    }

    /**
@@ -166,9 +178,15 @@
        int height = SizeProperties.getSize("mainWindowHeight");

        this.setSize(width, height);
-
- this.setLocation(Toolkit.getDefaultToolkit
().getScreenSize().width
+
+ if (GuiActivator.isAppletGui())
+ {
+ this.setLocation(0, 0);
+ } else
+ {
+ this.setLocation(Toolkit.getDefaultToolkit
().getScreenSize().width
                - this.getWidth(), 50);
+ }
    }

    /**
@@ -1009,7 +1027,43 @@
            return this.statusPanel.getLastStatusString(protocolProvider);
    }

- /**
+ @Override
+ public void dispose()
+ {
+ // don't call dispose if we are in an applet
+ if (!GuiActivator.isAppletGui())
+ {
+ super.dispose();
+ }
+ }
+
+ @Override
+ public void setVisible(boolean isVisible)
+ {
+ // don't call setVisible if we are in an applet
+ if (!GuiActivator.isAppletGui())
+ {
+ super.setVisible(isVisible);
+ }
+ }
+
+
+
+ @Override
+ public void validate()
+ {
+ // call validate on the applet if we are in an applet
+ if (GuiActivator.isAppletGui())
+ {
+ GuiActivator.getAppletService().getApplet().validate();
+ // otherwise call the original method
+ } else
+ {
+ super.validate();
+ }
+ }
+
+ /**
     * <tt>RenameAction</tt> is invoked when user presses the F2 key.
Depending
     * on the selection opens the appropriate form for renaming.
     */
Index: net/java/sip/communicator/impl/gui/main/menus/FileMenu.java

--- net/java/sip/communicator/impl/gui/main/menus/FileMenu.java (revision
3560)
+++ net/java/sip/communicator/impl/gui/main/menus/FileMenu.java (working
copy)
@@ -104,10 +104,13 @@

        this.add(createChatRoomItem);
        this.add(searchForChatRoomsItem);
-
- this.addSeparator();
-
- this.add(closeMenuItem);
+
+ if (!GuiActivator.isAppletGui())
+ {
+ this.addSeparator();
+
+ this.add(closeMenuItem);
+ }

        //this.addContactItem.setIcon(new ImageIcon(ImageLoader
        // .getImage(ImageLoader.ADD_CONTACT_16x16_ICON)));
@@ -113,7 +116,10 @@
        // .getImage(ImageLoader.ADD_CONTACT_16x16_ICON)));

        this.newAccountMenuItem.setName("newAccount");
- this.closeMenuItem.setName("close");
+ if (!GuiActivator.isAppletGui())
+ {
+ this.closeMenuItem.setName("close");
+ }
        this.addContactItem.setName("addContact");
        this.createGroupItem.setName("createGroup");
        this.createChatRoomItem.setName("createChatRoom");
@@ -120,7 +126,10 @@
        this.searchForChatRoomsItem.setName("searchForChatRooms");

        this.newAccountMenuItem.addActionListener(this);
- this.closeMenuItem.addActionListener(this);
+ if (!GuiActivator.isAppletGui())
+ {
+ this.closeMenuItem.addActionListener(this);
+ }
        this.addContactItem.addActionListener(this);
        this.createGroupItem.addActionListener(this);
        this.createChatRoomItem.addActionListener(this);
@@ -127,7 +136,10 @@
        this.searchForChatRoomsItem.addActionListener(this);

        this.setMnemonic(fileString.getMnemonic());
- this.closeMenuItem.setMnemonic(closeString.getMnemonic());
+ if (!GuiActivator.isAppletGui())
+ {
+ this.closeMenuItem.setMnemonic(closeString.getMnemonic());
+ }
        this.newAccountMenuItem.setMnemonic(newAccountString.getMnemonic
());
        this.addContactItem.setMnemonic(addContactString.getMnemonic());
        this.createGroupItem.setMnemonic(createGroupString.getMnemonic());
Index: net/java/sip/communicator/impl/gui/swing.ui.manifest.mf

--- net/java/sip/communicator/impl/gui/swing.ui.manifest.mf (revision
3560)
+++ net/java/sip/communicator/impl/gui/swing.ui.manifest.mf (working
copy)
@@ -39,4 +39,5 @@
javax.swing.undo,
javax.swing.border,
net.java.sip.communicator.service.audionotifier,
- org.jdesktop.jdic.desktop
+ org.jdesktop.jdic.desktop,
+ net.java.sip.communicator.service.applet
Index: net/java/sip/communicator/impl/applet/AppletImpl.java

--- net/java/sip/communicator/impl/applet/AppletImpl.java
+++ net/java/sip/communicator/impl/applet/AppletImpl.java
@@ -0,0 +1,35 @@
+package net.java.sip.communicator.impl.applet;
+
+import javax.swing.JApplet;
+
+import net.java.sip.communicator.service.applet.AppletService;
+
+/**
+ * Holds an applet.
+ * @author Sebastian Heib - <a href="mailto:heib@synyx.de">heib@synyx.de
</a>
+ *
+ */
+public class AppletImpl implements AppletService
+{
+
+ private JApplet applet;
+
+ /**
+ * Creates a new instance.
+ * @param applet the applet to be used
+ */
+ public AppletImpl(JApplet applet)
+ {
+ this.applet = applet;
+ }
+
+ /**
+ * Returns the applet.
+ * @return the applet
+ */
+ public JApplet getApplet()
+ {
+ return applet;
+ }
+
+}
Index: net/java/sip/communicator/impl/applet/AppletActivator.java

--- net/java/sip/communicator/impl/applet/AppletActivator.java
+++ net/java/sip/communicator/impl/applet/AppletActivator.java
@@ -0,0 +1,72 @@
+package net.java.sip.communicator.impl.applet;
+
+
+import javax.swing.JApplet;
+
+import net.java.sip.communicator.service.applet.AppletService;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * Activates an AppletBundle, to make the calling applet available to the
felix framework
+ * @author Sebastian Heib - <a href="mailto:heib@synyx.de">heib@synyx.de
</a>
+ *
+ */
+public class AppletActivator implements BundleActivator
+{
+
+ private BundleContext m_context = null;
+ private ServiceRegistration m_registration = null;
+ private JApplet applet = null;
+
+ /**
+ * Creates a new AppletActivator without an applet (when running in
+ * standard mode)
+ */
+ public AppletActivator()
+ {
+ //do nothing
+ }
+
+ /**
+ * Creates a new AppletActivator
+ * @param applet the applet that is made available for the framework
+ */
+ public AppletActivator(JApplet applet)
+ {
+ // Save a reference to the applet
+ this.applet = applet;
+ }
+
+ /**
+ * starts the bundle
+ * @param context the bundleContext
+ */
+ public void start(BundleContext context)
+ {
+ // Save a reference to the bundle context.
+ m_context = context;
+
+ // Create a property applet service
+ AppletService appletImpl = new AppletImpl(applet);
+
+ // Register the applet service and save
+ // the service registration.
+ m_registration = m_context.registerService(
+ AppletService.class.getName(), appletImpl, null);
+ }
+
+ /**
+ * stops the bundle
+ * @param context the bundleContext
+ */
+ public void stop(BundleContext context)
+ {
+ // Unregister the applet service.
+ m_registration.unregister();
+ m_context = null;
+ }
+
+}
Index: net/java/sip/communicator/impl/applet/applet.manifest.mf

--- net/java/sip/communicator/impl/applet/applet.manifest.mf
+++ net/java/sip/communicator/impl/applet/applet.manifest.mf
@@ -0,0 +1,9 @@
+Bundle-Activator: net.java.sip.communicator.util.AppletHostActivator
+Bundle-Name: Applet Service Implementation
+Bundle-Description: An implementation of the Applet service.
+Bundle-Vendor: sip-communicator.org
+Bundle-Version: 0.0.1
+Export-Package: net.java.sip.communicator.service.applet
+Import-Package: org.osgi.framework,
+ net.java.sip.communicator.util
+ net.java.sip.communicator.service.applet
Index: net/java/sip/communicator/launcher/SIPCommunicatorApplet.java

--- net/java/sip/communicator/launcher/SIPCommunicatorApplet.java
+++ net/java/sip/communicator/launcher/SIPCommunicatorApplet.java
@@ -0,0 +1,320 @@
+package net.java.sip.communicator.launcher;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JApplet;
+
+import net.java.sip.communicator.impl.applet.AppletActivator;
+
+import org.apache.felix.framework.Felix;
+import org.apache.felix.framework.cache.BundleCache;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.framework.util.StringMap;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+
+
+/**
+ *
+ * @author Sebastian Heib - <a href="mailto:heib@synyx.de">heib@synyx.de
</a>
+ *
+ */
+public class SIPCommunicatorApplet extends JApplet
+{
+ // the felix cache directory
+ private static final String CACHE_DIR = ".sip-communicator/bin";
+
+ // the old config file - sip-communicator.xml
+ private File oldConfigFile = null;
+
+ // the old contact list file - contactlist.xml
+ private File oldContactlistFile = null;
+
+ // the user's home dir
+ private String userHome = null;
+
+ private static final long serialVersionUID =
-2876656913837180952L;
+
+ // the auto-start property for felix 1.0.3
+// private static final String AUTO_START_PROP =
AutoActivator.AUTO_START_PROP;
+
+ // the auto-start property for felix 1.0.1
+ private static final String AUTO_START_PROP =
FelixConstants.AUTO_START_PROP;
+
+ // the felix instance
+ private Felix felix = null;
+
+ // the activator for the applet bundle
+ private AppletActivator appletActivator = null;
+
+
+ public void init()
+ {
+ userHome = System.getProperty("user.home") +
File.separator;
+ // remove the cache dir from a previous startup to make
sure that the new bundles are loaded
+ File existingCacheDir = new File(userHome + CACHE_DIR);
+ if (existingCacheDir.exists())
+ {
+ boolean deleted =
deleteDirectory(existingCacheDir);
+ }
+
+ //rename the config files - maybe there is a local
instance of sipCom, we would otherwise overwrite the config files
+ oldConfigFile = new File(userHome +
".sip-communicator/sip-communicator.xml");
+ if (oldConfigFile.exists())
+ {
+ File newFile = new File(userHome +
".sip-communicator/sip-communicator.xml." + System.currentTimeMillis());
+ if (oldConfigFile.renameTo(newFile))
+ {
+ oldConfigFile = newFile;
+ }
+ }
+
+ oldContactlistFile = new File(userHome +
".sip-communicator/contactlist.xml");
+ if (oldContactlistFile.exists())
+ {
+ File newFile = new File(userHome +
".sip-communicator/contactlist.xml." + System.currentTimeMillis());
+ if (oldContactlistFile.renameTo(newFile))
+ {
+ oldContactlistFile = newFile;
+ }
+ }
+
+
+ // use the codeBase as the server we are running on
+ String server = getCodeBase().toString();
+
+ // Print welcome banner.
+ System.out.println("\nWelcome to Felix.");
+ System.out.println("=================\n");
+
+ Map<String, String> configMap = new StringMap(false);
+
+ // Configure the Felix instance to be embedded.
+ configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
+
+ // add all the framework system packages to the config map
+ configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
+ "org.osgi.framework; version=1.3.0," +
+
+// "org.osgi.service.packageadmin; version=1.2.0," +
+// "org.osgi.service.startlevel; version=1.0.0," +
+// "org.osgi.service.url; version=1.0.0," +
+// "org.osgi.util.tracker; version=1.3.2," +
+
+ "javax.swing;" +
+ "javax.swing.event;" +
+ "javax.swing.table;" +
+ "javax.swing.text;" +
+ "javax.swing.text.html;" +
+ "javax.accessibility;" +
+ "javax.swing.plaf;" +
+ "javax.swing.plaf.metal;" +
+ "javax.swing.plaf.basic;" +
+ "javax.imageio;" +
+ "javax.swing.tree;" +
+ "javax.swing.undo;" +
+ "javax.swing.event;" +
+ "javax.swing.border;" +
+ "javax.swing.filechooser;" +
+ "org.w3c.dom;" +
+ "org.xml.sax;" +
+ "org.xml.sax.ext;" +
+ "javax.xml.parsers;" +
+ "org.apache.xml.serialize;" +
+ "javax.xml.transform;" +
+ "javax.xml.transform.dom;" +
+ "javax.xml.transform.stream;" +
+ "sun.security.action;" +
+ "sun.misc;" +
+ "javax.net;" +
+ "javax.net.ssl;" +
+ "javax.naming;" +
+ "javax.naming.directory;" +
+ "javax.sound;" +
+ "javax.sound.sampled;" +
+ "org.jdesktop.jdic.tray;" +
+ "org.jdesktop.jdic.desktop;" +
+ "com.apple.eio;" +
+ "org.xml.sax.helpers;" +
+ "net.java.sip.communicator.service.applet;");
+
+
+ // add all the bundles we need to the config map
+ configMap.put(AUTO_START_PROP + ".10",
+ server +
"lib/bundle/org.apache.felix.bundlerepository-1.0.0.jar " +
+ server +
"lib/bundle/org.apache.felix.servicebinder-0.9.0-SNAPSHOT.jar");
+
+ configMap.put(AUTO_START_PROP + ".20",
+ server + "sc-bundles/util.jar " +
+ server + "lib/bundle/log4j.jar");
+
+ configMap.put(AUTO_START_PROP + ".30",
+ server + "sc-bundles/contacteventhandler.jar " +
+ server + "sc-bundles/fileaccess.jar");
+
+ configMap.put(AUTO_START_PROP + ".40",
+ server + "sc-bundles/configuration.jar " +
+ server + "sc-bundles/version.jar " +
+ server + "sc-bundles/version-impl.jar " +
+ server + "sc-bundles/branding.jar");
+
+ configMap.put(AUTO_START_PROP + ".50",
+ server + "sc-bundles/browserlauncher.jar " +
+ server + "sc-bundles/protocol.jar " +
+ server + "sc-bundles/contactlist.jar " +
+ server + "sc-bundles/media.jar " +
+ // server + "sc-bundles/protocol-icq.jar " +
+ server + "sc-bundles/protocol-sip.jar " +
+ server + "sc-bundles/smacklib.jar " +
+ server + "sc-bundles/protocol-jabber.jar " +
+ //server + "sc-bundles/protocol-msn.jar " +
+ //server + "sc-bundles/protocol-yahoo.jar " +
+ //server + "sc-bundles/protocol-gibberish.jar " +
+ server + "sc-bundles/netaddr.jar " +
+// server + "sc-bundles/protocol-rss.jar " +
+ //server + "sc-bundles/protocol-zeroconf.jar " +
+// server + "sc-bundles/protocol-irc.jar " +
+ server + "sc-bundles/meta-cl.jar");
+
+ configMap.put(AUTO_START_PROP + ".60",
+ server + "sc-bundles/accountinstaller.jar " +
+ server + "sc-bundles/history.jar " +
+ server + "sc-bundles/msghistory.jar " +
+ server + "sc-bundles/callhistory.jar " +
+ server + "sc-bundles/audionotifier.jar " +
+ server + "sc-bundles/notification.jar");
+
+ configMap.put(AUTO_START_PROP + ".66",
+ server + "sc-bundles/swing-ui.jar " +
+ server + "sc-bundles/systray.jar"
+ );
+
+ configMap.put(AUTO_START_PROP + ".67",
+// server + "sc-bundles/pluginmanager.jar " +
+ server + "sc-bundles/whiteboard.jar " +
+ //server + "sc-bundles/icqaccregwizz.jar " +
+ //server + "sc-bundles/aimaccregwizz.jar " +
+// server + "sc-bundles/sipaccregwizz.jar " +
+// server + "sc-bundles/jabberaccregwizz.jar " +
+ //server + "sc-bundles/msnaccregwizz.jar " +
+ //server + "sc-bundles/yahooaccregwizz.jar " +
+ //server + "sc-bundles/gibberishaccregwizz.jar " +
+ server + "sc-bundles/extendedcallhistorysearch.jar
" +
+// server + "sc-bundles/rssaccregwizz.jar " +
+ //server + "sc-bundles/zeroconfaccregwizz.jar " +
+// server + "sc-bundles/ircaccregwizz.jar " +
+ //server + "sc-bundles/contacteventhandler.jar " +
+ server + "sc-bundles/minosaddresses.jar " +
+ server + "sc-bundles/shutdown.jar");
+
+
+
+ configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP,
+ CACHE_DIR);
+
+ configMap.put("felix.startlevel.framework", "100");
+
+ configMap.put("felix.startlevel.bundle", "100");
+
+ // this prevents felix from loading stream and content factories
a second time
+ configMap.put("felix.service.urlhandlers", "false");
+
+
+ // create an AppletActivator to make this applet available to the
framwork
+ appletActivator = new AppletActivator(this);
+
+ // add this appletActivator to the parameter list for felix
+ List list = new ArrayList();
+ list.add(appletActivator);
+
+ // add an autoActivator to start the bundles - only in Felix 1.0.3
+// list.add(new AutoActivator(configMap));
+
+ try
+ {
+ // Now create an instance of the framework.
+ felix = new Felix(configMap, list);
+ // and start it!
+ felix.start();
+ }
+ catch (Exception ex)
+ {
+ System.err.println("Could not create framework: " + ex);
+ ex.printStackTrace();
+ }
+ }
+
+ public void start()
+ {
+
+ }
+
+ public void stop()
+ {
+
+ }
+
+
+ public void destroy()
+ {
+
+ // Shut down the felix framework when stopping the
+ // host application.
+ try
+ {
+ felix.stop();
+ } catch (BundleException e)
+ {
+ e.printStackTrace();
+ }
+
+ //delete the applet config files
+ File configFile = new File(userHome +
".sip-communicator/sip-communicator.xml");
+ if (configFile.exists())
+ {
+ configFile.delete();
+ }
+
+ File contactListFile = new File(userHome +
".sip-communicator/contactlist.xml");
+ if (contactListFile.exists())
+ {
+ contactListFile.delete();
+ }
+
+ //rename the old config files
+ if (oldConfigFile.exists())
+ {
+ oldConfigFile.renameTo(new File(userHome +
".sip-communicator/sip-communicator.xml"));
+ }
+
+ if (oldContactlistFile.exists())
+ {
+ oldContactlistFile.renameTo(new File(userHome +
".sip-communicator/contactlist.xml"));
+ }
+ }
+
+
+ private boolean deleteDirectory(File path)
+ {
+ if (path.exists())
+ {
+ File[] files = path.listFiles();
+ for (int i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory())
+ {
+ deleteDirectory(files[i]);
+ } else
+ {
+ files[i].delete();
+ }
+ }
+ }
+ return (path.delete());
+ }
+
+
+}
Index: net/java/sip/communicator/service/applet/AppletService.java

--- net/java/sip/communicator/service/applet/AppletService.java
+++ net/java/sip/communicator/service/applet/AppletService.java
@@ -0,0 +1,18 @@
+package net.java.sip.communicator.service.applet;
+
+import javax.swing.JApplet;
+
+/**
+ * Service to provide access to the external applet object
+ * @author Sebastian Heib - <a href="mailto:heib@synyx.de">heib@synyx.de
</a>
+ *
+ */
+public interface AppletService
+{
+ /**
+ *
+ * @return the applet
+ */
+ public JApplet getApplet();
+
+}

Index: .

--- . (revision 3560)
+++ . (working copy)
@@ -12,6 +12,7 @@
    <property name="bundles.dest.win" value="${bundles.dest
}/os-specific/windows"/>
    <property name="bundles.dest.lin" value="${bundles.dest
}/os-specific/linux"/>
    <property name="bundles.dest.sol" value="${bundles.dest
}/os-specific/solaris"/>
+ <property name="bundles.signed.dest"
value="/opt/lampp/htdocs/sipcom/sc-bundles"/>
    <property name="doc" value="doc"/>
    <property name="java.doc" value="${doc}/api"/>
    <property name="lib" value="${sc.basedir}/lib"/>
@@ -39,6 +40,10 @@
    <property name="resources" value="${dest}/resources"/>
    <property name="inst.resrc" value="${sc.basedir}/resources/install"/>
    <property name="path" value="${lib}/native/windows;${system.PATH}"/>
+ <property name="keystore" value="sipcomkeystore"/>
+ <property name="keystore.alias" value="sipcom"/>
+ <property name="keystore.password" value="geheim"/>
+

    <!-- set the build label property and make it take the cc bild into
account -->
    <condition property="build.label"
@@ -289,6 +294,7 @@
            includes="**/*.properties"/>
    </target>

+
    <!-- JAVADOC -->
    <target name="javadoc"
      description="Generates project javadoc.">
@@ -615,7 +621,7 @@
        bundle-irc,bundle-plugin-ircaccregwizz,
        bundle-pluginmanager,bundle-notification,
        bundle-ssh,bundle-plugin-sshaccregwizz,
- bundle-contacteventhandler,bundle-plugin-contactinfo,
+ bundle-contacteventhandler,bundle-plugin-contactinfo,
        bundle-plugin-accountinfo,bundle-plugin-chatalerter,
        bundle-updatecheckplugin"/>

@@ -1161,6 +1167,7 @@
        </jar>
    </target>

+
    <!-- BUNDLE-PLUGIN-AIMACCREGWIZZ -->
    <target name="bundle-plugin-aimaccregwizz">
        <!-- Creates a bundle for the plugin Aim Account Registration
Wizard.-->
@@ -1620,5 +1627,40 @@
                prefix="resources/languages/plugin/updatechecker"/>
        </jar>
    </target>
-
+
+
+ <!-- APPLET JAR -->
+ <target name="bundle-applet-starter">
+ <!-- Creates a jar with the applet bundle to start as an
applet.-->
+ <jar compress="false" destfile="${bundles.dest}/applet-
starter.jar"
+
manifest="${src}/net/java/sip/communicator/impl/applet/applet.manifest.mf">
+ <zipfileset
dir="${dest}/net/java/sip/communicator/launcher"
+ prefix="net/java/sip/communicator/launcher"/>
+ <zipfileset
dir="${dest}/net/java/sip/communicator/impl/applet"
+
prefix="net/java/sip/communicator/impl/applet"/>
+ <zipfileset
dir="${dest}/net/java/sip/communicator/service/applet"
+
prefix="net/java/sip/communicator/service/applet"/>
+ </jar>
+ </target>
+
+
+ <!-- sign all the created jars -->
+ <target name="sign-copy-jars">
+ <signjar alias="${keystore.alias}" keystore="${keystore}"
storepass="${keystore.password}"
+ lazy="true" destDir="${bundles.signed.dest}">
+ <path>
+ <fileset dir="${bundles.dest}"
includes="**/*.jar">
+ <!-- exclude the windows media jar as it
fails to sign it -->
+ <exclude name="**/windows/media.jar"/>
+ </fileset>
+ </path>
+ </signjar>
+ </target>
+
+
+ <!-- Rebuild the project, sign all the jars and copy to the
server-->
+ <target name="applet" depends="rebuild, bundle-applet-starter,
sign-copy-jars"
+ description="Rebuilds the project, signs all the jars and
copys those">
+ </target>
+
</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#4

Hey Seb,

Great news indeed! As JD already mentioned, there have been many people
asking for such a thing so it could be a very popular feature. I'll try
to review your patch as soon as possible but keep in mind that we are
all quite busy with GSoC right now and it might take some time before I
get there so please bear with me.

Cheers
Emil

Sebastian Heib написа:

···

Hi,

I have written a patch, that allows it to start SC as an applet within a
web page.

The patch has two files: one that's for the sources, and another one
that is for the build file.

I have extended the build file with an "applet" task, that will build SC
with an additional applet bundle and signs all the jars afterwards. For
that purpose, it is necessary that you have a keystore with a key in it.

The applet starter starts Felix embedded in the applet. At the moment it
will only load the protocols and wizards for sip and jabber, but the
others only need to be uncommented in the source.
This applet starter is still very basic (to be improved), but it works.

To run it as an applet, I have attached an example html file. On the
server, the folder structure has to be in the same way as the normal SC
folder structure. In the "sc-bundles" directory, the media.jar that you
want to use must be present.

I have tested the applet on my Ubuntu system with Firefox. It should run
on other systems/ browsers as well, as long as a java plugin is installed.

Regards,
Sebastian

------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#5

Hi,
I've tried running SIP Communicator as applet on Windows XP using Sebastians patches, but it seems I have two jars missing: accountinstaller.jar and minosaddresses.jar. Does anyone know what these jars are and how can I obtain them?

I've checked out latest SIP Communicator source code from SVN and applied patches Sebastian sent (though I had to perform some changes manually on build.xml).

Thanks,
Zoran

···

_____

From: Sebastian Heib [mailto:heib@synyx.de]

To: dev@sip-communicator.dev.java.net
Sent: Wed, 26 Mar 2008 14:10:37 +0000
Subject: [sip-comm-dev] Applet patch

Hi,
  
  I have written a patch, that allows it to start SC as an applet within a
  web page.
  
  The patch has two files: one that's for the sources, and another one
  that is for the build file.
  
  I have extended the build file with an "applet" task, that will build SC
  with an additional applet bundle and signs all the jars afterwards. For
  that purpose, it is necessary that you have a keystore with a key in it.
  
  The applet starter starts Felix embedded in the applet. At the moment it
  will only load the protocols and wizards for sip and jabber, but the
  others only need to be uncommented in the source.
  This applet starter is still very basic (to be improved), but it works.
  
  To run it as an applet, I have attached an example html file. On the
  server, the folder structure has to be in the same way as the normal SC
  folder structure. In the "sc-bundles" directory, the media.jar that you
  want to use must be present.
  
  I have tested the applet on my Ubuntu system with Firefox. It should run
  on other systems/ browsers as well, as long as a java plugin is installed.
  
  Regards,
  Sebastian
  
  --
  /**
   * Sebastian Heib
   * Software Developer
   *
   * Synyx GmbH & Co. KG
   * Business in Components
   * Karlstr. 68
   * 76137 Karlsruhe
   *
   * phone +49(0)721 66 24 866
   * fax +49(0)721 66 48 877
   * eMail heib@synyx.de
   * www http://www.synyx.de
   * irc irc.synyx.de
   *
   * Sitz der Gesellschaft: Karlsruhe
   * Registergericht: Mannheim
   * Handelsregisternummer: HRA 4793
   * USt-IdNr.: DE249264296
   *
   * Komplementärin: Elatech Verwaltungs GmbH
   * Sitz der Gesellschaft: Karlsruhe
   * Geschäftsführer: Markus Daniel
   * Registergericht: Mannheim
   * Handelsregisternummer: HRB 7250
   */


#6

Hi,
It's a great news !! :slight_smile:
Create signed jar it's a good idea.
But I've some problem with the build.xml and signjar option.
I've changed the sign-copy-jars target :

<!-- sign all the created jars -->
<target name="sign-copy-jars">
   <delete file="${keystore}"/>
   <genkey alias="${keystore.alias}"
    keystore="${keystore}" storepass="${keystore.password}" >
     <dname>
    <param name="CN" value="SIP-Communicator Group"/>
    <param name="OU" value="SIP-Communicator Division"/>
     <param name="O" value="sip-communicator.org"/>
    <param name="C" value="FR"/>
    </dname>
   </genkey>
   <signjar alias="${keystore.alias}"
     keystore="${keystore}" storepass="${keystore.password}"
     lazy="true" destDir="${bundles.signed.dest}">
    <path>
         <fileset dir="${bundles.dest}" includes="**/*.jar">
             <!--exclude the windows media jar as it fails to sign it-->
            <exclude name="**/windows/*.jar"/>
             <exclude name="**/linux/*.jar"/>
             <exclude name="**/macosx/*.jar"/>
        </fileset>
     </path>
   </signjar>
  <signjar alias="${keystore.alias}"
     keystore="${keystore}" storepass="${keystore.password}"
    lazy="true" destDir="${bundles.signed.dest}/lib">
     <path>
    <fileset dir="${lib}" includes="*.jar"/>
     </path>
  </signjar>
</target>

I've the SIP-Comm's main interface with many Felix errors with Firefox
(2.0.0.13)
and Internet Explorer7, but it's not "usable" (any chat-plugin was
loaded correctly)
Have you done something special?
I've forgotten something?
(I've a server if you want test)

Regards,
Julien

···

2008/3/26, Emil Ivov <emcho@sip-communicator.org>:

Hey Seb,

Great news indeed! As JD already mentioned, there have been many people
asking for such a thing so it could be a very popular feature. I'll try
to review your patch as soon as possible but keep in mind that we are
all quite busy with GSoC right now and it might take some time before I
get there so please bear with me.

Cheers
Emil

Sebastian Heib написа:

> Hi,
>
> I have written a patch, that allows it to start SC as an applet within a
> web page.
>
> The patch has two files: one that's for the sources, and another one
> that is for the build file.
>
> I have extended the build file with an "applet" task, that will build SC
> with an additional applet bundle and signs all the jars afterwards. For
> that purpose, it is necessary that you have a keystore with a key in it.
>
> The applet starter starts Felix embedded in the applet. At the moment it
> will only load the protocols and wizards for sip and jabber, but the
> others only need to be uncommented in the source.
> This applet starter is still very basic (to be improved), but it works.
>
> To run it as an applet, I have attached an example html file. On the
> server, the folder structure has to be in the same way as the normal SC
> folder structure. In the "sc-bundles" directory, the media.jar that you
> want to use must be present.
>
> I have tested the applet on my Ubuntu system with Firefox. It should run
> on other systems/ browsers as well, as long as a java plugin is installed.
>
> Regards,
> Sebastian
>
>
>
>

> ------------------------------------------------------------------------

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
> For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#7

Hi Zoran,

the references to those jars seem to be in there by mistake - you don't
need them. So just feel free to delete them out of the
sipCommunicatorApplet class.

Sebastian

Zoran Lovric schrieb:

···

Hi,
I've tried running SIP Communicator as applet on Windows XP using Sebastians patches, but it seems I have two jars missing: accountinstaller.jar and minosaddresses.jar. Does anyone know what these jars are and how can I obtain them?

I've checked out latest SIP Communicator source code from SVN and applied patches Sebastian sent (though I had to perform some changes manually on build.xml).

Thanks,
Zoran

  _____

From: Sebastian Heib [mailto:heib@synyx.de]
To: dev@sip-communicator.dev.java.net
Sent: Wed, 26 Mar 2008 14:10:37 +0000
Subject: [sip-comm-dev] Applet patch

Hi,
  
  I have written a patch, that allows it to start SC as an applet within a
  web page.
  
  The patch has two files: one that's for the sources, and another one
  that is for the build file.
  
  I have extended the build file with an "applet" task, that will build SC
  with an additional applet bundle and signs all the jars afterwards. For
  that purpose, it is necessary that you have a keystore with a key in it.
  
  The applet starter starts Felix embedded in the applet. At the moment it
  will only load the protocols and wizards for sip and jabber, but the
  others only need to be uncommented in the source.
  This applet starter is still very basic (to be improved), but it works.
  
  To run it as an applet, I have attached an example html file. On the
  server, the folder structure has to be in the same way as the normal SC
  folder structure. In the "sc-bundles" directory, the media.jar that you
  want to use must be present.
  
  I have tested the applet on my Ubuntu system with Firefox. It should run
  on other systems/ browsers as well, as long as a java plugin is installed.
  
  Regards,
  Sebastian
  
  --
  /**
   * Sebastian Heib
   * Software Developer
   *
   * Synyx GmbH & Co. KG
   * Business in Components
   * Karlstr. 68
   * 76137 Karlsruhe
   *
   * phone +49(0)721 66 24 866
   * fax +49(0)721 66 48 877
   * eMail heib@synyx.de
   * www http://www.synyx.de
   * irc irc.synyx.de
   *
   * Sitz der Gesellschaft: Karlsruhe
   * Registergericht: Mannheim
   * Handelsregisternummer: HRA 4793
   * USt-IdNr.: DE249264296
   *
   * Komplement�rin: Elatech Verwaltungs GmbH
   * Sitz der Gesellschaft: Karlsruhe
   * Gesch�ftsf�hrer: Markus Daniel
   * Registergericht: Mannheim
   * Handelsregisternummer: HRB 7250
   */
    
--
/**
* Sebastian Heib
* Software Developer
*
* Synyx GmbH & Co. KG
* Business in Components
* Karlstr. 68
* 76137 Karlsruhe
*
* phone +49(0)721 66 24 866
* fax +49(0)721 66 48 877
* eMail heib@synyx.de
* www http://www.synyx.de
* irc irc.synyx.de
*
* Sitz der Gesellschaft: Karlsruhe
* Registergericht: Mannheim
* Handelsregisternummer: HRA 4793
* USt-IdNr.: DE249264296
*
* Komplement�rin: Elatech Verwaltungs GmbH
* Sitz der Gesellschaft: Karlsruhe
* Gesch�ftsf�hrer: Markus Daniel
* Registergericht: Mannheim
* Handelsregisternummer: HRB 7250
*/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#8

Hi Sebastian,
I've managed to start SIP Communicator as Web-start application using your example, thanks.

Now I'm having problems with JMF on Windows XP. I'll post a message on SIP Communicator dev list.

Zoran

···

_____

From: Sebastian Heib [mailto:heib@synyx.de]

To: dev@sip-communicator.dev.java.net
Sent: Tue, 29 Apr 2008 15:18:54 +0100
Subject: Re: [sip-comm-dev] Applet patch

Hi Zoran,
  
  the references to those jars seem to be in there by mistake - you don't
  need them. So just feel free to delete them out of the
  sipCommunicatorApplet class.
  
  Sebastian
  
  Zoran Lovric schrieb:
  > Hi,
  > I've tried running SIP Communicator as applet on Windows XP using Sebastians patches, but it seems I have two jars missing: accountinstaller.jar and minosaddresses.jar. Does anyone know what these jars are and how can I obtain them?
  >
  > I've checked out latest SIP Communicator source code from SVN and applied patches Sebastian sent (though I had to perform some changes manually on build.xml).
  >
  > Thanks,
  > Zoran
  >
  > _____
  >
  > From: Sebastian Heib [mailto:heib@synyx.de]
  > To: dev@sip-communicator.dev.java.net
  > Sent: Wed, 26 Mar 2008 14:10:37 +0000
  > Subject: [sip-comm-dev] Applet patch
  >
  > Hi,
  >
  > I have written a patch, that allows it to start SC as an applet within a
  > web page.
  >
  > The patch has two files: one that's for the sources, and another one
  > that is for the build file.
  >
  > I have extended the build file with an "applet" task, that will build SC
  > with an additional applet bundle and signs all the jars afterwards. For
  > that purpose, it is necessary that you have a keystore with a key in it.
  >
  > The applet starter starts Felix embedded in the applet. At the moment it
  > will only load the protocols and wizards for sip and jabber, but the
  > others only need to be uncommented in the source.
  > This applet starter is still very basic (to be improved), but it works.
  >
  > To run it as an applet, I have attached an example html file. On the
  > server, the folder structure has to be in the same way as the normal SC
  > folder structure. In the "sc-bundles" directory, the media.jar that you
  > want to use must be present.
  >
  > I have tested the applet on my Ubuntu system with Firefox. It should run
  > on other systems/ browsers as well, as long as a java plugin is installed.
  >
  > Regards,
  > Sebastian


#9

Ups, sorry guys, I thought I was sending private e-mail to Sebastian Heib. :slight_smile:

Anyway, as you probably already read, I'm having problems starting SIP Communicator as a web-start application. It seems JMF doesn't allow media capturing from applets. The exception I'm getting is:

INFO: Creating datasource for:javasound://44100
java.lang.RuntimeException: No permission to capture from applets
05-May-2008 15:16:45 net.java.sip.communicator.util.Logger error
SEVERE: Could not create data source for javasound://44100
javax.media.NoDataSourceException: Error instantiating class: com.sun.media.protocol.javasound.DataSource : java.lang.RuntimeException: No permission to capture from applets
    at javax.media.Manager.createDataSource(Manager.java:1012)
    at net.java.sip.communicator.impl.media.MediaControl.createDataSource(MediaControl.java:697)
    at net.java.sip.communicator.impl.media.MediaControl.initCaptureDevices(MediaControl.java:373)
    at net.java.sip.communicator.impl.media.MediaControl.initialize(MediaControl.java:213)
    at net.java.sip.communicator.impl.media.MediaServiceImpl$DeviceConfigurationThread.run(MediaServiceImpl.java:375)
    at net.java.sip.communicator.impl.media.MediaServiceImpl.start(MediaServiceImpl.java:222)
    at net.java.sip.communicator.impl.media.MediaActivator.start(MediaActivator.java:82)
    at org.apache.felix.framework.util.SecureAction$Actions.run(SecureAction.java:853)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:580)
    at org.apache.felix.framework.Felix._startBundle(Felix.java:1536)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1470)
    at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1065)
    at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258)
    at java.lang.Thread.run(Unknown Source)

I've tried to find a solution on the Internet. A lot of people had this problem, but I couldn't find general, platform-independent solution. XP and Vista seem to be most difficult in this regard.

I'm testing on Windows XP SP2 with JMF installed. I've used JMFRegistry tool to allow applet media capture and I've changed java.policy and javaws.policy files to give all permissions to all applets (just for testing purposes), but nothing helped.

When I try to call to call a mobile phone using SIP Account the phone rings but when it's answered SIP Communicator reports failed message. I'll send exception details for this situation later it anyone is interested.

···

_____

From: Zoran Lovric [mailto:zoran@q-sphere.com]

To: dev@sip-communicator.dev.java.net
Sent: Mon, 05 May 2008 14:08:36 +0100
Subject: Re: [sip-comm-dev] Applet patch

                Hi Sebastian,
I've managed to start SIP Communicator as Web-start application using your example, thanks.

Now I'm having problems with JMF on Windows XP. I'll post a message on SIP Communicator dev list.

Zoran
  _____

From: Sebastian Heib [mailto:heib@synyx.de]

To: dev@sip-communicator.dev.java.net
Sent: Tue, 29 Apr 2008 15:18:54 +0100
Subject: Re: [sip-comm-dev] Applet patch

Hi Zoran,
  
  the references to those jars seem to be in there by mistake - you don't
  need them. So just feel free to delete them out of the
  sipCommunicatorApplet class.
  
  Sebastian
  
  Zoran Lovric schrieb:
  > Hi,
  > I've tried running SIP Communicator as applet on Windows XP using Sebastians patches, but it seems I have two jars missing: accountinstaller.jar and minosaddresses.jar. Does anyone know what these jars are and how can I obtain them?
  >
  > I've checked out latest SIP Communicator source code from SVN and applied patches Sebastian sent (though I had to perform some changes manually on build.xml).
  >
  > Thanks,
  > Zoran
  >
  > _____
  >
  > From: Sebastian Heib [mailto:heib@synyx.de]
  > To: dev@sip-communicator.dev.java.net
  > Sent: Wed, 26 Mar 2008 14:10:37 +0000
  > Subject: [sip-comm-dev] Applet patch
  >
  > Hi,
  >
  > I have written a patch, that allows it to start SC as an applet within a
  > web page.
  >
  > The patch has two files: one that's for the sources, and another one
  > that is for the build file.
  >
  > I have extended the build file with an "applet" task, that will build SC
  > with an additional applet bundle and signs all the jars afterwards. For
  > that purpose, it is necessary that you have a keystore with a key in it.
  >
  > The applet starter starts Felix embedded in the applet. At the moment it
  > will only load the protocols and wizards for sip and jabber, but the
  > others only need to be uncommented in the source.
  > This applet starter is still very basic (to be improved), but it works.
  >
  > To run it as an applet, I have attached an example html file. On the
  > server, the folder structure has to be in the same way as the normal SC
  > folder structure. In the "sc-bundles" directory, the media.jar that you
  > want to use must be present.
  >
  > I have tested the applet on my Ubuntu system with Firefox. It should run
  > on other systems/ browsers as well, as long as a java plugin is installed.
  >
  > Regards,
  > Sebastian


#10

From what I can tell, the ability to record from an applet is supposed to be set here:

In JmfDeviceDetector:

            Registry.set(PROP_ALLOW_CAPTURE_FROM_APPLETS, new Boolean(true));

It might be worthwhile to check with the debugger that this is actually getting called.

(this is JMF-only code and would not be relevant if FMJ were used)

Ken

Zoran Lovric wrote:

···

Ups, sorry guys, I thought I was sending private e-mail to Sebastian Heib. :slight_smile:

Anyway, as you probably already read, I'm having problems starting SIP Communicator as a web-start application. It seems JMF doesn't allow media capturing from applets. The exception I'm getting is:

INFO: Creating datasource for:javasound://44100
java.lang.RuntimeException: No permission to capture from applets
05-May-2008 15:16:45 net.java.sip.communicator.util.Logger error
SEVERE: Could not create data source for javasound://44100
javax.media.NoDataSourceException: Error instantiating class: com.sun.media.protocol.javasound.DataSource : java.lang.RuntimeException: No permission to capture from applets
    at javax.media.Manager.createDataSource(Manager.java:1012)
    at net.java.sip.communicator.impl.media.MediaControl.createDataSource(MediaControl.java:697)
    at net.java.sip.communicator.impl.media.MediaControl.initCaptureDevices(MediaControl.java:373)
    at net.java.sip.communicator.impl.media.MediaControl.initialize(MediaControl.java:213)
    at net.java.sip.communicator.impl.media.MediaServiceImpl$DeviceConfigurationThread.run(MediaServiceImpl.java:375)
    at net.java.sip.communicator.impl.media.MediaServiceImpl.start(MediaServiceImpl.java:222)
    at net.java.sip.communicator.impl.media.MediaActivator.start(MediaActivator.java:82)
    at org.apache.felix.framework.util.SecureAction$Actions.run(SecureAction.java:853)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:580)
    at org.apache.felix.framework.Felix._startBundle(Felix.java:1536)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1470)
    at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1065)
    at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258)
    at java.lang.Thread.run(Unknown Source)

I've tried to find a solution on the Internet. A lot of people had this problem, but I couldn't find general, platform-independent solution. XP and Vista seem to be most difficult in this regard.

I'm testing on Windows XP SP2 with JMF installed. I've used JMFRegistry tool to allow applet media capture and I've changed java.policy and javaws.policy files to give all permissions to all applets (just for testing purposes), but nothing helped.

When I try to call to call a mobile phone using SIP Account the phone rings but when it's answered SIP Communicator reports failed message. I'll send exception details for this situation later it anyone is interested.

    ------------------------------------------------------------------------
    *From:* Zoran Lovric [mailto:zoran@q-sphere.com]
    *To:* dev@sip-communicator.dev.java.net
    *Sent:* Mon, 05 May 2008 14:08:36 +0100
    *Subject:* Re: [sip-comm-dev] Applet patch

    Hi Sebastian,
    I've managed to start SIP Communicator as Web-start application
    using your example, thanks.

    Now I'm having problems with JMF on Windows XP. I'll post a
    message on SIP Communicator dev list.

    Zoran

        ------------------------------------------------------------------------
        *From:* Sebastian Heib [mailto:heib@synyx.de
        <mailto:heib@synyx.de>]
        *To:* dev@sip-communicator.dev.java.net
        <mailto:dev@sip-communicator.dev.java.net>
        *Sent:* Tue, 29 Apr 2008 15:18:54 +0100
        *Subject:* Re: [sip-comm-dev] Applet patch

        Hi Zoran,

        the references to those jars seem to be in there by mistake -
        you don't
        need them. So just feel free to delete them out of the
        sipCommunicatorApplet class.

        Sebastian

        Zoran Lovric schrieb:
        > Hi,
        > I've tried running SIP Communicator as applet on Windows XP
        using Sebastians patches, but it seems I have two jars
        missing: accountinstaller.jar and minosaddresses.jar. Does
        anyone know what these jars are and how can I obtain them?
        >
        > I've checked out latest SIP Communicator source code from
        SVN and applied patches Sebastian sent (though I had to
        perform some changes manually on build.xml).
        >
        > Thanks,
        > Zoran
        >
        > _____
        >
        > From: Sebastian Heib [mailto:heib@synyx.de
        <mailto:heib@synyx.de>]
        > To: dev@sip-communicator.dev.java.net
        <mailto:dev@sip-communicator.dev.java.net>
        > Sent: Wed, 26 Mar 2008 14:10:37 +0000
        > Subject: [sip-comm-dev] Applet patch
        >
        > Hi,
        >
        > I have written a patch, that allows it to start SC as an
        applet within a
        > web page.
        >
        > The patch has two files: one that's for the sources, and
        another one
        > that is for the build file.
        >
        > I have extended the build file with an "applet" task, that
        will build SC
        > with an additional applet bundle and signs all the jars
        afterwards. For
        > that purpose, it is necessary that you have a keystore with
        a key in it.
        >
        > The applet starter starts Felix embedded in the applet. At
        the moment it
        > will only load the protocols and wizards for sip and jabber,
        but the
        > others only need to be uncommented in the source.
        > This applet starter is still very basic (to be improved),
        but it works.
        >
        > To run it as an applet, I have attached an example html
        file. On the
        > server, the folder structure has to be in the same way as
        the normal SC
        > folder structure. In the "sc-bundles" directory, the
        media.jar that you
        > want to use must be present.
        >
        > I have tested the applet on my Ubuntu system with Firefox.
        It should run
        > on other systems/ browsers as well, as long as a java plugin
        is installed.
        >
        > Regards,
        > Sebastian