public Collection<ImportReference> getAllImportReference() {
    Collection<ImportReference> irefs = new HashSet<ImportReference>();

    for (EndpointDescription desc : registrations.keySet()) {
      irefs.add(registrations.getElem(desc).getImportReference());
    }

    return irefs;
  }
  /**
   * Stop the proxy-creator, iPOJO Invalidate instance callback. Must be override ! Close all
   * endpoints.
   */
  protected void stop() {

    synchronized (registrations) {
      Collection<EndpointDescription> descs = registrations.keySet();

      for (EndpointDescription desc : descs) {
        MyImportReference iref = registrations.getElem(desc).getImportReference();
        destroyProxy(iref.getImportedEndpoint(), iref.getRegistration()); // TODO check != null
        iref.close(); // unregister the proxy
      }

      registrations.clear();
      isValid = false;
    }
  }
  /** Start the endpoint-creator component, iPOJO Validate instance callback. Must be override ! */
  protected void start() {
    synchronized (registrations) {
      if (registrations.size() > 0) {
        getLogService()
            .log(
                LOG_WARNING,
                "Internal structures have not been clean while stopping the instance.");
        stop();
      }

      isValid = true;
    }
  }
  /**
   * @param sref
   * @param extraProperties
   * @return
   */
  public ImportRegistration importService(
      EndpointDescription description, Map<String, Object> properties) {
    final ImportRegistration ireg;

    synchronized (registrations) {
      if (!isValid) {
        return new BadImportRegistration(
            new Throwable("This ExporterService is no more available. !"));
      }

      if (registrations.containsKey(description)) {
        // Clone Registration
        ireg = new MyImportRegistration(registrations.getElem(description));
      } else {
        // First registration, create the proxy
        ServiceRegistration registration = createProxy(description, properties);

        ireg = new MyImportRegistration(description, registration);
      }
    }

    return ireg;
  }