if (handlesURI(uri)) {
ServerConnectionIdentifier hostInfo = null;
try {
hostInfo = parseURIForHostInfo(uri);
} catch(Exception ex) {
DeploymentManagerCreationException e = new DeploymentManagerCreationException(
xlocalStrings.getLocalString(
"enterprise.deployapi.spi.wronghostidentifier",
"Wrong host identifier in uri {0} ", new Object[] { uri }));
e.initCause(ex);
throw e;
}
try {
hostInfo.setUserName(username);
hostInfo.setPassword(password);
DeploymentManager answer = null;
answer = new SunDeploymentManager(hostInfo);
return answer;
} catch(Throwable t) {
DeploymentManagerCreationException e = new DeploymentManagerCreationException(xlocalStrings.getLocalString(
"enterprise.deployapi.spi.exceptionwhileconnecting", //NOI18N
"Exception while connecting to {0} : {1}", new Object[] { uri, t.getMessage() })); //NOI18N
e.initCause(t);
throw e;
}
} else {
return null;
}