KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > iiop > rmi > ir > SequenceDefImpl


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.iiop.rmi.ir;
23
24 import org.omg.CORBA.TypeCode JavaDoc;
25 import org.omg.CORBA.TypeCodePackage.BadKind JavaDoc;
26 import org.omg.CORBA.IRObject JavaDoc;
27 import org.omg.CORBA.IDLType JavaDoc;
28 import org.omg.CORBA.IDLTypeHelper JavaDoc;
29 import org.omg.CORBA.DefinitionKind JavaDoc;
30 import org.omg.CORBA.SequenceDef JavaDoc;
31 import org.omg.CORBA.SequenceDefOperations JavaDoc;
32 import org.omg.CORBA.SequenceDefPOATie;
33 import org.omg.CORBA.BAD_INV_ORDER JavaDoc;
34
35 /**
36  * SequenceDef IR object.
37  *
38  * @author <a HREF="mailto:osh@sparre.dk">Ole Husgaard</a>
39  * @version $Revision: 37459 $
40  */

41 class SequenceDefImpl
42    extends IDLTypeImpl
43    implements SequenceDefOperations JavaDoc
44 {
45    // Constants -----------------------------------------------------
46

47    // Attributes ----------------------------------------------------
48

49    // Static --------------------------------------------------------
50

51    // Constructors --------------------------------------------------
52

53    SequenceDefImpl(TypeCode JavaDoc typeCode, RepositoryImpl repository)
54    {
55       super(typeCode, DefinitionKind.dk_Sequence, repository);
56    }
57
58    // Public --------------------------------------------------------
59

60    // LocalIRObject implementation ---------------------------------
61

62    public IRObject JavaDoc getReference()
63    {
64       if (ref == null) {
65          ref = org.omg.CORBA.SequenceDefHelper.narrow(
66                              servantToReference(new SequenceDefPOATie(this)) );
67       }
68       return ref;
69    }
70  
71    public void allDone()
72       throws IRConstructionException
73    {
74       // Get my element type definition: It should have been created now.
75
try {
76          element_type_def = IDLTypeImpl.getIDLType(type().content_type(),
77                                                     repository);
78       } catch (BadKind JavaDoc ex) {
79          throw new RuntimeException JavaDoc("Bad kind " + type().kind().value() +
80                                     " for TypeCode.content_type()");
81       }
82  
83       getReference();
84    }
85
86
87    // SequenceDefOperations implementation --------------------------
88

89    public int bound()
90    {
91       try {
92          return type().length();
93       } catch (BadKind JavaDoc ex) {
94          // should never happen
95
throw new RuntimeException JavaDoc();
96       }
97    }
98
99    public void bound(int arg)
100    {
101       throw new BAD_INV_ORDER JavaDoc("Cannot change RMI/IIOP mapping.");
102    }
103
104    public TypeCode JavaDoc element_type()
105    {
106       try {
107          return type().content_type();
108       } catch (BadKind JavaDoc ex) {
109          // should never happen
110
throw new RuntimeException JavaDoc();
111       }
112    }
113
114    public IDLType JavaDoc element_type_def()
115    {
116       return IDLTypeHelper.narrow(element_type_def.getReference());
117    }
118
119    public void element_type_def(IDLType JavaDoc arg)
120    {
121       throw new BAD_INV_ORDER JavaDoc("Cannot change RMI/IIOP mapping.");
122    }
123
124
125    // Package protected ---------------------------------------------
126

127    // Private -------------------------------------------------------
128

129    /**
130     * My CORBA reference.
131     */

132    private SequenceDef JavaDoc ref = null;
133
134    /**
135     * My element type.
136     */

137    private LocalIDLType element_type_def;
138 }
139
Popular Tags