1 23 24 package com.sun.enterprise.deployment.util; 25 26 import javax.enterprise.deploy.shared.ModuleType ; 27 28 33 34 public class XModuleType extends ModuleType { 35 36 private static final int offset = 100; 37 public static final XModuleType LCM = new XModuleType(100); 38 public static final XModuleType CMB = new XModuleType(101); 39 40 private static final String [] stringTable = { 41 "lcm", 42 "cmb" 43 }; 44 45 private static final XModuleType[] enumValueTable = { 46 LCM, 47 CMB 48 }; 49 50 private static final String [] moduleExtension = { 51 ".jar", 52 ".jar" 53 }; 54 55 protected XModuleType(int value) { 56 super(value); 57 } 58 59 protected String [] getStringTable() { 60 return this.stringTable; 61 } 62 63 protected ModuleType [] getEnumValueTable() { 64 return this.enumValueTable; 65 } 66 67 public String getModuleExtension() { 68 if (super.getValue() >= this.getOffset()) { 69 return (this.moduleExtension[super.getValue() - this.getOffset()]); 70 } else { 71 return super.getModuleExtension(); 72 } 73 } 74 75 public static ModuleType getModuleType(int value) { 76 if (value >= offset) { 77 return enumValueTable[value-offset]; 78 } else { 79 return ModuleType.getModuleType(value); 80 } 81 } 82 83 public String toString() { 84 String [] strTable = this.getStringTable(); 85 int index = super.getValue() - this.getOffset(); 86 if (strTable != null && index >= 0 && index < strTable.length) 87 return strTable[index]; 88 else 89 super.toString(); 90 return null; 91 } 92 93 protected int getOffset() { 94 return offset; 95 } 96 97 } 98 | Popular Tags |