View Javadoc

1   package org.jscsi.target;
2   
3   
4   import org.jscsi.target.storage.IStorageModule;
5   
6   
7   /**
8    * One Target exists per iSCSI named target. Holds onto the name and the {@link IStorageModule}
9    * 
10   * @author David L. Smith-Uchida
11   * 
12   *         jSCSI
13   * 
14   *         Copyright (C) 2009 iGeek, Inc. All Rights Reserved
15   */
16  public class Target {
17      private final String targetName;
18      private final String targetAlias;
19      private final IStorageModule storageModule;
20  
21      public Target (String targetName, String targetAlias, IStorageModule storageModule) {
22          this.targetName = targetName;
23          this.targetAlias = targetAlias;
24          this.storageModule = storageModule;
25      }
26  
27      public String getTargetName () {
28          return targetName;
29      }
30  
31      public String getTargetAlias () {
32          return targetAlias;
33      }
34  
35      public IStorageModule getStorageModule () {
36          return storageModule;
37      }
38  
39      @Override
40      public int hashCode () {
41          final int prime = 31;
42          int result = 1;
43          result = prime + ((targetName == null) ? 0 : targetName.hashCode());
44          return result;
45      }
46  
47      @Override
48      public boolean equals (Object obj) {
49          if (this == obj) return true;
50          if (obj == null) return false;
51          if (getClass() != obj.getClass()) return false;
52          Target other = (Target) obj;
53          if (targetName == null) {
54              if (other.targetName != null) return false;
55          } else if (!targetName.equals(other.targetName)) return false;
56          return true;
57      }
58  
59  }