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.TCKind;
027: import org.omg.CORBA.IRObject;
028: import org.omg.CORBA.IDLType;
029: import org.omg.CORBA.IDLTypeHelper;
030: import org.omg.CORBA.IDLTypeOperations;
031: import org.omg.CORBA.DefinitionKind;
032: import org.omg.CORBA.AliasDef;
033: import org.omg.CORBA.AliasDefOperations;
034: import org.omg.CORBA.AliasDefHelper;
035: import org.omg.CORBA.AliasDefPOATie;
036: import org.omg.CORBA.Any;
037: import org.omg.CORBA.TypeDescription;
038: import org.omg.CORBA.TypeDescriptionHelper;
039: import org.omg.CORBA.ContainedOperations;
040: import org.omg.CORBA.ContainedPackage.Description;
041: import org.omg.CORBA.BAD_INV_ORDER;
042:
043: import java.util.Map;
044: import java.util.HashMap;
045:
046: /**
047: * AliasDef IR object.
048: *
049: * @author <a href="mailto:osh@sparre.dk">Ole Husgaard</a>
050: * @version $Revision: 57194 $
051: */
052: class AliasDefImpl extends TypedefDefImpl implements AliasDefOperations {
053: // Constants -----------------------------------------------------
054:
055: // Attributes ----------------------------------------------------
056:
057: // Static --------------------------------------------------------
058:
059: // Constructors --------------------------------------------------
060:
061: AliasDefImpl(String id, String name, String version,
062: LocalContainer defined_in, TypeCode typeCode,
063: RepositoryImpl repository) {
064: super (id, name, version, defined_in, typeCode,
065: DefinitionKind.dk_Alias, repository);
066: }
067:
068: // Public --------------------------------------------------------
069:
070: // LocalIRObject implementation ---------------------------------
071:
072: public IRObject getReference() {
073: if (ref == null) {
074: ref = org.omg.CORBA.AliasDefHelper
075: .narrow(servantToReference(new AliasDefPOATie(this )));
076: }
077: return ref;
078: }
079:
080: public void allDone() throws IRConstructionException {
081: // Get my original type definition: It should have been created now.
082: try {
083: original_type_def = IDLTypeImpl.getIDLType(type()
084: .content_type(), repository);
085: } catch (BadKind ex) {
086: throw new RuntimeException("Bad kind "
087: + type().kind().value()
088: + " for TypeCode.content_type()");
089: }
090:
091: getReference();
092: }
093:
094: // AliasDefOperations implementation -------------------------------
095:
096: public IDLType original_type_def() {
097: return IDLTypeHelper.narrow(original_type_def.getReference());
098: }
099:
100: public void original_type_def(IDLType arg) {
101: throw new BAD_INV_ORDER("Cannot change RMI/IIOP mapping.");
102: }
103:
104: // Package protected ---------------------------------------------
105:
106: // Private -------------------------------------------------------
107:
108: /**
109: * My CORBA reference.
110: */
111: private AliasDef ref = null;
112:
113: /**
114: * My original IDL type.
115: */
116: private LocalIDLType original_type_def;
117: }
|