KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > juddi > datatype > response > DispositionReport


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.juddi.datatype.response;
17
18 import java.util.Vector JavaDoc;
19
20 import org.apache.juddi.datatype.RegistryObject;
21
22 /**
23  * "This structure is used to report the outcome of message processing and
24  * to report errors discovered during processing. This message contains one
25  * or more result structures. A special case - success - contains only one
26  * result structure with the special errno attribute value of E_success (0)."
27  *
28  * @author Steve Viens (sviens@apache.org)
29  */

30 public class DispositionReport implements RegistryObject
31 {
32   String JavaDoc generic;
33   String JavaDoc operator;
34   Vector JavaDoc resultVector;
35
36   /**
37    * Constructs a new initialized DispositionReport instance.
38    */

39   public DispositionReport()
40   {
41   }
42
43   /**
44    *
45    * @param genericValue
46    */

47   public void setGeneric(String JavaDoc genericValue)
48   {
49     this.generic = genericValue;
50   }
51
52   /**
53    *
54    * @return String UDDI generic value.
55    */

56   public String JavaDoc getGeneric()
57   {
58     return this.generic;
59   }
60
61   /**
62    *
63    */

64   public void setOperator(String JavaDoc operator)
65   {
66     this.operator = operator;
67   }
68
69   /**
70    *
71    */

72   public String JavaDoc getOperator()
73   {
74      return this.operator;
75   }
76
77   /**
78    *
79    */

80   public void addResult(Result result)
81   {
82     if (this.resultVector == null)
83       this.resultVector = new Vector JavaDoc();
84     this.resultVector.add(result);
85   }
86
87   /**
88    *
89    */

90   public void setResultVector(Vector JavaDoc results)
91   {
92     this.resultVector = results;
93   }
94
95   /**
96    *
97    */

98   public Vector JavaDoc getResultVector()
99   {
100     return this.resultVector;
101   }
102
103   /**
104    *
105    */

106   public String JavaDoc toString()
107   {
108     StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
109     buffer.append("org.apache.juddi.datatype.response.DispositionReport.operator=");
110     buffer.append(this.operator);
111     buffer.append("\n");
112
113     if (this.resultVector != null)
114       for (int i=0; i<this.resultVector.size(); i++)
115         buffer.append(this.resultVector.elementAt(i));
116
117     return buffer.toString();
118   }
119
120   // test driver
121
public static void main(String JavaDoc[] args)
122   {
123     DispositionReport obj = new DispositionReport();
124     obj.setGeneric("2.0");
125     obj.setOperator("jUDDI.org");
126
127     ErrInfo errInfo = new ErrInfo();
128     errInfo.setErrCode("abc");
129     errInfo.setErrMsg("def");
130
131     Result result = new Result();
132     result.setErrInfo(errInfo);
133     result.setErrno(123);
134
135     obj.addResult(result);
136
137     errInfo = new ErrInfo();
138     errInfo.setErrCode("ghi");
139     errInfo.setErrMsg("jkl");
140
141     result = new Result();
142     result.setErrInfo(errInfo);
143     result.setErrno(456);
144
145     obj.addResult(result);
146
147     errInfo = new ErrInfo();
148     errInfo.setErrCode("mno");
149     errInfo.setErrMsg("pqr");
150
151     result = new Result();
152     result.setErrInfo(errInfo);
153     result.setErrno(789);
154
155     obj.addResult(result);
156
157     System.out.println(obj);
158   }
159 }
Popular Tags