Esempio n. 1
0
    ResolverClient(Client parent, MeemPath meemPath) {
      this.parent = parent;

      Meem resolverMeem = EssentialMeemHelper.getEssentialMeem(MeemResolver.spi.getIdentifier());
      MeemResolverClient proxy = GatewayManagerWedge.getTargetFor(this, MeemResolverClient.class);
      Filter filter = ExactMatchFilter.create(meemPath);

      this.reference = Reference.spi.create("meemResolverClient", proxy, true, filter);

      resolverMeem.addOutboundReference(reference, false);
    }
Esempio n. 2
0
    RegistryClient(Client parent, MeemPath meemPath) {
      this.parent = parent;
      this.meemPath = meemPath;

      this.proxy = GatewayManagerWedge.getTargetFor(this, MeemRegistryClient.class);

      reference =
          Reference.spi.create(
              "meemRegistryClient", proxy, true, ExactMatchFilter.create(meemPath));

      Meem registryMeem =
          EssentialMeemHelper.getEssentialMeem(MeemRegistryGateway.spi.getIdentifier());

      registryMeem.addOutboundReference(reference, false);
    }
Esempio n. 3
0
 private synchronized void doRemoveOutboundReference(Meem meem, Reference reference) {
   if (reference.getFacetIdentifier().equals("lifeCycleClient")) {
     removeLifeCycleReference(reference);
   } else if (meem != null) {
     meem.removeOutboundReference(reference);
   }
 }
Esempio n. 4
0
  public void updateDependency(DependencyAttribute dependencyAttribute) {
    Client client = getClient();
    synchronized (client) {
      if (!client.isDone()) {
        queuedMeemProxy.updateDependency(dependencyAttribute);
        return;
      }
    }

    doUpdateDependency(meem, dependencyAttribute);
  }
Esempio n. 5
0
  public void addDependency(
      Facet facet, DependencyAttribute dependencyAttribute, LifeTime lifeTime) {
    Client client = getClient();
    synchronized (client) {
      if (!client.isDone()) {
        queuedMeemProxy.addDependency(facet, dependencyAttribute, lifeTime);
        return;
      }
    }

    doAddDependency(meem, facet, dependencyAttribute, lifeTime);
  }
Esempio n. 6
0
  private synchronized void doAddOutboundReference(
      Meem meem, Reference reference, boolean automaticRemove) {
    if (reference.getFacetIdentifier().equals("lifeCycleClient")) {
      addLifeCycleReference(reference, automaticRemove);
    } else if (meem != null) {
      meem.addOutboundReference(reference, automaticRemove);
    } else {
      ContentClient contentClient =
          MeemSystemWedge.getContentClientFromTarget(reference.getTarget());

      contentClient.contentFailed(
          "Cannot add reference to Meem in LifeCycleState of "
              + lastTransition.getCurrentState().getCurrentState());
    }
  }
Esempio n. 7
0
  /**
   * @see
   *     org.openmaji.meem.Meem#removeOutboundReference(org.openmaji.meem.wedge.reference.Reference)
   */
  public void removeOutboundReference(Reference reference) {
    if (reference == null) {
      throw new IllegalArgumentException(
          "attempt to call removeOutboundReference with null reference.");
    }

    Client client = getClient();
    synchronized (client) {
      if (!client.isDone()) {
        if (reference.getFacetIdentifier().equals("lifeCycleClient")) {
          removeLifeCycleReference(reference);
        } else {
          queuedMeemProxy.removeOutboundReference(reference);
        }
        return;
      }
    }

    doRemoveOutboundReference(meem, reference);
  }
  /**
   * Set up a dependency between a meem and a hyperspace-referenced meem.
   *
   * @param meem The dependent meem.
   * @param path The path to the meem to depend on.
   * @param target the target facet
   * @param source The source facet
   */
  protected void setDependency(Meem meem, String path, String target, String source) {

    MeemPath meemPath = MeemPath.spi.create(Space.HYPERSPACE, myHyperSpacePath + "/" + path);

    // TODO make an AddressFilter
    Filter filter = null;

    DependencyAttribute attr =
        new DependencyAttribute(
            DependencyType.STRONG, Scope.DISTRIBUTED, meemPath, target, filter, true);

    if (DEBUG) {
      logger.log(
          Level.INFO, "Adding dependency: " + meem + "." + source + " -> " + path + "." + target);
    }

    // XXX
    // DependencyHandler dependencyHandler = (DependencyHandler)
    // MeemUtility.spi.get().getTarget(meem, "dependencyHandler", DependencyHandler.class);
    // dependencyHandler.addDependency(source, attr, LifeTime.PERMANENT);

    meem.addDependency(source, attr, LifeTime.PERMANENT);
  }
Esempio n. 9
0
 private synchronized void doUpdateDependency(Meem meem, DependencyAttribute dependencyAttribute) {
   meem.updateDependency(dependencyAttribute);
 }
Esempio n. 10
0
 private synchronized void doRemoveDependency(Meem meem, DependencyAttribute dependencyAttribute) {
   meem.removeDependency(dependencyAttribute);
 }
Esempio n. 11
0
 private synchronized void doAddDependency(
     Meem meem, Facet facet, DependencyAttribute dependencyAttribute, LifeTime lifeTime) {
   meem.addDependency(facet, dependencyAttribute, lifeTime);
 }