use of org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint in project felix by apache.
the class Activator method doInitImporter.
/**
* Method used for initilizing the Import component of the UPnP Base Driver
*
* @since 0.3
*/
private void doInitImporter() {
boolean useImporter = Boolean.valueOf(configuration.getProperty(Constants.IMPORTER_ENABLED_PROP, "true")).booleanValue();
if (!useImporter)
return;
// Setting up Base Driver Importer
this.notifierQueue = new NotifierQueue();
this.subQueue = new SubscriptionQueue();
ctrl = new MyCtrlPoint(Activator.bc, subQueue, notifierQueue);
// Enable CyberLink re-new for Event
ctrl.setNMPRMode(true);
this.monitor = new Monitor();
this.notifier = new Notifier(notifierQueue, monitor);
this.subScriber = new SubScriber(ctrl, subQueue, monitor);
ctrl.start();
subScriber.start();
notifier.start();
}
use of org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint in project felix by apache.
the class Monitor method updateListener.
public synchronized void updateListener(ListenerModified msg, SubscriptionQueue subqueue, MyCtrlPoint ctrl) /*##renew, SidRenewer sidRenewer*/
{
UPnPEventListener listener = msg.getListener();
Vector newServices = msg.getNewServices();
Vector subscribed = new Vector();
Vector notSubscribed = new Vector();
for (int i = 0; i < newServices.size(); i++) {
Service ser = (Service) newServices.elementAt(i);
if (ser.isSubscribed()) {
subscribed.add(ser);
} else {
notSubscribed.add(ser);
}
}
Vector oldSids = sidListSid.getSidsFromListener(listener);
// check subscribed services
if (oldSids == null)
return;
for (int i = 0; i < notSubscribed.size(); i++) {
Service ser = (Service) notSubscribed.elementAt(i);
subqueue.enqueue(new FirstMessage(ser, listener));
}
for (int i = 0; i < oldSids.size(); i++) {
String oldSid = (String) oldSids.elementAt(i);
if (!subscribed.contains(oldSid)) {
// francesco-renew
// to check -- Listner removal from sid2Listener
unsubscribeListenerForSid(oldSid, listener, ctrl);
}
}
}
Aggregations