1 22 package org.jboss.deployment.spi.status; 23 24 import java.util.ArrayList ; 25 import java.util.List ; 26 27 import javax.enterprise.deploy.shared.StateType ; 28 import javax.enterprise.deploy.spi.TargetModuleID ; 29 import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException ; 30 import javax.enterprise.deploy.spi.status.ClientConfiguration ; 31 import javax.enterprise.deploy.spi.status.DeploymentStatus ; 32 import javax.enterprise.deploy.spi.status.ProgressEvent ; 33 import javax.enterprise.deploy.spi.status.ProgressListener ; 34 import javax.enterprise.deploy.spi.status.ProgressObject ; 35 36 43 public class ProgressObjectImpl implements ProgressObject 44 { 45 private List listeners = new ArrayList (); 47 48 private DeploymentStatusImpl deploymentStatus; 49 private TargetModuleID [] targetModules; 50 51 public ProgressObjectImpl(DeploymentStatus deploymentStatus, TargetModuleID [] targetModules) 52 { 53 this.deploymentStatus = (DeploymentStatusImpl)deploymentStatus; 54 this.targetModules = targetModules; 55 } 56 57 60 public void sendProgressEvent(StateType stateType, String message, TargetModuleID moduleID) 61 { 62 deploymentStatus.setStateType(stateType); 63 deploymentStatus.setMessage(message); 64 ProgressEvent progressEvent = new ProgressEvent (this, moduleID, deploymentStatus); 65 for (int i = 0; i < listeners.size(); i++) 66 { 67 ProgressListener progressListener = (ProgressListener )listeners.get(i); 68 progressListener.handleProgressEvent(progressEvent); 69 } 70 } 71 72 77 public DeploymentStatus getDeploymentStatus() 78 { 79 return deploymentStatus; 80 } 81 82 87 public TargetModuleID [] getResultTargetModuleIDs() 88 { 89 return targetModules; 90 } 91 92 98 public ClientConfiguration getClientConfiguration(TargetModuleID id) 99 { 100 return null; } 102 103 108 public boolean isCancelSupported() 109 { 110 return false; 111 } 112 113 119 public void cancel() throws OperationUnsupportedException 120 { 121 throw new OperationUnsupportedException ("cancel not supported"); 122 } 123 124 129 public boolean isStopSupported() 130 { 131 return false; 132 } 133 134 140 public void stop() throws OperationUnsupportedException 141 { 142 throw new OperationUnsupportedException ("stop not supported"); 143 } 144 145 150 public void addProgressListener(ProgressListener listener) 151 { 152 listeners.add(listener); 153 } 154 155 160 public void removeProgressListener(ProgressListener listener) 161 { 162 listeners.remove(listener); 163 } 164 } 165 | Popular Tags |