1 20 package org.jacorb.orb.etf; 21 22 import java.io.*; 23 24 import org.apache.avalon.framework.logger.Logger; 25 import org.apache.avalon.framework.configuration.*; 26 27 35 36 public abstract class ConnectionBase 37 extends org.omg.ETF._ConnectionLocalBase 38 implements Configurable 39 { 40 protected boolean connected = false; 41 42 47 protected ByteArrayOutputStream b_out = null; 48 49 54 protected int finalTimeout = 20000; 55 56 59 protected ProfileBase profile = null; 60 61 62 protected Logger logger; 63 protected org.jacorb.config.Configuration configuration; 64 protected String connection_info; 65 66 protected ConnectionBase() 67 { 68 } 69 70 74 protected ConnectionBase(ConnectionBase other) 75 { 76 this.b_out = other.b_out; 77 this.connection_info = other.connection_info; 78 this.finalTimeout = other.finalTimeout; 79 this.profile = other.profile; 80 } 81 82 public void configure(Configuration configuration) 83 throws ConfigurationException 84 { 85 this.configuration = (org.jacorb.config.Configuration)configuration; 86 logger = this.configuration.getNamedLogger( 87 this.configuration.getLoggerName(this.getClass())); 88 89 if( configuration.getAttribute("jacorb.debug.dump_outgoing_messages","off").equals("on")) 90 { 91 b_out = new ByteArrayOutputStream(); 92 } 93 94 finalTimeout = 95 configuration.getAttributeAsInteger("jacorb.connection.timeout_after_closeconnection", 96 20000 ); 97 } 98 99 protected abstract void setTimeout(int timeout); 100 101 protected abstract int getTimeout(); 102 103 public org.omg.ETF.Profile get_server_profile() 104 { 105 return profile; 106 } 107 108 public synchronized boolean is_connected() 109 { 110 return connected; 111 } 112 113 122 public void turnOnFinalTimeout() 123 { 124 setTimeout( finalTimeout ); 125 } 126 127 protected org.omg.CORBA.COMM_FAILURE to_COMM_FAILURE (IOException ex) 128 { 129 return new org.omg.CORBA.COMM_FAILURE ("IOException: " 130 + ex.toString()); 131 } 132 133 140 public boolean wait_next_data (long time_out) 141 { 142 throw new org.omg.CORBA.NO_IMPLEMENT (); 143 } 144 145 146 152 public boolean supports_callback() 153 { 154 return true; 155 } 156 157 165 public boolean use_handle_time_out() 166 { 167 return false; 170 } 171 } 172 173 | Popular Tags |