1 22 package org.jboss.iiop.rmi.ir; 23 24 import org.omg.CORBA.ContainedPackage.Description; 25 import org.omg.CORBA.DefinitionKind ; 26 import org.omg.CORBA.Container ; 27 import org.omg.CORBA.ContainerHelper; 28 import org.omg.CORBA.Repository ; 29 import org.omg.CORBA.RepositoryHelper; 30 import org.omg.CORBA.BAD_INV_ORDER ; 31 32 import java.io.UnsupportedEncodingException ; 33 34 35 41 abstract class ContainedImpl 42 extends IRObjectImpl 43 implements LocalContained 44 { 45 47 49 51 private static final org.jboss.logging.Logger logger = 52 org.jboss.logging.Logger.getLogger(ContainedImpl.class); 53 54 56 ContainedImpl(String id, String name, String version, 57 LocalContainer defined_in, 58 DefinitionKind def_kind, RepositoryImpl repository) 59 { 60 super(def_kind, repository); 61 this.id = id; 62 this.name = name; 63 this.version = version; 64 this.defined_in = defined_in; 65 66 if (defined_in instanceof LocalContained) 67 this.absolute_name = ((LocalContained)defined_in).absolute_name() + 68 "::" + name; 69 else this.absolute_name = "::" + name; 71 } 72 73 75 77 public java.lang.String id() 78 { 79 logger.trace("ContainedImpl[" + id + "].id() entered."); 80 return id; 81 } 82 83 public void id(java.lang.String id) 84 { 85 throw new BAD_INV_ORDER ("Cannot change RMI/IIOP mapping."); 86 } 87 88 public java.lang.String name() 89 { 90 logger.trace("ContainedImpl[" + id + "].name() entered."); 91 return name; 92 } 93 94 public void name(java.lang.String name) 95 { 96 throw new BAD_INV_ORDER ("Cannot change RMI/IIOP mapping."); 97 } 98 99 public java.lang.String version() 100 { 101 logger.trace("ContainedImpl[" + id + "].version() entered."); 102 return version; 103 } 104 105 public void version(java.lang.String version) 106 { 107 throw new BAD_INV_ORDER ("Cannot change RMI/IIOP mapping."); 108 } 109 110 public Container defined_in() 111 { 112 logger.debug("ContainedImpl[" + id + "].defined_in() entered."); 113 return ContainerHelper.narrow(defined_in.getReference()); 114 } 115 116 public java.lang.String absolute_name() 117 { 118 logger.trace("ContainedImpl[" + id + "].absolute_name() returning \"" + 119 absolute_name + "\"."); 120 return absolute_name; 121 } 122 123 public Repository containing_repository() 124 { 125 logger.debug("ContainedImpl[" + id + 126 "].containing_repository() entered."); 127 return RepositoryHelper.narrow(repository.getReference()); 128 } 129 130 public abstract Description describe(); 131 132 public void move(Container new_container, 133 String new_name, String new_version) 134 { 135 throw new BAD_INV_ORDER ("Cannot change RMI/IIOP mapping."); 136 } 137 138 140 142 144 147 protected String id; 148 149 152 protected String name; 153 154 157 protected String version = "1.0"; 158 159 163 protected LocalContainer defined_in; 164 165 168 protected String absolute_name; 169 170 171 176 protected byte[] getObjectId() 177 { 178 try { 179 return (getRepository().getObjectIdPrefix() + id).getBytes("UTF-8"); 180 } catch (UnsupportedEncodingException ex) { 181 throw new RuntimeException ("UTF-8 encoding not supported."); 182 } 183 } 184 185 187 } 189 | Popular Tags |