hostDescriptor.setHostType(hostType);
return hostDescriptor;
}
public static HostDescription createHostDescription (HostDescriptor hostDescriptor){
HostDescription hostDescription = new HostDescription(HostDescriptionType.type);
hostDescription.getType().setHostAddress(hostDescriptor.getHostAddress());
hostDescription.getType().setHostName(hostDescriptor.getHostname());
if (hostDescriptor.getHostType() != null && !hostDescriptor.getHostType().isEmpty()) {
if (hostDescriptor.getHostType().get(0).equals(HostTypes.GLOBUS_HOST_TYPE)) {
hostDescription.getType().changeType(GlobusHostType.type);
if (!hostDescriptor.getGateKeeperEndPoint().isEmpty() && hostDescriptor.getGateKeeperEndPoint() != null){
((GlobusHostType) hostDescription.getType()).addGlobusGateKeeperEndPoint(hostDescriptor.getGateKeeperEndPoint().get(0));
}
if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){
((GlobusHostType) hostDescription.getType()).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0));
}
} else if (hostDescriptor.getHostType().get(0).equals(HostTypes.GSISSH_HOST_TYPE)) {
hostDescription.getType().changeType(GsisshHostType.type);
if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){
((GsisshHostType) hostDescription).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0));
}
} else if (hostDescriptor.getHostType().get(0).equals(HostTypes.EC2_HOST_TYPE)) {
hostDescription.getType().changeType(Ec2HostType.type);
if (!hostDescriptor.getImageID().isEmpty() && hostDescriptor.getImageID() != null ){
((Ec2HostType) hostDescription).addImageID(hostDescriptor.getImageID().get(0));
}
if (!hostDescriptor.getInstanceID().isEmpty() && hostDescriptor.getInstanceID() != null){
((Ec2HostType) hostDescription).addInstanceID(hostDescriptor.getInstanceID().get(0));
}
}else if (hostDescriptor.getHostType().get(0).equals(HostTypes.SSH_HOST_TYPE)) {
hostDescription.getType().changeType(SSHHostType.type);
} else if (hostDescriptor.getHostType().get(0).equals(HostTypes.UNICORE_HOST_TYPE)) {
hostDescription.getType().changeType(UnicoreHostType.type);
if (!hostDescriptor.getGateKeeperEndPoint().isEmpty() && hostDescriptor.getGateKeeperEndPoint() != null){
((UnicoreHostType) hostDescription.getType()).addUnicoreHostAddress(hostDescriptor.getGateKeeperEndPoint().get(0));
}
if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){
((UnicoreHostType) hostDescription.getType()).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0));
}
}
}
return hostDescription;