1 package org.jacorb.notification; 2 3 23 24 import org.jacorb.notification.container.CORBAObjectComponentAdapter; 25 import org.omg.CORBA.IntHolder ; 26 import org.omg.CORBA.ORB ; 27 import org.omg.CORBA.UserException ; 28 import org.omg.CosNotification.Property; 29 import org.omg.CosNotification.UnsupportedAdmin; 30 import org.omg.CosNotification.UnsupportedQoS; 31 import org.omg.CosNotifyChannelAdmin.ChannelNotFound; 32 import org.omg.CosNotifyChannelAdmin.EventChannel; 33 import org.omg.CosNotifyChannelAdmin.EventChannelFactory; 34 import org.omg.CosNotifyChannelAdmin.EventChannelFactoryHelper; 35 import org.omg.CosNotifyChannelAdmin.EventChannelHelper; 36 import org.omg.PortableServer.Servant ; 37 import org.picocontainer.ComponentAdapter; 38 import org.picocontainer.MutablePicoContainer; 39 import org.picocontainer.PicoContainer; 40 import org.picocontainer.defaults.CachingComponentAdapter; 41 42 56 57 public class EventChannelFactoryImpl extends AbstractChannelFactory implements 58 JacORBEventChannelFactoryOperations 59 { 60 62 protected String getShortcut() 63 { 64 return "NotificationService"; 65 } 66 67 protected String getObjectName() 68 { 69 return "_ECFactory"; 70 } 71 72 74 public EventChannelFactoryImpl(PicoContainer container, ORB orb) throws UserException 75 { 76 super(container, orb); 77 78 container_.registerComponent(new CORBAObjectComponentAdapter(EventChannelFactory.class, 79 EventChannelFactoryHelper.narrow(thisRef_))); 80 } 81 82 116 public EventChannel create_channel(Property[] qualitiyOfServiceProperties, 117 Property[] administrativeProperties, IntHolder channelIdentifier) 118 throws UnsupportedAdmin, UnsupportedQoS 119 { 120 try 121 { 122 AbstractEventChannel _channelServant = create_channel_servant(channelIdentifier, 123 qualitiyOfServiceProperties, administrativeProperties); 124 125 addToChannels(channelIdentifier.value, _channelServant); 126 127 return EventChannelHelper.narrow(_channelServant.activate()); 128 } catch (UnsupportedQoS e) 129 { 130 throw e; 131 } catch (UnsupportedAdmin e) 132 { 133 throw e; 134 } catch (Exception e) 135 { 136 logger_.fatalError("create_channel", e); 137 138 throw new RuntimeException (); 139 } 140 } 141 142 protected AbstractEventChannel newEventChannel() 143 { 144 final MutablePicoContainer _channelContainer = newContainerForChannel(); 145 146 ComponentAdapter _channelComponentAdapter = componentAdapterFactory_ 147 .createComponentAdapter(EventChannelImpl.class, EventChannelImpl.class, null); 148 149 _channelContainer.registerComponent(new CachingComponentAdapter(_channelComponentAdapter)); 150 151 EventChannelImpl channel = (EventChannelImpl) _channelContainer 152 .getComponentInstance(EventChannelImpl.class); 153 154 return channel; 155 } 156 157 164 public int[] get_all_channels() 165 { 166 return getAllChannels(); 167 } 168 169 184 public EventChannel get_event_channel(int id) throws ChannelNotFound 185 { 186 return EventChannelHelper.narrow(get_event_channel_servant(id).activate()); 187 } 188 189 public EventChannelFactory getEventChannelFactory() 190 { 191 return EventChannelFactoryHelper.narrow(thisRef_); 192 } 193 194 public Servant getServant() 195 { 196 return new JacORBEventChannelFactoryPOATie(this); 197 } 198 199 protected org.omg.CORBA.Object create_abstract_channel(Property[] admin, Property[] qos, 200 IntHolder id) throws UnsupportedAdmin, UnsupportedQoS 201 { 202 return create_channel(admin, qos, id); 203 } 204 } | Popular Tags |