try {
Principal subject = null;
if (principal != null) {
subject = new BasicPrincipal(principal, credentials);
}
Connection connection = _manager.getConnection(subject, uri);
result = connection.getLocalURI();
// @todo - closing the connection will work for now in that
// connection reference counts for OpenJMS will be correct. Won't
// support the case where a client exports an object to the server
// and then disposes its server proxies - the connection
// will be prematurely closed. The connection needs to be kept
// until the object is unexported.
connection.close();
} catch (ResourceException exception) {
throw new ExportException("Failed to connect to URI: " + uri,
exception);
}
return result;