1 package org.jacorb.notification; 2 3 22 23 import org.apache.avalon.framework.configuration.ConfigurationException; 24 import org.jacorb.notification.container.CORBAObjectComponentAdapter; 25 import org.jacorb.notification.servant.ITypedEventChannel; 26 import org.omg.CORBA.IntHolder ; 27 import org.omg.CORBA.ORB ; 28 import org.omg.CORBA.UserException ; 29 import org.omg.CosNotification.Property; 30 import org.omg.CosNotification.UnsupportedAdmin; 31 import org.omg.CosNotification.UnsupportedQoS; 32 import org.omg.CosNotifyChannelAdmin.ChannelNotFound; 33 import org.omg.CosTypedNotifyChannelAdmin.TypedEventChannel; 34 import org.omg.CosTypedNotifyChannelAdmin.TypedEventChannelFactory; 35 import org.omg.CosTypedNotifyChannelAdmin.TypedEventChannelFactoryHelper; 36 import org.omg.CosTypedNotifyChannelAdmin.TypedEventChannelFactoryOperations; 37 import org.omg.CosTypedNotifyChannelAdmin.TypedEventChannelFactoryPOATie; 38 import org.omg.CosTypedNotifyChannelAdmin.TypedEventChannelHelper; 39 import org.omg.PortableServer.Servant ; 40 import org.picocontainer.ComponentAdapter; 41 import org.picocontainer.MutablePicoContainer; 42 import org.picocontainer.PicoContainer; 43 import org.picocontainer.defaults.CachingComponentAdapter; 44 45 49 50 public class TypedEventChannelFactoryImpl extends AbstractChannelFactory implements 51 TypedEventChannelFactoryOperations 52 { 53 public TypedEventChannelFactoryImpl(PicoContainer container, ORB orb) throws UserException 54 { 55 super(container, orb); 56 57 container_.registerComponent(new CORBAObjectComponentAdapter( 58 TypedEventChannelFactory.class, TypedEventChannelFactoryHelper.narrow(thisRef_))); 59 } 60 61 public TypedEventChannel create_typed_channel(Property[] qosProps, Property[] adminProps, 62 IntHolder intHolder) throws UnsupportedAdmin, UnsupportedQoS 63 { 64 try 65 { 66 AbstractEventChannel _channel = create_channel_servant(intHolder, qosProps, adminProps); 67 68 addToChannels(intHolder.value, _channel); 69 70 return TypedEventChannelHelper.narrow(_channel.activate()); 71 } catch (ConfigurationException e) 72 { 73 logger_.fatalError("error creating typed channel", e); 74 75 throw new org.omg.CORBA.INTERNAL (); 76 } 77 } 78 79 protected AbstractEventChannel newEventChannel() 80 { 81 final MutablePicoContainer _container = newContainerForChannel(); 82 83 ComponentAdapter typedChannelComponentAdapter = componentAdapterFactory_ 84 .createComponentAdapter(ITypedEventChannel.class, TypedEventChannelImpl.class, null); 85 86 _container.registerComponent(new CachingComponentAdapter(typedChannelComponentAdapter)); 87 88 return (AbstractEventChannel) _container.getComponentInstance(ITypedEventChannel.class); 89 } 90 91 public int[] get_all_typed_channels() 92 { 93 return getAllChannels(); 94 } 95 96 public TypedEventChannel get_typed_event_channel(int id) throws ChannelNotFound 97 { 98 return TypedEventChannelHelper.narrow(get_event_channel_servant(id)); 99 } 100 101 public Servant getServant() 102 { 103 return new TypedEventChannelFactoryPOATie(this); 104 } 105 106 public String getObjectName() 107 { 108 return "_ECFactory"; 109 } 110 111 protected String getShortcut() 112 { 113 return "NotificationService"; 114 } 115 116 protected org.omg.CORBA.Object create_abstract_channel(Property[] admin, Property[] qos, 117 IntHolder id) throws UnsupportedQoS, UnsupportedAdmin 118 { 119 return create_typed_channel(admin, qos, id); 120 } 121 } | Popular Tags |