1 package org.apache.axis2.deployment.util; 2 3 import org.apache.axis2.description.OperationDescription; 4 import org.apache.axis2.engine.Phase; 5 import org.apache.axis2.phaseresolver.PhaseMetadata; 6 7 import javax.xml.namespace.QName ; 8 import java.util.ArrayList ; 9 10 27 28 33 public class DeploymentData { 34 35 private static DeploymentData deploymentData; 36 37 private ArrayList modules ; 38 39 private ArrayList INPhases; 40 private ArrayList OUTPhases; 41 private ArrayList IN_FaultPhases; 42 private ArrayList OUT_FaultPhases; 43 44 private ArrayList oprationINPhases; 45 private ArrayList oprationOUTPhases; 46 private ArrayList oprationIN_FaultPhases; 47 private ArrayList oprationOUT_FaultPhases; 48 49 private DeploymentData() { 50 modules = new ArrayList (); 51 } 52 53 public static DeploymentData getInstance() { 54 if (deploymentData == null) { 55 deploymentData = new DeploymentData(); 56 } 57 return deploymentData; 58 } 59 60 61 public void setINPhases(ArrayList INPhases) { 62 this.INPhases = INPhases; 63 } 64 65 public void setOUTPhases(ArrayList OUTPhases) { 66 this.OUTPhases = OUTPhases; 67 } 68 69 public void setIN_FaultPhases(ArrayList IN_FaultPhases) { 70 this.IN_FaultPhases = IN_FaultPhases; 71 } 72 73 public void setOUT_FaultPhases(ArrayList OUT_FaultPhases) { 74 this.OUT_FaultPhases = OUT_FaultPhases; 75 } 76 77 public ArrayList getINPhases() { 78 return INPhases; 79 } 80 81 public ArrayList getOUTPhases() { 82 return OUTPhases; 83 } 84 85 public ArrayList getIN_FaultPhases() { 86 return IN_FaultPhases; 87 } 88 89 public ArrayList getOUT_FaultPhases() { 90 return OUT_FaultPhases; 91 } 92 93 public ArrayList getOperationInPhases() { 94 oprationINPhases = new ArrayList (); 95 oprationINPhases.add(new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION)); 96 for (int i = 0; i < INPhases.size(); i++) { 97 String phaseName = (String ) INPhases.get(i); 98 if (PhaseMetadata.PHASE_TRANSPORTIN.equals(phaseName) || 99 PhaseMetadata.PHASE_PRE_DISPATCH.equals(phaseName) || 100 PhaseMetadata.PHASE_DISPATCH.equals(phaseName) || 101 PhaseMetadata.PHASE_POST_DISPATCH.equals(phaseName)) { 102 continue; 103 } else { 104 oprationINPhases.add(new Phase(phaseName)); 105 } 106 } 107 return oprationINPhases; 108 } 109 110 public ArrayList getOperationOutPhases() { 111 oprationOUTPhases = new ArrayList (); 112 for (int i = 0; i < OUTPhases.size(); i++) { 113 String phaseName = (String ) OUTPhases.get(i); 114 if (PhaseMetadata.PHASE_TRANSPORT_OUT.equals(phaseName)) { 115 continue; 116 } else { 117 oprationOUTPhases.add(new Phase(phaseName)); 118 } 119 } 120 oprationOUTPhases.add(new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION)); 121 oprationOUTPhases.add(new Phase(PhaseMetadata.PHASE_MESSAGE_OUT)); 122 return oprationOUTPhases; 123 } 124 125 public ArrayList getOperationInFaultPhases() { 126 oprationIN_FaultPhases = new ArrayList (); 127 for (int i = 0; i < IN_FaultPhases.size(); i++) { 128 String phaseName = (String ) IN_FaultPhases.get(i); 129 oprationIN_FaultPhases.add(new Phase(phaseName)); 130 } 131 return oprationIN_FaultPhases; 132 } 133 134 public ArrayList getOperationOutFaultPhases() { 135 oprationOUT_FaultPhases = new ArrayList (); 136 for (int i = 0; i < OUT_FaultPhases.size(); i++) { 137 String phaseName = (String ) OUT_FaultPhases.get(i); 138 oprationOUT_FaultPhases.add(new Phase(phaseName)); 139 } 140 return oprationOUT_FaultPhases; 141 } 142 143 public void setOperationPhases(OperationDescription operation) { 144 if (operation != null) { 145 operation.setRemainingPhasesInFlow(getOperationInPhases()); 146 operation.setPhasesOutFlow(getOperationOutPhases()); 147 operation.setPhasesInFaultFlow(getOperationInFaultPhases()); 148 operation.setPhasesOutFaultFlow(getOperationOutFaultPhases()); 149 } 150 } 151 152 public void addModule(QName moduleName){ 153 modules.add(moduleName); 154 } 155 156 public ArrayList getModules(){ 157 return modules; 158 } 159 160 } 161 | Popular Tags |