1 package org.jacorb.ir; 2 3 22 23 import org.omg.CORBA.INTF_REPOS ; 24 import org.omg.PortableServer.POA ; 25 import org.apache.avalon.framework.logger.Logger; 26 27 public class AliasDef 28 extends TypedefDef 29 implements org.omg.CORBA.AliasDefOperations 30 { 31 private org.omg.CORBA.IDLType original_type_def; 32 private Logger logger; 33 private POA poa; 34 35 public AliasDef( org.omg.CORBA.TypeCode type, 36 org.omg.CORBA.Container defined_in, 37 org.omg.CORBA.Repository containing_repository, 38 Logger logger, 39 POA poa) 40 { 41 this.logger = logger; 42 this.poa = poa; 43 def_kind = org.omg.CORBA.DefinitionKind.dk_Alias; 44 this.type = type; 45 this.containing_repository = containing_repository; 46 this.defined_in = defined_in; 47 try 48 { 49 name( type.name() ); 50 id( type.id() ); 51 version = ("1.0"); 52 absolute_name = org.omg.CORBA.ContainedHelper.narrow( defined_in ).absolute_name() + 53 "::" + name(); 54 } 55 catch( Exception e ) 56 { 57 this.logger.error("Caught Exception", e); } 59 60 if (this.logger.isDebugEnabled()) 61 { 62 this.logger.debug("New AliasDef name: " + name()); 63 } 64 } 65 66 public org.omg.CORBA.IDLType original_type_def() 67 { 68 if (original_type_def == null) 69 { 70 throw new INTF_REPOS ("Alias " + name () + " has null original_type_def" ); 71 } 72 return original_type_def; 73 } 74 75 public void original_type_def(org.omg.CORBA.IDLType arg) 76 { 77 original_type_def = arg; 78 } 79 80 public void define() 81 { 82 try 83 { 84 original_type_def( IDLType.create( type().content_type(), 85 containing_repository, 86 true, 87 this.logger, 88 this.poa) 89 ); 90 } 91 catch( Exception e ) 92 { 93 this.logger.error("Caught Exception", e); } 95 } 96 97 public org.omg.CORBA.ContainedPackage.Description describe() 98 { 99 org.omg.CORBA.Any a = orb.create_any(); 100 String containerId; 101 if( defined_in._is_a("IDL:omg.org/CORBA/Contained:1.0")) 102 containerId = org.omg.CORBA.ContainedHelper.narrow(defined_in).id(); 103 else 104 containerId = "IDL::1.0"; 106 org.omg.CORBA.TypeDescription td = 107 new org.omg.CORBA.TypeDescription ( name, 108 id(), 109 containerId, 110 version(), 111 type() ); 112 113 org.omg.CORBA.TypeDescriptionHelper.insert( a , td ); 114 115 org.omg.CORBA.ContainedPackage.Description result = 116 new org.omg.CORBA.ContainedPackage.Description( 117 org.omg.CORBA.DefinitionKind.dk_Alias, a ); 118 return result; 119 } 120 121 public void destroy() 122 {} 123 124 } 125 | Popular Tags |