001: package org.jacorb.ir;
002:
003: /*
004: * JacORB - a free Java ORB
005: *
006: * Copyright (C) 1997-2004 Gerald Brose.
007: *
008: * This library is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Library General Public
010: * License as published by the Free Software Foundation; either
011: * version 2 of the License, or (at your option) any later version.
012: *
013: * This library is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * Library General Public License for more details.
017: *
018: * You should have received a copy of the GNU Library General Public
019: * License along with this library; if not, write to the Free
020: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021: */
022:
023: import org.omg.CORBA.INTF_REPOS;
024: import org.omg.PortableServer.POA;
025:
026: import org.apache.avalon.framework.logger.Logger;
027:
028: public class SequenceDef extends IDLType implements
029: org.omg.CORBA.SequenceDefOperations {
030: private int bound = -1;
031: private org.omg.CORBA.TypeCode element_type;
032: private org.omg.CORBA.IDLType element_type_def;
033: private Logger logger;
034: private POA poa;
035:
036: /** needed for lookup in define() */
037: private org.omg.CORBA.Repository ir;
038:
039: public SequenceDef(org.omg.CORBA.TypeCode tc,
040: org.omg.CORBA.Repository ir, Logger logger, POA poa) {
041: if (tc.kind() != org.omg.CORBA.TCKind.tk_sequence) {
042: throw new INTF_REPOS(
043: "Precondition volation: TypeCode must be of kind sequence");
044: }
045:
046: this .logger = logger;
047: this .poa = poa;
048: type = tc;
049: def_kind = org.omg.CORBA.DefinitionKind.dk_Sequence;
050: this .ir = ir;
051: String name = "<unknown>";
052: try {
053: element_type = tc.content_type();
054: bound = tc.length();
055: name = element_type.name();
056: } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
057: // cannot happen because of above test
058: }
059:
060: element_type_def = IDLType.create(element_type, ir,
061: this .logger, this .poa);
062:
063: if (element_type_def == null) {
064: throw new INTF_REPOS("Element type " + name
065: + " null in SequenceDef " + name);
066: }
067:
068: this .logger.debug("New SequenceDef");
069: }
070:
071: public int bound() {
072: return bound;
073: }
074:
075: public void bound(int a) {
076: bound = a;
077: }
078:
079: public org.omg.CORBA.TypeCode element_type() {
080: return element_type;
081: }
082:
083: public org.omg.CORBA.IDLType element_type_def() {
084: return element_type_def;
085: }
086:
087: public void element_type_def(org.omg.CORBA.IDLType a) {
088: element_type_def = a;
089: }
090:
091: public void destroy() {
092: type = null;
093: element_type = null;
094: element_type_def = null;
095: }
096:
097: public void define() {
098:
099: }
100: }
|