Example #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);
    }
Example #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);
    }
Example #3
0
 private synchronized void doRemoveOutboundReference(Meem meem, Reference reference) {
   if (reference.getFacetIdentifier().equals("lifeCycleClient")) {
     removeLifeCycleReference(reference);
   } else if (meem != null) {
     meem.removeOutboundReference(reference);
   }
 }
Example #4
0
  public void updateDependency(DependencyAttribute dependencyAttribute) {
    Client client = getClient();
    synchronized (client) {
      if (!client.isDone()) {
        queuedMeemProxy.updateDependency(dependencyAttribute);
        return;
      }
    }

    doUpdateDependency(meem, dependencyAttribute);
  }
Example #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);
  }
Example #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());
    }
  }
Example #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);
  }
Example #9
0
 private synchronized void doUpdateDependency(Meem meem, DependencyAttribute dependencyAttribute) {
   meem.updateDependency(dependencyAttribute);
 }
Example #10
0
 private synchronized void doRemoveDependency(Meem meem, DependencyAttribute dependencyAttribute) {
   meem.removeDependency(dependencyAttribute);
 }
Example #11
0
 private synchronized void doAddDependency(
     Meem meem, Facet facet, DependencyAttribute dependencyAttribute, LifeTime lifeTime) {
   meem.addDependency(facet, dependencyAttribute, lifeTime);
 }