1 22 package org.jboss.deployment.spi; 23 24 import java.io.Serializable ; 25 import java.util.ArrayList ; 26 27 import javax.enterprise.deploy.spi.TargetModuleID ; 28 29 35 public class SerializableTargetModuleID implements Serializable 36 { 37 private static final long serialVersionUID = 6856468929226666749L; 38 39 private SerializableTargetModuleID parentModuleID; 40 private ArrayList childModuleIDs = new ArrayList (); 41 private String moduleID; 42 private int moduleType; 43 private boolean isRunning; 44 45 public SerializableTargetModuleID(TargetModuleIDImpl impl) 46 { 47 this(null, impl); 48 } 49 50 public SerializableTargetModuleID(SerializableTargetModuleID parent, TargetModuleIDImpl impl) 51 { 52 parentModuleID = parent; 53 moduleID = impl.getModuleID(); 54 moduleType = impl.getModuleType().getValue(); 55 56 TargetModuleID [] children = impl.getChildTargetModuleID(); 57 int length = children != null ? children.length : 0; 58 for (int n = 0; n < length; n++) 59 { 60 TargetModuleIDImpl child = (TargetModuleIDImpl)children[n]; 61 childModuleIDs.add(new SerializableTargetModuleID(this, child)); 62 } 63 } 64 65 public SerializableTargetModuleID(SerializableTargetModuleID parent, String moduleID, int moduleType, boolean isRunning) 66 { 67 parentModuleID = parent; 68 this.moduleID = moduleID; 69 this.moduleType = moduleType; 70 this.isRunning = isRunning; 71 } 72 73 public SerializableTargetModuleID getParentModuleID() 74 { 75 return parentModuleID; 76 } 77 78 public void addChildTargetModuleID(SerializableTargetModuleID child) 79 { 80 childModuleIDs.add(child); 81 } 82 83 public void clearChildModuleIDs() 84 { 85 childModuleIDs.clear(); 86 } 87 88 public SerializableTargetModuleID[] getChildModuleIDs() 89 { 90 SerializableTargetModuleID[] ids = new SerializableTargetModuleID[childModuleIDs.size()]; 91 childModuleIDs.toArray(ids); 92 return ids; 93 } 94 95 public String getModuleID() 96 { 97 return moduleID; 98 } 99 100 public int getModuleType() 101 { 102 return moduleType; 103 } 104 105 public boolean isRunning() 106 { 107 return isRunning; 108 } 109 110 public void setRunning(boolean flag) 111 { 112 this.isRunning = flag; 113 } 114 115 public String toString() 116 { 117 return "SerializableTargetModuleID{" + "parentModuleID=@" + System.identityHashCode(parentModuleID) + ", childModuleIDs=" + childModuleIDs + ", moduleID='" 118 + moduleID + "'" + ", moduleType=" + moduleType + ", isRunning=" + isRunning + "}"; 119 } 120 121 } 122 | Popular Tags |