KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > deployment > util > DeploymentData


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 JavaDoc;
8 import java.util.ArrayList JavaDoc;
9
10 /*
11 * Copyright 2004,2005 The Apache Software Foundation.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 *
26 */

27
28 /**
29  * Author : Deepal Jayasinghe
30  * Date: May 12, 2005
31  * Time: 7:14:26 PM
32  */

33 public class DeploymentData {
34
35     private static DeploymentData deploymentData;
36
37     private ArrayList JavaDoc modules ;
38
39     private ArrayList JavaDoc INPhases;
40     private ArrayList JavaDoc OUTPhases;
41     private ArrayList JavaDoc IN_FaultPhases;
42     private ArrayList JavaDoc OUT_FaultPhases;
43
44     private ArrayList JavaDoc oprationINPhases;
45     private ArrayList JavaDoc oprationOUTPhases;
46     private ArrayList JavaDoc oprationIN_FaultPhases;
47     private ArrayList JavaDoc oprationOUT_FaultPhases;
48
49     private DeploymentData() {
50         modules = new ArrayList JavaDoc();
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 JavaDoc INPhases) {
62         this.INPhases = INPhases;
63     }
64
65     public void setOUTPhases(ArrayList JavaDoc OUTPhases) {
66         this.OUTPhases = OUTPhases;
67     }
68
69     public void setIN_FaultPhases(ArrayList JavaDoc IN_FaultPhases) {
70         this.IN_FaultPhases = IN_FaultPhases;
71     }
72
73     public void setOUT_FaultPhases(ArrayList JavaDoc OUT_FaultPhases) {
74         this.OUT_FaultPhases = OUT_FaultPhases;
75     }
76
77     public ArrayList JavaDoc getINPhases() {
78         return INPhases;
79     }
80
81     public ArrayList JavaDoc getOUTPhases() {
82         return OUTPhases;
83     }
84
85     public ArrayList JavaDoc getIN_FaultPhases() {
86         return IN_FaultPhases;
87     }
88
89     public ArrayList JavaDoc getOUT_FaultPhases() {
90         return OUT_FaultPhases;
91     }
92
93     public ArrayList JavaDoc getOperationInPhases() {
94         oprationINPhases = new ArrayList JavaDoc();
95         oprationINPhases.add(new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION));
96         for (int i = 0; i < INPhases.size(); i++) {
97             String JavaDoc phaseName = (String JavaDoc) 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 JavaDoc getOperationOutPhases() {
111         oprationOUTPhases = new ArrayList JavaDoc();
112         for (int i = 0; i < OUTPhases.size(); i++) {
113             String JavaDoc phaseName = (String JavaDoc) 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 JavaDoc getOperationInFaultPhases() {
126         oprationIN_FaultPhases = new ArrayList JavaDoc();
127         for (int i = 0; i < IN_FaultPhases.size(); i++) {
128             String JavaDoc phaseName = (String JavaDoc) IN_FaultPhases.get(i);
129             oprationIN_FaultPhases.add(new Phase(phaseName));
130         }
131         return oprationIN_FaultPhases;
132     }
133
134     public ArrayList JavaDoc getOperationOutFaultPhases() {
135         oprationOUT_FaultPhases = new ArrayList JavaDoc();
136         for (int i = 0; i < OUT_FaultPhases.size(); i++) {
137             String JavaDoc phaseName = (String JavaDoc) 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 JavaDoc moduleName){
153         modules.add(moduleName);
154     }
155
156     public ArrayList JavaDoc getModules(){
157         return modules;
158     }
159
160 }
161
Popular Tags