1 28 29 package org.objectweb.openccm.Containers.MetaInformation; 30 31 import org.omg.Components.CCMHome; 32 33 36 public class HomeInstanceImpl 37 extends InstanceImpl 38 implements HomeInstance { 39 40 protected HomeType _home_type; 41 protected ComponentInstanceList _component_instances; 42 protected CCMHome _home_ref; 43 protected String _home_instance_factory_entrypt; 44 protected OperationInstanceList _operation_instance_list; 45 protected InterfaceInstance _equivalent_interface; 46 47 public HomeInstanceImpl() 48 { 49 _home_instance_factory_entrypt = null; 50 _component_instances = new ComponentInstanceListImpl(); 51 _equivalent_interface = null; 52 _home_ref = null; 53 _home_type = null; 54 _operation_instance_list = new OperationInstanceListImpl(); 55 } 56 57 60 public CCMHome home_ref() 61 { 62 return _home_ref; 63 } 64 67 public void home_ref(CCMHome value) 68 { 69 _home_ref = value; 70 } 71 74 public String home_instance_factory_entrypt() 75 { 76 return _home_instance_factory_entrypt; 77 } 78 81 public void home_instance_factory_entrypt(String value) 82 { 83 _home_instance_factory_entrypt = value; 84 } 85 86 public ComponentInstanceList component_instance_list() 87 { 88 return _component_instances; 89 } 90 93 public void component_instance_list(ComponentInstanceList value) 94 { 95 _component_instances = value; 96 } 97 100 public InterfaceInstance equivalent_interface() 101 { 102 return _equivalent_interface; 103 } 104 107 public void equivalent_interface(InterfaceInstance value) 108 { 109 _equivalent_interface = value; 110 } 111 114 public OperationInstanceList operation_instance_list() 115 { 116 return _operation_instance_list; 117 } 118 121 public void operation_instance_list(OperationInstanceList value) 122 { 123 _operation_instance_list = value; 124 } 125 128 public ComponentInstance create_component_instance() 129 { 130 ComponentInstance result = new ComponentInstanceImpl(); 131 ComponentType _ctype; 132 HomeType _htype; 133 try 135 { 136 _htype = (HomeType) this.type_reference(); 137 } 138 catch (ClassCastException e) 139 { 140 System.err.println("Cannot convert type -> home type !!!"); 141 return null; 142 } 143 try 145 { 146 _ctype = (ComponentType) _htype.type_reference(); 147 } 148 catch (ClassCastException e) 149 { 150 System.err.println("Cannot convert type -> component type !!!"); 151 return null; 152 } 153 154 157 result.related_instance_kind(instance_kind.HOME_INSTANCE); 158 result.instance_reference(this); 159 result.type_reference(_ctype); 160 161 163 AttributeType[] _catts = _ctype.attribute_type_list().get_all_attribute_types(); 164 if (_catts.length != 0) 165 { 166 AttributeInstanceImpl _cints; 167 168 for (int i = 0; i < _catts.length; i++) 169 { 170 _cints = new AttributeInstanceImpl(); 171 _cints.type_reference(_catts[i]); 172 _cints.related_instance_kind(instance_kind.COMPONENT_INSTANCE); 173 _cints.instance_reference(this); 174 _cints.object_ref(null); 175 result.attribute_instance_list().add_attribute_instance(_cints); 176 } 177 } 178 180 InterfaceType[] _sit = 181 _ctype.supported_interfaces().get_all_interface_types(); 182 if (_sit.length != 0) 183 { 184 InterfaceInstance _sii; 185 for (int i = 0; i < _sit.length; i++) 186 { 187 _sii = create_interface_instance(_sit[i]); 188 _sii.related_instance_kind(instance_kind.COMPONENT_INSTANCE); 189 _sii.instance_reference(this); 190 _sii.object_ref(null); 191 result.supported_interface().add_interface_instance( 192 create_interface_instance(_sit[i])); 193 } 194 } 195 197 InterfaceInstance _eii = 198 create_interface_instance(_ctype.equivalent_interface()); 199 _eii.related_instance_kind(instance_kind.COMPONENT_INSTANCE); 200 _eii.instance_reference(this); 201 result.equivalent_interface(_eii); 202 203 204 206 this.component_instance_list().add_component_instance(result); 207 208 return result; 209 } 210 211 212 private InterfaceInstance create_interface_instance(InterfaceType it) 213 { 214 216 InterfaceInstance result = new InterfaceInstanceImpl(); 217 OperationInstance tmp_opi; 218 result.type_reference(it); 219 OperationType[] tmp_ops = it.operation_type_list().get_all_operation_types(); 220 for (int i = 0; i < tmp_ops.length; i++) 221 { 222 tmp_opi = new OperationInstanceImpl(); 223 tmp_opi.related_instance_kind(instance_kind.INTERFACE_INSTANCE); 224 tmp_opi.type_reference(tmp_ops[i]); 225 tmp_opi.instance_reference(result); 226 tmp_opi.object_ref(null); 227 result.operation_instance_list().add_operation_instance(tmp_opi); 228 } 229 return result; 230 } 231 232 } 233 | Popular Tags |