1 21 22 package org.jacorb.notification.jmx; 23 24 import java.util.Properties ; 25 26 import org.jacorb.notification.AbstractChannelFactory; 27 import org.jacorb.notification.FilterFactoryImpl; 28 29 34 public class EventChannelFactoryControl implements EventChannelFactoryMBean 35 { 36 private AbstractChannelFactory factory_; 37 38 private final static String STARTED = "Started"; 39 40 private final static String RUNNING = "Already Running"; 41 42 private final static String NOT_RUNNING = "Not Running"; 43 44 private final static String STOPPED = "Stopped"; 45 46 private final static String IOR_DEFAULT = "IOR:0"; 47 48 private final static String CORBALOC_DEFAULT = "not running"; 49 50 public String start() 51 { 52 if (factory_ != null) 53 { 54 return RUNNING; 55 } 56 57 try 58 { 59 Properties props = new Properties (); 60 61 factory_ = AbstractChannelFactory.newFactory(props); 62 63 return STARTED; 64 } catch (Exception e) 65 { 66 throw new RuntimeException ("Start failed"); 67 } 68 } 69 70 public String stop() 71 { 72 if (factory_ != null) 73 { 74 factory_.dispose(); 75 factory_ = null; 76 77 return STOPPED; 78 } 79 return NOT_RUNNING; 80 } 81 82 public String getIOR() 83 { 84 return (factory_ != null) ? factory_.getIOR() : IOR_DEFAULT; 85 } 86 87 public String getCorbaloc() 88 { 89 return (factory_ != null) ? factory_.getCorbaLoc() : CORBALOC_DEFAULT; 90 } 91 } | Popular Tags |