KickJava   Java API By Example, From Geeks To Geeks.

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


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.ValueBoxDef JavaDoc;
31 import org.omg.CORBA.ValueBoxDefOperations JavaDoc;
32 import org.omg.CORBA.ValueBoxDefPOATie;
33 import org.omg.CORBA.BAD_INV_ORDER JavaDoc;
34
35 /**
36  * ValueBoxDef IR object.
37  *
38  * @author <a HREF="mailto:osh@sparre.dk">Ole Husgaard</a>
39  * @version $Revision: 37459 $
40  */

41 class ValueBoxDefImpl
42    extends TypedefDefImpl
43    implements ValueBoxDefOperations JavaDoc
44 {
45    // Constants -----------------------------------------------------
46

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

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

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

53    ValueBoxDefImpl(String JavaDoc id, String JavaDoc name, String JavaDoc version,
54                 LocalContainer defined_in,
55                 TypeCode JavaDoc typeCode, RepositoryImpl repository)
56    {
57       super(id, name, version, defined_in, typeCode,
58             DefinitionKind.dk_ValueBox, repository);
59    }
60
61    // Public --------------------------------------------------------
62

63    // LocalIRObject implementation ---------------------------------
64

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

91    public IDLType JavaDoc original_type_def()
92    {
93       return IDLTypeHelper.narrow(original_type_def.getReference());
94    }
95
96    public void original_type_def(IDLType JavaDoc arg)
97    {
98       throw new BAD_INV_ORDER JavaDoc("Cannot change RMI/IIOP mapping.");
99    }
100
101    // Package protected ---------------------------------------------
102

103    // Private -------------------------------------------------------
104

105    /**
106     * My CORBA reference.
107     */

108    private ValueBoxDef JavaDoc ref = null;
109
110    /**
111     * My original IDL type.
112     */

113    private LocalIDLType original_type_def;
114 }
115
Popular Tags