Fields Summary |
---|
private static com.sun.enterprise.util.LocalStringManagerImpl | xlocalStrings |
private static String | DMGR_NOT_CONNECTED |
private static final String | PE_BETA_URISTRING |
private static final String | DEFAULT_URISTRING |
private static final String | HTTPS |
private static final String | URI_SEPARATOR |
private static final String | LOCAL_HOST |
private static final int | HOST_PORT |
private static final String[] | supportedURIs |
private static Hashtable | connectedDeploymentManagers |
private static Hashtable | disconnectedDeploymentManagers |
private static final String | HTTPS_PROTOCOL |
private static final String | HTTP_PROTOCOL |
Methods Summary |
---|
public javax.enterprise.deploy.spi.DeploymentManager | getDeploymentManager(java.lang.String uri, java.lang.String username, java.lang.String password)Return a connected DeploymentManager instance.
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;
}
|
public javax.enterprise.deploy.spi.DeploymentManager | getDisconnectedDeploymentManager(java.lang.String uri)Return a disconnected DeploymentManager instance.
if (handlesURI(uri)) {
return new SunDeploymentManager();
} else {
return null;
}
|
public java.lang.String | getDisplayName()Provide a string with the name of this vendor's DeploymentManager.
return xlocalStrings.getLocalString(
"enterprise.deployapi.spi.DisplayName",
"Sun Java System Application Server");
|
public java.lang.String | getProductVersion()Provide a string identifying version of this vendor's
DeploymentManager.
return xlocalStrings.getLocalString(
"enterprise.deployapi.spi.ProductVersion", "9.0");
|
public boolean | handlesURI(java.lang.String uri)Tests whether this factory can create a DeploymentManager
object based on the specificed URI. This does not indicate
whether such an attempt will be successful, only whether the
factory can handle the uri.
if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) {
DOLUtils.getDefaultLogger().fine("handlesURI: URI ["+uri+"]");// NOI18N
}
if (uri != null) {
try {
return (parseURIForHostInfo(uri)!=null);
} catch (Exception ex) {
DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.deplyomentManagerLoadFailure", // NOI18N
new Object[] {uri});
}
}
return false;
|
public com.sun.enterprise.deployment.client.ServerConnectionIdentifier | parseURIForHostInfo(java.lang.String uri)
String targetURI = null;
for (int i=0;i<supportedURIs.length;i++) {
if (uri.indexOf(supportedURIs[i])==0) {
targetURI = supportedURIs[i];
}
}
//if the URI does not contain DEFAULT_URISTRINNG or PE_BETA_URISTRING,
//then the URI is not valid.
if (targetURI == null) {
throw new Exception(xlocalStrings.getLocalString(
"enterprise.deployapi.spi.invaliduri", // NOI18N
"Invalid URI")); // NOI18N
}
ServerConnectionIdentifier sci = new ServerConnectionIdentifier();
if(uri.length() == targetURI.length()) {
sci.setHostName(LOCAL_HOST);
sci.setHostPort(HOST_PORT);
} else {
String reminder = uri.substring(targetURI.length());
String[] splitted = reminder.split(URI_SEPARATOR);
if (splitted.length<2) {
throw new Exception(xlocalStrings.getLocalString(
"enterprise.deployapi.spi.invaliduri", // NOI18N
"Invalid URI")); // NOI18N
}
if ("".equals(splitted[0])) {
sci.setHostName(LOCAL_HOST);
} else {
sci.setHostName(splitted[0]);
}
if ("".equals(splitted[1])) {
sci.setHostPort(HOST_PORT);
} else {
sci.setHostPort(Integer.parseInt(splitted[1]));
}
if (splitted.length>2) {
if (HTTPS.equals(splitted[2])) {
sci.setSecure(true);
}
}
}
return sci;
|