コード例 #1
0
  public Collection<ImportReference> getAllImportReference() {
    Collection<ImportReference> irefs = new HashSet<ImportReference>();

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

    return irefs;
  }
コード例 #2
0
  /**
   * 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;
    }
  }
コード例 #3
0
  /**
   * @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;
  }