Example #1
0
  private synchronized void notifyLastTransition(LifeCycleTransition transition) {
    Iterator iterator = getLifeCycleClientRefs().entrySet().iterator();
    while (iterator.hasNext()) {
      Map.Entry entry = (Map.Entry) iterator.next();
      Reference reference = (Reference) entry.getKey();
      RequestStack currentRequestStack = RequestTracker.getRequestStack();
      RequestStack requestStack = (RequestStack) entry.getValue();
      //	if (requestStack != null && !lifeCycleContentSent) {
      RequestTracker.setRequestStack(requestStack);
      //	}

      LifeCycleClient client = (LifeCycleClient) reference.getTarget();

      client.lifeCycleStateChanging(transition);
      client.lifeCycleStateChanged(transition);

      //	if (requestStack != null && !lifeCycleContentSent) {
      RequestTracker.setRequestStack(currentRequestStack);
      //	}
    }
  }
Example #2
0
  private void addLifeCycleReference(Reference reference, boolean automaticRemove) {
    Facet target = reference.getTarget();
    ContentClient contentClient = MeemSystemWedge.getContentClientFromTarget(target);

    if (target instanceof LifeCycleClient) {
      if (reference.isContentRequired()) {
        LifeCycleClient lifeCycleClient = (LifeCycleClient) target;
        lifeCycleClient.lifeCycleStateChanged(lastTransition);
      }

      contentClient.contentSent();

      if (!automaticRemove) {
        getLifeCycleClientRefs()
            .put(reference, (RequestStack) RequestTracker.getRequestStack().clone());
      }
    } else {
      contentClient.contentFailed("Target must be of type: " + LifeCycleClient.class);
    }

    getClient().startResolving(); // this needs to be done
  }