Coverage Report - org.jscsi.target.scsi.lun.AddressMethod
 
Classes in this File Line Coverage Branch Coverage Complexity
AddressMethod
0%
0/11
0%
0/4
2
 
 1  
 package org.jscsi.target.scsi.lun;
 2  
 
 3  
 /**
 4  
  * The ADDRESS METHOD field of a LOGICAL UNIT NUMBER's ADDRESSING field (from FIRST LEVEL ADDRESSING to FOURTH LEVEL
 5  
  * ADDRESSING) defines the contents of the ADDRESS METHOD SPECIFIC field.
 6  
  * <p>
 7  
  * This field is two bits long.
 8  
  * 
 9  
  * @author Andreas Ergenzinger
 10  
  */
 11  0
 public enum AddressMethod {
 12  
     /**
 13  
      * The SCSI target device should relay the received command or task management function to the addressed dependent
 14  
      * logical unit.
 15  
      */
 16  0
     PERIPHERAL_DEVICE_ADDRESSING_METHOD((byte) 0),
 17  
     /**
 18  
      * The flat space addressing method specifies a logical unit at the current level. The contents of all hierarchical
 19  
      * structure addressing fields following a flat space addressing method addressing field shall be ignored.
 20  
      */
 21  0
     FLAT_SPACE_ADDRESSING_METHOD((byte) 1),
 22  
     /**
 23  
      * The SCSI device should relay the received command or task management function to the addressed dependent logical
 24  
      * unit.
 25  
      */
 26  0
     LOGICAL_UNIT_ADDRESSING_METHOD((byte) 2),
 27  
     /**
 28  
      * Extended logical unit addressing specifies a logical unit at the current level.
 29  
      * <p>
 30  
      * Extended logical unit addressing builds on the formats defined for dependent logical units (see 4.6.19.4) but may
 31  
      * be used by SCSI devices having single level logical unit structure. In dependent logical unit addressing, the
 32  
      * logical unit information at each level fits in exactly two bytes. Extended logical unit addresses have sizes of
 33  
      * two bytes, four bytes, six bytes, or eight bytes.
 34  
      */
 35  0
     EXTENDED_LOGICAL_UNIT__ADDRESSING_METHOD((byte) 3);
 36  
 
 37  
     /**
 38  
      * The serialized value of the object.
 39  
      */
 40  
     private final byte value;
 41  
 
 42  0
     private AddressMethod (final byte value) {
 43  0
         this.value = value;
 44  0
     }
 45  
 
 46  
     /**
 47  
      * Returns the serialized value of the object.
 48  
      * 
 49  
      * @return the serialized value of the object
 50  
      */
 51  
     public byte getValue () {
 52  0
         return value;
 53  
     }
 54  
 
 55  
     /**
 56  
      * Returns the {@link AddressMethod} with a matching {@link #value} or <code>null</code> if no such
 57  
      * {@link AddressMethod} exists.
 58  
      * 
 59  
      * @param value the value from a serialized ADDRESS METHOD field
 60  
      * @return the {@link AddressMethod} with a matching {@link #value} or or <code>null</code>
 61  
      */
 62  
     public static AddressMethod getValue (int value) {
 63  0
         if (0 <= value && value <= 3) return values()[value];
 64  0
         return null;
 65  
     }
 66  
 }