Coverage Report - org.apache.commons.pipeline.validation.ValidationFailure
 
Classes in this File Line Coverage Branch Coverage Complexity
ValidationFailure
0%
0/10
N/A
0
ValidationFailure$Type
0%
0/5
N/A
0
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 package org.apache.commons.pipeline.validation;
 19  
 
 20  
 import org.apache.commons.pipeline.Stage;
 21  
 
 22  
 /**
 23  
  * This class is used to store a collection of information about a particular 
 24  
  * validation failure.
 25  
  *
 26  
  */
 27  
 public class ValidationFailure {
 28  
     /**
 29  
      * Enumeration of possible causes of validation failure
 30  
      */
 31  0
     public enum Type {
 32  
         /**
 33  
          * Indicates that a stage appears to be unable to consume the output of the previous stage
 34  
          */
 35  0
         STAGE_CONNECT, 
 36  
         /**
 37  
          * Indicates that a branch could not consume the output (type mismatch) of pipeline
 38  
          * stages feeding the branch.
 39  
          */
 40  0
         BRANCH_CONNECT, 
 41  
         /**
 42  
          * Indicates that a branch to consume the branch output of a stage could not be found.
 43  
          */
 44  0
         BRANCH_NOT_FOUND,
 45  
         /**
 46  
          * Other validation error - see detail message.
 47  
          */
 48  0
         OTHER
 49  
     };
 50  
     
 51  
     private Type type;
 52  
     private String message;
 53  
     private Stage upstream;
 54  
     private Stage downstream;
 55  
     
 56  
     /**
 57  
      * Creates a new instance of ValidationError
 58  
      * @param type The type of problem encountered
 59  
      * @param message A message with more detailed information about the problem
 60  
      * @param upstream A reference to the upstream stage
 61  
      * @param downstream A reference to a downstream stage
 62  
      */
 63  0
     public ValidationFailure(Type type, String message, Stage upstream, Stage downstream) {
 64  0
         this.type = type;
 65  0
         this.message = message;
 66  0
         this.upstream = upstream;
 67  0
         this.downstream = downstream;        
 68  0
     }
 69  
     
 70  
     /**
 71  
      * Type identifying what sort of problem was encountered
 72  
      * @return the type of problem encountered
 73  
      */
 74  
     public Type getType() {
 75  0
         return this.type;
 76  
     }
 77  
     
 78  
     /**
 79  
      * Returns the descriptive message about the error
 80  
      * @return message describing the error
 81  
      */
 82  
     public String getMessage() {
 83  0
         return this.message;
 84  
     }
 85  
     
 86  
     /**
 87  
      * The stage upstream of the connection that could not be validated
 88  
      * @return reference to the upstream Stage
 89  
      */
 90  
     public Stage getUpstreamStage() {
 91  0
         return this.upstream;
 92  
     }
 93  
     
 94  
     /**
 95  
      * The stage downstream of the connection that could not be validated
 96  
      * @return reference to the downstream Stage
 97  
      */
 98  
     public Stage getDownstreamStage() {
 99  0
         return this.downstream;
 100  
     }
 101  
 }