1 17 18 package org.apache.geronimo.deployment.plugin; 19 20 import javax.enterprise.deploy.spi.TargetModuleID ; 21 import javax.enterprise.deploy.spi.Target ; 22 import javax.enterprise.deploy.shared.ModuleType ; 23 import java.io.Serializable ; 24 25 30 public class TargetModuleIDImpl implements TargetModuleID , Serializable { 31 private String webURL; 32 private ModuleType type; 33 private final Target target; 34 private final String moduleID; 35 private final TargetModuleID parentTargetModuleID; 36 private final TargetModuleID [] childTargetModuleID; 37 38 public TargetModuleIDImpl(Target target, String moduleID) { 39 this.target = target; 40 this.moduleID = moduleID; 41 parentTargetModuleID = null; 42 childTargetModuleID = null; 43 } 44 45 public TargetModuleIDImpl(Target target, String moduleID, String [] childIDs) { 46 this.target = target; 47 this.moduleID = moduleID; 48 parentTargetModuleID = null; 49 if(childIDs == null || childIDs.length == 0) { 50 childTargetModuleID = null; 51 } else { 52 childTargetModuleID = new TargetModuleID [childIDs.length]; 53 for (int i = 0; i < childIDs.length; i++) { 54 String childID = childIDs[i]; 55 childTargetModuleID[i] = new TargetModuleIDImpl(target, childID, this); 56 } 57 } 58 } 59 60 private TargetModuleIDImpl(Target target, String moduleID, TargetModuleID parent) { 61 this.target = target; 62 this.moduleID = moduleID; 63 this.parentTargetModuleID = parent; 64 childTargetModuleID = null; 65 } 66 67 public Target getTarget() { 68 return target; 69 } 70 71 public String getModuleID() { 72 return moduleID; 73 } 74 75 public TargetModuleID getParentTargetModuleID() { 76 return parentTargetModuleID; 77 } 78 79 public TargetModuleID [] getChildTargetModuleID() { 80 return childTargetModuleID; 81 } 82 83 public String getWebURL() { 84 return webURL; 85 } 86 87 public void setWebURL(String webURL) { 88 this.webURL = webURL; 89 } 90 91 public ModuleType getType() { 92 return type; 93 } 94 95 public void setType(ModuleType type) { 96 this.type = type; 97 } 98 99 public String toString() { 100 return "[" + target + ", " + moduleID + "]"; 101 } 102 103 public boolean equals(Object o) { 104 if (this == o) return true; 105 if (!(o instanceof TargetModuleIDImpl)) return false; 106 107 final TargetModuleIDImpl targetModuleID = (TargetModuleIDImpl) o; 108 109 if (!moduleID.equals(targetModuleID.moduleID)) return false; 110 if (!target.equals(targetModuleID.target)) return false; 111 112 return true; 113 } 114 115 public int hashCode() { 116 int result; 117 result = target.hashCode(); 118 result = 29 * result + moduleID.hashCode(); 119 return result; 120 } 121 } 122 | Popular Tags |