Commits the patch of Linus Wallgren which introduces ShutdownService to better abstract the shutdown procedure of the application.

cusax-fix
Lyubomir Marinov 16 years ago
parent 8477810824
commit 6bacfb8901

@ -788,7 +788,7 @@
bundle-plugin-icqaccregwizz,bundle-plugin-jabberaccregwizz,
bundle-plugin-msnaccregwizz,bundle-plugin-sipaccregwizz,
bundle-plugin-yahooaccregwizz,bundle-plugin-aimaccregwizz,
bundle-version,bundle-version-impl,bundle-shutdown,
bundle-version,bundle-version-impl,bundle-shutdown-timeout,
bundle-growlnotification,bundle-swingnotification,bundle-sparkle,
bundle-audionotifier,bundle-plugin-branding,
bundle-osdependent,bundle-browserlauncher,bundle-gibberish,
@ -1329,6 +1329,8 @@ javax.swing.event, javax.swing.border"/>
manifest="${src}/net/java/sip/communicator/service/gui/gui.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/service/gui"
prefix="net/java/sip/communicator/service/gui"/>
<zipfileset dir="${dest}/net/java/sip/communicator/service/shutdown"
prefix="net/java/sip/communicator/service/shutdown"/>
</jar>
</target>
@ -1497,13 +1499,13 @@ javax.swing.event, javax.swing.border"/>
</jar>
</target>
<!-- BUNDLE-SHUTDOWN -->
<target name="bundle-shutdown">
<!-- Creates a bundle for the shutdown plugin.-->
<jar compress="false" destfile="${bundles.dest}/shutdown.jar"
manifest="${src}/net/java/sip/communicator/impl/shutdown/shutdown.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/impl/shutdown"
prefix="net/java/sip/communicator/impl/shutdown"/>
<!-- BUNDLE-SHUTDOWN-TIMEOUT -->
<target name="bundle-shutdown-timeout">
<!-- Creates a bundle for the shutdown-timeout plugin.-->
<jar compress="false" destfile="${bundles.dest}/shutdown-timeout.jar"
manifest="${src}/net/java/sip/communicator/impl/shutdowntimeout/shutdown.timeout.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/impl/shutdowntimeout"
prefix="net/java/sip/communicator/impl/shutdowntimeout"/>
</jar>
</target>

@ -177,7 +177,7 @@ felix.auto.start.75= \
reference:file:sc-bundles/argdelegation.jar
felix.auto.start.80= \
reference:file:sc-bundles/shutdown.jar
reference:file:sc-bundles/shutdown-timeout.jar
# Uncomment the following lines if you want to run the architect viewer
# bundle.

@ -22,6 +22,7 @@
import net.java.sip.communicator.service.notification.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.service.shutdown.*;
import net.java.sip.communicator.service.systray.*;
import net.java.sip.communicator.util.*;
@ -93,11 +94,16 @@ public void start(BundleContext bContext)
logger.info("UI Service...[ STARTED ]");
bundleContext.registerService( UIService.class.getName(),
uiService, null);
bundleContext.registerService(UIService.class.getName(),
uiService,
null);
logger.info("UI Service ...[REGISTERED]");
// UIServiceImpl also implements ShutdownService.
bundleContext.registerService(ShutdownService.class.getName(),
(ShutdownService) uiService,
null);
uiService.loadApplicationGui();
logger.logEntry();

@ -30,6 +30,7 @@
import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.service.shutdown.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
@ -45,9 +46,10 @@
* @author Lubomir Marinov
*/
public class UIServiceImpl
implements UIService,
ServiceListener,
PropertyChangeListener
implements UIService,
ShutdownService,
ServiceListener,
PropertyChangeListener
{
private static final Logger logger = Logger.getLogger(UIServiceImpl.class);
@ -1048,8 +1050,8 @@ public boolean useMacOSXScreenMenuBar()
}
/*
* Implements UIService#beginShutdown(). Disposes of the mainFrame (if it
* exists) and then instructs Felix to start shutting down the bundles so
* Implements ShutdownService#beginShutdown(). Disposes of the mainFrame (if
* it exists) and then instructs Felix to start shutting down the bundles so
* that the application can gracefully quit.
*/
public void beginShutdown()

@ -14,40 +14,41 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.contacteventhandler,
net.java.sip.communicator.service.contactlist,
net.java.sip.communicator.service.contactlist.event,
net.java.sip.communicator.service.desktop,
net.java.sip.communicator.service.fileaccess,
net.java.sip.communicator.service.filehistory,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
net.java.sip.communicator.service.history.event,
net.java.sip.communicator.service.keybindings,
net.java.sip.communicator.service.msghistory,
net.java.sip.communicator.service.filehistory,
net.java.sip.communicator.service.metahistory,
net.java.sip.communicator.service.history.event,
net.java.sip.communicator.service.msghistory,
net.java.sip.communicator.service.notification,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.icqconstants,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.icqconstants,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.shutdown,
net.java.sip.communicator.service.systray,
net.java.sip.communicator.service.desktop,
net.java.sip.communicator.service.fileaccess,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
net.java.sip.communicator.util.swing.border,
net.java.sip.communicator.util.swing.event,
net.java.sip.communicator.util.swing.plaf,
net.java.sip.communicator.util.swing.border,
javax.accessibility,
javax.imageio,
javax.swing,
javax.swing.border,
javax.swing.event,
javax.swing.filechooser,
javax.swing.plaf,
javax.swing.plaf.basic,
javax.swing.plaf.metal,
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.filechooser,
javax.swing.tree,
javax.swing.undo,
javax.swing.border,
org.jdesktop.jdic.desktop,
say.swing,
com.apple.eawt

