private ConfigurationDictionary bindLocationIfNecessary(
      ServiceReference[] servicePids, ConfigurationDictionary dictionary) throws IOException {
    if (servicePids == null || servicePids.length == 0) {
      return dictionary;
    }
    String configLocation = dictionary.getLocation();
    LOG.info(ArrayUtils.toString(servicePids, "[", "]", ", "));
    if (configLocation != null) {
      LOG.info(configLocation + " " + configLocation.getClass());
    }
    Enumeration e = dictionary.keys();
    while (e.hasMoreElements()) {
      String key = (String) e.nextElement();
      LOG.info(key + " -> " + dictionary.get(key));
    }

    if (isUnrealBundleLocation(configLocation)) {
      if (dictionary.isDynamic()) {
        configLocation = null;
        dictionary.setLocation(null);
      }
    }

    if (configLocation == null) {
      String pid = (String) dictionary.get(Constants.SERVICE_PID);
      String serviceLocation = servicePids[0].getBundle().getLocation();

      dictionary.setLocation(serviceLocation);
      configurationDictionaryManager.save(pid, dictionary);
    }
    return dictionary;
  }
 /**
  * Registers a new incoming ManagedService
  *
  * @param serviceReference The reference to the managed service
  */
 public synchronized void registeredManagedService(ServiceReference serviceReference) {
   String[] servicePids = getServicePids(serviceReference);
   if (servicePids == null) {
     String bundleLocation = serviceReference.getBundle().getLocation();
     LOG.error(
         "ManagedService is registering without a "
             + Constants.SERVICE_PID
             + ": "
             + bundleLocation);
   } else {
     registerPidsAndCheck(serviceReference, servicePids);
     if (LOG.isDebugEnabled()) {
       LOG.debug("ManagedService registered: " + ArrayUtils.toString(servicePids, "[", "]", ", "));
     }
     try {
       updateManagedService(serviceReference, servicePids);
     } catch (IOException e) {
       LOG.error("Error while notifying services.", e);
     }
   }
 }