KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > idl > ExceptionHolderTypeSpec


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1997-2004 Gerald Brose.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */

20
21 package org.jacorb.idl;
22
23 /**
24  * @author Andre Spiegel <spiegel@gnu.org>
25  * @version $Id: ExceptionHolderTypeSpec.java,v 1.8 2004/05/06 12:39:58 nicolas Exp $
26  */

27
28 import java.io.PrintWriter JavaDoc;
29
30 public class ExceptionHolderTypeSpec
31     extends TypeSpec
32 {
33
34     public ExceptionHolderTypeSpec( int num )
35     {
36         super( num );
37     }
38
39     public Object JavaDoc clone()
40     {
41         return this;
42     }
43
44     public String JavaDoc typeName()
45     {
46         return "org.omg.Messaging.ExceptionHolder";
47     }
48
49     public TypeSpec typeSpec()
50     {
51         return this;
52     }
53
54     public void setPackage( String JavaDoc s )
55     {
56         s = parser.pack_replace( s );
57     }
58
59     public boolean basic()
60     {
61         return true;
62     }
63
64     public void set_constr( TypeDeclaration td )
65     {
66     }
67
68     public void parse()
69     {
70     }
71
72     public String JavaDoc id()
73     {
74         return "IDL:omg.org/Messaging/ExceptionHolder:1.0";
75     }
76
77     public String JavaDoc toString()
78     {
79         return "org.omg.Messaging.ExceptionHolder";
80     }
81
82     /**
83      * @return a string for an expression of type TypeCode that describes this type
84      */

85     public String JavaDoc getTypeCodeExpression()
86     {
87         return "org.omg.CORBA.ORB.init().create_value_tc"
88           + "(\"IDL:omg.org/Messaging/ExceptionHolder:1.0\","
89           + "\"ExceptionHolder\", (short)0, null,"
90           + "new org.omg.CORBA.ValueMember[] {"
91           + "new org.omg.CORBA.ValueMember (\"\", \"IDL:*primitive*:1.0\","
92           + "\"ExceptionHolder\", \"1.0\", "
93           + "org.omg.CORBA.ORB.init().get_primitive_tc("
94           + "org.omg.CORBA.TCKind.from_int(8)), null, (short)0),"
95           + "new org.omg.CORBA.ValueMember (\"\", \"IDL:*primitive*:1.0\","
96           + "\"ExceptionHolder\", \"1.0\", "
97           + "org.omg.CORBA.ORB.init().get_primitive_tc("
98           + "org.omg.CORBA.TCKind.from_int(8)), null, (short)0),"
99           + "new org.omg.CORBA.ValueMember (\"\", \"IDL:marshaled_exception:1.0\","
100           + "\"ExceptionHolder\", \"1.0\", "
101           + "org.omg.CORBA.ORB.init().create_sequence_tc("
102           + "0, org.omg.CORBA.ORB.init().get_primitive_tc("
103           + "org.omg.CORBA.TCKind.from_int(10)) ), null, (short)0)});";
104     }
105
106     public void print( PrintWriter JavaDoc ps )
107     {
108     }
109
110     public String JavaDoc holderName()
111     {
112         return typeName() + "Holder";
113     }
114
115     public String JavaDoc printWriteStatement( String JavaDoc var_name, String JavaDoc streamname )
116     {
117         return "((org.omg.CORBA_2_3.portable.OutputStream)" + streamname + ")"
118                 + ".write_value (" + var_name + " );";
119     }
120
121     public String JavaDoc printReadExpression( String JavaDoc streamname )
122     {
123         return "(" + typeName() + ")"
124                 + "((org.omg.CORBA_2_3.portable.InputStream)" + streamname + ")"
125                 + ".read_value (\"" + id() + "\")";
126     }
127
128 }
129
Popular Tags