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.ConstantDef ; 33 import org.omg.CORBA.ConstantDefOperations ; 34 import org.omg.CORBA.ConstantDescription ; 35 import org.omg.CORBA.ConstantDescriptionHelper; 36 import org.omg.CORBA.ConstantDefPOATie; 37 import org.omg.CORBA.BAD_INV_ORDER ; 38 39 45 public class ConstantDefImpl 46 extends ContainedImpl 47 implements ConstantDefOperations 48 { 49 51 53 55 private static final org.jboss.logging.Logger logger = 56 org.jboss.logging.Logger.getLogger(ConstantDefImpl.class); 57 58 60 ConstantDefImpl(String id, String name, String version, 61 TypeCode typeCode, Any value, 62 LocalContainer defined_in, RepositoryImpl repository) 63 { 64 super(id, name, version, defined_in, 65 DefinitionKind.dk_Constant, repository); 66 67 this.typeCode = typeCode; 68 this.value = value; 69 } 70 71 73 74 76 public IRObject getReference() 77 { 78 if (ref == null) { 79 ref = org.omg.CORBA.ConstantDefHelper.narrow( 80 servantToReference(new ConstantDefPOATie(this)) ); 81 } 82 return ref; 83 } 84 85 public void allDone() 86 throws IRConstructionException 87 { 88 type_def = IDLTypeImpl.getIDLType(typeCode, repository); 90 if (type_def == null) 91 logger.debug("Got type_def: [NULL]"); 92 else 93 logger.debug("Got type_def: [" + type_def.toString() + "]"); 94 95 getReference(); 96 } 97 98 99 101 public TypeCode type() 102 { 103 logger.debug("ConstantDefImpl.type(): entered."); 104 return typeCode; 105 } 106 107 public IDLType type_def() 108 { 109 logger.debug("ConstantDefImpl.type_def(): entered."); 110 try { 111 return IDLTypeHelper.narrow(type_def.getReference()); 112 } finally { 113 logger.debug("ConstantDefImpl.type_def(): returning."); 114 } 115 } 116 117 public void type_def(IDLType arg) 118 { 119 throw new BAD_INV_ORDER ("Cannot change RMI/IIOP mapping."); 120 } 121 122 public Any value() 123 { 124 logger.debug("ConstantDefImpl.value(): entered."); 125 return value; 126 } 127 128 public void value(Any arg) 129 { 130 throw new BAD_INV_ORDER ("Cannot change RMI/IIOP mapping."); 131 } 132 133 134 136 public Description describe() 137 { 138 logger.debug("ConstantDefImpl.describe(): entered."); 139 String defined_in_id = "IR"; 140 141 if (defined_in instanceof ContainedOperations ) 142 defined_in_id = ((ContainedOperations )defined_in).id(); 143 144 ConstantDescription d = 145 new ConstantDescription (name, id, defined_in_id, version, 146 typeCode, value); 147 148 Any any = getORB().create_any(); 149 150 ConstantDescriptionHelper.insert(any, d); 151 152 return new Description(DefinitionKind.dk_Constant, any); 153 } 154 155 157 159 161 163 166 private ConstantDef ref = null; 167 168 169 172 private TypeCode typeCode; 173 174 177 private LocalIDLType type_def; 178 179 182 private Any value; 183 184 185 } 187 | Popular Tags |