code: @FFDCIgnore(PrivilegedActionException.class)
      private String getConfigNameForRef(final String ref) {
          String name = null;
          if (ref != null) {
              final ConfigurationAdmin configAdmin = configAdminRef.getService();
              Configuration config;
              try {
                  config = AccessController.doPrivileged(new PrivilegedExceptionAction<Configuration>() {
                      @Override
                      public Configuration run() throws IOException {
                          return configAdmin.getConfiguration(ref, configAdminRef.getReference().getBundle().getLocation());
                      }
                  });
              } catch (PrivilegedActionException paex) {
                  return null;
              }
              Dictionary<String, Object> props = config.getProperties();
              name = (String) props.get(KEY_NAME);
          }
          return name;
      }
docs: Use the config admin service to get the name for a given service reference
  
  @param ref the service reference string
  @return the name or null if there were problems