Package org.osgi.framework

Examples of org.osgi.framework.ServiceReference


  }

  public boolean runTest() {
    Control control = (Control)tracker.getService();
    control.register();
    ServiceReference ref = bc.getServiceReference(PhonyService7.class.getName());
    bc.getService(ref);
    control.unregister();
    bc.ungetService(ref);
    return true;
  }
View Full Code Here


  }

  public boolean runTest() {
    Control control = (Control)tracker.getService();
    control.register();
    ServiceReference ref = bc.getServiceReference(PhonyService7.class.getName());
    bc.getService(ref);
    bc.ungetService(ref);
    control.unregister();
   
    return true;
View Full Code Here

      e.printStackTrace();
    }
  }

  public boolean runTest() {
    ServiceReference ref =
      bc.getServiceReference("org.knopflerfish.service.bundleEnd5_test.PhonyService");
    bc.getService(ref);
    bc.ungetService(ref);
    return true;
  }
View Full Code Here

        Dictionary parameters = new Hashtable();
        parameters.put("service.pid", FACTORY_PID);
        configReg = bc.registerService(ManagedServiceFactory.class.getName(),
                serverFactory, parameters);

        ServiceReference adminRef = null;
        try {
            ConfigurationAdmin admin = null;
            Configuration[] configs = null;
            try {
                adminRef = bc.getServiceReference(ConfigurationAdmin.class
View Full Code Here

      ServiceReference[] listeners = null;
      try {
        listeners = context.getServiceReferences(UPnPEventListener.class.getName(),null);
        if (listeners != null){
          for (int i = 0;i<listeners.length;i++){
            ServiceReference sr = listeners[i];
            Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
            if (filter == null) upnpListeners.add(sr);
            else {       
              if (filter.match(UPnPTargetListener))
                addNewListener(sr);
            }
View Full Code Here

  private void doNotify(Properties events){
       
    synchronized (LOCK) {     
      Iterator list = upnpListeners.iterator();
      while (list.hasNext()){
        final ServiceReference sr = (ServiceReference)list.next();
        new NotifierThread(sr,events).start();           
      }
    }   
  }
View Full Code Here

 
  /* (non-Javadoc)
   * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
   */
  public void serviceChanged(ServiceEvent e) {
    ServiceReference sr = e.getServiceReference();   
    synchronized (LOCK) {     
      switch(e.getType()){
        case ServiceEvent.REGISTERED:{
          Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
          if (filter == null) {
            addNewListener(sr);
            doNotify(sr);
          }
          else {       
            if (filter.match(UPnPTargetListener)){
              addNewListener(sr);
              doNotify(sr);
            }
          }
        };break;
       
        case ServiceEvent.MODIFIED:{       
                   Filter filter = (Filtersr.getProperty(UPnPEventListener.UPNP_FILTER);
                   removeListener(sr);
                   if (filter == null)
                       addNewListener(sr);
                   else {
                       if (filter.match(UPnPTargetListener))
View Full Code Here

       
        for (int i = 0; i < references.length; i++) {

            try {
               
              ServiceReference ref = bundleContext.getServiceReference(referenceClasses[i].getName());
              if (ref != null) {
                    Object obj = bundleContext.getService(ref);
                    referenceFields[i].set(this, referenceClasses[i].cast(obj));
                } else {
            String filter = "(objectclass=" + referenceClasses[i].getName() + ")";
View Full Code Here

  public void serviceChanged(ServiceEvent event) {
    try {
      if (event.getType() == ServiceEvent.REGISTERED) {
               
                ServiceReference ref = event.getServiceReference();
                Object obj = bundleContext.getService(ref);
                for (int i = 0; i < references.length; i++) {
                    if (referenceClasses[i].isAssignableFrom(obj.getClass())) {
                        referenceFields[i].set(this, referenceClasses[i].cast(obj));
                    }
View Full Code Here

     * Schedules the execution of the Runnable Service of the {@link ServiceEvent}.
     *
     * @param event
     */
    protected void scheduleRunnableService(ServiceEvent event) {
        ServiceReference reference = event.getServiceReference();
        Runnable service = (Runnable) bundleContext.getService(reference);
        String id = (String) reference.getProperty(KarafTimerTask.ID_PROPERTY);
        String periodValue = (String) reference.getProperty(KarafTimerTask.PERIOD_PROPERTY);

        if (periodValue != null) {
            Long period = Long.parseLong(periodValue);
            KarafTimerTask task = new KarafTimerTask(id, service, period);
            scheduler.schedule(task);
View Full Code Here

TOP

Related Classes of org.osgi.framework.ServiceReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.