01: package org.jacorb.ir;
02:
03: /*
04: * JacORB - a free Java ORB
05: *
06: * Copyright (C) 1997-2004 Gerald Brose.
07: *
08: * This library is free software; you can redistribute it and/or
09: * 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;
24: import org.omg.PortableServer.POA;
25: import org.apache.avalon.framework.logger.Logger;
26:
27: public class ArrayDef extends IDLType implements
28: org.omg.CORBA.ArrayDefOperations {
29: int size = -1;
30: org.omg.CORBA.TypeCode element_type;
31: org.omg.CORBA.IDLType element_type_def;
32: private org.omg.CORBA.Repository ir;
33:
34: private Logger logger;
35: private POA poa;
36:
37: public ArrayDef(org.omg.CORBA.TypeCode tc,
38: org.omg.CORBA.Repository ir, Logger logger, POA poa) {
39: this .logger = logger;
40: this .poa = poa;
41:
42: if (tc.kind() != org.omg.CORBA.TCKind.tk_array) {
43: throw new INTF_REPOS(
44: "Precondition volation: TypeCode must be of kind array");
45: }
46:
47: def_kind = org.omg.CORBA.DefinitionKind.dk_Array;
48: this .ir = ir;
49: type = tc;
50: try {
51: size = tc.length();
52: element_type = tc.content_type();
53: element_type_def = IDLType.create(element_type, ir,
54: this .logger, this .poa);
55: } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
56: // cannot happen because of above test
57: }
58:
59: if (element_type_def == null) {
60: throw new INTF_REPOS(
61: "Precondition volation: TypeCode must be of kind array");
62: }
63:
64: this .logger.debug("New ArrayDef");
65: }
66:
67: public int length() {
68: return size;
69: }
70:
71: public void length(int a) {
72: size = a;
73: }
74:
75: public org.omg.CORBA.TypeCode element_type() {
76: return element_type;
77: }
78:
79: public org.omg.CORBA.IDLType element_type_def() {
80: return element_type_def;
81: }
82:
83: public void element_type_def(org.omg.CORBA.IDLType a) {
84: element_type_def = a;
85: }
86:
87: public void destroy() {
88: type = null;
89: element_type = null;
90: element_type_def = null;
91: }
92:
93: public void define() {
94:
95: }
96: }
|