1 21 package org.jacorb.orb.etf; 22 23 import org.apache.avalon.framework.configuration.*; 24 25 import org.omg.ETF.*; 26 import org.omg.IOP.*; 27 import org.omg.RTCORBA.ProtocolProperties; 28 29 33 public abstract class FactoriesBase 34 extends org.omg.ETF._FactoriesLocalBase 35 implements Configurable 36 { 37 protected org.jacorb.config.Configuration configuration; 38 39 protected static Class connectionClz; 40 41 protected static Class listenerClz; 42 43 protected static Class profileClz; 44 45 public void configure(Configuration configuration) 46 throws ConfigurationException 47 { 48 this.configuration = (org.jacorb.config.Configuration)configuration; 49 } 50 51 54 public Connection create_connection(ProtocolProperties props) 55 { 56 Connection connection = null; 57 try 58 { 59 connection = (Connection)connectionClz.newInstance(); 60 } 61 catch (Exception ie) 62 { 63 throw new org.omg.CORBA.INTERNAL ("Cannot instantiate ETF::Connection class: " + ie.getMessage()); 64 } 65 try 66 { 67 if (connection instanceof Configurable) 68 { 69 ((Configurable)connection).configure(configuration); 70 } 71 } 72 catch( ConfigurationException ce ) 73 { 74 throw new org.omg.CORBA.INTERNAL ("ConfigurationException: " + ce.getMessage()); 75 } 76 return connection; 77 } 78 79 82 public Listener create_listener(ProtocolProperties props, 83 int stacksize, 84 short base_priority) 85 { 86 Listener listener = null; 87 try 88 { 89 listener = (Listener)listenerClz.newInstance(); 90 } 91 catch (Exception ie) 92 { 93 throw new org.omg.CORBA.INTERNAL ("Cannot instantiate ETF::Listener class: " + ie.getMessage()); 94 } 95 try 96 { 97 if (listener instanceof Configurable) 98 { 99 ((Configurable)listener).configure(configuration); 100 } 101 } 102 catch( ConfigurationException ce ) 103 { 104 throw new org.omg.CORBA.INTERNAL ("ConfigurationException: " + ce.getMessage()); 105 } 106 return listener; 107 } 108 109 public Profile demarshal_profile(TaggedProfileHolder tagged_profile, 110 TaggedComponentSeqHolder components) 111 { 112 ProfileBase profile = null; 113 try 114 { 115 profile = (ProfileBase)profileClz.newInstance(); 116 } 117 catch (Exception ie) 118 { 119 throw new org.omg.CORBA.INTERNAL ("Cannot instantiate ETF::Profile class: " + ie.getMessage()); 120 } 121 122 profile.demarshal(tagged_profile, components); 123 124 try 125 { 126 if (profile instanceof Configurable) 127 { 128 ((Configurable)profile).configure(configuration); 129 } 130 } 131 catch( ConfigurationException ce ) 132 { 133 throw new org.omg.CORBA.INTERNAL ("ConfigurationException: " + ce.getMessage()); 134 } 135 136 return profile; 137 } 138 139 public abstract Profile decode_corbaloc (String corbaloc); 140 } 141 | Popular Tags |