*/
URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
Properties properties = new Properties();
properties.load(url.openStream());
HostDescription host = new HostDescription();
host.getType().changeType(GlobusHostType.type);
host.getType().setHostName(properties.getProperty("host.commom.name"));
host.getType().setHostAddress(properties.getProperty("host.fqdn.name"));
((GlobusHostType) host.getType()).setGridFTPEndPointArray(new String[]{properties.getProperty("gridftp.endpoint")});
((GlobusHostType) host.getType()).setGlobusGateKeeperEndPointArray(new String[]{properties.getProperty("gram.endpoints")});
/*
* App
*/
ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
app.setCpuCount(1);
app.setNodeCount(1);
ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
name.setStringValue("EchoLocal");
app.setExecutableLocation("/bin/echo");
app.setScratchWorkingDirectory(properties.getProperty("scratch.working.directory"));
app.setCpuCount(1);
ProjectAccountType projectAccountType = ((HpcApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
projectAccountType.setProjectAccountNumber(properties.getProperty("allocation.charge.number"));
QueueType queueType = app.addNewQueue();
queueType.setQueueName(properties.getProperty("defualt.queue"));
app.setMaxMemory(100);
/*
* Service
*/
ServiceDescription serv = new ServiceDescription();
serv.getType().setName("SimpleEcho");
InputParameterType input = InputParameterType.Factory.newInstance();
ParameterType parameterType = input.addNewParameterType();
parameterType.setName("echo_input");
List<InputParameterType> inputList = new ArrayList<InputParameterType>();
inputList.add(input);
InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
.size()]);
OutputParameterType output = OutputParameterType.Factory.newInstance();
ParameterType parameterType1 = output.addNewParameterType();
parameterType1.setName("echo_output");
List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
outputList.add(output);
OutputParameterType[] outputParamList = outputList
.toArray(new OutputParameterType[outputList.size()]);
serv.getType().setInputParametersArray(inputParamList);
serv.getType().setOutputParametersArray(outputParamList);
/*
* Save to registry
*/
airavataAPI.getApplicationManager().getApplicationDescriptors(serv.getType().getName());
if(airavataAPI.getApplicationManager().isHostDescriptorExists(host.getType().getHostName())) {
airavataAPI.getApplicationManager().updateHostDescriptor(host);
} else {
airavataAPI.getApplicationManager().saveHostDescription(host);
}
if (airavataAPI.getApplicationManager().isApplicationDescriptorExists(serv.getType().getName(), host.getType().getHostName(), appDesc.getType().getApplicationName().getStringValue())){
airavataAPI.getApplicationManager().updateApplicationDescriptor(serv.getType().getName(), host.getType().getHostName(), appDesc);
} else {
airavataAPI.getApplicationManager().saveApplicationDescription(serv.getType().getName(), host.getType().getHostName(), appDesc);
}
if (airavataAPI.getApplicationManager().isServiceDescriptorExists(serv.getType().getName())){
airavataAPI.getApplicationManager().updateServiceDescriptor(serv);
} else {