You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2017/12/02 18:43:26 UTC
[airavata-sandbox] branch master updated: Added serverhandler,
server and client for allocation manager (#20)
This is an automated email from the ASF dual-hosted git repository.
smarru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git
The following commit(s) were added to refs/heads/master by this push:
new da740d1 Added serverhandler, server and client for allocation manager (#20)
da740d1 is described below
commit da740d18557299d1a0725682e18211359e397232
Author: Madrina Thapa <ma...@gmail.com>
AuthorDate: Sat Dec 2 13:43:24 2017 -0500
Added serverhandler, server and client for allocation manager (#20)
* Added new structure in thrift model file.
* Added AllocationManagerServerHandler file to implement all the thrift CPI methods
* Added DBHandler, server, client and a method in thrift chi to update the allocation request
* Added the main Server file in airavata-sandbox/allocation_manager.
* Merge remote-tracking branch 'apache/master'
# Conflicts:
#
allocation-manager/airavata-allocation-manager/airavata-allocation-manag
er-server/pom.xml
#
allocation-manager/airavata-allocation-manager/airavata-allocation-manag
er-server/src/main/java/org/apache/airavata/allocation/manager/server/Al
locationManagerServerHandler.java
#
allocation-manager/airavata-allocation-manager/airavata-allocation-manag
er-stubs/src/main/java/org/apache/airavata/allocation/manager/service/cp
i/AllocationRegistryService.java
#
allocation-manager/allocation-manager-docs/api-docs/allocation_manager_c
pi.html
# allocation-manager/allocation-manager-docs/api-docs/index.html
# allocation-manager/thrift_models/allocation_manager_cpi.thrift
---
.../airavata-allocation-manager-server/.gitignore | 1 +
.../airavata-allocation-manager-server/pom.xml | 12 +
.../UserAllocationDetailRepository.java | 6 +-
.../messaging/AllocationServiceDBEventHandler.java | 124 +++
.../AllocationServiceDBEventMessagingFactory.java | 99 +++
.../manager/server/AllocationManagerServer.java | 168 ++++
.../server/AllocationManagerServerHandler.java | 165 +++-
.../allocation/manager/server/ServerMain.java | 91 +++
.../allocation/manager/utils/Constants.java | 23 +
.../manager/utils/ThriftDataModelConversion.java | 31 +
.../client/AllocationServiceClientFactory.java | 35 +
.../service/cpi/AllocationRegistryService.java | 871 ++++++++++++++++++++-
.../api-docs/allocation_manager_cpi.html | 20 +
.../allocation-manager-docs/api-docs/index.html | 5 +
.../thrift_models/allocation_manager_cpi.thrift | 8 +-
15 files changed, 1622 insertions(+), 37 deletions(-)
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/.gitignore b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
index 991173e..1cd1814 100644
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
@@ -47,6 +47,18 @@
<version>0.10.0</version>
<type>pom</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-commons</artifactId>
+ <version>0.17-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-messaging-core</artifactId>
+ <version>0.17-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
index adfd6d2..394f2b8 100644
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
@@ -1,11 +1,13 @@
package org.apache.airavata.allocation.manager.db.repositories;
import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity;
-import org.apache.airavata.allocation.manager.models.UserAllocationDetail;
+import org.apache.airavata.allocation.manager.models.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class UserAllocationDetailRepository extends AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity, String> {
+public class UserAllocationDetailRepository
+ //extends AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity, UserAllocationDetailPK>{
+ extends AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity, String> {
private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
public UserAllocationDetailRepository(){
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/messaging/AllocationServiceDBEventHandler.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/messaging/AllocationServiceDBEventHandler.java
new file mode 100644
index 0000000..fd33c59
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/messaging/AllocationServiceDBEventHandler.java
@@ -0,0 +1,124 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.airavata.allocation.manager.messaging;
+
+import org.apache.airavata.common.exception.AiravataException;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.common.utils.ThriftUtils;
+import org.apache.airavata.messaging.core.MessageContext;
+import org.apache.airavata.messaging.core.MessageHandler;
+import org.apache.airavata.model.dbevent.DBEventMessage;
+import org.apache.airavata.model.dbevent.DBEventMessageContext;
+import org.apache.airavata.model.error.DuplicateEntryException;
+import org.apache.airavata.model.user.UserProfile;
+import org.apache.airavata.allocation.manager.client.AllocationServiceClientFactory;
+import org.apache.airavata.allocation.manager.models.*;
+import org.apache.airavata.allocation.manager.server.AllocationManagerServer;
+import org.apache.airavata.allocation.manager.service.cpi.AllocationRegistryService;
+import org.apache.airavata.allocation.manager.utils.ThriftDataModelConversion;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author madrinathapa
+ */
+public class AllocationServiceDBEventHandler implements MessageHandler {
+
+ private final static Logger log = LoggerFactory.getLogger(AllocationServiceDBEventHandler.class);
+
+ private final AllocationRegistryService.Client allocationManagerClient;
+
+ AllocationServiceDBEventHandler() throws ApplicationSettingsException, AllocationManagerException {
+ log.info("Starting Allocation registry client.....");
+ allocationManagerClient = AllocationServiceClientFactory.createAllocationRegistryClient(ServerSettings.getSetting(AllocationManagerServer.ALLOCATION_REG_SERVER_HOST), Integer.parseInt(ServerSettings.getSetting(AllocationManagerServer.ALLOCATION_REG_SERVER_PORT)));
+ }
+
+ @Override
+ public void onMessage(MessageContext messageContext) {
+
+ log.info("New DB Event message to Allocation service.");
+
+ try{
+
+ byte[] bytes = ThriftUtils.serializeThriftObject(messageContext.getEvent());
+
+ DBEventMessage dbEventMessage = new DBEventMessage();
+ ThriftUtils.createThriftFromBytes(bytes, dbEventMessage);
+
+ log.info("DB Event message to Allocation service from " + dbEventMessage.getPublisherService());
+
+ DBEventMessageContext dBEventMessageContext = dbEventMessage.getMessageContext();
+ try{
+ switch (dBEventMessageContext.getPublisher().getPublisherContext().getEntityType()){
+
+ case USER_PROFILE :
+
+ log.info("User profile specific DB Event communicated by " + dbEventMessage.getPublisherService());
+
+ UserProfile userProfile = new UserProfile();
+ ThriftUtils.createThriftFromBytes(dBEventMessageContext.getPublisher().getPublisherContext().getEntityDataModel(), userProfile);
+
+ userProfile.setUserId(userProfile.getAiravataInternalUserId());
+ UserAllocationDetail user = ThriftDataModelConversion.getUser(userProfile);
+
+ switch (dBEventMessageContext.getPublisher().getPublisherContext().getCrudType()){
+
+ case CREATE:
+ log.info("Creating user. User name: " + user.id.getUsername());
+
+ allocationManagerClient.createAllocationRequest(user);
+ log.debug("User created. User name : " + user.id.getUsername());
+
+ break;
+
+ case READ:
+ log.info("Updating user. User name : " + user.id.getUsername());
+
+ allocationManagerClient.getAllocationRequest(user.id.projectId);
+ log.debug("User updated. User Id : " + user.id.getUsername());
+
+ break;
+
+ case UPDATE:
+ log.info("Updating user. User name : " + user.id.getUsername());
+ //To be done
+ log.debug("User updated. User Id : " + user.id.getUsername());
+
+ break;
+
+ case DELETE:
+ log.info("Deleting user. User name : " + user.id.getUsername());
+
+ allocationManagerClient.deleteAllocationRequest(user.id.projectId);
+ log.debug("User deleted. User name : " + user.id.getUsername());
+
+ break;
+ }
+ break;
+
+ default: log.error("Handler not defined for " + dBEventMessageContext.getPublisher().getPublisherContext().getEntityType());
+ }
+ } catch (DuplicateEntryException ex) {
+ // log this exception and proceed (do nothing)
+ // this exception is thrown mostly when messages are re-consumed in case of some exception, hence ignore
+ log.warn("DuplicateEntryException while consuming db-event message, ex: " + ex.getMessage(), ex);
+ }
+
+ log.info("Sending ack. Message Delivery Tag : " + messageContext.getDeliveryTag());
+ AllocationServiceDBEventMessagingFactory.getDBEventSubscriber().sendAck(messageContext.getDeliveryTag());
+
+ } catch (TException e) {
+ log.error("Error processing message.", e);
+ } catch (ApplicationSettingsException e) {
+ log.error("Error fetching application settings.", e);
+ } catch (AiravataException e) {
+ log.error("Error sending ack. Message Delivery Tag : " + messageContext.getDeliveryTag(), e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/messaging/AllocationServiceDBEventMessagingFactory.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/messaging/AllocationServiceDBEventMessagingFactory.java
new file mode 100644
index 0000000..c57910a
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/messaging/AllocationServiceDBEventMessagingFactory.java
@@ -0,0 +1,99 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.airavata.allocation.manager.messaging;
+
+
+import org.apache.airavata.common.exception.AiravataException;
+import org.apache.airavata.common.utils.DBEventManagerConstants;
+import org.apache.airavata.common.utils.DBEventService;
+import org.apache.airavata.messaging.core.MessageContext;
+import org.apache.airavata.messaging.core.MessagingFactory;
+import org.apache.airavata.messaging.core.Publisher;
+import org.apache.airavata.messaging.core.Subscriber;
+import org.apache.airavata.model.dbevent.DBEventMessage;
+import org.apache.airavata.model.dbevent.DBEventMessageContext;
+import org.apache.airavata.model.dbevent.DBEventSubscriber;
+import org.apache.airavata.model.dbevent.DBEventType;
+import org.apache.airavata.model.messaging.event.MessageType;
+import org.apache.airavata.allocation.manager.models.AllocationManagerException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+/**
+ *
+ * @author madrinathapa
+ */
+public class AllocationServiceDBEventMessagingFactory {
+
+ private final static Logger log = LoggerFactory.getLogger(AllocationServiceDBEventMessagingFactory.class);
+
+ private static Publisher dbEventPublisher;
+
+ private static Subscriber allocationServiceDBEventSubscriber;
+
+ /**
+ * Get publisher for DB Event queue
+ * Change access specifier as required
+ * @return
+ * @throws AiravataException
+ */
+ private static Publisher getDBEventPublisher() throws AiravataException {
+ if(null == dbEventPublisher){
+ synchronized (AllocationServiceDBEventMessagingFactory.class){
+ if(null == dbEventPublisher){
+ log.info("Creating DB Event publisher.....");
+ dbEventPublisher = MessagingFactory.getDBEventPublisher();
+ log.info("DB Event publisher created");
+ }
+ }
+ }
+ return dbEventPublisher;
+ }
+
+ public static Subscriber getDBEventSubscriber() throws AiravataException, AllocationManagerException {
+ if(null == allocationServiceDBEventSubscriber){
+ synchronized (AllocationServiceDBEventMessagingFactory.class){
+ if(null == allocationServiceDBEventSubscriber){
+ log.info("Creating DB Event publisher.....");
+ allocationServiceDBEventSubscriber = MessagingFactory.getDBEventSubscriber(new AllocationServiceDBEventHandler(), DBEventService.ALLOCATION.toString());
+ log.info("DB Event publisher created");
+ }
+ }
+ }
+ return allocationServiceDBEventSubscriber;
+ }
+
+ /**
+ * Register Allocation Manager service with stated publishers
+ * @param publishers
+ * @return
+ * @throws AiravataException
+ */
+ public static boolean registerAllocationServiceWithPublishers(List<String> publishers) throws AiravataException {
+
+ for(String publisher : publishers){
+
+ log.info("Sending service discovery message. Publisher : " + publisher + ", Subscriber : " + DBEventService.ALLOCATION.toString());
+
+ DBEventSubscriber dbEventSubscriber = new DBEventSubscriber(DBEventService.ALLOCATION.toString());
+ DBEventMessageContext dbEventMessageContext = new DBEventMessageContext();
+ dbEventMessageContext.setSubscriber(dbEventSubscriber);
+
+ DBEventMessage dbEventMessage = new DBEventMessage(DBEventType.SUBSCRIBER, dbEventMessageContext, publisher);
+
+ MessageContext messageContext = new MessageContext(dbEventMessage, MessageType.DB_EVENT, "", "");
+
+ getDBEventPublisher().publish(messageContext, DBEventManagerConstants.getRoutingKey(DBEventService.DB_EVENT.toString()));
+
+ }
+
+ return true;
+ }
+
+}
+
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/server/AllocationManagerServer.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/server/AllocationManagerServer.java
new file mode 100644
index 0000000..58af710
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/server/AllocationManagerServer.java
@@ -0,0 +1,168 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.airavata.allocation.manager.server;
+
+import org.apache.airavata.common.utils.IServer;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.allocation.manager.messaging.AllocationServiceDBEventMessagingFactory;
+import org.apache.airavata.allocation.manager.models.AllocationManagerException;
+import org.apache.airavata.allocation.manager.service.cpi.AllocationRegistryService;
+import org.apache.thrift.server.TServer;
+import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TSSLTransportFactory;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TServerTransport;
+import org.apache.thrift.transport.TTransportException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.util.logging.Level;
+import org.apache.airavata.allocation.manager.utils.Constants;
+import org.apache.airavata.common.exception.AiravataException;
+
+/**
+ *
+ * @author madrinathapa
+ */
+
+public class AllocationManagerServer implements IServer {
+ private final static Logger logger = LoggerFactory.getLogger(AllocationManagerServer.class);
+
+ public static final String ALLOCATION_REG_SERVER_HOST = "allocation.registry.server.host";
+ public static final String ALLOCATION_REG_SERVER_PORT = "allocation.registry.server.port";
+
+ private static final String SERVER_NAME = "Allocation Registry Server";
+ private static final String SERVER_VERSION = "1.0";
+
+ private IServer.ServerStatus status;
+ private TServer server;
+
+ public AllocationManagerServer() {
+ setStatus(IServer.ServerStatus.STOPPED);
+ }
+
+ @Override
+ public String getName() {
+ return SERVER_NAME;
+ }
+
+ @Override
+ public String getVersion() {
+ return SERVER_VERSION;
+ }
+
+ @Override
+ public void start() throws Exception {
+ try {
+ setStatus(IServer.ServerStatus.STARTING);
+
+ final int serverPort = Integer.parseInt(ServerSettings.getSetting(ALLOCATION_REG_SERVER_PORT));
+ final String serverHost = ServerSettings.getSetting(ALLOCATION_REG_SERVER_HOST);
+ AllocationRegistryService.Processor processor = new AllocationRegistryService.Processor(new AllocationManagerServerHandler());
+
+ TServerTransport serverTransport;
+
+ if (!ServerSettings.isTLSEnabled()) {
+ InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
+ serverTransport = new TServerSocket(inetSocketAddress);
+ TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
+ options.minWorkerThreads = 30;
+ server = new TThreadPoolServer(options.processor(processor));
+ }else{
+ TSSLTransportFactory.TSSLTransportParameters TLSParams =
+ new TSSLTransportFactory.TSSLTransportParameters();
+ TLSParams.requireClientAuth(true);
+ TLSParams.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword());
+ TLSParams.setTrustStore(ServerSettings.getTrustStorePath(), ServerSettings.getTrustStorePassword());
+ TServerSocket TLSServerTransport = TSSLTransportFactory.getServerSocket(
+ serverPort, ServerSettings.getTLSClientTimeout(),
+ InetAddress.getByName(serverHost), TLSParams);
+ TThreadPoolServer.Args options = new TThreadPoolServer.Args(TLSServerTransport);
+ options.minWorkerThreads = 30;
+ server = new TThreadPoolServer(options.processor(processor));
+ }
+
+ new Thread() {
+ public void run() {
+ server.serve();
+ setStatus(IServer.ServerStatus.STOPPED);
+ logger.info("Allocation Registry Server Stopped.");
+ }
+ }.start();
+ new Thread() {
+ public void run() {
+ while (!server.isServing()) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ if (server.isServing()) {
+
+ try {
+ logger.info("Register allocation manager service with DB Event publishers");
+ AllocationServiceDBEventMessagingFactory.registerAllocationServiceWithPublishers(Constants.PUBLISHERS);
+
+ logger.info("Start allocation manager service DB Event subscriber");
+ AllocationServiceDBEventMessagingFactory.getDBEventSubscriber();
+ } catch (AllocationManagerException e) {
+ logger.error("Error starting allocation Manager service. Error setting up DB event services.");
+ server.stop();
+ } catch (AiravataException ex) {
+ java.util.logging.Logger.getLogger(AllocationManagerServer.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ setStatus(IServer.ServerStatus.STARTED);
+ logger.info("Starting Allocation manager Registry Server on Port " + serverPort);
+ logger.info("Listening to Allocation manager Registry server clients ....");
+ }
+ }
+ }.start();
+
+ } catch (TTransportException e) {
+ setStatus(IServer.ServerStatus.FAILED);
+ throw new Exception("Error while starting the Allocation manager Registry service", e);
+ }
+ }
+
+ @Override
+ public void stop() throws Exception {
+ if (server!=null && server.isServing()){
+ setStatus(IServer.ServerStatus.STOPING);
+ server.stop();
+ }
+ }
+
+ @Override
+ public void restart() throws Exception {
+ stop();
+ start();
+ }
+
+ @Override
+ public void configure() throws Exception {
+
+ }
+
+ @Override
+ public IServer.ServerStatus getStatus() throws Exception {
+ return status;
+ }
+
+ private void setStatus(IServer.ServerStatus stat){
+ status=stat;
+ status.updateTime();
+ }
+
+ public TServer getServer() {
+ return server;
+ }
+
+ public void setServer(TServer server) {
+ this.server = server;
+ }
+}
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/server/AllocationManagerServerHandler.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/server/AllocationManagerServerHandler.java
index b6c9ee8..13e5837 100644
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/server/AllocationManagerServerHandler.java
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/server/AllocationManagerServerHandler.java
@@ -6,7 +6,7 @@
* 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
+ * with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -19,46 +19,147 @@
*/
package org.apache.airavata.allocation.manager.server;
-import org.apache.airavata.allocation.manager.db.repositories.RequestStatusRepository;
-import org.apache.airavata.allocation.manager.db.repositories.UserAllocationDetailPKRepository;
-import org.apache.airavata.allocation.manager.db.repositories.UserDetailRepository;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.allocation.manager.db.repositories.*;
+import org.apache.airavata.allocation.manager.db.utils.JPAUtils;
import org.apache.airavata.allocation.manager.models.*;
-import org.apache.commons.lang3.exception.ExceptionUtils;
-
+import org.apache.airavata.allocation.manager.service.cpi.AllocationRegistryService;
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AllocationManagerServerHandler implements AllocationRegistryService.Iface {
-
- public String getAllocationRequestStatus(String projectId) throws org.apache.thrift.TException{
- try{
+
+ private final static Logger logger = LoggerFactory.getLogger(AllocationManagerServerHandler.class);
+
+ public static String OWNER_PERMISSION_NAME = "OWNER";
+
+ public AllocationManagerServerHandler() throws AllocationManagerException, ApplicationSettingsException, TException, Exception {
+ JPAUtils.initializeDB();
+ }
+
+
+ //Implementing createAllocationRequest method
+ @Override
+ public String createAllocationRequest(UserAllocationDetail reqDetails) throws AllocationManagerException, TException {
+ try{
+ if((new UserAllocationDetailPKRepository()).isExists(reqDetails.id.projectId))
+ throw new TException("There exist project with the id");
+ UserAllocationDetail create = (new UserAllocationDetailRepository()).create(reqDetails);
+ return reqDetails.id.projectId;
+ }catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ throw new AllocationManagerException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ }
+ }
+
+ //Implementing isAllocationRequestExists method to check if the allocation request exists
+ @Override
+ public boolean isAllocationRequestExists(String projectId) throws AllocationManagerException, TException {
+ try{
+ UserAllocationDetailPK alloc = new UserAllocationDetailPK();
+ alloc.setProjectId(projectId);
+ return ((new UserAllocationDetailRepository()).isExists(alloc.projectId));
+ }catch (Exception ex) {
+ throw new AllocationManagerException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ }
+ }
+
+ //Implementing deleteAllocationRequest method to delete an allocation request
+ @Override
+ public boolean deleteAllocationRequest(String projectId) throws AllocationManagerException, TException {
+ try{
+ UserAllocationDetailPK alloc = new UserAllocationDetailPK();
+ alloc.setProjectId(projectId);
+ (new UserAllocationDetailPKRepository()).delete(alloc.projectId);
+ return true;
+ }catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ throw new AllocationManagerException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ }
+ }
+
+ //Implementing getAllocationRequest method to get an allocation request
+ @Override
+ public UserAllocationDetail getAllocationRequest(String projectId) throws AllocationManagerException, TException {
+ try{
+ UserAllocationDetailPK alloc = new UserAllocationDetailPK();
+ alloc.setProjectId(projectId);
+ return (new UserAllocationDetailRepository()).get(alloc.projectId);
+ }catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ throw new AllocationManagerException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ }
+ }
+
+ @Override
+ public boolean updateAllocationRequest(UserAllocationDetail reqDetails) throws TException {
+ try{
+ UserAllocationDetail userAlloc = new UserAllocationDetail();
+
+ //Update UserAllocationDetail field.
+ userAlloc.id.setProjectId(reqDetails.id.projectId);
+ userAlloc.setApplicationsToBeUsed(reqDetails.applicationsToBeUsed);
+ userAlloc.setDiskUsageRangePerJob(reqDetails.diskUsageRangePerJob);
+ userAlloc.setDocuments(reqDetails.documents);
+ userAlloc.setFieldOfScience(reqDetails.fieldOfScience);
+ userAlloc.setKeywords(reqDetails.keywords);
+ userAlloc.setMaxMemoryPerCpu(reqDetails.maxMemoryPerCpu);
+ userAlloc.setNumberOfCpuPerJob(reqDetails.numberOfCpuPerJob);
+ userAlloc.setProjectDescription(reqDetails.projectDescription);
+ userAlloc.setServiceUnits(reqDetails.serviceUnits);
+ userAlloc.setSpecificResourceSelection(reqDetails.specificResourceSelection);
+ userAlloc.setTypeOfAllocation(reqDetails.typeOfAllocation);
+ userAlloc.setTypicalSuPerJob(reqDetails.typicalSuPerJob);
+
+ (new UserAllocationDetailRepository()).update(userAlloc);
+ return true;
+ }catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ throw new AllocationManagerException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ }
+ }
+
+ @Override
+ public String getAllocationRequestStatus(String projectId) throws org.apache.thrift.TException{
+ try{
return (new RequestStatusRepository()).get(projectId).status;
- }catch (Throwable ex) {
- throw new Exception("Could not get project status");
+ }catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ throw new AllocationManagerException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
- }
-
- public String getAllocationRequestPIEmail(String projectId) throws org.apache.thrift.TException{
- try{
- String userName = getAllocationRequestUserName(projectId);
+ }
+
+ @Override
+ public String getAllocationRequestUserEmail(String projectId) throws TException {
+ try{
+ String userName = getAllocationRequestUserName(projectId);
return (new UserDetailRepository()).get(userName).email;
- }catch (Throwable ex) {
- throw new Exception("Could not get email");
+ }catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ throw new AllocationManagerException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
- }
-
- public String getAllocationRequestUserName(String projectId) throws org.apache.thrift.TException{
- try{
+ }
+
+ @Override
+ public String getAllocationRequestUserName(String projectId) throws org.apache.thrift.TException{
+ try{
return (new UserAllocationDetailPKRepository()).get(projectId).username;
- }catch (Throwable ex) {
- throw new Exception("Could not get project status");
+ }catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ throw new AllocationManagerException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
- }
-
- public String getAllocationRequestAdminEmail() throws org.apache.thrift.TException{
- try{
+ }
+
+ @Override
+ public String getAllocationManagerAdminEmail(String userType) throws TException {
+ try{
return (new UserDetailRepository()).getAdminDetails().getEmail();
- }catch (Throwable ex) {
- throw new Exception("Could not get project status");
- }
- }
+ }catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ throw new AllocationManagerException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ }
+ }
}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/server/ServerMain.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/server/ServerMain.java
new file mode 100644
index 0000000..c0edf44
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/server/ServerMain.java
@@ -0,0 +1,91 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.airavata.allocation.manager.server;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+/**
+ *
+ * @author madrinathapa
+ */
+
+public class ServerMain {
+ private final static Logger logger = LoggerFactory.getLogger(ServerMain.class);
+
+ private static int serverPID = -1;
+ private static final String stopFileNamePrefix = "server_stop";
+ private static final String serverStartedFileNamePrefix = "server_start";
+
+ public static void main(String[] args) {
+ try {
+ setServerStarted();
+ new AllocationManagerServer().start();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ @SuppressWarnings({"resource"})
+ private static void setServerStarted() {
+ try {
+ serverPID = getPID();
+ deleteOldStopRequests();
+ File serverStartedFile = null;
+ serverStartedFile = new File(getServerStartedFileName());
+ serverStartedFile.createNewFile();
+ serverStartedFile.deleteOnExit();
+ new RandomAccessFile(serverStartedFile, "rw").getChannel().lock();
+ } catch (FileNotFoundException e) {
+ logger.warn(e.getMessage(), e);
+ } catch (IOException e) {
+ logger.warn(e.getMessage(), e);
+ }
+ }
+
+ private static String getServerStartedFileName() {
+ String ALLOCATION_MANAGER_HOME = System.getenv("" +"ALLOCATION_MANAGER_HOME");
+ if(ALLOCATION_MANAGER_HOME==null)
+ ALLOCATION_MANAGER_HOME = "/tmp";
+ else
+ ALLOCATION_MANAGER_HOME = ALLOCATION_MANAGER_HOME + "/bin";
+ return new File(ALLOCATION_MANAGER_HOME, serverStartedFileNamePrefix + "_" + Integer.toString(serverPID)).toString();
+ }
+
+ private static int getPID() {
+ try {
+ java.lang.management.RuntimeMXBean runtime = java.lang.management.ManagementFactory
+ .getRuntimeMXBean();
+ java.lang.reflect.Field jvm = runtime.getClass()
+ .getDeclaredField("jvm");
+ jvm.setAccessible(true);
+ sun.management.VMManagement mgmt = (sun.management.VMManagement) jvm
+ .get(runtime);
+ java.lang.reflect.Method pid_method = mgmt.getClass()
+ .getDeclaredMethod("getProcessId");
+ pid_method.setAccessible(true);
+
+ int pid = (Integer) pid_method.invoke(mgmt);
+ return pid;
+ } catch (Exception e) {
+ return -1;
+ }
+ }
+
+ private static void deleteOldStopRequests() {
+ File[] files = new File(".").listFiles();
+ for (File file : files) {
+ if (file.getName().contains(stopFileNamePrefix)) {
+ file.delete();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/utils/Constants.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/utils/Constants.java
new file mode 100644
index 0000000..bd15e12
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/utils/Constants.java
@@ -0,0 +1,23 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.airavata.allocation.manager.utils;
+
+import org.apache.airavata.common.utils.DBEventService;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author madrinathapa
+ */
+public class Constants {
+ /**
+ * List of publishers in which allocation manager service is interested.
+ * Add publishers as required
+ */
+ public static final List<String> PUBLISHERS = new ArrayList<String>(){{add(DBEventService.USER_PROFILE.toString());};};
+}
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/utils/ThriftDataModelConversion.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/utils/ThriftDataModelConversion.java
new file mode 100644
index 0000000..cf8af5f
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/utils/ThriftDataModelConversion.java
@@ -0,0 +1,31 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.airavata.allocation.manager.utils;
+
+import org.apache.airavata.model.user.UserProfile;
+import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntityPK;
+import org.apache.airavata.allocation.manager.models.UserAllocationDetail;
+
+/**
+ *
+ * @author madrinathapa
+ */
+public class ThriftDataModelConversion {
+ /**
+ * Build user object from UserProfile
+ * @param userProfile thrift object
+ * @return
+ * User corresponding to userProfile thrift
+ */
+ public static UserAllocationDetail getUser(UserProfile userProfile){
+ UserAllocationDetail user = new UserAllocationDetail();
+ //user.id.setUsername(userProfile.getUserId());
+ //user.setDomainId(userProfile.getGatewayId());
+ user.id.setUsername(userProfile.getFirstName() + " " + userProfile.getLastName());
+ //user.setEmail(userProfile.getEmails().get(0));
+ return user;
+ }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/client/AllocationServiceClientFactory.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/client/AllocationServiceClientFactory.java
new file mode 100644
index 0000000..0e20d83
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/client/AllocationServiceClientFactory.java
@@ -0,0 +1,35 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.airavata.allocation.manager.client;
+
+import org.apache.airavata.allocation.manager.models.AllocationManagerException;
+import org.apache.airavata.allocation.manager.service.cpi.AllocationRegistryService;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransportException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author madrinathapa
+ */
+
+public class AllocationServiceClientFactory {
+ private final static Logger logger = LoggerFactory.getLogger(AllocationServiceClientFactory.class);
+
+ public static AllocationRegistryService.Client createAllocationRegistryClient(String serverHost, int serverPort) throws AllocationManagerException {
+ try {
+ TSocket e = new TSocket(serverHost, serverPort);
+ e.open();
+ TBinaryProtocol protocol = new TBinaryProtocol(e);
+ return new AllocationRegistryService.Client(protocol);
+ } catch (TTransportException var4) {
+ logger.error("failed to create allocate registry client", var4);
+ throw new AllocationManagerException();
+ }
+ }
+}
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/service/cpi/AllocationRegistryService.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/service/cpi/AllocationRegistryService.java
index 1fc3811..8430747 100644
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/service/cpi/AllocationRegistryService.java
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/service/cpi/AllocationRegistryService.java
@@ -7,7 +7,7 @@
package org.apache.airavata.allocation.manager.service.cpi;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)", date = "2017-11-20")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)")
public class AllocationRegistryService {
public interface Iface {
@@ -41,6 +41,13 @@ public class AllocationRegistryService {
public org.apache.airavata.allocation.manager.models.UserAllocationDetail getAllocationRequest(java.lang.String projectId) throws org.apache.thrift.TException;
/**
+ * <p>API method to update an allocation Request</p>
+ *
+ * @param allocDetail
+ */
+ public boolean updateAllocationRequest(org.apache.airavata.allocation.manager.models.UserAllocationDetail allocDetail) throws org.apache.thrift.TException;
+
+ /**
* <p>API method to get an allocation Request status</p>
*
* @param projectId
@@ -80,6 +87,8 @@ public class AllocationRegistryService {
public void getAllocationRequest(java.lang.String projectId, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.allocation.manager.models.UserAllocationDetail> resultHandler) throws org.apache.thrift.TException;
+ public void updateAllocationRequest(org.apache.airavata.allocation.manager.models.UserAllocationDetail allocDetail, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException;
+
public void getAllocationRequestStatus(java.lang.String projectId, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException;
public void getAllocationRequestUserEmail(java.lang.String userName, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException;
@@ -202,6 +211,29 @@ public class AllocationRegistryService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getAllocationRequest failed: unknown result");
}
+ public boolean updateAllocationRequest(org.apache.airavata.allocation.manager.models.UserAllocationDetail allocDetail) throws org.apache.thrift.TException
+ {
+ send_updateAllocationRequest(allocDetail);
+ return recv_updateAllocationRequest();
+ }
+
+ public void send_updateAllocationRequest(org.apache.airavata.allocation.manager.models.UserAllocationDetail allocDetail) throws org.apache.thrift.TException
+ {
+ updateAllocationRequest_args args = new updateAllocationRequest_args();
+ args.setAllocDetail(allocDetail);
+ sendBase("updateAllocationRequest", args);
+ }
+
+ public boolean recv_updateAllocationRequest() throws org.apache.thrift.TException
+ {
+ updateAllocationRequest_result result = new updateAllocationRequest_result();
+ receiveBase(result, "updateAllocationRequest");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "updateAllocationRequest failed: unknown result");
+ }
+
public java.lang.String getAllocationRequestStatus(java.lang.String projectId) throws org.apache.thrift.TException
{
send_getAllocationRequestStatus(projectId);
@@ -440,6 +472,38 @@ public class AllocationRegistryService {
}
}
+ public void updateAllocationRequest(org.apache.airavata.allocation.manager.models.UserAllocationDetail allocDetail, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ updateAllocationRequest_call method_call = new updateAllocationRequest_call(allocDetail, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class updateAllocationRequest_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.Boolean> {
+ private org.apache.airavata.allocation.manager.models.UserAllocationDetail allocDetail;
+ public updateAllocationRequest_call(org.apache.airavata.allocation.manager.models.UserAllocationDetail allocDetail, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.allocDetail = allocDetail;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("updateAllocationRequest", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ updateAllocationRequest_args args = new updateAllocationRequest_args();
+ args.setAllocDetail(allocDetail);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public java.lang.Boolean getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new java.lang.IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_updateAllocationRequest();
+ }
+ }
+
public void getAllocationRequestStatus(java.lang.String projectId, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException {
checkReady();
getAllocationRequestStatus_call method_call = new getAllocationRequestStatus_call(projectId, resultHandler, this, ___protocolFactory, ___transport);
@@ -585,6 +649,7 @@ public class AllocationRegistryService {
processMap.put("isAllocationRequestExists", new isAllocationRequestExists());
processMap.put("deleteAllocationRequest", new deleteAllocationRequest());
processMap.put("getAllocationRequest", new getAllocationRequest());
+ processMap.put("updateAllocationRequest", new updateAllocationRequest());
processMap.put("getAllocationRequestStatus", new getAllocationRequestStatus());
processMap.put("getAllocationRequestUserEmail", new getAllocationRequestUserEmail());
processMap.put("getAllocationManagerAdminEmail", new getAllocationManagerAdminEmail());
@@ -674,6 +739,27 @@ public class AllocationRegistryService {
}
}
+ public static class updateAllocationRequest<I extends Iface> extends org.apache.thrift.ProcessFunction<I, updateAllocationRequest_args> {
+ public updateAllocationRequest() {
+ super("updateAllocationRequest");
+ }
+
+ public updateAllocationRequest_args getEmptyArgsInstance() {
+ return new updateAllocationRequest_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public updateAllocationRequest_result getResult(I iface, updateAllocationRequest_args args) throws org.apache.thrift.TException {
+ updateAllocationRequest_result result = new updateAllocationRequest_result();
+ result.success = iface.updateAllocationRequest(args.allocDetail);
+ result.setSuccessIsSet(true);
+ return result;
+ }
+ }
+
public static class getAllocationRequestStatus<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getAllocationRequestStatus_args> {
public getAllocationRequestStatus() {
super("getAllocationRequestStatus");
@@ -771,6 +857,7 @@ public class AllocationRegistryService {
processMap.put("isAllocationRequestExists", new isAllocationRequestExists());
processMap.put("deleteAllocationRequest", new deleteAllocationRequest());
processMap.put("getAllocationRequest", new getAllocationRequest());
+ processMap.put("updateAllocationRequest", new updateAllocationRequest());
processMap.put("getAllocationRequestStatus", new getAllocationRequestStatus());
processMap.put("getAllocationRequestUserEmail", new getAllocationRequestUserEmail());
processMap.put("getAllocationManagerAdminEmail", new getAllocationManagerAdminEmail());
@@ -1024,6 +1111,68 @@ public class AllocationRegistryService {
}
}
+ public static class updateAllocationRequest<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, updateAllocationRequest_args, java.lang.Boolean> {
+ public updateAllocationRequest() {
+ super("updateAllocationRequest");
+ }
+
+ public updateAllocationRequest_args getEmptyArgsInstance() {
+ return new updateAllocationRequest_args();
+ }
+
+ public org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean>() {
+ public void onComplete(java.lang.Boolean o) {
+ updateAllocationRequest_result result = new updateAllocationRequest_result();
+ result.success = o;
+ result.setSuccessIsSet(true);
+ try {
+ fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ } catch (org.apache.thrift.transport.TTransportException e) {
+ _LOGGER.error("TTransportException writing to internal frame buffer", e);
+ fb.close();
+ } catch (java.lang.Exception e) {
+ _LOGGER.error("Exception writing to internal frame buffer", e);
+ onError(e);
+ }
+ }
+ public void onError(java.lang.Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TSerializable msg;
+ updateAllocationRequest_result result = new updateAllocationRequest_result();
+ if (e instanceof org.apache.thrift.transport.TTransportException) {
+ _LOGGER.error("TTransportException inside handler", e);
+ fb.close();
+ return;
+ } else if (e instanceof org.apache.thrift.TApplicationException) {
+ _LOGGER.error("TApplicationException inside handler", e);
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TApplicationException)e;
+ } else {
+ _LOGGER.error("Exception inside handler", e);
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ } catch (java.lang.Exception ex) {
+ _LOGGER.error("Exception writing to internal frame buffer", ex);
+ fb.close();
+ }
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public void start(I iface, updateAllocationRequest_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException {
+ iface.updateAllocationRequest(args.allocDetail,resultHandler);
+ }
+ }
+
public static class getAllocationRequestStatus<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getAllocationRequestStatus_args, java.lang.String> {
public getAllocationRequestStatus() {
super("getAllocationRequestStatus");
@@ -4144,6 +4293,726 @@ public class AllocationRegistryService {
}
}
+ public static class updateAllocationRequest_args implements org.apache.thrift.TBase<updateAllocationRequest_args, updateAllocationRequest_args._Fields>, java.io.Serializable, Cloneable, Comparable<updateAllocationRequest_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("updateAllocationRequest_args");
+
+ private static final org.apache.thrift.protocol.TField ALLOC_DETAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("allocDetail", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new updateAllocationRequest_argsStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new updateAllocationRequest_argsTupleSchemeFactory();
+
+ public org.apache.airavata.allocation.manager.models.UserAllocationDetail allocDetail; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ ALLOC_DETAIL((short)1, "allocDetail");
+
+ private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
+
+ static {
+ for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // ALLOC_DETAIL
+ return ALLOC_DETAIL;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(java.lang.String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final java.lang.String _fieldName;
+
+ _Fields(short thriftId, java.lang.String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public java.lang.String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.ALLOC_DETAIL, new org.apache.thrift.meta_data.FieldMetaData("allocDetail", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.allocation.manager.models.UserAllocationDetail.class)));
+ metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(updateAllocationRequest_args.class, metaDataMap);
+ }
+
+ public updateAllocationRequest_args() {
+ }
+
+ public updateAllocationRequest_args(
+ org.apache.airavata.allocation.manager.models.UserAllocationDetail allocDetail)
+ {
+ this();
+ this.allocDetail = allocDetail;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public updateAllocationRequest_args(updateAllocationRequest_args other) {
+ if (other.isSetAllocDetail()) {
+ this.allocDetail = new org.apache.airavata.allocation.manager.models.UserAllocationDetail(other.allocDetail);
+ }
+ }
+
+ public updateAllocationRequest_args deepCopy() {
+ return new updateAllocationRequest_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.allocDetail = null;
+ }
+
+ public org.apache.airavata.allocation.manager.models.UserAllocationDetail getAllocDetail() {
+ return this.allocDetail;
+ }
+
+ public updateAllocationRequest_args setAllocDetail(org.apache.airavata.allocation.manager.models.UserAllocationDetail allocDetail) {
+ this.allocDetail = allocDetail;
+ return this;
+ }
+
+ public void unsetAllocDetail() {
+ this.allocDetail = null;
+ }
+
+ /** Returns true if field allocDetail is set (has been assigned a value) and false otherwise */
+ public boolean isSetAllocDetail() {
+ return this.allocDetail != null;
+ }
+
+ public void setAllocDetailIsSet(boolean value) {
+ if (!value) {
+ this.allocDetail = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, java.lang.Object value) {
+ switch (field) {
+ case ALLOC_DETAIL:
+ if (value == null) {
+ unsetAllocDetail();
+ } else {
+ setAllocDetail((org.apache.airavata.allocation.manager.models.UserAllocationDetail)value);
+ }
+ break;
+
+ }
+ }
+
+ public java.lang.Object getFieldValue(_Fields field) {
+ switch (field) {
+ case ALLOC_DETAIL:
+ return getAllocDetail();
+
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ switch (field) {
+ case ALLOC_DETAIL:
+ return isSetAllocDetail();
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(java.lang.Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof updateAllocationRequest_args)
+ return this.equals((updateAllocationRequest_args)that);
+ return false;
+ }
+
+ public boolean equals(updateAllocationRequest_args that) {
+ if (that == null)
+ return false;
+ if (this == that)
+ return true;
+
+ boolean this_present_allocDetail = true && this.isSetAllocDetail();
+ boolean that_present_allocDetail = true && that.isSetAllocDetail();
+ if (this_present_allocDetail || that_present_allocDetail) {
+ if (!(this_present_allocDetail && that_present_allocDetail))
+ return false;
+ if (!this.allocDetail.equals(that.allocDetail))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 1;
+
+ hashCode = hashCode * 8191 + ((isSetAllocDetail()) ? 131071 : 524287);
+ if (isSetAllocDetail())
+ hashCode = hashCode * 8191 + allocDetail.hashCode();
+
+ return hashCode;
+ }
+
+ @Override
+ public int compareTo(updateAllocationRequest_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = java.lang.Boolean.valueOf(isSetAllocDetail()).compareTo(other.isSetAllocDetail());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAllocDetail()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.allocDetail, other.allocDetail);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ scheme(iprot).read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ scheme(oprot).write(oprot, this);
+ }
+
+ @Override
+ public java.lang.String toString() {
+ java.lang.StringBuilder sb = new java.lang.StringBuilder("updateAllocationRequest_args(");
+ boolean first = true;
+
+ sb.append("allocDetail:");
+ if (this.allocDetail == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.allocDetail);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (allocDetail == null) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'allocDetail' was not present! Struct: " + toString());
+ }
+ // check for sub-struct validity
+ if (allocDetail != null) {
+ allocDetail.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class updateAllocationRequest_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public updateAllocationRequest_argsStandardScheme getScheme() {
+ return new updateAllocationRequest_argsStandardScheme();
+ }
+ }
+
+ private static class updateAllocationRequest_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<updateAllocationRequest_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, updateAllocationRequest_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // ALLOC_DETAIL
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.allocDetail = new org.apache.airavata.allocation.manager.models.UserAllocationDetail();
+ struct.allocDetail.read(iprot);
+ struct.setAllocDetailIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, updateAllocationRequest_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.allocDetail != null) {
+ oprot.writeFieldBegin(ALLOC_DETAIL_FIELD_DESC);
+ struct.allocDetail.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class updateAllocationRequest_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public updateAllocationRequest_argsTupleScheme getScheme() {
+ return new updateAllocationRequest_argsTupleScheme();
+ }
+ }
+
+ private static class updateAllocationRequest_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<updateAllocationRequest_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, updateAllocationRequest_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ struct.allocDetail.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, updateAllocationRequest_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ struct.allocDetail = new org.apache.airavata.allocation.manager.models.UserAllocationDetail();
+ struct.allocDetail.read(iprot);
+ struct.setAllocDetailIsSet(true);
+ }
+ }
+
+ private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+ return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+ }
+ }
+
+ public static class updateAllocationRequest_result implements org.apache.thrift.TBase<updateAllocationRequest_result, updateAllocationRequest_result._Fields>, java.io.Serializable, Cloneable, Comparable<updateAllocationRequest_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("updateAllocationRequest_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
+
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new updateAllocationRequest_resultStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new updateAllocationRequest_resultTupleSchemeFactory();
+
+ public boolean success; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)0, "success");
+
+ private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
+
+ static {
+ for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 0: // SUCCESS
+ return SUCCESS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(java.lang.String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final java.lang.String _fieldName;
+
+ _Fields(short thriftId, java.lang.String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public java.lang.String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __SUCCESS_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(updateAllocationRequest_result.class, metaDataMap);
+ }
+
+ public updateAllocationRequest_result() {
+ }
+
+ public updateAllocationRequest_result(
+ boolean success)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public updateAllocationRequest_result(updateAllocationRequest_result other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ }
+
+ public updateAllocationRequest_result deepCopy() {
+ return new updateAllocationRequest_result(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public updateAllocationRequest_result setSuccess(boolean success) {
+ this.success = success;
+ setSuccessIsSet(true);
+ return this;
+ }
+
+ public void unsetSuccess() {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, java.lang.Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((java.lang.Boolean)value);
+ }
+ break;
+
+ }
+ }
+
+ public java.lang.Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return isSuccess();
+
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUCCESS:
+ return isSetSuccess();
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(java.lang.Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof updateAllocationRequest_result)
+ return this.equals((updateAllocationRequest_result)that);
+ return false;
+ }
+
+ public boolean equals(updateAllocationRequest_result that) {
+ if (that == null)
+ return false;
+ if (this == that)
+ return true;
+
+ boolean this_present_success = true;
+ boolean that_present_success = true;
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (this.success != that.success)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 1;
+
+ hashCode = hashCode * 8191 + ((success) ? 131071 : 524287);
+
+ return hashCode;
+ }
+
+ @Override
+ public int compareTo(updateAllocationRequest_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ scheme(iprot).read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ scheme(oprot).write(oprot, this);
+ }
+
+ @Override
+ public java.lang.String toString() {
+ java.lang.StringBuilder sb = new java.lang.StringBuilder("updateAllocationRequest_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ sb.append(this.success);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class updateAllocationRequest_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public updateAllocationRequest_resultStandardScheme getScheme() {
+ return new updateAllocationRequest_resultStandardScheme();
+ }
+ }
+
+ private static class updateAllocationRequest_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<updateAllocationRequest_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, updateAllocationRequest_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, updateAllocationRequest_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.isSetSuccess()) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeBool(struct.success);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class updateAllocationRequest_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public updateAllocationRequest_resultTupleScheme getScheme() {
+ return new updateAllocationRequest_resultTupleScheme();
+ }
+ }
+
+ private static class updateAllocationRequest_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<updateAllocationRequest_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, updateAllocationRequest_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ java.util.BitSet optionals = new java.util.BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetSuccess()) {
+ oprot.writeBool(struct.success);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, updateAllocationRequest_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ java.util.BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+ return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+ }
+ }
+
public static class getAllocationRequestStatus_args implements org.apache.thrift.TBase<getAllocationRequestStatus_args, getAllocationRequestStatus_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAllocationRequestStatus_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllocationRequestStatus_args");
diff --git a/allocation-manager/allocation-manager-docs/api-docs/allocation_manager_cpi.html b/allocation-manager/allocation-manager-docs/api-docs/allocation_manager_cpi.html
index 4d64879..60defb3 100644
--- a/allocation-manager/allocation-manager-docs/api-docs/allocation_manager_cpi.html
+++ b/allocation-manager/allocation-manager-docs/api-docs/allocation_manager_cpi.html
@@ -13,8 +13,13 @@
<ul>
<li><a href="#Fn_AllocationRegistryService_createAllocationRequest">createAllocationRequest</a></li>
<li><a href="#Fn_AllocationRegistryService_deleteAllocationRequest">deleteAllocationRequest</a></li>
+<li><a href="#Fn_AllocationRegistryService_getAllocationManagerAdminEmail">getAllocationManagerAdminEmail</a></li>
<li><a href="#Fn_AllocationRegistryService_getAllocationRequest">getAllocationRequest</a></li>
+<li><a href="#Fn_AllocationRegistryService_getAllocationRequestStatus">getAllocationRequestStatus</a></li>
+<li><a href="#Fn_AllocationRegistryService_getAllocationRequestUserEmail">getAllocationRequestUserEmail</a></li>
+<li><a href="#Fn_AllocationRegistryService_getAllocationRequestUserName">getAllocationRequestUserName</a></li>
<li><a href="#Fn_AllocationRegistryService_isAllocationRequestExists">isAllocationRequestExists</a></li>
+<li><a href="#Fn_AllocationRegistryService_updateAllocationRequest">updateAllocationRequest</a></li>
</ul>
</td>
<td></td>
@@ -34,4 +39,19 @@
<br/></div><div class="definition"><h4 id="Fn_AllocationRegistryService_getAllocationRequest">Function: AllocationRegistryService.getAllocationRequest</h4>
<pre><code><a href="allocation_manager_models.html#Struct_UserAllocationDetail">allocation_manager_models.UserAllocationDetail</a></code> getAllocationRequest(<code>string</code> projectId)
</pre><p>API method to get an allocation Request</p>
+<br/></div><div class="definition"><h4 id="Fn_AllocationRegistryService_updateAllocationRequest">Function: AllocationRegistryService.updateAllocationRequest</h4>
+<pre><code>bool</code> updateAllocationRequest(<code><a href="allocation_manager_models.html#Struct_UserAllocationDetail">allocation_manager_models.UserAllocationDetail</a></code> allocDetail)
+</pre><p>API method to update an allocation Request</p>
+<br/></div><div class="definition"><h4 id="Fn_AllocationRegistryService_getAllocationRequestStatus">Function: AllocationRegistryService.getAllocationRequestStatus</h4>
+<pre><code>string</code> getAllocationRequestStatus(<code>string</code> projectId)
+</pre><p>API method to get an allocation Request status</p>
+<br/></div><div class="definition"><h4 id="Fn_AllocationRegistryService_getAllocationRequestUserEmail">Function: AllocationRegistryService.getAllocationRequestUserEmail</h4>
+<pre><code>string</code> getAllocationRequestUserEmail(<code>string</code> userName)
+</pre><p>API method to get an allocation Request PI email</p>
+<br/></div><div class="definition"><h4 id="Fn_AllocationRegistryService_getAllocationManagerAdminEmail">Function: AllocationRegistryService.getAllocationManagerAdminEmail</h4>
+<pre><code>string</code> getAllocationManagerAdminEmail(<code>string</code> userType)
+</pre><p>API method to get an allocation Request Admin email</p>
+<br/></div><div class="definition"><h4 id="Fn_AllocationRegistryService_getAllocationRequestUserName">Function: AllocationRegistryService.getAllocationRequestUserName</h4>
+<pre><code>string</code> getAllocationRequestUserName(<code>string</code> projectId)
+</pre><p>API method to get an allocation Request PI</p>
<br/></div></div></body></html>
diff --git a/allocation-manager/allocation-manager-docs/api-docs/index.html b/allocation-manager/allocation-manager-docs/api-docs/index.html
index 50071c3..18ed8bc 100644
--- a/allocation-manager/allocation-manager-docs/api-docs/index.html
+++ b/allocation-manager/allocation-manager-docs/api-docs/index.html
@@ -9,8 +9,13 @@
<ul>
<li><a href="allocation_manager_cpi.html#Fn_AllocationRegistryService_createAllocationRequest">createAllocationRequest</a></li>
<li><a href="allocation_manager_cpi.html#Fn_AllocationRegistryService_deleteAllocationRequest">deleteAllocationRequest</a></li>
+<li><a href="allocation_manager_cpi.html#Fn_AllocationRegistryService_getAllocationManagerAdminEmail">getAllocationManagerAdminEmail</a></li>
<li><a href="allocation_manager_cpi.html#Fn_AllocationRegistryService_getAllocationRequest">getAllocationRequest</a></li>
+<li><a href="allocation_manager_cpi.html#Fn_AllocationRegistryService_getAllocationRequestStatus">getAllocationRequestStatus</a></li>
+<li><a href="allocation_manager_cpi.html#Fn_AllocationRegistryService_getAllocationRequestUserEmail">getAllocationRequestUserEmail</a></li>
+<li><a href="allocation_manager_cpi.html#Fn_AllocationRegistryService_getAllocationRequestUserName">getAllocationRequestUserName</a></li>
<li><a href="allocation_manager_cpi.html#Fn_AllocationRegistryService_isAllocationRequestExists">isAllocationRequestExists</a></li>
+<li><a href="allocation_manager_cpi.html#Fn_AllocationRegistryService_updateAllocationRequest">updateAllocationRequest</a></li>
</ul>
</td>
<td></td>
diff --git a/allocation-manager/thrift_models/allocation_manager_cpi.thrift b/allocation-manager/thrift_models/allocation_manager_cpi.thrift
index d506b83..ea29060 100644
--- a/allocation-manager/thrift_models/allocation_manager_cpi.thrift
+++ b/allocation-manager/thrift_models/allocation_manager_cpi.thrift
@@ -23,8 +23,13 @@ service AllocationRegistryService{
<p>API method to get an allocation Request</p>
*/
allocation_manager_models.UserAllocationDetail getAllocationRequest(1: required string projectId)
+
+ /**
+ <p>API method to update an allocation Request</p>
+ */
+ bool updateAllocationRequest(1: required allocation_manager_models.UserAllocationDetail allocDetail)
-/**
+ /**
<p>API method to get an allocation Request status</p>
*/
string getAllocationRequestStatus(1: required string projectId)
@@ -43,5 +48,4 @@ service AllocationRegistryService{
<p>API method to get an allocation Request PI</p>
*/
string getAllocationRequestUserName(1: required string projectId)
-
}
--
To stop receiving notification emails like this one, please contact
['"commits@airavata.apache.org" <co...@airavata.apache.org>'].