1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54: import ;
55: import ;
56: import ;
57:
58: import ;
59:
60:
65: public abstract class _NamingContextExtImplBase
66: extends _NamingContextImplBase
67: implements NamingContextExt, InvokeHandler
68: {
69: static Hashtable<String,Integer> _methods = new Hashtable<String,Integer>();
70:
71: static
72: {
73: _methods.put("to_string", new java.lang.Integer(0));
74: _methods.put("to_name", new java.lang.Integer(1));
75: _methods.put("to_url", new java.lang.Integer(2));
76: _methods.put("resolve_str", new java.lang.Integer(3));
77: }
78:
79:
83: private static String[] __ids =
84: { NamingContextExtHelper.id(), NamingContextHelper.id() };
85:
86:
92: public String[] _ids()
93: {
94: return __ids;
95: }
96:
97: public OutputStream _invoke(String method, InputStream in, ResponseHandler rh)
98: {
99: Integer call_method = (Integer) _methods.get(method);
100:
101: if (call_method == null)
102:
103:
104: return super._invoke(method, in, rh);
105:
106: OutputStream out = null;
107:
108: switch (call_method.intValue())
109: {
110: case 0 :
111: {
112: try
113: {
114: NameComponent[] a_name = NameHelper.read(in);
115: String result = null;
116: result = this.to_string(a_name);
117: out = rh.createReply();
118: out.write_string(result);
119: }
120: catch (InvalidName ex)
121: {
122: out = rh.createExceptionReply();
123: InvalidNameHelper.write(out, ex);
124: }
125: break;
126: }
127:
128: case 1 :
129: {
130: try
131: {
132: String a_name_string = in.read_string();
133: NameComponent[] result = to_name(a_name_string);
134: out = rh.createReply();
135: NameHelper.write(out, result);
136: }
137: catch (InvalidName ex)
138: {
139: out = rh.createExceptionReply();
140: InvalidNameHelper.write(out, ex);
141: }
142: break;
143: }
144:
145: case 2 :
146: {
147: try
148: {
149: String an_address = in.read_string();
150: String a_name_string = in.read_string();
151: String result = to_url(an_address, a_name_string);
152: out = rh.createReply();
153: out.write_string(result);
154: }
155: catch (InvalidAddress ex)
156: {
157: out = rh.createExceptionReply();
158: InvalidAddressHelper.write(out, ex);
159: }
160: catch (InvalidName ex)
161: {
162: out = rh.createExceptionReply();
163: InvalidNameHelper.write(out, ex);
164: }
165: break;
166: }
167:
168: case 3 :
169: {
170: try
171: {
172: String a_name_string = in.read_string();
173: org.omg.CORBA.Object result = resolve_str(a_name_string);
174: out = rh.createReply();
175: org.omg.CORBA.ObjectHelper.write(out, result);
176: }
177: catch (NotFound ex)
178: {
179: out = rh.createExceptionReply();
180: NotFoundHelper.write(out, ex);
181: }
182: catch (CannotProceed ex)
183: {
184: out = rh.createExceptionReply();
185: CannotProceedHelper.write(out, ex);
186: }
187: catch (InvalidName ex)
188: {
189: out = rh.createExceptionReply();
190: InvalidNameHelper.write(out, ex);
191: }
192: break;
193: }
194: }
195: return out;
196: }
197:
198:
205: public void invoke(ServerRequest request)
206: {
207: Streamable result = null;
208:
209: Integer call_method = (Integer) _methods.get(request.operation());
210:
211: if (call_method == null)
212: {
213: super.invoke(request);
214: return;
215: }
216:
217: switch (call_method.intValue())
218: {
219: case 0 :
220: result = new StringHolder();
221: break;
222:
223: case 1 :
224: result = new NameHolder();
225: break;
226:
227: case 2 :
228: result = new StringHolder();
229: break;
230:
231: case 3 :
232: result = new ObjectHolder();
233: break;
234: }
235: gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result);
236: }
237: }