Initial commit of container based task execution workflow on top of Kubernetes 8/head
authordimuthu.upeksha2@gmail.com <Dimu@1234>
Tue, 31 Oct 2017 21:17:50 +0000 (02:47 +0530)
committerdimuthu.upeksha2@gmail.com <Dimu@1234>
Tue, 31 Oct 2017 21:17:55 +0000 (02:47 +0530)
246 files changed:
airavata-kubernetes/Design Document.pdf [new file with mode: 0644]
airavata-kubernetes/User Guide.pdf [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationDeploymentResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationIfaceResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationInputResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationModuleResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationOutputResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/compute/ComputeResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/data/DataEntryResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentInputResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentOutputResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentStatusResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/process/ProcessResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/process/ProcessStatusResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/task/TaskParamResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/task/TaskResource.java [new file with mode: 0644]
airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/task/TaskStatusResource.java [new file with mode: 0644]
airavata-kubernetes/modules/compute-resource-api/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/api/ComputeOperations.java [new file with mode: 0644]
airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/api/ExecutionResult.java [new file with mode: 0644]
airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/impl/MockComputeOperation.java [new file with mode: 0644]
airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/impl/SSHComputeOperations.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/Application.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/ServerRuntimeException.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ApplicationDeploymentController.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ApplicationInterfaceController.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ApplicationModuleController.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ComputeResourceController.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/DataStoreController.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ExperimentController.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ProcessController.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/TaskController.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationDeployment.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationInput.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationInterface.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationModule.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationOutput.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/commons/ErrorModel.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/compute/ComputeResourceModel.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/data/DataStoreModel.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/Experiment.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/ExperimentInputData.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/ExperimentOutputData.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/ExperimentStatus.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/job/JobModel.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/job/JobStatus.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/process/ProcessModel.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/process/ProcessStatus.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/task/TaskModel.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/task/TaskParam.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/task/TaskStatus.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationDeploymentRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationIfaceRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationInputRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationModuleRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationOutputRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ComputeRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/DataStoreRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentInputDataRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentOutputDataRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentStatusRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ProcessRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ProcessStatusRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/TaskParamRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/TaskRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/TaskStatusRepository.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ApplicationDeploymentService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ApplicationIfaceService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ApplicationModuleService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ComputeResourceService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ExperimentService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ProcessService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/TaskService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/data/DataStoreService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/messaging/MessagingService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/messaging/SenderConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/util/ToResourceUtil.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/resources/application.properties [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/resources/application.yml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/api-server/src/main/resources/docker/Dockerfile [new file with mode: 0644]
airavata-kubernetes/modules/microservices/event-sink/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/event-sink/src/main/java/org/apache/airavata/k8s/sink/Application.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/event-sink/src/main/java/org/apache/airavata/k8s/sink/messaging/KafkaReceiver.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/event-sink/src/main/java/org/apache/airavata/k8s/sink/messaging/KafkaSender.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/event-sink/src/main/java/org/apache/airavata/k8s/sink/messaging/ReceiverConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/event-sink/src/main/java/org/apache/airavata/k8s/sink/messaging/SenderConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/event-sink/src/main/java/org/apache/airavata/k8s/sink/service/EventPersistingService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/event-sink/src/main/resources/application.properties [new file with mode: 0644]
airavata-kubernetes/modules/microservices/event-sink/src/main/resources/application.yml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/task-scheduler/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/Application.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/core/ProcessLifeCycleManager.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/messaging/KafkaReceiver.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/messaging/KafkaSender.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/messaging/ReceiverConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/messaging/SenderConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/service/WorkerService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/task-scheduler/src/main/resources/application.properties [new file with mode: 0644]
airavata-kubernetes/modules/microservices/task-scheduler/src/main/resources/application.yml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/egress-staging-task/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/egress-staging-task/src/main/java/org/apacher/airavata/k8s/task/egress/Application.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/egress-staging-task/src/main/java/org/apacher/airavata/k8s/task/egress/messaging/KafkaReceiver.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/egress-staging-task/src/main/java/org/apacher/airavata/k8s/task/egress/messaging/KafkaSender.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/egress-staging-task/src/main/java/org/apacher/airavata/k8s/task/egress/messaging/ReceiverConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/egress-staging-task/src/main/java/org/apacher/airavata/k8s/task/egress/messaging/SenderConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/egress-staging-task/src/main/java/org/apacher/airavata/k8s/task/egress/service/TaskExecutionService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/egress-staging-task/src/main/resources/application.properties [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/egress-staging-task/src/main/resources/application.yml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-cleanup-task/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-cleanup-task/src/main/java/org/apache/airavata/k8s/task/cleanup/Application.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-cleanup-task/src/main/java/org/apache/airavata/k8s/task/cleanup/messaging/KafkaReceiver.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-cleanup-task/src/main/java/org/apache/airavata/k8s/task/cleanup/messaging/KafkaSender.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-cleanup-task/src/main/java/org/apache/airavata/k8s/task/cleanup/messaging/ReceiverConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-cleanup-task/src/main/java/org/apache/airavata/k8s/task/cleanup/messaging/SenderConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-cleanup-task/src/main/java/org/apache/airavata/k8s/task/cleanup/service/TaskExecutionService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-cleanup-task/src/main/resources/application.properties [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-cleanup-task/src/main/resources/application.yml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-setup-task/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-setup-task/src/main/java/org/apache/airavata/k8s/task/env/setup/Application.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-setup-task/src/main/java/org/apache/airavata/k8s/task/env/setup/messaging/KafkaReceiver.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-setup-task/src/main/java/org/apache/airavata/k8s/task/env/setup/messaging/KafkaSender.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-setup-task/src/main/java/org/apache/airavata/k8s/task/env/setup/messaging/ReceiverConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-setup-task/src/main/java/org/apache/airavata/k8s/task/env/setup/messaging/SenderConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-setup-task/src/main/java/org/apache/airavata/k8s/task/env/setup/service/TaskExecutionService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-setup-task/src/main/resources/application.properties [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/env-setup-task/src/main/resources/application.yml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/ingress-staging-task/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/ingress-staging-task/src/main/java/org/apache/airavata/k8s/task/ingress/Application.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/ingress-staging-task/src/main/java/org/apache/airavata/k8s/task/ingress/messaging/KafkaReceiver.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/ingress-staging-task/src/main/java/org/apache/airavata/k8s/task/ingress/messaging/KafkaSender.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/ingress-staging-task/src/main/java/org/apache/airavata/k8s/task/ingress/messaging/ReceiverConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/ingress-staging-task/src/main/java/org/apache/airavata/k8s/task/ingress/messaging/SenderConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/ingress-staging-task/src/main/java/org/apache/airavata/k8s/task/ingress/service/TaskExecutionService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/ingress-staging-task/src/main/resources/application.properties [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/ingress-staging-task/src/main/resources/application.yml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/job-submission-task/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/job-submission-task/src/main/java/org/apache/airavata/k8s/task/job/Application.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/job-submission-task/src/main/java/org/apache/airavata/k8s/task/job/messaging/KafkaReceiver.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/job-submission-task/src/main/java/org/apache/airavata/k8s/task/job/messaging/KafkaSender.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/job-submission-task/src/main/java/org/apache/airavata/k8s/task/job/messaging/ReceiverConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/job-submission-task/src/main/java/org/apache/airavata/k8s/task/job/messaging/SenderConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/job-submission-task/src/main/java/org/apache/airavata/k8s/task/job/service/TaskExecutionService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/job-submission-task/src/main/resources/application.properties [new file with mode: 0644]
airavata-kubernetes/modules/microservices/tasks/job-submission-task/src/main/resources/application.yml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/workflow-generator/pom.xml [new file with mode: 0644]
airavata-kubernetes/modules/microservices/workflow-generator/src/main/java/org/apache/airavata/k8s/orchestrator/Application.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/workflow-generator/src/main/java/org/apache/airavata/k8s/orchestrator/messaging/KafkaReceiver.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/workflow-generator/src/main/java/org/apache/airavata/k8s/orchestrator/messaging/KafkaSender.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/workflow-generator/src/main/java/org/apache/airavata/k8s/orchestrator/messaging/ReceiverConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/workflow-generator/src/main/java/org/apache/airavata/k8s/orchestrator/messaging/SenderConfig.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/workflow-generator/src/main/java/org/apache/airavata/k8s/orchestrator/service/ExperimentLaunchService.java [new file with mode: 0644]
airavata-kubernetes/modules/microservices/workflow-generator/src/main/resources/application.properties [new file with mode: 0644]
airavata-kubernetes/modules/microservices/workflow-generator/src/main/resources/application.yml [new file with mode: 0644]
airavata-kubernetes/pom.xml [new file with mode: 0644]
airavata-kubernetes/readme.txt [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/api-server/api-server-dep.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/api-server/api-server-svc.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/db-service.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/event-sink/event-sink-dep.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/kafka-service.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/task-scheduler/task-secheduler-dep.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/tasks/egress-staging-task/egress-staging-task-dep.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/tasks/env-cleanup-task/env-cleanup-task-dep.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/tasks/env-setup-task/env-setup-task-dep.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/tasks/ingress-staging-task/ingress-staging-task-dep.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/tasks/job-submission-task/job-submission-task-dep.yml [new file with mode: 0644]
airavata-kubernetes/scripts/k8s/workflow-generator/workflow-generator-dep.yml [new file with mode: 0644]
airavata-kubernetes/web-console/.angular-cli.json [new file with mode: 0644]
airavata-kubernetes/web-console/.editorconfig [new file with mode: 0644]
airavata-kubernetes/web-console/.gitignore [new file with mode: 0644]
airavata-kubernetes/web-console/README.md [new file with mode: 0644]
airavata-kubernetes/web-console/docker/Dockerfile [new file with mode: 0644]
airavata-kubernetes/web-console/e2e/app.e2e-spec.ts [new file with mode: 0644]
airavata-kubernetes/web-console/e2e/app.po.ts [new file with mode: 0644]
airavata-kubernetes/web-console/e2e/tsconfig.e2e.json [new file with mode: 0644]
airavata-kubernetes/web-console/karma.conf.js [new file with mode: 0644]
airavata-kubernetes/web-console/package-lock.json [new file with mode: 0644]
airavata-kubernetes/web-console/package.json [new file with mode: 0644]
airavata-kubernetes/web-console/protractor.conf.js [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/app.component.css [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/app.component.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/app.component.spec.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/app.component.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/app.module.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/app.routing.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/app-dep/list/app.dep.list.component.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/app-dep/list/list.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/app-iface/list/app.iface.list.component.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/app-iface/list/list.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/app-module/list/app.module.list.component.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/app-module/list/list.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/compute/list/compute.list.component.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/compute/list/list.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/dashboard/dashboard.component.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/dashboard/dashboard.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/dashboard/dashboard.routes.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/experiment/detail/detail.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/experiment/detail/experiment.detail.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/experiment/list/experiment.list.component.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/experiment/list/list.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/process/detail/detail.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/process/detail/process.detail.component.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/setup/setup.component.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/components/setup/setup.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/application/application.deployment.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/application/application.iface.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/application/application.ipnput.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/application/application.module.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/application/application.output.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/compute/compute.resource.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/data/data.entry.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/experiment/experiment.input.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/experiment/experiment.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/experiment/experiment.output.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/experiment/experiment.status.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/process/process.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/process/process.status.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/task/task.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/task/task.param.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/models/task/task.status.model.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/services/api.service.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/services/app.module.service.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/services/application.iface.service.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/services/compute.service.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/services/deployment.service.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/services/experiment.service.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/services/process.service.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/app/services/task.service.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/assets/.gitkeep [new file with mode: 0644]
airavata-kubernetes/web-console/src/environments/environment.prod.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/environments/environment.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/favicon.ico [new file with mode: 0644]
airavata-kubernetes/web-console/src/index.html [new file with mode: 0644]
airavata-kubernetes/web-console/src/main.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/polyfills.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/styles.css [new file with mode: 0644]
airavata-kubernetes/web-console/src/test.ts [new file with mode: 0644]
airavata-kubernetes/web-console/src/tsconfig.app.json [new file with mode: 0644]
airavata-kubernetes/web-console/src/tsconfig.spec.json [new file with mode: 0644]
airavata-kubernetes/web-console/src/typings.d.ts [new file with mode: 0644]
airavata-kubernetes/web-console/tsconfig.json [new file with mode: 0644]
airavata-kubernetes/web-console/tslint.json [new file with mode: 0644]

diff --git a/airavata-kubernetes/Design Document.pdf b/airavata-kubernetes/Design Document.pdf
new file mode 100644 (file)
index 0000000..aac8cf2
Binary files /dev/null and b/airavata-kubernetes/Design Document.pdf differ
diff --git a/airavata-kubernetes/User Guide.pdf b/airavata-kubernetes/User Guide.pdf
new file mode 100644 (file)
index 0000000..80ca6c2
Binary files /dev/null and b/airavata-kubernetes/User Guide.pdf differ
diff --git a/airavata-kubernetes/modules/api-resource/pom.xml b/airavata-kubernetes/modules/api-resource/pom.xml
new file mode 100644 (file)
index 0000000..e0e879e
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>airavata-kubernetes</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>api-resource</artifactId>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.5.1</version>
+                <configuration>
+                    <source>${java.version}</source>
+                    <target>${java.version}</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationDeploymentResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationDeploymentResource.java
new file mode 100644 (file)
index 0000000..3d1bb51
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ *
+ * 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.k8s.api.resources.application;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ApplicationDeploymentResource {
+
+    private long id;
+    private String name;
+    private long applicationModuleId;
+    private long computeResourceId;
+    private String executablePath;
+    private String preJobCommand;
+    private String postJobCommand;
+
+    public long getId() {
+        return id;
+    }
+
+    public ApplicationDeploymentResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public long getApplicationModuleId() {
+        return applicationModuleId;
+    }
+
+    public ApplicationDeploymentResource setApplicationModuleId(long applicationModuleId) {
+        this.applicationModuleId = applicationModuleId;
+        return this;
+    }
+
+    public long getComputeResourceId() {
+        return computeResourceId;
+    }
+
+    public ApplicationDeploymentResource setComputeResourceId(long computeResourceId) {
+        this.computeResourceId = computeResourceId;
+        return this;
+    }
+
+    public String getExecutablePath() {
+        return executablePath;
+    }
+
+    public ApplicationDeploymentResource setExecutablePath(String executablePath) {
+        this.executablePath = executablePath;
+        return this;
+    }
+
+    public String getPreJobCommand() {
+        return preJobCommand;
+    }
+
+    public ApplicationDeploymentResource setPreJobCommand(String preJobCommand) {
+        this.preJobCommand = preJobCommand;
+        return this;
+    }
+
+    public String getPostJobCommand() {
+        return postJobCommand;
+    }
+
+    public ApplicationDeploymentResource setPostJobCommand(String postJobCommand) {
+        this.postJobCommand = postJobCommand;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ApplicationDeploymentResource setName(String name) {
+        this.name = name;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationIfaceResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationIfaceResource.java
new file mode 100644 (file)
index 0000000..2a42f9d
--- /dev/null
@@ -0,0 +1,92 @@
+/**
+ *
+ * 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.k8s.api.resources.application;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ApplicationIfaceResource {
+    private long id;
+    private String name;
+    private String description;
+    private long applicationModuleId;
+    private List<ApplicationInputResource> inputs = new ArrayList<>();
+    private List<ApplicationOutputResource> outputs = new ArrayList<>();
+
+    public long getId() {
+        return id;
+    }
+
+    public ApplicationIfaceResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ApplicationIfaceResource setName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public ApplicationIfaceResource setDescription(String description) {
+        this.description = description;
+        return this;
+    }
+
+    public long getApplicationModuleId() {
+        return applicationModuleId;
+    }
+
+    public ApplicationIfaceResource setApplicationModuleId(long applicationModuleId) {
+        this.applicationModuleId = applicationModuleId;
+        return this;
+    }
+
+    public List<ApplicationInputResource> getInputs() {
+        return inputs;
+    }
+
+    public ApplicationIfaceResource setInputs(List<ApplicationInputResource> inputs) {
+        this.inputs = inputs;
+        return this;
+    }
+
+    public List<ApplicationOutputResource> getOutputs() {
+        return outputs;
+    }
+
+    public ApplicationIfaceResource setOutputs(List<ApplicationOutputResource> outputs) {
+        this.outputs = outputs;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationInputResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationInputResource.java
new file mode 100644 (file)
index 0000000..60bffd2
--- /dev/null
@@ -0,0 +1,79 @@
+/**
+ *
+ * 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.k8s.api.resources.application;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ApplicationInputResource {
+
+    private long id;
+    private String name;
+    private int type;
+    private String value;
+    private String arguments;
+
+    public long getId() {
+        return id;
+    }
+
+    public ApplicationInputResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ApplicationInputResource setName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public ApplicationInputResource setValue(String value) {
+        this.value = value;
+        return this;
+    }
+
+    public String getArguments() {
+        return arguments;
+    }
+
+    public ApplicationInputResource setArguments(String arguments) {
+        this.arguments = arguments;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationModuleResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationModuleResource.java
new file mode 100644 (file)
index 0000000..59de417
--- /dev/null
@@ -0,0 +1,70 @@
+/**
+ *
+ * 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.k8s.api.resources.application;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ApplicationModuleResource {
+
+    private long id;
+    private String name;
+    private String version;
+    private String description;
+
+    public long getId() {
+        return id;
+    }
+
+    public ApplicationModuleResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ApplicationModuleResource setName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public ApplicationModuleResource setVersion(String version) {
+        this.version = version;
+        return this;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public ApplicationModuleResource setDescription(String description) {
+        this.description = description;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationOutputResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/application/ApplicationOutputResource.java
new file mode 100644 (file)
index 0000000..20d385f
--- /dev/null
@@ -0,0 +1,68 @@
+/**
+ *
+ * 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.k8s.api.resources.application;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ApplicationOutputResource {
+    private long id;
+    private String name;
+    private int type;
+    private String value;
+
+    public long getId() {
+        return id;
+    }
+
+    public ApplicationOutputResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ApplicationOutputResource setName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public ApplicationOutputResource setValue(String value) {
+        this.value = value;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/compute/ComputeResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/compute/ComputeResource.java
new file mode 100644 (file)
index 0000000..b4d3eee
--- /dev/null
@@ -0,0 +1,90 @@
+/**
+ *
+ * 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.k8s.api.resources.compute;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ComputeResource {
+
+    private long id;
+    private String name;
+    private String host;
+    private String userName;
+    private String password;
+    private String communicationType;
+
+    public long getId() {
+        return id;
+    }
+
+    public ComputeResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ComputeResource setName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public ComputeResource setHost(String host) {
+        this.host = host;
+        return this;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public ComputeResource setUserName(String userName) {
+        this.userName = userName;
+        return this;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public ComputeResource setPassword(String password) {
+        this.password = password;
+        return this;
+    }
+
+    public String getCommunicationType() {
+        return communicationType;
+    }
+
+    public ComputeResource setCommunicationType(String communicationType) {
+        this.communicationType = communicationType;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/data/DataEntryResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/data/DataEntryResource.java
new file mode 100644 (file)
index 0000000..912e7a2
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ *
+ * 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.k8s.api.resources.data;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class DataEntryResource {
+
+    private long id;
+    private String dataType;
+    private String name;
+
+    public long getId() {
+        return id;
+    }
+
+    public DataEntryResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getDataType() {
+        return dataType;
+    }
+
+    public DataEntryResource setDataType(String dataType) {
+        this.dataType = dataType;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public DataEntryResource setName(String name) {
+        this.name = name;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentInputResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentInputResource.java
new file mode 100644 (file)
index 0000000..dbaecad
--- /dev/null
@@ -0,0 +1,90 @@
+/**
+ *
+ * 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.k8s.api.resources.experiment;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ExperimentInputResource {
+
+    private long id;
+    private String name;
+    private int type;
+    private String value;
+    private String arguments;
+
+    public long getId() {
+        return id;
+    }
+
+    public ExperimentInputResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ExperimentInputResource setName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public ExperimentInputResource setType(int type) {
+        this.type = type;
+        return this;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public ExperimentInputResource setValue(String value) {
+        this.value = value;
+        return this;
+    }
+
+    public String getArguments() {
+        return arguments;
+    }
+
+    public ExperimentInputResource setArguments(String arguments) {
+        this.arguments = arguments;
+        return this;
+    }
+
+    public static final class Types {
+        public static final int STRING = 0;
+        public static final int INTEGER = 1;
+        public static final int FLOAT = 2;
+        public static final int URI = 3;
+        public static final int URI_COLLECTION = 4;
+        public static final int STDOUT = 5;
+        public static final int STDERR = 6;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentOutputResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentOutputResource.java
new file mode 100644 (file)
index 0000000..3c3fa59
--- /dev/null
@@ -0,0 +1,80 @@
+/**
+ *
+ * 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.k8s.api.resources.experiment;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ExperimentOutputResource {
+
+    private long id;
+    private String name;
+    private String value;
+    private int type;
+
+    public long getId() {
+        return id;
+    }
+
+    public ExperimentOutputResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ExperimentOutputResource setName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public ExperimentOutputResource setValue(String value) {
+        this.value = value;
+        return this;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public ExperimentOutputResource setType(int type) {
+        this.type = type;
+        return this;
+    }
+
+    public static final class Types {
+        public static final int STRING = 0;
+        public static final int INTEGER = 1;
+        public static final int FLOAT = 2;
+        public static final int URI = 3;
+        public static final int URI_COLLECTION = 4;
+        public static final int STDOUT = 5;
+        public static final int STDERR = 6;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentResource.java
new file mode 100644 (file)
index 0000000..7c8ab73
--- /dev/null
@@ -0,0 +1,168 @@
+/**
+ *
+ * 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.k8s.api.resources.experiment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ExperimentResource {
+
+    private long id;
+    private String experimentName;
+    private long creationTime;
+    private String description;
+    private long applicationInterfaceId;
+    private String applicationInterfaceName;
+    private long applicationDeploymentId;
+    private String applicationDeploymentName;
+
+    private List<ExperimentInputResource> experimentInputs = new ArrayList<>();
+
+    private List<ExperimentOutputResource> experimentOutputs = new ArrayList<>();
+
+    private List<ExperimentStatusResource> experimentStatus = new ArrayList<>();
+
+    private List<Long> errorsIds = new ArrayList<>();
+
+    private List<Long> processIds = new ArrayList<>();
+
+    public long getId() {
+        return id;
+    }
+
+    public ExperimentResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getExperimentName() {
+        return experimentName;
+    }
+
+    public ExperimentResource setExperimentName(String experimentName) {
+        this.experimentName = experimentName;
+        return this;
+    }
+
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public ExperimentResource setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+        return this;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public ExperimentResource setDescription(String description) {
+        this.description = description;
+        return this;
+    }
+
+    public long getApplicationInterfaceId() {
+        return applicationInterfaceId;
+    }
+
+    public ExperimentResource setApplicationInterfaceId(long applicationInterfaceId) {
+        this.applicationInterfaceId = applicationInterfaceId;
+        return this;
+    }
+
+    public long getApplicationDeploymentId() {
+        return applicationDeploymentId;
+    }
+
+    public ExperimentResource setApplicationDeploymentId(long applicationDeploymentId) {
+        this.applicationDeploymentId = applicationDeploymentId;
+        return this;
+    }
+
+    public List<ExperimentInputResource> getExperimentInputs() {
+        return experimentInputs;
+    }
+
+    public ExperimentResource setExperimentInputs(List<ExperimentInputResource> experimentInputs) {
+        this.experimentInputs = experimentInputs;
+        return this;
+    }
+
+    public List<ExperimentOutputResource> getExperimentOutputs() {
+        return experimentOutputs;
+    }
+
+    public ExperimentResource setExperimentOutputs(List<ExperimentOutputResource> experimentOutputs) {
+        this.experimentOutputs = experimentOutputs;
+        return this;
+    }
+
+    public List<ExperimentStatusResource> getExperimentStatus() {
+        return experimentStatus;
+    }
+
+    public ExperimentResource setExperimentStatus(List<ExperimentStatusResource> experimentStatus) {
+        this.experimentStatus = experimentStatus;
+        return this;
+    }
+
+    public List<Long> getErrorsIds() {
+        return errorsIds;
+    }
+
+    public ExperimentResource setErrorsIds(List<Long> errorsIds) {
+        this.errorsIds = errorsIds;
+        return this;
+    }
+
+    public List<Long> getProcessIds() {
+        return processIds;
+    }
+
+    public ExperimentResource setProcessIds(List<Long> processIds) {
+        this.processIds = processIds;
+        return this;
+    }
+
+    public String getApplicationInterfaceName() {
+        return applicationInterfaceName;
+    }
+
+    public ExperimentResource setApplicationInterfaceName(String applicationInterfaceName) {
+        this.applicationInterfaceName = applicationInterfaceName;
+        return this;
+    }
+
+    public String getApplicationDeploymentName() {
+        return applicationDeploymentName;
+    }
+
+    public ExperimentResource setApplicationDeploymentName(String applicationDeploymentName) {
+        this.applicationDeploymentName = applicationDeploymentName;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentStatusResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/experiment/ExperimentStatusResource.java
new file mode 100644 (file)
index 0000000..aa605b2
--- /dev/null
@@ -0,0 +1,79 @@
+/**
+ *
+ * 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.k8s.api.resources.experiment;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ExperimentStatusResource {
+    private long id;
+    private int state;
+    private String stateStr;
+    private long timeOfStateChange;
+    private String reason;
+
+    public long getId() {
+        return id;
+    }
+
+    public ExperimentStatusResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public int getState() {
+        return state;
+    }
+
+    public ExperimentStatusResource setState(int state) {
+        this.state = state;
+        return this;
+    }
+
+    public String getStateStr() {
+        return stateStr;
+    }
+
+    public ExperimentStatusResource setStateStr(String stateStr) {
+        this.stateStr = stateStr;
+        return this;
+    }
+
+    public long getTimeOfStateChange() {
+        return timeOfStateChange;
+    }
+
+    public ExperimentStatusResource setTimeOfStateChange(long timeOfStateChange) {
+        this.timeOfStateChange = timeOfStateChange;
+        return this;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public ExperimentStatusResource setReason(String reason) {
+        this.reason = reason;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/process/ProcessResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/process/ProcessResource.java
new file mode 100644 (file)
index 0000000..8805e74
--- /dev/null
@@ -0,0 +1,125 @@
+/**
+ *
+ * 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.k8s.api.resources.process;
+
+import org.apache.airavata.k8s.api.resources.task.TaskResource;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ProcessResource {
+
+    private long id;
+    private long experimentId;
+    private long creationTime;
+    private long lastUpdateTime;
+    private List<ProcessStatusResource> processStatuses = new ArrayList<>();
+    private List<TaskResource> tasks = new ArrayList<>();
+    private List<Long> processErrorIds = new ArrayList<>();
+    private String taskDag;
+    private String experimentDataDir;
+
+    public long getId() {
+        return id;
+    }
+
+    public ProcessResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public long getExperimentId() {
+        return experimentId;
+    }
+
+    public ProcessResource setExperimentId(long experimentId) {
+        this.experimentId = experimentId;
+        return this;
+    }
+
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public ProcessResource setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+        return this;
+    }
+
+    public long getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+
+    public ProcessResource setLastUpdateTime(long lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+        return this;
+    }
+
+    public List<ProcessStatusResource> getProcessStatuses() {
+        return processStatuses;
+    }
+
+    public ProcessResource setProcessStatuses(List<ProcessStatusResource> processStatuses) {
+        this.processStatuses = processStatuses;
+        return this;
+    }
+
+    public List<TaskResource> getTasks() {
+        return tasks;
+    }
+
+    public ProcessResource setTasks(List<TaskResource> tasks) {
+        this.tasks = tasks;
+        return this;
+    }
+
+    public String getTaskDag() {
+        return taskDag;
+    }
+
+    public ProcessResource setTaskDag(String taskDag) {
+        this.taskDag = taskDag;
+        return this;
+    }
+
+    public List<Long> getProcessErrorIds() {
+        return processErrorIds;
+    }
+
+    public ProcessResource setProcessErrorIds(List<Long> processErrorIds) {
+        this.processErrorIds = processErrorIds;
+        return this;
+    }
+
+    public String getExperimentDataDir() {
+        return experimentDataDir;
+    }
+
+    public ProcessResource setExperimentDataDir(String experimentDataDir) {
+        this.experimentDataDir = experimentDataDir;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/process/ProcessStatusResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/process/ProcessStatusResource.java
new file mode 100644 (file)
index 0000000..cfaa212
--- /dev/null
@@ -0,0 +1,107 @@
+/**
+ *
+ * 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.k8s.api.resources.process;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ProcessStatusResource {
+
+    private long id;
+    private int state;
+    private String stateStr;
+    private long timeOfStateChange;
+    private String reason;
+    private long processId;
+
+    public long getId() {
+        return id;
+    }
+
+    public ProcessStatusResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public int getState() {
+        return state;
+    }
+
+    public ProcessStatusResource setState(int state) {
+        this.state = state;
+        return this;
+    }
+
+    public long getTimeOfStateChange() {
+        return timeOfStateChange;
+    }
+
+    public ProcessStatusResource setTimeOfStateChange(long timeOfStateChange) {
+        this.timeOfStateChange = timeOfStateChange;
+        return this;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public ProcessStatusResource setReason(String reason) {
+        this.reason = reason;
+        return this;
+    }
+
+    public long getProcessId() {
+        return processId;
+    }
+
+    public ProcessStatusResource setProcessId(long processId) {
+        this.processId = processId;
+        return this;
+    }
+
+    public String getStateStr() {
+        return stateStr;
+    }
+
+    public ProcessStatusResource setStateStr(String stateStr) {
+        this.stateStr = stateStr;
+        return this;
+    }
+
+    public static final class State {
+        public static final int CREATED = 0;
+        public static final int VALIDATED = 1;
+        public static final int STARTED = 2;
+        public static final int PRE_PROCESSING = 3;
+        public static final int CONFIGURING_WORKSPACE = 4;
+        public static final int INPUT_DATA_STAGING = 5;
+        public static final int EXECUTING = 6;
+        public static final int MONITORING = 7;
+        public static final int OUTPUT_DATA_STAGING = 8;
+        public static final int POST_PROCESSING = 9;
+        public static final int COMPLETED = 10;
+        public static final int FAILED = 11;
+        public static final int CANCELLING = 12;
+        public static final int CANCELED = 13;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/task/TaskParamResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/task/TaskParamResource.java
new file mode 100644 (file)
index 0000000..033e367
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ *
+ * 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.k8s.api.resources.task;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class TaskParamResource {
+
+    private long id;
+    private String key;
+    private String value;
+
+    public long getId() {
+        return id;
+    }
+
+    public TaskParamResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public TaskParamResource setKey(String key) {
+        this.key = key;
+        return this;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public TaskParamResource setValue(String value) {
+        this.value = value;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/task/TaskResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/task/TaskResource.java
new file mode 100644 (file)
index 0000000..10948f7
--- /dev/null
@@ -0,0 +1,163 @@
+/**
+ *
+ * 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.k8s.api.resources.task;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class TaskResource {
+
+    private long id;
+    private int taskType;
+    private String taskTypeStr;
+    private long parentProcessId;
+    private long creationTime;
+    private long lastUpdateTime;
+    private List<TaskStatusResource> taskStatus = new ArrayList<>();
+    private String taskDetail;
+    private List<Long> taskErrorIds = new ArrayList<>();
+    private List<TaskParamResource> taskParams = new ArrayList<>();
+    private List<Long> jobIds;
+    private int order;
+
+    public long getId() {
+        return id;
+    }
+
+    public TaskResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public int getTaskType() {
+        return taskType;
+    }
+
+    public TaskResource setTaskType(int taskType) {
+        this.taskType = taskType;
+        return this;
+    }
+
+    public long getParentProcessId() {
+        return parentProcessId;
+    }
+
+    public TaskResource setParentProcessId(long parentProcessId) {
+        this.parentProcessId = parentProcessId;
+        return this;
+    }
+
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public TaskResource setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+        return this;
+    }
+
+    public long getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+
+    public TaskResource setLastUpdateTime(long lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+        return this;
+    }
+
+    public List<TaskStatusResource> getTaskStatus() {
+        return taskStatus;
+    }
+
+    public TaskResource setTaskStatus(List<TaskStatusResource> taskStatus) {
+        this.taskStatus = taskStatus;
+        return this;
+    }
+
+    public String getTaskDetail() {
+        return taskDetail;
+    }
+
+    public TaskResource setTaskDetail(String taskDetail) {
+        this.taskDetail = taskDetail;
+        return this;
+    }
+
+    public List<Long> getTaskErrorIds() {
+        return taskErrorIds;
+    }
+
+    public TaskResource setTaskErrorIds(List<Long> taskErrorIds) {
+        this.taskErrorIds = taskErrorIds;
+        return this;
+    }
+
+    public List<Long> getJobIds() {
+        return jobIds;
+    }
+
+    public TaskResource setJobIds(List<Long> jobIds) {
+        this.jobIds = jobIds;
+        return this;
+    }
+
+    public List<TaskParamResource> getTaskParams() {
+        return taskParams;
+    }
+
+    public TaskResource setTaskParams(List<TaskParamResource> taskParams) {
+        this.taskParams = taskParams;
+        return this;
+    }
+
+    public String getTaskTypeStr() {
+        return taskTypeStr;
+    }
+
+    public TaskResource setTaskTypeStr(String taskTypeStr) {
+        this.taskTypeStr = taskTypeStr;
+        return this;
+    }
+
+    public int getOrder() {
+        return order;
+    }
+
+    public TaskResource setOrder(int order) {
+        this.order = order;
+        return this;
+    }
+
+    public static final class TaskTypes {
+        public static final int ENV_SETUP = 0;
+        public static final int INGRESS_DATA_STAGING = 1;
+        public static final int EGRESS_DATA_STAGING = 2;
+        public static final int JOB_SUBMISSION = 3;
+        public static final int ENV_CLEANUP = 4;
+        public static final int MONITORING = 5;
+        public static final int OUTPUT_FETCHING = 6;
+    }
+}
diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/task/TaskStatusResource.java b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/task/TaskStatusResource.java
new file mode 100644 (file)
index 0000000..884a2b4
--- /dev/null
@@ -0,0 +1,99 @@
+/**
+ *
+ * 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.k8s.api.resources.task;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class TaskStatusResource {
+
+    private long id;
+    private int state;
+    private String stateStr;
+    private long timeOfStateChange;
+    private String reason;
+    private long taskId;
+
+    public long getId() {
+        return id;
+    }
+
+    public TaskStatusResource setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public int getState() {
+        return state;
+    }
+
+    public TaskStatusResource setState(int state) {
+        this.state = state;
+        return this;
+    }
+
+    public long getTimeOfStateChange() {
+        return timeOfStateChange;
+    }
+
+    public TaskStatusResource setTimeOfStateChange(long timeOfStateChange) {
+        this.timeOfStateChange = timeOfStateChange;
+        return this;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public TaskStatusResource setReason(String reason) {
+        this.reason = reason;
+        return this;
+    }
+
+    public long getTaskId() {
+        return taskId;
+    }
+
+    public TaskStatusResource setTaskId(long taskId) {
+        this.taskId = taskId;
+        return this;
+    }
+
+    public String getStateStr() {
+        return stateStr;
+    }
+
+    public TaskStatusResource setStateStr(String stateStr) {
+        this.stateStr = stateStr;
+        return this;
+    }
+
+    public static final class State {
+        public static final int CREATED = 0;
+        public static final int SCHEDULED = 1;
+        public static final int EXECUTING = 2;
+        public static final int COMPLETED = 3;
+        public static final int FAILED = 4;
+        public static final int CANCELED = 5;
+    }
+}
diff --git a/airavata-kubernetes/modules/compute-resource-api/pom.xml b/airavata-kubernetes/modules/compute-resource-api/pom.xml
new file mode 100644 (file)
index 0000000..def9012
--- /dev/null
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>airavata-kubernetes</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>compute-resource-api</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.jcraft</groupId>
+            <artifactId>jsch</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.5.1</version>
+                <configuration>
+                    <source>${java.version}</source>
+                    <target>${java.version}</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file
diff --git a/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/api/ComputeOperations.java b/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/api/ComputeOperations.java
new file mode 100644 (file)
index 0000000..3147a93
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ *
+ * 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.k8s.compute.api;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ComputeOperations {
+    public ExecutionResult executeCommand(String command) throws Exception;
+    public void transferDataIn(String source, String target, String protocol) throws Exception;
+    public void transferDataOut(String source, String target, String protocol) throws Exception;
+}
diff --git a/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/api/ExecutionResult.java b/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/api/ExecutionResult.java
new file mode 100644 (file)
index 0000000..820890f
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ *
+ * 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.k8s.compute.api;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ExecutionResult {
+
+    private String stdOut;
+    private String stdErr;
+    private int exitStatus = -1;
+
+    public String getStdOut() {
+        return stdOut;
+    }
+
+    public ExecutionResult setStdOut(String stdOut) {
+        this.stdOut = stdOut;
+        return this;
+    }
+
+    public String getStdErr() {
+        return stdErr;
+    }
+
+    public ExecutionResult setStdErr(String stdErr) {
+        this.stdErr = stdErr;
+        return this;
+    }
+
+    public int getExitStatus() {
+        return exitStatus;
+    }
+
+    public ExecutionResult setExitStatus(int exitStatus) {
+        this.exitStatus = exitStatus;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/impl/MockComputeOperation.java b/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/impl/MockComputeOperation.java
new file mode 100644 (file)
index 0000000..350bcff
--- /dev/null
@@ -0,0 +1,68 @@
+/**
+ *
+ * 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.k8s.compute.impl;
+
+import org.apache.airavata.k8s.compute.api.ComputeOperations;
+import org.apache.airavata.k8s.compute.api.ExecutionResult;
+
+import java.io.File;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class MockComputeOperation implements ComputeOperations {
+
+    private String computeHost;
+
+    public MockComputeOperation(String computeHost) {
+        this.computeHost = computeHost;
+    }
+
+    @Override
+    public ExecutionResult executeCommand(String command) throws Exception {
+        System.out.println("Executing command " + command + " on host " + this.computeHost);
+        ExecutionResult executionResult = new ExecutionResult();
+        executionResult.setExitStatus(0);
+        executionResult.setStdOut("Sample standard out");
+        executionResult.setStdErr("Simple standard error");
+        Thread.sleep(5000);
+        System.out.println("Command successfully executed");
+        return executionResult;
+    }
+
+    @Override
+    public void transferDataIn(String source, String target, String protocol) throws Exception {
+        System.out.println("Transferring data in from " + source + " to " + target);
+        Thread.sleep(5000);
+        System.out.println("Transferred data in from " + source + " to " + target);
+    }
+
+    @Override
+    public void transferDataOut(String source, String target, String protocol) throws Exception {
+        System.out.println("Transferring data out from " + source + " to " + target);
+        File f = new File(target);
+        f.getParentFile().mkdirs();
+        f.createNewFile();
+        System.out.println("Transferred data out from " + source + " to " + target);
+    }
+}
diff --git a/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/impl/SSHComputeOperations.java b/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/impl/SSHComputeOperations.java
new file mode 100644 (file)
index 0000000..140c5b6
--- /dev/null
@@ -0,0 +1,302 @@
+/**
+ *
+ * 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.k8s.compute.impl;
+
+import com.jcraft.jsch.*;
+import org.apache.airavata.k8s.compute.api.ComputeOperations;
+import org.apache.airavata.k8s.compute.api.ExecutionResult;
+
+import java.io.*;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class SSHComputeOperations implements ComputeOperations {
+
+    private String computeHost;
+    private String userName;
+    private String password;
+    private int port = 22;
+
+    public SSHComputeOperations(String computeHost, String userName, String password) {
+        this.computeHost = computeHost;
+        this.userName = userName;
+        this.password = password;
+    }
+
+    public SSHComputeOperations(String computeHost, String userName, String password, int port) {
+        this.computeHost = computeHost;
+        this.userName = userName;
+        this.password = password;
+        this.port = port;
+    }
+
+    public ExecutionResult executeCommand(String command) throws JSchException, IOException {
+        JSch jsch = new JSch();
+        Session session = jsch.getSession(userName, this.computeHost, port);
+        session.setConfig("StrictHostKeyChecking", "no");
+
+        session.setUserInfo(new UserInfo() {
+            @Override
+            public String getPassphrase() {
+                return password;
+            }
+
+            @Override
+            public String getPassword() {
+                return password;
+            }
+
+            @Override
+            public boolean promptPassword(String s) {
+                return true;
+            }
+
+            @Override
+            public boolean promptPassphrase(String s) {
+                return false;
+            }
+
+            @Override
+            public boolean promptYesNo(String s) {
+                return false;
+            }
+
+            @Override
+            public void showMessage(String s) {
+
+            }
+        });
+
+        session.connect();
+        Channel channel=session.openChannel("exec");
+        ((ChannelExec)channel).setCommand(command);
+
+        ByteArrayOutputStream sysOut = new ByteArrayOutputStream();
+        channel.setOutputStream(sysOut);
+        ByteArrayOutputStream sysErr = new ByteArrayOutputStream();
+        ((ChannelExec) channel).setErrStream(sysErr);
+
+        InputStream in = channel.getInputStream();
+
+        channel.connect();
+
+        ExecutionResult result = new ExecutionResult();
+        byte[] tmp = new byte[1024];
+        while (true) {
+            while (in.available()>0) {
+                int i = in.read(tmp, 0, 1024);
+                if (i<0) break;
+                System.out.print(new String(tmp, 0, i));
+            }
+            if (channel.isClosed()) {
+                if (in.available() > 0) continue;
+                System.out.println("exit-status: " + channel.getExitStatus());
+                result.setExitStatus(channel.getExitStatus());
+                break;
+            }
+            try {
+                Thread.sleep(1000);
+            } catch(Exception e){}
+        }
+
+        channel.disconnect();
+        session.disconnect();
+
+        result.setStdErr(sysErr.toString("UTF-8"));
+        result.setStdOut(sysOut.toString("UTF-8"));
+        return result;
+    }
+
+    public void transferDataIn(String source, String target, String protocol) {
+
+    }
+
+    public void transferDataOut(String source, String target, String protocol) throws Exception {
+        JSch jsch = new JSch();
+        Session session = jsch.getSession(userName, this.computeHost, port);
+        session.setConfig("StrictHostKeyChecking", "no");
+
+        session.setUserInfo(new UserInfo() {
+            @Override
+            public String getPassphrase() {
+                return password;
+            }
+
+            @Override
+            public String getPassword() {
+                return password;
+            }
+
+            @Override
+            public boolean promptPassword(String s) {
+                return true;
+            }
+
+            @Override
+            public boolean promptPassphrase(String s) {
+                return false;
+            }
+
+            @Override
+            public boolean promptYesNo(String s) {
+                return false;
+            }
+
+            @Override
+            public void showMessage(String s) {
+
+            }
+        });
+
+        session.connect();
+
+        copyRemoteToLocal(session, source, target);
+    }
+
+    private static void copyRemoteToLocal(Session session, String source, String target) throws JSchException, IOException {
+
+        // exec 'scp -f rfile' remotely
+        String command = "scp -f " + source;
+        Channel channel = session.openChannel("exec");
+        ((ChannelExec) channel).setCommand(command);
+
+        // get I/O streams for remote scp
+        OutputStream out = channel.getOutputStream();
+        InputStream in = channel.getInputStream();
+
+        channel.connect();
+
+        byte[] buf = new byte[1024];
+
+        // send '\0'
+        buf[0] = 0;
+        out.write(buf, 0, 1);
+        out.flush();
+
+        while (true) {
+            int c = checkAck(in);
+            if (c != 'C') {
+                break;
+            }
+
+            // read '0644 '
+            in.read(buf, 0, 5);
+
+            long filesize = 0L;
+            while (true) {
+                if (in.read(buf, 0, 1) < 0) {
+                    // error
+                    break;
+                }
+                if (buf[0] == ' ') break;
+                filesize = filesize * 10L + (long) (buf[0] - '0');
+            }
+
+            String file = null;
+            for (int i = 0; ; i++) {
+                in.read(buf, i, 1);
+                if (buf[i] == (byte) 0x0a) {
+                    file = new String(buf, 0, i);
+                    break;
+                }
+            }
+
+            System.out.println("file-size=" + filesize + ", file=" + file);
+
+            // send '\0'
+            buf[0] = 0;
+            out.write(buf, 0, 1);
+            out.flush();
+
+            // read a content of lfile
+            FileOutputStream fos = new FileOutputStream(target);
+            int foo;
+            while (true) {
+                if (buf.length < filesize) foo = buf.length;
+                else foo = (int) filesize;
+                foo = in.read(buf, 0, foo);
+                if (foo < 0) {
+                    // error
+                    break;
+                }
+                fos.write(buf, 0, foo);
+                filesize -= foo;
+                if (filesize == 0L) break;
+            }
+
+            if (checkAck(in) != 0) {
+                System.exit(0);
+            }
+
+            // send '\0'
+            buf[0] = 0;
+            out.write(buf, 0, 1);
+            out.flush();
+
+            try {
+                if (fos != null) fos.close();
+            } catch (Exception ex) {
+                System.out.println(ex);
+            }
+        }
+
+        channel.disconnect();
+        session.disconnect();
+    }
+
+    public static int checkAck(InputStream in) throws IOException {
+        int b = in.read();
+        // b may be 0 for success,
+        //          1 for error,
+        //          2 for fatal error,
+        //         -1
+        if (b == 0) return b;
+        if (b == -1) return b;
+
+        if (b == 1 || b == 2) {
+            StringBuffer sb = new StringBuffer();
+            int c;
+            do {
+                c = in.read();
+                sb.append((char) c);
+            }
+            while (c != '\n');
+            if (b == 1) { // error
+                System.out.print(sb.toString());
+            }
+            if (b == 2) { // fatal error
+                System.out.print(sb.toString());
+            }
+        }
+        return b;
+    }
+
+    public static void main(String args[]) throws IOException, Exception {
+        SSHComputeOperations operations = new SSHComputeOperations("192.168.1.101", "dimuthu", "123456");
+        //ExecutionResult result = operations.executeCommand("sh /opt/sample.sh > /tmp/stdout.txt 2> /tmp/stderr.txt");
+        //System.out.println(result.getStdOut());
+        //System.out.println(result.getStdErr());
+        operations.transferDataOut("/tmp/stdout.txt", "/tmp/b.txt", "SCP");
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/pom.xml b/airavata-kubernetes/modules/microservices/api-server/pom.xml
new file mode 100644 (file)
index 0000000..2ecd6bd
--- /dev/null
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>airavata-kubernetes</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>api-server</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>api-resource</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-freemarker</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.kafka</groupId>
+            <artifactId>spring-kafka</artifactId>
+        </dependency>
+    </dependencies>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.5.1</version>
+                <configuration>
+                    <source>${java.version}</source>
+                    <target>${java.version}</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>jar</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <properties>
+                <artifact-packaging>jar</artifact-packaging>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.springframework.boot</groupId>
+                        <artifactId>spring-boot-maven-plugin</artifactId>
+                        <version>1.4.3.RELEASE</version>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>repackage</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <!-- Create a docker image that runs the executable jar-->
+                    <plugin>
+                        <groupId>com.spotify</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <version>1.0.0</version>
+                        <configuration>
+                            <imageName>${docker.image.prefix}/api-server</imageName>
+                            <baseImage>java:openjdk-8-jdk-alpine</baseImage>
+                            <exposes>
+                                <expose>8080</expose>
+                            </exposes>
+                            <entryPoint>["java","-jar","/${project.build.finalName}.jar"]</entryPoint>
+                            <resources>
+                                <resource>
+                                    <targetPath>/</targetPath>
+                                    <directory>${project.build.directory}</directory>
+                                    <include>${project.build.finalName}.jar</include>
+                                </resource>
+                            </resources>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>build</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>war</id>
+            <properties>
+                <artifact-packaging>war</artifact-packaging>
+            </properties>
+            <dependencies>
+                <dependency>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                    <scope>provided</scope>
+                </dependency>
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.springframework.boot</groupId>
+                        <artifactId>spring-boot-maven-plugin</artifactId>
+                        <version>1.4.3.RELEASE</version>
+                        <configuration>
+                            <!-- this will get rid of version info from war file name -->
+                            <finalName>api-server</finalName>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
\ No newline at end of file
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/Application.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/Application.java
new file mode 100644 (file)
index 0000000..bc06c79
--- /dev/null
@@ -0,0 +1,66 @@
+/**
+ *
+ * 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.k8s.api.server;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author Dimuthu Upeksha
+ * @since 1.0.0-SNAPSHOT
+ */
+@SpringBootApplication(scanBasePackages={"org.apache.airavata.k8s.api.server.controller"})
+@EnableJpaRepositories(basePackages = {"org.apache.airavata.k8s.api.server.repository"})
+@Configuration
+@EnableAutoConfiguration
+@ComponentScan
+public class Application extends SpringBootServletInitializer {
+
+    @Override
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+        return application.sources(Application.class);
+    }
+
+    public static void main(String args[]) {
+        SpringApplication.run(Application.class, args);
+    }
+
+    @Bean
+    public WebMvcConfigurer corsConfigurer() {
+        return new WebMvcConfigurerAdapter() {
+            @Override
+            public void addCorsMappings(CorsRegistry registry) {
+                registry.addMapping("/**").allowedOrigins("*");
+            }
+        };
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/ServerRuntimeException.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/ServerRuntimeException.java
new file mode 100644 (file)
index 0000000..aae15b4
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ *
+ * 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.k8s.api.server;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ServerRuntimeException extends RuntimeException {
+    public ServerRuntimeException(Exception e) {
+        super(e);
+    }
+
+    public ServerRuntimeException(String message) {
+        super(message);
+    }
+
+    public ServerRuntimeException(String message, Exception e) {
+        super(message, e);
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ApplicationDeploymentController.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ApplicationDeploymentController.java
new file mode 100644 (file)
index 0000000..ae3be0d
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ *
+ * 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.k8s.api.server.controller;
+
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.resources.application.ApplicationDeploymentResource;
+import org.apache.airavata.k8s.api.server.service.ApplicationDeploymentService;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@RestController
+@RequestMapping(path="/appdep")
+public class ApplicationDeploymentController {
+
+    @Resource
+    private ApplicationDeploymentService applicationDeploymentService;
+
+    @PostMapping( path = "", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public Long createApplicationModule(@RequestBody ApplicationDeploymentResource resource) {
+        return applicationDeploymentService.create(resource);
+    }
+
+    @GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
+    public List<ApplicationDeploymentResource> getAllDepResources() {
+        return this.applicationDeploymentService.getAll();
+    }
+
+
+    @GetMapping(path = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ApplicationDeploymentResource findAppModuleById(@PathVariable("id") long id) {
+        return this.applicationDeploymentService.findById(id)
+                .orElseThrow(() -> new ServerRuntimeException("App deployment with id " + id + " can not be found"));
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ApplicationInterfaceController.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ApplicationInterfaceController.java
new file mode 100644 (file)
index 0000000..e191f66
--- /dev/null
@@ -0,0 +1,59 @@
+/**
+ *
+ * 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.k8s.api.server.controller;
+
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.resources.application.ApplicationIfaceResource;
+import org.apache.airavata.k8s.api.server.service.ApplicationIfaceService;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@RestController
+@RequestMapping(path="/appiface")
+public class ApplicationInterfaceController {
+
+    @Resource
+    private ApplicationIfaceService ifaceService;
+
+    @PostMapping( path = "", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public Long createApplicationModule(@RequestBody ApplicationIfaceResource resource) {
+        return ifaceService.create(resource);
+    }
+
+    @GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
+    public List<ApplicationIfaceResource> getAllDepResources() {
+        return this.ifaceService.getAll();
+    }
+
+    @GetMapping(path = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ApplicationIfaceResource findAppModuleById(@PathVariable("id") long id) {
+        return this.ifaceService.findById(id)
+                .orElseThrow(() -> new ServerRuntimeException("App interface with id " + id + " can not be found"));
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ApplicationModuleController.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ApplicationModuleController.java
new file mode 100644 (file)
index 0000000..271974b
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ *
+ * 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.k8s.api.server.controller;
+
+import org.apache.airavata.k8s.api.resources.compute.ComputeResource;
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.resources.application.ApplicationModuleResource;
+import org.apache.airavata.k8s.api.server.service.ApplicationModuleService;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@RestController
+@RequestMapping(path="/appmodule")
+public class ApplicationModuleController {
+
+    @Resource
+    private ApplicationModuleService applicationModuleService;
+
+    @PostMapping( path = "", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public Long createApplicationModule(@RequestBody ApplicationModuleResource resource) {
+        return applicationModuleService.create(resource);
+    }
+
+    @GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
+    public List<ApplicationModuleResource> getAllAppModules() {
+        return this.applicationModuleService.getAll();
+    }
+
+    @GetMapping(path = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ApplicationModuleResource findAppModuleById(@PathVariable("id") long id) {
+        return this.applicationModuleService.findById(id)
+                .orElseThrow(() -> new ServerRuntimeException("Compute resource with id " + id + " can not be found"));
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ComputeResourceController.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ComputeResourceController.java
new file mode 100644 (file)
index 0000000..610bb1c
--- /dev/null
@@ -0,0 +1,59 @@
+/**
+ *
+ * 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.k8s.api.server.controller;
+
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.resources.compute.ComputeResource;
+import org.apache.airavata.k8s.api.server.service.ComputeResourceService;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@RestController
+@RequestMapping(path="/compute")
+public class ComputeResourceController {
+
+    @Resource
+    private ComputeResourceService computeResourceService;
+
+    @PostMapping( path = "", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public Long createComputeResource(@RequestBody ComputeResource resource) {
+        return computeResourceService.create(resource);
+    }
+
+    @GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
+    public List<ComputeResource> getAllComputeResources() {
+        return this.computeResourceService.getAll();
+    }
+
+    @GetMapping(path = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ComputeResource findComputeResourceById(@PathVariable("id") long id) {
+        return this.computeResourceService.findById(id)
+                .orElseThrow(() -> new ServerRuntimeException("Compute resource with id " + id + " cab not be found"));
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/DataStoreController.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/DataStoreController.java
new file mode 100644 (file)
index 0000000..016011d
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+ *
+ * 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.k8s.api.server.controller;
+
+import org.apache.airavata.k8s.api.resources.data.DataEntryResource;
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.server.service.data.DataStoreService;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@RestController
+@RequestMapping(path="/data")
+public class DataStoreController {
+
+    @Resource
+    private DataStoreService dataStoreService;
+
+    @PostMapping("{taskId}/{expOutputId}/upload")
+    public long uploadData(@RequestParam("file") MultipartFile file, @PathVariable("taskId") long taskId,
+                           @PathVariable("expOutputId") long expOutputId, RedirectAttributes redirectAttributes) {
+
+        System.out.println("Received data for task id " + taskId + " and experiment output id " + expOutputId);
+        if (file.isEmpty()) {
+            throw new ServerRuntimeException("Data file is empty");
+        }
+        try {
+            // Get the file and save it somewhere
+            byte[] bytes = file.getBytes();
+            return this.dataStoreService.createEntry(taskId, expOutputId, bytes);
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new ServerRuntimeException("Failed to store file", e);
+        }
+    }
+
+    @GetMapping("process/{id}")
+    public List<DataEntryResource> getAllEntriesForProcess(@PathVariable("id") long processId) {
+        return this.dataStoreService.getEntriesForProcess(processId);
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ExperimentController.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ExperimentController.java
new file mode 100644 (file)
index 0000000..074b8b5
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ *
+ * 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.k8s.api.server.controller;
+
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.resources.experiment.ExperimentResource;
+import org.apache.airavata.k8s.api.server.service.ExperimentService;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@RestController
+@RequestMapping(path="/experiment")
+public class ExperimentController {
+
+    @Resource
+    private ExperimentService experimentService;
+
+    @PostMapping( path = "", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public long createExperiment(@RequestBody ExperimentResource resource) {
+        return experimentService.create(resource);
+    }
+
+    @GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
+    public List<ExperimentResource> getAllExperiments() {
+        return this.experimentService.getAll();
+    }
+
+    @GetMapping(path = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ExperimentResource findExperimentById(@PathVariable("id") long id) {
+        return this.experimentService.findById(id)
+                .orElseThrow(() -> new ServerRuntimeException("Experiment with id " + id + " not found"));
+    }
+
+    @GetMapping(path = "{id}/launch", produces = MediaType.APPLICATION_JSON_VALUE)
+    public long launchExperiment(@PathVariable("id") long id) {
+        return this.experimentService.launchExperiment(id);
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ProcessController.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/ProcessController.java
new file mode 100644 (file)
index 0000000..7dffe68
--- /dev/null
@@ -0,0 +1,59 @@
+/**
+ *
+ * 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.k8s.api.server.controller;
+
+import org.apache.airavata.k8s.api.resources.process.ProcessStatusResource;
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.resources.process.ProcessResource;
+import org.apache.airavata.k8s.api.server.service.ProcessService;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@RestController
+@RequestMapping(path="/process")
+public class ProcessController {
+
+    @Resource
+    private ProcessService processService;
+
+    @PostMapping( path = "", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public long createProcess(@RequestBody ProcessResource resource) {
+        return processService.create(resource);
+    }
+
+    @PostMapping( path = "{id}/status", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public long addStatus(@PathVariable("id") long id, @RequestBody ProcessStatusResource resource) {
+        return processService.addProcessStatus(id, resource);
+    }
+
+    @GetMapping(path = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ProcessResource findProcessById(@PathVariable("id") long id) {
+        return this.processService.findById(id)
+                .orElseThrow(() -> new ServerRuntimeException("Process with id " + id + " not found"));
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/TaskController.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/TaskController.java
new file mode 100644 (file)
index 0000000..ef8c797
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ *
+ * 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.k8s.api.server.controller;
+
+import org.apache.airavata.k8s.api.resources.task.TaskResource;
+import org.apache.airavata.k8s.api.resources.task.TaskStatusResource;
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.server.service.TaskService;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@RestController
+@RequestMapping(path="/task")
+public class TaskController {
+
+    @Resource
+    private TaskService taskService;
+
+    @PostMapping( path = "", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public long createTask(@RequestBody TaskResource resource) {
+        return taskService.create(resource);
+    }
+
+    @PostMapping( path = "{id}/status", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public long addStatus(@PathVariable("id") long id, @RequestBody TaskStatusResource resource) {
+        return taskService.addTaskStatus(id, resource);
+    }
+
+    @GetMapping(path = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
+    public TaskResource findTaskById(@PathVariable("id") long id) {
+        return this.taskService.findById(id)
+                .orElseThrow(() -> new ServerRuntimeException("Task with id " + id + " not found"));
+    }
+
+    @GetMapping(path = "status/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
+    public TaskStatusResource findTaskStatusById(@PathVariable("id") long id) {
+        return this.taskService.findTaskStatusById(id)
+                .orElseThrow(() -> new ServerRuntimeException("Task status with id " + id + " not found"));
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationDeployment.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationDeployment.java
new file mode 100644 (file)
index 0000000..f7da42d
--- /dev/null
@@ -0,0 +1,109 @@
+/**
+ *
+ * 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.k8s.api.server.model.application;
+
+import org.apache.airavata.k8s.api.server.model.compute.ComputeResourceModel;
+
+import javax.persistence.*;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "APPLICATION_DEPLOYMENT")
+public class ApplicationDeployment {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    @ManyToOne
+    @JoinColumn(name = "APPLICATION_MODULE_ID")
+    private ApplicationModule applicationModule;
+
+    @ManyToOne
+    @JoinColumn(name = "COMPUTE_RESOURCE_ID")
+    private ComputeResourceModel computeResource;
+
+    private String name;
+    private String executablePath;
+    private String preJobCommand;
+    private String postJobCommand;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public ApplicationModule getApplicationModule() {
+        return applicationModule;
+    }
+
+    public void setApplicationModule(ApplicationModule applicationModule) {
+        this.applicationModule = applicationModule;
+    }
+
+    public ComputeResourceModel getComputeResource() {
+        return computeResource;
+    }
+
+    public void setComputeResource(ComputeResourceModel computeResourceModel) {
+        this.computeResource = computeResourceModel;
+    }
+
+    public String getExecutablePath() {
+        return executablePath;
+    }
+
+    public void setExecutablePath(String executablePath) {
+        this.executablePath = executablePath;
+    }
+
+    public String getPreJobCommand() {
+        return preJobCommand;
+    }
+
+    public void setPreJobCommand(String preJobCommand) {
+        this.preJobCommand = preJobCommand;
+    }
+
+    public String getPostJobCommand() {
+        return postJobCommand;
+    }
+
+    public void setPostJobCommand(String postJobCommand) {
+        this.postJobCommand = postJobCommand;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ApplicationDeployment setName(String name) {
+        this.name = name;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationInput.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationInput.java
new file mode 100644 (file)
index 0000000..1cc97e3
--- /dev/null
@@ -0,0 +1,116 @@
+/**
+ *
+ * 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.k8s.api.server.model.application;
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "APPLICATION_INPUT")
+public class ApplicationInput {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String name;
+    private String value;
+    private DataType type;
+    private String arguments;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public DataType getType() {
+        return type;
+    }
+
+    public void setType(DataType type) {
+        this.type = type;
+    }
+
+    public String getArguments() {
+        return arguments;
+    }
+
+    public void setArguments(String arguments) {
+        this.arguments = arguments;
+    }
+
+    public static enum DataType {
+        STRING(0),
+        INTEGER(1),
+        FLOAT(2),
+        URI(3),
+        URI_COLLECTION(4),
+        STDOUT(5),
+        STDERR(6);
+
+        private final int value;
+        private static Map<Integer, DataType> map = new HashMap();
+
+        static {
+            for (DataType dataType : DataType.values()) {
+                map.put(dataType.value, dataType);
+            }
+        }
+
+        private DataType(int value) {
+            this.value = value;
+        }
+
+        public static DataType valueOf(int dataType) {
+            return map.get(dataType);
+        }
+
+        public int getValue() {
+            return value;
+        }
+    }
+
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationInterface.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationInterface.java
new file mode 100644 (file)
index 0000000..43d3d07
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ *
+ * 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.k8s.api.server.model.application;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "APPLICATION_INTERFACE")
+public class ApplicationInterface {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String name;
+    private String description;
+
+    @ManyToOne
+    @JoinColumn(name = "APP_MODULE_ID")
+    private ApplicationModule applicationModule;
+
+    @OneToMany
+    private List<ApplicationInput> inputs = new ArrayList<>();
+
+    @OneToMany
+    private List<ApplicationOutput> outputs = new ArrayList<>();
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public ApplicationModule getApplicationModule() {
+        return applicationModule;
+    }
+
+    public void setApplicationModule(ApplicationModule applicationModule) {
+        this.applicationModule = applicationModule;
+    }
+
+    public List<ApplicationInput> getInputs() {
+        return inputs;
+    }
+
+    public void setInputs(List<ApplicationInput> inputs) {
+        this.inputs = inputs;
+    }
+
+    public List<ApplicationOutput> getOutputs() {
+        return outputs;
+    }
+
+    public void setOutputs(List<ApplicationOutput> outputs) {
+        this.outputs = outputs;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationModule.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationModule.java
new file mode 100644 (file)
index 0000000..8b06fef
--- /dev/null
@@ -0,0 +1,73 @@
+/**
+ *
+ * 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.k8s.api.server.model.application;
+
+import javax.persistence.*;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "APPLICATION_MODULE")
+public class ApplicationModule {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String name;
+    private String version;
+    private String description;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationOutput.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/application/ApplicationOutput.java
new file mode 100644 (file)
index 0000000..1f3ab8d
--- /dev/null
@@ -0,0 +1,108 @@
+/**
+ *
+ * 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.k8s.api.server.model.application;
+
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "APPLICATION_OUTPUT")
+public class ApplicationOutput {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String name;
+    private String value;
+    private DataType type;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public DataType getType() {
+        return type;
+    }
+
+    public void setType(DataType type) {
+        this.type = type;
+    }
+
+    public static enum DataType {
+        STRING(0),
+        INTEGER(1),
+        FLOAT(2),
+        URI(3),
+        URI_COLLECTION(4),
+        STDOUT(5),
+        STDERR(6);
+
+        private final int value;
+        private static Map<Integer, DataType> map = new HashMap<>();
+
+        static {
+            for (DataType dataType : DataType.values()) {
+                map.put(dataType.value, dataType);
+            }
+        }
+
+        private DataType(int value) {
+            this.value = value;
+        }
+
+        public static DataType valueOf(int dataType) {
+            return map.get(dataType);
+        }
+
+        public int getValue() {
+            return value;
+        }
+    }
+
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/commons/ErrorModel.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/commons/ErrorModel.java
new file mode 100644 (file)
index 0000000..b4925e6
--- /dev/null
@@ -0,0 +1,108 @@
+/**
+ *
+ * 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.k8s.api.server.model.commons;
+
+import org.apache.airavata.k8s.api.server.model.task.TaskModel;
+
+import javax.persistence.*;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "ERROR_MODEL")
+public class ErrorModel {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private long creationTime;
+    private String actualErrorMessage;
+    private String userFriendlyMessage;
+    private boolean transientOrPersistent;
+
+    @ManyToOne
+    private TaskModel taskModel;
+
+    @OneToMany
+    private List<ErrorModel> rootCauseErrorList;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public void setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+    }
+
+    public String getActualErrorMessage() {
+        return actualErrorMessage;
+    }
+
+    public void setActualErrorMessage(String actualErrorMessage) {
+        this.actualErrorMessage = actualErrorMessage;
+    }
+
+    public String getUserFriendlyMessage() {
+        return userFriendlyMessage;
+    }
+
+    public void setUserFriendlyMessage(String userFriendlyMessage) {
+        this.userFriendlyMessage = userFriendlyMessage;
+    }
+
+    public boolean isTransientOrPersistent() {
+        return transientOrPersistent;
+    }
+
+    public void setTransientOrPersistent(boolean transientOrPersistent) {
+        this.transientOrPersistent = transientOrPersistent;
+    }
+
+    public List<ErrorModel> getRootCauseErrorList() {
+        return rootCauseErrorList;
+    }
+
+    public void setRootCauseErrorList(List<ErrorModel> rootCauseErrorList) {
+        this.rootCauseErrorList = rootCauseErrorList;
+    }
+
+    public TaskModel getTaskModel() {
+        return taskModel;
+    }
+
+    public ErrorModel setTaskModel(TaskModel taskModel) {
+        this.taskModel = taskModel;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/compute/ComputeResourceModel.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/compute/ComputeResourceModel.java
new file mode 100644 (file)
index 0000000..3244c2b
--- /dev/null
@@ -0,0 +1,96 @@
+/**
+ *
+ * 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.k8s.api.server.model.compute;
+
+import javax.persistence.*;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "COMPUTE_RESOURCE")
+public class ComputeResourceModel {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String name;
+    private String host;
+    private String userName;
+    private String password;
+    private String communicationType;
+
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public ComputeResourceModel setHost(String host) {
+        this.host = host;
+        return this;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public ComputeResourceModel setUserName(String userName) {
+        this.userName = userName;
+        return this;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public ComputeResourceModel setPassword(String password) {
+        this.password = password;
+        return this;
+    }
+
+    public String getCommunicationType() {
+        return communicationType;
+    }
+
+    public ComputeResourceModel setCommunicationType(String communicationType) {
+        this.communicationType = communicationType;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/data/DataStoreModel.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/data/DataStoreModel.java
new file mode 100644 (file)
index 0000000..71df7c4
--- /dev/null
@@ -0,0 +1,88 @@
+/**
+ *
+ * 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.k8s.api.server.model.data;
+
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentInputData;
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentOutputData;
+import org.apache.airavata.k8s.api.server.model.task.TaskModel;
+
+import javax.persistence.*;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "DATA_STORE")
+public class DataStoreModel {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    @Lob
+    @Column(length = 1000000, name = "CONTENT")
+    @Basic(fetch = FetchType.LAZY)
+    private byte[] content;
+
+    @ManyToOne
+    private ExperimentOutputData experimentOutputData;
+
+    @ManyToOne
+    private TaskModel taskModel;
+
+    public long getId() {
+        return id;
+    }
+
+    public DataStoreModel setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public byte[] getContent() {
+        return content;
+    }
+
+    public DataStoreModel setContent(byte[] content) {
+        this.content = content;
+        return this;
+    }
+
+    public ExperimentOutputData getExperimentOutputData() {
+        return experimentOutputData;
+    }
+
+    public DataStoreModel setExperimentOutputData(ExperimentOutputData experimentOutputData) {
+        this.experimentOutputData = experimentOutputData;
+        return this;
+    }
+
+    public TaskModel getTaskModel() {
+        return taskModel;
+    }
+
+    public DataStoreModel setTaskModel(TaskModel taskModel) {
+        this.taskModel = taskModel;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/Experiment.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/Experiment.java
new file mode 100644 (file)
index 0000000..8b96163
--- /dev/null
@@ -0,0 +1,168 @@
+/**
+ *
+ * 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.k8s.api.server.model.experiment;
+
+import org.apache.airavata.k8s.api.server.model.application.ApplicationDeployment;
+import org.apache.airavata.k8s.api.server.model.application.ApplicationInterface;
+import org.apache.airavata.k8s.api.server.model.commons.ErrorModel;
+import org.apache.airavata.k8s.api.server.model.process.ProcessModel;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "EXPERIMENT")
+public class Experiment {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String experimentName;
+    private long creationTime;
+    private String description;
+
+    @ManyToOne
+    private ApplicationInterface applicationInterface;
+
+    @ManyToOne
+    private ApplicationDeployment applicationDeployment;
+
+    @OneToMany
+    private List<ExperimentInputData> experimentInputs = new ArrayList<>();
+
+    @OneToMany
+    private List<ExperimentOutputData> experimentOutputs = new ArrayList<>();
+
+    @OneToMany
+    private List<ExperimentStatus> experimentStatus = new ArrayList<>();
+
+    @OneToMany
+    private List<ErrorModel> errors = new ArrayList<>();
+
+    @OneToMany(mappedBy = "experiment", cascade = CascadeType.ALL)
+    private List<ProcessModel> processes = new ArrayList<>();
+
+    public long getId() {
+        return id;
+    }
+
+    public Experiment setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getExperimentName() {
+        return experimentName;
+    }
+
+    public Experiment setExperimentName(String experimentName) {
+        this.experimentName = experimentName;
+        return this;
+    }
+
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public Experiment setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+        return this;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public Experiment setDescription(String description) {
+        this.description = description;
+        return this;
+    }
+
+    public ApplicationInterface getApplicationInterface() {
+        return applicationInterface;
+    }
+
+    public Experiment setApplicationInterface(ApplicationInterface applicationInterface) {
+        this.applicationInterface = applicationInterface;
+        return this;
+    }
+
+    public ApplicationDeployment getApplicationDeployment() {
+        return applicationDeployment;
+    }
+
+    public Experiment setApplicationDeployment(ApplicationDeployment applicationDeployment) {
+        this.applicationDeployment = applicationDeployment;
+        return this;
+    }
+
+    public List<ExperimentInputData> getExperimentInputs() {
+        return experimentInputs;
+    }
+
+    public Experiment setExperimentInputs(List<ExperimentInputData> experimentInputs) {
+        this.experimentInputs = experimentInputs;
+        return this;
+    }
+
+    public List<ExperimentOutputData> getExperimentOutputs() {
+        return experimentOutputs;
+    }
+
+    public Experiment setExperimentOutputs(List<ExperimentOutputData> experimentOutputs) {
+        this.experimentOutputs = experimentOutputs;
+        return this;
+    }
+
+    public List<ExperimentStatus> getExperimentStatus() {
+        return experimentStatus;
+    }
+
+    public Experiment setExperimentStatus(List<ExperimentStatus> experimentStatus) {
+        this.experimentStatus = experimentStatus;
+        return this;
+    }
+
+    public List<ErrorModel> getErrors() {
+        return errors;
+    }
+
+    public Experiment setErrors(List<ErrorModel> errors) {
+        this.errors = errors;
+        return this;
+    }
+
+    public List<ProcessModel> getProcesses() {
+        return processes;
+    }
+
+    public Experiment setProcesses(List<ProcessModel> processes) {
+        this.processes = processes;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/ExperimentInputData.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/ExperimentInputData.java
new file mode 100644 (file)
index 0000000..3c19e3f
--- /dev/null
@@ -0,0 +1,114 @@
+/**
+ *
+ * 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.k8s.api.server.model.experiment;
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "EXPERIMENT_INPUT_OBJECT")
+public class ExperimentInputData {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String name;
+    private String value;
+    private DataType type;
+    private String arguments;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public DataType getType() {
+        return type;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public void setType(DataType type) {
+        this.type = type;
+    }
+
+    public String getArguments() {
+        return arguments;
+    }
+
+    public void setArguments(String arguments) {
+        this.arguments = arguments;
+    }
+
+    public static enum DataType {
+        STRING(0),
+        INTEGER(1),
+        FLOAT(2),
+        URI(3),
+        URI_COLLECTION(4),
+        STDOUT(5),
+        STDERR(6);
+
+        private final int value;
+        private static Map<Integer, DataType> map = new HashMap<>();
+
+        static {
+            for (DataType dataType : DataType.values()) {
+                map.put(dataType.value, dataType);
+            }
+        }
+
+        public static DataType valueOf(int dataType) {
+            return map.get(dataType);
+        }
+
+        private DataType(int value) {
+            this.value = value;
+        }
+        public int getValue() {
+            return value;
+        }
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/ExperimentOutputData.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/ExperimentOutputData.java
new file mode 100644 (file)
index 0000000..38a2581
--- /dev/null
@@ -0,0 +1,106 @@
+/**
+ *
+ * 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.k8s.api.server.model.experiment;
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "EXPERIMENT_OUTPUT_OBJECT")
+public class ExperimentOutputData {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String name;
+    private String value;
+    private DataType type;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public DataType getType() {
+        return type;
+    }
+
+    public void setType(DataType type) {
+        this.type = type;
+    }
+
+    public static enum DataType {
+        STRING(0),
+        INTEGER(1),
+        FLOAT(2),
+        URI(3),
+        URI_COLLECTION(4),
+        STDOUT(5),
+        STDERR(6);
+
+        private final int value;
+        private static Map<Integer, DataType> map = new HashMap<>();
+
+        static {
+            for (DataType dataType : DataType.values()) {
+                map.put(dataType.value, dataType);
+            }
+        }
+
+        public static DataType valueOf(int dataType) {
+            return map.get(dataType);
+        }
+
+        private DataType(int value) {
+            this.value = value;
+        }
+        public int getValue() {
+            return value;
+        }
+
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/ExperimentStatus.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/experiment/ExperimentStatus.java
new file mode 100644 (file)
index 0000000..6a17710
--- /dev/null
@@ -0,0 +1,99 @@
+/**
+ *
+ * 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.k8s.api.server.model.experiment;
+
+import javax.persistence.*;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "EXPERIMENT_STATUS")
+public class ExperimentStatus {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private ExperimentState state; // required
+    private long timeOfStateChange; // optional
+    private String reason; // optional
+
+    public long getId() {
+        return id;
+    }
+
+    public ExperimentStatus setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public ExperimentState getState() {
+        return state;
+    }
+
+    public ExperimentStatus setState(ExperimentState state) {
+        this.state = state;
+        return this;
+    }
+
+    public long getTimeOfStateChange() {
+        return timeOfStateChange;
+    }
+
+    public ExperimentStatus setTimeOfStateChange(long timeOfStateChange) {
+        this.timeOfStateChange = timeOfStateChange;
+        return this;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public ExperimentStatus setReason(String reason) {
+        this.reason = reason;
+        return this;
+    }
+
+    public enum ExperimentState {
+        CREATED(0),
+        VALIDATED(1),
+        SCHEDULED(2),
+        LAUNCHED(3),
+        EXECUTING(4),
+        CANCELING(5),
+        CANCELED(6),
+        COMPLETED(7),
+        FAILED(8);
+
+        private final int value;
+
+        private ExperimentState(int value) {
+            this.value = value;
+        }
+
+        public int getValue() {
+            return value;
+        }
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/job/JobModel.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/job/JobModel.java
new file mode 100644 (file)
index 0000000..5e559bb
--- /dev/null
@@ -0,0 +1,168 @@
+/**
+ *
+ * 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.k8s.api.server.model.job;
+
+import org.apache.airavata.k8s.api.server.model.task.TaskModel;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "JOB_MODEL")
+public class JobModel {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    @ManyToOne
+    private TaskModel task;
+
+    private String jobDescription;
+    private long creationTime;
+
+    @OneToMany(mappedBy = "jobModel", cascade = CascadeType.ALL)
+    private List<JobStatus> jobStatuses = new ArrayList<>();
+
+    @ManyToOne
+    private TaskModel taskModel;
+    
+    private String computeResourceConsumed;
+    private String jobName;
+    private String workingDir;
+    private String stdOut;
+    private String stdErr;
+    private int exitCode;
+
+    public long getId() {
+        return id;
+    }
+
+    public JobModel setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public TaskModel getTask() {
+        return task;
+    }
+
+    public JobModel setTask(TaskModel task) {
+        this.task = task;
+        return this;
+    }
+
+    public String getJobDescription() {
+        return jobDescription;
+    }
+
+    public JobModel setJobDescription(String jobDescription) {
+        this.jobDescription = jobDescription;
+        return this;
+    }
+
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public JobModel setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+        return this;
+    }
+
+    public List<JobStatus> getJobStatuses() {
+        return jobStatuses;
+    }
+
+    public JobModel setJobStatuses(List<JobStatus> jobStatuses) {
+        this.jobStatuses = jobStatuses;
+        return this;
+    }
+
+    public TaskModel getTaskModel() {
+        return taskModel;
+    }
+
+    public JobModel setTaskModel(TaskModel taskModel) {
+        this.taskModel = taskModel;
+        return this;
+    }
+
+    public String getComputeResourceConsumed() {
+        return computeResourceConsumed;
+    }
+
+    public JobModel setComputeResourceConsumed(String computeResourceConsumed) {
+        this.computeResourceConsumed = computeResourceConsumed;
+        return this;
+    }
+
+    public String getJobName() {
+        return jobName;
+    }
+
+    public JobModel setJobName(String jobName) {
+        this.jobName = jobName;
+        return this;
+    }
+
+    public String getWorkingDir() {
+        return workingDir;
+    }
+
+    public JobModel setWorkingDir(String workingDir) {
+        this.workingDir = workingDir;
+        return this;
+    }
+
+    public String getStdOut() {
+        return stdOut;
+    }
+
+    public JobModel setStdOut(String stdOut) {
+        this.stdOut = stdOut;
+        return this;
+    }
+
+    public String getStdErr() {
+        return stdErr;
+    }
+
+    public JobModel setStdErr(String stdErr) {
+        this.stdErr = stdErr;
+        return this;
+    }
+
+    public int getExitCode() {
+        return exitCode;
+    }
+
+    public JobModel setExitCode(int exitCode) {
+        this.exitCode = exitCode;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/job/JobStatus.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/job/JobStatus.java
new file mode 100644 (file)
index 0000000..38c1ff0
--- /dev/null
@@ -0,0 +1,109 @@
+/**
+ *
+ * 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.k8s.api.server.model.job;
+
+import javax.persistence.*;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "JOB_STATUS")
+public class JobStatus {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private JobState jobState;
+    private long timeOfStateChange;
+    private String reason;
+    
+    @ManyToOne
+    private JobModel jobModel;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public JobState getJobState() {
+        return jobState;
+    }
+
+    public void setJobState(JobState jobState) {
+        this.jobState = jobState;
+    }
+
+    public long getTimeOfStateChange() {
+        return timeOfStateChange;
+    }
+
+    public void setTimeOfStateChange(long timeOfStateChange) {
+        this.timeOfStateChange = timeOfStateChange;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public JobModel getJobModel() {
+        return jobModel;
+    }
+
+    public JobStatus setJobModel(JobModel jobModel) {
+        this.jobModel = jobModel;
+        return this;
+    }
+
+    public enum JobState {
+        SUBMITTED(0),
+        QUEUED(1),
+        ACTIVE(2),
+        COMPLETE(3),
+        CANCELED(4),
+        FAILED(5),
+        SUSPENDED(6),
+        UNKNOWN(7);
+
+        private final int value;
+
+        private JobState(int value) {
+            this.value = value;
+        }
+
+        /**
+         * Get the integer value of this enum value, as defined in the Thrift IDL.
+         */
+        public int getValue() {
+            return value;
+        }
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/process/ProcessModel.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/process/ProcessModel.java
new file mode 100644 (file)
index 0000000..d3f8984
--- /dev/null
@@ -0,0 +1,135 @@
+/**
+ *
+ * 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.k8s.api.server.model.process;
+
+import org.apache.airavata.k8s.api.server.model.commons.ErrorModel;
+import org.apache.airavata.k8s.api.server.model.experiment.Experiment;
+import org.apache.airavata.k8s.api.server.model.task.TaskModel;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+
+@Entity
+@Table(name = "PROCESS_MODEL")
+public class ProcessModel {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    @ManyToOne
+    private Experiment experiment;
+
+    private long creationTime;
+    private long lastUpdateTime;
+
+    @OneToMany(mappedBy = "processModel", cascade = CascadeType.ALL)
+    private List<ProcessStatus> processStatuses = new ArrayList<>();
+
+    @OneToMany(mappedBy = "parentProcess", cascade = CascadeType.ALL)
+    private List<TaskModel> tasks = new ArrayList<>();
+
+    private String taskDag;
+
+    @OneToMany
+    private List<ErrorModel> processErrors = new ArrayList<>();
+
+    private String experimentDataDir;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public Experiment getExperiment() {
+        return experiment;
+    }
+
+    public void setExperiment(Experiment experiment) {
+        this.experiment = experiment;
+    }
+
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public void setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+    }
+
+    public long getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+
+    public void setLastUpdateTime(long lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+    }
+
+    public List<ProcessStatus> getProcessStatuses() {
+        return processStatuses;
+    }
+
+    public void setProcessStatuses(List<ProcessStatus> processStatuses) {
+        this.processStatuses = processStatuses;
+    }
+
+    public List<TaskModel> getTasks() {
+        return tasks;
+    }
+
+    public void setTasks(List<TaskModel> tasks) {
+        this.tasks = tasks;
+    }
+
+    public String getTaskDag() {
+        return taskDag;
+    }
+
+    public void setTaskDag(String taskDag) {
+        this.taskDag = taskDag;
+    }
+
+    public List<ErrorModel> getProcessErrors() {
+        return processErrors;
+    }
+
+    public void setProcessErrors(List<ErrorModel> processErrors) {
+        this.processErrors = processErrors;
+    }
+
+    public String getExperimentDataDir() {
+        return experimentDataDir;
+    }
+
+    public void setExperimentDataDir(String experimentDataDir) {
+        this.experimentDataDir = experimentDataDir;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/process/ProcessStatus.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/process/ProcessStatus.java
new file mode 100644 (file)
index 0000000..616f1a4
--- /dev/null
@@ -0,0 +1,124 @@
+/**
+ *
+ * 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.k8s.api.server.model.process;
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "PROCESS_STATUS")
+public class ProcessStatus {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    @ManyToOne
+    private ProcessModel processModel;
+    private ProcessState state;
+    private long timeOfStateChange;
+    private String reason;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public ProcessModel getProcessModel() {
+        return processModel;
+    }
+
+    public void setProcessModel(ProcessModel processModel) {
+        this.processModel = processModel;
+    }
+
+    public ProcessState getState() {
+        return state;
+    }
+
+    public void setState(ProcessState state) {
+        this.state = state;
+    }
+
+    public long getTimeOfStateChange() {
+        return timeOfStateChange;
+    }
+
+    public void setTimeOfStateChange(long timeOfStateChange) {
+        this.timeOfStateChange = timeOfStateChange;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public enum ProcessState {
+        CREATED(0),
+        VALIDATED(1),
+        STARTED(2),
+        PRE_PROCESSING(3),
+        CONFIGURING_WORKSPACE(4),
+        INPUT_DATA_STAGING(5),
+        EXECUTING(6),
+        MONITORING(7),
+        OUTPUT_DATA_STAGING(8),
+        POST_PROCESSING(9),
+        COMPLETED(10),
+        FAILED(11),
+        CANCELLING(12),
+        CANCELED(13);
+
+        private final int value;
+
+        private ProcessState(int value) {
+            this.value = value;
+        }
+
+        private static Map<Integer, ProcessState> map = new HashMap<>();
+
+        static {
+            for (ProcessState state : ProcessState.values()) {
+                map.put(state.value, state);
+            }
+        }
+
+        public static ProcessState valueOf(int prcessState) {
+            return map.get(prcessState);
+        }
+
+        public int getValue() {
+            return value;
+        }
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/task/TaskModel.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/task/TaskModel.java
new file mode 100644 (file)
index 0000000..6ce995d
--- /dev/null
@@ -0,0 +1,190 @@
+/**
+ *
+ * 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.k8s.api.server.model.task;
+
+import org.apache.airavata.k8s.api.server.model.commons.ErrorModel;
+import org.apache.airavata.k8s.api.server.model.job.JobModel;
+import org.apache.airavata.k8s.api.server.model.process.ProcessModel;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "TASK_MODEL")
+public class TaskModel {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private TaskTypes taskType;
+
+    @ManyToOne
+    private ProcessModel parentProcess;
+
+    private long creationTime;
+    private long lastUpdateTime;
+    private int orderIndex;
+
+    @OneToMany(mappedBy = "taskModel", cascade = CascadeType.ALL)
+    private List<TaskStatus> taskStatuses = new ArrayList<>();
+
+    private String taskDetail;
+
+    @OneToMany(mappedBy = "taskModel", cascade = CascadeType.ALL)
+    private List<ErrorModel> taskErrors = new ArrayList<>();
+
+    @OneToMany(mappedBy = "taskModel", cascade = CascadeType.ALL)
+    private List<JobModel> jobs = new ArrayList<>();
+
+    @OneToMany(mappedBy = "taskModel", cascade = CascadeType.ALL)
+    private List<TaskParam> taskParams = new ArrayList<>();
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public TaskTypes getTaskType() {
+        return taskType;
+    }
+
+    public void setTaskType(TaskTypes taskType) {
+        this.taskType = taskType;
+    }
+
+    public ProcessModel getParentProcess() {
+        return parentProcess;
+    }
+
+    public void setParentProcess(ProcessModel parentProcess) {
+        this.parentProcess = parentProcess;
+    }
+
+    public long getCreationTime() {
+        return creationTime;
+    }
+
+    public void setCreationTime(long creationTime) {
+        this.creationTime = creationTime;
+    }
+
+    public long getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+
+    public void setLastUpdateTime(long lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+    }
+
+    public List<TaskStatus> getTaskStatuses() {
+        return taskStatuses;
+    }
+
+    public void setTaskStatuses(List<TaskStatus> taskStatuses) {
+        this.taskStatuses = taskStatuses;
+    }
+
+    public String getTaskDetail() {
+        return taskDetail;
+    }
+
+    public void setTaskDetail(String taskDetail) {
+        this.taskDetail = taskDetail;
+    }
+
+    public List<ErrorModel> getTaskErrors() {
+        return taskErrors;
+    }
+
+    public void setTaskErrors(List<ErrorModel> taskErrors) {
+        this.taskErrors = taskErrors;
+    }
+
+    public List<JobModel> getJobs() {
+        return jobs;
+    }
+
+    public void setJobs(List<JobModel> jobs) {
+        this.jobs = jobs;
+    }
+
+    public List<TaskParam> getTaskParams() {
+        return taskParams;
+    }
+
+    public TaskModel setTaskParams(List<TaskParam> taskParams) {
+        this.taskParams = taskParams;
+        return this;
+    }
+
+    public int getOrderIndex() {
+        return orderIndex;
+    }
+
+    public TaskModel setOrderIndex(int orderIndex) {
+        this.orderIndex = orderIndex;
+        return this;
+    }
+
+    public enum TaskTypes {
+        ENV_SETUP(0),
+        INGRESS_DATA_STAGING(1),
+        EGRESS_DATA_STAGING(2),
+        JOB_SUBMISSION(3),
+        ENV_CLEANUP(4),
+        MONITORING(5),
+        OUTPUT_FETCHING(6);
+
+        private static Map<Integer, TaskTypes> map = new HashMap<>();
+
+        static {
+            for (TaskTypes taskType : TaskTypes.values()) {
+                map.put(taskType.value, taskType);
+            }
+        }
+        private final int value;
+
+        public static TaskTypes valueOf(int taskType) {
+            return map.get(taskType);
+        }
+
+        private TaskTypes(int value) {
+            this.value = value;
+        }
+
+        public int getValue() {
+            return value;
+        }
+    }
+
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/task/TaskParam.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/task/TaskParam.java
new file mode 100644 (file)
index 0000000..cbeaace
--- /dev/null
@@ -0,0 +1,82 @@
+/**
+ *
+ * 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.k8s.api.server.model.task;
+
+import javax.persistence.*;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "TASK_PARAM")
+public class TaskParam {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    @Column(name = "PARAM_KEY")
+    private String key;
+
+    @Column(name = "PARAM_VALUE")
+    private String value;
+
+    @ManyToOne
+    private TaskModel taskModel;
+
+    public long getId() {
+        return id;
+    }
+
+    public TaskParam setId(long id) {
+        this.id = id;
+        return this;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public TaskParam setKey(String key) {
+        this.key = key;
+        return this;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public TaskParam setValue(String value) {
+        this.value = value;
+        return this;
+    }
+
+    public TaskModel getTaskModel() {
+        return taskModel;
+    }
+
+    public TaskParam setTaskModel(TaskModel taskModel) {
+        this.taskModel = taskModel;
+        return this;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/task/TaskStatus.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/task/TaskStatus.java
new file mode 100644 (file)
index 0000000..d62f450
--- /dev/null
@@ -0,0 +1,121 @@
+/**
+ *
+ * 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.k8s.api.server.model.task;
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Entity
+@Table(name = "TASK_STATUS")
+public class TaskStatus {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private TaskState state; // required
+    private long timeOfStateChange; // optional
+    private String reason; // optional
+
+    @ManyToOne
+    private TaskModel taskModel;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public TaskState getState() {
+        return state;
+    }
+
+    public void setState(TaskState state) {
+        this.state = state;
+    }
+
+    public long getTimeOfStateChange() {
+        return timeOfStateChange;
+    }
+
+    public void setTimeOfStateChange(long timeOfStateChange) {
+        this.timeOfStateChange = timeOfStateChange;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public TaskModel getTaskModel() {
+        return taskModel;
+    }
+
+    public TaskStatus setTaskModel(TaskModel taskModel) {
+        this.taskModel = taskModel;
+        return this;
+    }
+
+    public enum TaskState {
+        CREATED(0),
+        SCHEDULED(1),
+        EXECUTING(2),
+        COMPLETED(3),
+        FAILED(4),
+        CANCELED(5);
+
+        private final int value;
+
+        private TaskState(int value) {
+            this.value = value;
+        }
+
+        private static Map<Integer, TaskState> map = new HashMap<>();
+
+        static {
+            for (TaskState state : TaskState.values()) {
+                map.put(state.value, state);
+            }
+        }
+
+        public static TaskState valueOf(int taskState) {
+            return map.get(taskState);
+        }
+
+        /**
+         * Get the integer value of this enum value, as defined in the Thrift IDL.
+         */
+        public int getValue() {
+            return value;
+        }
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationDeploymentRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationDeploymentRepository.java
new file mode 100644 (file)
index 0000000..8699bea
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.application.ApplicationDeployment;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ApplicationDeploymentRepository extends CrudRepository<ApplicationDeployment, Long> {
+
+    public Optional<ApplicationDeployment> findById(long id);
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationIfaceRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationIfaceRepository.java
new file mode 100644 (file)
index 0000000..57a35fb
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.application.ApplicationInterface;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ApplicationIfaceRepository extends CrudRepository<ApplicationInterface, Long> {
+
+    public Optional<ApplicationInterface> findById(long id);
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationInputRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationInputRepository.java
new file mode 100644 (file)
index 0000000..624fdfe
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.application.ApplicationInput;
+import org.springframework.data.repository.CrudRepository;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ApplicationInputRepository extends CrudRepository<ApplicationInput, Long> {
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationModuleRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationModuleRepository.java
new file mode 100644 (file)
index 0000000..fd1a2ae
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.application.ApplicationModule;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ApplicationModuleRepository extends CrudRepository <ApplicationModule, Long> {
+
+    public Optional<ApplicationModule> findById(long id);
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationOutputRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ApplicationOutputRepository.java
new file mode 100644 (file)
index 0000000..852179f
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.application.ApplicationOutput;
+import org.springframework.data.repository.CrudRepository;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ApplicationOutputRepository extends CrudRepository<ApplicationOutput, Long> {
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ComputeRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ComputeRepository.java
new file mode 100644 (file)
index 0000000..fb73dfb
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.compute.ComputeResourceModel;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ComputeRepository extends CrudRepository<ComputeResourceModel, Long> {
+
+    public Optional<ComputeResourceModel> findById(long id);
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/DataStoreRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/DataStoreRepository.java
new file mode 100644 (file)
index 0000000..ec584c3
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.data.DataStoreModel;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.List;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface DataStoreRepository extends CrudRepository<DataStoreModel, Long>{
+
+    List<DataStoreModel> findByTaskModel_ParentProcess_Id(long processId);
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentInputDataRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentInputDataRepository.java
new file mode 100644 (file)
index 0000000..9087da7
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentInputData;
+import org.springframework.data.repository.CrudRepository;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ExperimentInputDataRepository extends CrudRepository<ExperimentInputData, Long> {
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentOutputDataRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentOutputDataRepository.java
new file mode 100644 (file)
index 0000000..b3b9392
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentOutputData;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ExperimentOutputDataRepository extends CrudRepository<ExperimentOutputData, Long> {
+    public Optional<ExperimentOutputData> findById(long id);
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentRepository.java
new file mode 100644 (file)
index 0000000..ca98567
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.experiment.Experiment;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ExperimentRepository extends CrudRepository<Experiment, Long> {
+    public Optional<Experiment> findById(long id);
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentStatusRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ExperimentStatusRepository.java
new file mode 100644 (file)
index 0000000..0b795c1
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentStatus;
+import org.springframework.data.repository.CrudRepository;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ExperimentStatusRepository extends CrudRepository<ExperimentStatus, Long> {
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ProcessRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ProcessRepository.java
new file mode 100644 (file)
index 0000000..d0dc311
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.process.ProcessModel;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ProcessRepository extends CrudRepository<ProcessModel, Long> {
+    Optional<ProcessModel> findById(long id);
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ProcessStatusRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/ProcessStatusRepository.java
new file mode 100644 (file)
index 0000000..bb11a9a
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.process.ProcessStatus;
+import org.springframework.data.repository.CrudRepository;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface ProcessStatusRepository extends CrudRepository<ProcessStatus, Long> {
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/TaskParamRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/TaskParamRepository.java
new file mode 100644 (file)
index 0000000..8d66c41
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.task.TaskParam;
+import org.springframework.data.repository.CrudRepository;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface TaskParamRepository extends CrudRepository<TaskParam, Long> {
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/TaskRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/TaskRepository.java
new file mode 100644 (file)
index 0000000..2701c33
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.task.TaskModel;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface TaskRepository extends CrudRepository<TaskModel, Long> {
+    public Optional<TaskModel> findById(long id);
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/TaskStatusRepository.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/repository/TaskStatusRepository.java
new file mode 100644 (file)
index 0000000..b79ad2b
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.k8s.api.server.repository;
+
+import org.apache.airavata.k8s.api.server.model.task.TaskStatus;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public interface TaskStatusRepository extends CrudRepository<TaskStatus, Long> {
+
+    public Optional<TaskStatus> findById(long id);
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ApplicationDeploymentService.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ApplicationDeploymentService.java
new file mode 100644 (file)
index 0000000..941ee6e
--- /dev/null
@@ -0,0 +1,87 @@
+/**
+ *
+ * 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.k8s.api.server.service;
+
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.server.model.application.ApplicationDeployment;
+import org.apache.airavata.k8s.api.server.repository.ApplicationDeploymentRepository;
+import org.apache.airavata.k8s.api.server.repository.ApplicationModuleRepository;
+import org.apache.airavata.k8s.api.server.repository.ComputeRepository;
+import org.apache.airavata.k8s.api.resources.application.ApplicationDeploymentResource;
+import org.apache.airavata.k8s.api.server.service.util.ToResourceUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Service
+public class ApplicationDeploymentService {
+
+    private ApplicationDeploymentRepository applicationDeploymentRepository;
+    private ComputeRepository computeRepository;
+    private ApplicationModuleRepository applicationModuleRepository;
+
+    @Autowired
+    public ApplicationDeploymentService(ApplicationDeploymentRepository applicationDeploymentRepository,
+                                        ComputeRepository computeRepository,
+                                        ApplicationModuleRepository applicationModuleRepository) {
+        this.applicationDeploymentRepository = applicationDeploymentRepository;
+        this.computeRepository = computeRepository;
+        this.applicationModuleRepository = applicationModuleRepository;
+    }
+
+    public long create(ApplicationDeploymentResource resource) {
+        ApplicationDeployment deployment = new ApplicationDeployment();
+        deployment.setPreJobCommand(resource.getPreJobCommand());
+        deployment.setPostJobCommand(resource.getPostJobCommand());
+        deployment.setExecutablePath(resource.getExecutablePath());
+        deployment.setName(resource.getName());
+        deployment.setComputeResource(computeRepository
+                .findById(resource.getComputeResourceId())
+                .orElseThrow(() -> new ServerRuntimeException("Can not find a compute resource with id " +
+                        resource.getComputeResourceId())));
+        deployment.setApplicationModule(applicationModuleRepository
+                .findById(resource.getApplicationModuleId())
+                .orElseThrow(() -> new ServerRuntimeException("Can not find an app module with id "
+                        + resource.getApplicationModuleId())));
+        ApplicationDeployment saved = applicationDeploymentRepository.save(deployment);
+        return saved.getId();
+    }
+
+    public Optional<ApplicationDeploymentResource> findById(long id) {
+        return ToResourceUtil.toResource(applicationDeploymentRepository.findById(id).get());
+    }
+
+    public List<ApplicationDeploymentResource> getAll() {
+        List<ApplicationDeploymentResource> deploymentList = new ArrayList<>();
+        Optional.ofNullable(applicationDeploymentRepository.findAll())
+                .ifPresent(deployments ->
+                        deployments.forEach(dep -> deploymentList.add(ToResourceUtil.toResource(dep).get())));
+        return deploymentList;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ApplicationIfaceService.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ApplicationIfaceService.java
new file mode 100644 (file)
index 0000000..e95b651
--- /dev/null
@@ -0,0 +1,109 @@
+/**
+ *
+ * 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.k8s.api.server.service;
+
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.server.model.application.ApplicationInput;
+import org.apache.airavata.k8s.api.server.model.application.ApplicationInterface;
+import org.apache.airavata.k8s.api.server.model.application.ApplicationOutput;
+import org.apache.airavata.k8s.api.server.repository.ApplicationIfaceRepository;
+import org.apache.airavata.k8s.api.server.repository.ApplicationInputRepository;
+import org.apache.airavata.k8s.api.server.repository.ApplicationModuleRepository;
+import org.apache.airavata.k8s.api.server.repository.ApplicationOutputRepository;
+import org.apache.airavata.k8s.api.resources.application.ApplicationIfaceResource;
+import org.apache.airavata.k8s.api.server.service.util.ToResourceUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Service
+public class ApplicationIfaceService {
+
+    private ApplicationIfaceRepository ifaceRepository;
+    private ApplicationInputRepository inputRepository;
+    private ApplicationOutputRepository outputRepository;
+    private ApplicationModuleRepository moduleRepository;
+
+    @Autowired
+    public ApplicationIfaceService(ApplicationIfaceRepository ifaceRepository,
+                                   ApplicationInputRepository inputRepository,
+                                   ApplicationOutputRepository outputRepository,
+                                   ApplicationModuleRepository moduleRepository) {
+        this.ifaceRepository = ifaceRepository;
+        this.inputRepository = inputRepository;
+        this.outputRepository = outputRepository;
+        this.moduleRepository = moduleRepository;
+    }
+
+    public long create(ApplicationIfaceResource resource) {
+
+        ApplicationInterface iface = new ApplicationInterface();
+        iface.setName(resource.getName());
+        iface.setDescription(resource.getDescription());
+
+        iface.setApplicationModule(moduleRepository
+                .findById(resource.getApplicationModuleId())
+                .orElseThrow(() -> new ServerRuntimeException("Can not find app module with id " +
+                        resource.getApplicationModuleId())));
+
+        Optional.ofNullable(resource.getInputs()).ifPresent(ips -> ips.forEach(ip -> {
+            ApplicationInput appInput = new ApplicationInput();
+            appInput.setName(ip.getName());
+            appInput.setValue(ip.getValue());
+            appInput.setArguments(ip.getArguments());
+            appInput.setType(ApplicationInput.DataType.valueOf(ip.getType()));
+            ApplicationInput saved = inputRepository.save(appInput);
+            iface.getInputs().add(saved);
+        }));
+
+        Optional.ofNullable(resource.getOutputs()).ifPresent(ops -> ops.forEach(op -> {
+            ApplicationOutput appOutput = new ApplicationOutput();
+            appOutput.setName(op.getName());
+            appOutput.setValue(op.getValue());
+            appOutput.setType(ApplicationOutput.DataType.valueOf(op.getType()));
+            ApplicationOutput saved = outputRepository.save(appOutput);
+            iface.getOutputs().add(saved);
+        }));
+
+        ApplicationInterface saved = ifaceRepository.save(iface);
+        return saved.getId();
+    }
+
+    public Optional<ApplicationIfaceResource> findById(long id) {
+        return ToResourceUtil.toResource(ifaceRepository.findById(id).get());
+    }
+
+    public List<ApplicationIfaceResource> getAll() {
+        List<ApplicationIfaceResource> computeList = new ArrayList<>();
+        Optional.ofNullable(ifaceRepository.findAll())
+                .ifPresent(computes ->
+                        computes.forEach(compute -> computeList.add(ToResourceUtil.toResource(compute).get())));
+        return computeList;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ApplicationModuleService.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ApplicationModuleService.java
new file mode 100644 (file)
index 0000000..e658c42
--- /dev/null
@@ -0,0 +1,69 @@
+/**
+ *
+ * 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.k8s.api.server.service;
+
+import org.apache.airavata.k8s.api.server.model.application.ApplicationModule;
+import org.apache.airavata.k8s.api.server.repository.ApplicationModuleRepository;
+import org.apache.airavata.k8s.api.resources.application.ApplicationModuleResource;
+import org.apache.airavata.k8s.api.server.service.util.ToResourceUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Service
+public class ApplicationModuleService {
+
+    private ApplicationModuleRepository applicationModuleRepository;
+
+    @Autowired
+    public ApplicationModuleService(ApplicationModuleRepository applicationModuleRepository) {
+        this.applicationModuleRepository = applicationModuleRepository;
+    }
+
+    public long create(ApplicationModuleResource resource) {
+        ApplicationModule module = new ApplicationModule();
+        module.setName(resource.getName());
+        module.setVersion(resource.getVersion());
+        module.setDescription(resource.getDescription());
+        ApplicationModule saved = this.applicationModuleRepository.save(module);
+        return saved.getId();
+    }
+
+    public Optional<ApplicationModuleResource> findById(long id) {
+        return ToResourceUtil.toResource(applicationModuleRepository.findById(id).get());
+    }
+
+    public List<ApplicationModuleResource> getAll() {
+        List<ApplicationModuleResource> computeList = new ArrayList<>();
+        Optional.ofNullable(applicationModuleRepository.findAll())
+                .ifPresent(computes ->
+                        computes.forEach(compute -> computeList.add(ToResourceUtil.toResource(compute).get())));
+        return computeList;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ComputeResourceService.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ComputeResourceService.java
new file mode 100644 (file)
index 0000000..bceda0b
--- /dev/null
@@ -0,0 +1,70 @@
+/**
+ *
+ * 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.k8s.api.server.service;
+
+import org.apache.airavata.k8s.api.server.model.compute.ComputeResourceModel;
+import org.apache.airavata.k8s.api.server.repository.ComputeRepository;
+import org.apache.airavata.k8s.api.resources.compute.ComputeResource;
+import org.apache.airavata.k8s.api.server.service.util.ToResourceUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Service
+public class ComputeResourceService {
+    private ComputeRepository computeRepository;
+
+    @Autowired
+    public ComputeResourceService(ComputeRepository computeRepository) {
+        this.computeRepository = computeRepository;
+    }
+
+    public long create(ComputeResource resource) {
+        ComputeResourceModel model = new ComputeResourceModel();
+        model.setName(resource.getName());
+        model.setHost(resource.getHost());
+        model.setUserName(resource.getUserName());
+        model.setPassword(resource.getPassword());
+        model.setCommunicationType(resource.getCommunicationType());
+        ComputeResourceModel saved = computeRepository.save(model);
+        return saved.getId();
+    }
+
+    public Optional<ComputeResource> findById(long id) {
+        return ToResourceUtil.toResource(computeRepository.findById(id).get());
+    }
+
+    public List<ComputeResource> getAll() {
+        List<ComputeResource> computeList = new ArrayList<>();
+        Optional.ofNullable(computeRepository.findAll())
+                .ifPresent(computes ->
+                        computes.forEach(compute -> computeList.add(ToResourceUtil.toResource(compute).get())));
+        return computeList;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ExperimentService.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ExperimentService.java
new file mode 100644 (file)
index 0000000..1ded541
--- /dev/null
@@ -0,0 +1,149 @@
+/**
+ *
+ * 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.k8s.api.server.service;
+
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.server.model.experiment.Experiment;
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentInputData;
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentOutputData;
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentStatus;
+import org.apache.airavata.k8s.api.server.repository.*;
+import org.apache.airavata.k8s.api.resources.experiment.ExperimentResource;
+import org.apache.airavata.k8s.api.server.service.messaging.MessagingService;
+import org.apache.airavata.k8s.api.server.service.util.ToResourceUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Service
+@Transactional
+public class ExperimentService {
+
+    private ExperimentRepository experimentRepository;
+    private ApplicationDeploymentRepository appDepRepository;
+    private ApplicationIfaceRepository appIfaceRepository;
+    private ExperimentInputDataRepository inputDataRepository;
+    private ExperimentOutputDataRepository outputDataRepository;
+    private ExperimentStatusRepository experimentStatusRepository;
+
+    private MessagingService messagingService;
+
+    @Value("${launch.topic.name}")
+    private String launchTopic;
+
+    @Autowired
+    public ExperimentService(ExperimentRepository experimentRepository,
+                             ApplicationDeploymentRepository appDepRepository,
+                             ApplicationIfaceRepository appIfaceRepository,
+                             ExperimentInputDataRepository inputDataRepository,
+                             ExperimentOutputDataRepository outputDataRepository,
+                             ExperimentStatusRepository experimentStatusRepository,
+                             MessagingService messagingService) {
+
+        this.experimentRepository = experimentRepository;
+        this.appDepRepository = appDepRepository;
+        this.appIfaceRepository = appIfaceRepository;
+        this.inputDataRepository = inputDataRepository;
+        this.outputDataRepository = outputDataRepository;
+        this.experimentStatusRepository = experimentStatusRepository;
+        this.messagingService = messagingService;
+    }
+
+    public long create(ExperimentResource resource) {
+        Experiment experiment = new Experiment();
+        experiment.setExperimentName(resource.getExperimentName());
+
+        experiment.setApplicationDeployment(appDepRepository.findById(resource.getApplicationDeploymentId())
+                .orElseThrow(() -> new ServerRuntimeException("Can not find app deployment with id " +
+                        resource.getApplicationDeploymentId())));
+
+        experiment.setApplicationInterface(appIfaceRepository.findById(resource.getApplicationInterfaceId())
+                .orElseThrow(() -> new ServerRuntimeException("Can not find app inerface with id " +
+                        resource.getApplicationInterfaceId())));
+
+        Optional.ofNullable(resource.getExperimentOutputs()).ifPresent(ops -> {
+            ops.forEach(op -> {
+                ExperimentOutputData outputData = new ExperimentOutputData();
+                outputData.setName(op.getName());
+                outputData.setValue(op.getValue());
+                outputData.setType(ExperimentOutputData.DataType.valueOf(op.getType()));
+                ExperimentOutputData saved = outputDataRepository.save(outputData);
+                experiment.getExperimentOutputs().add(saved);
+            });
+        });
+
+        Optional.ofNullable(resource.getExperimentInputs()).ifPresent(ips -> {
+            ips.forEach(ip -> {
+                ExperimentInputData inputData = new ExperimentInputData();
+                inputData.setName(ip.getName());
+                inputData.setValue(ip.getValue());
+                inputData.setType(ExperimentInputData.DataType.valueOf(ip.getType()));
+                inputData.setArguments(ip.getArguments());
+                ExperimentInputData saved = inputDataRepository.save(inputData);
+                experiment.getExperimentInputs().add(saved);
+            });
+        });
+
+        Experiment saved = experimentRepository.save(experiment);
+        return saved.getId();
+    }
+
+    public Optional<ExperimentResource> findById(long id) {
+        return ToResourceUtil.toResource(findEntityById(id).get());
+    }
+
+    public Optional<Experiment> findEntityById(long id) {
+        return this.experimentRepository.findById(id);
+    }
+
+    public long launchExperiment(long id) {
+        Experiment experiment = this.experimentRepository.findById(id).orElseThrow(() -> new ServerRuntimeException("Experiment with id " +
+                id + "can not be found"));
+        // TODO validate status and get a lock
+
+        ExperimentStatus experimentStatus = this.experimentStatusRepository.save(new ExperimentStatus()
+                .setState(ExperimentStatus.ExperimentState.LAUNCHED)
+                .setTimeOfStateChange(System.currentTimeMillis()));
+
+        experiment.getExperimentStatus().add(experimentStatus);
+
+        this.messagingService.send(this.launchTopic, "exp-" + id);
+        return 0;
+    }
+
+    public List<ExperimentResource> getAll() {
+        List<ExperimentResource> experimentList = new ArrayList<>();
+        Optional.ofNullable(experimentRepository.findAll())
+                .ifPresent(experiments ->
+                        experiments.forEach(experiment -> experimentList.add(ToResourceUtil.toResource(experiment).get())));
+        return experimentList;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ProcessService.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ProcessService.java
new file mode 100644 (file)
index 0000000..532a1d5
--- /dev/null
@@ -0,0 +1,99 @@
+/**
+ *
+ * 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.k8s.api.server.service;
+
+import org.apache.airavata.k8s.api.resources.process.ProcessStatusResource;
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.server.model.process.ProcessModel;
+import org.apache.airavata.k8s.api.server.model.process.ProcessStatus;
+import org.apache.airavata.k8s.api.server.model.task.TaskModel;
+import org.apache.airavata.k8s.api.server.repository.ProcessRepository;
+import org.apache.airavata.k8s.api.resources.process.ProcessResource;
+import org.apache.airavata.k8s.api.server.repository.ProcessStatusRepository;
+import org.apache.airavata.k8s.api.server.service.util.ToResourceUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Service
+public class ProcessService {
+
+    private ProcessRepository processRepository;
+    private ProcessStatusRepository processStatusRepository;
+
+    private ExperimentService experimentService;
+    private TaskService taskService;
+
+    public ProcessService(ProcessRepository processRepository,
+                          ProcessStatusRepository processStatusRepository,
+                          ExperimentService experimentService,
+                          TaskService taskService) {
+
+        this.processRepository = processRepository;
+        this.processStatusRepository = processStatusRepository;
+        this.experimentService = experimentService;
+        this.taskService = taskService;
+    }
+
+    public long create(ProcessResource resource) {
+
+        ProcessModel processModel = new ProcessModel();
+        processModel.setId(resource.getId());
+        processModel.setCreationTime(resource.getCreationTime());
+        processModel.setLastUpdateTime(resource.getLastUpdateTime());
+        processModel.setExperiment(experimentService.findEntityById(resource.getExperimentId())
+                .orElseThrow(() -> new ServerRuntimeException("Can not find experiment with id " +
+                        resource.getExperimentId())));
+        processModel.setExperimentDataDir(resource.getExperimentDataDir());
+
+        ProcessModel saved = processRepository.save(processModel);
+
+        Optional.ofNullable(resource.getTasks()).ifPresent(taskResources -> taskResources.forEach(taskRes -> {
+            TaskModel taskModel = new TaskModel();
+            taskRes.setParentProcessId(saved.getId());
+            taskModel.setId(taskService.create(taskRes));
+        }));
+
+        return saved.getId();
+    }
+
+    public long addProcessStatus(long processId, ProcessStatusResource resource) {
+        ProcessModel processModel = processRepository.findById(processId)
+                .orElseThrow(() -> new ServerRuntimeException("Process with id " + processId + " can not be found"));
+
+        ProcessStatus status = new ProcessStatus();
+        status.setReason(resource.getReason());
+        status.setState(ProcessStatus.ProcessState.valueOf(resource.getState()));
+        status.setTimeOfStateChange(resource.getTimeOfStateChange());
+        status.setProcessModel(processModel);
+        ProcessStatus savedStatus = processStatusRepository.save(status);
+        return savedStatus.getId();
+    }
+
+    public Optional<ProcessResource> findById(long id) {
+        return ToResourceUtil.toResource(processRepository.findById(id).get());
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/TaskService.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/TaskService.java
new file mode 100644 (file)
index 0000000..11a3b91
--- /dev/null
@@ -0,0 +1,109 @@
+/**
+ *
+ * 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.k8s.api.server.service;
+
+import org.apache.airavata.k8s.api.resources.task.TaskResource;
+import org.apache.airavata.k8s.api.resources.task.TaskStatusResource;
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
+import org.apache.airavata.k8s.api.server.model.task.TaskModel;
+import org.apache.airavata.k8s.api.server.model.task.TaskParam;
+import org.apache.airavata.k8s.api.server.model.task.TaskStatus;
+import org.apache.airavata.k8s.api.server.repository.ProcessRepository;
+import org.apache.airavata.k8s.api.server.repository.TaskParamRepository;
+import org.apache.airavata.k8s.api.server.repository.TaskRepository;
+import org.apache.airavata.k8s.api.server.repository.TaskStatusRepository;
+import org.apache.airavata.k8s.api.server.service.util.ToResourceUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Service
+public class TaskService {
+
+    private ProcessRepository processRepository;
+    private TaskRepository taskRepository;
+    private TaskParamRepository taskParamRepository;
+    private TaskStatusRepository taskStatusRepository;
+
+    public TaskService(ProcessRepository processRepository,
+                       TaskRepository taskRepository,
+                       TaskParamRepository taskParamRepository,
+                       TaskStatusRepository taskStatusRepository) {
+
+        this.processRepository = processRepository;
+        this.taskRepository = taskRepository;
+        this.taskParamRepository = taskParamRepository;
+        this.taskStatusRepository = taskStatusRepository;
+    }
+
+    public long create(TaskResource resource) {
+        TaskModel taskModel = new TaskModel();
+        taskModel.setCreationTime(resource.getCreationTime());
+        taskModel.setLastUpdateTime(resource.getLastUpdateTime());
+        taskModel.setOrderIndex(resource.getOrder());
+        taskModel.setTaskDetail(resource.getTaskDetail());
+        taskModel.setParentProcess(processRepository.findById(resource.getParentProcessId())
+                .orElseThrow(() -> new ServerRuntimeException("Can not find process with id " +
+                        resource.getParentProcessId())));
+        taskModel.setTaskType(TaskModel.TaskTypes.valueOf(resource.getTaskType()));
+
+        TaskModel savedTask = taskRepository.save(taskModel);
+
+        Optional.ofNullable(resource.getTaskParams()).ifPresent(params -> params.forEach(param -> {
+            TaskParam taskParam = new TaskParam();
+            taskParam.setKey(param.getKey());
+            taskParam.setValue(param.getValue());
+            taskParam.setTaskModel(savedTask);
+            taskParamRepository.save(taskParam);
+
+        }));
+        return savedTask.getId();
+    }
+
+    public long addTaskStatus(long taskId, TaskStatusResource resource) {
+
+        TaskModel taskModel = taskRepository.findById(taskId)
+                .orElseThrow(() -> new ServerRuntimeException("Task with id " + taskId + " can not be found"));
+
+        TaskStatus status = new TaskStatus();
+        status.setReason(resource.getReason());
+        status.setState(TaskStatus.TaskState.valueOf(resource.getState()));
+        status.setTimeOfStateChange(resource.getTimeOfStateChange());
+        status.setTaskModel(taskModel);
+        TaskStatus savedStatus = taskStatusRepository.save(status);
+
+        return savedStatus.getId();
+    }
+
+    public Optional<TaskStatusResource> findTaskStatusById(long id) {
+        return ToResourceUtil.toResource(taskStatusRepository.findById(id).get());
+    }
+
+    public Optional<TaskResource> findById(long id) {
+        return ToResourceUtil.toResource(taskRepository.findById(id).get());
+    }
+
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/data/DataStoreService.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/data/DataStoreService.java
new file mode 100644 (file)
index 0000000..27fceb1
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+ *
+ * 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.k8s.api.server.service.data;
+
+import org.apache.airavata.k8s.api.resources.data.DataEntryResource;
+import org.apache.airavata.k8s.api.server.model.data.DataStoreModel;
+import org.apache.airavata.k8s.api.server.repository.DataStoreRepository;
+import org.apache.airavata.k8s.api.server.repository.ExperimentOutputDataRepository;
+import org.apache.airavata.k8s.api.server.repository.TaskRepository;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Service
+public class DataStoreService {
+
+    private DataStoreRepository dataStoreRepository;
+    private TaskRepository taskRepository;
+    private ExperimentOutputDataRepository experimentOutputDataRepository;
+
+    public DataStoreService(DataStoreRepository dataStoreRepository,
+                            TaskRepository taskRepository,
+                            ExperimentOutputDataRepository experimentOutputDataRepository) {
+        this.dataStoreRepository = dataStoreRepository;
+        this.taskRepository = taskRepository;
+        this.experimentOutputDataRepository = experimentOutputDataRepository;
+    }
+
+    public long createEntry(long taskId, long expOutId, byte[] content) {
+        DataStoreModel model = new DataStoreModel();
+        model.setTaskModel(taskRepository.findById(taskId).get())
+                .setExperimentOutputData(experimentOutputDataRepository.findById(expOutId).get())
+                .setContent(content);
+        return dataStoreRepository.save(model).getId();
+    }
+
+    public List<DataEntryResource> getEntriesForProcess(long processId) {
+        List<DataEntryResource> entries = new ArrayList<>();
+        List<DataStoreModel> dataStoreModels = this.dataStoreRepository.findByTaskModel_ParentProcess_Id(processId);
+        Optional.ofNullable(dataStoreModels).ifPresent(models -> models.forEach(model -> entries.add(new DataEntryResource()
+                .setId(model.getId())
+                .setName(model.getExperimentOutputData().getName())
+                .setDataType(model.getExperimentOutputData().getType().name()))));
+        return entries;
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/messaging/MessagingService.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/messaging/MessagingService.java
new file mode 100644 (file)
index 0000000..19c9312
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ *
+ * 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.k8s.api.server.service.messaging;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.stereotype.Service;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Service
+public class MessagingService {
+
+    @Autowired
+    private KafkaTemplate<String, String> kafkaTemplate;
+
+    public void send(String topic, String payload) {
+        kafkaTemplate.send(topic, payload);
+    }
+
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/messaging/SenderConfig.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/messaging/SenderConfig.java
new file mode 100644 (file)
index 0000000..0ec1c74
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ *
+ * 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.k8s.api.server.service.messaging;
+
+import org.apache.kafka.clients.producer.ProducerConfig;
+import org.apache.kafka.common.serialization.StringSerializer;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.kafka.core.DefaultKafkaProducerFactory;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.kafka.core.ProducerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@Configuration
+public class SenderConfig {
+    @Value("${kafka.bootstrap-servers}")
+    private String bootstrapServers;
+
+    @Bean
+    public Map<String, Object> producerConfigs() {
+        Map<String, Object> props = new HashMap<>();
+        // list of host:port pairs used for establishing the initial connections to the Kakfa cluster
+        props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
+        props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
+        props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
+        return props;
+    }
+
+    @Bean
+    public ProducerFactory<String, String> producerFactory() {
+        return new DefaultKafkaProducerFactory<String, String>(producerConfigs());
+    }
+
+    @Bean
+    public KafkaTemplate<String, String> kafkaTemplate() {
+        return new KafkaTemplate<>(producerFactory());
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/util/ToResourceUtil.java b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/util/ToResourceUtil.java
new file mode 100644 (file)
index 0000000..0318978
--- /dev/null
@@ -0,0 +1,305 @@
+/**
+ *
+ * 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.k8s.api.server.service.util;
+
+import org.apache.airavata.k8s.api.resources.experiment.ExperimentStatusResource;
+import org.apache.airavata.k8s.api.resources.process.ProcessStatusResource;
+import org.apache.airavata.k8s.api.resources.task.TaskParamResource;
+import org.apache.airavata.k8s.api.resources.task.TaskResource;
+import org.apache.airavata.k8s.api.resources.task.TaskStatusResource;
+import org.apache.airavata.k8s.api.server.model.application.ApplicationDeployment;
+import org.apache.airavata.k8s.api.server.model.application.ApplicationInterface;
+import org.apache.airavata.k8s.api.server.model.application.ApplicationModule;
+import org.apache.airavata.k8s.api.server.model.compute.ComputeResourceModel;
+import org.apache.airavata.k8s.api.server.model.experiment.Experiment;
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentInputData;
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentOutputData;
+import org.apache.airavata.k8s.api.server.model.experiment.ExperimentStatus;
+import org.apache.airavata.k8s.api.server.model.process.ProcessModel;
+import org.apache.airavata.k8s.api.server.model.process.ProcessStatus;
+import org.apache.airavata.k8s.api.server.model.task.TaskModel;
+import org.apache.airavata.k8s.api.resources.application.*;
+import org.apache.airavata.k8s.api.resources.compute.ComputeResource;
+import org.apache.airavata.k8s.api.resources.experiment.ExperimentInputResource;
+import org.apache.airavata.k8s.api.resources.experiment.ExperimentOutputResource;
+import org.apache.airavata.k8s.api.resources.experiment.ExperimentResource;
+import org.apache.airavata.k8s.api.resources.process.ProcessResource;
+import org.apache.airavata.k8s.api.server.model.task.TaskParam;
+import org.apache.airavata.k8s.api.server.model.task.TaskStatus;
+
+import java.util.Optional;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+public class ToResourceUtil {
+
+    public static Optional<ExperimentStatusResource> toResource(ExperimentStatus experimentStatus) {
+        if (experimentStatus != null) {
+            ExperimentStatusResource resource = new ExperimentStatusResource();
+            resource.setId(experimentStatus.getId());
+            resource.setState(experimentStatus.getState().getValue());
+            resource.setReason(experimentStatus.getReason());
+            resource.setStateStr(experimentStatus.getState().name());
+            resource.setTimeOfStateChange(experimentStatus.getTimeOfStateChange());
+            return Optional.of(resource);
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<ExperimentResource> toResource(Experiment experiment) {
+
+        if (experiment != null) {
+            ExperimentResource resource = new ExperimentResource();
+            resource.setId(experiment.getId());
+            resource.setExperimentName(experiment.getExperimentName());
+            resource.setDescription(experiment.getDescription());
+            resource.setCreationTime(experiment.getCreationTime());
+            Optional.ofNullable(experiment.getErrors())
+                    .ifPresent(errs -> errs.forEach(err -> resource.getErrorsIds().add(err.getId())));
+            Optional.ofNullable(experiment.getExperimentStatus())
+                    .ifPresent(sts -> sts.forEach(status -> resource.getExperimentStatus().add(toResource(status).get())));
+            Optional.ofNullable(experiment.getExperimentInputs())
+                    .ifPresent(ips -> ips.forEach(ip -> resource.getExperimentInputs().add(toResource(ip).get())));
+            Optional.ofNullable(experiment.getExperimentOutputs())
+                    .ifPresent(ops -> ops.forEach(op -> resource.getExperimentOutputs().add(toResource(op).get())));
+            Optional.ofNullable(experiment.getApplicationDeployment())
+                    .ifPresent(appDep -> {
+                        resource.setApplicationDeploymentId(appDep.getId());
+                        resource.setApplicationDeploymentName(appDep.getName());
+                    });
+            Optional.ofNullable(experiment.getApplicationInterface())
+                    .ifPresent(iface -> {
+                        resource.setApplicationInterfaceId(iface.getId());
+                        resource.setApplicationInterfaceName(iface.getName());
+                    });
+            Optional.ofNullable(experiment.getProcesses())
+                    .ifPresent(processModels -> processModels
+                            .forEach(processModel -> resource.getProcessIds().add(processModel.getId())));
+            return Optional.of(resource);
+
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<ExperimentInputResource> toResource(ExperimentInputData input) {
+        if (input != null) {
+            ExperimentInputResource resource = new ExperimentInputResource();
+            resource.setId(input.getId());
+            resource.setName(input.getName());
+            resource.setValue(input.getValue());
+            resource.setType(input.getType().getValue());
+            resource.setArguments(input.getArguments());
+            return Optional.of(resource);
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<ExperimentOutputResource> toResource(ExperimentOutputData output) {
+        if (output != null) {
+            ExperimentOutputResource resource = new ExperimentOutputResource();
+            resource.setId(output.getId());
+            resource.setName(output.getName());
+            resource.setValue(output.getValue());
+            resource.setType(output.getType().getValue());
+            return Optional.of(resource);
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<ComputeResource> toResource(ComputeResourceModel computeResourceModel) {
+
+        if (computeResourceModel != null) {
+            ComputeResource resource = new ComputeResource();
+            resource.setId(computeResourceModel.getId());
+            resource.setName(computeResourceModel.getName());
+            resource.setUserName(computeResourceModel.getUserName());
+            resource.setPassword(computeResourceModel.getPassword());
+            resource.setCommunicationType(computeResourceModel.getCommunicationType());
+            resource.setHost(computeResourceModel.getHost());
+            return Optional.of(resource);
+
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<ApplicationModuleResource> toResource(ApplicationModule applicationModule) {
+
+        if (applicationModule != null) {
+            ApplicationModuleResource resource = new ApplicationModuleResource();
+            resource.setId(applicationModule.getId());
+            resource.setName(applicationModule.getName());
+            resource.setDescription(applicationModule.getDescription());
+            resource.setVersion(applicationModule.getVersion());
+            return Optional.of(resource);
+
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<ApplicationDeploymentResource> toResource(ApplicationDeployment applicationDeployment) {
+        if (applicationDeployment != null) {
+            ApplicationDeploymentResource resource = new ApplicationDeploymentResource();
+            resource.setId(applicationDeployment.getId());
+            resource.setExecutablePath(applicationDeployment.getExecutablePath());
+            resource.setPreJobCommand(applicationDeployment.getPreJobCommand());
+            resource.setPostJobCommand(applicationDeployment.getPostJobCommand());
+            resource.setName(applicationDeployment.getName());
+            Optional.ofNullable(applicationDeployment.getApplicationModule())
+                    .ifPresent(module -> resource.setApplicationModuleId(module.getId()));
+            Optional.ofNullable(applicationDeployment.getComputeResource())
+                    .ifPresent(cr -> resource.setComputeResourceId(cr.getId()));
+            return Optional.of(resource);
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<ApplicationIfaceResource> toResource(ApplicationInterface applicationInterface) {
+        if (applicationInterface != null) {
+            ApplicationIfaceResource resource = new ApplicationIfaceResource();
+            resource.setId(applicationInterface.getId());
+            resource.setName(applicationInterface.getName());
+            resource.setApplicationModuleId(applicationInterface.getId());
+            resource.setDescription(applicationInterface.getDescription());
+
+            Optional.ofNullable(applicationInterface.getInputs()).ifPresent(ips -> ips.forEach(ip -> {
+                ApplicationInputResource ipResource = new ApplicationInputResource();
+                ipResource.setId(ip.getId());
+                ipResource.setName(ip.getName());
+                ipResource.setArguments(ip.getArguments());
+                ipResource.setType(ip.getType().getValue());
+                ipResource.setValue(ip.getValue());
+                resource.getInputs().add(ipResource);
+            }));
+
+            Optional.ofNullable(applicationInterface.getOutputs()).ifPresent(ops -> ops.forEach(op -> {
+                ApplicationOutputResource opResource = new ApplicationOutputResource();
+                opResource.setId(op.getId());
+                opResource.setName(op.getName());
+                opResource.setType(op.getType().getValue());
+                opResource.setValue(op.getValue());
+                resource.getOutputs().add(opResource);
+            }));
+
+            return Optional.of(resource);
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<TaskResource> toResource(TaskModel taskModel) {
+        if (taskModel != null) {
+            TaskResource resource = new TaskResource();
+            resource.setId(taskModel.getId());
+            resource.setLastUpdateTime(taskModel.getLastUpdateTime());
+            resource.setCreationTime(taskModel.getCreationTime());
+            resource.setParentProcessId(taskModel.getParentProcess().getId());
+            resource.setTaskType(taskModel.getTaskType().getValue());
+            resource.setTaskTypeStr(taskModel.getTaskType().name());
+            resource.setTaskDetail(taskModel.getTaskDetail());
+            Optional.ofNullable(taskModel.getTaskParams())
+                    .ifPresent(params ->
+                            params.forEach(param -> resource.getTaskParams()
+                                    .add(toResource(param).get())));
+
+            Optional.ofNullable(taskModel.getTaskStatuses())
+                    .ifPresent(taskStatuses ->
+                            taskStatuses.forEach(taskStatus -> resource.getTaskStatus()
+                                    .add(toResource(taskStatus).get())));
+
+            resource.setOrder(taskModel.getOrderIndex());
+            return Optional.of(resource);
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<TaskStatusResource> toResource(TaskStatus taskStatus) {
+        if (taskStatus != null) {
+            TaskStatusResource resource = new TaskStatusResource();
+            resource.setId(taskStatus.getId());
+            resource.setState(taskStatus.getState().getValue());
+            resource.setTimeOfStateChange(taskStatus.getTimeOfStateChange());
+            resource.setTaskId(taskStatus.getTaskModel().getId());
+            resource.setStateStr(taskStatus.getState().name());
+            resource.setReason(taskStatus.getReason());
+            return Optional.of(resource);
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<TaskParamResource> toResource(TaskParam taskParam) {
+        if (taskParam != null) {
+            TaskParamResource resource = new TaskParamResource();
+            resource.setId(taskParam.getId());
+            resource.setKey(taskParam.getKey());
+            resource.setValue(taskParam.getValue());
+            return Optional.of(resource);
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<ProcessResource> toResource(ProcessModel processModel) {
+        if (processModel != null) {
+            ProcessResource processResource = new ProcessResource();
+            processResource.setId(processModel.getId());
+            processResource.setLastUpdateTime(processModel.getLastUpdateTime());
+            processResource.setExperimentId(processModel.getExperiment().getId());
+            processResource.setTaskDag(processModel.getTaskDag());
+            processResource.setCreationTime(processModel.getCreationTime());
+            Optional.ofNullable(processModel.getProcessStatuses())
+                    .ifPresent(stss -> stss.forEach(sts -> processResource.getProcessStatuses().add(toResource(sts).get())));
+            Optional.ofNullable(processModel.getTasks())
+                    .ifPresent(tasks -> tasks.forEach(task -> processResource.getTasks().add(toResource(task).get())));
+            Optional.ofNullable(processModel.getProcessErrors())
+                    .ifPresent(errs -> errs.forEach(err -> processResource.getProcessErrorIds().add(err.getId())));
+            return Optional.of(processResource);
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    public static Optional<ProcessStatusResource> toResource(ProcessStatus processStatus) {
+        if (processStatus != null) {
+            ProcessStatusResource resource = new ProcessStatusResource();
+            resource.setId(processStatus.getId());
+            resource.setState(processStatus.getState().getValue());
+            resource.setTimeOfStateChange(processStatus.getTimeOfStateChange());
+            resource.setStateStr(processStatus.getState().name());
+            resource.setReason(processStatus.getReason());
+            resource.setProcessId(processStatus.getProcessModel().getId());
+            return Optional.of(resource);
+        } else {
+            return Optional.empty();
+        }
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/resources/application.properties b/airavata-kubernetes/modules/microservices/api-server/src/main/resources/application.properties
new file mode 100644 (file)
index 0000000..6f76911
--- /dev/null
@@ -0,0 +1,5 @@
+spring.jpa.hibernate.ddl-auto=update
+spring.datasource.url=jdbc:mysql://db.default.svc.cluster.local:3306/airavata
+spring.datasource.username=root
+spring.datasource.password=fun123
+launch.topic.name = airavata-launch
\ No newline at end of file
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/resources/application.yml b/airavata-kubernetes/modules/microservices/api-server/src/main/resources/application.yml
new file mode 100644 (file)
index 0000000..069dd61
--- /dev/null
@@ -0,0 +1,4 @@
+kafka:
+  bootstrap-servers: kafka.default.svc.cluster.local:9092
+  topic:
+    helloworld: helloworld.t
\ No newline at end of file
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/resources/docker/Dockerfile b/airavata-kubernetes/modules/microservices/api-server/src/main/resources/docker/Dockerfile
new file mode 100644 (file)
index 0000000..d34508b
--- /dev/null
@@ -0,0 +1,6 @@
+FROM openjdk:8-jdk-alpine
+VOLUME /tmp
+COPY ${project.build.finalName}.jar app.jar
+ENV JAVA_OPTS=""
+EXPOSE 8080
+ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar
\ No newline at end of file
diff --git a/airavata-kubernetes/modules/microservices/event-sink/pom.xml b/airavata-kubernetes/modules/microservices/event-sink/pom.xml
new file mode 100644 (file)
index 0000000..0c4d2ee
--- /dev/null
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>airavata-kubernetes</artifactId>
+        <groupId>org.apache.airavata</groupId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>event-sink</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>api-resource</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-freemarker</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.kafka</groupId>
+            <artifactId>spring-kafka</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.5.1</version>
+                <configuration>
+                    <source>${java.version}</source>
+                    <target>${java.version}</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+
+        <profile>
+            <id>jar</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <properties>
+                <artifact-packaging>jar</artifact-packaging>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.springframework.boot</groupId>
+                        <artifactId>spring-boot-maven-plugin</artifactId>
+                        <version>1.4.3.RELEASE</version>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>repackage</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <!-- Create a docker image that runs the executable jar-->
+                    <plugin>
+                        <groupId>com.spotify</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <version>1.0.0</version>
+                        <configuration>
+                            <imageName>${docker.image.prefix}/event-sink</imageName>
+                            <baseImage>java:openjdk-8-jdk-alpine</baseImage>
+                            <entryPoint>["java","-jar","/${project.build.finalName}.jar"]</entryPoint>
+                            <resources>
+                                <resource>
+                                    <targetPath>/</targetPath>
+                                    <directory>${project.build.directory}</directory>
+                                    <include>${project.build.finalName}.jar</include>
+                                </resource>
+                            </resources>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>build</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>war</id>
+            <properties>
+                <artifact-packaging>war</artifact-packaging>
+            </properties>
+            <dependencies>
+                <dependency>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                    <scope>provided</scope>
+                </dependency>
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.springframework.boot</groupId>
+                        <artifactId>spring-boot-maven-plugin</artifactId>
+                        <version>1.4.3.RELEASE</version>
+                        <configuration>
+                            <!-- this will get rid of version info from war file name -->
+                            <finalName>event-sink</finalName>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
\ No newline at end of file
diff --git a/airavata-kubernetes/modules/microservices/event-sink/src/main/java/org/apache/airavata/k8s/sink/Application.java b/airavata-kubernetes/modules/microservices/event-sink/src/main/java/org/apache/airavata/k8s/sink/Application.java
new file mode 100644 (file)
index 0000000..3c7b91f
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ *
+ * 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.k8s.sink;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * TODO: Class level comments please
+ *
+ * @author dimuthu
+ * @since 1.0.0-SNAPSHOT
+ */
+@SpringBootApplication
+@Configuration
+@ComponentScan
+public class Application {
+
+    public static void main(String[] args) {
+        SpringApplication.run(Application.class, args);
+    }
+
+    @Bean
+    public RestTemplate restTemplate(RestTemplateBuilder builder) {
+        return builder.build();
+    }
+}
diff --git a/airavata-kubernetes/modules/microservices/event-sink/src/main/java/org/apache/airavata/k8s/sink/messaging/KafkaReceiver.java b/airavata-kubernetes/modules/microservices/event-sink/src/main/java/org/apache/airavata/k8s/sink/messaging/KafkaReceiver.java
new file mode 100644 (file)
index 0000000..e6bec6b
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+ *
+ * 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&