コード例 #1
0
  /**
   * Return the set of models assigned as providers.
   *
   * @return the providers consumed by the model
   * @exception IllegalStateException if the model is not in an assembled state
   */
  public DeploymentModel[] getProviders() {
    if (!isAssembled()) {
      final String error = "Model is not assembled " + this;
      throw new IllegalStateException(error);
    }

    final ArrayList list = new ArrayList();
    if (getContextModel().isEnabled()) {
      DeploymentModel provider = getContextModel().getProvider();
      if (provider != null) {
        list.add(provider);
      }
    }

    StageModel[] stages = getStageModels();
    for (int i = 0; i < stages.length; i++) {
      StageModel stage = stages[i];
      list.add(stage.getProvider());
    }

    DependencyModel[] dependencies = getDependencyModels();
    for (int i = 0; i < dependencies.length; i++) {
      DependencyModel dependency = dependencies[i];
      DeploymentModel provider = dependency.getProvider();
      if (provider != null) list.add(provider);
    }

    return (DeploymentModel[]) list.toArray(new DeploymentModel[0]);
  }
コード例 #2
0
 /**
  * Return a stage model matching the supplied descriptor. If no stage model matches the supplied
  * descriptor the implementation will return null.
  *
  * @param stage the stage descriptor
  * @return the matching stage model
  */
 public StageModel getStageModel(StageDescriptor stage) {
   StageModel[] stages = getStageModels();
   for (int i = 0; i < stages.length; i++) {
     StageModel model = stages[i];
     if (stage.equals(model.getStage())) {
       return model;
     }
   }
   return null;
 }