KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > ir > SequenceDef


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

22
23 import org.omg.CORBA.INTF_REPOS JavaDoc;
24 import org.omg.PortableServer.POA JavaDoc;
25
26 import org.apache.avalon.framework.logger.Logger;
27
28 public class SequenceDef
29     extends IDLType
30     implements org.omg.CORBA.SequenceDefOperations JavaDoc
31 {
32     private int bound = -1;
33     private org.omg.CORBA.TypeCode JavaDoc element_type;
34     private org.omg.CORBA.IDLType JavaDoc element_type_def;
35     private Logger logger;
36     private POA JavaDoc poa;
37
38     /** needed for lookup in define() */
39     private org.omg.CORBA.Repository JavaDoc ir;
40
41     public SequenceDef( org.omg.CORBA.TypeCode JavaDoc tc,
42                         org.omg.CORBA.Repository JavaDoc ir,
43                         Logger logger,
44                         POA JavaDoc poa )
45     {
46         if (tc.kind () != org.omg.CORBA.TCKind.tk_sequence)
47         {
48            throw new INTF_REPOS JavaDoc ("Precondition volation: TypeCode must be of kind sequence");
49         }
50         
51         this.logger = logger;
52         this.poa = poa;
53         type = tc;
54         def_kind = org.omg.CORBA.DefinitionKind.dk_Sequence;
55         this.ir = ir;
56         String JavaDoc name = "<unknown>";
57         try
58         {
59             element_type = tc.content_type();
60             bound = tc.length();
61             name = element_type.name();
62         }
63         catch( org.omg.CORBA.TypeCodePackage.BadKind JavaDoc bk )
64         {
65             // cannot happen because of above test
66
}
67
68         element_type_def = IDLType.create( element_type, ir,
69                                            this.logger, this.poa);
70
71         if (element_type_def == null)
72         {
73             throw new INTF_REPOS JavaDoc ("Element type " + name + " null in SequenceDef " + name );
74         }
75
76         this.logger.debug("New SequenceDef");
77     }
78
79     public int bound()
80     {
81         return bound;
82     }
83
84     public void bound(int a)
85     {
86         bound = a;
87     }
88
89     public org.omg.CORBA.TypeCode JavaDoc element_type()
90     {
91         return element_type;
92     }
93
94     public org.omg.CORBA.IDLType JavaDoc element_type_def()
95     {
96         return element_type_def;
97     }
98
99     public void element_type_def(org.omg.CORBA.IDLType JavaDoc a)
100     {
101         element_type_def = a;
102     }
103
104     public void destroy()
105     {
106         type = null;
107         element_type = null;
108         element_type_def = null;
109     }
110
111     public void define()
112     {
113
114     }
115 }
116
Popular Tags