1 51 52 package org.omg.CosActivity; 53 54 import javax.activity.ActivityCoordinator ; 55 import javax.activity.CompletionStatus ; 56 import javax.activity.CoordinationInformation ; 57 import javax.activity.Outcome ; 58 import javax.activity.Signal ; 59 import javax.activity.SignalSetActiveException ; 60 import javax.activity.SignalSetInactiveException ; 61 import javax.activity.coordination.SignalSet; 62 63 public class ChildLifetime implements SignalSet { 64 65 public static final String SSNAME = "org.omg.CosActivity.ChildLifetime"; 66 private String signalSetName; 68 69 private ActivityCoordinator ac; 70 71 private int completionStatus; 72 73 private int status; 74 75 private Outcome outcome; 76 77 private boolean started; 78 79 private boolean finished; 80 81 83 public ChildLifetime() { 84 this.signalSetName = SSNAME; 85 this.outcome = null; 86 this.started = false; 87 this.finished = false; 88 } 89 90 92 94 public java.lang.String getSignalSetName() { 95 return this.signalSetName; 96 } 97 98 public Signal getSignal() { 99 100 Signal signal = null; 101 102 if (!finished) { 103 if (started == false) { 104 started = true; 105 signal = 106 new Signal ( 107 "childBegin", 108 this.signalSetName, 109 (java.io.Serializable ) null); 110 } 111 112 if (signal == null) 113 finished = true; 114 } 115 return signal; 116 } 117 118 public CoordinationInformation setResponse(Outcome response) 119 throws SignalSetInactiveException { 120 121 if (!started) 122 throw new SignalSetInactiveException (); 123 124 CoordinationInformation info = 125 new CoordinationInformation (false, false); 126 127 if ((completionStatus != CompletionStatus.CompletionStatusFailOnly) 128 && (response.getName().equals("ActionError") 129 || response.getName().equals("ActionError"))) { 130 completionStatus = CompletionStatus.CompletionStatusFailOnly; 131 } 132 133 return info; 134 135 } 136 137 public Outcome getOutcome() throws SignalSetActiveException { 138 return outcome; 139 } 140 141 public void setCompletionStatus(int completionStatus, int status) { 142 this.completionStatus = completionStatus; 143 this.status = status; 144 } 145 146 public int getCompletionStatus() throws SignalSetActiveException { 147 if (!finished) 148 throw new SignalSetActiveException (); 149 return this.completionStatus; 150 } 151 152 public void setActivityCoordinator(ActivityCoordinator coord) 153 throws SignalSetActiveException { 154 155 if (started) 156 throw new SignalSetActiveException (); 157 ac = coord; 158 } 159 160 public void destroy() { 161 ac = null; 162 } 163 164 } 165 | Popular Tags |