1 26 27 package org.objectweb.ccm.IDL3; 28 29 37 38 public class ExceptionDeclImpl 39 extends ScopeImpl 40 implements ExceptionRef, ExceptionDecl 41 { 42 48 51 private org.omg.CORBA.ExceptionDef exception_def_; 52 53 56 private StructMembersImpl members_; 57 58 64 69 public 70 ExceptionDeclImpl(Repository rep, ScopeImpl parent) 71 { 72 super(rep, parent); 74 75 exception_def_ = null; 77 members_ = new StructMembersImpl(); 78 the_declaration_kind_ = DeclarationKind._dk_exception; 79 } 80 81 87 90 protected void 91 doCreation() 92 { 93 exception_def_ = the_parent_.getContainer().create_exception(getId(), getName(), getVersion(), 94 members_.getMemberDefs()); 95 super.create(); 96 } 97 98 104 109 protected void 110 load(org.omg.CORBA.Contained contained) 111 { 112 exception_def_ = org.omg.CORBA.ExceptionDefHelper.narrow(contained); 113 org.omg.CORBA.StructMember [] members = exception_def_.members(); 114 115 super.load(contained); 117 118 for (int i=0;i<members.length;i++) 119 { 120 members_.addMember(members[i].name, 121 getRepository().getAsTypeRef((members[i].type_def))); 122 } 123 } 124 125 130 protected void 131 loadAsMapping(org.omg.CORBA.Contained contained) 132 { 133 exception_def_ = org.omg.CORBA.ExceptionDefHelper.narrow(contained); 134 org.omg.CORBA.StructMember [] members = exception_def_.members(); 135 136 super.loadAsMapping(contained); 138 139 for (int i=0;i<members.length;i++) 140 members_.addMember(members[i].name, 141 getRepository().getAsMappedTypeRef((members[i].type_def))); 142 } 143 144 150 157 public String 158 declaratorAt(int index) 159 { 160 return members_.nameAt(index); 161 } 162 163 170 public Declaration[] 171 getDependencies() 172 { 173 if (dependencies_!=null) 174 return dependencies_; 175 176 org.objectweb.ccm.util.Vector exc_depend = new org.objectweb.ccm.util.Vector(); 178 Declaration[] depend = null; 179 TypeRef[] member_types = getMembers().getMemberTypes(); 180 181 for (int i=0;i<member_types.length;i++) 182 { 183 if (member_types[i].isDeclaration()) 184 { 185 if ((!containsDecl((Declaration)member_types[i])) && 186 (exc_depend.indexOf(member_types[i])==-1)) 187 exc_depend.add(member_types[i]); 188 } 189 190 depend = member_types[i].getDependencies(); 191 for (int j=0;j<depend.length;j++) 192 { 193 if ((exc_depend.indexOf(depend[j])==-1) && 194 (!containsDecl(depend[j]))) 195 exc_depend.add(depend[j]); 196 } 197 } 198 199 dependencies_ = (Declaration[])exc_depend.toArray(new Declaration[0]); 200 return dependencies_; 201 } 202 203 209 212 public void 213 create() 214 { 215 if(exception_def_ == null) 216 doCreation(); 217 else 218 exception_def_.members(members_.getMemberDefs()); 219 } 220 221 227 232 public org.omg.CORBA.ExceptionDef 233 getExceptionDef() 234 { 235 return exception_def_; 236 } 237 238 241 public int 242 getTypeKind() 243 { 244 return TypeKind._tk_exception; 245 } 246 247 253 258 public StructMembers 259 getMembers() 260 { 261 return members_; 262 } 263 264 270 276 protected org.omg.CORBA.Container 277 getContainer() 278 { 279 if(exception_def_ == null) 280 doCreation(); 281 282 return exception_def_; 283 } 284 285 291 294 public void 295 destroy() 296 { 297 members_.destroy(); 298 super.destroy(); 299 } 300 301 307 protected org.omg.CORBA.Contained 308 getContained() 309 { 310 if(exception_def_ == null) 311 doCreation(); 312 313 return exception_def_; 314 } 315 } 316 | Popular Tags |