/** @return a description of the resource referenced. */
  public String getDescription() {
    String rv = "unknown";

    if (m_service != null) {
      rv = m_service.getEntityDescription(this);

      if (rv == null) {
        rv = m_service.getLabel() + " " + m_reference;
      }
    }

    return rv;
  }
  /**
   * Access the URL which can be used to access the referenced resource.
   *
   * @return The URL which can be used to access the referenced resource.
   */
  public String getUrl() {
    String url = null;

    if (m_service != null) {
      url = m_service.getEntityUrl(this);
    }

    return url;
  }
  /**
   * Find the Entity that is referenced.
   *
   * @return The Entity object that this references.
   */
  public Entity getEntity() {
    Entity e = null;

    if (m_service != null) {
      e = m_service.getEntity(this);
    }

    return e;
  }
  /**
   * Find the ResourceProperties object for this reference.
   *
   * @return A ResourcesProperties object found (or constructed) for this reference.
   */
  public ResourceProperties getProperties() {
    ResourceProperties props = null;

    if (m_service != null) {
      props = m_service.getEntityResourceProperties(this);
    }

    return props;
  }
  /** {@inheritDoc} */
  public Collection getAuthzGroups(String userId) {
    Collection realms = null;

    if (m_service != null) {
      realms = m_service.getEntityAuthzGroups(this, userId);
    }

    if (realms == null) realms = new Vector();

    return realms;
  }
 private final EntityProducer getEntityProducerNoDebug(String reference, Reference target) {
   if (reference.trim().length() == 0) {
     return null;
   }
   String ref = reference;
   int n = ref.indexOf('/', 1);
   if (n > 0) {
     if (ref.charAt(0) == '/') {
       ref = ref.substring(1, n);
     } else {
       ref = ref.substring(0, n);
     }
   }
   if (m_rejectRef.get(ref) != null) {
     return null;
   }
   EntityProducer ep = m_producers.get(ref);
   if (ep != null) {
     if (ep.parseEntityReference(reference, target)) {
       return ep;
     }
   }
   for (Iterator<EntityProducer> iServices = m_producers.values().iterator();
       iServices.hasNext(); ) {
     EntityProducer service = iServices.next();
     Calls c = m_performance.get(service);
     c.iterateStart();
     try {
       if (service.parseEntityReference(reference, target)) {
         c.iterateMatch();
         return service;
       }
     } finally {
       c.iterateEnd();
     }
   }
   return null;
 }
  private final EntityProducer getEntityProducerWithDebug(String reference, Reference target) {
    nparse++;
    long start = System.currentTimeMillis();
    try {
      if (reference.trim().length() == 0) {
        return null;
      }
      if (nparse == 1000) {
        long t = total;
        double rate = (1.0 * t) / (1.0 * nparse);
        nparse = 0;
        StringBuilder sb = new StringBuilder();
        for (Calls c : m_performance.values()) {
          sb.append("\n     ").append(c);
        }
        for (String c : m_producers.keySet()) {
          sb.append("\n     [").append(c).append("]").append(m_producers.get(c));
        }
        M_log.debug("EntityManager Montor " + sb.toString());
        M_log.info("EntityManager Montor Average " + rate + " ms per parse");
      }

      String ref = reference;
      int n = ref.indexOf('/', 1);
      if (n > 0) {
        if (ref.charAt(0) == '/') {
          ref = ref.substring(1, n);
        } else {
          ref = ref.substring(0, n);
        }
      }
      if (m_rejectRef.get(ref) != null) {
        return null;
      }
      EntityProducer ep = m_producers.get(ref);
      if (ep != null) {
        Calls c = m_performance.get(ep);
        c.lookupStart();
        try {
          if (ep.parseEntityReference(reference, target)) {
            c.lookupMatch();
            return ep;
          }
        } finally {
          c.lookupEnd();
        }
      }
      M_log.info("Entity Scan for " + ref + " for " + reference);
      for (Iterator<EntityProducer> iServices = m_producers.values().iterator();
          iServices.hasNext(); ) {
        EntityProducer service = iServices.next();
        Calls c = m_performance.get(service);
        c.iterateStart();
        try {
          if (service.parseEntityReference(reference, target)) {
            c.iterateMatch();
            return service;
          }
        } finally {
          c.iterateEnd();
        }
      }
      M_log.info(
          "Nothing Found for  "
              + ref
              + " for "
              + reference
              + " adding "
              + ref
              + " to the reject list");
      Exception e = new Exception("Traceback");
      M_log.info("Traceback ", e);
      addRejectRef(ref);
      return null;
    } finally {
      total += (System.currentTimeMillis() - start);
    }
  }