http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java deleted file mode 100644 index 62ad814..0000000 --- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.app.catalog.test; - -import org.airavata.appcatalog.cpi.*; -import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory; -import org.apache.aiaravata.application.catalog.data.resources.AbstractResource; -import org.apache.airavata.app.catalog.test.util.Initialize; -import org.apache.airavata.common.utils.AiravataUtils; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription; -import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule; -import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths; -import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertTrue; - -public class AppDeploymentTest { - private static Initialize initialize; - private static AppCatalog appcatalog; - private static final Logger logger = LoggerFactory.getLogger(AppDeploymentTest.class); - - @Before - public void setUp() { - try { - initialize = new Initialize("appcatalog-derby.sql"); - initialize.initializeDB(); - appcatalog = AppCatalogFactory.getAppCatalog(); - } catch (AppCatalogException e) { - logger.error(e.getMessage(), e); - } - } - - @After - public void tearDown() throws Exception { - System.out.println("********** TEAR DOWN ************"); - initialize.stopDerbyServer(); - } - - @Test - public void testAppDeployment () throws Exception { - ApplicationDeployment appDep = appcatalog.getApplicationDeployment(); - ApplicationInterface appInt = appcatalog.getApplicationInterface(); - ComputeResource computeRs = appcatalog.getComputeResource(); - ComputeResourceDescription cm = new ComputeResourceDescription(); - cm.setHostName("localhost"); - cm.setResourceDescription("test compute host"); - String hostId = computeRs.addComputeResource(cm); - - ApplicationModule module = new ApplicationModule(); - module.setAppModuleName("WRF"); - module.setAppModuleVersion("1.0.0"); - String wrfModuleId = appInt.addApplicationModule(module, ServerSettings.getDefaultUserGateway()); - - ApplicationDeploymentDescription description = new ApplicationDeploymentDescription(); - description.setAppModuleId(wrfModuleId); - description.setComputeHostId(hostId); - description.setExecutablePath("/home/a/b/c"); - description.setAppDeploymentDescription("test app deployment"); - description.addToModuleLoadCmds("cmd1"); - description.addToModuleLoadCmds("cmd2"); - - List<SetEnvPaths> libPrepandPaths = new ArrayList<SetEnvPaths>(); - libPrepandPaths.add(createSetEnvPath("name1", "val1")); - libPrepandPaths.add(createSetEnvPath("name2", "val2")); - description.setLibPrependPaths(libPrepandPaths); - List<SetEnvPaths> libApendPaths = new ArrayList<SetEnvPaths>(); - libApendPaths.add(createSetEnvPath("name3", "val3")); - libApendPaths.add(createSetEnvPath("name4", "val4")); - description.setLibAppendPaths(libApendPaths); - List<SetEnvPaths> appEvns = new ArrayList<SetEnvPaths>(); - appEvns.add(createSetEnvPath("name5", "val5")); - appEvns.add(createSetEnvPath("name6", "val6")); - description.setSetEnvironment(appEvns); - - String appDepId = appDep.addApplicationDeployment(description, ServerSettings.getDefaultUserGateway()); - ApplicationDeploymentDescription app = null; - if (appDep.isAppDeploymentExists(appDepId)){ - app = appDep.getApplicationDeployement(appDepId); - System.out.println("*********** application deployment id ********* : " + app.getAppDeploymentId()); - System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription()); - } - - description.setAppDeploymentDescription("test app deployment2"); - appDep.updateApplicationDeployment(appDepId, description); - - if (appDep.isAppDeploymentExists(appDepId)){ - app = appDep.getApplicationDeployement(appDepId); - System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription()); - } - - Map<String, String> moduleIdFilter = new HashMap<String, String>(); - moduleIdFilter.put(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, wrfModuleId); - List<ApplicationDeploymentDescription> applicationDeployements = appDep.getApplicationDeployements(moduleIdFilter); - System.out.println("******** Size of App deployments for module *********** : " + applicationDeployements.size()); - Map<String, String> hostFilter = new HashMap<String, String>(); - hostFilter.put(AbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID, hostId); - List<ApplicationDeploymentDescription> applicationDeployementsForHost = appDep.getApplicationDeployements(hostFilter); - System.out.println("******** Size of App deployments for host *********** : " + applicationDeployementsForHost.size()); - - List<String> allApplicationDeployementIds = appDep.getAllApplicationDeployementIds(); - System.out.println("******** Size of all App deployments ids *********** : " + allApplicationDeployementIds.size()); - - List<ApplicationDeploymentDescription> allApplicationDeployements = appDep.getAllApplicationDeployements(ServerSettings.getDefaultUserGateway()); - System.out.println("******** Size of all App deployments *********** : " + allApplicationDeployements.size()); - - assertTrue("App interface saved successfully", app != null); - } - - public SetEnvPaths createSetEnvPath (String name, String val){ - SetEnvPaths setEnvPaths = new SetEnvPaths(); - setEnvPaths.setName(name); - setEnvPaths.setValue(val); - return setEnvPaths; - - } - -}
http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java deleted file mode 100644 index dd72b8e..0000000 --- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.app.catalog.test; - -import org.airavata.appcatalog.cpi.AppCatalog; -import org.airavata.appcatalog.cpi.AppCatalogException; -import org.airavata.appcatalog.cpi.ApplicationInterface; -import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory; -import org.apache.aiaravata.application.catalog.data.resources.AbstractResource; -import org.apache.airavata.app.catalog.test.util.Initialize; -import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.AiravataUtils; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule; -import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription; -import org.apache.airavata.model.appcatalog.appinterface.DataType; -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertTrue; - -public class AppInterfaceTest { - private static Initialize initialize; - private static AppCatalog appcatalog; - private static int order = 1; - private static final Logger logger = LoggerFactory.getLogger(AppInterfaceTest.class); - - @Before - public void setUp() { - try { - initialize = new Initialize("appcatalog-derby.sql"); - initialize.initializeDB(); - appcatalog = AppCatalogFactory.getAppCatalog(); - } catch (AppCatalogException e) { - logger.error(e.getMessage(), e); - } - } - - @After - public void tearDown() throws Exception { - System.out.println("********** TEAR DOWN ************"); - initialize.stopDerbyServer(); - - } - - @Test - public void testAppInterface(){ - try { - ApplicationInterface appInterface = appcatalog.getApplicationInterface(); - ApplicationInterfaceDescription description = new ApplicationInterfaceDescription(); - String wrfModuleId = addAppModule("WRF"); - String amberModuleId = addAppModule("AMBER"); - List<String> modules = new ArrayList<String>(); - modules.add(wrfModuleId); - modules.add(amberModuleId); - InputDataObjectType appInput1 = createAppInput("input1", "input1", DataType.STRING); - InputDataObjectType appInput2 = createAppInput("input2", "input2", DataType.INTEGER); - List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>(); - inputs.add(appInput1); - inputs.add(appInput2); - OutputDataObjectType output1 = createAppOutput("output1", "", DataType.STRING); - OutputDataObjectType output2 = createAppOutput("output2", "", DataType.STRING); - List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>(); - outputs.add(output1); - outputs.add(output2); - description.setApplicationName("testApplication"); - description.setApplicationDescription("my testApplication"); - description.setApplicationModules(modules); - description.setApplicationInputs(inputs); - description.setApplicationOutputs(outputs); - String appID = appInterface.addApplicationInterface(description, ServerSettings.getDefaultUserGateway()); - System.out.println("********** application id ************* : " + appID); - ApplicationInterfaceDescription ainterface = null; - if (appInterface.isApplicationInterfaceExists(appID)){ - ainterface = appInterface.getApplicationInterface(appID); - OutputDataObjectType output3 = createAppOutput("output3", "", DataType.STRING); - OutputDataObjectType output4 = createAppOutput("output4", "", DataType.STRING); - outputs.add(output3); - outputs.add(output4); - ainterface.setApplicationOutputs(outputs); - appInterface.updateApplicationInterface(appID, ainterface); - ApplicationInterfaceDescription updateApp = appInterface.getApplicationInterface(appID); - List<OutputDataObjectType> appOutputs = updateApp.getApplicationOutputs(); - System.out.println("********** application name ************* : " + updateApp.getApplicationName()); - System.out.println("********** application description ************* : " + updateApp.getApplicationDescription()); - System.out.println("********** output size ************* : " + appOutputs.size()); - } - ApplicationModule wrfModule = appInterface.getApplicationModule(wrfModuleId); - System.out.println("********** WRF module name ************* : " + wrfModule.getAppModuleName()); - ApplicationModule amberModule = appInterface.getApplicationModule(amberModuleId); - System.out.println("********** Amber module name ************* : " + amberModule.getAppModuleName()); - - List<InputDataObjectType> applicationInputs = appInterface.getApplicationInputs(appID); - System.out.println("********** App Input size ************* : " + applicationInputs.size()); - - List<OutputDataObjectType> applicationOutputs = appInterface.getApplicationOutputs(appID); - System.out.println("********** App output size ************* : " + applicationOutputs.size()); - - description.setApplicationName("testApplication2"); - appInterface.updateApplicationInterface(appID, description); - if (appInterface.isApplicationInterfaceExists(appID)){ - ainterface = appInterface.getApplicationInterface(appID); - System.out.println("********** updated application name ************* : " + ainterface.getApplicationName()); - } - - wrfModule.setAppModuleVersion("1.0.1"); - appInterface.updateApplicationModule(wrfModuleId, wrfModule); - wrfModule = appInterface.getApplicationModule(wrfModuleId); - System.out.println("********** Updated WRF module version ************* : " + wrfModule.getAppModuleVersion()); - - Map<String, String> filters = new HashMap<String, String>(); - filters.put(AbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME, "testApplication2"); - List<ApplicationInterfaceDescription> apps = appInterface.getApplicationInterfaces(filters); - System.out.println("********** Size og app interfaces ************* : " + apps.size()); - - List<ApplicationInterfaceDescription> appInts = appInterface.getAllApplicationInterfaces(ServerSettings.getDefaultUserGateway()); - System.out.println("********** Size of all app interfaces ************* : " + appInts.size()); - - List<String> appIntIds = appInterface.getAllApplicationInterfaceIds(); - System.out.println("********** Size of all app interface ids ************* : " + appIntIds.size()); - - assertTrue("App interface saved successfully", ainterface != null); - }catch (AppCatalogException e) { - e.printStackTrace(); - } catch (ApplicationSettingsException e) { - e.printStackTrace(); - } - - } - - public String addAppModule (String moduleName){ - try { - ApplicationModule module = new ApplicationModule(); - module.setAppModuleName(moduleName); - module.setAppModuleVersion("1.0.0"); - module.setAppModuleDescription("WeatherForcast"); - return appcatalog.getApplicationInterface().addApplicationModule(module, ServerSettings.getDefaultUserGateway()); - } catch (AppCatalogException e) { - logger.error(e.getMessage(), e); - } catch (ApplicationSettingsException e) { - e.printStackTrace(); - } - return null; - } - - public InputDataObjectType createAppInput (String inputName, String value, DataType type ){ - InputDataObjectType input = new InputDataObjectType(); - input.setName(inputName); - input.setValue(value); - input.setType(type); - input.setApplicationArgument("test arg"); - input.setInputOrder(order++); - return input; - } - - public OutputDataObjectType createAppOutput (String inputName, String value, DataType type ){ - OutputDataObjectType outputDataObjectType = new OutputDataObjectType(); - outputDataObjectType.setName(inputName); - outputDataObjectType.setValue(value); - outputDataObjectType.setType(type); - return outputDataObjectType; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java deleted file mode 100644 index 9b8ec4b..0000000 --- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.app.catalog.test; - - -import org.airavata.appcatalog.cpi.AppCatalog; -import org.airavata.appcatalog.cpi.AppCatalogException; -import org.airavata.appcatalog.cpi.ComputeResource; -import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory; -import org.apache.aiaravata.application.catalog.data.resources.AbstractResource; -import org.apache.airavata.app.catalog.test.util.Initialize; -import org.apache.airavata.common.utils.AiravataUtils; -import org.apache.airavata.model.appcatalog.computeresource.*; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.*; - -import static org.junit.Assert.assertTrue; - -public class ComputeResourceTest { - private static Initialize initialize; - private static AppCatalog appcatalog; - private static final Logger logger = LoggerFactory.getLogger(ComputeResourceTest.class); - - @Before - public void setUp() { - try { - initialize = new Initialize("appcatalog-derby.sql"); - initialize.initializeDB(); - appcatalog = AppCatalogFactory.getAppCatalog(); - } catch (AppCatalogException e) { - logger.error(e.getMessage(), e); - } - } - - @After - public void tearDown() throws Exception { - System.out.println("********** TEAR DOWN ************"); - initialize.stopDerbyServer(); - - } - - @Test - public void testAddComputeResource (){ - try { - ComputeResource computeResource = appcatalog.getComputeResource(); - ComputeResourceDescription description = new ComputeResourceDescription(); - - description.setHostName("localhost"); - description.setResourceDescription("test compute resource"); - List<String> ipdaresses = new ArrayList<String>(); - ipdaresses.add("222.33.43.444"); - ipdaresses.add("23.344.44.454"); - description.setIpAddresses(ipdaresses); -// List<String> aliases = new ArrayList<String>(); -// aliases.add("test.alias1"); -// aliases.add("test.alias2"); -// description.setHostAliases(aliases); - String sshsubmissionId = addSSHJobSubmission(); - System.out.println("**** SSH Submission id ****** :" + sshsubmissionId); -// String gsiSSHsubmissionId = addGSISSHJobSubmission(); -// System.out.println("**** GSISSH Submission id ****** :" + gsiSSHsubmissionId); -// String globusSubmissionId = addGlobusJobSubmission(); -// System.out.println("**** Globus Submission id ****** :" + globusSubmissionId); - JobSubmissionInterface sshSubmissionInt = new JobSubmissionInterface(); - sshSubmissionInt.setJobSubmissionInterfaceId(sshsubmissionId); - sshSubmissionInt.setPriorityOrder(1); - sshSubmissionInt.setJobSubmissionProtocol(JobSubmissionProtocol.SSH); -// JobSubmissionInterface globusSubInt = new JobSubmissionInterface(); -// globusSubInt.setJobSubmissionInterfaceId(globusSubmissionId); -// globusSubInt.setPriorityOrder(2); -// globusSubInt.setJobSubmissionProtocol(JobSubmissionProtocol.GLOBUS); - List<JobSubmissionInterface> interfaceList = new ArrayList<JobSubmissionInterface>(); - interfaceList.add(sshSubmissionInt); -// interfaceList.add(globusSubInt); - description.setJobSubmissionInterfaces(interfaceList); - - String scpDataMoveId = addSCPDataMovement(); - System.out.println("**** SCP DataMoveId****** :" + scpDataMoveId); - String gridFTPDataMoveId = addGridFTPDataMovement(); - System.out.println("**** grid FTP DataMoveId****** :" + gridFTPDataMoveId); - - List<DataMovementInterface> dataMovementInterfaces = new ArrayList<DataMovementInterface>(); - DataMovementInterface scpInterface = new DataMovementInterface(); - scpInterface.setDataMovementInterfaceId(scpDataMoveId); - scpInterface.setDataMovementProtocol(DataMovementProtocol.SCP); - scpInterface.setPriorityOrder(1); - - DataMovementInterface gridFTPMv = new DataMovementInterface(); - gridFTPMv.setDataMovementInterfaceId(gridFTPDataMoveId); - gridFTPMv.setDataMovementProtocol(DataMovementProtocol.GridFTP); - gridFTPMv.setPriorityOrder(2); - - description.setDataMovementInterfaces(dataMovementInterfaces); - - BatchQueue batchQueue1 = new BatchQueue(); - batchQueue1.setQueueName("queue1"); - batchQueue1.setQueueDescription("que1Desc1"); - batchQueue1.setMaxRunTime(10); - batchQueue1.setMaxNodes(4); - batchQueue1.setMaxJobsInQueue(1); - - BatchQueue batchQueue2 = new BatchQueue(); - batchQueue2.setQueueName("queue2"); - batchQueue2.setQueueDescription("que1Desc2"); - batchQueue2.setMaxRunTime(10); - batchQueue2.setMaxNodes(4); - batchQueue2.setMaxJobsInQueue(1); - - List<BatchQueue> batchQueueList = new ArrayList<BatchQueue>(); - batchQueueList.add(batchQueue1); - batchQueueList.add(batchQueue2); - description.setBatchQueues(batchQueueList); - - Map<FileSystems, String> fileSysMap = new HashMap<FileSystems, String>(); - fileSysMap.put(FileSystems.HOME, "/home"); - fileSysMap.put(FileSystems.SCRATCH, "/tmp"); - description.setFileSystems(fileSysMap); - - String resourceId = computeResource.addComputeResource(description); - System.out.println("**********Resource id ************* : " + resourceId); - ComputeResourceDescription host = null; - if (computeResource.isComputeResourceExists(resourceId)){ - host = computeResource.getComputeResource(resourceId); - List<BatchQueue> batchQueues = host.getBatchQueues(); - for (BatchQueue queue : batchQueues){ - System.out.println("%%%%%%%%%%%%%%%% queue description : %%%%%%%%%%%%%%%%%%% : " + queue.getQueueDescription()); - } - List<String> hostAliases = host.getHostAliases(); - if (hostAliases != null && !hostAliases.isEmpty()){ - for (String alias : hostAliases){ - System.out.println("%%%%%%%%%%%%%%%% alias value : %%%%%%%%%%%%%%%%%%% : " + alias); - } - } - host.addToHostAliases("abc"); - computeResource.updateComputeResource(resourceId, host); - List<String> hostAliases1 = computeResource.getComputeResource(resourceId).getHostAliases(); - for (String alias : hostAliases1){ - System.out.println("%%%%%%%%%%%%%%%% alias value : %%%%%%%%%%%%%%%%%%% : " + alias); - } - System.out.println("**********Resource name ************* : " + host.getHostName()); - } - - SSHJobSubmission sshJobSubmission = computeResource.getSSHJobSubmission(sshsubmissionId); - System.out.println("**********SSH Submission resource job manager ************* : " + sshJobSubmission.getResourceJobManager().toString()); - System.out.println("**********Monitor mode ************* : " + sshJobSubmission.getMonitorMode().toString()); - -// GlobusJobSubmission globusJobSubmission = computeResource.get(globusSubmissionId); -// System.out.println("**********Globus Submission resource job manager ************* : " + globusJobSubmission.getResourceJobManager().toString()); - - SCPDataMovement scpDataMovement = computeResource.getSCPDataMovement(scpDataMoveId); - System.out.println("**********SCP Data Move Security protocol ************* : " + scpDataMovement.getSecurityProtocol().toString()); - - GridFTPDataMovement gridFTPDataMovement = computeResource.getGridFTPDataMovement(gridFTPDataMoveId); - System.out.println("**********GRID FTP Data Move Security protocol ************* : " + gridFTPDataMovement.getSecurityProtocol().toString()); - - description.setHostName("localhost2"); - computeResource.updateComputeResource(resourceId, description); - if (computeResource.isComputeResourceExists(resourceId)){ - host = computeResource.getComputeResource(resourceId); - System.out.println("**********Updated Resource name ************* : " + host.getHostName()); - } - - Map<String, String> cfilters = new HashMap<String, String>(); - cfilters.put(AbstractResource.ComputeResourceConstants.HOST_NAME, "localhost2"); - List<ComputeResourceDescription> computeResourceList = computeResource.getComputeResourceList(cfilters); - System.out.println("**********Size of compute resources ************* : " + computeResourceList.size()); - - List<ComputeResourceDescription> allComputeResourceList = computeResource.getAllComputeResourceList(); - System.out.println("**********Size of all compute resources ************* : " + allComputeResourceList.size()); - - Map<String, String> allComputeResourceIdList = computeResource.getAllComputeResourceIdList(); - System.out.println("**********Size of all compute resources ids ************* : " + allComputeResourceIdList.size()); - -// Map<String, String> globusfilters = new HashMap<String, String>(); -// globusfilters.put(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString()); -// List<GlobusJobSubmission> gList = computeResource.getGlobusJobSubmissionList(globusfilters); -// System.out.println("**********Size of globus jobs ************* : " + gList.size()); - -// Map<String, String> sshfilters = new HashMap<String, String>(); -// sshfilters.put(AbstractResource.SSHSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString()); -// List<SSHJobSubmission> sshList = computeResource.getSS(sshfilters); -// System.out.println("**********Size of SSH jobs ************* : " + sshList.size()); - -// Map<String, String> gsishfilters = new HashMap<String, String>(); -// gsishfilters.put(AbstractResource.GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString()); -// List<GSISSHJobSubmission> gsisshList = computeResource.getGSISSHJobSubmissionList(gsishfilters); -// System.out.println("**********Size of GSISSH jobs ************* : " + gsisshList.size()); - -// Map<String, String> scpfilters = new HashMap<String, String>(); -// scpfilters.put(AbstractResource.SCPDataMovementConstants.SECURITY_PROTOCOL, SecurityProtocol.SSH_KEYS.toString()); -// List<SCPDataMovement> scpDataMovementList = computeResource.getSCPDataMovementList(scpfilters); -// System.out.println("**********Size of SCP DM list ************* : " + scpDataMovementList.size()); -// -// Map<String, String> ftpfilters = new HashMap<String, String>(); -// ftpfilters.put(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL, SecurityProtocol.SSH_KEYS.toString()); -// List<GridFTPDataMovement> ftpDataMovementList = computeResource.getGridFTPDataMovementList(ftpfilters); -// System.out.println("**********Size of FTP DM list ************* : " + ftpDataMovementList.size()); - - assertTrue("Compute resource save successfully", host != null); - } catch (AppCatalogException e) { - logger.error(e.getMessage(), e); - } - } - - public String addSSHJobSubmission (){ - try { - SSHJobSubmission jobSubmission = new SSHJobSubmission(); - jobSubmission.setSshPort(22); - jobSubmission.setSecurityProtocol(SecurityProtocol.GSI); - ResourceJobManager jobManager = new ResourceJobManager(); - jobManager.setResourceJobManagerType(ResourceJobManagerType.PBS); - jobManager.setPushMonitoringEndpoint("monitor ep"); - jobManager.setJobManagerBinPath("/bin"); - Map<JobManagerCommand, String> commands = new HashMap<JobManagerCommand, String>(); - commands.put(JobManagerCommand.SUBMISSION, "Sub command"); - commands.put(JobManagerCommand.SHOW_QUEUE, "show q command"); - jobManager.setJobManagerCommands(commands); - jobSubmission.setMonitorMode(MonitorMode.POLL_JOB_MANAGER); -// String jobManagerID = appcatalog.getComputeResource().addResourceJobManager(jobManager); -// jobManager.setResourceJobManagerId(jobManagerID); - jobSubmission.setResourceJobManager(jobManager); - return appcatalog.getComputeResource().addSSHJobSubmission(jobSubmission); - } catch (AppCatalogException e) { - logger.error(e.getMessage(), e); - } - return null; - } - -// public String addGlobusJobSubmission (){ -// try { -// GlobusJobSubmission jobSubmission = new GlobusJobSubmission(); -// jobSubmission.setSecurityProtocol(SecurityProtocol.GSI); -// jobSubmission.setResourceJobManager(ResourceJobManager.PBS); -// List<String> endPoints = new ArrayList<String>(); -// endPoints.add("222.33.43.444"); -// endPoints.add("23.344.44.454"); -// jobSubmission.setGlobusGateKeeperEndPoint(endPoints); -// return appcatalog.getComputeResource().addGlobusJobSubmission(jobSubmission); -// } catch (AppCatalogException e) { -// e.printStackTrace(); -// } -// return null; -// } - - public String addSCPDataMovement (){ - try { - SCPDataMovement dataMovement = new SCPDataMovement(); - dataMovement.setSshPort(22); - dataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS); - return appcatalog.getComputeResource().addScpDataMovement(dataMovement); - }catch (AppCatalogException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - public String addGridFTPDataMovement (){ - try { - GridFTPDataMovement dataMovement = new GridFTPDataMovement(); - dataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS); - List<String> endPoints = new ArrayList<String>(); - endPoints.add("222.33.43.444"); - endPoints.add("23.344.44.454"); - dataMovement.setGridFTPEndPoints(endPoints); - return appcatalog.getComputeResource().addGridFTPDataMovement(dataMovement); - }catch (AppCatalogException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - -} - http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java deleted file mode 100644 index b2b8555..0000000 --- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.app.catalog.test; - -import org.airavata.appcatalog.cpi.AppCatalog; -import org.airavata.appcatalog.cpi.AppCatalogException; -import org.airavata.appcatalog.cpi.ComputeResource; -import org.airavata.appcatalog.cpi.GwyResourceProfile; -import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory; -import org.apache.airavata.app.catalog.test.util.Initialize; -import org.apache.airavata.common.utils.AiravataUtils; -import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; -import org.apache.airavata.model.appcatalog.computeresource.DataMovementProtocol; -import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol; -import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference; -import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertTrue; - -public class GatewayProfileTest { - private static Initialize initialize; - private static AppCatalog appcatalog; - private static final Logger logger = LoggerFactory.getLogger(GatewayProfileTest.class); - - @Before - public void setUp() { - try { - initialize = new Initialize("appcatalog-derby.sql"); - initialize.initializeDB(); - appcatalog = AppCatalogFactory.getAppCatalog(); - } catch (AppCatalogException e) { - logger.error(e.getMessage(), e); - } - } - - @After - public void tearDown() throws Exception { - System.out.println("********** TEAR DOWN ************"); - initialize.stopDerbyServer(); - } - - @Test - public void gatewayProfileTest() throws Exception { - GwyResourceProfile gatewayProfile = appcatalog.getGatewayProfile(); - GatewayResourceProfile gf = new GatewayResourceProfile(); - ComputeResource computeRs = appcatalog.getComputeResource(); - ComputeResourceDescription cm1 = new ComputeResourceDescription(); - cm1.setHostName("localhost"); - cm1.setResourceDescription("test compute host"); - String hostId1 = computeRs.addComputeResource(cm1); - - ComputeResourceDescription cm2 = new ComputeResourceDescription(); - cm2.setHostName("localhost"); - cm2.setResourceDescription("test compute host"); - String hostId2 = computeRs.addComputeResource(cm2); - - ComputeResourcePreference preference1 = new ComputeResourcePreference(); - preference1.setComputeResourceId(hostId1); - preference1.setOverridebyAiravata(true); - preference1.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.SSH); - preference1.setPreferredDataMovementProtocol(DataMovementProtocol.SCP); - preference1.setPreferredBatchQueue("queue1"); - preference1.setScratchLocation("/tmp"); - preference1.setAllocationProjectNumber("project1"); - - ComputeResourcePreference preference2 = new ComputeResourcePreference(); - preference2.setComputeResourceId(hostId2); - preference2.setOverridebyAiravata(true); - preference2.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.LOCAL); - preference2.setPreferredDataMovementProtocol(DataMovementProtocol.GridFTP); - preference2.setPreferredBatchQueue("queue2"); - preference2.setScratchLocation("/tmp"); - preference2.setAllocationProjectNumber("project2"); - - List<ComputeResourcePreference> list = new ArrayList<ComputeResourcePreference>(); - list.add(preference1); - list.add(preference2); - gf.setComputeResourcePreferences(list); - gf.setGatewayID("testGateway"); - - String gwId = gatewayProfile.addGatewayResourceProfile(gf); - GatewayResourceProfile retrievedProfile = null; - if (gatewayProfile.isGatewayResourceProfileExists(gwId)){ - retrievedProfile = gatewayProfile.getGatewayProfile(gwId); - System.out.println("************ gateway id ************** :" + retrievedProfile.getGatewayID()); - } - List<ComputeResourcePreference> preferences = gatewayProfile.getAllComputeResourcePreferences(gwId); - System.out.println("compute preferences size : " + preferences.size()); - if (preferences != null && !preferences.isEmpty()){ - for (ComputeResourcePreference cm : preferences){ - System.out.println("******** host id ********* : " + cm.getComputeResourceId()); - System.out.println(cm.getPreferredBatchQueue()); - System.out.println(cm.getPreferredDataMovementProtocol()); - System.out.println(cm.getPreferredJobSubmissionProtocol()); - } - } - - assertTrue("App interface saved successfully", retrievedProfile != null); - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java deleted file mode 100644 index 5e8be65..0000000 --- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.app.catalog.test.util; - -import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.derby.drda.NetworkServerControl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.InetAddress; -import java.net.URI; -import java.sql.*; -import java.util.StringTokenizer; - -public class Initialize { - private static final Logger logger = LoggerFactory.getLogger(Initialize.class); - public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer"; - public String scriptName = "appcatalog-derby.sql"; - private NetworkServerControl server; - private static final String delimiter = ";"; - public static final String COMPUTE_RESOURCE_TABLE = "COMPUTE_RESOURCE"; - private String jdbcUrl = null; - private String jdbcDriver = null; - private String jdbcUser = null; - private String jdbcPassword = null; - - public Initialize(String scriptName) { - this.scriptName = scriptName; - } - - public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) { - if (suffix.length() > buffer.length()) { - return false; - } - // this loop is done on purpose to avoid memory allocation performance - // problems on various JDKs - // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and - // implementation is ok though does allocation/copying - // StringBuffer.toString().endsWith() does massive memory - // allocation/copying on JDK 1.5 - // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169 - int endIndex = suffix.length() - 1; - int bufferIndex = buffer.length() - 1; - while (endIndex >= 0) { - if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) { - return false; - } - bufferIndex--; - endIndex--; - } - return true; - } - - private static boolean isServerStarted(NetworkServerControl server, int ntries) - { - for (int i = 1; i <= ntries; i ++) - { - try { - Thread.sleep(500); - server.ping(); - return true; - } - catch (Exception e) { - if (i == ntries) - return false; - } - } - return false; - } - - public void initializeDB() { - - try{ - jdbcDriver = ServerSettings.getSetting("appcatalog.jdbc.driver"); - jdbcUrl = ServerSettings.getSetting("appcatalog.jdbc.url"); - jdbcUser = ServerSettings.getSetting("appcatalog.jdbc.user"); - jdbcPassword = ServerSettings.getSetting("appcatalog.jdbc.password"); - jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword; - } catch (ApplicationSettingsException e) { - logger.error("Unable to read properties", e); - } - - startDerbyInServerMode(); - if(!isServerStarted(server, 20)){ - throw new RuntimeException("Derby server cound not started within five seconds..."); - } -// startDerbyInEmbeddedMode(); - - Connection conn = null; - try { - Class.forName(jdbcDriver).newInstance(); - conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword); - if (!isDatabaseStructureCreated(COMPUTE_RESOURCE_TABLE, conn)) { - executeSQLScript(conn); - logger.info("New Database created for App Catalog !!!"); - } else { - logger.debug("Database already created for App Catalog!"); - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - throw new RuntimeException("Database failure", e); - } finally { - try { - if (conn != null){ - if (!conn.getAutoCommit()) { - conn.commit(); - } - conn.close(); - } - } catch (SQLException e) { - logger.error(e.getMessage(), e); - } - } - } - - public static boolean isDatabaseStructureCreated(String tableName, Connection conn) { - try { - System.out.println("Running a query to test the database tables existence."); - // check whether the tables are already created with a query - Statement statement = null; - try { - statement = conn.createStatement(); - ResultSet rs = statement.executeQuery("select * from " + tableName); - if (rs != null) { - rs.close(); - } - } finally { - try { - if (statement != null) { - statement.close(); - } - } catch (SQLException e) { - return false; - } - } - } catch (SQLException e) { - return false; - } - - return true; - } - - private void executeSQLScript(Connection conn) throws Exception { - StringBuffer sql = new StringBuffer(); - BufferedReader reader = null; - try{ - - InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName); - reader = new BufferedReader(new InputStreamReader(inputStream)); - String line; - while ((line = reader.readLine()) != null) { - line = line.trim(); - if (line.startsWith("//")) { - continue; - } - if (line.startsWith("--")) { - continue; - } - StringTokenizer st = new StringTokenizer(line); - if (st.hasMoreTokens()) { - String token = st.nextToken(); - if ("REM".equalsIgnoreCase(token)) { - continue; - } - } - sql.append(" ").append(line); - - // SQL defines "--" as a comment to EOL - // and in Oracle it may contain a hint - // so we cannot just remove it, instead we must end it - if (line.indexOf("--") >= 0) { - sql.append("\n"); - } - if ((checkStringBufferEndsWith(sql, delimiter))) { - executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn); - sql.replace(0, sql.length(), ""); - } - } - // Catch any statements not followed by ; - if (sql.length() > 0) { - executeSQL(sql.toString(), conn); - } - }catch (IOException e){ - logger.error("Error occurred while executing SQL script for creating Airavata database", e); - throw new Exception("Error occurred while executing SQL script for creating Airavata database", e); - }finally { - if (reader != null) { - reader.close(); - } - - } - - } - - private static void executeSQL(String sql, Connection conn) throws Exception { - // Check and ignore empty statements - if ("".equals(sql.trim())) { - return; - } - - Statement statement = null; - try { - logger.debug("SQL : " + sql); - - boolean ret; - int updateCount = 0, updateCountTotal = 0; - statement = conn.createStatement(); - ret = statement.execute(sql); - updateCount = statement.getUpdateCount(); - do { - if (!ret) { - if (updateCount != -1) { - updateCountTotal += updateCount; - } - } - ret = statement.getMoreResults(); - if (ret) { - updateCount = statement.getUpdateCount(); - } - } while (ret); - - logger.debug(sql + " : " + updateCountTotal + " rows affected"); - - SQLWarning warning = conn.getWarnings(); - while (warning != null) { - logger.warn(warning + " sql warning"); - warning = warning.getNextWarning(); - } - conn.clearWarnings(); - } catch (SQLException e) { - if (e.getSQLState().equals("X0Y32")) { - // eliminating the table already exception for the derby - // database - logger.info("Table Already Exists", e); - } else { - throw new Exception("Error occurred while executing : " + sql, e); - } - } finally { - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - logger.error("Error occurred while closing result set.", e); - } - } - } - } - - private void startDerbyInServerMode() { - try { - System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true"); - server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"), - 20000, - jdbcUser, jdbcPassword); - java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true); - server.start(consoleWriter); - } catch (IOException e) { - logger.error("Unable to start Apache derby in the server mode! Check whether " + - "specified port is available"); - } catch (Exception e) { - logger.error("Unable to start Apache derby in the server mode! Check whether " + - "specified port is available"); - } - - } - - public static int getPort(String jdbcURL){ - try{ - String cleanURI = jdbcURL.substring(5); - URI uri = URI.create(cleanURI); - return uri.getPort(); - } catch (Exception e) { - logger.error(e.getMessage(), e); - return -1; - } - } - - private void startDerbyInEmbeddedMode(){ - try { - Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); - DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close(); - } catch (ClassNotFoundException e) { - logger.error(e.getMessage(), e); - } catch (SQLException e) { - logger.error(e.getMessage(), e); - } - } - - public void stopDerbyServer() { - try { - server.shutdown(); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-application-specific-handlers/src/main/java/org/apache/airavata/application/gaussian/handler/GaussianHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-application-specific-handlers/src/main/java/org/apache/airavata/application/gaussian/handler/GaussianHandler.java b/modules/gfac/gfac-application-specific-handlers/src/main/java/org/apache/airavata/application/gaussian/handler/GaussianHandler.java index 0d21665..9b37ffa 100644 --- a/modules/gfac/gfac-application-specific-handlers/src/main/java/org/apache/airavata/application/gaussian/handler/GaussianHandler.java +++ b/modules/gfac/gfac-application-specific-handlers/src/main/java/org/apache/airavata/application/gaussian/handler/GaussianHandler.java @@ -26,8 +26,8 @@ import org.apache.airavata.gfac.core.handler.AbstractHandler; import org.apache.airavata.gfac.core.handler.GFacHandlerException; import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling; +import org.apache.airavata.registry.cpi.ExperimentCatalogModelType; import org.apache.airavata.registry.cpi.RegistryException; -import org.apache.airavata.registry.cpi.RegistryModelType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,7 +88,7 @@ public class GaussianHandler extends AbstractHandler { } logger.info("$$$$$$$$ " + inputConfig.getKey() + " --> " + inputConfig.getValue() + " $$$$$$$$$$$"); } - registry.update(RegistryModelType.TASK_DETAIL, jobExecutionContext.getTaskData(), jobExecutionContext.getTaskData().getTaskID()); + experimentCatalog.update(ExperimentCatalogModelType.TASK_DETAIL, jobExecutionContext.getTaskData(), jobExecutionContext.getTaskData().getTaskID()); } catch (IOException e) { throw new GFacHandlerException("Error while reading main input file ", e); } catch (RegistryException e) { http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java index 7b369f7..34a00e3 100644 --- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java +++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/handlers/AbstractSMSHandler.java @@ -25,7 +25,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.util.Properties; -import org.airavata.appcatalog.cpi.AppCatalogException; +import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.gfac.GFacException; import org.apache.airavata.gfac.bes.security.UNICORESecurityContext; import org.apache.airavata.gfac.bes.security.X509SecurityContext; http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java index edac12f..19f4e3b 100644 --- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java +++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java @@ -23,7 +23,7 @@ package org.apache.airavata.gfac.bes.provider.impl; import java.util.Calendar; import java.util.Map; -import org.airavata.appcatalog.cpi.AppCatalogException; +import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.gfac.GFacException; import org.apache.airavata.gfac.bes.security.UNICORESecurityContext; http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java index b9c17e7..c9a1ce0 100644 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java @@ -21,8 +21,8 @@ package org.apache.airavata.gfac; -import org.airavata.appcatalog.cpi.AppCatalog; -import org.airavata.appcatalog.cpi.AppCatalogException; +import org.apache.airavata.registry.cpi.AppCatalog; +import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.gfac.core.context.JobExecutionContext; import org.apache.airavata.gfac.core.provider.GFacProvider; import org.apache.airavata.gfac.core.provider.GFacProviderConfig; http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFac.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFac.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFac.java index d3e1c70..584a581 100644 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFac.java +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFac.java @@ -20,11 +20,11 @@ */ package org.apache.airavata.gfac.core; -import org.airavata.appcatalog.cpi.AppCatalog; +import org.apache.airavata.registry.cpi.AppCatalog; import org.apache.airavata.common.utils.MonitorPublisher; import org.apache.airavata.gfac.GFacException; import org.apache.airavata.gfac.core.context.JobExecutionContext; -import org.apache.airavata.registry.cpi.Registry; +import org.apache.airavata.registry.cpi.ExperimentCatalog; import org.apache.curator.framework.CuratorFramework; /** @@ -35,13 +35,13 @@ public interface GFac { /** * Initialized method, this method must call one time before use any other method. - * @param registry + * @param experimentCatalog * @param appCatalog * @param curatorClient * @param publisher * @return */ - public boolean init(Registry registry, AppCatalog appCatalog, CuratorFramework curatorClient, MonitorPublisher publisher); + public boolean init(ExperimentCatalog experimentCatalog, AppCatalog appCatalog, CuratorFramework curatorClient, MonitorPublisher publisher); /** * This is the job launching method outsiders of GFac can use, this will invoke the GFac handler chain and providers http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java index 3756140..16ffee9 100644 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java @@ -20,8 +20,8 @@ */ package org.apache.airavata.gfac.core; -import org.airavata.appcatalog.cpi.AppCatalog; -import org.airavata.appcatalog.cpi.AppCatalogException; +import org.apache.airavata.registry.cpi.AppCatalog; +import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.AiravataZKUtils; @@ -57,12 +57,9 @@ import org.apache.airavata.model.workspace.experiment.JobDetails; import org.apache.airavata.model.workspace.experiment.JobState; import org.apache.airavata.model.workspace.experiment.JobStatus; import org.apache.airavata.model.workspace.experiment.TaskState; -import org.apache.airavata.experiment.catalog.impl.RegistryFactory; -import org.apache.airavata.registry.cpi.ChildDataType; -import org.apache.airavata.registry.cpi.CompositeIdentifier; -import org.apache.airavata.registry.cpi.Registry; -import org.apache.airavata.registry.cpi.RegistryException; -import org.apache.airavata.registry.cpi.RegistryModelType; +import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory; +import org.apache.airavata.registry.cpi.*; +import org.apache.airavata.registry.cpi.ExperimentCatalog; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.utils.ZKPaths; import org.apache.zookeeper.CreateMode; @@ -264,11 +261,11 @@ public class GFacUtils { JobDetails details, JobState state) throws GFacException { try { // first we save job details to the registry for sa and then save the job status. - Registry registry = jobExecutionContext.getRegistry(); + ExperimentCatalog experimentCatalog = jobExecutionContext.getExperimentCatalog(); JobStatus status = new JobStatus(); status.setJobState(state); details.setJobStatus(status); - registry.add(ChildDataType.JOB_DETAIL, details, + experimentCatalog.add(ExpCatChildDataType.JOB_DETAIL, details, new CompositeIdentifier(jobExecutionContext.getTaskData() .getTaskID(), details.getJobID())); JobIdentifier identifier = new JobIdentifier(details.getJobID(), jobExecutionContext.getTaskData().getTaskID(), @@ -285,14 +282,14 @@ public class GFacUtils { public static void updateJobStatus(JobExecutionContext jobExecutionContext, JobDetails details, JobState state) throws GFacException { try { - Registry registry = jobExecutionContext.getRegistry(); + ExperimentCatalog experimentCatalog = jobExecutionContext.getExperimentCatalog(); JobStatus status = new JobStatus(); status.setJobState(state); status.setTimeOfStateChange(Calendar.getInstance() .getTimeInMillis()); details.setJobStatus(status); - registry.update( - org.apache.airavata.registry.cpi.RegistryModelType.JOB_DETAIL, + experimentCatalog.update( + ExperimentCatalogModelType.JOB_DETAIL, details, details.getJobID()); } catch (Exception e) { throw new GFacException("Error persisting job status" @@ -305,14 +302,14 @@ public class GFacUtils { CorrectiveAction action, ErrorCategory errorCatogory) throws GFacException { try { - Registry registry = jobExecutionContext.getRegistry(); + ExperimentCatalog experimentCatalog = jobExecutionContext.getExperimentCatalog(); ErrorDetails details = new ErrorDetails(); details.setActualErrorMessage(errorMessage); details.setCorrectiveAction(action); details.setActionableGroup(ActionableGroup.GATEWAYS_ADMINS); details.setCreationTime(Calendar.getInstance().getTimeInMillis()); details.setErrorCategory(errorCatogory); - registry.add(ChildDataType.ERROR_DETAIL, details, + experimentCatalog.add(ExpCatChildDataType.ERROR_DETAIL, details, jobExecutionContext.getTaskData().getTaskID()); } catch (Exception e) { throw new GFacException("Error persisting job status" @@ -690,8 +687,8 @@ public class GFacUtils { } public static ExperimentState updateExperimentStatus(String experimentId, ExperimentState state) throws RegistryException { - Registry airavataRegistry = RegistryFactory.getDefaultRegistry(); - Experiment details = (Experiment) airavataRegistry.get(RegistryModelType.EXPERIMENT, experimentId); + ExperimentCatalog airavataExperimentCatalog = RegistryFactory.getDefaultRegistry(); + Experiment details = (Experiment) airavataExperimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentId); if (details == null) { details = new Experiment(); details.setExperimentID(experimentId); @@ -707,7 +704,7 @@ public class GFacUtils { } details.setExperimentStatus(status); log.info("Updating the experiment status of experiment: " + experimentId + " to " + status.getExperimentState().toString()); - airavataRegistry.update(RegistryModelType.EXPERIMENT_STATUS, status, experimentId); + airavataExperimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT_STATUS, status, experimentId); return details.getExperimentStatus().getExperimentState(); } http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java index 67c80cf..9b3f5da 100644 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/JobExecutionContext.java @@ -27,8 +27,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.airavata.appcatalog.cpi.AppCatalog; -import org.airavata.appcatalog.cpi.AppCatalogException; +import org.apache.airavata.registry.cpi.AppCatalog; +import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory; import org.apache.airavata.common.utils.MonitorPublisher; import org.apache.airavata.gfac.GFacConfiguration; @@ -41,7 +41,7 @@ import org.apache.airavata.model.workspace.experiment.Experiment; import org.apache.airavata.model.workspace.experiment.JobDetails; import org.apache.airavata.model.workspace.experiment.TaskDetails; import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails; -import org.apache.airavata.registry.cpi.Registry; +import org.apache.airavata.registry.cpi.ExperimentCatalog; import org.apache.curator.framework.CuratorFramework; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -143,7 +143,7 @@ public class JobExecutionContext extends AbstractContext implements Serializable private String gatewayID; private String status; private List<String> outputFileList; - private Registry registry; + private ExperimentCatalog experimentCatalog; private MonitorPublisher monitorPublisher; public String getGatewayID() { @@ -316,16 +316,16 @@ public class JobExecutionContext extends AbstractContext implements Serializable return outputFileList; } - public Registry getRegistry() { - return registry; + public ExperimentCatalog getExperimentCatalog() { + return experimentCatalog; } public Map<String, SecurityContext> getAllSecurityContexts(){ return securityContext; } - public void setRegistry(Registry registry) { - this.registry = registry; + public void setExperimentCatalog(ExperimentCatalog experimentCatalog) { + this.experimentCatalog = experimentCatalog; } public Experiment getExperiment() { http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java index 27bc424..21c5d06 100644 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java @@ -27,8 +27,8 @@ import org.apache.airavata.gfac.core.GFacUtils; import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; import org.apache.airavata.model.messaging.event.TaskIdentifier; import org.apache.airavata.model.messaging.event.TaskOutputChangeEvent; -import org.apache.airavata.experiment.catalog.impl.RegistryFactory; -import org.apache.airavata.registry.cpi.Registry; +import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory; +import org.apache.airavata.registry.cpi.ExperimentCatalog; import org.apache.airavata.registry.cpi.RegistryException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +37,7 @@ import java.util.List; public abstract class AbstractHandler implements GFacHandler { private static final Logger logger = LoggerFactory.getLogger(AbstractHandler.class); - protected Registry registry = null; + protected ExperimentCatalog experimentCatalog = null; protected MonitorPublisher publisher = null; @@ -48,22 +48,22 @@ public abstract class AbstractHandler implements GFacHandler { } catch (Exception e) { logger.error("Error saving Recoverable provider state", e); } - registry = jobExecutionContext.getRegistry(); - if(registry == null){ + experimentCatalog = jobExecutionContext.getExperimentCatalog(); + if(experimentCatalog == null){ try { - registry = RegistryFactory.getDefaultRegistry(); + experimentCatalog = RegistryFactory.getDefaultRegistry(); } catch (RegistryException e) { throw new GFacHandlerException("unable to create registry instance", e); } } } - public Registry getRegistry() { - return registry; + public ExperimentCatalog getExperimentCatalog() { + return experimentCatalog; } - public void setRegistry(Registry registry) { - this.registry = registry; + public void setExperimentCatalog(ExperimentCatalog experimentCatalog) { + this.experimentCatalog = experimentCatalog; } protected void fireTaskOutputChangeEvent(JobExecutionContext jobExecutionContext, List<OutputDataObjectType> outputArray) { http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java index c531cb2..43cf08e 100644 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java @@ -25,8 +25,8 @@ import org.apache.airavata.gfac.GFacException; import org.apache.airavata.gfac.core.context.JobExecutionContext; import org.apache.airavata.model.workspace.experiment.JobDetails; import org.apache.airavata.model.workspace.experiment.JobStatus; -import org.apache.airavata.experiment.catalog.impl.RegistryFactory; -import org.apache.airavata.registry.cpi.Registry; +import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory; +import org.apache.airavata.registry.cpi.ExperimentCatalog; import org.apache.airavata.registry.cpi.RegistryException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,21 +34,21 @@ import org.slf4j.LoggerFactory; public abstract class AbstractProvider implements GFacProvider{ private final Logger log = LoggerFactory.getLogger(this.getClass()); - protected Registry registry = null; + protected ExperimentCatalog experimentCatalog = null; protected JobDetails details; //todo we need to remove this and add methods to fill Job details, this is not a property of a provider protected JobStatus status; //todo we need to remove this and add methods to fill Job details, this is not a property of a provider protected JobExecutionContext jobExecutionContext; public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException { log.debug("Initializing " + this.getClass().getName()); - if(jobExecutionContext.getRegistry() == null) { + if(jobExecutionContext.getExperimentCatalog() == null) { try { - registry = RegistryFactory.getDefaultRegistry(); + experimentCatalog = RegistryFactory.getDefaultRegistry(); } catch (RegistryException e) { throw new GFacException("Unable to create registry instance", e); } }else{ - registry = jobExecutionContext.getRegistry(); + experimentCatalog = jobExecutionContext.getExperimentCatalog(); } details = new JobDetails(); status = new JobStatus(); http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java index 8151647..df91310 100644 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java +++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java @@ -29,7 +29,7 @@ import org.apache.airavata.gfac.gsissh.security.GSISecurityContext; import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils; import org.apache.airavata.gfac.core.cluster.Cluster; import org.apache.airavata.model.workspace.experiment.*; -import org.apache.airavata.registry.cpi.ChildDataType; +import org.apache.airavata.registry.cpi.ExpCatChildDataType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -90,7 +90,7 @@ public class GSISSHDirectorySetupHandler extends AbstractHandler { detail.setTransferStatus(status); detail.setTransferDescription("Working directory = " + workingDirectory); - registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); + experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); } catch (Exception e) { DataTransferDetails detail = new DataTransferDetails(); @@ -99,7 +99,7 @@ public class GSISSHDirectorySetupHandler extends AbstractHandler { status.setTransferState(TransferState.FAILED); detail.setTransferStatus(status); try { - registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); + experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); GFacUtils.saveErrorDetails(jobExecutionContext, e.getCause().toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE); } catch (Exception e1) { throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage()); http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java index 72f738f..014ad65 100644 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java +++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java @@ -37,7 +37,7 @@ import org.apache.airavata.model.workspace.experiment.DataTransferDetails; import org.apache.airavata.model.workspace.experiment.ErrorCategory; import org.apache.airavata.model.workspace.experiment.TransferState; import org.apache.airavata.model.workspace.experiment.TransferStatus; -import org.apache.airavata.registry.cpi.ChildDataType; +import org.apache.airavata.registry.cpi.ExpCatChildDataType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -129,7 +129,7 @@ public class GSISSHInputHandler extends AbstractHandler { status.setTransferState(TransferState.UPLOAD); detail.setTransferStatus(status); detail.setTransferDescription("Input Data Staged: " + stageInputFile); - registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); + experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); GFacUtils.saveHandlerData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName()); } @@ -165,7 +165,7 @@ public class GSISSHInputHandler extends AbstractHandler { detail.setTransferStatus(status); try { GFacUtils.saveErrorDetails(jobExecutionContext, e.getCause().toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE); - registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); + experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); } catch (Exception e1) { throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage()); } http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java index 4ad4ae5..a7cb806 100644 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java +++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java @@ -40,7 +40,7 @@ import org.apache.airavata.model.workspace.experiment.ErrorCategory; import org.apache.airavata.model.workspace.experiment.TaskDetails; import org.apache.airavata.model.workspace.experiment.TransferState; import org.apache.airavata.model.workspace.experiment.TransferStatus; -import org.apache.airavata.registry.cpi.ChildDataType; +import org.apache.airavata.registry.cpi.ExpCatChildDataType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -159,12 +159,12 @@ public class GSISSHOutputHandler extends AbstractHandler { status.setTransferState(TransferState.STDOUT_DOWNLOAD); detail.setTransferStatus(status); detail.setTransferDescription("STDOUT:" + localStdOutFile.getAbsolutePath()); - registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); + experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); status.setTransferState(TransferState.STDERROR_DOWNLOAD); detail.setTransferStatus(status); detail.setTransferDescription("STDERR:" + localStdErrFile.getAbsolutePath()); - registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); + experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); //todo this is a mess we have to fix this List<OutputDataObjectType> outputArray = new ArrayList<OutputDataObjectType>(); @@ -296,15 +296,15 @@ public class GSISSHOutputHandler extends AbstractHandler { status.setTransferState(TransferState.DOWNLOAD); detail.setTransferStatus(status); detail.setTransferDescription(outputDataDir); - registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); - registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID()); + experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); + experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID()); fireTaskOutputChangeEvent(jobExecutionContext, outputArray); } catch (Exception e) { try { status.setTransferState(TransferState.FAILED); detail.setTransferStatus(status); detail.setTransferDescription(e.getLocalizedMessage()); - registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); + experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); GFacUtils.saveErrorDetails(jobExecutionContext, e.getCause().toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE); } catch (Exception e1) { throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage()); http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java index 03ebb94..f8a6439 100644 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java +++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java @@ -16,7 +16,7 @@ import org.apache.airavata.gfac.core.cluster.Cluster; import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; import org.apache.airavata.model.workspace.experiment.CorrectiveAction; import org.apache.airavata.model.workspace.experiment.ErrorCategory; -import org.apache.airavata.registry.cpi.ChildDataType; +import org.apache.airavata.registry.cpi.ExpCatChildDataType; import org.apache.airavata.registry.cpi.RegistryException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +63,7 @@ public class NewGSISSHOutputHandler extends AbstractHandler{ super.invoke(jobExecutionContext); List<OutputDataObjectType> outputArray = HandleOutputs.handleOutputs(jobExecutionContext, cluster); try { - registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID()); + experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID()); } catch (RegistryException e) { throw new GFacHandlerException(e); } http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java index 1578b9d..ce7fec8 100644 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java +++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java @@ -20,7 +20,7 @@ */ package org.apache.airavata.gfac.gsissh.provider.impl; -import org.airavata.appcatalog.cpi.AppCatalogException; +import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.common.exception.AiravataException; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.gfac.GFacException; http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java index 3a9e83e..622e660 100644 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java +++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java @@ -20,7 +20,7 @@ */ package org.apache.airavata.gfac.gsissh.util; -import org.airavata.appcatalog.cpi.AppCatalog; +import org.apache.airavata.registry.cpi.AppCatalog; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
