1 22 package org.jboss.iiop.rmi.ir; 23 24 import org.omg.CORBA.Any ; 25 import org.omg.CORBA.TypeCode ; 26 import org.omg.CORBA.IRObject ; 27 import org.omg.CORBA.ContainedOperations ; 28 import org.omg.CORBA.ContainedPackage.Description; 29 import org.omg.CORBA.DefinitionKind ; 30 import org.omg.CORBA.IDLType ; 31 import org.omg.CORBA.IDLTypeHelper ; 32 import org.omg.CORBA.AttributeDef ; 33 import org.omg.CORBA.AttributeDefOperations ; 34 import org.omg.CORBA.AttributeMode ; 35 import org.omg.CORBA.AttributeDescription ; 36 import org.omg.CORBA.AttributeDescriptionHelper; 37 import org.omg.CORBA.AttributeDefPOATie; 38 import org.omg.CORBA.BAD_INV_ORDER ; 39 40 46 public class AttributeDefImpl 47 extends ContainedImpl 48 implements AttributeDefOperations 49 { 50 52 54 56 58 AttributeDefImpl(String id, String name, String version, 59 AttributeMode mode, TypeCode typeCode, 60 LocalContainer defined_in, RepositoryImpl repository) 61 { 62 super(id, name, version, defined_in, 63 DefinitionKind.dk_Attribute, repository); 64 65 this.mode = mode; 66 this.typeCode = typeCode; 67 } 68 69 71 72 74 public IRObject getReference() 75 { 76 if (ref == null) { 77 ref = org.omg.CORBA.AttributeDefHelper.narrow( 78 servantToReference(new AttributeDefPOATie(this)) ); 79 } 80 return ref; 81 } 82 83 public void allDone() 84 throws IRConstructionException 85 { 86 type_def = IDLTypeImpl.getIDLType(typeCode, repository); 88 89 getReference(); 90 } 91 92 93 95 public TypeCode type() 96 { 97 return typeCode; 98 } 99 100 public IDLType type_def() 101 { 102 return IDLTypeHelper.narrow(type_def.getReference()); 103 } 104 105 public void type_def(IDLType arg) 106 { 107 throw new BAD_INV_ORDER ("Cannot change RMI/IIOP mapping."); 108 } 109 110 public AttributeMode mode() 111 { 112 return mode; 113 } 114 115 public void mode(AttributeMode arg) 116 { 117 throw new BAD_INV_ORDER ("Cannot change RMI/IIOP mapping."); 118 } 119 120 121 123 public Description describe() 124 { 125 String defined_in_id = "IR"; 126 127 if (defined_in instanceof ContainedOperations ) 128 defined_in_id = ((ContainedOperations )defined_in).id(); 129 130 AttributeDescription d = 131 new AttributeDescription (name, id, defined_in_id, version, 132 typeCode, mode); 133 134 Any any = getORB().create_any(); 135 136 AttributeDescriptionHelper.insert(any, d); 137 138 return new Description(DefinitionKind.dk_Attribute, any); 139 } 140 141 143 145 147 149 152 private AttributeDef ref = null; 153 154 155 158 private AttributeMode mode; 159 160 163 private TypeCode typeCode; 164 165 168 private LocalIDLType type_def; 169 170 171 } 173 174 | Popular Tags |