Package org.osgi.framework

Examples of org.osgi.framework.ServiceReference


   * *************** Called from set methods *********************
   */

  private void updateConfig() {
    try {
      ServiceReference sr = bc
          .getServiceReference(ConfigurationAdmin.class.getName());
      if (sr != null) {
        ConfigurationAdmin ca = (ConfigurationAdmin) bc.getService(sr);
        if (ca != null) {
          Configuration conf = ca.getConfiguration(pid);
View Full Code Here


    // //////////////////////////////////
    public void serviceChanged(ServiceEvent event) {
        switch (event.getType()) {
        case ServiceEvent.REGISTERED:
            ServiceReference sr = event.getServiceReference();
            if (refCA != sr) {
                refCA = sr;
            }
            break;
        case ServiceEvent.MODIFIED:
View Full Code Here

        return new AuthorizationImpl(role);
    }

    // - interface org.osgi.framework.ServiceListener --------------------------
    public void serviceChanged(ServiceEvent event) {
        ServiceReference sr = event.getServiceReference();
        switch (event.getType()) {
        case ServiceEvent.REGISTERED:
            listeners.addElement(sr);
            if (Activator.log.doDebug())
                Activator.log.debug("UserAdminListener found: " + sr);
View Full Code Here

    public void log(int level, String msg) {
        log(level, msg, null);
    }

    public void log(int level, String msg, Exception e) {
        ServiceReference srLog = bc.getServiceReference(logServiceName);
        if (srLog != null) {
            LogService sLog = (LogService) bc.getService(srLog);
            if (sLog != null) {
                if (e == null) {
                    sLog.log(level, msg);
View Full Code Here

  }
 
  void open() {
    ServiceListener sl = new ServiceListener() {
      public void serviceChanged(ServiceEvent ev) {
        ServiceReference sr = ev.getServiceReference();
        switch(ev.getType()) {
        case ServiceEvent.REGISTERED:
          {
            try {
              register(sr);
View Full Code Here

     *            Log message
     */

    void log(int level, String msg) {
        try {
            ServiceReference srLog = bc.getServiceReference(logServiceName);
            if (srLog != null) {
                LogService sLog = (LogService) bc.getService(srLog);
                if (sLog != null) {
                    sLog.log(level, msg);
                }
View Full Code Here

    if (list.isEmpty()) {
      return null;
    }

    ServiceReference bestRef = (ServiceReference)list.get(0);

    if (list.size() == 1)
      return (ConnectionFactory)bc.getService(bestRef);

    int bestRanking = getRanking(bestRef);
    int rank;
    ServiceReference ref;

    for (int i = 1; i < list.size(); i++) {
      ref = (ServiceReference)list.get(i);
      rank = getRanking(ref);

      if (rank > bestRanking) { // by highest rank, then lowest service id.
        bestRanking = rank;
        bestRef = ref;

      } else {
        if (rank == bestRanking) {

          Long l1 = (Long)ref.getProperty(Constants.SERVICE_ID);
          Long l2 = (Long)bestRef.getProperty(Constants.SERVICE_ID);

          if (l1.compareTo(l2) < 0) {
            bestRef = ref;
          }
View Full Code Here

            in.read(); // Read answer.
            out.println();

            Authorization authorization = null;
            boolean loginOK = false;
            ServiceReference sr = bc
                    .getServiceReference(PasswdAuthenticator.class.getName());
            if (sr == null) {
                if (requireUM.booleanValue()) {
                    log(LogService.LOG_WARNING,
                            "Failed to get PasswdAuthenticator reference. UM required but not present.");
View Full Code Here

    org.osgi.service.event.Event ev =
      new org.osgi.service.event.Event(topic, (Dictionary) props);


    ServiceReference sr = Activator.getBC().getServiceReference(EventAdmin.class.getName());
    if(sr != null) {
      try {
        EventAdmin ea = (EventAdmin)Activator.getBC().getService(sr);
        ea.postEvent(ev);
      } finally {
View Full Code Here

  PackageAdmin pkgAdmin = null;

  public void serviceChanged(ServiceEvent ev) {
    synchronized(services) {
      ServiceReference sr       = ev.getServiceReference();
      String[]         objClass = (String[]) sr.getProperty(Constants.OBJECTCLASS);
      boolean          bRelease = true;
      SX               sx       = (SX)services.get(sr);

      boolean          isPAdmin = false;
      if (objClass !=  null) {
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.