1 26 27 package org.objectweb.ccm.runtime.cif.lib; 28 29 import org.omg.Components.ExecutorSegmentBase; 30 31 import org.objectweb.ccm.runtime.cif.api.SegmentHome; 32 33 import java.util.HashMap ; 34 35 45 46 public abstract class ComponentSegmentBase 47 extends org.objectweb.corba.util.LocalObjectBase 48 implements org.objectweb.ccm.runtime.cif.api.ComponentSegment, 49 org.objectweb.ccm.runtime.cif.api.Segment 50 { 51 57 60 ExecutorSegmentBase[] executor_segments_; 61 62 63 SegmentHome segment_home_; 64 65 71 72 public 73 ComponentSegmentBase() 74 { 75 executor_segments_ = null; 77 segment_home_ = null; 78 } 79 80 86 92 97 public void 98 set_main_segment(org.objectweb.ccm.runtime.cif.api.ComponentSegment seg) 99 { 100 } 102 103 109 118 public void 119 set_nb_segments(int nb_segments) 120 { 121 executor_segments_ = new ExecutorSegmentBase[nb_segments]; 123 124 executor_segments_[0] = this; 126 } 127 128 133 public void 134 set_segment_home(SegmentHome sh) 135 { 136 segment_home_ = sh; 137 } 138 139 149 public ExecutorSegmentBase 150 get_executor_segment(int segid) 151 { 152 ExecutorSegmentBase result = executor_segments_[segid]; 154 155 if(result == null) 157 { 158 result = segment_home_.create_executor_segment(segid); 160 ((org.objectweb.ccm.runtime.cif.api.Segment)result).set_main_segment(this); 161 162 executor_segments_[segid] = result; 164 } 165 166 return result; 168 } 169 170 178 abstract public java.util.HashMap 179 get_segmentation_table(); 180 181 187 199 public void 200 configuration_complete() 201 throws org.omg.Components.InvalidConfiguration 202 { 203 getLogger().trace(this, 204 "Completing configuration: Do nothing by default"); 205 206 } 208 209 215 227 public org.omg.CORBA.Object 228 obtain_executor(java.lang.String name) 229 throws org.omg.Components.CCMException 230 { 231 getLogger().trace(this, "Obtaining executor " + name); 232 233 HashMap segmentation_table = get_segmentation_table(); 235 236 Integer segid = (Integer )segmentation_table.get(name); 238 239 if(segid == null) 241 { 242 getLogger().error(this, 243 "No executor segment associated to facet " + name); 244 245 throw new org.omg.Components.CCMException(); 246 } 247 248 return get_executor_segment(segid.intValue()); 250 } 251 252 262 public void 263 release_executor(org.omg.CORBA.Object executor) 264 throws org.omg.Components.CCMException 265 { 266 getLogger().trace(this, "Releasing executor " + executor + 267 ": Do nothing by default"); 268 269 } 271 } 272 | Popular Tags |