List<String> gridFTPEndPoint = new ArrayList<String>();
List<String> gateKeeperEndPoint = new ArrayList<String>();
List<String> imageID = new ArrayList<String>();
List<String> instanceID = new ArrayList<String>();
HostDescriptor hostDescriptor = new HostDescriptor();
hostDescriptor.setHostname(hostDescription.getType().getHostName());
hostDescriptor.setHostAddress(hostDescription.getType().getHostAddress());
HostDescriptionType hostDescriptionType = hostDescription.getType();
if (hostDescriptionType instanceof GlobusHostType){
GlobusHostType globusHostType = (GlobusHostType) hostDescriptionType;
hostType.add(HostTypes.GLOBUS_HOST_TYPE);
String[] globusGateKeeperEndPointArray = globusHostType.getGlobusGateKeeperEndPointArray();
for (int i = 0; i < globusGateKeeperEndPointArray.length ; i++){
gateKeeperEndPoint.add(globusGateKeeperEndPointArray[i]);
}
String[] gridFTPEndPointArray = globusHostType.getGridFTPEndPointArray();
for (int i = 0; i < gridFTPEndPointArray.length ; i++){
gridFTPEndPoint.add(gridFTPEndPointArray[i]);
}
}else if (hostDescriptionType instanceof GsisshHostType){
GsisshHostType gsisshHostType = (GsisshHostType) hostDescriptionType;
hostType.add(HostTypes.GSISSH_HOST_TYPE);
String[] gridFTPEndPointArray = gsisshHostType.getGridFTPEndPointArray();
for (int i = 0; i < gridFTPEndPointArray.length ; i++){
gridFTPEndPoint.add(gridFTPEndPointArray[i]);
}
} else if (hostDescriptionType instanceof SSHHostType) {
hostType.add(HostTypes.SSH_HOST_TYPE);
} else if (hostDescriptionType instanceof UnicoreHostType) {
UnicoreHostType unicoreHostType = (UnicoreHostType) hostDescriptionType;
hostType.add(HostTypes.UNICORE_HOST_TYPE);
String[] unicoreGateKeeperEndPointArray = unicoreHostType.getUnicoreHostAddressArray();
for (int i = 0; i < unicoreGateKeeperEndPointArray.length ; i++){
gateKeeperEndPoint.add(unicoreGateKeeperEndPointArray[i]);
}
String[] gridFTPEndPointArray = unicoreHostType.getGridFTPEndPointArray();
for (int i = 0; i < gridFTPEndPointArray.length ; i++){
gridFTPEndPoint.add(gridFTPEndPointArray[i]);
}
} else if (hostDescriptionType instanceof Ec2HostType) {
hostType.add(HostTypes.EC2_HOST_TYPE);
} else {
hostType.add(HostTypes.HOST_DESCRIPTION_TYPE);
}
hostDescriptor.setGateKeeperEndPoint(gateKeeperEndPoint);
hostDescriptor.setGridFTPEndPoint(gridFTPEndPoint);
hostDescriptor.setImageID(imageID);
hostDescriptor.setInstanceID(instanceID);
hostDescriptor.setHostType(hostType);
return hostDescriptor;
}