1 5 package ve.luz.ica.jackass.daemon; 6 7 import java.util.Iterator ; 8 import java.util.Set ; 9 import java.util.LinkedHashSet ; 10 import java.io.Serializable ; 11 import java.io.ObjectInputStream ; 12 import java.io.IOException ; 13 import java.io.InvalidObjectException ; 14 15 import ve.luz.ica.jackass.deploy.daemon.NodeDeployer; 16 17 23 public final class ApplicationInfo implements Serializable 24 { 25 private static final String ERR_NULL_VAR = "Invalid NULL instance variable"; 26 private static final String ERR_NULL_ENTRY = "Invalid NULL entry"; 27 private Set nodeDeployers; 28 private Set componentNSNames; 29 30 33 public ApplicationInfo() 34 { 35 nodeDeployers = new LinkedHashSet (); 36 componentNSNames = new LinkedHashSet (); 37 } 38 39 43 public void addNodeDeployer(NodeDeployer nd) 44 { 45 nodeDeployers.add(nd); 46 } 47 48 52 public void addComponentNSName(String name) 53 { 54 componentNSNames.add(name); 55 } 56 57 62 public void removeNodeDeployer(NodeDeployer nd) 63 { 64 nodeDeployers.remove(nd); 65 } 66 67 72 public Iterator nodeDeployerIterator() 73 { 74 return nodeDeployers.iterator(); 75 } 76 77 82 public Iterator componentNSNamesIterator() 83 { 84 return componentNSNames.iterator(); 85 } 86 87 94 private void readObject(ObjectInputStream s) throws IOException , ClassNotFoundException 95 { 96 s.defaultReadObject(); 97 98 if (this.nodeDeployers == null || this.componentNSNames == null) 99 { 100 throw new InvalidObjectException (ERR_NULL_VAR); 101 } 102 103 for (Iterator i = nodeDeployers.iterator(); i.hasNext();) 104 { 105 NodeDeployer nd = (NodeDeployer) i.next(); 106 if (nd == null) 107 { 108 throw new InvalidObjectException (ERR_NULL_ENTRY); 109 } 110 } 111 112 for (Iterator i = componentNSNames.iterator(); i.hasNext();) 113 { 114 String nsn = (String ) i.next(); 115 if (nsn == null) 116 { 117 throw new InvalidObjectException (ERR_NULL_ENTRY); 118 } 119 } 120 } 121 } 122 | Popular Tags |