@ -11,6 +11,7 @@
import net.java.sip.communicator.service.desktop.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.service.shutdown.*;
import net.java.sip.communicator.service.systray.*;
import net.java.sip.communicator.util.*;
@ -20,6 +21,7 @@
* Registers the <tt>Systray</tt> in the UI Service.
*
* @author Nicolas Chamouard
* @author Lubomir Marinov
*/
public class OsDependentActivator
implements BundleActivator
@ -115,6 +117,28 @@ public static ConfigurationService getConfigurationService()
return configService;
}
/**
* Gets a reference to a <code>ShutdownService</code> implementation
* currently registered in the bundle context of the active
* <code>OsDependentActivator</code> instance.
* <p>
* The returned reference to <code>ShutdownService</code> is not being
* cached.
* </p>
*
* @return reference to a <code>ShutdownService</code> implementation
* currently registered in the bundle context of the active
* <code>OsDependentActivator</code> instance
*/
public static ShutdownService getShutdownService()
{
return
(ShutdownService)
bundleContext.getService(
bundleContext.getServiceReference(
ShutdownService.class.getName()));
}
/**
* Returns the <tt>UIService</tt> obtained from the bundle

@ -51,7 +51,7 @@ private static void actionPerformed(ActionEvent evt)
}
else if (itemName.equals("service.gui.CLOSE"))
{
OsDependentActivator.getUIService().beginShutdown();
OsDependentActivator.getShutdownService().beginShutdown();
}
else if (itemName.equals("addContact"))
{

@ -8,8 +8,8 @@ Export-Package: net.java.sip.communicator.service.systray,
net.java.sip.communicator.service.systray.event,
net.java.sip.communicator.service.desktop
Import-Package: org.osgi.framework,
org.jdesktop.jdic.tray,
org.jdesktop.jdic.desktop,
org.jdesktop.jdic.tray,
com.apple.cocoa.application,
com.apple.cocoa.foundation,
net.java.sip.communicator.service.configuration,
@ -18,21 +18,22 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.shutdown,
net.java.sip.communicator.service.systray,
net.java.sip.communicator.service.systray.event,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
javax.accessibility,
javax.imageio,
javax.swing,
javax.swing.border,
javax.swing.event,
javax.swing.filechooser,
javax.swing.plaf,
javax.swing.plaf.basic,
javax.swing.plaf.metal,
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.filechooser,
javax.swing.tree,
javax.swing.undo,
javax.swing.border
javax.swing.undo

@ -4,11 +4,12 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.shutdown;
package net.java.sip.communicator.impl.shutdowntimeout;
import org.osgi.framework.*;
import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/**
* In order to shut down SIP Communicator we kill the Felix system bundle.
* However, this sometimes doesn't work for reason of running non-daemon

@ -1,4 +1,4 @@
Bundle-Activator: net.java.sip.communicator.impl.shutdown.ShutdownTimeout
Bundle-Activator: net.java.sip.communicator.impl.shutdowntimeout.ShutdownTimeout
Bundle-Name: ShutdownBundle
Bundle-Description: A bundle that makes sure that when closed SIP Communicator will exit in 15 seconds at most.
Bundle-Vendor: sip-communicator.org

@ -6,10 +6,7 @@
*/
package net.java.sip.communicator.plugin.updatechecker;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
@ -23,8 +20,10 @@
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.service.shutdown.*;
import net.java.sip.communicator.service.version.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
@ -35,6 +34,7 @@
* Activates the UpdateCheck plugin
*
* @author Damian Minkov
* @authod Lubomir Marinov
*/
public class UpdateCheckActivator
implements BundleActivator
@ -141,6 +141,28 @@ public static ConfigurationService getConfigurationService()
return configService;
}
/**
* Gets a reference to a <code>ShutdownService</code> implementation
* currently registered in the bundle context of the active
* <code>UpdateCheckActivator</code> instance.
* <p>
* The returned reference to <code>ShutdownService</code> is not being
* cached.
* </p>
*
* @return reference to a <code>ShutdownService</code> implementation
* currently registered in the bundle context of the active
* <code>UpdateCheckActivator</code> instance
*/
private static ShutdownService getShutdownService()
{
return
(ShutdownService)
bundleContext.getService(
bundleContext.getServiceReference(
ShutdownService.class.getName()));
}
/**
* Returns a reference to the UIService implementation currently registered
* in the bundle context or null if no such implementation was found.
@ -455,7 +477,7 @@ public void run()
});
processBuilder.start();
getUIService().beginShutdown();
getShutdownService().beginShutdown();
} catch (Exception e)
{

@ -8,14 +8,15 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.browserlauncher,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.shutdown,
net.java.sip.communicator.service.version,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
javax.imageio,
javax.net.ssl,
javax.swing,
javax.swing.event,
javax.swing.text,
javax.swing.text.html,
javax.imageio,
javax.net.ssl
javax.swing.text.html

@ -375,17 +375,6 @@ public SecurityAuthority getDefaultSecurityAuthority(
*/
public boolean useMacOSXScreenMenuBar();
/**
* Invokes the UI action commonly associated with the "File &gt; Quit" menu
* item which begins the application shutdown procedure.
* <p>
* The method avoids duplication since the "File &gt; Quit" functionality
* may be invoked not only from the main application menu but also from the
* systray, for example.
* </p>
*/
public void beginShutdown();
/**
* Shows or hides the "Tools &gt; Settings" configuration window.
* <p>

@ -7,4 +7,5 @@ System-Bundle: yes
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.resources
Export-Package: net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event
net.java.sip.communicator.service.gui.event,
net.java.sip.communicator.service.shutdown

Loading…
Cancel
Save