Exemplo n.º 1
0
 /** Creation of a new Problem with a supplied problem identifier, properties and cause. */
 public Problem(String identifier, Properties props, Problem[] cause) {
   if (identifier.equals("REQUIRED_INPUT_IS_MISSING")) {
     message = "A required input resource has not been established on the Task.";
     description =
         "The Processor that this Task is coordinating requires "
             + "the association of a tagged input resource.  This condition must be fulfilled "
             + "before the process can be started.\n"
             + "\ttag: "
             + props.getProperty("tag")
             + "\n"
             + "\trequired: "
             + props.getProperty("required");
   } else if (identifier.equals("REQUIRED_INPUT_TYPE_MISMATCH")) {
     message = "A required input resource has an invalid type";
     description =
         "The type of resource required by a input constraint is "
             + "different to the type of resource currently bound to a usage association "
             + "of the same name.\n"
             + "\ttag: "
             + props.getProperty("tag")
             + "\n"
             + "\tfound: "
             + props.getProperty("supplied")
             + "\n"
             + "\trequired: "
             + props.getProperty("required");
   } else {
     message = "Unqualified problem";
     description = "A problem has been raised with an unknown problem identifier.";
   }
   Date date = new Date();
   this.timestamp = TimeUtils.getCurrentTime();
   this.identifier = identifier;
   this.cause = cause;
 }
Exemplo n.º 2
0
 public Problem(String identifier, String message, Throwable cause) {
   this.timestamp = TimeUtils.getCurrentTime();
   this.identifier = identifier;
   this.message = message;
   this.description = "";
   this.cause = new Problem[] {new Problem(cause)};
 }
Exemplo n.º 3
0
 /**
  * Creation of a new Problem with a supplied problem identifier, message, description and cause.
  */
 public Problem(String identifier, String message, String description, Problem[] cause) {
   Date date = new Date();
   this.timestamp = TimeUtils.getCurrentTime();
   this.identifier = identifier;
   this.message = message;
   this.description = description;
   this.cause = cause;
 }
Exemplo n.º 4
0
 public Problem(Throwable e) {
   this.timestamp = TimeUtils.getCurrentTime();
   this.identifier = e.getClass().getName();
   this.message = e.getMessage();
   this.description = "";
   if (e.getCause() != null) {
     this.cause = new Problem[] {new Problem(e.getCause())};
   } else {
     this.cause = new Problem[0];
   }
 }
Exemplo n.º 5
0
  /** Creation of a new Problem with a supplied problem identifier, and cause. */
  public Problem(String identifier, Problem[] cause) {
    message = "";
    description = "";

    if (identifier.equals("NO_COORDINATOR")) {
      message = "A Processor must be associated with a coordinating Task";
      description =
          "A Processor is coordinated by a single Task that is "
              + "responsible for the inital establishment of process "
              + "preconditions (such as consumption and production usage "
              + "associations). Until a Task is associated as the coordinator, "
              + "this processor cannot be executed.";
    } else if (identifier.equals("PROCESSOR_COORDINATION_ERROR")) {
      message = "Internal error while attempting to locate the coordianting Task";
      description =
          "An unexpected exception occured while attempting to locate "
              + "Task respoonsible for coordination of this Processor.  See log for details";
    } else if (identifier.equals("INPUT_PRECONDITION_ASSESSMENT_ERROR")) {
      message = "Internal error while attempting to assess usage preconditions";
      description =
          "An unexpected exception occured while attempting to validate "
              + " preconditions associated with this process.  See log for details";
    } else if (identifier.equals("INPUT_PRECONDITION_VALIDATION_ERROR")) {
      message = "Internal error while attempting to validate a usage precondition";
      description =
          "An unexpected exception occured while attempting to validate "
              + " a input preconditions associated with this process.  See log for details";
    } else {
      identifier = "UNKNOWN";
      message = "Unqualified problem";
      description = "A problem has been raised with an unknown problem identifier.";
    }
    Date date = new Date();
    this.timestamp = TimeUtils.getCurrentTime();
    this.identifier = identifier;
    this.message = message;
    this.description = description;
    this.cause = cause;
  }