code: public static AbstractLifeCycleManager build( Instance instance, String appName, IAgentClient messagingClient ) {
  
  		AbstractLifeCycleManager result;
  		switch( instance.getStatus()) {
  		case DEPLOYED_STARTED:
  			result = new DeployedStarted( appName, messagingClient );
  			break;
  
  		case DEPLOYED_STOPPED:
  			result = new DeployedStopped( appName, messagingClient );
  			break;
  
  		case NOT_DEPLOYED:
  			result = new NotDeployed( appName, messagingClient );
  			break;
  
  		case UNRESOLVED:
  			result = new Unresolved( appName, messagingClient );
  			break;
  
  		case WAITING_FOR_ANCESTOR:
  			result = new WaitingForAncestor( appName, messagingClient );
  			break;
  
  		default:
  			result = new TransitiveStates( appName, messagingClient );
  			break;
  		}
  
  		return result;
  	}
docs: Builds the right handler depending on the current instance's state.
  @param instance an instance
  @param appName the application name
  @param messagingClient the messaging client
  @return a non-null manager to update the instance's life cycle