1 45 package org.exolab.jms.client.net; 46 47 import java.rmi.RemoteException ; 48 import javax.jms.InvalidClientIDException ; 49 import javax.jms.JMSException ; 50 51 import org.exolab.jms.net.orb.ORB; 52 import org.exolab.jms.server.ServerConnection; 53 import org.exolab.jms.server.ServerSession; 54 55 56 62 public class JmsConnectionStubImpl 63 implements ServerConnection { 64 65 68 private JmsServerStubImpl _server; 69 70 73 private ServerConnection _connection; 74 75 78 private final ORB _orb; 79 80 83 private final String _uri; 84 85 88 private final String _principal; 89 90 93 private final String _credentials; 94 95 96 106 public JmsConnectionStubImpl(JmsServerStubImpl server, 107 ServerConnection connection, 108 ORB orb, String uri, String principal, 109 String credentials) { 110 if (server == null) { 111 throw new IllegalArgumentException ("Argument 'server' is null"); 112 } 113 if (connection == null) { 114 throw new IllegalArgumentException ("Argument 'connection' is null"); 115 } 116 _server = server; 117 _connection = connection; 118 _orb = orb; 119 _uri = uri; 120 _principal = principal; 121 _credentials = credentials; 122 } 123 124 130 public long getConnectionId() throws JMSException { 131 return _connection.getConnectionId(); 132 } 133 134 140 public String getClientID() throws JMSException { 141 return _connection.getClientID(); 142 } 143 144 158 public void setClientID(String clientID) throws JMSException { 159 _connection.setClientID(clientID); 160 } 161 162 175 public ServerSession createSession(int acknowledgeMode, boolean transacted) 176 throws JMSException { 177 JmsSessionStubImpl result = null; 178 try { 179 ServerSession session = _connection.createSession(acknowledgeMode, 180 transacted); 181 result = new JmsSessionStubImpl(session, _orb, _uri, _principal, 182 _credentials); 183 } catch (RemoteException exception) { 184 throw new JMSException ("Failed to create session: " + exception); 186 } 187 188 return result; 189 } 190 191 196 public void close() throws JMSException { 197 try { 198 _connection.close(); 199 } finally { 200 _connection = null; 201 } 202 } 203 204 205 } 206 | Popular Tags |