1 22 package org.jboss.iiop.rmi.ir; 23 24 import org.omg.CORBA.ExceptionDefOperations ; 25 import org.omg.CORBA.ExceptionDefPOATie; 26 import org.omg.CORBA.Any ; 27 import org.omg.CORBA.TypeCode ; 28 import org.omg.CORBA.IRObject ; 29 import org.omg.CORBA.Contained ; 30 import org.omg.CORBA.ContainedOperations ; 31 import org.omg.CORBA.ContainedPackage.Description; 32 import org.omg.CORBA.IDLType ; 33 import org.omg.CORBA.IDLTypeHelper ; 34 import org.omg.CORBA.DefinitionKind ; 35 import org.omg.CORBA.StructMember ; 36 import org.omg.CORBA.UnionMember ; 37 import org.omg.CORBA.InterfaceDef ; 38 import org.omg.CORBA.ConstantDef ; 39 import org.omg.CORBA.EnumDef ; 40 import org.omg.CORBA.ValueDef ; 41 import org.omg.CORBA.ValueBoxDef ; 42 import org.omg.CORBA.Initializer ; 43 import org.omg.CORBA.StructDef ; 44 import org.omg.CORBA.UnionDef ; 45 import org.omg.CORBA.ExceptionDef ; 46 import org.omg.CORBA.AliasDef ; 47 import org.omg.CORBA.NativeDef ; 48 import org.omg.CORBA.ModuleDef ; 49 import org.omg.CORBA.ExceptionDescription ; 50 import org.omg.CORBA.ExceptionDescriptionHelper; 51 import org.omg.CORBA.BAD_INV_ORDER ; 52 53 59 class ExceptionDefImpl 60 extends ContainedImpl 61 implements ExceptionDefOperations , LocalContainer 62 { 63 65 67 69 71 ExceptionDefImpl(String id, String name, String version, 72 TypeCode typeCode, ValueDefImpl vDef, 73 LocalContainer defined_in, RepositoryImpl repository) 74 { 75 super(id, name, version, defined_in, 76 DefinitionKind.dk_Exception, repository); 77 78 this.delegate = new ContainerImplDelegate(this); 79 this.typeCode = typeCode; 80 this.vDef = vDef; 81 } 82 83 85 87 public LocalContained _lookup(String search_name) 88 { 89 return delegate._lookup(search_name); 90 } 91 92 public LocalContained[] _contents(DefinitionKind limit_type, 93 boolean exclude_inherited) 94 { 95 return delegate._contents(limit_type, exclude_inherited); 96 } 97 98 public LocalContained[] _lookup_name(String search_name, 99 int levels_to_search, 100 DefinitionKind limit_type, 101 boolean exclude_inherited) 102 { 103 return delegate._lookup_name(search_name, levels_to_search, limit_type, 104 exclude_inherited); 105 } 106 107 public void add(String name, LocalContained contained) 108 throws IRConstructionException 109 { 110 throw new RuntimeException ("Should never reach this point."); 111 } 113 114 116 public Contained lookup(String search_name) 117 { 118 return delegate.lookup(search_name); 119 } 120 121 public Contained [] contents(DefinitionKind limit_type, 122 boolean exclude_inherited) 123 { 124 return delegate.contents(limit_type, exclude_inherited); 125 } 126 127 public Contained [] lookup_name(String search_name, int levels_to_search, 128 DefinitionKind limit_type, 129 boolean exclude_inherited) 130 { 131 return delegate.lookup_name(search_name, levels_to_search, limit_type, 132 exclude_inherited); 133 } 134 135 public org.omg.CORBA.ContainerPackage.Description[] 136 describe_contents(DefinitionKind limit_type, 137 boolean exclude_inherited, 138 int max_returned_objs) 139 { 140 return delegate.describe_contents(limit_type, exclude_inherited, 141 max_returned_objs); 142 } 143 144 public ModuleDef create_module(String id, String name, String version) 145 { 146 return delegate.create_module(id, name, version); 147 } 148 149 public ConstantDef create_constant(String id, String name, String version, 150 IDLType type, Any value) 151 { 152 return delegate.create_constant(id, name, version, type, value); 153 } 154 155 public StructDef create_struct(String id, String name, String version, 156 StructMember [] members) 157 { 158 return delegate.create_struct(id, name, version, members); 159 } 160 161 public UnionDef create_union(String id, String name, String version, 162 IDLType discriminator_type, 163 UnionMember [] members) 164 { 165 return delegate.create_union(id, name, version, discriminator_type, 166 members); 167 } 168 169 public EnumDef create_enum(String id, String name, String version, 170 String [] members) 171 { 172 return delegate.create_enum(id, name, version, members); 173 } 174 175 public AliasDef create_alias(String id, String name, String version, 176 IDLType original_type) 177 { 178 return delegate.create_alias(id, name, version, original_type); 179 } 180 181 public InterfaceDef create_interface(String id, String name, String version, 182 InterfaceDef [] base_interfaces, 183 boolean is_abstract) 184 { 185 return delegate.create_interface(id, name, version, 186 base_interfaces, is_abstract); 187 } 188 189 public ValueDef create_value(String id, String name, String version, 190 boolean is_custom, boolean is_abstract, 191 ValueDef base_value, boolean is_truncatable, 192 ValueDef [] abstract_base_values, 193 InterfaceDef [] supported_interfaces, 194 Initializer [] initializers) 195 { 196 return delegate.create_value(id, name, version, is_custom, is_abstract, 197 base_value, is_truncatable, 198 abstract_base_values, supported_interfaces, 199 initializers); 200 } 201 202 public ValueBoxDef create_value_box(String id, String name, String version, 203 IDLType original_type_def) 204 { 205 return delegate.create_value_box(id, name, version, original_type_def); 206 } 207 208 public ExceptionDef create_exception(String id, String name, String version, 209 StructMember [] members) 210 { 211 return delegate.create_exception(id, name, version, members); 212 } 213 214 public NativeDef create_native(String id, String name, String version) 215 { 216 return delegate.create_native(id, name, version); 217 } 218 219 221 public IRObject getReference() 222 { 223 if (ref == null) { 224 ref = org.omg.CORBA.ExceptionDefHelper.narrow( 225 servantToReference(new ExceptionDefPOATie(this)) ); 226 } 227 return ref; 228 } 229 230 public void allDone() 231 throws IRConstructionException 232 { 233 getReference(); 234 delegate.allDone(); 235 } 236 237 239 public Description describe() 240 { 241 String defined_in_id = "IR"; 242 243 if (defined_in instanceof ContainedOperations ) 244 defined_in_id = ((ContainedOperations )defined_in).id(); 245 246 ExceptionDescription ed = new ExceptionDescription (name, id, 247 defined_in_id, 248 version, type()); 249 250 Any any = getORB().create_any(); 251 252 ExceptionDescriptionHelper.insert(any, ed); 253 254 return new Description(DefinitionKind.dk_Exception, any); 255 } 256 257 258 260 public TypeCode type() { 261 return typeCode; 262 } 263 264 public StructMember [] members() 265 { 266 if (members == null) { 267 TypeCode type = vDef.type(); 268 LocalIDLType localTypeDef = IDLTypeImpl.getIDLType(type, repository); 269 IDLType type_def = IDLTypeHelper.narrow(localTypeDef.getReference()); 270 271 members = new StructMember [1]; 272 members[0] = new StructMember ("value", type, type_def); 273 } 274 return members; 275 } 276 277 public void members(StructMember [] arg) 278 { 279 throw new BAD_INV_ORDER ("Cannot change RMI/IIOP mapping."); 280 } 281 282 284 286 288 291 private ContainerImplDelegate delegate; 292 293 296 private ExceptionDef ref = null; 297 298 301 private TypeCode typeCode; 302 303 306 ValueDefImpl vDef; 307 308 311 private StructMember [] members; 312 313 } 315 316 | Popular Tags |