1 26 27 package org.objectweb.ccm.chat.monolithic; 28 29 import org.objectweb.ccm.chat.*; 30 31 42 43 public class ServerImpl 44 extends org.omg.CORBA.LocalObject 45 implements CCM_Server, 46 CCM_Service, 47 org.omg.Components.SessionComponent 48 { 49 55 56 private String name_; 57 58 59 private java.awt.Frame frame_; 60 61 private java.awt.TextArea textArea_; 62 63 64 private CCM_Server_Context the_context_; 65 66 72 73 public 74 ServerImpl() 75 { 76 } 77 78 84 90 96 102 public void 103 configuration_complete() 104 throws org.omg.Components.InvalidConfiguration 105 { 106 if(name_ == null) 108 throw new org.omg.Components.InvalidConfiguration(); 109 110 System.out.println("================================"); 111 System.out.println("Welcome to OpenCCM's Chat server"); 112 System.out.println("================================"); 113 } 114 115 121 128 public void 129 set_session_context(org.omg.Components.SessionContext context) 130 throws org.omg.Components.CCMException 131 { 132 the_context_ = (CCM_Server_Context)context; 133 } 134 135 140 public void 141 ccm_activate() 142 throws org.omg.Components.CCMException 143 { 144 } 146 147 152 public void 153 ccm_passivate() 154 throws org.omg.Components.CCMException 155 { 156 } 158 159 164 public void 165 ccm_remove() 166 throws org.omg.Components.CCMException 167 { 168 frame_.dispose(); 170 frame_ = null; 171 } 172 173 179 184 public void 185 name(String n) 186 { 187 name_ = n; 188 189 if (frame_ != null) 190 frame_.setTitle(name_ + "'s Server GUI"); 191 } 192 193 198 public String 199 name() 200 { 201 return name_; 202 } 203 204 210 216 public CCM_Service 217 get_the_service() 218 { 219 return this; 221 } 222 223 229 234 public void 235 display(String text) 236 { 237 System.out.println(text); 240 the_context_.push_to_consumers( new TextEventImpl(text) ); 242 } 243 } 244 245 | Popular Tags |