}
public DeploymentManager getDeploymentManager(String uri, String username, String password) throws DeploymentManagerCreationException {
URI protocolUri = getProtocolUri(uri);
if (protocolUri == null) {
throw new DeploymentManagerCreationException("Invalid URI: " + uri);
}
try {
Deployment deployment = factory.createDeployment(protocolUri, username, password);
return new OpenEJBDeploymentManager(deployment);
} catch (RuntimeException e) {
// some DeploymentManagerFactories suppress unchecked exceptions - log and rethrow
DeploymentManagerCreationException creationException = new DeploymentManagerCreationException("Unexpected exception while creating deployment manager");
creationException.initCause(e);
throw creationException;
} catch (AssertionError e) {
// some DeploymentManagerFactories suppress unchecked exceptions - log and rethrow
DeploymentManagerCreationException creationException = new DeploymentManagerCreationException("Assertion error while creating deployment manager");
creationException.initCause(e);
throw creationException;
}
}