001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.iiop.rmi.ir;
023:
024: import org.omg.CORBA.TypeCode;
025: import org.omg.CORBA.TypeCodePackage.BadKind;
026: import org.omg.CORBA.IRObject;
027: import org.omg.CORBA.IDLType;
028: import org.omg.CORBA.IDLTypeHelper;
029: import org.omg.CORBA.DefinitionKind;
030: import org.omg.CORBA.ValueBoxDef;
031: import org.omg.CORBA.ValueBoxDefOperations;
032: import org.omg.CORBA.ValueBoxDefHelper;
033: import org.omg.CORBA.ValueBoxDefPOATie;
034: import org.omg.CORBA.BAD_INV_ORDER;
035:
036: /**
037: * ValueBoxDef IR object.
038: *
039: * @author <a href="mailto:osh@sparre.dk">Ole Husgaard</a>
040: * @version $Revision: 57194 $
041: */
042: class ValueBoxDefImpl extends TypedefDefImpl implements
043: ValueBoxDefOperations {
044: // Constants -----------------------------------------------------
045:
046: // Attributes ----------------------------------------------------
047:
048: // Static --------------------------------------------------------
049:
050: // Constructors --------------------------------------------------
051:
052: ValueBoxDefImpl(String id, String name, String version,
053: LocalContainer defined_in, TypeCode typeCode,
054: RepositoryImpl repository) {
055: super (id, name, version, defined_in, typeCode,
056: DefinitionKind.dk_ValueBox, repository);
057: }
058:
059: // Public --------------------------------------------------------
060:
061: // LocalIRObject implementation ---------------------------------
062:
063: public IRObject getReference() {
064: if (ref == null) {
065: ref = org.omg.CORBA.ValueBoxDefHelper
066: .narrow(servantToReference(new ValueBoxDefPOATie(
067: this )));
068: }
069: return ref;
070: }
071:
072: public void allDone() throws IRConstructionException {
073: // Get my original type definition: It should have been created now.
074: try {
075: original_type_def = IDLTypeImpl.getIDLType(type()
076: .content_type(), repository);
077: } catch (BadKind ex) {
078: throw new RuntimeException("Bad kind "
079: + type().kind().value()
080: + " for TypeCode.content_type()");
081: }
082:
083: getReference();
084: }
085:
086: // ValueBoxDefOperations implementation --------------------------
087:
088: public IDLType original_type_def() {
089: return IDLTypeHelper.narrow(original_type_def.getReference());
090: }
091:
092: public void original_type_def(IDLType arg) {
093: throw new BAD_INV_ORDER("Cannot change RMI/IIOP mapping.");
094: }
095:
096: // Package protected ---------------------------------------------
097:
098: // Private -------------------------------------------------------
099:
100: /**
101: * My CORBA reference.
102: */
103: private ValueBoxDef ref = null;
104:
105: /**
106: * My original IDL type.
107: */
108: private LocalIDLType original_type_def;
109: }
|