wwndesc  1.0-76
IBMDescription.java
Go to the documentation of this file.
1 /* smallfoot.org is owned by allan.clark */
2 package org.smallfoot.wwn;
3 
4 import java.math.BigInteger;
5 
6 /**
7  * @file
8  */
9 
10 /**
11  * Centralize the sorting logic for various IBM products based on IBM Storage Systems WWPN Determination
12  *
13 * @see http://aussiestorageblog.files.wordpress.com/2013/01/ibm-storage-systems-wwpn-determination-version-6-6.pdf
14  */
15 public class IBMDescription extends WWNDesc.WWNDescTarget
16 {
17  /** @copydoc WWNDesc#WWNDesc(String) */
18  public IBMDescription(String wwn)
19  {
20  super(wwn);
21  }
22  /** @copydoc WWNDesc#WWNDesc(boolean,String) */
23  public IBMDescription(boolean brief, String wwn)
24  {
25  super(brief, wwn);
26  }
27 
28  /**
29  * If this class matches or describes the given WWN, returns a new instance of this class loaded with the given WWN.
30  *
31  * @return new instance of this class, or null if the given wwn does not match this class
32  * @param strong is ignored: this class is a strong representation, not a weak one based on empirical matching, hence can always be used with confidence
33  * @param brief is ignored: this class has only one representation of the WWN description or alias
34  * @param wwn the WWN (WWPN or WWNN, but typically WWPN) to match
35  */
36  public static WWNDesc getDesc(/* ignored */ boolean strong, /* ignored */ boolean brief, String wwn)
37  {
38  return getDesc(strong, brief, wwn, DevRole.max()-1);
39  }
40  /**
41  * @copydoc #getDesc(boolean, boolean, String)
42  * @param role Role (Initiator/Switch/Target) to check for
43  */
44  public static WWNDesc getDesc (boolean strong, boolean brief, String wwn, int role)
45  {
46  if (!isA(role))
47  return null;
48 
49  else if (wwn.matches("2[0-9a-f]0[0-9a-f]0020c2.*"))
50  return new IBM3700Description(brief, wwn);
51 
52  if (wwn.matches("5005076801.*"))
53  return new IBMSVCDescription(brief, wwn);
54 
55  /* the not-yet-done ones */
56  /* DS3000/DS4000/DS5000 */
57  //if (wwn.matches("20[0-9a-f]{2}00a0b8[0-9a-f]{6}"))
58  // return new IBMDescription(brief, wwn);
59 
60  else
61  return null;
62  }
63 
64  /**
65  * return a description or alias for this WWN
66  *
67  * @return generated alias or nickname for the WWN
68  */
69  public String toString()
70  {
71  return null;
72  }
73 }
static WWNDesc getDesc(boolean strong, boolean brief, String wwn)
If this class matches or describes the given WWN, returns a new instance of this class loaded with th...
static WWNDesc getDesc(boolean strong, boolean brief, String wwn, int role)
If this class matches or describes the given WWN, returns a new instance of this class loaded with th...
IBM3700Description (ie RamSan-G8332-FC-2B) breaks out the serial and port information from the Texas ...
static boolean isA(int role)
convenience function to use bit-masks to check for membership in this role
Definition: WWNDesc.java:158
DevRole role
role of the device: Target, Switch, Initiator
Definition: WWNDesc.java:24
boolean brief
whether a more brief output should be offered in toString() (ie the difference between "VMax-HK192601...
Definition: WWNDesc.java:22
String toString()
return a description or alias for this WWN
static int max
global singleton to keep track of the max DevRole.value so far
Definition: DevRole.java:21
IBMDescription(boolean brief, String wwn)
create an instance with the given WWN.
IBMDescription(String wwn)
create an instance with brief set to false.
IBMSVCDescription (ie SVCe0_Node0E_Port1) breaks out the SVC number, node, and port of a WWPN; it doe...
This class seeks to provide simple bitfield type-checking of a device in a fabric so that I can use t...
Definition: DevRole.java:18
WWNDesc is the basic generic class from which each vendor-specific pattern is built upon; similar to ...
Definition: WWNDesc.java:19
Centralize the sorting logic for various IBM products based on IBM Storage Systems WWPN Determination...
simple pass-thru class to define internal value for a Target in an idempotent way ...
Definition: WWNDesc.java:139
BigInteger wwn
the WWN that the instance tried to describe
Definition: WWNDesc.java:21