mirror of https://github.com/sipwise/jitsi.git
parent
c543e54197
commit
1f7765cd81
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.plugin.notificationwiring;
|
||||
|
||||
import net.java.sip.communicator.service.gui.*;
|
||||
import net.java.sip.communicator.service.neomedia.*;
|
||||
import net.java.sip.communicator.service.notification.*;
|
||||
import net.java.sip.communicator.service.resources.*;
|
||||
import net.java.sip.communicator.util.*;
|
||||
|
||||
import org.osgi.framework.*;
|
||||
|
||||
/**
|
||||
* The <tt>NotificationActivator</tt> is the activator of the notification
|
||||
* bundle.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class NotificationWiringActivator
|
||||
implements BundleActivator
|
||||
{
|
||||
private final Logger logger =
|
||||
Logger.getLogger(NotificationWiringActivator.class);
|
||||
|
||||
protected static BundleContext bundleContext;
|
||||
|
||||
private static NotificationService notificationService;
|
||||
private static ResourceManagementService resourcesService;
|
||||
private static UIService uiService = null;
|
||||
private static MediaService mediaService;
|
||||
|
||||
public void start(BundleContext bc) throws Exception
|
||||
{
|
||||
bundleContext = bc;
|
||||
try
|
||||
{
|
||||
logger.logEntry();
|
||||
logger.info("Notification wiring plugin...[ STARTED ]");
|
||||
|
||||
|
||||
// Get the notification service implementation
|
||||
ServiceReference notifReference = bundleContext
|
||||
.getServiceReference(NotificationService.class.getName());
|
||||
|
||||
notificationService = (NotificationService) bundleContext
|
||||
.getService(notifReference);
|
||||
|
||||
new NotificationManager().init();
|
||||
|
||||
logger.info("Notification wiring plugin ...[REGISTERED]");
|
||||
}
|
||||
finally
|
||||
{
|
||||
logger.logExit();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop(BundleContext bc) throws Exception
|
||||
{
|
||||
logger.info("Notification handler Service ...[STOPPED]");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <tt>NotificationService</tt> obtained from the bundle context.
|
||||
*
|
||||
* @return the <tt>NotificationService</tt> obtained from the bundle context
|
||||
*/
|
||||
public static NotificationService getNotificationService()
|
||||
{
|
||||
return notificationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <tt>ResourceManagementService</tt>, through which we will
|
||||
* access all resources.
|
||||
*
|
||||
* @return the <tt>ResourceManagementService</tt>, through which we will
|
||||
* access all resources.
|
||||
*/
|
||||
public static ResourceManagementService getResources()
|
||||
{
|
||||
if (resourcesService == null)
|
||||
{
|
||||
resourcesService
|
||||
= ServiceUtils.getService(
|
||||
bundleContext,
|
||||
ResourceManagementService.class);
|
||||
}
|
||||
return resourcesService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current implementation of the <tt>UIService</tt>.
|
||||
* @return the current implementation of the <tt>UIService</tt>
|
||||
*/
|
||||
public static UIService getUIService()
|
||||
{
|
||||
if (uiService == null)
|
||||
{
|
||||
uiService = ServiceUtils.getService(bundleContext, UIService.class);
|
||||
}
|
||||
|
||||
return uiService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of the <tt>MediaService</tt> obtained from the
|
||||
* bundle context.
|
||||
* @return an instance of the <tt>MediaService</tt> obtained from the
|
||||
* bundle context
|
||||
*/
|
||||
public static MediaService getMediaService()
|
||||
{
|
||||
if (mediaService == null)
|
||||
{
|
||||
mediaService
|
||||
= ServiceUtils.getService(bundleContext, MediaService.class);
|
||||
}
|
||||
return mediaService;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
Bundle-Activator: net.java.sip.communicator.plugin.notificationwiring.NotificationWiringActivator
|
||||
Bundle-Name: Notification-Wiring
|
||||
Bundle-Description: Wires events from various bundles to the notification service
|
||||
Bundle-Vendor: sip-communicator.org
|
||||
Bundle-Version: 0.0.1
|
||||
System-Bundle: yes
|
||||
Import-Package: org.osgi.framework,
|
||||
javax.imageio,
|
||||
net.java.sip.communicator.util,
|
||||
net.java.sip.communicator.service.contactlist,
|
||||
net.java.sip.communicator.service.gui,
|
||||
net.java.sip.communicator.service.neomedia,
|
||||
net.java.sip.communicator.service.notification,
|
||||
net.java.sip.communicator.service.protocol,
|
||||
net.java.sip.communicator.service.protocol.event,
|
||||
net.java.sip.communicator.service.resources
|
||||
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.service.notification;
|
||||
|
||||
/**
|
||||
* Object to cache fired notifications before all handler implementations are
|
||||
* ready registered.
|
||||
*
|
||||
* @author Ingo Bauersachs
|
||||
*/
|
||||
public class NotificationData
|
||||
{
|
||||
private final String eventType;
|
||||
private final String title;
|
||||
private final String message;
|
||||
private final byte[] icon;
|
||||
private final Object tag;
|
||||
|
||||
/**
|
||||
* Creates a new instance of this class.
|
||||
*
|
||||
* @param eventType the type of the event that we'd like to fire a
|
||||
* notification for.
|
||||
* @param title the title of the given message
|
||||
* @param message the message to use if and where appropriate (e.g. with
|
||||
* systray or log notification.)
|
||||
* @param icon the icon to show in the notification if and where appropriate
|
||||
* @param tag additional info to be used by the notification handler
|
||||
*/
|
||||
NotificationData(String eventType, String title, String message,
|
||||
byte[] icon, Object tag)
|
||||
{
|
||||
this.eventType = eventType;
|
||||
this.title = title;
|
||||
this.message = message;
|
||||
this.icon = icon;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of the event that we'd like to fire a notification for
|
||||
*
|
||||
* @return the eventType
|
||||
*/
|
||||
String getEventType()
|
||||
{
|
||||
return eventType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title of the given message.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message to use if and where appropriate (e.g. with systray or
|
||||
* log notification).
|
||||
*
|
||||
* @return the message
|
||||
*/
|
||||
String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the icon to show in the notification if and where appropriate.
|
||||
*
|
||||
* @return the icon
|
||||
*/
|
||||
byte[] getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets additional info to be used by the notification handler.
|
||||
*
|
||||
* @return the tag
|
||||
*/
|
||||
Object getTag()
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue