KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mark > comps > Add2_Skeleton


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

19 package mark.comps;
20
21 import gcc.rmi.iiop.ObjectInputStream;
22 import gcc.rmi.iiop.ObjectOutputStream;
23 import gcc.rmi.iiop.RemoteInterface;
24 import gcc.rmi.iiop.RemoteInterface;
25 import gcc.rmi.iiop.ObjectRef;
26 import gcc.rmi.iiop.RemoteObject;
27 import gcc.adapter.Adapter;
28 import java.util.HashMap;
29
30 import mark.AddData;
31 import mark.comps.Add2Impl;
32
33 public class Add2_Skeleton
34     extends RemoteObject
35     implements RemoteInterface
36 {
37     //
38
// Fields
39
//
40
public java.lang.String[] _ids = { "mark.comps.Add2", "RMI:mark.comps.Add2:0000000000000000"};
41     public java.util.HashMap _methods = new HashMap(10);
42     public Add2Impl _servant = null;
43     public java.lang.String _f3 = "f1";
44     public java.lang.String[] _f4 = { "f1", "f2" };
45     public gcc.rmi.iiop.ValueType vt$0 = gcc.rmi.iiop.ValueType.getInstance( AddData.class );
46     public gcc.rmi.iiop.ValueType vt$1 = gcc.rmi.iiop.ValueType.getInstance( AddData[].class );
47     public gcc.rmi.iiop.ValueType vt$2 = gcc.rmi.iiop.ValueType.getInstance( java.lang.String.class );
48
49     //
50
// Constructors
51
//
52
public Add2_Skeleton( )
53     {
54         super();
55
56         registerMethods();
57     }
58
59     protected void registerMethods()
60     {
61         super.registerMethods();
62
63         registerMethod( "add", 0);
64         registerMethod( "addData", 1);
65         registerMethod( "addDatas", 2);
66     }
67
68     //
69
// Methods
70
//
71

72     public void registerMethod( java.lang.String name, int id )
73     {
74         _methods.put( name, new Integer(id) );
75     }
76
77     public java.lang.String[] getIds( )
78     {
79         return _ids;
80     }
81
82     public RemoteInterface $getSkeleton( )
83     {
84         return this;
85     }
86
87     public ObjectRef $getObjectRef( )
88     {
89         gcc.rmi.iiop.ObjectRef or = new ObjectRef();
90         or.$setID("RMI:mark.comps.Add2:0000000000000000");
91         or.$setObjectKey("mark.comps.Add2");
92         return or;
93     }
94
95     public void $invoke( java.lang.String methodName, byte[] objectKey, java.lang.Object instance, gcc.rmi.iiop.ObjectInputStream input, gcc.rmi.iiop.ObjectOutputStream output )
96     {
97         java.lang.Integer m = (Integer)_methods.get(methodName);
98         if (m == null)
99         {
100             throw new org.omg.CORBA.BAD_OPERATION(methodName);
101         }
102
103         _servant = (mark.comps.Add2Impl)instance;
104
105         if (m.intValue() < 0)
106         {
107             super.invoke( m.intValue(), objectKey, instance, input, output );
108         }
109
110
111         switch(m.intValue())
112         {
113             case 0:
114             {
115                 add(input,output);
116             }
117             break;
118             case 1:
119             {
120                 addData(input,output);
121             }
122             break;
123             case 2:
124             {
125                 addDatas(input,output);
126             }
127             break;
128         }
129     }
130
131     public void add( gcc.rmi.iiop.ObjectInputStream input, gcc.rmi.iiop.ObjectOutputStream output )
132     {
133         int rc;
134
135         try
136         {
137             int p0 = input.readInt();
138             int p1 = input.readInt();
139             rc = _servant.add( p0, p1 );
140             output.writeInt( rc );
141         }
142         catch( java.lang.Exception ex )
143         {
144             ex.printStackTrace();
145         }
146         catch( java.lang.Error er )
147         {
148             er.printStackTrace();
149         }
150     }
151
152     public void addData( gcc.rmi.iiop.ObjectInputStream input, gcc.rmi.iiop.ObjectOutputStream output )
153     {
154         AddData rc;
155
156         try
157         {
158             AddData p0 = (AddData) input.readObject( vt$0 );
159             AddData p1 = (AddData) input.readObject( vt$0 );
160             rc = _servant.addData( p0, p1 );
161             output.writeObject( vt$0, rc );
162         }
163         catch( java.lang.Exception ex )
164         {
165             ex.printStackTrace();
166         }
167         catch( java.lang.Error er )
168         {
169             er.printStackTrace();
170         }
171     }
172
173     public void addDatas( gcc.rmi.iiop.ObjectInputStream input, gcc.rmi.iiop.ObjectOutputStream output )
174     {
175         AddData rc;
176
177         try
178         {
179             AddData[] p0 = (AddData[]) input.readObject( vt$1 );
180             rc = _servant.addDatas( p0 );
181             output.writeObject( vt$0, rc );
182         }
183         catch( java.lang.Exception ex )
184         {
185             ex.printStackTrace();
186         }
187         catch( java.lang.Error er )
188         {
189             er.printStackTrace();
190         }
191     }
192 }
193
Popular Tags