replace client calls inside services with direct handler calls. add airavata-service start mode for unified, multiplexed thrift svc.
diff --git a/airavata-api/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 4be740e..dd368e1 100644
--- a/airavata-api/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -33,8 +33,7 @@
import org.apache.airavata.common.utils.AiravataUtils;
import org.apache.airavata.common.utils.Constants;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.common.utils.ThriftClientPool;
-import org.apache.airavata.credential.store.cpi.CredentialStoreService;
+import org.apache.airavata.credential.store.server.CredentialStoreServerHandler;
import org.apache.airavata.messaging.core.MessageContext;
import org.apache.airavata.messaging.core.MessagingFactory;
import org.apache.airavata.messaging.core.Publisher;
@@ -91,13 +90,12 @@
import org.apache.airavata.model.workspace.Gateway;
import org.apache.airavata.model.workspace.Notification;
import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.registry.api.RegistryService;
import org.apache.airavata.registry.api.exception.RegistryServiceException;
+import org.apache.airavata.registry.api.service.handler.RegistryServerHandler;
import org.apache.airavata.service.security.GatewayGroupsInitializer;
import org.apache.airavata.service.security.interceptor.SecurityCheck;
import org.apache.airavata.sharing.registry.models.*;
-import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
-import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
+import org.apache.airavata.sharing.registry.server.SharingRegistryServerHandler;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -107,56 +105,40 @@
private Publisher statusPublisher;
private Publisher experimentPublisher;
- private ThriftClientPool<SharingRegistryService.Client> sharingClientPool;
- private ThriftClientPool<RegistryService.Client> registryClientPool;
- private ThriftClientPool<CredentialStoreService.Client> csClientPool;
+ // Direct handler dependencies (for unified service)
+ private RegistryServerHandler registryHandler;
+ private SharingRegistryServerHandler sharingHandler;
+ private CredentialStoreServerHandler credentialStoreHandler;
- public AiravataServerHandler() {
+ // Legacy client pools removed - using direct handler calls
+
+ // Constructor for unified service with direct handler dependencies
+ public AiravataServerHandler(
+ RegistryServerHandler registryHandler,
+ SharingRegistryServerHandler sharingHandler,
+ CredentialStoreServerHandler credentialStoreHandler) {
try {
+ this.registryHandler = registryHandler;
+ this.sharingHandler = sharingHandler;
+ this.credentialStoreHandler = credentialStoreHandler;
+
statusPublisher = MessagingFactory.getPublisher(Type.STATUS);
experimentPublisher = MessagingFactory.getPublisher(Type.EXPERIMENT_LAUNCH);
- sharingClientPool = new ThriftClientPool<>(
- tProtocol -> new SharingRegistryService.Client(tProtocol),
- this.<SharingRegistryService.Client>createGenericObjectPoolConfig(),
- ServerSettings.getSharingRegistryHost(),
- Integer.parseInt(ServerSettings.getSharingRegistryPort()));
- registryClientPool = new ThriftClientPool<>(
- tProtocol -> new RegistryService.Client(tProtocol),
- this.<RegistryService.Client>createGenericObjectPoolConfig(),
- ServerSettings.getRegistryServerHost(),
- Integer.parseInt(ServerSettings.getRegistryServerPort()));
- csClientPool = new ThriftClientPool<>(
- tProtocol -> new CredentialStoreService.Client(tProtocol),
- this.<CredentialStoreService.Client>createGenericObjectPoolConfig(),
- ServerSettings.getCredentialStoreServerHost(),
- Integer.parseInt(ServerSettings.getCredentialStoreServerPort()));
-
initSharingRegistry();
postInitDefaultGateway();
} catch (ApplicationSettingsException e) {
- logger.error("Error occured while reading airavata-server properties..", e);
+ logger.error("Error occurred while reading airavata-server properties..", e);
} catch (AiravataException e) {
- logger.error("Error occured while reading airavata-server properties..", e);
+ logger.error("Error occurred while reading airavata-server properties..", e);
} catch (TException e) {
- logger.error("Error occured while reading airavata-server properties..", e);
+ logger.error("Error occurred while reading airavata-server properties..", e);
}
}
- private <T> GenericObjectPoolConfig<T> createGenericObjectPoolConfig() {
+ // Legacy constructor removed - using direct handler calls only
- GenericObjectPoolConfig<T> poolConfig = new GenericObjectPoolConfig<T>();
- poolConfig.setMaxTotal(100);
- poolConfig.setMinIdle(5);
- poolConfig.setBlockWhenExhausted(true);
- poolConfig.setTestOnBorrow(true);
- poolConfig.setTestWhileIdle(true);
- // must set timeBetweenEvictionRunsMillis since eviction doesn't run unless that is positive
- poolConfig.setTimeBetweenEvictionRunsMillis(5L * 60L * 1000L);
- poolConfig.setNumTestsPerEvictionRun(10);
- poolConfig.setMaxWaitMillis(3000);
- return poolConfig;
- }
+ // Always using direct handlers now
/**
* This method creates a password token for the default gateway profile. Default gateway is originally initialized
@@ -164,12 +146,10 @@
* before registry server.
*/
private void postInitDefaultGateway() {
-
- RegistryService.Client registryClient = registryClientPool.getResource();
try {
-
GatewayResourceProfile gatewayResourceProfile =
- registryClient.getGatewayResourceProfile(ServerSettings.getDefaultUserGateway());
+ registryHandler.getGatewayResourceProfile(ServerSettings.getDefaultUserGateway());
+
if (gatewayResourceProfile != null && gatewayResourceProfile.getIdentityServerPwdCredToken() == null) {
logger.debug("Starting to add the password credential for default gateway : "
@@ -182,20 +162,15 @@
passwordCredential.setPassword(ServerSettings.getDefaultUserPassword());
passwordCredential.setDescription("Credentials for default gateway");
- CredentialStoreService.Client csClient = csClientPool.getResource();
String token = null;
try {
logger.info("Creating password credential for default gateway");
- token = csClient.addPasswordCredential(passwordCredential);
- csClientPool.returnResource(csClient);
+ token = credentialStoreHandler.addPasswordCredential(passwordCredential);
} catch (Exception ex) {
logger.error(
"Failed to create the password credential for the default gateway : "
+ ServerSettings.getDefaultUserGateway(),
ex);
- if (csClient != null) {
- csClientPool.returnBrokenResource(csClient);
- }
}
if (token != null) {
@@ -203,106 +178,94 @@
+ ServerSettings.getDefaultUserGateway());
gatewayResourceProfile.setIdentityServerPwdCredToken(token);
gatewayResourceProfile.setIdentityServerTenant(ServerSettings.getDefaultUserGateway());
- registryClient.updateGatewayResourceProfile(
+
+ registryHandler.updateGatewayResourceProfile(
ServerSettings.getDefaultUserGateway(), gatewayResourceProfile);
}
}
-
- registryClientPool.returnResource(registryClient);
} catch (Exception e) {
logger.error("Failed to add the password credentials for the default gateway", e);
-
- if (registryClient != null) {
- registryClientPool.returnBrokenResource(registryClient);
- }
}
}
private void initSharingRegistry() throws ApplicationSettingsException, TException {
- SharingRegistryService.Client client = sharingClientPool.getResource();
- try {
- if (!client.isDomainExists(ServerSettings.getDefaultUserGateway())) {
- Domain domain = new Domain();
- domain.setDomainId(ServerSettings.getDefaultUserGateway());
- domain.setName(ServerSettings.getDefaultUserGateway());
- domain.setDescription("Domain entry for " + domain.getName());
- client.createDomain(domain);
+ if (!sharingHandler.isDomainExists(ServerSettings.getDefaultUserGateway())) {
+ Domain domain = new Domain();
+ domain.setDomainId(ServerSettings.getDefaultUserGateway());
+ domain.setName(ServerSettings.getDefaultUserGateway());
+ domain.setDescription("Domain entry for " + domain.getName());
+ sharingHandler.createDomain(domain);
- User user = new User();
- user.setDomainId(domain.getDomainId());
- user.setUserId(ServerSettings.getDefaultUser() + "@" + ServerSettings.getDefaultUserGateway());
- user.setUserName(ServerSettings.getDefaultUser());
- client.createUser(user);
+ User user = new User();
+ user.setDomainId(domain.getDomainId());
+ user.setUserId(ServerSettings.getDefaultUser() + "@" + ServerSettings.getDefaultUserGateway());
+ user.setUserName(ServerSettings.getDefaultUser());
+ sharingHandler.createUser(user);
- // Creating Entity Types for each domain
- EntityType entityType = new EntityType();
- entityType.setEntityTypeId(domain.getDomainId() + ":PROJECT");
- entityType.setDomainId(domain.getDomainId());
- entityType.setName("PROJECT");
- entityType.setDescription("Project entity type");
- client.createEntityType(entityType);
+ // Creating Entity Types for each domain
+ EntityType entityType = new EntityType();
+ entityType.setEntityTypeId(domain.getDomainId() + ":PROJECT");
+ entityType.setDomainId(domain.getDomainId());
+ entityType.setName("PROJECT");
+ entityType.setDescription("Project entity type");
+ sharingHandler.createEntityType(entityType);
- entityType = new EntityType();
- entityType.setEntityTypeId(domain.getDomainId() + ":EXPERIMENT");
- entityType.setDomainId(domain.getDomainId());
- entityType.setName("EXPERIMENT");
- entityType.setDescription("Experiment entity type");
- client.createEntityType(entityType);
+ entityType = new EntityType();
+ entityType.setEntityTypeId(domain.getDomainId() + ":EXPERIMENT");
+ entityType.setDomainId(domain.getDomainId());
+ entityType.setName("EXPERIMENT");
+ entityType.setDescription("Experiment entity type");
+ sharingHandler.createEntityType(entityType);
- entityType = new EntityType();
- entityType.setEntityTypeId(domain.getDomainId() + ":FILE");
- entityType.setDomainId(domain.getDomainId());
- entityType.setName("FILE");
- entityType.setDescription("File entity type");
- client.createEntityType(entityType);
+ entityType = new EntityType();
+ entityType.setEntityTypeId(domain.getDomainId() + ":FILE");
+ entityType.setDomainId(domain.getDomainId());
+ entityType.setName("FILE");
+ entityType.setDescription("File entity type");
+ sharingHandler.createEntityType(entityType);
- entityType = new EntityType();
- entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.APPLICATION_DEPLOYMENT.name());
- entityType.setDomainId(domain.getDomainId());
- entityType.setName("APPLICATION-DEPLOYMENT");
- entityType.setDescription("Application Deployment entity type");
- client.createEntityType(entityType);
+ entityType = new EntityType();
+ entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.APPLICATION_DEPLOYMENT.name());
+ entityType.setDomainId(domain.getDomainId());
+ entityType.setName("APPLICATION-DEPLOYMENT");
+ entityType.setDescription("Application Deployment entity type");
+ sharingHandler.createEntityType(entityType);
- entityType = new EntityType();
- entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.GROUP_RESOURCE_PROFILE.name());
- entityType.setDomainId(domain.getDomainId());
- entityType.setName(ResourceType.GROUP_RESOURCE_PROFILE.name());
- entityType.setDescription("Group Resource Profile entity type");
- client.createEntityType(entityType);
+ entityType = new EntityType();
+ entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.GROUP_RESOURCE_PROFILE.name());
+ entityType.setDomainId(domain.getDomainId());
+ entityType.setName(ResourceType.GROUP_RESOURCE_PROFILE.name());
+ entityType.setDescription("Group Resource Profile entity type");
+ sharingHandler.createEntityType(entityType);
- entityType = new EntityType();
- entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.CREDENTIAL_TOKEN.name());
- entityType.setDomainId(domain.getDomainId());
- entityType.setName(ResourceType.CREDENTIAL_TOKEN.name());
- entityType.setDescription("Credential Store Token entity type");
- client.createEntityType(entityType);
+ entityType = new EntityType();
+ entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.CREDENTIAL_TOKEN.name());
+ entityType.setDomainId(domain.getDomainId());
+ entityType.setName(ResourceType.CREDENTIAL_TOKEN.name());
+ entityType.setDescription("Credential Store Token entity type");
+ sharingHandler.createEntityType(entityType);
- // Creating Permission Types for each domain
- PermissionType permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.getDomainId() + ":READ");
- permissionType.setDomainId(domain.getDomainId());
- permissionType.setName("READ");
- permissionType.setDescription("Read permission type");
- client.createPermissionType(permissionType);
+ // Creating Permission Types for each domain
+ PermissionType permissionType = new PermissionType();
+ permissionType.setPermissionTypeId(domain.getDomainId() + ":READ");
+ permissionType.setDomainId(domain.getDomainId());
+ permissionType.setName("READ");
+ permissionType.setDescription("Read permission type");
+ sharingHandler.createPermissionType(permissionType);
- permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.getDomainId() + ":WRITE");
- permissionType.setDomainId(domain.getDomainId());
- permissionType.setName("WRITE");
- permissionType.setDescription("Write permission type");
- client.createPermissionType(permissionType);
+ permissionType = new PermissionType();
+ permissionType.setPermissionTypeId(domain.getDomainId() + ":WRITE");
+ permissionType.setDomainId(domain.getDomainId());
+ permissionType.setName("WRITE");
+ permissionType.setDescription("Write permission type");
+ sharingHandler.createPermissionType(permissionType);
- permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.getDomainId() + ":MANAGE_SHARING");
- permissionType.setDomainId(domain.getDomainId());
- permissionType.setName("MANAGE_SHARING");
- permissionType.setDescription("Sharing permission type");
- client.createPermissionType(permissionType);
- }
- sharingClientPool.returnResource(client);
- } catch (Exception ex) {
- sharingClientPool.returnBrokenResource(client);
- throw ex;
+ permissionType = new PermissionType();
+ permissionType.setPermissionTypeId(domain.getDomainId() + ":MANAGE_SHARING");
+ permissionType.setDomainId(domain.getDomainId());
+ permissionType.setName("MANAGE_SHARING");
+ permissionType.setDescription("Sharing permission type");
+ sharingHandler.createPermissionType(permissionType);
}
}
@@ -327,18 +290,15 @@
public boolean isUserExists(AuthzToken authzToken, String gatewayId, String userName)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client client = registryClientPool.getResource();
try {
- boolean isExists = client.isUserExists(gatewayId, userName);
+ boolean isExists = registryHandler.isUserExists(gatewayId, userName);
logger.debug("Checking if the user" + userName + "exists in the gateway" + gatewayId);
- registryClientPool.returnResource(client);
return isExists;
} catch (Exception e) {
logger.error("Error while verifying user", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while verifying user. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(client);
throw exception;
}
}
@@ -348,15 +308,13 @@
public String addGateway(AuthzToken authzToken, Gateway gateway)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
- RegistryService.Client registryClient = registryClientPool.getResource();
try {
- String gatewayId = registryClient.addGateway(gateway);
+ String gatewayId = registryHandler.addGateway(gateway);
Domain domain = new Domain();
domain.setDomainId(gateway.getGatewayId());
domain.setName(gateway.getGatewayName());
domain.setDescription("Domain entry for " + domain.getName());
- sharingClient.createDomain(domain);
+ sharingHandler.createDomain(domain);
// Creating Entity Types for each domain
EntityType entityType = new EntityType();
@@ -364,35 +322,42 @@
entityType.setDomainId(domain.getDomainId());
entityType.setName("PROJECT");
entityType.setDescription("Project entity type");
- sharingClient.createEntityType(entityType);
+ sharingHandler.createEntityType(entityType);
entityType = new EntityType();
entityType.setEntityTypeId(domain.getDomainId() + ":EXPERIMENT");
entityType.setDomainId(domain.getDomainId());
entityType.setName("EXPERIMENT");
entityType.setDescription("Experiment entity type");
- sharingClient.createEntityType(entityType);
+ sharingHandler.createEntityType(entityType);
entityType = new EntityType();
entityType.setEntityTypeId(domain.getDomainId() + ":FILE");
entityType.setDomainId(domain.getDomainId());
entityType.setName("FILE");
entityType.setDescription("File entity type");
- sharingClient.createEntityType(entityType);
+ sharingHandler.createEntityType(entityType);
entityType = new EntityType();
entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.APPLICATION_DEPLOYMENT.name());
entityType.setDomainId(domain.getDomainId());
entityType.setName("APPLICATION-DEPLOYMENT");
entityType.setDescription("Application Deployment entity type");
- sharingClient.createEntityType(entityType);
+ sharingHandler.createEntityType(entityType);
entityType = new EntityType();
entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.GROUP_RESOURCE_PROFILE.name());
entityType.setDomainId(domain.getDomainId());
entityType.setName(ResourceType.GROUP_RESOURCE_PROFILE.name());
entityType.setDescription("Group Resource Profile entity type");
- sharingClient.createEntityType(entityType);
+ sharingHandler.createEntityType(entityType);
+
+ entityType = new EntityType();
+ entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.CREDENTIAL_TOKEN.name());
+ entityType.setDomainId(domain.getDomainId());
+ entityType.setName(ResourceType.CREDENTIAL_TOKEN.name());
+ entityType.setDescription("Credential Store Token entity type");
+ sharingHandler.createEntityType(entityType);
// Creating Permission Types for each domain
PermissionType permissionType = new PermissionType();
@@ -400,24 +365,22 @@
permissionType.setDomainId(domain.getDomainId());
permissionType.setName("READ");
permissionType.setDescription("Read permission type");
- sharingClient.createPermissionType(permissionType);
+ sharingHandler.createPermissionType(permissionType);
permissionType = new PermissionType();
permissionType.setPermissionTypeId(domain.getDomainId() + ":WRITE");
permissionType.setDomainId(domain.getDomainId());
permissionType.setName("WRITE");
permissionType.setDescription("Write permission type");
- sharingClient.createPermissionType(permissionType);
+ sharingHandler.createPermissionType(permissionType);
permissionType = new PermissionType();
permissionType.setPermissionTypeId(domain.getDomainId() + ":MANAGE_SHARING");
permissionType.setDomainId(domain.getDomainId());
permissionType.setName("MANAGE_SHARING");
permissionType.setDescription("Sharing permission type");
- sharingClient.createPermissionType(permissionType);
+ sharingHandler.createPermissionType(permissionType);
- registryClientPool.returnResource(registryClient);
- sharingClientPool.returnResource(sharingClient);
logger.debug("Airavata successfully created the gateway with " + gatewayId);
return gatewayId;
@@ -426,8 +389,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while adding gateway. More info : " + e.getMessage());
- sharingClientPool.returnBrokenResource(sharingClient);
- registryClientPool.returnBrokenResource(registryClient);
throw exception;
}
}
@@ -445,17 +406,14 @@
public List<String> getAllUsersInGateway(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
try {
- List<String> result = regClient.getAllUsersInGateway(gatewayId);
- registryClientPool.returnResource(regClient);
+ List<String> result = registryHandler.getAllUsersInGateway(gatewayId);
return result;
} catch (Exception e) {
logger.error("Error while retrieving users", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving users. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -466,17 +424,14 @@
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
try {
- boolean result = regClient.updateGateway(gatewayId, updatedGateway);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateGateway(gatewayId, updatedGateway);
return result;
} catch (Exception e) {
logger.error("Error while updating the gateway", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating the gateway. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -487,10 +442,8 @@
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
try {
- Gateway result = regClient.getGateway(gatewayId);
- registryClientPool.returnResource(regClient);
+ Gateway result = registryHandler.getGateway(gatewayId);
logger.debug("Airavata found the gateway with " + gatewayId);
return result;
} catch (Exception e) {
@@ -498,7 +451,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while getting the gateway. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -508,17 +460,15 @@
public boolean deleteGateway(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteGateway(gatewayId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteGateway(gatewayId);
return result;
} catch (Exception e) {
logger.error("Error while deleting the gateway", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting the gateway. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -528,18 +478,16 @@
public List<Gateway> getAllGateways(AuthzToken authzToken)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
logger.debug("Airavata searching for all gateways");
- List<Gateway> result = regClient.getAllGateways();
- registryClientPool.returnResource(regClient);
+ List<Gateway> result = registryHandler.getAllGateways();
return result;
} catch (Exception e) {
logger.error("Error while getting all the gateways", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while getting all the gateways. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -549,18 +497,16 @@
public boolean isGatewayExist(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
logger.debug("Airavata verifying if the gateway with " + gatewayId + "exits");
- boolean result = regClient.isGatewayExist(gatewayId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.isGatewayExist(gatewayId);
return result;
} catch (Exception e) {
logger.error("Error while getting gateway", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while getting gateway. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -577,17 +523,15 @@
public String createNotification(AuthzToken authzToken, Notification notification)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.createNotification(notification);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.createNotification(notification);
return result;
} catch (Exception e) {
logger.error("Error while creating notification", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while creating notification. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -597,17 +541,15 @@
public boolean updateNotification(AuthzToken authzToken, Notification notification)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateNotification(notification);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateNotification(notification);
return result;
} catch (Exception e) {
logger.error("Error while updating notification", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while getting gateway. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -617,17 +559,15 @@
public boolean deleteNotification(AuthzToken authzToken, String gatewayId, String notificationId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteNotification(gatewayId, notificationId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteNotification(gatewayId, notificationId);
return result;
} catch (Exception e) {
logger.error("Error while deleting notification", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting notification. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -637,17 +577,15 @@
public Notification getNotification(AuthzToken authzToken, String gatewayId, String notificationId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- Notification result = regClient.getNotification(gatewayId, notificationId);
- registryClientPool.returnResource(regClient);
+ Notification result = registryHandler.getNotification(gatewayId, notificationId);
return result;
} catch (Exception e) {
logger.error("Error while retrieving notification", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retreiving notification. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -657,17 +595,15 @@
public List<Notification> getAllNotifications(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<Notification> result = regClient.getAllNotifications(gatewayId);
- registryClientPool.returnResource(regClient);
+ List<Notification> result = registryHandler.getAllNotifications(gatewayId);
return result;
} catch (Exception e) {
logger.error("Error while getting all notifications", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while getting all notifications. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -678,15 +614,15 @@
throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
- CredentialStoreService.Client csClient = csClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
SSHCredential sshCredential = new SSHCredential();
sshCredential.setUsername(userName);
sshCredential.setGatewayId(gatewayId);
sshCredential.setDescription(description);
- String key = csClient.addSSHCredential(sshCredential);
+ String key = credentialStoreHandler.addSSHCredential(sshCredential);
try {
Entity entity = new Entity();
entity.setEntityId(key);
@@ -695,29 +631,23 @@
entity.setOwnerId(userName + "@" + gatewayId);
entity.setName(key);
entity.setDescription(description);
- sharingClient.createEntity(entity);
+ sharingHandler.createEntity(entity);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error("Rolling back ssh key creation for user " + userName + " and description [" + description
+ "]");
- csClient.deleteSSHCredential(key, gatewayId);
+ credentialStoreHandler.deleteSSHCredential(key, gatewayId);
AiravataSystemException ase = new AiravataSystemException();
ase.setMessage("Failed to create sharing registry record");
throw ase;
}
logger.debug("Airavata generated SSH keys for gateway : " + gatewayId + " and for user : " + userName);
- csClientPool.returnResource(csClient);
- sharingClientPool.returnResource(sharingClient);
- registryClientPool.returnResource(regClient);
return key;
} catch (Exception e) {
logger.error("Error occurred while registering SSH Credential", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error occurred while registering SSH Credential. More info : " + e.getMessage());
- csClientPool.returnBrokenResource(csClient);
- sharingClientPool.returnBrokenResource(sharingClient);
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -738,9 +668,9 @@
throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
- CredentialStoreService.Client csClient = csClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
PasswordCredential pwdCredential = new PasswordCredential();
pwdCredential.setPortalUserName(userName);
@@ -748,7 +678,7 @@
pwdCredential.setPassword(password);
pwdCredential.setDescription(description);
pwdCredential.setGatewayId(gatewayId);
- String key = csClient.addPasswordCredential(pwdCredential);
+ String key = credentialStoreHandler.addPasswordCredential(pwdCredential);
try {
Entity entity = new Entity();
entity.setEntityId(key);
@@ -757,28 +687,24 @@
entity.setOwnerId(userName + "@" + gatewayId);
entity.setName(key);
entity.setDescription(description);
- sharingClient.createEntity(entity);
+ sharingHandler.createEntity(entity);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error("Rolling back password registration for user " + userName + " and description ["
+ description + "]");
- csClient.deletePWDCredential(key, gatewayId);
+ credentialStoreHandler.deletePWDCredential(key, gatewayId);
AiravataSystemException ase = new AiravataSystemException();
ase.setMessage("Failed to create sharing registry record");
throw ase;
}
logger.debug("Airavata generated PWD credential for gateway : " + gatewayId + " and for user : "
+ loginUserName);
- csClientPool.returnResource(csClient);
- sharingClientPool.returnResource(sharingClient);
- registryClientPool.returnResource(regClient);
return key;
} catch (Exception e) {
logger.error("Error occurred while registering PWD Credential", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error occurred while registering PWD Credential. More info : " + e.getMessage());
- csClientPool.returnBrokenResource(csClient);
throw exception;
}
}
@@ -788,31 +714,25 @@
public CredentialSummary getCredentialSummary(AuthzToken authzToken, String tokenId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- CredentialStoreService.Client csClient = csClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
try {
- if (!userHasAccessInternal(sharingClient, authzToken, tokenId, ResourcePermissionType.READ)) {
+ if (!userHasAccessInternal(sharingHandler, authzToken, tokenId, ResourcePermissionType.READ)) {
throw new AuthorizationException("User does not have permission to access this resource");
}
- CredentialSummary credentialSummary = csClient.getCredentialSummary(tokenId, gatewayId);
- csClientPool.returnResource(csClient);
- sharingClientPool.returnResource(sharingClient);
+ CredentialSummary credentialSummary = credentialStoreHandler.getCredentialSummary(tokenId, gatewayId);
logger.debug("Airavata retrived the credential summary for token " + tokenId + "GatewayId: " + gatewayId);
return credentialSummary;
} catch (AuthorizationException ae) {
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
logger.info("User " + userName + " not allowed to access credential store token " + tokenId);
- csClientPool.returnResource(csClient);
- sharingClientPool.returnResource(sharingClient);
throw ae;
} catch (Exception e) {
String msg = "Error retrieving credential summary for token " + tokenId + ". GatewayId: " + gatewayId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- csClientPool.returnBrokenResource(csClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -821,8 +741,8 @@
@SecurityCheck
public List<CredentialSummary> getAllCredentialSummaries(AuthzToken authzToken, SummaryType type)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
- CredentialStoreService.Client csClient = csClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
try {
@@ -833,13 +753,11 @@
searchCriteria.setValue(gatewayId + ":" + ResourceType.CREDENTIAL_TOKEN.name());
filters.add(searchCriteria);
List<String> accessibleTokenIds =
- sharingClient.searchEntities(gatewayId, userName + "@" + gatewayId, filters, 0, -1).stream()
+ sharingHandler.searchEntities(gatewayId, userName + "@" + gatewayId, filters, 0, -1).stream()
.map(p -> p.getEntityId())
.collect(Collectors.toList());
List<CredentialSummary> credentialSummaries =
- csClient.getAllCredentialSummaries(type, accessibleTokenIds, gatewayId);
- csClientPool.returnResource(csClient);
- sharingClientPool.returnResource(sharingClient);
+ credentialStoreHandler.getAllCredentialSummaries(type, accessibleTokenIds, gatewayId);
logger.debug(
"Airavata successfully retrived credential summaries of type " + type + " GatewayId: " + gatewayId);
return credentialSummaries;
@@ -848,8 +766,6 @@
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- csClientPool.returnBrokenResource(csClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -858,34 +774,28 @@
@SecurityCheck
public boolean deleteSSHPubKey(AuthzToken authzToken, String airavataCredStoreToken)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
- CredentialStoreService.Client csClient = csClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
try {
if (!userHasAccessInternal(
- sharingClient, authzToken, airavataCredStoreToken, ResourcePermissionType.WRITE)) {
+ sharingHandler, authzToken, airavataCredStoreToken, ResourcePermissionType.WRITE)) {
throw new AuthorizationException("User does not have permission to delete this resource.");
}
logger.debug("Airavata deleted SSH pub key for gateway Id : " + gatewayId + " and with token id : "
+ airavataCredStoreToken);
- boolean result = csClient.deleteSSHCredential(airavataCredStoreToken, gatewayId);
- csClientPool.returnResource(csClient);
- sharingClientPool.returnResource(sharingClient);
+ boolean result = credentialStoreHandler.deleteSSHCredential(airavataCredStoreToken, gatewayId);
return result;
} catch (AuthorizationException ae) {
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
logger.info("User " + userName + " not allowed to delete (no WRITE permission) credential store token "
+ airavataCredStoreToken);
- csClientPool.returnResource(csClient);
- sharingClientPool.returnResource(sharingClient);
throw ae;
} catch (Exception e) {
logger.error("Error occurred while deleting SSH credential", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error occurred while deleting SSH credential. More info : " + e.getMessage());
- csClientPool.returnBrokenResource(csClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -894,34 +804,28 @@
@SecurityCheck
public boolean deletePWDCredential(AuthzToken authzToken, String airavataCredStoreToken)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
- CredentialStoreService.Client csClient = csClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
try {
if (!userHasAccessInternal(
- sharingClient, authzToken, airavataCredStoreToken, ResourcePermissionType.WRITE)) {
+ sharingHandler, authzToken, airavataCredStoreToken, ResourcePermissionType.WRITE)) {
throw new AuthorizationException("User does not have permission to delete this resource.");
}
logger.debug("Airavata deleted PWD credential for gateway Id : " + gatewayId + " and with token id : "
+ airavataCredStoreToken);
- boolean result = csClient.deletePWDCredential(airavataCredStoreToken, gatewayId);
- csClientPool.returnResource(csClient);
- sharingClientPool.returnResource(sharingClient);
+ boolean result = credentialStoreHandler.deletePWDCredential(airavataCredStoreToken, gatewayId);
return result;
} catch (AuthorizationException ae) {
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
logger.info("User " + userName + " not allowed to delete (no WRITE permission) credential store token "
+ airavataCredStoreToken);
- csClientPool.returnResource(csClient);
- sharingClientPool.returnResource(sharingClient);
throw ae;
} catch (Exception e) {
logger.error("Error occurred while deleting PWD credential", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error occurred while deleting PWD credential. More info : " + e.getMessage());
- csClientPool.returnBrokenResource(csClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -937,10 +841,10 @@
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
// TODO: verify that gatewayId and project.gatewayId match authzToken
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- String projectId = regClient.createProject(gatewayId, project);
+ String projectId = registryHandler.createProject(gatewayId, project);
if (ServerSettings.isEnableSharing()) {
try {
Entity entity = new Entity();
@@ -951,27 +855,23 @@
entity.setOwnerId(project.getOwner() + "@" + domainId);
entity.setName(project.getName());
entity.setDescription(project.getDescription());
- sharingClient.createEntity(entity);
+ sharingHandler.createEntity(entity);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error("Rolling back project creation Proj ID : " + projectId);
- regClient.deleteProject(projectId);
+ registryHandler.deleteProject(projectId);
AiravataSystemException ase = new AiravataSystemException();
ase.setMessage("Failed to create entry for project in Sharing Registry");
throw ase;
}
}
logger.debug("Airavata created project with project Id : " + projectId + " for gateway Id : " + gatewayId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return projectId;
} catch (Exception e) {
logger.error("Error while creating the project", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while creating the project. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -981,10 +881,10 @@
public void updateProject(AuthzToken authzToken, String projectId, Project updatedProject)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, ProjectNotFoundException,
AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- Project existingProject = regClient.getProject(projectId);
+ Project existingProject = registryHandler.getProject(projectId);
if (ServerSettings.isEnableSharing()
&& !authzToken
.getClaimsMap()
@@ -997,7 +897,7 @@
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, projectId, gatewayId + ":WRITE")) {
throw new AuthorizationException("User does not have permission to access this resource");
}
@@ -1011,17 +911,13 @@
if (!updatedProject.getGatewayId().equals(existingProject.getGatewayId())) {
throw new InvalidRequestException("Gateway ID of a project cannot be changed");
}
- regClient.updateProject(projectId, updatedProject);
+ registryHandler.updateProject(projectId, updatedProject);
logger.debug("Airavata updated project with project Id : " + projectId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
} catch (Exception e) {
logger.error("Error while updating the project", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating the project. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1031,10 +927,10 @@
public boolean deleteProject(AuthzToken authzToken, String projectId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, ProjectNotFoundException,
AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- Project existingProject = regClient.getProject(projectId);
+ Project existingProject = registryHandler.getProject(projectId);
if (ServerSettings.isEnableSharing()
&& !authzToken
.getClaimsMap()
@@ -1047,7 +943,7 @@
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, projectId, gatewayId + ":WRITE")) {
throw new AuthorizationException("User does not have permission to access this resource");
}
@@ -1055,17 +951,13 @@
throw new AuthorizationException("User does not have permission to access this resource");
}
}
- boolean ret = regClient.deleteProject(projectId);
+ boolean ret = registryHandler.deleteProject(projectId);
logger.debug("Airavata deleted project with project Id : " + projectId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return ret;
} catch (Exception e) {
logger.error("Error while removing the project", e);
ProjectNotFoundException exception = new ProjectNotFoundException();
exception.setMessage("Error while removing the project. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1088,10 +980,10 @@
public Project getProject(AuthzToken authzToken, String projectId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, ProjectNotFoundException,
AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- Project project = regClient.getProject(projectId);
+ Project project = registryHandler.getProject(projectId);
if (authzToken
.getClaimsMap()
.get(org.apache.airavata.common.utils.Constants.USER_NAME)
@@ -1100,34 +992,26 @@
.getClaimsMap()
.get(org.apache.airavata.common.utils.Constants.GATEWAY_ID)
.equals(project.getGatewayId())) {
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return project;
} else if (ServerSettings.isEnableSharing()) {
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, projectId, gatewayId + ":READ")) {
throw new AuthorizationException("User does not have permission to access this resource");
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return project;
} catch (Exception e) {
throw new AuthorizationException("User does not have permission to access this resource");
}
} else {
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return null;
}
} catch (Exception e) {
logger.error("Error while retrieving the project", e);
ProjectNotFoundException exception = new ProjectNotFoundException();
exception.setMessage("Error while retrieving the project. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1151,8 +1035,8 @@
AuthzToken authzToken, String gatewayId, String userName, int limit, int offset)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
// user projects + user accessible projects
@@ -1163,7 +1047,7 @@
searchCriteria.setSearchCondition(SearchCondition.EQUAL);
searchCriteria.setValue(gatewayId + ":PROJECT");
filters.add(searchCriteria);
- sharingClient
+ sharingHandler
.searchEntities(
authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
userName + "@" + gatewayId,
@@ -1176,16 +1060,12 @@
if (accessibleProjectIds.isEmpty()) {
result = Collections.emptyList();
} else {
- result = regClient.searchProjects(
+ result = registryHandler.searchProjects(
gatewayId, userName, accessibleProjectIds, new HashMap<>(), limit, offset);
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return result;
} else {
- List<Project> result = regClient.getUserProjects(gatewayId, userName, limit, offset);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ List<Project> result = registryHandler.getUserProjects(gatewayId, userName, limit, offset);
return result;
}
@@ -1194,8 +1074,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving projects. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1233,8 +1111,8 @@
int offset)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
List<String> accessibleProjIds = new ArrayList<>();
@@ -1246,7 +1124,7 @@
searchCriteria.setSearchCondition(SearchCondition.EQUAL);
searchCriteria.setValue(gatewayId + ":PROJECT");
sharingFilters.add(searchCriteria);
- sharingClient
+ sharingHandler
.searchEntities(
authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
userName + "@" + gatewayId,
@@ -1258,21 +1136,18 @@
if (accessibleProjIds.isEmpty()) {
result = Collections.emptyList();
} else {
- result = regClient.searchProjects(gatewayId, userName, accessibleProjIds, filters, limit, offset);
+ result = registryHandler.searchProjects(
+ gatewayId, userName, accessibleProjIds, filters, limit, offset);
}
} else {
- result = regClient.searchProjects(gatewayId, userName, accessibleProjIds, filters, limit, offset);
+ result = registryHandler.searchProjects(gatewayId, userName, accessibleProjIds, filters, limit, offset);
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return result;
} catch (Exception e) {
logger.error("Error while retrieving projects", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving projects. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1303,8 +1178,8 @@
int offset)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
List<String> accessibleExpIds = new ArrayList<>();
Map<ExperimentSearchFields, String> filtersCopy = new HashMap<>(filters);
@@ -1374,7 +1249,7 @@
searchOffset = offset;
searchLimit = limit;
}
- sharingClient
+ sharingHandler
.searchEntities(
authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
userName + "@" + gatewayId,
@@ -1387,18 +1262,14 @@
if (filteredInSharing) {
finalOffset = 0;
}
- List<ExperimentSummaryModel> result =
- regClient.searchExperiments(gatewayId, userName, accessibleExpIds, filtersCopy, limit, finalOffset);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ List<ExperimentSummaryModel> result = registryHandler.searchExperiments(
+ gatewayId, userName, accessibleExpIds, filtersCopy, limit, finalOffset);
return result;
} catch (Exception e) {
logger.error("Error while retrieving experiments", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1430,8 +1301,8 @@
int offset)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- // SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // SharingRegistryService.Client sharingHandler = sharingHandler.getResource();
try {
// FIXME: re-enable experiment statistics for non-admin users
// Find accessible experiments in date range
@@ -1453,12 +1324,12 @@
// toCreatedTimeCriteria.setValue(Long.toString(toTime));
// sharingFilters.add(toCreatedTimeCriteria);
// String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- // sharingClient.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
+ // sharingHandler.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
// userId + "@" + gatewayId, sharingFilters, 0, Integer.MAX_VALUE).forEach(e ->
// accessibleExpIds.add(e.getEntityId()));
List<String> accessibleExpIds = null;
- ExperimentStatistics result = regClient.getExperimentStatistics(
+ ExperimentStatistics result = registryHandler.getExperimentStatistics(
gatewayId,
fromTime,
toTime,
@@ -1468,16 +1339,14 @@
accessibleExpIds,
limit,
offset);
- registryClientPool.returnResource(regClient);
- // sharingClientPool.returnResource(sharingClient);
+ // sharingHandler.returnResource(sharingHandler);
return result;
} catch (Exception e) {
logger.error("Error while retrieving experiments", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- // sharingClientPool.returnBrokenResource(sharingClient);
+ // sharingHandler.returnBrokenResource(sharingHandler);
throw exception;
}
}
@@ -1498,10 +1367,10 @@
public List<ExperimentModel> getExperimentsInProject(AuthzToken authzToken, String projectId, int limit, int offset)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, ProjectNotFoundException,
AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- Project project = regClient.getProject(projectId);
+ Project project = registryHandler.getProject(projectId);
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
if (ServerSettings.isEnableSharing()
@@ -1515,7 +1384,7 @@
.equals(project.getGatewayId())) {
try {
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, projectId, gatewayId + ":READ")) {
throw new AuthorizationException("User does not have permission to access this resource");
}
@@ -1523,17 +1392,13 @@
throw new AuthorizationException("User does not have permission to access this resource");
}
}
- List<ExperimentModel> result = regClient.getExperimentsInProject(gatewayId, projectId, limit, offset);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ List<ExperimentModel> result = registryHandler.getExperimentsInProject(gatewayId, projectId, limit, offset);
return result;
} catch (Exception e) {
logger.error("Error while retrieving the experiments", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving the experiments. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1557,20 +1422,16 @@
AuthzToken authzToken, String gatewayId, String userName, int limit, int offset)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- List<ExperimentModel> result = regClient.getUserExperiments(gatewayId, userName, limit, offset);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ List<ExperimentModel> result = registryHandler.getUserExperiments(gatewayId, userName, limit, offset);
return result;
} catch (Exception e) {
logger.error("Error while retrieving the experiments", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving the experiments. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1604,10 +1465,10 @@
TException {
// TODO: verify that gatewayId and experiment.gatewayId match authzToken
logger.info("Api server accepted experiment creation with name {}", experiment.getExperimentName());
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- String experimentId = regClient.createExperiment(gatewayId, experiment);
+ String experimentId = registryHandler.createExperiment(gatewayId, experiment);
if (ServerSettings.isEnableSharing()) {
try {
@@ -1621,12 +1482,12 @@
entity.setDescription(experiment.getDescription());
entity.setParentEntityId(experiment.getProjectId());
- sharingClient.createEntity(entity);
- shareEntityWithAdminGatewayGroups(regClient, sharingClient, entity);
+ sharingHandler.createEntity(entity);
+ shareEntityWithAdminGatewayGroups(registryHandler, sharingHandler, entity);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error("Rolling back experiment creation Exp ID : " + experimentId);
- regClient.deleteExperiment(experimentId);
+ registryHandler.deleteExperiment(experimentId);
AiravataSystemException ase = new AiravataSystemException();
ase.setMessage("Failed to create sharing registry record");
throw ase;
@@ -1648,16 +1509,12 @@
"Created new experiment with experiment name {} and id ",
experiment.getExperimentName(),
experimentId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return experimentId;
} catch (Exception e) {
logger.error("Error while creating the experiment with experiment name {}", experiment.getExperimentName());
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while creating the experiment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1678,10 +1535,10 @@
public boolean deleteExperiment(AuthzToken authzToken, String experimentId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- ExperimentModel experimentModel = regClient.getExperiment(experimentId);
+ ExperimentModel experimentModel = registryHandler.getExperiment(experimentId);
if (ServerSettings.isEnableSharing()
&& !authzToken
@@ -1695,7 +1552,7 @@
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, experimentId, gatewayId + ":WRITE")) {
throw new AuthorizationException("User does not have permission to access this resource");
}
@@ -1709,17 +1566,13 @@
throw new RegistryServiceException(
"Experiment is not in CREATED state. Hence cannot deleted. ID:" + experimentId);
}
- boolean result = regClient.deleteExperiment(experimentId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ boolean result = registryHandler.deleteExperiment(experimentId);
return result;
} catch (Exception e) {
logger.error("Error while deleting the experiment", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting the experiment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1751,11 +1604,11 @@
public ExperimentModel getExperiment(AuthzToken authzToken, String airavataExperimentId)
throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
AiravataSystemException, AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
ExperimentModel experimentModel = null;
try {
- experimentModel = regClient.getExperiment(airavataExperimentId);
+ experimentModel = registryHandler.getExperiment(airavataExperimentId);
if (authzToken
.getClaimsMap()
.get(org.apache.airavata.common.utils.Constants.USER_NAME)
@@ -1764,40 +1617,30 @@
.getClaimsMap()
.get(org.apache.airavata.common.utils.Constants.GATEWAY_ID)
.equals(experimentModel.getGatewayId())) {
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return experimentModel;
} else if (ServerSettings.isEnableSharing()) {
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, airavataExperimentId, gatewayId + ":READ")) {
throw new AuthorizationException("User does not have permission to access this resource");
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return experimentModel;
} catch (Exception e) {
throw new AuthorizationException("User does not have permission to access this resource");
}
} else {
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return null;
}
} catch (ExperimentNotFoundException e) {
logger.error(e.getMessage(), e);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
throw e;
} catch (Exception e) {
logger.error("Error while getting the experiment", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while getting the experiment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1807,12 +1650,11 @@
public ExperimentModel getExperimentByAdmin(AuthzToken authzToken, String airavataExperimentId)
throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
AiravataSystemException, AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
ExperimentModel experimentModel = null;
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- experimentModel = regClient.getExperiment(airavataExperimentId);
- registryClientPool.returnResource(regClient);
+ experimentModel = registryHandler.getExperiment(airavataExperimentId);
if (gatewayId.equals(experimentModel.getGatewayId())) {
return experimentModel;
} else {
@@ -1823,7 +1665,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while getting the experiment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -1856,20 +1697,13 @@
public ExperimentModel getDetailedExperimentTree(AuthzToken authzToken, String airavataExperimentId)
throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
AiravataSystemException, AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
try {
- ExperimentModel result = regClient.getDetailedExperimentTree(airavataExperimentId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
- return result;
+ return registryHandler.getDetailedExperimentTree(airavataExperimentId);
} catch (Exception e) {
logger.error("Error while retrieving the experiment", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving the experiment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1903,10 +1737,10 @@
public void updateExperiment(AuthzToken authzToken, String airavataExperimentId, ExperimentModel experiment)
throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
AiravataSystemException, AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- ExperimentModel experimentModel = regClient.getExperiment(airavataExperimentId);
+ ExperimentModel experimentModel = registryHandler.getExperiment(airavataExperimentId);
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
if (ServerSettings.isEnableSharing()
&& !authzToken
@@ -1920,7 +1754,7 @@
try {
// Verify WRITE access
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, airavataExperimentId, gatewayId + ":WRITE")) {
throw new AuthorizationException("User does not have permission to access this resource");
}
@@ -1932,25 +1766,21 @@
try {
// Update name, description and parent on Entity
// TODO: update the experiment via a DB event
- Entity entity = sharingClient.getEntity(gatewayId, airavataExperimentId);
+ Entity entity = sharingHandler.getEntity(gatewayId, airavataExperimentId);
entity.setName(experiment.getExperimentName());
entity.setDescription(experiment.getDescription());
entity.setParentEntityId(experiment.getProjectId());
- sharingClient.updateEntity(entity);
+ sharingHandler.updateEntity(entity);
} catch (Exception e) {
throw new Exception("Failed to update entity in sharing registry", e);
}
- regClient.updateExperiment(airavataExperimentId, experiment);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ registryHandler.updateExperiment(airavataExperimentId, experiment);
} catch (Exception e) {
logger.error(airavataExperimentId, "Error while updating experiment", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating experiment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -1960,10 +1790,9 @@
public void updateExperimentConfiguration(
AuthzToken authzToken, String airavataExperimentId, UserConfigurationDataModel userConfiguration)
throws AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- regClient.updateExperimentConfiguration(airavataExperimentId, userConfiguration);
- registryClientPool.returnResource(regClient);
+ registryHandler.updateExperimentConfiguration(airavataExperimentId, userConfiguration);
} catch (Exception e) {
logger.error(airavataExperimentId, "Error while updating user configuration", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -1973,7 +1802,6 @@
+ "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given "
+ "experiment is in one of above statuses... "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -1983,10 +1811,9 @@
public void updateResourceScheduleing(
AuthzToken authzToken, String airavataExperimentId, ComputationalResourceSchedulingModel resourceScheduling)
throws AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- regClient.updateResourceScheduleing(airavataExperimentId, resourceScheduling);
- registryClientPool.returnResource(regClient);
+ registryHandler.updateResourceScheduleing(airavataExperimentId, resourceScheduling);
} catch (Exception e) {
logger.error(airavataExperimentId, "Error while updating scheduling info", e);
AiravataSystemException exception = new AiravataSystemException();
@@ -1996,7 +1823,6 @@
+ "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given "
+ "experiment is in one of above statuses... "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2017,7 +1843,7 @@
public boolean validateExperiment(AuthzToken authzToken, String airavataExperimentId) throws TException {
// TODO - call validation module and validate experiment
/* try {
- ExperimentModel experimentModel = regClient.getExperiment(airavataExperimentId);
+ ExperimentModel experimentModel = registryHandler.getExperiment(airavataExperimentId);
if (experimentModel == null) {
logger.error(airavataExperimentId, "Experiment validation failed , experiment {} doesn't exist.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
@@ -2073,15 +1899,13 @@
@Override
@SecurityCheck
public ExperimentStatus getExperimentStatus(AuthzToken authzToken, String airavataExperimentId) throws TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- ExperimentStatus result = regClient.getExperimentStatus(airavataExperimentId);
- registryClientPool.returnResource(regClient);
+ ExperimentStatus result = registryHandler.getExperimentStatus(airavataExperimentId);
return result;
} catch (Exception e) {
AiravataSystemException exception = new AiravataSystemException();
exception.setMessage(e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2090,17 +1914,15 @@
@SecurityCheck
public List<OutputDataObjectType> getExperimentOutputs(AuthzToken authzToken, String airavataExperimentId)
throws AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<OutputDataObjectType> result = regClient.getExperimentOutputs(airavataExperimentId);
- registryClientPool.returnResource(regClient);
+ List<OutputDataObjectType> result = registryHandler.getExperimentOutputs(airavataExperimentId);
return result;
} catch (Exception e) {
logger.error(airavataExperimentId, "Error while retrieving the experiment outputs", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving the experiment outputs. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2119,20 +1941,20 @@
throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
AiravataSystemException, AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
// Verify that user has WRITE access to experiment
final boolean hasAccess = userHasAccessInternal(
- sharingClient, authzToken, airavataExperimentId, ResourcePermissionType.WRITE);
+ sharingHandler, authzToken, airavataExperimentId, ResourcePermissionType.WRITE);
if (!hasAccess) {
throw new AuthorizationException("User does not have WRITE access to this experiment");
}
// Verify that the experiment's job is currently ACTIVE
- ExperimentModel existingExperiment = regClient.getExperiment(airavataExperimentId);
- List<JobModel> jobs = regClient.getJobDetails(airavataExperimentId);
+ ExperimentModel existingExperiment = registryHandler.getExperiment(airavataExperimentId);
+ List<JobModel> jobs = registryHandler.getJobDetails(airavataExperimentId);
boolean anyJobIsActive = jobs.stream().anyMatch(j -> {
if (j.getJobStatusesSize() > 0) {
return j.getJobStatuses().get(j.getJobStatusesSize() - 1).getJobState() == JobState.ACTIVE;
@@ -2168,12 +1990,8 @@
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
submitExperimentIntermediateOutputsEvent(gatewayId, airavataExperimentId, outputNames);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
} catch (InvalidRequestException | AuthorizationException e) {
logger.error(e.getMessage(), e);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
throw e;
} catch (Exception e) {
logger.error(
@@ -2185,8 +2003,6 @@
exception.setMessage(
"Error while processing request to fetch intermediate outputs for experiment. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -2197,18 +2013,18 @@
AuthzToken authzToken, String airavataExperimentId, List<String> outputNames)
throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
AiravataSystemException, AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
// Verify that user has READ access to experiment
- final boolean hasAccess =
- userHasAccessInternal(sharingClient, authzToken, airavataExperimentId, ResourcePermissionType.READ);
+ final boolean hasAccess = userHasAccessInternal(
+ sharingHandler, authzToken, airavataExperimentId, ResourcePermissionType.READ);
if (!hasAccess) {
throw new AuthorizationException("User does not have WRITE access to this experiment");
}
- ExperimentModel existingExperiment = regClient.getExperiment(airavataExperimentId);
+ ExperimentModel existingExperiment = registryHandler.getExperiment(airavataExperimentId);
// Find the most recent intermediate output fetching process for the outputNames
// Assumption: only one of these output fetching processes runs at a
@@ -2239,13 +2055,9 @@
result = new ProcessStatus(ProcessState.CREATED);
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return result;
} catch (InvalidRequestException | AuthorizationException e) {
logger.debug(e.getMessage(), e);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
throw e;
} catch (Exception e) {
logger.error(
@@ -2257,8 +2069,6 @@
exception.setMessage(
"Error while processing request to fetch intermediate outputs for experiment. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -2266,17 +2076,15 @@
@SecurityCheck
public Map<String, JobStatus> getJobStatuses(AuthzToken authzToken, String airavataExperimentId)
throws AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- Map<String, JobStatus> result = regClient.getJobStatuses(airavataExperimentId);
- registryClientPool.returnResource(regClient);
+ Map<String, JobStatus> result = registryHandler.getJobStatuses(airavataExperimentId);
return result;
} catch (Exception e) {
logger.error(airavataExperimentId, "Error while retrieving the job statuses", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving the job statuses. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2286,17 +2094,15 @@
public List<JobModel> getJobDetails(AuthzToken authzToken, String airavataExperimentId)
throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
AiravataSystemException, AuthorizationException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<JobModel> result = regClient.getJobDetails(airavataExperimentId);
- registryClientPool.returnResource(regClient);
+ List<JobModel> result = registryHandler.getJobDetails(airavataExperimentId);
return result;
} catch (Exception e) {
logger.error(airavataExperimentId, "Error while retrieving the job details", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving the job details. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2334,10 +2140,10 @@
throws AuthorizationException, AiravataSystemException, TException {
// TODO: verify that gatewayId matches gatewayId in authzToken
logger.info("Launching experiment {}", airavataExperimentId);
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- ExperimentModel experiment = regClient.getExperiment(airavataExperimentId);
+ ExperimentModel experiment = registryHandler.getExperiment(airavataExperimentId);
if (experiment == null) {
logger.error(
@@ -2363,7 +2169,7 @@
airavataExperimentId,
groupResourceProfileId);
experiment.getUserConfigurationData().setGroupResourceProfileId(groupResourceProfileId);
- regClient.updateExperimentConfiguration(
+ registryHandler.updateExperimentConfiguration(
airavataExperimentId, experiment.getUserConfigurationData());
} else {
throw new AuthorizationException("User " + username + " in gateway " + gatewayId
@@ -2372,7 +2178,7 @@
}
// Verify user has READ access to groupResourceProfileId
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId,
username + "@" + gatewayId,
experiment.getUserConfigurationData().getGroupResourceProfileId(),
@@ -2385,14 +2191,14 @@
// Verify user has READ access to Application Deployment
final String appInterfaceId = experiment.getExecutionId();
ApplicationInterfaceDescription applicationInterfaceDescription =
- regClient.getApplicationInterface(appInterfaceId);
+ registryHandler.getApplicationInterface(appInterfaceId);
List<String> appModuleIds = applicationInterfaceDescription.getApplicationModules();
// Assume that there is only one app module for this interface (otherwise, how could we figure out the
// deployment)
String appModuleId = appModuleIds.get(0);
List<ApplicationDeploymentDescription> applicationDeploymentDescriptions =
- regClient.getApplicationDeployments(appModuleId);
+ registryHandler.getApplicationDeployments(appModuleId);
if (!experiment.getUserConfigurationData().isAiravataAutoSchedule()) {
final String resourceHostId = experiment
@@ -2407,7 +2213,7 @@
if (applicationDeploymentDescription.isPresent()) {
final String appDeploymentId =
applicationDeploymentDescription.get().getAppDeploymentId();
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, username + "@" + gatewayId, appDeploymentId, gatewayId + ":READ")) {
throw new AuthorizationException("User " + username + " in gateway " + gatewayId
+ " doesn't have access to app deployment " + appDeploymentId);
@@ -2431,7 +2237,7 @@
if (applicationDeploymentDescription.isPresent()) {
final String appDeploymentId =
applicationDeploymentDescription.get().getAppDeploymentId();
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, username + "@" + gatewayId, appDeploymentId, gatewayId + ":READ")) {
throw new AuthorizationException("User " + username + " in gateway " + gatewayId
+ " doesn't have access to app deployment " + appDeploymentId);
@@ -2442,20 +2248,14 @@
submitExperiment(gatewayId, airavataExperimentId);
logger.info("Experiment with ExpId: " + airavataExperimentId + " was submitted in gateway with gatewayID: "
+ gatewayId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
} catch (InvalidRequestException | ExperimentNotFoundException | AuthorizationException e) {
logger.error(e.getMessage(), e);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
throw e;
} catch (Exception e1) {
logger.error(airavataExperimentId, "Error while instantiate the registry instance", e1);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while instantiate the registry instance. More info : " + e1.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -2517,21 +2317,19 @@
AuthzToken authzToken, String existingExperimentID, String newExperimentName, String newExperimentProjectId)
throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
AiravataSystemException, AuthorizationException, ProjectNotFoundException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
// getExperiment will apply sharing permissions
ExperimentModel existingExperiment = this.getExperiment(authzToken, existingExperimentID);
String result = cloneExperimentInternal(
- regClient,
- sharingClient,
+ registryHandler,
+ sharingHandler,
authzToken,
existingExperimentID,
newExperimentName,
newExperimentProjectId,
existingExperiment);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return result;
} catch (Exception e) {
logger.error(existingExperimentID, "Error while cloning the experiment with existing configuration...", e);
@@ -2539,8 +2337,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while cloning the experiment with existing configuration. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -2551,21 +2347,19 @@
AuthzToken authzToken, String existingExperimentID, String newExperimentName, String newExperimentProjectId)
throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
AiravataSystemException, AuthorizationException, ProjectNotFoundException, TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
// get existing experiment by bypassing normal sharing permissions for the admin user
ExperimentModel existingExperiment = this.getExperimentByAdmin(authzToken, existingExperimentID);
String result = cloneExperimentInternal(
- regClient,
- sharingClient,
+ registryHandler,
+ sharingHandler,
authzToken,
existingExperimentID,
newExperimentName,
newExperimentProjectId,
existingExperiment);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return result;
} catch (Exception e) {
logger.error(existingExperimentID, "Error while cloning the experiment with existing configuration...", e);
@@ -2573,15 +2367,13 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while cloning the experiment with existing configuration. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
private String cloneExperimentInternal(
- RegistryService.Client regClient,
- SharingRegistryService.Client sharingClient,
+ RegistryServerHandler registryHandler,
+ SharingRegistryServerHandler sharingHandler,
AuthzToken authzToken,
String existingExperimentID,
String newExperimentName,
@@ -2615,7 +2407,7 @@
// make sure user has write access to the project
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, existingExperiment.getProjectId(), gatewayId + ":WRITE")) {
logger.error(
"Error while cloning experiment {}, user doesn't have write access to project {}",
@@ -2627,7 +2419,7 @@
existingExperiment.setCreationTime(AiravataUtils.getCurrentTimestamp().getTime());
if (existingExperiment.getExecutionId() != null) {
List<OutputDataObjectType> applicationOutputs =
- regClient.getApplicationOutputs(existingExperiment.getExecutionId());
+ registryHandler.getApplicationOutputs(existingExperiment.getExecutionId());
existingExperiment.setExperimentOutputs(applicationOutputs);
}
if (validateString(newExperimentName)) {
@@ -2648,14 +2440,14 @@
.getComputationalResourceScheduling()
.getResourceHostId();
- ComputeResourceDescription computeResourceDescription = regClient.getComputeResource(compResourceId);
+ ComputeResourceDescription computeResourceDescription = registryHandler.getComputeResource(compResourceId);
if (!computeResourceDescription.isEnabled()) {
existingExperiment.getUserConfigurationData().setComputationalResourceScheduling(null);
}
}
logger.debug("Airavata cloned experiment with experiment id : " + existingExperimentID);
existingExperiment.setUserName(userId);
- String expId = regClient.createExperiment(gatewayId, existingExperiment);
+ String expId = registryHandler.createExperiment(gatewayId, existingExperiment);
if (ServerSettings.isEnableSharing()) {
try {
@@ -2667,12 +2459,12 @@
entity.setOwnerId(existingExperiment.getUserName() + "@" + domainId);
entity.setName(existingExperiment.getExperimentName());
entity.setDescription(existingExperiment.getDescription());
- sharingClient.createEntity(entity);
- shareEntityWithAdminGatewayGroups(regClient, sharingClient, entity);
+ sharingHandler.createEntity(entity);
+ shareEntityWithAdminGatewayGroups(registryHandler, sharingHandler, entity);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error("rolling back experiment creation Exp ID : " + expId);
- regClient.deleteExperiment(expId);
+ registryHandler.deleteExperiment(expId);
}
}
@@ -2704,10 +2496,10 @@
@SecurityCheck
public void terminateExperiment(AuthzToken authzToken, String airavataExperimentId, String gatewayId)
throws TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- ExperimentModel existingExperiment = regClient.getExperiment(airavataExperimentId);
- ExperimentStatus experimentLastStatus = regClient.getExperimentStatus(airavataExperimentId);
+ ExperimentModel existingExperiment = registryHandler.getExperiment(airavataExperimentId);
+ ExperimentStatus experimentLastStatus = registryHandler.getExperimentStatus(airavataExperimentId);
if (existingExperiment == null) {
logger.error(
airavataExperimentId,
@@ -2737,13 +2529,11 @@
logger.debug("Airavata cancelled experiment with experiment id : " + airavataExperimentId);
break;
}
- registryClientPool.returnResource(regClient);
} catch (RegistryServiceException | AiravataException e) {
logger.error(airavataExperimentId, "Error while cancelling the experiment...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while cancelling the experiment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2761,17 +2551,15 @@
AuthzToken authzToken, String gatewayId, ApplicationModule applicationModule)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.registerApplicationModule(gatewayId, applicationModule);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.registerApplicationModule(gatewayId, applicationModule);
return result;
} catch (Exception e) {
logger.error("Error while adding application module...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while adding application module. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2788,17 +2576,15 @@
public ApplicationModule getApplicationModule(AuthzToken authzToken, String appModuleId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- ApplicationModule result = regClient.getApplicationModule(appModuleId);
- registryClientPool.returnResource(regClient);
+ ApplicationModule result = registryHandler.getApplicationModule(appModuleId);
return result;
} catch (Exception e) {
logger.error(appModuleId, "Error while retrieving application module...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving the adding application module. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2817,17 +2603,15 @@
AuthzToken authzToken, String appModuleId, ApplicationModule applicationModule)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateApplicationModule(appModuleId, applicationModule);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateApplicationModule(appModuleId, applicationModule);
return result;
} catch (Exception e) {
logger.error(appModuleId, "Error while updating application module...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating application module. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2843,17 +2627,15 @@
public List<ApplicationModule> getAllAppModules(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<ApplicationModule> result = regClient.getAllAppModules(gatewayId);
- registryClientPool.returnResource(regClient);
+ List<ApplicationModule> result = registryHandler.getAllAppModules(gatewayId);
return result;
} catch (Exception e) {
logger.error("Error while retrieving all application modules...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving all application modules. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2869,9 +2651,9 @@
public List<ApplicationModule> getAccessibleAppModules(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
try {
List<String> accessibleAppDeploymentIds = new ArrayList<>();
if (ServerSettings.isEnableSharing()) {
@@ -2886,7 +2668,7 @@
permissionTypeFilter.setSearchCondition(SearchCondition.EQUAL);
permissionTypeFilter.setValue(gatewayId + ":" + ResourcePermissionType.READ);
sharingFilters.add(permissionTypeFilter);
- sharingClient
+ sharingHandler
.searchEntities(
authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
userName + "@" + gatewayId,
@@ -2905,18 +2687,14 @@
accessibleComputeResourceIds.add(groupComputeResourcePreference.getComputeResourceId());
}
}
- List<ApplicationModule> result = regClient.getAccessibleAppModules(
+ List<ApplicationModule> result = registryHandler.getAccessibleAppModules(
gatewayId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return result;
} catch (Exception e) {
logger.error("Error while retrieving all application modules...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving all application modules. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -2933,17 +2711,15 @@
public boolean deleteApplicationModule(AuthzToken authzToken, String appModuleId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteApplicationModule(appModuleId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteApplicationModule(appModuleId);
return result;
} catch (Exception e) {
logger.error(appModuleId, "Error while deleting application module...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting the application module. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -2961,10 +2737,10 @@
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
// TODO: verify that gatewayId matches authzToken gatewayId
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- String result = regClient.registerApplicationDeployment(gatewayId, applicationDeployment);
+ String result = registryHandler.registerApplicationDeployment(gatewayId, applicationDeployment);
Entity entity = new Entity();
entity.setEntityId(result);
final String domainId = gatewayId;
@@ -2974,18 +2750,14 @@
entity.setOwnerId(userName + "@" + domainId);
entity.setName(result);
entity.setDescription(applicationDeployment.getAppDeploymentDescription());
- sharingClient.createEntity(entity);
- shareEntityWithAdminGatewayGroups(regClient, sharingClient, entity);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ sharingHandler.createEntity(entity);
+ shareEntityWithAdminGatewayGroups(registryHandler, sharingHandler, entity);
return result;
} catch (Exception e) {
logger.error("Error while adding application deployment...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while adding application deployment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -3002,28 +2774,24 @@
public ApplicationDeploymentDescription getApplicationDeployment(AuthzToken authzToken, String appDeploymentId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
final boolean hasAccess =
- userHasAccessInternal(sharingClient, authzToken, appDeploymentId, ResourcePermissionType.READ);
+ userHasAccessInternal(sharingHandler, authzToken, appDeploymentId, ResourcePermissionType.READ);
if (!hasAccess) {
throw new AuthorizationException(
"User does not have access to application deployment " + appDeploymentId);
}
}
- ApplicationDeploymentDescription result = regClient.getApplicationDeployment(appDeploymentId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ ApplicationDeploymentDescription result = registryHandler.getApplicationDeployment(appDeploymentId);
return result;
} catch (Exception e) {
logger.error(appDeploymentId, "Error while retrieving application deployment...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving application deployment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -3042,28 +2810,24 @@
AuthzToken authzToken, String appDeploymentId, ApplicationDeploymentDescription applicationDeployment)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
- final boolean hasAccess =
- userHasAccessInternal(sharingClient, authzToken, appDeploymentId, ResourcePermissionType.WRITE);
+ final boolean hasAccess = userHasAccessInternal(
+ sharingHandler, authzToken, appDeploymentId, ResourcePermissionType.WRITE);
if (!hasAccess) {
throw new AuthorizationException(
"User does not have WRITE access to application deployment " + appDeploymentId);
}
}
- boolean result = regClient.updateApplicationDeployment(appDeploymentId, applicationDeployment);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ boolean result = registryHandler.updateApplicationDeployment(appDeploymentId, applicationDeployment);
return result;
} catch (Exception e) {
logger.error(appDeploymentId, "Error while updating application deployment...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating application deployment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -3080,28 +2844,24 @@
public boolean deleteApplicationDeployment(AuthzToken authzToken, String appDeploymentId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
final boolean hasAccess =
- userHasAccessInternal(sharingClient, authzToken, appDeploymentId, ResourcePermissionType.WRITE);
+ userHasAccessInternal(sharingHandler, authzToken, appDeploymentId, ResourcePermissionType.WRITE);
if (!hasAccess) {
throw new AuthorizationException(
"User does not have WRITE access to application deployment " + appDeploymentId);
}
final String domainId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- boolean result = regClient.deleteApplicationDeployment(appDeploymentId);
- sharingClient.deleteEntity(domainId, appDeploymentId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ boolean result = registryHandler.deleteApplicationDeployment(appDeploymentId);
+ sharingHandler.deleteEntity(domainId, appDeploymentId);
return result;
} catch (Exception e) {
logger.error(appDeploymentId, "Error while deleting application deployment...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting application deployment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -3132,9 +2892,9 @@
AuthzToken authzToken, String gatewayId, ResourcePermissionType permissionType)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
try {
List<String> accessibleAppDeploymentIds = new ArrayList<>();
if (ServerSettings.isEnableSharing()) {
@@ -3149,7 +2909,7 @@
permissionTypeFilter.setSearchCondition(SearchCondition.EQUAL);
permissionTypeFilter.setValue(gatewayId + ":" + permissionType.name());
sharingFilters.add(permissionTypeFilter);
- sharingClient
+ sharingHandler
.searchEntities(
authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
userName + "@" + gatewayId,
@@ -3168,18 +2928,14 @@
accessibleComputeResourceIds.add(groupComputeResourcePreference.getComputeResourceId());
}
}
- List<ApplicationDeploymentDescription> result = regClient.getAccessibleApplicationDeployments(
+ List<ApplicationDeploymentDescription> result = registryHandler.getAccessibleApplicationDeployments(
gatewayId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return result;
} catch (Exception e) {
logger.error("Error while retrieving application deployments...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving application deployments. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -3197,18 +2953,16 @@
public List<String> getAppModuleDeployedResources(AuthzToken authzToken, String appModuleId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
// TODO: restrict to only application deployments that are accessible to user
- List<String> result = regClient.getAppModuleDeployedResources(appModuleId);
- registryClientPool.returnResource(regClient);
+ List<String> result = registryHandler.getAppModuleDeployedResources(appModuleId);
return result;
} catch (Exception e) {
logger.error(appModuleId, "Error while retrieving application deployments...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving application deployment. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3232,18 +2986,18 @@
AuthzToken authzToken, String appModuleId, String groupResourceProfileId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
try {
// Get list of compute resources for this Group Resource Profile
if (!userHasAccessInternal(
- sharingClient, authzToken, groupResourceProfileId, ResourcePermissionType.READ)) {
+ sharingHandler, authzToken, groupResourceProfileId, ResourcePermissionType.READ)) {
throw new AuthorizationException(
"User is not authorized to access Group Resource Profile " + groupResourceProfileId);
}
- GroupResourceProfile groupResourceProfile = regClient.getGroupResourceProfile(groupResourceProfileId);
+ GroupResourceProfile groupResourceProfile = registryHandler.getGroupResourceProfile(groupResourceProfileId);
List<String> accessibleComputeResourceIds = groupResourceProfile.getComputePreferences().stream()
.map(compPref -> compPref.getComputeResourceId())
.collect(Collectors.toList());
@@ -3261,27 +3015,22 @@
permissionTypeFilter.setSearchCondition(SearchCondition.EQUAL);
permissionTypeFilter.setValue(gatewayId + ":" + ResourcePermissionType.READ);
sharingFilters.add(permissionTypeFilter);
- sharingClient
+ sharingHandler
.searchEntities(gatewayId, userName + "@" + gatewayId, sharingFilters, 0, -1)
.forEach(a -> accessibleAppDeploymentIds.add(a.getEntityId()));
- List<ApplicationDeploymentDescription> result = regClient.getAccessibleApplicationDeploymentsForAppModule(
- gatewayId, appModuleId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ List<ApplicationDeploymentDescription> result =
+ registryHandler.getAccessibleApplicationDeploymentsForAppModule(
+ gatewayId, appModuleId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
return result;
} catch (AuthorizationException checkedException) {
logger.error("Error while retrieving application deployments...", checkedException);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
throw checkedException;
} catch (Exception e) {
logger.error("Error while retrieving application deployments...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving application deployments. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -3298,17 +3047,15 @@
AuthzToken authzToken, String gatewayId, ApplicationInterfaceDescription applicationInterface)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.registerApplicationInterface(gatewayId, applicationInterface);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.registerApplicationInterface(gatewayId, applicationInterface);
return result;
} catch (Exception e) {
logger.error("Error while adding application interface...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while adding application interface. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3319,10 +3066,10 @@
AuthzToken authzToken, String existingAppInterfaceID, String newApplicationName, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
ApplicationInterfaceDescription existingInterface =
- regClient.getApplicationInterface(existingAppInterfaceID);
+ registryHandler.getApplicationInterface(existingAppInterfaceID);
if (existingInterface == null) {
logger.error(
"Provided application interface does not exist.Please provide a valid application interface id...");
@@ -3331,17 +3078,15 @@
existingInterface.setApplicationName(newApplicationName);
existingInterface.setApplicationInterfaceId(airavata_commonsConstants.DEFAULT_ID);
- String interfaceId = regClient.registerApplicationInterface(gatewayId, existingInterface);
+ String interfaceId = registryHandler.registerApplicationInterface(gatewayId, existingInterface);
logger.debug("Airavata cloned application interface : " + existingAppInterfaceID + " for gateway id : "
+ gatewayId);
- registryClientPool.returnResource(regClient);
return interfaceId;
} catch (Exception e) {
logger.error("Error while adding application interface...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while adding application interface. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3358,17 +3103,15 @@
public ApplicationInterfaceDescription getApplicationInterface(AuthzToken authzToken, String appInterfaceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- ApplicationInterfaceDescription result = regClient.getApplicationInterface(appInterfaceId);
- registryClientPool.returnResource(regClient);
+ ApplicationInterfaceDescription result = registryHandler.getApplicationInterface(appInterfaceId);
return result;
} catch (Exception e) {
logger.error(appInterfaceId, "Error while retrieving application interface...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving application interface. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3387,17 +3130,15 @@
AuthzToken authzToken, String appInterfaceId, ApplicationInterfaceDescription applicationInterface)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateApplicationInterface(appInterfaceId, applicationInterface);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateApplicationInterface(appInterfaceId, applicationInterface);
return result;
} catch (Exception e) {
logger.error(appInterfaceId, "Error while updating application interface...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating application interface. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3414,17 +3155,15 @@
public boolean deleteApplicationInterface(AuthzToken authzToken, String appInterfaceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteApplicationInterface(appInterfaceId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteApplicationInterface(appInterfaceId);
return result;
} catch (Exception e) {
logger.error(appInterfaceId, "Error while deleting application interface...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting application interface. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3440,17 +3179,15 @@
public Map<String, String> getAllApplicationInterfaceNames(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- Map<String, String> result = regClient.getAllApplicationInterfaceNames(gatewayId);
- registryClientPool.returnResource(regClient);
+ Map<String, String> result = registryHandler.getAllApplicationInterfaceNames(gatewayId);
return result;
} catch (Exception e) {
logger.error("Error while retrieving application interfaces...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving application interfaces. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3466,17 +3203,15 @@
public List<ApplicationInterfaceDescription> getAllApplicationInterfaces(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<ApplicationInterfaceDescription> result = regClient.getAllApplicationInterfaces(gatewayId);
- registryClientPool.returnResource(regClient);
+ List<ApplicationInterfaceDescription> result = registryHandler.getAllApplicationInterfaces(gatewayId);
return result;
} catch (Exception e) {
logger.error("Error while retrieving application interfaces...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving application interfaces. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3493,17 +3228,15 @@
public List<InputDataObjectType> getApplicationInputs(AuthzToken authzToken, String appInterfaceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<InputDataObjectType> result = regClient.getApplicationInputs(appInterfaceId);
- registryClientPool.returnResource(regClient);
+ List<InputDataObjectType> result = registryHandler.getApplicationInputs(appInterfaceId);
return result;
} catch (Exception e) {
logger.error(appInterfaceId, "Error while retrieving application inputs...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving application inputs. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3520,15 +3253,13 @@
public List<OutputDataObjectType> getApplicationOutputs(AuthzToken authzToken, String appInterfaceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<OutputDataObjectType> result = regClient.getApplicationOutputs(appInterfaceId);
- registryClientPool.returnResource(regClient);
+ List<OutputDataObjectType> result = registryHandler.getApplicationOutputs(appInterfaceId);
return result;
} catch (Exception e) {
AiravataSystemException exception = new AiravataSystemException();
exception.setMessage(e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3547,17 +3278,15 @@
public Map<String, String> getAvailableAppInterfaceComputeResources(AuthzToken authzToken, String appInterfaceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- Map<String, String> result = regClient.getAvailableAppInterfaceComputeResources(appInterfaceId);
- registryClientPool.returnResource(regClient);
+ Map<String, String> result = registryHandler.getAvailableAppInterfaceComputeResources(appInterfaceId);
return result;
} catch (Exception e) {
logger.error(appInterfaceId, "Error while saving compute resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while saving compute resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3574,17 +3303,15 @@
public String registerComputeResource(AuthzToken authzToken, ComputeResourceDescription computeResourceDescription)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.registerComputeResource(computeResourceDescription);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.registerComputeResource(computeResourceDescription);
return result;
} catch (Exception e) {
logger.error("Error while saving compute resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while saving compute resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3601,17 +3328,15 @@
public ComputeResourceDescription getComputeResource(AuthzToken authzToken, String computeResourceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- ComputeResourceDescription result = regClient.getComputeResource(computeResourceId);
- registryClientPool.returnResource(regClient);
+ ComputeResourceDescription result = registryHandler.getComputeResource(computeResourceId);
return result;
} catch (Exception e) {
logger.error(computeResourceId, "Error while retrieving compute resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving compute resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3627,17 +3352,15 @@
public Map<String, String> getAllComputeResourceNames(AuthzToken authzToken)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- Map<String, String> result = regClient.getAllComputeResourceNames();
- registryClientPool.returnResource(regClient);
+ Map<String, String> result = registryHandler.getAllComputeResourceNames();
return result;
} catch (Exception e) {
logger.error("Error while retrieving compute resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving compute resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3656,17 +3379,15 @@
AuthzToken authzToken, String computeResourceId, ComputeResourceDescription computeResourceDescription)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateComputeResource(computeResourceId, computeResourceDescription);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateComputeResource(computeResourceId, computeResourceDescription);
return result;
} catch (Exception e) {
logger.error(computeResourceId, "Error while updating compute resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updaing compute resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3683,17 +3404,15 @@
public boolean deleteComputeResource(AuthzToken authzToken, String computeResourceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteComputeResource(computeResourceId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteComputeResource(computeResourceId);
return result;
} catch (Exception e) {
logger.error(computeResourceId, "Error while deleting compute resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting compute resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3711,17 +3430,15 @@
public String registerStorageResource(AuthzToken authzToken, StorageResourceDescription storageResourceDescription)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.registerStorageResource(storageResourceDescription);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.registerStorageResource(storageResourceDescription);
return result;
} catch (Exception e) {
logger.error("Error while saving storage resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while saving storage resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3739,17 +3456,15 @@
public StorageResourceDescription getStorageResource(AuthzToken authzToken, String storageResourceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- StorageResourceDescription result = regClient.getStorageResource(storageResourceId);
- registryClientPool.returnResource(regClient);
+ StorageResourceDescription result = registryHandler.getStorageResource(storageResourceId);
return result;
} catch (Exception e) {
logger.error(storageResourceId, "Error while retrieving storage resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving storage resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3766,17 +3481,15 @@
public Map<String, String> getAllStorageResourceNames(AuthzToken authzToken)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- Map<String, String> result = regClient.getAllStorageResourceNames();
- registryClientPool.returnResource(regClient);
+ Map<String, String> result = registryHandler.getAllStorageResourceNames();
return result;
} catch (Exception e) {
logger.error("Error while retrieving storage resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving storage resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3796,17 +3509,15 @@
AuthzToken authzToken, String storageResourceId, StorageResourceDescription storageResourceDescription)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateStorageResource(storageResourceId, storageResourceDescription);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateStorageResource(storageResourceId, storageResourceDescription);
return result;
} catch (Exception e) {
logger.error(storageResourceId, "Error while updating storage resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updaing storage resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3824,17 +3535,15 @@
public boolean deleteStorageResource(AuthzToken authzToken, String storageResourceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteStorageResource(storageResourceId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteStorageResource(storageResourceId);
return result;
} catch (Exception e) {
logger.error(storageResourceId, "Error while deleting storage resource...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting storage resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3855,10 +3564,10 @@
AuthzToken authzToken, String computeResourceId, int priorityOrder, LOCALSubmission localSubmission)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.addLocalSubmissionDetails(computeResourceId, priorityOrder, localSubmission);
- registryClientPool.returnResource(regClient);
+ String result =
+ registryHandler.addLocalSubmissionDetails(computeResourceId, priorityOrder, localSubmission);
return result;
} catch (Exception e) {
logger.error(
@@ -3870,7 +3579,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3889,10 +3597,9 @@
AuthzToken authzToken, String jobSubmissionInterfaceId, LOCALSubmission localSubmission)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateLocalSubmissionDetails(jobSubmissionInterfaceId, localSubmission);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateLocalSubmissionDetails(jobSubmissionInterfaceId, localSubmission);
return result;
} catch (Exception e) {
logger.error(
@@ -3904,7 +3611,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3914,10 +3620,9 @@
public LOCALSubmission getLocalJobSubmission(AuthzToken authzToken, String jobSubmissionId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- LOCALSubmission result = regClient.getLocalJobSubmission(jobSubmissionId);
- registryClientPool.returnResource(regClient);
+ LOCALSubmission result = registryHandler.getLocalJobSubmission(jobSubmissionId);
return result;
} catch (Exception e) {
String errorMsg = "Error while retrieving local job submission interface to resource compute resource...";
@@ -3925,7 +3630,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(errorMsg + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3946,10 +3650,10 @@
AuthzToken authzToken, String computeResourceId, int priorityOrder, SSHJobSubmission sshJobSubmission)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.addSSHJobSubmissionDetails(computeResourceId, priorityOrder, sshJobSubmission);
- registryClientPool.returnResource(regClient);
+ String result =
+ registryHandler.addSSHJobSubmissionDetails(computeResourceId, priorityOrder, sshJobSubmission);
return result;
} catch (Exception e) {
logger.error(
@@ -3961,7 +3665,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -3982,11 +3685,10 @@
AuthzToken authzToken, String computeResourceId, int priorityOrder, SSHJobSubmission sshJobSubmission)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
String result =
- regClient.addSSHForkJobSubmissionDetails(computeResourceId, priorityOrder, sshJobSubmission);
- registryClientPool.returnResource(regClient);
+ registryHandler.addSSHForkJobSubmissionDetails(computeResourceId, priorityOrder, sshJobSubmission);
return result;
} catch (Exception e) {
logger.error(
@@ -3998,7 +3700,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4008,10 +3709,9 @@
public SSHJobSubmission getSSHJobSubmission(AuthzToken authzToken, String jobSubmissionId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- SSHJobSubmission result = regClient.getSSHJobSubmission(jobSubmissionId);
- registryClientPool.returnResource(regClient);
+ SSHJobSubmission result = registryHandler.getSSHJobSubmission(jobSubmissionId);
return result;
} catch (Exception e) {
String errorMsg = "Error while retrieving SSH job submission interface to resource compute resource...";
@@ -4019,7 +3719,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(errorMsg + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4040,11 +3739,10 @@
AuthzToken authzToken, String computeResourceId, int priorityOrder, CloudJobSubmission cloudJobSubmission)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
String result =
- regClient.addCloudJobSubmissionDetails(computeResourceId, priorityOrder, cloudJobSubmission);
- registryClientPool.returnResource(regClient);
+ registryHandler.addCloudJobSubmissionDetails(computeResourceId, priorityOrder, cloudJobSubmission);
return result;
} catch (Exception e) {
logger.error(
@@ -4056,7 +3754,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4066,10 +3763,9 @@
public CloudJobSubmission getCloudJobSubmission(AuthzToken authzToken, String jobSubmissionId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- CloudJobSubmission result = regClient.getCloudJobSubmission(jobSubmissionId);
- registryClientPool.returnResource(regClient);
+ CloudJobSubmission result = registryHandler.getCloudJobSubmission(jobSubmissionId);
return result;
} catch (Exception e) {
String errorMsg = "Error while retrieving Cloud job submission interface to resource compute resource...";
@@ -4077,7 +3773,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(errorMsg + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4091,11 +3786,10 @@
UnicoreJobSubmission unicoreJobSubmission)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result =
- regClient.addUNICOREJobSubmissionDetails(computeResourceId, priorityOrder, unicoreJobSubmission);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.addUNICOREJobSubmissionDetails(
+ computeResourceId, priorityOrder, unicoreJobSubmission);
return result;
} catch (Exception e) {
logger.error("Error while adding job submission interface to resource compute resource...", e);
@@ -4104,7 +3798,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4114,10 +3807,9 @@
public UnicoreJobSubmission getUnicoreJobSubmission(AuthzToken authzToken, String jobSubmissionId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- UnicoreJobSubmission result = regClient.getUnicoreJobSubmission(jobSubmissionId);
- registryClientPool.returnResource(regClient);
+ UnicoreJobSubmission result = registryHandler.getUnicoreJobSubmission(jobSubmissionId);
return result;
} catch (Exception e) {
String errorMsg = "Error while retrieving Unicore job submission interface to resource compute resource...";
@@ -4125,7 +3817,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(errorMsg + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4144,10 +3835,9 @@
AuthzToken authzToken, String jobSubmissionInterfaceId, SSHJobSubmission sshJobSubmission)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateSSHJobSubmissionDetails(jobSubmissionInterfaceId, sshJobSubmission);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateSSHJobSubmissionDetails(jobSubmissionInterfaceId, sshJobSubmission);
return result;
} catch (Exception e) {
logger.error(
@@ -4159,7 +3849,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4178,10 +3867,10 @@
AuthzToken authzToken, String jobSubmissionInterfaceId, CloudJobSubmission cloudJobSubmission)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateCloudJobSubmissionDetails(jobSubmissionInterfaceId, cloudJobSubmission);
- registryClientPool.returnResource(regClient);
+ boolean result =
+ registryHandler.updateCloudJobSubmissionDetails(jobSubmissionInterfaceId, cloudJobSubmission);
return result;
} catch (Exception e) {
logger.error(
@@ -4193,7 +3882,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4204,11 +3892,10 @@
AuthzToken authzToken, String jobSubmissionInterfaceId, UnicoreJobSubmission unicoreJobSubmission)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
boolean result =
- regClient.updateUnicoreJobSubmissionDetails(jobSubmissionInterfaceId, unicoreJobSubmission);
- registryClientPool.returnResource(regClient);
+ registryHandler.updateUnicoreJobSubmissionDetails(jobSubmissionInterfaceId, unicoreJobSubmission);
return result;
} catch (Exception e) {
logger.error(
@@ -4220,7 +3907,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4245,10 +3931,10 @@
LOCALDataMovement localDataMovement)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.addLocalDataMovementDetails(resourceId, dmType, priorityOrder, localDataMovement);
- registryClientPool.returnResource(regClient);
+ String result =
+ registryHandler.addLocalDataMovementDetails(resourceId, dmType, priorityOrder, localDataMovement);
return result;
} catch (Exception e) {
logger.error(resourceId, "Error while adding data movement interface to resource resource...", e);
@@ -4256,7 +3942,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while adding data movement interface to resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4275,17 +3960,15 @@
AuthzToken authzToken, String dataMovementInterfaceId, LOCALDataMovement localDataMovement)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateLocalDataMovementDetails(dataMovementInterfaceId, localDataMovement);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateLocalDataMovementDetails(dataMovementInterfaceId, localDataMovement);
return result;
} catch (Exception e) {
logger.error(dataMovementInterfaceId, "Error while updating local data movement interface..", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating local data movement interface. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4295,10 +3978,9 @@
public LOCALDataMovement getLocalDataMovement(AuthzToken authzToken, String dataMovementId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- LOCALDataMovement result = regClient.getLocalDataMovement(dataMovementId);
- registryClientPool.returnResource(regClient);
+ LOCALDataMovement result = registryHandler.getLocalDataMovement(dataMovementId);
return result;
} catch (Exception e) {
String errorMsg = "Error while retrieving local data movement interface to resource compute resource...";
@@ -4306,7 +3988,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(errorMsg + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4327,10 +4008,10 @@
AuthzToken authzToken, String resourceId, DMType dmType, int priorityOrder, SCPDataMovement scpDataMovement)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.addSCPDataMovementDetails(resourceId, dmType, priorityOrder, scpDataMovement);
- registryClientPool.returnResource(regClient);
+ String result =
+ registryHandler.addSCPDataMovementDetails(resourceId, dmType, priorityOrder, scpDataMovement);
return result;
} catch (Exception e) {
logger.error(resourceId, "Error while adding data movement interface to resource compute resource...", e);
@@ -4338,7 +4019,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while adding data movement interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4358,10 +4038,9 @@
AuthzToken authzToken, String dataMovementInterfaceId, SCPDataMovement scpDataMovement)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateSCPDataMovementDetails(dataMovementInterfaceId, scpDataMovement);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateSCPDataMovementDetails(dataMovementInterfaceId, scpDataMovement);
return result;
} catch (Exception e) {
logger.error(
@@ -4373,7 +4052,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4383,10 +4061,9 @@
public SCPDataMovement getSCPDataMovement(AuthzToken authzToken, String dataMovementId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- SCPDataMovement result = regClient.getSCPDataMovement(dataMovementId);
- registryClientPool.returnResource(regClient);
+ SCPDataMovement result = registryHandler.getSCPDataMovement(dataMovementId);
return result;
} catch (Exception e) {
String errorMsg = "Error while retrieving SCP data movement interface to resource compute resource...";
@@ -4394,7 +4071,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(errorMsg + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4409,11 +4085,10 @@
UnicoreDataMovement unicoreDataMovement)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result =
- regClient.addUnicoreDataMovementDetails(resourceId, dmType, priorityOrder, unicoreDataMovement);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.addUnicoreDataMovementDetails(
+ resourceId, dmType, priorityOrder, unicoreDataMovement);
return result;
} catch (Exception e) {
logger.error(resourceId, "Error while adding data movement interface to resource compute resource...", e);
@@ -4421,7 +4096,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while adding data movement interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4432,10 +4106,10 @@
AuthzToken authzToken, String dataMovementInterfaceId, UnicoreDataMovement unicoreDataMovement)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateUnicoreDataMovementDetails(dataMovementInterfaceId, unicoreDataMovement);
- registryClientPool.returnResource(regClient);
+ boolean result =
+ registryHandler.updateUnicoreDataMovementDetails(dataMovementInterfaceId, unicoreDataMovement);
return result;
} catch (Exception e) {
logger.error(
@@ -4444,7 +4118,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while updating unicore data movement to compute resource. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4454,10 +4127,9 @@
public UnicoreDataMovement getUnicoreDataMovement(AuthzToken authzToken, String dataMovementId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- UnicoreDataMovement result = regClient.getUnicoreDataMovement(dataMovementId);
- registryClientPool.returnResource(regClient);
+ UnicoreDataMovement result = registryHandler.getUnicoreDataMovement(dataMovementId);
return result;
} catch (Exception e) {
String errorMsg = "Error while retrieving UNICORE data movement interface...";
@@ -4465,7 +4137,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(errorMsg + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4490,11 +4161,10 @@
GridFTPDataMovement gridFTPDataMovement)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.addGridFTPDataMovementDetails(
+ String result = registryHandler.addGridFTPDataMovementDetails(
computeResourceId, dmType, priorityOrder, gridFTPDataMovement);
- registryClientPool.returnResource(regClient);
return result;
} catch (Exception e) {
logger.error(
@@ -4503,7 +4173,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while adding data movement interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4523,10 +4192,10 @@
AuthzToken authzToken, String dataMovementInterfaceId, GridFTPDataMovement gridFTPDataMovement)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateGridFTPDataMovementDetails(dataMovementInterfaceId, gridFTPDataMovement);
- registryClientPool.returnResource(regClient);
+ boolean result =
+ registryHandler.updateGridFTPDataMovementDetails(dataMovementInterfaceId, gridFTPDataMovement);
return result;
} catch (Exception e) {
logger.error(
@@ -4538,7 +4207,6 @@
exception.setMessage(
"Error while adding job submission interface to resource compute resource. More info : "
+ e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4548,10 +4216,9 @@
public GridFTPDataMovement getGridFTPDataMovement(AuthzToken authzToken, String dataMovementId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- GridFTPDataMovement result = regClient.getGridFTPDataMovement(dataMovementId);
- registryClientPool.returnResource(regClient);
+ GridFTPDataMovement result = registryHandler.getGridFTPDataMovement(dataMovementId);
return result;
} catch (Exception e) {
String errorMsg = "Error while retrieving GridFTP data movement interface to resource compute resource...";
@@ -4559,7 +4226,6 @@
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(errorMsg + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4641,17 +4307,15 @@
AuthzToken authzToken, String computeResourceId, String jobSubmissionInterfaceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteJobSubmissionInterface(computeResourceId, jobSubmissionInterfaceId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteJobSubmissionInterface(computeResourceId, jobSubmissionInterfaceId);
return result;
} catch (Exception e) {
logger.error(jobSubmissionInterfaceId, "Error while deleting job submission interface...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting job submission interface. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4669,17 +4333,15 @@
AuthzToken authzToken, String resourceId, String dataMovementInterfaceId, DMType dmType)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteDataMovementInterface(resourceId, dataMovementInterfaceId, dmType);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteDataMovementInterface(resourceId, dataMovementInterfaceId, dmType);
return result;
} catch (Exception e) {
logger.error(dataMovementInterfaceId, "Error while deleting data movement interface...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting data movement interface. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4689,17 +4351,15 @@
public String registerResourceJobManager(AuthzToken authzToken, ResourceJobManager resourceJobManager)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.registerResourceJobManager(resourceJobManager);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.registerResourceJobManager(resourceJobManager);
return result;
} catch (Exception e) {
logger.error(resourceJobManager.getResourceJobManagerId(), "Error while adding resource job manager...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while adding resource job manager. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4710,17 +4370,15 @@
AuthzToken authzToken, String resourceJobManagerId, ResourceJobManager updatedResourceJobManager)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateResourceJobManager(resourceJobManagerId, updatedResourceJobManager);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateResourceJobManager(resourceJobManagerId, updatedResourceJobManager);
return result;
} catch (Exception e) {
logger.error(resourceJobManagerId, "Error while updating resource job manager...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating resource job manager. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4730,17 +4388,15 @@
public ResourceJobManager getResourceJobManager(AuthzToken authzToken, String resourceJobManagerId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- ResourceJobManager result = regClient.getResourceJobManager(resourceJobManagerId);
- registryClientPool.returnResource(regClient);
+ ResourceJobManager result = registryHandler.getResourceJobManager(resourceJobManagerId);
return result;
} catch (Exception e) {
logger.error(resourceJobManagerId, "Error while retrieving resource job manager...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving resource job manager. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4750,17 +4406,15 @@
public boolean deleteResourceJobManager(AuthzToken authzToken, String resourceJobManagerId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteResourceJobManager(resourceJobManagerId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteResourceJobManager(resourceJobManagerId);
return result;
} catch (Exception e) {
logger.error(resourceJobManagerId, "Error while deleting resource job manager...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting resource job manager. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4770,17 +4424,15 @@
public boolean deleteBatchQueue(AuthzToken authzToken, String computeResourceId, String queueName)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteBatchQueue(computeResourceId, queueName);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteBatchQueue(computeResourceId, queueName);
return result;
} catch (Exception e) {
logger.error(computeResourceId, "Error while deleting batch queue...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while deleting batch queue. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4799,17 +4451,15 @@
public String registerGatewayResourceProfile(AuthzToken authzToken, GatewayResourceProfile gatewayResourceProfile)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.registerGatewayResourceProfile(gatewayResourceProfile);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.registerGatewayResourceProfile(gatewayResourceProfile);
return result;
} catch (Exception e) {
logger.error("Error while registering gateway resource profile...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while registering gateway resource profile. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4826,17 +4476,15 @@
public GatewayResourceProfile getGatewayResourceProfile(AuthzToken authzToken, String gatewayID)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- GatewayResourceProfile result = regClient.getGatewayResourceProfile(gatewayID);
- registryClientPool.returnResource(regClient);
+ GatewayResourceProfile result = registryHandler.getGatewayResourceProfile(gatewayID);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while retrieving gateway resource profile...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving gateway resource profile. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4853,17 +4501,15 @@
@SecurityCheck
public boolean updateGatewayResourceProfile(
AuthzToken authzToken, String gatewayID, GatewayResourceProfile gatewayResourceProfile) throws TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateGatewayResourceProfile(gatewayID, gatewayResourceProfile);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateGatewayResourceProfile(gatewayID, gatewayResourceProfile);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while updating gateway resource profile...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating gateway resource profile. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4878,17 +4524,15 @@
@Override
@SecurityCheck
public boolean deleteGatewayResourceProfile(AuthzToken authzToken, String gatewayID) throws TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteGatewayResourceProfile(gatewayID);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteGatewayResourceProfile(gatewayID);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while removing gateway resource profile...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while removing gateway resource profile. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4912,11 +4556,10 @@
ComputeResourcePreference computeResourcePreference)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.addGatewayComputeResourcePreference(
+ boolean result = registryHandler.addGatewayComputeResourcePreference(
gatewayID, computeResourceId, computeResourcePreference);
- registryClientPool.returnResource(regClient);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while registering gateway resource profile preference...", e);
@@ -4924,7 +4567,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while registering gateway resource profile preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4935,10 +4577,10 @@
AuthzToken authzToken, String gatewayID, String storageResourceId, StoragePreference dataStoragePreference)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.addGatewayStoragePreference(gatewayID, storageResourceId, dataStoragePreference);
- registryClientPool.returnResource(regClient);
+ boolean result =
+ registryHandler.addGatewayStoragePreference(gatewayID, storageResourceId, dataStoragePreference);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while registering gateway resource profile preference...", e);
@@ -4946,7 +4588,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while registering gateway resource profile preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4965,11 +4606,10 @@
AuthzToken authzToken, String gatewayID, String computeResourceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
ComputeResourcePreference result =
- regClient.getGatewayComputeResourcePreference(gatewayID, computeResourceId);
- registryClientPool.returnResource(regClient);
+ registryHandler.getGatewayComputeResourcePreference(gatewayID, computeResourceId);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
@@ -4977,7 +4617,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while reading gateway compute resource preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -4987,17 +4626,15 @@
public StoragePreference getGatewayStoragePreference(AuthzToken authzToken, String gatewayID, String storageId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- StoragePreference result = regClient.getGatewayStoragePreference(gatewayID, storageId);
- registryClientPool.returnResource(regClient);
+ StoragePreference result = registryHandler.getGatewayStoragePreference(gatewayID, storageId);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while reading gateway data storage preference...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while reading gateway data storage preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5015,10 +4652,9 @@
AuthzToken authzToken, String gatewayID)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<ComputeResourcePreference> result = regClient.getAllGatewayComputeResourcePreferences(gatewayID);
- registryClientPool.returnResource(regClient);
+ List<ComputeResourcePreference> result = registryHandler.getAllGatewayComputeResourcePreferences(gatewayID);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while reading gateway compute resource preferences...", e);
@@ -5026,7 +4662,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while reading gateway compute resource preferences. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5036,17 +4671,15 @@
public List<StoragePreference> getAllGatewayStoragePreferences(AuthzToken authzToken, String gatewayID)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<StoragePreference> result = regClient.getAllGatewayStoragePreferences(gatewayID);
- registryClientPool.returnResource(regClient);
+ List<StoragePreference> result = registryHandler.getAllGatewayStoragePreferences(gatewayID);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while reading gateway data storage preferences...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while reading gateway data storage preferences. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5056,16 +4689,14 @@
public List<GatewayResourceProfile> getAllGatewayResourceProfiles(AuthzToken authzToken)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<GatewayResourceProfile> result = regClient.getAllGatewayResourceProfiles();
- registryClientPool.returnResource(regClient);
+ List<GatewayResourceProfile> result = registryHandler.getAllGatewayResourceProfiles();
return result;
} catch (Exception e) {
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while reading retrieving all gateway profiles. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5088,11 +4719,10 @@
ComputeResourcePreference computeResourcePreference)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateGatewayComputeResourcePreference(
+ boolean result = registryHandler.updateGatewayComputeResourcePreference(
gatewayID, computeResourceId, computeResourcePreference);
- registryClientPool.returnResource(regClient);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
@@ -5100,7 +4730,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while updating gateway compute resource preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5111,17 +4740,16 @@
AuthzToken authzToken, String gatewayID, String storageId, StoragePreference dataStoragePreference)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateGatewayStoragePreference(gatewayID, storageId, dataStoragePreference);
- registryClientPool.returnResource(regClient);
+ boolean result =
+ registryHandler.updateGatewayStoragePreference(gatewayID, storageId, dataStoragePreference);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while reading gateway data storage preference...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating gateway data storage preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5140,10 +4768,9 @@
AuthzToken authzToken, String gatewayID, String computeResourceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteGatewayComputeResourcePreference(gatewayID, computeResourceId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteGatewayComputeResourcePreference(gatewayID, computeResourceId);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
@@ -5151,7 +4778,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while updating gateway compute resource preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5161,17 +4787,15 @@
public boolean deleteGatewayStoragePreference(AuthzToken authzToken, String gatewayID, String storageId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteGatewayStoragePreference(gatewayID, storageId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteGatewayStoragePreference(gatewayID, storageId);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while reading gateway data storage preference...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating gateway data storage preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5242,17 +4866,15 @@
TException {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- CredentialStoreService.Client csClient = csClientPool.getResource();
+ // Direct handler call - no client needed
SSHCredential sshCredential = null;
try {
- sshCredential = csClient.getSSHCredential(airavataCredStoreToken, gatewayId);
- csClientPool.returnResource(csClient);
+ sshCredential = credentialStoreHandler.getSSHCredential(airavataCredStoreToken, gatewayId);
} catch (Exception e) {
logger.error("Error occurred while retrieving SSH Credential", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error occurred while retrieving SSH Credential. More info : " + e.getMessage());
- csClientPool.returnBrokenResource(csClient);
throw exception;
}
@@ -5276,17 +4898,15 @@
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- CredentialStoreService.Client csClient = csClientPool.getResource();
+ // Direct handler call - no client needed
SSHCredential sshCredential = null;
try {
- sshCredential = csClient.getSSHCredential(airavataCredStoreToken, gatewayId);
- csClientPool.returnResource(csClient);
+ sshCredential = credentialStoreHandler.getSSHCredential(airavataCredStoreToken, gatewayId);
} catch (Exception e) {
logger.error("Error occurred while retrieving SSH Credential", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error occurred while retrieving SSH Credential. More info : " + e.getMessage());
- csClientPool.returnBrokenResource(csClient);
throw exception;
}
@@ -5318,17 +4938,15 @@
public String registerUserResourceProfile(AuthzToken authzToken, UserResourceProfile userResourceProfile)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.registerUserResourceProfile(userResourceProfile);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.registerUserResourceProfile(userResourceProfile);
return result;
} catch (Exception e) {
logger.error("Error while registering user resource profile...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while registering user resource profile. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5338,10 +4956,9 @@
public boolean isUserResourceProfileExists(AuthzToken authzToken, String userId, String gatewayID)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.isUserResourceProfileExists(userId, gatewayID);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.isUserResourceProfileExists(userId, gatewayID);
return result;
} catch (Exception e) {
logger.error("Error while checking existence of user resource profile for " + userId, e);
@@ -5349,7 +4966,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while checking existence of user resource profile. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5369,17 +4985,15 @@
public UserResourceProfile getUserResourceProfile(AuthzToken authzToken, String userId, String gatewayID)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- UserResourceProfile result = regClient.getUserResourceProfile(userId, gatewayID);
- registryClientPool.returnResource(regClient);
+ UserResourceProfile result = registryHandler.getUserResourceProfile(userId, gatewayID);
return result;
} catch (Exception e) {
logger.error("Error while retrieving user resource profile for " + userId, e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while retrieving user resource profile. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5398,17 +5012,15 @@
public boolean updateUserResourceProfile(
AuthzToken authzToken, String userId, String gatewayID, UserResourceProfile userResourceProfile)
throws TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateUserResourceProfile(userId, gatewayID, userResourceProfile);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateUserResourceProfile(userId, gatewayID, userResourceProfile);
return result;
} catch (Exception e) {
logger.error(userId, "Error while updating user resource profile...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating user resource profile. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5424,17 +5036,15 @@
@Override
@SecurityCheck
public boolean deleteUserResourceProfile(AuthzToken authzToken, String userId, String gatewayID) throws TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteUserResourceProfile(userId, gatewayID);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteUserResourceProfile(userId, gatewayID);
return result;
} catch (Exception e) {
logger.error(userId, "Error while removing user resource profile...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while removing user resource profile. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5460,11 +5070,10 @@
UserComputeResourcePreference userComputeResourcePreference)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.addUserComputeResourcePreference(
+ boolean result = registryHandler.addUserComputeResourcePreference(
userId, gatewayID, userComputeResourceId, userComputeResourcePreference);
- registryClientPool.returnResource(regClient);
return result;
} catch (Exception e) {
logger.error(userId, "Error while registering user resource profile preference...", e);
@@ -5472,7 +5081,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while registering user resource profile preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5487,18 +5095,16 @@
UserStoragePreference dataStoragePreference)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result =
- regClient.addUserStoragePreference(userId, gatewayID, userStorageResourceId, dataStoragePreference);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.addUserStoragePreference(
+ userId, gatewayID, userStorageResourceId, dataStoragePreference);
return result;
} catch (Exception e) {
logger.error(userId, "Error while registering user storage preference...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while registering user storage preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5518,18 +5124,16 @@
AuthzToken authzToken, String userId, String gatewayID, String userComputeResourceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
UserComputeResourcePreference result =
- regClient.getUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
- registryClientPool.returnResource(regClient);
+ registryHandler.getUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
return result;
} catch (Exception e) {
logger.error(userId, "Error while reading user compute resource preference...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while reading user compute resource preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5540,17 +5144,15 @@
AuthzToken authzToken, String userId, String gatewayID, String userStorageId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- UserStoragePreference result = regClient.getUserStoragePreference(userId, gatewayID, userStorageId);
- registryClientPool.returnResource(regClient);
+ UserStoragePreference result = registryHandler.getUserStoragePreference(userId, gatewayID, userStorageId);
return result;
} catch (Exception e) {
logger.error(userId, "Error while reading user data storage preference...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while reading user data storage preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5569,11 +5171,10 @@
AuthzToken authzToken, String userId, String gatewayID)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
List<UserComputeResourcePreference> result =
- regClient.getAllUserComputeResourcePreferences(userId, gatewayID);
- registryClientPool.returnResource(regClient);
+ registryHandler.getAllUserComputeResourcePreferences(userId, gatewayID);
return result;
} catch (Exception e) {
logger.error(userId, "Error while reading User compute resource preferences...", e);
@@ -5581,7 +5182,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while reading User compute resource preferences. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5592,17 +5192,15 @@
AuthzToken authzToken, String userId, String gatewayID)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<UserStoragePreference> result = regClient.getAllUserStoragePreferences(userId, gatewayID);
- registryClientPool.returnResource(regClient);
+ List<UserStoragePreference> result = registryHandler.getAllUserStoragePreferences(userId, gatewayID);
return result;
} catch (Exception e) {
logger.error(userId, "Error while reading User data storage preferences...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while reading User data storage preferences. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5612,17 +5210,15 @@
public List<UserResourceProfile> getAllUserResourceProfiles(AuthzToken authzToken)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<UserResourceProfile> result = regClient.getAllUserResourceProfiles();
- registryClientPool.returnResource(regClient);
+ List<UserResourceProfile> result = registryHandler.getAllUserResourceProfiles();
return result;
} catch (Exception e) {
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while reading retrieving all user resource profiles. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5647,11 +5243,10 @@
UserComputeResourcePreference userComputeResourcePreference)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.updateUserComputeResourcePreference(
+ boolean result = registryHandler.updateUserComputeResourcePreference(
userId, gatewayID, userComputeResourceId, userComputeResourcePreference);
- registryClientPool.returnResource(regClient);
return result;
} catch (Exception e) {
logger.error(userId, "Error while reading user compute resource preference...", e);
@@ -5659,7 +5254,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while updating user compute resource preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5674,18 +5268,16 @@
UserStoragePreference dataStoragePreference)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result =
- regClient.updateUserStoragePreference(userId, gatewayID, userStorageId, dataStoragePreference);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.updateUserStoragePreference(
+ userId, gatewayID, userStorageId, dataStoragePreference);
return result;
} catch (Exception e) {
logger.error(userId, "Error while reading user data storage preference...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating user data storage preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5705,10 +5297,10 @@
AuthzToken authzToken, String userId, String gatewayID, String userComputeResourceId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
- registryClientPool.returnResource(regClient);
+ boolean result =
+ registryHandler.deleteUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
return result;
} catch (Exception e) {
logger.error(userId, "Error while reading user compute resource preference...", e);
@@ -5716,7 +5308,6 @@
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(
"Error while updating user compute resource preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5727,17 +5318,15 @@
AuthzToken authzToken, String userId, String gatewayID, String userStorageId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- boolean result = regClient.deleteUserStoragePreference(userId, gatewayID, userStorageId);
- registryClientPool.returnResource(regClient);
+ boolean result = registryHandler.deleteUserStoragePreference(userId, gatewayID, userStorageId);
return result;
} catch (Exception e) {
logger.error(userId, "Error while reading user data storage preference...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating user data storage preference. More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5747,17 +5336,15 @@
public List<QueueStatusModel> getLatestQueueStatuses(AuthzToken authzToken)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<QueueStatusModel> result = regClient.getLatestQueueStatuses();
- registryClientPool.returnResource(regClient);
+ List<QueueStatusModel> result = registryHandler.getLatestQueueStatuses();
return result;
} catch (Exception e) {
String msg = "Error in retrieving queue statuses";
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5773,17 +5360,15 @@
public String registerDataProduct(AuthzToken authzToken, DataProductModel dataProductModel)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.registerDataProduct(dataProductModel);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.registerDataProduct(dataProductModel);
return result;
} catch (Exception e) {
String msg = "Error in registering the data resource" + dataProductModel.getProductName() + ".";
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5793,17 +5378,15 @@
public DataProductModel getDataProduct(AuthzToken authzToken, String productUri)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- DataProductModel result = regClient.getDataProduct(productUri);
- registryClientPool.returnResource(regClient);
+ DataProductModel result = registryHandler.getDataProduct(productUri);
return result;
} catch (Exception e) {
String msg = "Error in retreiving the data product " + productUri + ".";
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5813,17 +5396,15 @@
public String registerReplicaLocation(AuthzToken authzToken, DataReplicaLocationModel replicaLocationModel)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String result = regClient.registerReplicaLocation(replicaLocationModel);
- registryClientPool.returnResource(regClient);
+ String result = registryHandler.registerReplicaLocation(replicaLocationModel);
return result;
} catch (Exception e) {
String msg = "Error in retreiving the replica " + replicaLocationModel.getReplicaName() + ".";
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5833,17 +5414,15 @@
public DataProductModel getParentDataProduct(AuthzToken authzToken, String productUri)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- DataProductModel result = regClient.getParentDataProduct(productUri);
- registryClientPool.returnResource(regClient);
+ DataProductModel result = registryHandler.getParentDataProduct(productUri);
return result;
} catch (Exception e) {
String msg = "Error in retreiving the parent data product for " + productUri + ".";
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5853,17 +5432,15 @@
public List<DataProductModel> getChildDataProducts(AuthzToken authzToken, String productUri)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<DataProductModel> result = regClient.getChildDataProducts(productUri);
- registryClientPool.returnResource(regClient);
+ List<DataProductModel> result = registryHandler.getChildDataProducts(productUri);
return result;
} catch (Exception e) {
String msg = "Error in retreiving the child products for " + productUri + ".";
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5881,35 +5458,35 @@
AuthzToken authzToken, String resourceId, Map<String, ResourcePermissionType> userPermissionList)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- if (!userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)
+ if (!userHasAccessInternal(sharingHandler, authzToken, resourceId, ResourcePermissionType.OWNER)
&& !userHasAccessInternal(
- sharingClient, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
+ sharingHandler, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
throw new AuthorizationException(
"User is not allowed to change sharing because the user is either not the resource owner or does not have access to share the resource");
}
for (Map.Entry<String, ResourcePermissionType> userPermission : userPermissionList.entrySet()) {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
if (userPermission.getValue().equals(ResourcePermissionType.WRITE))
- sharingClient.shareEntityWithUsers(
+ sharingHandler.shareEntityWithUsers(
gatewayId,
resourceId,
Arrays.asList(userPermission.getKey()),
authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "WRITE",
true);
else if (userPermission.getValue().equals(ResourcePermissionType.READ))
- sharingClient.shareEntityWithUsers(
+ sharingHandler.shareEntityWithUsers(
gatewayId,
resourceId,
Arrays.asList(userPermission.getKey()),
authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "READ",
true);
else if (userPermission.getValue().equals(ResourcePermissionType.MANAGE_SHARING)) {
- if (userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)) {
- createManageSharingPermissionTypeIfMissing(sharingClient, gatewayId);
- sharingClient.shareEntityWithUsers(
+ if (userHasAccessInternal(sharingHandler, authzToken, resourceId, ResourcePermissionType.OWNER)) {
+ createManageSharingPermissionTypeIfMissing(sharingHandler, gatewayId);
+ sharingHandler.shareEntityWithUsers(
gatewayId,
resourceId,
Arrays.asList(userPermission.getKey()),
@@ -5924,16 +5501,12 @@
throw new AiravataClientException(AiravataErrorType.UNSUPPORTED_OPERATION);
}
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return true;
} catch (Exception e) {
String msg = "Error in sharing resource with users. Resource ID : " + resourceId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- sharingClientPool.returnBrokenResource(sharingClient);
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -5944,35 +5517,35 @@
AuthzToken authzToken, String resourceId, Map<String, ResourcePermissionType> groupPermissionList)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- if (!userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)
+ if (!userHasAccessInternal(sharingHandler, authzToken, resourceId, ResourcePermissionType.OWNER)
&& !userHasAccessInternal(
- sharingClient, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
+ sharingHandler, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
throw new AuthorizationException(
"User is not allowed to change sharing because the user is either not the resource owner or does not have access to share the resource");
}
for (Map.Entry<String, ResourcePermissionType> groupPermission : groupPermissionList.entrySet()) {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
if (groupPermission.getValue().equals(ResourcePermissionType.WRITE))
- sharingClient.shareEntityWithGroups(
+ sharingHandler.shareEntityWithGroups(
gatewayId,
resourceId,
Arrays.asList(groupPermission.getKey()),
authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "WRITE",
true);
else if (groupPermission.getValue().equals(ResourcePermissionType.READ))
- sharingClient.shareEntityWithGroups(
+ sharingHandler.shareEntityWithGroups(
gatewayId,
resourceId,
Arrays.asList(groupPermission.getKey()),
authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "READ",
true);
else if (groupPermission.getValue().equals(ResourcePermissionType.MANAGE_SHARING)) {
- if (userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)) {
- createManageSharingPermissionTypeIfMissing(sharingClient, gatewayId);
- sharingClient.shareEntityWithGroups(
+ if (userHasAccessInternal(sharingHandler, authzToken, resourceId, ResourcePermissionType.OWNER)) {
+ createManageSharingPermissionTypeIfMissing(sharingHandler, gatewayId);
+ sharingHandler.shareEntityWithGroups(
gatewayId,
resourceId,
Arrays.asList(groupPermission.getKey()),
@@ -5987,16 +5560,12 @@
throw new AiravataClientException(AiravataErrorType.UNSUPPORTED_OPERATION);
}
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return true;
} catch (Exception e) {
String msg = "Error in sharing resource with groups. Resource ID : " + resourceId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- sharingClientPool.returnBrokenResource(sharingClient);
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6007,33 +5576,33 @@
AuthzToken authzToken, String resourceId, Map<String, ResourcePermissionType> userPermissionList)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- if (!userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)
+ if (!userHasAccessInternal(sharingHandler, authzToken, resourceId, ResourcePermissionType.OWNER)
&& !userHasAccessInternal(
- sharingClient, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
+ sharingHandler, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
throw new AuthorizationException(
"User is not allowed to change sharing because the user is either not the resource owner or does not have access to share the resource");
}
for (Map.Entry<String, ResourcePermissionType> userPermission : userPermissionList.entrySet()) {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
if (userPermission.getValue().equals(ResourcePermissionType.WRITE))
- sharingClient.revokeEntitySharingFromUsers(
+ sharingHandler.revokeEntitySharingFromUsers(
gatewayId,
resourceId,
Arrays.asList(userPermission.getKey()),
authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "WRITE");
else if (userPermission.getValue().equals(ResourcePermissionType.READ))
- sharingClient.revokeEntitySharingFromUsers(
+ sharingHandler.revokeEntitySharingFromUsers(
gatewayId,
resourceId,
Arrays.asList(userPermission.getKey()),
authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "READ");
else if (userPermission.getValue().equals(ResourcePermissionType.MANAGE_SHARING)) {
- if (userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)) {
- createManageSharingPermissionTypeIfMissing(sharingClient, gatewayId);
- sharingClient.revokeEntitySharingFromUsers(
+ if (userHasAccessInternal(sharingHandler, authzToken, resourceId, ResourcePermissionType.OWNER)) {
+ createManageSharingPermissionTypeIfMissing(sharingHandler, gatewayId);
+ sharingHandler.revokeEntitySharingFromUsers(
gatewayId,
resourceId,
Arrays.asList(userPermission.getKey()),
@@ -6047,16 +5616,12 @@
throw new AiravataClientException(AiravataErrorType.UNSUPPORTED_OPERATION);
}
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return true;
} catch (Exception e) {
String msg = "Error in revoking access to resource from users. Resource ID : " + resourceId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- sharingClientPool.returnBrokenResource(sharingClient);
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6067,23 +5632,23 @@
AuthzToken authzToken, String resourceId, Map<String, ResourcePermissionType> groupPermissionList)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
final String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
try {
- if (!userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)
+ if (!userHasAccessInternal(sharingHandler, authzToken, resourceId, ResourcePermissionType.OWNER)
&& !userHasAccessInternal(
- sharingClient, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
+ sharingHandler, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
throw new AuthorizationException(
"User is not allowed to change sharing because the user is either not the resource owner or does not have access to share the resource");
}
// For certain resource types, restrict them from being unshared with admin groups
- ResourceType resourceType = getResourceType(sharingClient, gatewayId, resourceId);
+ ResourceType resourceType = getResourceType(sharingHandler, gatewayId, resourceId);
Set<ResourceType> adminRestrictedResourceTypes = new HashSet<>(Arrays.asList(
ResourceType.EXPERIMENT, ResourceType.APPLICATION_DEPLOYMENT, ResourceType.GROUP_RESOURCE_PROFILE));
if (adminRestrictedResourceTypes.contains(resourceType)) {
// Prevent removing Admins WRITE/MANAGE_SHARING access and Read Only Admins READ access
- GatewayGroups gatewayGroups = retrieveGatewayGroups(regClient, gatewayId);
+ GatewayGroups gatewayGroups = retrieveGatewayGroups(registryHandler, gatewayId);
if (groupPermissionList.containsKey(gatewayGroups.getAdminsGroupId())
&& groupPermissionList
.get(gatewayGroups.getAdminsGroupId())
@@ -6111,15 +5676,15 @@
}
for (Map.Entry<String, ResourcePermissionType> groupPermission : groupPermissionList.entrySet()) {
if (groupPermission.getValue().equals(ResourcePermissionType.WRITE))
- sharingClient.revokeEntitySharingFromUsers(
+ sharingHandler.revokeEntitySharingFromUsers(
gatewayId, resourceId, Arrays.asList(groupPermission.getKey()), gatewayId + ":" + "WRITE");
else if (groupPermission.getValue().equals(ResourcePermissionType.READ))
- sharingClient.revokeEntitySharingFromUsers(
+ sharingHandler.revokeEntitySharingFromUsers(
gatewayId, resourceId, Arrays.asList(groupPermission.getKey()), gatewayId + ":" + "READ");
else if (groupPermission.getValue().equals(ResourcePermissionType.MANAGE_SHARING)) {
- if (userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)) {
- createManageSharingPermissionTypeIfMissing(sharingClient, gatewayId);
- sharingClient.revokeEntitySharingFromUsers(
+ if (userHasAccessInternal(sharingHandler, authzToken, resourceId, ResourcePermissionType.OWNER)) {
+ createManageSharingPermissionTypeIfMissing(sharingHandler, gatewayId);
+ sharingHandler.revokeEntitySharingFromUsers(
gatewayId,
resourceId,
Arrays.asList(groupPermission.getKey()),
@@ -6133,16 +5698,12 @@
throw new AiravataClientException(AiravataErrorType.UNSUPPORTED_OPERATION);
}
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return true;
} catch (Exception e) {
String msg = "Error in revoking access to resource from groups. Resource ID : " + resourceId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- sharingClientPool.returnBrokenResource(sharingClient);
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6183,42 +5744,38 @@
AuthzToken authzToken,
String resourceId,
ResourcePermissionType permissionType,
- BiFunction<SharingRegistryService.Client, ResourcePermissionType, Collection<User>> userListFunction)
+ BiFunction<SharingRegistryServerHandler, ResourcePermissionType, Collection<User>> userListFunction)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
HashSet<String> accessibleUsers = new HashSet<>();
if (permissionType.equals(ResourcePermissionType.WRITE)) {
- userListFunction.apply(sharingClient, ResourcePermissionType.WRITE).stream()
+ userListFunction.apply(sharingHandler, ResourcePermissionType.WRITE).stream()
.forEach(u -> accessibleUsers.add(u.getUserId()));
- userListFunction.apply(sharingClient, ResourcePermissionType.OWNER).stream()
+ userListFunction.apply(sharingHandler, ResourcePermissionType.OWNER).stream()
.forEach(u -> accessibleUsers.add(u.getUserId()));
} else if (permissionType.equals(ResourcePermissionType.READ)) {
- userListFunction.apply(sharingClient, ResourcePermissionType.READ).stream()
+ userListFunction.apply(sharingHandler, ResourcePermissionType.READ).stream()
.forEach(u -> accessibleUsers.add(u.getUserId()));
- userListFunction.apply(sharingClient, ResourcePermissionType.OWNER).stream()
+ userListFunction.apply(sharingHandler, ResourcePermissionType.OWNER).stream()
.forEach(u -> accessibleUsers.add(u.getUserId()));
} else if (permissionType.equals(ResourcePermissionType.OWNER)) {
- userListFunction.apply(sharingClient, ResourcePermissionType.OWNER).stream()
+ userListFunction.apply(sharingHandler, ResourcePermissionType.OWNER).stream()
.forEach(u -> accessibleUsers.add(u.getUserId()));
} else if (permissionType.equals(ResourcePermissionType.MANAGE_SHARING)) {
- userListFunction.apply(sharingClient, ResourcePermissionType.MANAGE_SHARING).stream()
+ userListFunction.apply(sharingHandler, ResourcePermissionType.MANAGE_SHARING).stream()
.forEach(u -> accessibleUsers.add(u.getUserId()));
- userListFunction.apply(sharingClient, ResourcePermissionType.OWNER).stream()
+ userListFunction.apply(sharingHandler, ResourcePermissionType.OWNER).stream()
.forEach(u -> accessibleUsers.add(u.getUserId()));
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return new ArrayList<>(accessibleUsers);
} catch (Exception e) {
String msg = "Error in getting all accessible users for resource. Resource ID : " + resourceId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- sharingClientPool.returnBrokenResource(sharingClient);
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6259,33 +5816,29 @@
AuthzToken authzToken,
String resourceId,
ResourcePermissionType permissionType,
- BiFunction<SharingRegistryService.Client, ResourcePermissionType, Collection<UserGroup>> groupListFunction)
+ BiFunction<SharingRegistryServerHandler, ResourcePermissionType, Collection<UserGroup>> groupListFunction)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
HashSet<String> accessibleGroups = new HashSet<>();
if (permissionType.equals(ResourcePermissionType.WRITE)) {
- groupListFunction.apply(sharingClient, ResourcePermissionType.WRITE).stream()
+ groupListFunction.apply(sharingHandler, ResourcePermissionType.WRITE).stream()
.forEach(g -> accessibleGroups.add(g.getGroupId()));
} else if (permissionType.equals(ResourcePermissionType.READ)) {
- groupListFunction.apply(sharingClient, ResourcePermissionType.READ).stream()
+ groupListFunction.apply(sharingHandler, ResourcePermissionType.READ).stream()
.forEach(g -> accessibleGroups.add(g.getGroupId()));
} else if (permissionType.equals(ResourcePermissionType.MANAGE_SHARING)) {
- groupListFunction.apply(sharingClient, ResourcePermissionType.MANAGE_SHARING).stream()
+ groupListFunction.apply(sharingHandler, ResourcePermissionType.MANAGE_SHARING).stream()
.forEach(g -> accessibleGroups.add(g.getGroupId()));
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return new ArrayList<>(accessibleGroups);
} catch (Exception e) {
String msg = "Error in getting all accessible groups for resource. Resource ID : " + resourceId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- sharingClientPool.returnBrokenResource(sharingClient);
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6297,10 +5850,9 @@
TException {
final String domainId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
final String userId = authzToken.getClaimsMap().get(Constants.USER_NAME) + "@" + domainId;
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
try {
- final boolean hasAccess = userHasAccessInternal(sharingClient, authzToken, resourceId, permissionType);
- sharingClientPool.returnResource(sharingClient);
+ final boolean hasAccess = userHasAccessInternal(sharingHandler, authzToken, resourceId, permissionType);
return hasAccess;
} catch (Exception e) {
String msg = "Error in if user can access resource. User ID : " + userId + ", Resource ID : " + resourceId
@@ -6308,7 +5860,6 @@
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -6319,12 +5870,12 @@
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
// TODO: verify that gatewayId in groupResourceProfile matches authzToken gatewayId
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
try {
- validateGroupResourceProfile(sharingClient, authzToken, groupResourceProfile);
- String groupResourceProfileId = regClient.createGroupResourceProfile(groupResourceProfile);
+ validateGroupResourceProfile(sharingHandler, authzToken, groupResourceProfile);
+ String groupResourceProfileId = registryHandler.createGroupResourceProfile(groupResourceProfile);
if (ServerSettings.isEnableSharing()) {
try {
Entity entity = new Entity();
@@ -6335,41 +5886,36 @@
entity.setOwnerId(userName + "@" + groupResourceProfile.getGatewayId());
entity.setName(groupResourceProfile.getGroupResourceProfileName());
- sharingClient.createEntity(entity);
+ sharingHandler.createEntity(entity);
- shareEntityWithAdminGatewayGroups(regClient, sharingClient, entity);
+ shareEntityWithAdminGatewayGroups(registryHandler, sharingHandler, entity);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error("Rolling back group resource profile creation Group Resource Profile ID : "
+ groupResourceProfileId);
- regClient.removeGroupResourceProfile(groupResourceProfileId);
+ registryHandler.removeGroupResourceProfile(groupResourceProfileId);
AiravataSystemException ase = new AiravataSystemException();
ase.setMessage("Failed to create sharing registry record");
throw ase;
}
}
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
return groupResourceProfileId;
} catch (AuthorizationException ae) {
logger.info("User " + userName
+ " not allowed access to resources referenced in this GroupResourceProfile. Reason: "
+ ae.getMessage());
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
throw ae;
} catch (Exception e) {
String msg = "Error creating group resource profile.";
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
private void validateGroupResourceProfile(
- SharingRegistryService.Client sharingClient,
+ SharingRegistryServerHandler sharingHandler,
AuthzToken authzToken,
GroupResourceProfile groupResourceProfile)
throws AuthorizationException {
@@ -6386,7 +5932,7 @@
tokenIds.add(groupResourceProfile.getDefaultCredentialStoreToken());
}
for (String tokenId : tokenIds) {
- if (!userHasAccessInternal(sharingClient, authzToken, tokenId, ResourcePermissionType.READ)) {
+ if (!userHasAccessInternal(sharingHandler, authzToken, tokenId, ResourcePermissionType.READ)) {
throw new AuthorizationException(
"User does not have READ permission to credential token " + tokenId + ".");
}
@@ -6398,26 +5944,22 @@
public void updateGroupResourceProfile(AuthzToken authzToken, GroupResourceProfile groupResourceProfile)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
- validateGroupResourceProfile(sharingClient, authzToken, groupResourceProfile);
+ validateGroupResourceProfile(sharingHandler, authzToken, groupResourceProfile);
if (!userHasAccessInternal(
- sharingClient,
+ sharingHandler,
authzToken,
groupResourceProfile.getGroupResourceProfileId(),
ResourcePermissionType.WRITE)) {
throw new AuthorizationException("User does not have permission to update group resource profile");
}
- regClient.updateGroupResourceProfile(groupResourceProfile);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ registryHandler.updateGroupResourceProfile(groupResourceProfile);
} catch (AuthorizationException ae) {
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
logger.info("User " + userName + " not allowed access to update GroupResourceProfile "
+ groupResourceProfile.getGroupResourceProfileId() + ", reason: " + ae.getMessage());
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
throw ae;
} catch (Exception e) {
String msg = "Error updating group resource profile. groupResourceProfileId: "
@@ -6425,7 +5967,6 @@
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6435,14 +5976,14 @@
public GroupResourceProfile getGroupResourceProfile(AuthzToken authzToken, String groupResourceProfileId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":READ")) {
throw new AuthorizationException(
"User does not have permission to access group resource profile");
@@ -6451,23 +5992,18 @@
throw new AuthorizationException("User does not have permission to access group resource profile");
}
}
- GroupResourceProfile groupResourceProfile = regClient.getGroupResourceProfile(groupResourceProfileId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ GroupResourceProfile groupResourceProfile = registryHandler.getGroupResourceProfile(groupResourceProfileId);
return groupResourceProfile;
} catch (AuthorizationException checkedException) {
logger.error(
"Error while retrieving group resource profile. groupResourceProfileId: " + groupResourceProfileId,
checkedException);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
throw checkedException;
} catch (Exception e) {
String msg = "Error retrieving group resource profile. groupResourceProfileId: " + groupResourceProfileId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6477,14 +6013,14 @@
public boolean removeGroupResourceProfile(AuthzToken authzToken, String groupResourceProfileId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
if (ServerSettings.isEnableSharing()) {
try {
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":WRITE")) {
throw new AuthorizationException(
"User does not have permission to remove group resource profile");
@@ -6493,17 +6029,14 @@
throw new AuthorizationException("User does not have permission to remove group resource profile");
}
}
- boolean result = regClient.removeGroupResourceProfile(groupResourceProfileId);
- sharingClient.deleteEntity(gatewayId, groupResourceProfileId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ boolean result = registryHandler.removeGroupResourceProfile(groupResourceProfileId);
+ sharingHandler.deleteEntity(gatewayId, groupResourceProfileId);
return result;
} catch (Exception e) {
String msg = "Error removing group resource profile. groupResourceProfileId: " + groupResourceProfileId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6513,8 +6046,8 @@
public List<GroupResourceProfile> getGroupResourceList(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
try {
List<String> accessibleGroupResProfileIds = new ArrayList<>();
@@ -6525,7 +6058,7 @@
searchCriteria.setSearchCondition(SearchCondition.EQUAL);
searchCriteria.setValue(gatewayId + ":" + ResourceType.GROUP_RESOURCE_PROFILE.name());
filters.add(searchCriteria);
- sharingClient
+ sharingHandler
.searchEntities(
authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
userName + "@" + gatewayId,
@@ -6536,17 +6069,13 @@
.forEach(p -> accessibleGroupResProfileIds.add(p.getEntityId()));
}
List<GroupResourceProfile> groupResourceProfileList =
- regClient.getGroupResourceList(gatewayId, accessibleGroupResProfileIds);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ registryHandler.getGroupResourceList(gatewayId, accessibleGroupResProfileIds);
return groupResourceProfileList;
} catch (Exception e) {
String msg = "Error retrieving list group resource profile list. GatewayId: " + gatewayId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
- sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@@ -6557,14 +6086,14 @@
AuthzToken authzToken, String computeResourceId, String groupResourceProfileId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":WRITE")) {
throw new AuthorizationException(
"User does not have permission to remove group compute preferences");
@@ -6574,9 +6103,7 @@
"User does not have permission to remove group compute preferences");
}
}
- boolean result = regClient.removeGroupComputePrefs(computeResourceId, groupResourceProfileId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ boolean result = registryHandler.removeGroupComputePrefs(computeResourceId, groupResourceProfileId);
return result;
} catch (Exception e) {
String msg = "Error removing group compute resource preferences. GroupResourceProfileId: "
@@ -6584,7 +6111,6 @@
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6594,16 +6120,16 @@
public boolean removeGroupComputeResourcePolicy(AuthzToken authzToken, String resourcePolicyId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
try {
ComputeResourcePolicy computeResourcePolicy =
- regClient.getGroupComputeResourcePolicy(resourcePolicyId);
+ registryHandler.getGroupComputeResourcePolicy(resourcePolicyId);
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId,
userId + "@" + gatewayId,
computeResourcePolicy.getGroupResourceProfileId(),
@@ -6616,16 +6142,13 @@
"User does not have permission to remove group compute resource policy");
}
}
- boolean result = regClient.removeGroupComputeResourcePolicy(resourcePolicyId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ boolean result = registryHandler.removeGroupComputeResourcePolicy(resourcePolicyId);
return result;
} catch (Exception e) {
String msg = "Error removing group compute resource policy. ResourcePolicyId: " + resourcePolicyId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6635,16 +6158,16 @@
public boolean removeGroupBatchQueueResourcePolicy(AuthzToken authzToken, String resourcePolicyId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
try {
BatchQueueResourcePolicy batchQueueResourcePolicy =
- regClient.getBatchQueueResourcePolicy(resourcePolicyId);
+ registryHandler.getBatchQueueResourcePolicy(resourcePolicyId);
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId,
userId + "@" + gatewayId,
batchQueueResourcePolicy.getGroupResourceProfileId(),
@@ -6657,16 +6180,13 @@
"User does not have permission to remove batch queue resource policy");
}
}
- boolean result = regClient.removeGroupBatchQueueResourcePolicy(resourcePolicyId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ boolean result = registryHandler.removeGroupBatchQueueResourcePolicy(resourcePolicyId);
return result;
} catch (Exception e) {
String msg = "Error removing batch queue resource policy. ResourcePolicyId: " + resourcePolicyId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6677,14 +6197,14 @@
AuthzToken authzToken, String computeResourceId, String groupResourceProfileId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":READ")) {
throw new AuthorizationException(
"User does not have permission to access group resource profile");
@@ -6694,16 +6214,13 @@
}
}
GroupComputeResourcePreference groupComputeResourcePreference =
- regClient.getGroupComputeResourcePreference(computeResourceId, groupResourceProfileId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ registryHandler.getGroupComputeResourcePreference(computeResourceId, groupResourceProfileId);
return groupComputeResourcePreference;
} catch (Exception e) {
String msg = "Error retrieving Group compute preference. GroupResourceProfileId: " + groupResourceProfileId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6713,16 +6230,16 @@
public ComputeResourcePolicy getGroupComputeResourcePolicy(AuthzToken authzToken, String resourcePolicyId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
try {
ComputeResourcePolicy computeResourcePolicy =
- regClient.getGroupComputeResourcePolicy(resourcePolicyId);
+ registryHandler.getGroupComputeResourcePolicy(resourcePolicyId);
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId,
userId + "@" + gatewayId,
computeResourcePolicy.getGroupResourceProfileId(),
@@ -6735,16 +6252,14 @@
}
}
- ComputeResourcePolicy computeResourcePolicy = regClient.getGroupComputeResourcePolicy(resourcePolicyId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ ComputeResourcePolicy computeResourcePolicy =
+ registryHandler.getGroupComputeResourcePolicy(resourcePolicyId);
return computeResourcePolicy;
} catch (Exception e) {
String msg = "Error retrieving Group compute resource policy. ResourcePolicyId: " + resourcePolicyId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6754,16 +6269,16 @@
public BatchQueueResourcePolicy getBatchQueueResourcePolicy(AuthzToken authzToken, String resourcePolicyId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
try {
BatchQueueResourcePolicy batchQueueResourcePolicy =
- regClient.getBatchQueueResourcePolicy(resourcePolicyId);
+ registryHandler.getBatchQueueResourcePolicy(resourcePolicyId);
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId,
userId + "@" + gatewayId,
batchQueueResourcePolicy.getGroupResourceProfileId(),
@@ -6775,16 +6290,14 @@
throw new AuthorizationException("User does not have permission to access group resource profile");
}
}
- BatchQueueResourcePolicy batchQueueResourcePolicy = regClient.getBatchQueueResourcePolicy(resourcePolicyId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ BatchQueueResourcePolicy batchQueueResourcePolicy =
+ registryHandler.getBatchQueueResourcePolicy(resourcePolicyId);
return batchQueueResourcePolicy;
} catch (Exception e) {
String msg = "Error retrieving Group batch queue resource policy. ResourcePolicyId: " + resourcePolicyId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6795,14 +6308,14 @@
AuthzToken authzToken, String groupResourceProfileId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":READ")) {
throw new AuthorizationException(
"User does not have permission to access group resource profile");
@@ -6812,9 +6325,7 @@
}
}
List<GroupComputeResourcePreference> groupComputeResourcePreferenceList =
- regClient.getGroupComputeResourcePrefList(groupResourceProfileId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ registryHandler.getGroupComputeResourcePrefList(groupResourceProfileId);
return groupComputeResourcePreferenceList;
} catch (Exception e) {
String msg = "Error retrieving Group compute resource preference. GroupResourceProfileId: "
@@ -6822,7 +6333,6 @@
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6833,14 +6343,14 @@
AuthzToken authzToken, String groupResourceProfileId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":READ")) {
throw new AuthorizationException(
"User does not have permission to access group resource profile");
@@ -6850,9 +6360,7 @@
}
}
List<BatchQueueResourcePolicy> batchQueueResourcePolicyList =
- regClient.getGroupBatchQueueResourcePolicyList(groupResourceProfileId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ registryHandler.getGroupBatchQueueResourcePolicyList(groupResourceProfileId);
return batchQueueResourcePolicyList;
} catch (Exception e) {
String msg = "Error retrieving Group batch queue resource policy list. GroupResourceProfileId: "
@@ -6860,7 +6368,6 @@
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6871,14 +6378,14 @@
AuthzToken authzToken, String groupResourceProfileId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
- SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
+ // Direct handler call - no client needed
+ // Direct handler call - no client needed
try {
if (ServerSettings.isEnableSharing()) {
try {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
- if (!sharingClient.userHasAccess(
+ if (!sharingHandler.userHasAccess(
gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":READ")) {
throw new AuthorizationException(
"User does not have permission to access group resource profile");
@@ -6888,9 +6395,7 @@
}
}
List<ComputeResourcePolicy> computeResourcePolicyList =
- regClient.getGroupComputeResourcePolicyList(groupResourceProfileId);
- registryClientPool.returnResource(regClient);
- sharingClientPool.returnResource(sharingClient);
+ registryHandler.getGroupComputeResourcePolicyList(groupResourceProfileId);
return computeResourcePolicyList;
} catch (Exception e) {
String msg = "Error retrieving Group compute resource policy list. GroupResourceProfileId: "
@@ -6898,7 +6403,6 @@
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6910,17 +6414,15 @@
TException {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- GatewayGroups gatewayGroups = retrieveGatewayGroups(regClient, gatewayId);
- registryClientPool.returnResource(regClient);
+ GatewayGroups gatewayGroups = retrieveGatewayGroups(registryHandler, gatewayId);
return gatewayGroups;
} catch (Exception e) {
String msg = "Error retrieving GatewayGroups for gateway: " + gatewayId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6930,17 +6432,15 @@
public Parser getParser(AuthzToken authzToken, String parserId, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- Parser parser = regClient.getParser(parserId, gatewayId);
- registryClientPool.returnResource(regClient);
+ Parser parser = registryHandler.getParser(parserId, gatewayId);
return parser;
} catch (Exception e) {
String msg = "Error retrieving parser with id: " + parserId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6950,17 +6450,15 @@
public String saveParser(AuthzToken authzToken, Parser parser)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String parserId = regClient.saveParser(parser);
- registryClientPool.returnResource(regClient);
+ String parserId = registryHandler.saveParser(parser);
return parserId;
} catch (Exception e) {
String msg = "Error while saving the parser";
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6970,17 +6468,15 @@
public List<Parser> listAllParsers(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<Parser> parsers = regClient.listAllParsers(gatewayId);
- registryClientPool.returnResource(regClient);
+ List<Parser> parsers = registryHandler.listAllParsers(gatewayId);
return parsers;
} catch (Exception e) {
String msg = "Error while listing the parsers for gateway " + gatewayId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -6990,17 +6486,15 @@
public boolean removeParser(AuthzToken authzToken, String parserId, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- regClient.removeParser(parserId, gatewayId);
- registryClientPool.returnResource(regClient);
+ registryHandler.removeParser(parserId, gatewayId);
return true;
} catch (Exception e) {
String msg = "Error while removing the parser " + parserId + " in gateway " + gatewayId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -7010,17 +6504,15 @@
public ParsingTemplate getParsingTemplate(AuthzToken authzToken, String templateId, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- ParsingTemplate parsingTemplate = regClient.getParsingTemplate(templateId, gatewayId);
- registryClientPool.returnResource(regClient);
+ ParsingTemplate parsingTemplate = registryHandler.getParsingTemplate(templateId, gatewayId);
return parsingTemplate;
} catch (Exception e) {
String msg = "Error retrieving parsing template with id: " + templateId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -7031,18 +6523,16 @@
AuthzToken authzToken, String experimentId, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
List<ParsingTemplate> parsingTemplates =
- regClient.getParsingTemplatesForExperiment(experimentId, gatewayId);
- registryClientPool.returnResource(regClient);
+ registryHandler.getParsingTemplatesForExperiment(experimentId, gatewayId);
return parsingTemplates;
} catch (Exception e) {
String msg = "Error retrieving parsing templates for experiment: " + experimentId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -7052,17 +6542,15 @@
public String saveParsingTemplate(AuthzToken authzToken, ParsingTemplate parsingTemplate)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- String templateId = regClient.saveParsingTemplate(parsingTemplate);
- registryClientPool.returnResource(regClient);
+ String templateId = registryHandler.saveParsingTemplate(parsingTemplate);
return templateId;
} catch (Exception e) {
String msg = "Error saving the parsing template";
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -7072,17 +6560,15 @@
public boolean removeParsingTemplate(AuthzToken authzToken, String templateId, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- regClient.removeParsingTemplate(templateId, gatewayId);
- registryClientPool.returnResource(regClient);
+ registryHandler.removeParsingTemplate(templateId, gatewayId);
return true;
} catch (Exception e) {
String msg = "Error while removing the parsing template " + templateId + " in gateway " + gatewayId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -7092,17 +6578,15 @@
public List<ParsingTemplate> listAllParsingTemplates(AuthzToken authzToken, String gatewayId)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
TException {
- RegistryService.Client regClient = registryClientPool.getResource();
+ // Direct handler call - no client needed
try {
- List<ParsingTemplate> templates = regClient.listAllParsingTemplates(gatewayId);
- registryClientPool.returnResource(regClient);
+ List<ParsingTemplate> templates = registryHandler.listAllParsingTemplates(gatewayId);
return templates;
} catch (Exception e) {
String msg = "Error while listing the parsing templates for gateway " + gatewayId;
logger.error(msg, e);
AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage(msg + " More info : " + e.getMessage());
- registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
@@ -7141,24 +6625,24 @@
}
private void shareEntityWithAdminGatewayGroups(
- RegistryService.Client regClient, SharingRegistryService.Client sharingClient, Entity entity)
+ RegistryServerHandler registryHandler, SharingRegistryServerHandler sharingHandler, Entity entity)
throws TException {
final String domainId = entity.getDomainId();
- GatewayGroups gatewayGroups = retrieveGatewayGroups(regClient, domainId);
- createManageSharingPermissionTypeIfMissing(sharingClient, domainId);
- sharingClient.shareEntityWithGroups(
+ GatewayGroups gatewayGroups = retrieveGatewayGroups(registryHandler, domainId);
+ createManageSharingPermissionTypeIfMissing(sharingHandler, domainId);
+ sharingHandler.shareEntityWithGroups(
domainId,
entity.getEntityId(),
Arrays.asList(gatewayGroups.getAdminsGroupId()),
domainId + ":MANAGE_SHARING",
true);
- sharingClient.shareEntityWithGroups(
+ sharingHandler.shareEntityWithGroups(
domainId,
entity.getEntityId(),
Arrays.asList(gatewayGroups.getAdminsGroupId()),
domainId + ":WRITE",
true);
- sharingClient.shareEntityWithGroups(
+ sharingHandler.shareEntityWithGroups(
domainId,
entity.getEntityId(),
Arrays.asList(gatewayGroups.getAdminsGroupId(), gatewayGroups.getReadOnlyAdminsGroupId()),
@@ -7167,27 +6651,27 @@
}
private boolean userHasAccessInternal(
- SharingRegistryService.Client sharingClient,
+ SharingRegistryServerHandler sharingHandler,
AuthzToken authzToken,
String entityId,
ResourcePermissionType permissionType) {
final String domainId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
final String userId = authzToken.getClaimsMap().get(Constants.USER_NAME) + "@" + domainId;
try {
- final boolean hasOwnerAccess = sharingClient.userHasAccess(
+ final boolean hasOwnerAccess = sharingHandler.userHasAccess(
domainId, userId, entityId, domainId + ":" + ResourcePermissionType.OWNER);
boolean hasAccess = false;
if (permissionType.equals(ResourcePermissionType.WRITE)) {
hasAccess = hasOwnerAccess
- || sharingClient.userHasAccess(
+ || sharingHandler.userHasAccess(
domainId, userId, entityId, domainId + ":" + ResourcePermissionType.WRITE);
} else if (permissionType.equals(ResourcePermissionType.READ)) {
hasAccess = hasOwnerAccess
- || sharingClient.userHasAccess(
+ || sharingHandler.userHasAccess(
domainId, userId, entityId, domainId + ":" + ResourcePermissionType.READ);
} else if (permissionType.equals(ResourcePermissionType.MANAGE_SHARING)) {
hasAccess = hasOwnerAccess
- || sharingClient.userHasAccess(
+ || sharingHandler.userHasAccess(
domainId, userId, entityId, domainId + ":" + ResourcePermissionType.MANAGE_SHARING);
} else if (permissionType.equals(ResourcePermissionType.OWNER)) {
hasAccess = hasOwnerAccess;
@@ -7198,9 +6682,9 @@
}
}
- private ResourceType getResourceType(SharingRegistryService.Client sharingClient, String domainId, String entityId)
+ private ResourceType getResourceType(SharingRegistryServerHandler sharingHandler, String domainId, String entityId)
throws TException {
- Entity entity = sharingClient.getEntity(domainId, entityId);
+ Entity entity = sharingHandler.getEntity(domainId, entityId);
for (ResourceType resourceType : ResourceType.values()) {
if (entity.getEntityTypeId().equals(domainId + ":" + resourceType.name())) {
return resourceType;
@@ -7210,24 +6694,25 @@
}
private void createManageSharingPermissionTypeIfMissing(
- SharingRegistryService.Client sharingClient, String domainId) throws TException {
+ SharingRegistryServerHandler sharingHandler, String domainId) throws TException {
// AIRAVATA-3297 Some gateways were created without the MANAGE_SHARING permission, so add it if missing
String permissionTypeId = domainId + ":MANAGE_SHARING";
- if (!sharingClient.isPermissionExists(domainId, permissionTypeId)) {
+ if (!sharingHandler.isPermissionExists(domainId, permissionTypeId)) {
PermissionType permissionType = new PermissionType();
permissionType.setPermissionTypeId(permissionTypeId);
permissionType.setDomainId(domainId);
permissionType.setName("MANAGE_SHARING");
permissionType.setDescription("Manage sharing permission type");
- sharingClient.createPermissionType(permissionType);
+ sharingHandler.createPermissionType(permissionType);
logger.info("Created MANAGE_SHARING permission type for domain " + domainId);
}
}
- private GatewayGroups retrieveGatewayGroups(RegistryService.Client regClient, String gatewayId) throws TException {
+ private GatewayGroups retrieveGatewayGroups(RegistryServerHandler registryHandler, String gatewayId)
+ throws TException {
- if (regClient.isGatewayGroupsExists(gatewayId)) {
- return regClient.getGatewayGroups(gatewayId);
+ if (registryHandler.isGatewayGroupsExists(gatewayId)) {
+ return registryHandler.getGatewayGroups(gatewayId);
} else {
return GatewayGroupsInitializer.initializeGatewayGroups(gatewayId);
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java b/airavata-api/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index e00a9d1..6d45910 100644
--- a/airavata-api/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ b/airavata-api/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -60,10 +60,8 @@
import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
import org.apache.airavata.orchestrator.util.OrchestratorServerThreadPoolExecutor;
import org.apache.airavata.orchestrator.util.OrchestratorUtils;
-import org.apache.airavata.registry.api.RegistryService;
-import org.apache.airavata.registry.api.RegistryService.Client;
-import org.apache.airavata.registry.api.client.RegistryServiceClientFactory;
import org.apache.airavata.registry.api.exception.RegistryServiceException;
+import org.apache.airavata.registry.api.service.handler.RegistryServerHandler;
import org.apache.commons.lang3.StringUtils;
import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
@@ -83,11 +81,14 @@
private String airavataUserName;
private String gatewayName;
private Publisher publisher;
- private final Subscriber statusSubscribe;
- private final Subscriber experimentSubscriber;
+ private Subscriber statusSubscribe;
+ private Subscriber experimentSubscriber;
private CuratorFramework curatorClient;
+ // Direct handler dependency (for unified service)
+ private RegistryServerHandler registryHandler;
+
/**
* Query orchestrator server to fetch the CPI version
*/
@@ -96,7 +97,18 @@
return null;
}
+ // Constructor for unified service with direct handler dependencies
+ public OrchestratorServerHandler(RegistryServerHandler registryHandler) throws OrchestratorException, TException {
+ this.registryHandler = registryHandler;
+ initializeOrchestrator();
+ }
+
+ // Legacy constructor for backward compatibility
public OrchestratorServerHandler() throws OrchestratorException, TException {
+ initializeOrchestrator();
+ }
+
+ private void initializeOrchestrator() throws OrchestratorException, TException {
// orchestrator init
try {
// first constructing the monitorManager and orchestrator, then fill
@@ -140,7 +152,6 @@
*/
public boolean launchExperiment(String experimentId, String gatewayId) throws TException {
ExperimentModel experiment = null;
- final RegistryService.Client registryClient = getRegistryServiceClient();
try {
// TODO deprecate this approach as we are replacing gfac
String experimentNodePath = getExperimentNodePath(experimentId);
@@ -148,7 +159,7 @@
String experimentCancelNode =
ZKPaths.makePath(experimentNodePath, ZkConstants.ZOOKEEPER_CANCEL_LISTENER_NODE);
ZKPaths.mkdirs(curatorClient.getZookeeperClient().getZooKeeper(), experimentCancelNode);
- experiment = registryClient.getExperiment(experimentId);
+ experiment = registryHandler.getExperiment(experimentId);
if (experiment == null) {
throw new Exception("Error retrieving the Experiment by the given experimentID: " + experimentId);
}
@@ -165,7 +176,7 @@
.getComputationalResourceScheduling()
.isSet(ComputationalResourceSchedulingModel._Fields.RESOURCE_HOST_ID)) {
GroupComputeResourcePreference groupComputeResourcePreference =
- registryClient.getGroupComputeResourcePreference(
+ registryHandler.getGroupComputeResourcePreference(
userConfigurationData
.getComputationalResourceScheduling()
.getResourceHostId(),
@@ -178,7 +189,7 @@
if (token == null || token.isEmpty()) {
// try with group resource profile level token
GroupResourceProfile groupResourceProfile =
- registryClient.getGroupResourceProfile(groupResourceProfileId);
+ registryHandler.getGroupResourceProfile(groupResourceProfileId);
token = groupResourceProfile.getDefaultCredentialStoreToken();
}
// still the token is empty, then we fail the experiment
@@ -201,7 +212,7 @@
&& pi.getValue() != null
&& pi.getValue().startsWith("airavata-dp://")) {
try {
- DataProductModel dataProductModel = registryClient.getDataProduct(pi.getValue());
+ DataProductModel dataProductModel = registryHandler.getDataProduct(pi.getValue());
Optional<DataReplicaLocationModel> rpLocation =
dataProductModel.getReplicaLocations().stream()
.filter(rpModel -> rpModel.getReplicaLocationCategory()
@@ -226,7 +237,7 @@
final ArrayList<String> filePathList = new ArrayList<>();
for (String uri : uriList) {
if (uri.startsWith("airavata-dp://")) {
- DataProductModel dataProductModel = registryClient.getDataProduct(uri);
+ DataProductModel dataProductModel = registryHandler.getDataProduct(uri);
Optional<DataReplicaLocationModel> rpLocation =
dataProductModel.getReplicaLocations().stream()
.filter(rpModel -> rpModel.getReplicaLocationCategory()
@@ -255,7 +266,7 @@
String taskDag = orchestrator.createAndSaveTasks(gatewayId, processModel);
processModel.setTaskDag(taskDag);
}
- registryClient.updateProcess(processModel, processModel.getProcessId());
+ registryHandler.updateProcess(processModel, processModel.getProcessId());
}
if (!experiment.getUserConfigurationData().isAiravataAutoSchedule()
@@ -266,7 +277,7 @@
ProcessScheduler scheduler = new ProcessSchedulerImpl();
if (!experiment.getUserConfigurationData().isAiravataAutoSchedule()
|| scheduler.canLaunch(experimentId)) {
- createAndValidateTasks(experiment, registryClient, false);
+ createAndValidateTasks(experiment, false);
runExperimentLauncher(experimentId, gatewayId, token);
} else {
log.debug(experimentId, "Queuing single application experiment {}.", experimentId);
@@ -306,9 +317,6 @@
OrchestratorUtils.updateAndPublishExperimentStatus(experimentId, status, publisher, gatewayId);
throw new TException("Experiment '" + experimentId + "' launch failed.", e);
} finally {
- if (registryClient != null) {
- ThriftUtils.close(registryClient);
- }
}
return true;
}
@@ -323,26 +331,21 @@
* @throws TException
*/
public boolean validateExperiment(String experimentId) throws TException, LaunchValidationException {
- final RegistryService.Client registryClient = getRegistryServiceClient();
try {
- ExperimentModel experimentModel = registryClient.getExperiment(experimentId);
+ ExperimentModel experimentModel = registryHandler.getExperiment(experimentId);
return orchestrator.validateExperiment(experimentModel).isValidationState();
} catch (OrchestratorException e) {
log.error(experimentId, "Error while validating experiment", e);
throw new TException(e);
} finally {
- if (registryClient != null) {
- ThriftUtils.close(registryClient);
- }
}
}
@Override
public boolean validateProcess(String experimentId, List<ProcessModel> processes)
throws LaunchValidationException, TException {
- final RegistryService.Client registryClient = getRegistryServiceClient();
try {
- ExperimentModel experimentModel = registryClient.getExperiment(experimentId);
+ ExperimentModel experimentModel = registryHandler.getExperiment(experimentId);
for (ProcessModel processModel : processes) {
boolean state = orchestrator
.validateProcess(experimentModel, processModel)
@@ -358,15 +361,12 @@
ErrorModel details = new ErrorModel();
details.setActualErrorMessage(lve.getErrorMessage());
details.setCreationTime(Calendar.getInstance().getTimeInMillis());
- registryClient.addErrors(OrchestratorConstants.EXPERIMENT_ERROR, details, experimentId);
+ registryHandler.addErrors(OrchestratorConstants.EXPERIMENT_ERROR, details, experimentId);
throw lve;
} catch (OrchestratorException e) {
log.error(experimentId, "Error while validating process", e);
throw new TException(e);
} finally {
- if (registryClient != null) {
- ThriftUtils.close(registryClient);
- }
}
}
@@ -379,42 +379,34 @@
* @throws TException
*/
public boolean terminateExperiment(String experimentId, String gatewayId) throws TException {
- final RegistryService.Client registryClient = getRegistryServiceClient();
log.info(experimentId, "Experiment: {} is cancelling !!!!!", experimentId);
try {
- return validateStatesAndCancel(registryClient, experimentId, gatewayId);
+ return validateStatesAndCancel(experimentId, gatewayId);
} catch (Exception e) {
log.error("expId : " + experimentId + " :- Error while cancelling experiment", e);
return false;
} finally {
- if (registryClient != null) {
- ThriftUtils.close(registryClient);
- }
}
}
public void fetchIntermediateOutputs(String experimentId, String gatewayId, List<String> outputNames)
throws TException {
- final RegistryService.Client registryClient = getRegistryServiceClient();
try {
- submitIntermediateOutputsProcess(registryClient, experimentId, gatewayId, outputNames);
+ submitIntermediateOutputsProcess(experimentId, gatewayId, outputNames);
} catch (Exception e) {
log.error("expId : " + experimentId + " :- Error while fetching intermediate", e);
} finally {
- if (registryClient != null) {
- ThriftUtils.close(registryClient);
- }
}
}
- private void submitIntermediateOutputsProcess(
- Client registryClient, String experimentId, String gatewayId, List<String> outputNames) throws Exception {
+ private void submitIntermediateOutputsProcess(String experimentId, String gatewayId, List<String> outputNames)
+ throws Exception {
- ExperimentModel experimentModel = registryClient.getExperiment(experimentId);
+ ExperimentModel experimentModel = registryHandler.getExperiment(experimentId);
ProcessModel processModel = ExperimentModelUtil.cloneProcessFromExperiment(experimentModel);
processModel.setExperimentDataDir(processModel.getExperimentDataDir() + "/intermediates");
- List<OutputDataObjectType> applicationOutputs = registryClient.getApplicationOutputs(
+ List<OutputDataObjectType> applicationOutputs = registryHandler.getApplicationOutputs(
experimentModel.getExecutionId()); // This is to get a clean output object set
List<OutputDataObjectType> requestedOutputs = new ArrayList<>();
@@ -424,7 +416,7 @@
}
}
processModel.setProcessOutputs(requestedOutputs);
- String processId = registryClient.addProcess(processModel, experimentId);
+ String processId = registryHandler.addProcess(processModel, experimentId);
processModel.setProcessId(processId);
try {
@@ -442,7 +434,7 @@
gatewayId, processModel, jobSubmissionProcess.get());
processModel.setTaskDag(taskDag);
- registryClient.updateProcess(processModel, processModel.getProcessId());
+ registryHandler.updateProcess(processModel, processModel.getProcessId());
// Figure out the credential token
UserConfigurationDataModel userConfigurationData = experimentModel.getUserConfigurationData();
@@ -452,7 +444,7 @@
throw new Exception("Experiment not configured with a Group Resource Profile: " + experimentId);
}
GroupComputeResourcePreference groupComputeResourcePreference =
- registryClient.getGroupComputeResourcePreference(
+ registryHandler.getGroupComputeResourcePreference(
userConfigurationData
.getComputationalResourceScheduling()
.getResourceHostId(),
@@ -463,7 +455,7 @@
if (token == null || token.isEmpty()) {
// try with group resource profile level token
GroupResourceProfile groupResourceProfile =
- registryClient.getGroupResourceProfile(groupResourceProfileId);
+ registryHandler.getGroupResourceProfile(groupResourceProfileId);
token = groupResourceProfile.getDefaultCredentialStoreToken();
}
// still the token is empty, then we fail the experiment
@@ -480,7 +472,7 @@
ProcessStatus status = new ProcessStatus(ProcessState.FAILED);
status.setReason("Intermediate output fetching process failed to launch: " + e.getMessage());
status.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
- registryClient.addProcessStatus(status, processId);
+ registryHandler.addProcessStatus(status, processId);
throw e;
}
@@ -504,15 +496,14 @@
@Override
public boolean launchProcess(String processId, String airavataCredStoreToken, String gatewayId) throws TException {
- final RegistryService.Client registryClient = getRegistryServiceClient();
try {
- ProcessStatus processStatus = registryClient.getProcessStatus(processId);
+ ProcessStatus processStatus = registryHandler.getProcessStatus(processId);
switch (processStatus.getState()) {
case CREATED:
case VALIDATED:
case DEQUEUING:
- ProcessModel processModel = registryClient.getProcess(processId);
+ ProcessModel processModel = registryHandler.getProcess(processId);
String applicationId = processModel.getApplicationInterfaceId();
if (applicationId == null) {
log.error(processId, "Application interface id shouldn't be null.");
@@ -521,7 +512,7 @@
}
// set application deployment id to process model
ApplicationDeploymentDescription applicationDeploymentDescription =
- getAppDeployment(registryClient, processModel, applicationId);
+ getAppDeployment(processModel, applicationId);
if (applicationDeploymentDescription == null) {
log.error("Could not find an application deployment for " + processModel.getComputeResourceId()
+ " and application " + applicationId);
@@ -533,7 +524,7 @@
// host id
processModel.setComputeResourceId(
processModel.getProcessResourceSchedule().getResourceHostId());
- registryClient.updateProcess(processModel, processModel.getProcessId());
+ registryHandler.updateProcess(processModel, processModel.getProcessId());
return orchestrator.launchProcess(processModel, airavataCredStoreToken);
default:
@@ -545,34 +536,30 @@
log.error(processId, "Error while launching process ", e);
throw new TException(e);
} finally {
- if (registryClient != null) {
- ThriftUtils.close(registryClient);
- }
}
}
- private ApplicationDeploymentDescription getAppDeployment(
- RegistryService.Client registryClient, ProcessModel processModel, String applicationId)
+ private ApplicationDeploymentDescription getAppDeployment(ProcessModel processModel, String applicationId)
throws OrchestratorException, ClassNotFoundException, ApplicationSettingsException, InstantiationException,
IllegalAccessException, TException {
- String selectedModuleId = getModuleId(registryClient, applicationId);
- return getAppDeploymentForModule(registryClient, processModel, selectedModuleId);
+ String selectedModuleId = getModuleId(applicationId);
+ return getAppDeploymentForModule(processModel, selectedModuleId);
}
private ApplicationDeploymentDescription getAppDeploymentForModule(
- RegistryService.Client registryClient, ProcessModel processModel, String selectedModuleId)
+ ProcessModel processModel, String selectedModuleId)
throws ClassNotFoundException, ApplicationSettingsException, InstantiationException, IllegalAccessException,
TException {
List<ApplicationDeploymentDescription> applicationDeployements =
- registryClient.getApplicationDeployments(selectedModuleId);
+ registryHandler.getApplicationDeployments(selectedModuleId);
Map<ComputeResourceDescription, ApplicationDeploymentDescription> deploymentMap =
new HashMap<ComputeResourceDescription, ApplicationDeploymentDescription>();
for (ApplicationDeploymentDescription deploymentDescription : applicationDeployements) {
if (processModel.getComputeResourceId().equals(deploymentDescription.getComputeHostId())) {
deploymentMap.put(
- registryClient.getComputeResource(deploymentDescription.getComputeHostId()),
+ registryHandler.getComputeResource(deploymentDescription.getComputeHostId()),
deploymentDescription);
}
}
@@ -585,9 +572,8 @@
return deploymentMap.get(ComputeResourceDescription);
}
- private String getModuleId(RegistryService.Client registryClient, String applicationId)
- throws OrchestratorException, TException {
- ApplicationInterfaceDescription applicationInterface = registryClient.getApplicationInterface(applicationId);
+ private String getModuleId(String applicationId) throws OrchestratorException, TException {
+ ApplicationInterfaceDescription applicationInterface = registryHandler.getApplicationInterface(applicationId);
List<String> applicationModules = applicationInterface.getApplicationModules();
if (applicationModules.size() == 0) {
throw new OrchestratorException("No modules defined for application " + applicationId);
@@ -597,9 +583,8 @@
return selectedModuleId;
}
- private boolean validateStatesAndCancel(
- RegistryService.Client registryClient, String experimentId, String gatewayId) throws Exception {
- ExperimentStatus experimentStatus = registryClient.getExperimentStatus(experimentId);
+ private boolean validateStatesAndCancel(String experimentId, String gatewayId) throws Exception {
+ ExperimentStatus experimentStatus = registryHandler.getExperimentStatus(experimentId);
switch (experimentStatus.getState()) {
case COMPLETED:
case CANCELED:
@@ -613,12 +598,12 @@
log.warn("Experiment termination is only allowed for launched experiments.");
return false;
default:
- ExperimentModel experimentModel = registryClient.getExperiment(experimentId);
+ ExperimentModel experimentModel = registryHandler.getExperiment(experimentId);
final UserConfigurationDataModel userConfigurationData = experimentModel.getUserConfigurationData();
final String groupResourceProfileId = userConfigurationData.getGroupResourceProfileId();
GroupComputeResourcePreference groupComputeResourcePreference =
- registryClient.getGroupComputeResourcePreference(
+ registryHandler.getGroupComputeResourcePreference(
userConfigurationData
.getComputationalResourceScheduling()
.getResourceHostId(),
@@ -627,7 +612,7 @@
if (token == null || token.isEmpty()) {
// try with group resource profile level token
GroupResourceProfile groupResourceProfile =
- registryClient.getGroupResourceProfile(groupResourceProfileId);
+ registryHandler.getGroupResourceProfile(groupResourceProfileId);
token = groupResourceProfile.getDefaultCredentialStoreToken();
}
// still the token is empty, then we fail the experiment
@@ -697,9 +682,8 @@
}
private boolean launchSingleAppExperiment() throws TException, AiravataException {
- final RegistryService.Client registryClient = getRegistryServiceClient();
try {
- List<String> processIds = registryClient.getProcessIds(experimentId);
+ List<String> processIds = registryHandler.getProcessIds(experimentId);
for (String processId : processIds) {
launchProcess(processId, airavataCredStoreToken, gatewayId);
}
@@ -725,9 +709,6 @@
publisher.publish(messageContext);
throw new TException(e);
} finally {
- if (registryClient != null) {
- ThriftUtils.close(registryClient);
- }
}
return true;
}
@@ -838,9 +819,8 @@
status.setState(ExperimentState.SCHEDULED);
status.setReason("Job submission failed, requeued to resubmit");
List<QueueStatusModel> queueStatusModels = new ArrayList<>();
- final RegistryService.Client registryClient = getRegistryServiceClient();
ExperimentModel experimentModel =
- registryClient.getExperiment(processIdentity.getExperimentId());
+ registryHandler.getExperiment(processIdentity.getExperimentId());
UserConfigurationDataModel userConfigurationDataModel =
experimentModel.getUserConfigurationData();
if (userConfigurationDataModel != null) {
@@ -850,7 +830,7 @@
String queueName = computationalResourceSchedulingModel.getQueueName();
String resourceId = computationalResourceSchedulingModel.getResourceHostId();
ComputeResourceDescription comResourceDes =
- registryClient.getComputeResource(resourceId);
+ registryHandler.getComputeResource(resourceId);
QueueStatusModel queueStatusModel = new QueueStatusModel();
queueStatusModel.setHostName(comResourceDes.getHostName());
queueStatusModel.setQueueName(queueName);
@@ -859,7 +839,7 @@
queueStatusModel.setQueuedJobs(0);
queueStatusModel.setTime(System.currentTimeMillis());
queueStatusModels.add(queueStatusModel);
- registryClient.registerQueueStatuses(queueStatusModels);
+ registryHandler.registerQueueStatuses(queueStatusModels);
}
}
@@ -966,7 +946,6 @@
private void launchExperiment(MessageContext messageContext) {
ExperimentSubmitEvent expEvent = new ExperimentSubmitEvent();
- final RegistryService.Client registryClient = getRegistryServiceClient();
try {
byte[] bytes = ThriftUtils.serializeThriftObject(messageContext.getEvent());
ThriftUtils.createThriftFromBytes(bytes, expEvent);
@@ -976,7 +955,7 @@
expEvent.getExperimentId(),
expEvent.getGatewayId());
if (messageContext.isRedeliver()) {
- ExperimentModel experimentModel = registryClient.getExperiment(expEvent.getExperimentId());
+ ExperimentModel experimentModel = registryHandler.getExperiment(expEvent.getExperimentId());
MDC.put(MDCConstants.EXPERIMENT_NAME, experimentModel.getExperimentName());
if (experimentModel.getExperimentStatus().get(0).getState() == ExperimentState.CREATED) {
launchExperiment(expEvent.getExperimentId(), expEvent.getGatewayId());
@@ -1001,21 +980,10 @@
} finally {
experimentSubscriber.sendAck(messageContext.getDeliveryTag());
MDC.clear();
- if (registryClient != null) {
- ThriftUtils.close(registryClient);
- }
}
}
- private RegistryService.Client getRegistryServiceClient() {
- try {
- final int serverPort = Integer.parseInt(ServerSettings.getRegistryServerPort());
- final String serverHost = ServerSettings.getRegistryServerHost();
- return RegistryServiceClientFactory.createRegistryClient(serverHost, serverPort);
- } catch (RegistryServiceException | ApplicationSettingsException e) {
- throw new RuntimeException("Unable to create registry client...", e);
- }
- }
+ // Registry client method removed - use registryHandler directly
private void startCurator() throws ApplicationSettingsException {
String connectionSting = ServerSettings.getZookeeperConnection();
@@ -1040,9 +1008,8 @@
private void launchQueuedExperiment(String experimentId) throws TException, Exception {
ExperimentModel experiment = null;
- final RegistryService.Client registryClient = getRegistryServiceClient();
// TODO deprecate this approach as we are replacing gfac
- experiment = registryClient.getExperiment(experimentId);
+ experiment = registryHandler.getExperiment(experimentId);
if (experiment == null) {
throw new Exception("Error retrieving the Experiment by the given experimentID: " + experimentId);
}
@@ -1054,7 +1021,7 @@
throw new Exception("Experiment not configured with a Group Resource Profile: " + experimentId);
}
GroupComputeResourcePreference groupComputeResourcePreference =
- registryClient.getGroupComputeResourcePreference(
+ registryHandler.getGroupComputeResourcePreference(
userConfigurationData
.getComputationalResourceScheduling()
.getResourceHostId(),
@@ -1064,7 +1031,7 @@
}
if (token == null || token.isEmpty()) {
// try with group resource profile level token
- GroupResourceProfile groupResourceProfile = registryClient.getGroupResourceProfile(groupResourceProfileId);
+ GroupResourceProfile groupResourceProfile = registryHandler.getGroupResourceProfile(groupResourceProfileId);
token = groupResourceProfile.getDefaultCredentialStoreToken();
}
// still the token is empty, then we fail the experiment
@@ -1073,21 +1040,19 @@
"You have not configured credential store token at group resource profile or compute resource preference."
+ " Please provide the correct token at group resource profile or compute resource preference.");
}
- createAndValidateTasks(experiment, registryClient, true);
+ createAndValidateTasks(experiment, true);
runExperimentLauncher(experimentId, experiment.getGatewayId(), token);
}
- private void createAndValidateTasks(
- ExperimentModel experiment, RegistryService.Client registryClient, boolean recreateTaskDag)
- throws Exception {
+ private void createAndValidateTasks(ExperimentModel experiment, boolean recreateTaskDag) throws Exception {
if (experiment.getUserConfigurationData().isAiravataAutoSchedule()) {
- List<ProcessModel> processModels = registryClient.getProcessList(experiment.getExperimentId());
+ List<ProcessModel> processModels = registryHandler.getProcessList(experiment.getExperimentId());
for (ProcessModel processModel : processModels) {
if (processModel.getTaskDag() == null || recreateTaskDag) {
- registryClient.deleteTasks(processModel.getProcessId());
+ registryHandler.deleteTasks(processModel.getProcessId());
String taskDag = orchestrator.createAndSaveTasks(experiment.getGatewayId(), processModel);
processModel.setTaskDag(taskDag);
- registryClient.updateProcess(processModel, processModel.getProcessId());
+ registryHandler.updateProcess(processModel, processModel.getProcessId());
}
}
if (!validateProcess(experiment.getExperimentId(), processModels)) {
diff --git a/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java b/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java
index 701d5e4..50c004d 100644
--- a/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java
+++ b/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java
@@ -53,6 +53,7 @@
private static final String API_ORCH = "api-orch";
private static final String EXECUTION = "execution";
// server names
+ private static final String ALL_IN_ONE_CLASS = "airavata_service.class";
private static final String API_SERVER = "apiserver.class";
private static final String CREDENTIAL_STORE = "credential.store.class";
private static final String REGISTRY_SERVER = "regserver";
@@ -109,13 +110,7 @@
if (serverList.indexOf(ALL_IN_ONE) > -1) {
serverList.clear();
serverList.add(DB_EVENT_MANAGER); // DB Event Manager should start before everything
- serverList.add(REGISTRY_SERVER); // registry server should start before everything else
- serverList.add(CREDENTIAL_STORE); // credential store should start before api server
- serverList.add(SHARING_SERVER);
- serverList.add(API_SERVER);
- serverList.add(ORCHESTRATOR);
- serverList.add(GFAC_SERVER);
- serverList.add(PROFILE_SERVICE);
+ serverList.add(ALL_IN_ONE_CLASS);
} else if (serverList.indexOf(API_ORCH) > -1) {
serverList.clear();
serverList.add(DB_EVENT_MANAGER); // DB Event Manager should start before everything
diff --git a/airavata-api/src/main/java/org/apache/airavata/service/airavata/AiravataServiceServer.java b/airavata-api/src/main/java/org/apache/airavata/service/airavata/AiravataServiceServer.java
new file mode 100644
index 0000000..0bb6926
--- /dev/null
+++ b/airavata-api/src/main/java/org/apache/airavata/service/airavata/AiravataServiceServer.java
@@ -0,0 +1,246 @@
+/**
+*
+* 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.service.airavata;
+
+import java.net.InetSocketAddress;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.airavata.api.Airavata;
+import org.apache.airavata.api.server.handler.AiravataServerHandler;
+import org.apache.airavata.common.utils.*;
+import org.apache.airavata.credential.store.cpi.CredentialStoreService;
+import org.apache.airavata.credential.store.server.CredentialStoreServerHandler;
+import org.apache.airavata.orchestrator.cpi.OrchestratorService;
+import org.apache.airavata.orchestrator.server.OrchestratorServerHandler;
+import org.apache.airavata.registry.api.RegistryService;
+import org.apache.airavata.registry.api.service.handler.RegistryServerHandler;
+import org.apache.airavata.registry.core.utils.AppCatalogDBInitConfig;
+import org.apache.airavata.registry.core.utils.ExpCatalogDBInitConfig;
+import org.apache.airavata.registry.core.utils.ReplicaCatalogDBInitConfig;
+import org.apache.airavata.registry.core.utils.WorkflowCatalogDBInitConfig;
+import org.apache.airavata.service.profile.groupmanager.cpi.GroupManagerService;
+import org.apache.airavata.service.profile.handlers.*;
+import org.apache.airavata.service.profile.iam.admin.services.cpi.IamAdminServices;
+import org.apache.airavata.service.profile.tenant.cpi.TenantProfileService;
+import org.apache.airavata.service.profile.user.core.utils.UserProfileCatalogDBInitConfig;
+import org.apache.airavata.service.profile.user.cpi.UserProfileService;
+import org.apache.airavata.sharing.registry.db.utils.SharingRegistryDBInitConfig;
+import org.apache.airavata.sharing.registry.server.SharingRegistryServerHandler;
+// import org.apache.airavata.api.workflow.Workflow;
+// import org.apache.airavata.api.workflow.WorkflowHandler;
+import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
+import org.apache.thrift.TMultiplexedProcessor;
+import org.apache.thrift.server.TServer;
+import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TServerTransport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * AiravataServiceServer combines all Airavata services into a single multiplexed server.
+ * This server hosts all 10 services on a single port using TMultiplexedProcessor.
+ */
+public class AiravataServiceServer implements IServer {
+ private static final Logger logger = LoggerFactory.getLogger(AiravataServiceServer.class);
+
+ private static final String SERVER_NAME = "Airavata Service Server";
+ private static final String SERVER_VERSION = "1.0";
+
+ private ServerStatus status;
+ private TServer server;
+
+ // Database initialization configs for all services
+ private List<DBInitConfig> dbInitConfigs = Arrays.asList(
+ new ExpCatalogDBInitConfig(),
+ new AppCatalogDBInitConfig(),
+ new ReplicaCatalogDBInitConfig(),
+ new WorkflowCatalogDBInitConfig(),
+ new UserProfileCatalogDBInitConfig(),
+ new SharingRegistryDBInitConfig());
+
+ public AiravataServiceServer() {
+ setStatus(ServerStatus.STOPPED);
+ }
+
+ @Override
+ public void start() throws Exception {
+ try {
+ setStatus(ServerStatus.STARTING);
+
+ logger.info("Initializing Airavata service databases...");
+ for (DBInitConfig dbInitConfig : dbInitConfigs) {
+ DBInitializer.initializeDB(dbInitConfig);
+ }
+ logger.info("Airavata service databases initialized successfully");
+
+ final int serverPort = Integer.parseInt(ServerSettings.getSetting("airavata.service.port", "9930"));
+ final String serverHost = ServerSettings.getSetting("airavata.service.host", "0.0.0.0");
+
+ // Create handler instances in dependency order
+ var registryHandler = new RegistryServerHandler();
+ var credentialStoreHandler = new CredentialStoreServerHandler();
+ var sharingHandler = new SharingRegistryServerHandler();
+ var orchestratorHandler = new OrchestratorServerHandler(registryHandler);
+ var userProfileHandler = new UserProfileServiceHandler();
+ var tenantProfileHandler = new TenantProfileServiceHandler(credentialStoreHandler);
+ var iamAdminHandler = new IamAdminServicesHandler(registryHandler, credentialStoreHandler);
+ var groupManagerHandler = new GroupManagerServiceHandler(sharingHandler);
+
+ // Create AiravataServerHandler with injected dependencies
+ var airavataHandler = new AiravataServerHandler(registryHandler, sharingHandler, credentialStoreHandler);
+
+ // Create all service processors
+ var airavataProcessor = new Airavata.Processor<>(airavataHandler);
+ var registryProcessor = new RegistryService.Processor<>(registryHandler);
+ var credentialStoreProcessor = new CredentialStoreService.Processor<>(credentialStoreHandler);
+ var sharingRegistryProcessor = new SharingRegistryService.Processor<>(sharingHandler);
+ var orchestratorProcessor = new OrchestratorService.Processor<>(orchestratorHandler);
+ // TODO: Uncomment when WorkflowModel thrift stubs are generated
+ // var workflowProcessor = new Workflow.Processor<>(new WorkflowHandler());
+ var userProfileProcessor = new UserProfileService.Processor<>(userProfileHandler);
+ var tenantProfileProcessor = new TenantProfileService.Processor<>(tenantProfileHandler);
+ var iamAdminServicesProcessor = new IamAdminServices.Processor<>(iamAdminHandler);
+ var groupManagerProcessor = new GroupManagerService.Processor<>(groupManagerHandler);
+
+ // Create multiplexed processor
+ TMultiplexedProcessor airavataServiceProcessor = new TMultiplexedProcessor();
+
+ // Register all processors with their service names
+ airavataServiceProcessor.registerProcessor("Airavata", airavataProcessor);
+ airavataServiceProcessor.registerProcessor("RegistryService", registryProcessor);
+ airavataServiceProcessor.registerProcessor("CredentialStoreService", credentialStoreProcessor);
+ airavataServiceProcessor.registerProcessor("SharingRegistryService", sharingRegistryProcessor);
+ airavataServiceProcessor.registerProcessor("OrchestratorService", orchestratorProcessor);
+ // TODO: Uncomment when WorkflowModel thrift stubs are generated
+ // airavataServiceProcessor.registerProcessor("Workflow", workflowProcessor);
+ airavataServiceProcessor.registerProcessor("UserProfileService", userProfileProcessor);
+ airavataServiceProcessor.registerProcessor("TenantProfileService", tenantProfileProcessor);
+ airavataServiceProcessor.registerProcessor("IamAdminServices", iamAdminServicesProcessor);
+ airavataServiceProcessor.registerProcessor("GroupManagerService", groupManagerProcessor);
+
+ // Create server transport
+ TServerTransport serverTransport;
+ InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
+ serverTransport = new TServerSocket(inetSocketAddress);
+
+ // Configure server
+ TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
+ options.minWorkerThreads =
+ Integer.parseInt(ServerSettings.getSetting("airavata.service.min.threads", "30"));
+ options.maxWorkerThreads =
+ Integer.parseInt(ServerSettings.getSetting("airavata.service.max.threads", "100"));
+ server = new TThreadPoolServer(options.processor(airavataServiceProcessor));
+
+ // Start server in background thread
+ new Thread(() -> {
+ try {
+ server.serve();
+ setStatus(ServerStatus.STOPPED);
+ logger.info("Airavata Service Server Stopped.");
+ } catch (Exception e) {
+ logger.error("Error in Airavata Service Server", e);
+ setStatus(ServerStatus.FAILED);
+ }
+ })
+ .start();
+
+ // Wait for server to start
+ new Thread(() -> {
+ while (!server.isServing()) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ if (server.isServing()) {
+ setStatus(ServerStatus.STARTED);
+ logger.info(
+ "Started Airavata Service Server on {}:{} with 9 services (Workflow pending thrift generation)",
+ serverHost,
+ serverPort);
+ } else {
+ setStatus(ServerStatus.FAILED);
+ logger.error("Failed to start Airavata Service Server");
+ }
+ })
+ .start();
+
+ } catch (Exception e) {
+ logger.error("Failed to start Airavata Service Server", e);
+ setStatus(ServerStatus.FAILED);
+ throw e;
+ }
+ }
+
+ @Override
+ public void stop() throws Exception {
+ if (server != null && server.isServing()) {
+ setStatus(ServerStatus.STOPING);
+ server.stop();
+ }
+ }
+
+ @Override
+ public void restart() throws Exception {
+ stop();
+ start();
+ }
+
+ @Override
+ public void configure() throws Exception {
+ // Configuration is handled in start()
+ }
+
+ @Override
+ public ServerStatus getStatus() throws Exception {
+ return status;
+ }
+
+ private void setStatus(ServerStatus stat) {
+ status = stat;
+ status.updateTime();
+ }
+
+ @Override
+ public String getName() {
+ return SERVER_NAME;
+ }
+
+ @Override
+ public String getVersion() {
+ return SERVER_VERSION;
+ }
+
+ public static void main(String[] args) {
+ try {
+ AiravataServiceServer server = new AiravataServiceServer();
+ server.start();
+
+ // Keep the main thread alive
+ while (server.getStatus() == ServerStatus.STARTED) {
+ Thread.sleep(1000);
+ }
+ } catch (Exception e) {
+ logger.error("Error while running Airavata Service Server", e);
+ }
+ }
+}
diff --git a/airavata-api/src/main/java/org/apache/airavata/service/airavata/client/AiravataServiceClientFactory.java b/airavata-api/src/main/java/org/apache/airavata/service/airavata/client/AiravataServiceClientFactory.java
new file mode 100644
index 0000000..f85e86b
--- /dev/null
+++ b/airavata-api/src/main/java/org/apache/airavata/service/airavata/client/AiravataServiceClientFactory.java
@@ -0,0 +1,208 @@
+/**
+*
+* 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.service.airavata.client;
+
+import org.apache.airavata.api.Airavata;
+import org.apache.airavata.credential.store.cpi.CredentialStoreService;
+import org.apache.airavata.orchestrator.cpi.OrchestratorService;
+import org.apache.airavata.registry.api.RegistryService;
+import org.apache.airavata.service.profile.groupmanager.cpi.GroupManagerService;
+import org.apache.airavata.service.profile.iam.admin.services.cpi.IamAdminServices;
+import org.apache.airavata.service.profile.tenant.cpi.TenantProfileService;
+import org.apache.airavata.service.profile.user.cpi.UserProfileService;
+import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TMultiplexedProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Client factory for creating multiplexed thrift clients that connect to the unified AiravataService.
+ * This factory creates clients that use TMultiplexedProtocol to access specific services within the unified server.
+ */
+public class AiravataServiceClientFactory {
+ @SuppressWarnings("unused")
+ private static final Logger logger = LoggerFactory.getLogger(AiravataServiceClientFactory.class);
+
+ /**
+ * Create a multiplexed protocol for a specific service
+ */
+ private static TProtocol createMultiplexedProtocol(String host, int port, String serviceName)
+ throws TTransportException {
+ TTransport transport = new TSocket(host, port);
+ transport.open();
+ TProtocol protocol = new TBinaryProtocol(transport);
+ return new TMultiplexedProtocol(protocol, serviceName);
+ }
+
+ /**
+ * Create Airavata API client
+ */
+ public static Airavata.Client createAiravataClient(String host, int port) throws TException {
+ TProtocol protocol = createMultiplexedProtocol(host, port, "Airavata");
+ return new Airavata.Client(protocol);
+ }
+
+ /**
+ * Create Registry Service client
+ */
+ public static RegistryService.Client createRegistryClient(String host, int port) throws TException {
+ TProtocol protocol = createMultiplexedProtocol(host, port, "RegistryService");
+ return new RegistryService.Client(protocol);
+ }
+
+ /**
+ * Create Credential Store Service client
+ */
+ public static CredentialStoreService.Client createCredentialStoreClient(String host, int port) throws TException {
+ TProtocol protocol = createMultiplexedProtocol(host, port, "CredentialStoreService");
+ return new CredentialStoreService.Client(protocol);
+ }
+
+ /**
+ * Create Sharing Registry Service client
+ */
+ public static SharingRegistryService.Client createSharingRegistryClient(String host, int port) throws TException {
+ TProtocol protocol = createMultiplexedProtocol(host, port, "SharingRegistryService");
+ return new SharingRegistryService.Client(protocol);
+ }
+
+ /**
+ * Create Orchestrator Service client
+ */
+ public static OrchestratorService.Client createOrchestratorClient(String host, int port) throws TException {
+ TProtocol protocol = createMultiplexedProtocol(host, port, "OrchestratorService");
+ return new OrchestratorService.Client(protocol);
+ }
+
+ /**
+ * Create Workflow Service client
+ * TODO: Uncomment when WorkflowModel thrift stubs are generated
+ */
+ // public static Workflow.Client createWorkflowClient(String host, int port) throws TException {
+ // TProtocol protocol = createMultiplexedProtocol(host, port, "Workflow");
+ // return new Workflow.Client(protocol);
+ // }
+
+ /**
+ * Create User Profile Service client
+ */
+ public static UserProfileService.Client createUserProfileClient(String host, int port) throws TException {
+ TProtocol protocol = createMultiplexedProtocol(host, port, "UserProfileService");
+ return new UserProfileService.Client(protocol);
+ }
+
+ /**
+ * Create Tenant Profile Service client
+ */
+ public static TenantProfileService.Client createTenantProfileClient(String host, int port) throws TException {
+ TProtocol protocol = createMultiplexedProtocol(host, port, "TenantProfileService");
+ return new TenantProfileService.Client(protocol);
+ }
+
+ /**
+ * Create IAM Admin Services client
+ */
+ public static IamAdminServices.Client createIamAdminServicesClient(String host, int port) throws TException {
+ TProtocol protocol = createMultiplexedProtocol(host, port, "IamAdminServices");
+ return new IamAdminServices.Client(protocol);
+ }
+
+ /**
+ * Create Group Manager Service client
+ */
+ public static GroupManagerService.Client createGroupManagerClient(String host, int port) throws TException {
+ TProtocol protocol = createMultiplexedProtocol(host, port, "GroupManagerService");
+ return new GroupManagerService.Client(protocol);
+ }
+
+ /**
+ * Create all service clients with default settings
+ * Uses localhost and default port 9930
+ */
+ public static AiravataServiceClients createAllClients() throws TException {
+ return createAllClients("localhost", 9930);
+ }
+
+ /**
+ * Create all service clients with specified host and port
+ * TODO: Add workflow client when thrift stubs are generated
+ */
+ public static AiravataServiceClients createAllClients(String host, int port) throws TException {
+ return new AiravataServiceClients(
+ createAiravataClient(host, port),
+ createRegistryClient(host, port),
+ createCredentialStoreClient(host, port),
+ createSharingRegistryClient(host, port),
+ createOrchestratorClient(host, port),
+ null, // createWorkflowClient(host, port), // TODO: Uncomment when WorkflowModel thrift stubs are
+ // generated
+ createUserProfileClient(host, port),
+ createTenantProfileClient(host, port),
+ createIamAdminServicesClient(host, port),
+ createGroupManagerClient(host, port));
+ }
+
+ /**
+ * Container class for all service clients
+ */
+ public static class AiravataServiceClients {
+ public final Airavata.Client airavata;
+ public final RegistryService.Client registry;
+ public final CredentialStoreService.Client credentialStore;
+ public final SharingRegistryService.Client sharingRegistry;
+ public final OrchestratorService.Client orchestrator;
+ // public final Workflow.Client workflow; // TODO: Uncomment when WorkflowModel thrift stubs are generated
+ public final Object workflow; // Placeholder
+ public final UserProfileService.Client userProfile;
+ public final TenantProfileService.Client tenantProfile;
+ public final IamAdminServices.Client iamAdmin;
+ public final GroupManagerService.Client groupManager;
+
+ public AiravataServiceClients(
+ Airavata.Client airavata,
+ RegistryService.Client registry,
+ CredentialStoreService.Client credentialStore,
+ SharingRegistryService.Client sharingRegistry,
+ OrchestratorService.Client orchestrator,
+ Object workflow, // Workflow.Client workflow, // TODO: Uncomment when WorkflowModel thrift stubs are
+ // generated
+ UserProfileService.Client userProfile,
+ TenantProfileService.Client tenantProfile,
+ IamAdminServices.Client iamAdmin,
+ GroupManagerService.Client groupManager) {
+ this.airavata = airavata;
+ this.registry = registry;
+ this.credentialStore = credentialStore;
+ this.sharingRegistry = sharingRegistry;
+ this.orchestrator = orchestrator;
+ this.workflow = workflow;
+ this.userProfile = userProfile;
+ this.tenantProfile = tenantProfile;
+ this.iamAdmin = iamAdmin;
+ this.groupManager = groupManager;
+ }
+ }
+}
diff --git a/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/GroupManagerServiceHandler.java b/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/GroupManagerServiceHandler.java
index 9b445aa..5be097b 100644
--- a/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/GroupManagerServiceHandler.java
+++ b/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/GroupManagerServiceHandler.java
@@ -23,9 +23,7 @@
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.model.error.AuthorizationException;
import org.apache.airavata.model.group.GroupModel;
import org.apache.airavata.model.security.AuthzToken;
@@ -35,13 +33,12 @@
import org.apache.airavata.service.profile.groupmanager.cpi.group_manager_cpiConstants;
import org.apache.airavata.service.profile.user.core.repositories.UserProfileRepository;
import org.apache.airavata.service.security.interceptor.SecurityCheck;
-import org.apache.airavata.sharing.registry.client.SharingRegistryServiceClientFactory;
import org.apache.airavata.sharing.registry.models.GroupCardinality;
import org.apache.airavata.sharing.registry.models.GroupType;
import org.apache.airavata.sharing.registry.models.SharingRegistryException;
import org.apache.airavata.sharing.registry.models.User;
import org.apache.airavata.sharing.registry.models.UserGroup;
-import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
+import org.apache.airavata.sharing.registry.server.SharingRegistryServerHandler;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,6 +49,15 @@
private UserProfileRepository userProfileRepository = new UserProfileRepository();
+ // Direct handler dependency (for unified service)
+ private SharingRegistryServerHandler sharingHandler;
+
+ // Constructor for unified service with direct handler dependencies
+ public GroupManagerServiceHandler(SharingRegistryServerHandler sharingHandler) {
+ this.sharingHandler = sharingHandler;
+ }
+
+ // Legacy constructor for backward compatibility
public GroupManagerServiceHandler() {}
@Override
@@ -65,7 +71,6 @@
throws GroupManagerServiceException, AuthorizationException, TException {
try {
// TODO Validations for authorization
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
UserGroup sharingUserGroup = new UserGroup();
sharingUserGroup.setGroupId(UUID.randomUUID().toString());
@@ -77,8 +82,8 @@
sharingUserGroup.setDomainId(gatewayId);
sharingUserGroup.setOwnerId(getUserId(authzToken));
- String groupId = sharingClient.createGroup(sharingUserGroup);
- internalAddUsersToGroup(sharingClient, gatewayId, groupModel.getMembers(), groupId);
+ String groupId = sharingHandler.createGroup(sharingUserGroup);
+ internalAddUsersToGroup(gatewayId, groupModel.getMembers(), groupId);
addGroupAdmins(authzToken, groupId, groupModel.getAdmins());
return groupId;
} catch (Exception e) {
@@ -95,11 +100,10 @@
public boolean updateGroup(AuthzToken authzToken, GroupModel groupModel)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
String userId = getUserId(authzToken);
String domainId = getDomainId(authzToken);
- if (!(sharingClient.hasOwnerAccess(domainId, groupModel.getId(), userId)
- || sharingClient.hasAdminAccess(domainId, groupModel.getId(), userId))) {
+ if (!(sharingHandler.hasOwnerAccess(domainId, groupModel.getId(), userId)
+ || sharingHandler.hasAdminAccess(domainId, groupModel.getId(), userId))) {
throw new GroupManagerServiceException("User does not have permission to update group");
}
@@ -111,7 +115,7 @@
sharingUserGroup.setDomainId(getDomainId(authzToken));
// adding and removal of users should be handle separately
- sharingClient.updateGroup(sharingUserGroup);
+ sharingHandler.updateGroup(sharingUserGroup);
return true;
} catch (Exception e) {
String msg = "Error Updating Group";
@@ -127,14 +131,13 @@
public boolean deleteGroup(AuthzToken authzToken, String groupId, String ownerId)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
String userId = getUserId(authzToken);
String domainId = getDomainId(authzToken);
- if (!(sharingClient.hasOwnerAccess(domainId, groupId, userId))) {
+ if (!(sharingHandler.hasOwnerAccess(domainId, groupId, userId))) {
throw new GroupManagerServiceException("User does not have permission to delete group");
}
- sharingClient.deleteGroup(getDomainId(authzToken), groupId);
+ sharingHandler.deleteGroup(getDomainId(authzToken), groupId);
return true;
} catch (Exception e) {
String msg = "Error Deleting Group. Group ID: " + groupId;
@@ -150,11 +153,10 @@
public GroupModel getGroup(AuthzToken authzToken, String groupId)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
final String domainId = getDomainId(authzToken);
- UserGroup userGroup = sharingClient.getGroup(domainId, groupId);
+ UserGroup userGroup = sharingHandler.getGroup(domainId, groupId);
- GroupModel groupModel = convertToGroupModel(userGroup, sharingClient);
+ GroupModel groupModel = convertToGroupModel(userGroup, null);
return groupModel;
} catch (Exception e) {
@@ -171,12 +173,10 @@
public List<GroupModel> getGroups(AuthzToken authzToken)
throws GroupManagerServiceException, AuthorizationException, TException {
final String domainId = getDomainId(authzToken);
- SharingRegistryService.Client sharingClient = null;
try {
- sharingClient = getSharingRegistryServiceClient();
- List<UserGroup> userGroups = sharingClient.getGroups(domainId, 0, -1);
+ List<UserGroup> userGroups = sharingHandler.getGroups(domainId, 0, -1);
- return convertToGroupModels(userGroups, sharingClient);
+ return convertToGroupModels(userGroups, null);
} catch (Exception e) {
String msg = "Error Retrieving Groups. Domain ID: " + domainId;
logger.error(msg, e);
@@ -184,7 +184,6 @@
exception.setMessage(msg + " More info : " + e.getMessage());
throw exception;
} finally {
- closeSharingClient(sharingClient);
}
}
@@ -193,12 +192,11 @@
public List<GroupModel> getAllGroupsUserBelongs(AuthzToken authzToken, String userName)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
List<GroupModel> groupModels = new ArrayList<GroupModel>();
final String domainId = getDomainId(authzToken);
- List<UserGroup> userGroups = sharingClient.getAllMemberGroupsForUser(domainId, userName);
+ List<UserGroup> userGroups = sharingHandler.getAllMemberGroupsForUser(domainId, userName);
- return convertToGroupModels(userGroups, sharingClient);
+ return convertToGroupModels(userGroups, null);
} catch (Exception e) {
String msg = "Error Retreiving All Groups for User. User ID: " + userName;
logger.error(msg, e);
@@ -212,14 +210,13 @@
public boolean addUsersToGroup(AuthzToken authzToken, List<String> userIds, String groupId)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
String userId = getUserId(authzToken);
String domainId = getDomainId(authzToken);
- if (!(sharingClient.hasOwnerAccess(domainId, groupId, userId)
- || sharingClient.hasAdminAccess(domainId, groupId, userId))) {
+ if (!(sharingHandler.hasOwnerAccess(domainId, groupId, userId)
+ || sharingHandler.hasAdminAccess(domainId, groupId, userId))) {
throw new GroupManagerServiceException("User does not have access to add users to the group");
}
- return internalAddUsersToGroup(sharingClient, domainId, userIds, groupId);
+ return internalAddUsersToGroup(domainId, userIds, groupId);
} catch (Exception e) {
String msg = "Error adding users to group. Group ID: " + groupId;
@@ -234,14 +231,13 @@
public boolean removeUsersFromGroup(AuthzToken authzToken, List<String> userIds, String groupId)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
String userId = getUserId(authzToken);
String domainId = getDomainId(authzToken);
- if (!(sharingClient.hasOwnerAccess(domainId, groupId, userId)
- || sharingClient.hasAdminAccess(domainId, groupId, userId))) {
+ if (!(sharingHandler.hasOwnerAccess(domainId, groupId, userId)
+ || sharingHandler.hasAdminAccess(domainId, groupId, userId))) {
throw new GroupManagerServiceException("User does not have access to remove users to the group");
}
- return sharingClient.removeUsersFromGroup(domainId, userIds, groupId);
+ return sharingHandler.removeUsersFromGroup(domainId, userIds, groupId);
} catch (Exception e) {
String msg = "Error remove users to group. Group ID: " + groupId;
logger.error(msg, e);
@@ -256,14 +252,13 @@
public boolean transferGroupOwnership(AuthzToken authzToken, String groupId, String newOwnerId)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
String userId = getUserId(authzToken);
String domainId = getDomainId(authzToken);
- if (!(sharingClient.hasOwnerAccess(domainId, groupId, userId))) {
+ if (!(sharingHandler.hasOwnerAccess(domainId, groupId, userId))) {
throw new GroupManagerServiceException(
"User does not have Owner permission to transfer group ownership");
}
- return sharingClient.transferGroupOwnership(getDomainId(authzToken), groupId, newOwnerId);
+ return sharingHandler.transferGroupOwnership(getDomainId(authzToken), groupId, newOwnerId);
} catch (Exception e) {
String msg = "Error Transferring Group Ownership";
logger.error(msg, e);
@@ -278,13 +273,12 @@
public boolean addGroupAdmins(AuthzToken authzToken, String groupId, List<String> adminIds)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
String userId = getUserId(authzToken);
String domainId = getDomainId(authzToken);
- if (!(sharingClient.hasOwnerAccess(domainId, groupId, userId))) {
+ if (!(sharingHandler.hasOwnerAccess(domainId, groupId, userId))) {
throw new GroupManagerServiceException("User does not have Owner permission to add group admins");
}
- return sharingClient.addGroupAdmins(getDomainId(authzToken), groupId, adminIds);
+ return sharingHandler.addGroupAdmins(getDomainId(authzToken), groupId, adminIds);
} catch (Exception e) {
String msg = "Error Adding Admins to Group. Group ID: " + groupId;
logger.error(msg, e);
@@ -299,13 +293,12 @@
public boolean removeGroupAdmins(AuthzToken authzToken, String groupId, List<String> adminIds)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
String userId = getUserId(authzToken);
String domainId = getDomainId(authzToken);
- if (!(sharingClient.hasOwnerAccess(domainId, groupId, userId))) {
+ if (!(sharingHandler.hasOwnerAccess(domainId, groupId, userId))) {
throw new GroupManagerServiceException("User does not have Owner permission to remove group admins");
}
- return sharingClient.removeGroupAdmins(getDomainId(authzToken), groupId, adminIds);
+ return sharingHandler.removeGroupAdmins(getDomainId(authzToken), groupId, adminIds);
} catch (Exception e) {
String msg = "Error Removing Admins from the Group. Group ID: " + groupId;
logger.error(msg, e);
@@ -320,8 +313,7 @@
public boolean hasAdminAccess(AuthzToken authzToken, String groupId, String adminId)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
- return sharingClient.hasAdminAccess(getDomainId(authzToken), groupId, adminId);
+ return sharingHandler.hasAdminAccess(getDomainId(authzToken), groupId, adminId);
} catch (Exception e) {
String msg = "Error Checking Admin Access for the Group. Group ID: " + groupId + " Admin ID: " + adminId;
logger.error(msg, e);
@@ -336,8 +328,7 @@
public boolean hasOwnerAccess(AuthzToken authzToken, String groupId, String ownerId)
throws GroupManagerServiceException, AuthorizationException, TException {
try {
- SharingRegistryService.Client sharingClient = getSharingRegistryServiceClient();
- return sharingClient.hasOwnerAccess(getDomainId(authzToken), groupId, ownerId);
+ return sharingHandler.hasOwnerAccess(getDomainId(authzToken), groupId, ownerId);
} catch (Exception e) {
String msg = "Error Checking Owner Access for the Group. Group ID: " + groupId + " Owner ID: " + ownerId;
logger.error(msg, e);
@@ -347,17 +338,7 @@
}
}
- // TODO: replace these methods with ThriftClientPool (see AIRAVATA-2607)
- private SharingRegistryService.Client getSharingRegistryServiceClient()
- throws TException, ApplicationSettingsException {
- final int serverPort = Integer.parseInt(ServerSettings.getSharingRegistryPort());
- final String serverHost = ServerSettings.getSharingRegistryHost();
- try {
- return SharingRegistryServiceClientFactory.createSharingRegistryClient(serverHost, serverPort);
- } catch (SharingRegistryException e) {
- throw new TException("Unable to create sharing registry client...", e);
- }
- }
+ // Sharing registry client method removed - use sharingHandler directly
private String getDomainId(AuthzToken authzToken) {
return authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
@@ -367,21 +348,19 @@
return authzToken.getClaimsMap().get(Constants.USER_NAME) + "@" + getDomainId(authzToken);
}
- private List<GroupModel> convertToGroupModels(
- List<UserGroup> userGroups, SharingRegistryService.Client sharingClient) throws TException {
+ private List<GroupModel> convertToGroupModels(List<UserGroup> userGroups, Object unused) throws TException {
List<GroupModel> groupModels = new ArrayList<>();
for (UserGroup userGroup : userGroups) {
- GroupModel groupModel = convertToGroupModel(userGroup, sharingClient);
+ GroupModel groupModel = convertToGroupModel(userGroup, null);
groupModels.add(groupModel);
}
return groupModels;
}
- private GroupModel convertToGroupModel(UserGroup userGroup, SharingRegistryService.Client sharingClient)
- throws TException {
+ private GroupModel convertToGroupModel(UserGroup userGroup, Object unused) throws TException {
GroupModel groupModel = new GroupModel();
groupModel.setId(userGroup.getGroupId());
groupModel.setName(userGroup.getName());
@@ -392,30 +371,20 @@
.collect(Collectors.toList());
groupModel.setAdmins(admins);
- sharingClient.getGroupMembersOfTypeUser(userGroup.getDomainId(), userGroup.getGroupId(), 0, -1).stream()
+ sharingHandler.getGroupMembersOfTypeUser(userGroup.getDomainId(), userGroup.getGroupId(), 0, -1).stream()
.forEach(user -> groupModel.addToMembers(user.getUserId()));
return groupModel;
}
- private void closeSharingClient(SharingRegistryService.Client sharingClient) {
- if (sharingClient != null) {
- if (sharingClient.getInputProtocol().getTransport().isOpen()) {
- sharingClient.getInputProtocol().getTransport().close();
- }
- if (sharingClient.getOutputProtocol().getTransport().isOpen()) {
- sharingClient.getOutputProtocol().getTransport().close();
- }
- }
- }
+ // closeSharingClient method removed - not needed with direct handler calls
- private boolean internalAddUsersToGroup(
- SharingRegistryService.Client sharingClient, String domainId, List<String> userIds, String groupId)
+ private boolean internalAddUsersToGroup(String domainId, List<String> userIds, String groupId)
throws SharingRegistryException, TException {
// FIXME: workaround for UserProfiles that failed to sync to the sharing
// registry: create any missing users in the sharing registry
for (String userId : userIds) {
- if (!sharingClient.isUserExists(domainId, userId)) {
+ if (!sharingHandler.isUserExists(domainId, userId)) {
User user = new User();
user.setDomainId(domainId);
user.setUserId(userId);
@@ -428,9 +397,9 @@
: null);
user.setFirstName(userProfile.getFirstName());
user.setLastName(userProfile.getLastName());
- sharingClient.createUser(user);
+ sharingHandler.createUser(user);
}
}
- return sharingClient.addUsersToGroup(domainId, userIds, groupId);
+ return sharingHandler.addUsersToGroup(domainId, userIds, groupId);
}
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java b/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java
index 2da10e5..da6a06c 100644
--- a/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java
+++ b/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java
@@ -26,9 +26,7 @@
import org.apache.airavata.common.utils.Constants;
import org.apache.airavata.common.utils.DBEventService;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.credential.store.client.CredentialStoreClientFactory;
-import org.apache.airavata.credential.store.cpi.CredentialStoreService;
-import org.apache.airavata.credential.store.exception.CredentialStoreException;
+import org.apache.airavata.credential.store.server.CredentialStoreServerHandler;
import org.apache.airavata.messaging.core.util.DBEventPublisherUtils;
import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
import org.apache.airavata.model.credential.store.PasswordCredential;
@@ -38,9 +36,7 @@
import org.apache.airavata.model.security.AuthzToken;
import org.apache.airavata.model.user.UserProfile;
import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.registry.api.RegistryService;
-import org.apache.airavata.registry.api.client.RegistryServiceClientFactory;
-import org.apache.airavata.registry.api.exception.RegistryServiceException;
+import org.apache.airavata.registry.api.service.handler.RegistryServerHandler;
import org.apache.airavata.service.profile.iam.admin.services.core.impl.TenantManagementKeycloakImpl;
import org.apache.airavata.service.profile.iam.admin.services.cpi.IamAdminServices;
import org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException;
@@ -57,6 +53,20 @@
private UserProfileRepository userProfileRepository = new UserProfileRepository();
private DBEventPublisherUtils dbEventPublisherUtils = new DBEventPublisherUtils(DBEventService.IAM_ADMIN);
+ // Direct handler dependencies (for unified service)
+ private RegistryServerHandler registryHandler;
+ private CredentialStoreServerHandler credentialStoreHandler;
+
+ // Constructor for unified service with direct handler dependencies
+ public IamAdminServicesHandler(
+ RegistryServerHandler registryHandler, CredentialStoreServerHandler credentialStoreHandler) {
+ this.registryHandler = registryHandler;
+ this.credentialStoreHandler = credentialStoreHandler;
+ }
+
+ // Legacy constructor for backward compatibility
+ public IamAdminServicesHandler() {}
+
@Override
public String getAPIVersion() throws TException {
return iam_admin_services_cpiConstants.IAM_ADMIN_SERVICES_CPI_VERSION;
@@ -72,9 +82,8 @@
keycloakclient.addTenant(isSuperAdminCredentials, gateway);
// Load the tenant admin password stored in gateway request
- CredentialStoreService.Client credentialStoreClient = getCredentialStoreServiceClient();
// Admin password token should already be stored under requested gateway's gatewayId
- PasswordCredential tenantAdminPasswordCredential = credentialStoreClient.getPasswordCredential(
+ PasswordCredential tenantAdminPasswordCredential = credentialStoreHandler.getPasswordCredential(
gateway.getIdentityServerPasswordToken(), gateway.getGatewayId());
if (!keycloakclient.createTenantAdminAccount(
@@ -83,7 +92,7 @@
}
Gateway gatewayWithIdAndSecret = keycloakclient.configureClient(isSuperAdminCredentials, gateway);
return gatewayWithIdAndSecret;
- } catch (TException | ApplicationSettingsException ex) {
+ } catch (TException ex) {
logger.error("Gateway Setup Failed, reason: " + ex.getMessage(), ex);
IamAdminServicesException iamAdminServicesException = new IamAdminServicesException(ex.getMessage());
throw iamAdminServicesException;
@@ -339,30 +348,10 @@
private PasswordCredential getTenantAdminPasswordCredential(String tenantId)
throws TException, ApplicationSettingsException {
- GatewayResourceProfile gwrp = getRegistryServiceClient().getGatewayResourceProfile(tenantId);
+ GatewayResourceProfile gwrp = registryHandler.getGatewayResourceProfile(tenantId);
- CredentialStoreService.Client csClient = getCredentialStoreServiceClient();
- return csClient.getPasswordCredential(gwrp.getIdentityServerPwdCredToken(), gwrp.getGatewayID());
+ return credentialStoreHandler.getPasswordCredential(gwrp.getIdentityServerPwdCredToken(), gwrp.getGatewayID());
}
- private RegistryService.Client getRegistryServiceClient() throws TException, ApplicationSettingsException {
- final int serverPort = Integer.parseInt(ServerSettings.getRegistryServerPort());
- final String serverHost = ServerSettings.getRegistryServerHost();
- try {
- return RegistryServiceClientFactory.createRegistryClient(serverHost, serverPort);
- } catch (RegistryServiceException e) {
- throw new TException("Unable to create registry client...", e);
- }
- }
-
- private CredentialStoreService.Client getCredentialStoreServiceClient()
- throws TException, ApplicationSettingsException {
- final int serverPort = Integer.parseInt(ServerSettings.getCredentialStoreServerPort());
- final String serverHost = ServerSettings.getCredentialStoreServerHost();
- try {
- return CredentialStoreClientFactory.createAiravataCSClient(serverHost, serverPort);
- } catch (CredentialStoreException e) {
- throw new TException("Unable to create credential store client...", e);
- }
- }
+ // Client factory methods removed - use direct handler calls
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java b/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java
index 2f856cc..56d616f 100644
--- a/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java
+++ b/airavata-api/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java
@@ -24,10 +24,7 @@
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.Constants;
import org.apache.airavata.common.utils.DBEventService;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.credential.store.client.CredentialStoreClientFactory;
-import org.apache.airavata.credential.store.cpi.CredentialStoreService;
-import org.apache.airavata.credential.store.exception.CredentialStoreException;
+import org.apache.airavata.credential.store.server.CredentialStoreServerHandler;
import org.apache.airavata.messaging.core.util.DBEventPublisherUtils;
import org.apache.airavata.model.credential.store.PasswordCredential;
import org.apache.airavata.model.dbevent.CrudType;
@@ -56,6 +53,15 @@
private TenantProfileRepository tenantProfileRepository;
private DBEventPublisherUtils dbEventPublisherUtils = new DBEventPublisherUtils(DBEventService.TENANT);
+ // Direct handler dependency (for unified service)
+ private CredentialStoreServerHandler credentialStoreHandler;
+
+ // Constructor for unified service with direct handler dependencies
+ public TenantProfileServiceHandler(CredentialStoreServerHandler credentialStoreHandler) {
+ this.credentialStoreHandler = credentialStoreHandler;
+ }
+
+ // Legacy constructor for backward compatibility
public TenantProfileServiceHandler() {
logger.debug("Initializing TenantProfileServiceHandler");
this.tenantProfileRepository = new TenantProfileRepository(Gateway.class, GatewayEntity.class);
@@ -242,32 +248,13 @@
// copied to a credential that is stored in the requested/newly created gateway
private void copyAdminPasswordToGateway(AuthzToken authzToken, Gateway gateway)
throws TException, ApplicationSettingsException {
- CredentialStoreService.Client csClient = getCredentialStoreServiceClient();
- try {
- String requestGatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- PasswordCredential adminPasswordCredential =
- csClient.getPasswordCredential(gateway.getIdentityServerPasswordToken(), requestGatewayId);
- adminPasswordCredential.setGatewayId(gateway.getGatewayId());
- String newAdminPasswordCredentialToken = csClient.addPasswordCredential(adminPasswordCredential);
- gateway.setIdentityServerPasswordToken(newAdminPasswordCredentialToken);
- } finally {
- if (csClient.getInputProtocol().getTransport().isOpen()) {
- csClient.getInputProtocol().getTransport().close();
- }
- if (csClient.getOutputProtocol().getTransport().isOpen()) {
- csClient.getOutputProtocol().getTransport().close();
- }
- }
+ String requestGatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+ PasswordCredential adminPasswordCredential = credentialStoreHandler.getPasswordCredential(
+ gateway.getIdentityServerPasswordToken(), requestGatewayId);
+ adminPasswordCredential.setGatewayId(gateway.getGatewayId());
+ String newAdminPasswordCredentialToken = credentialStoreHandler.addPasswordCredential(adminPasswordCredential);
+ gateway.setIdentityServerPasswordToken(newAdminPasswordCredentialToken);
}
- private CredentialStoreService.Client getCredentialStoreServiceClient()
- throws TException, ApplicationSettingsException {
- final int serverPort = Integer.parseInt(ServerSettings.getCredentialStoreServerPort());
- final String serverHost = ServerSettings.getCredentialStoreServerHost();
- try {
- return CredentialStoreClientFactory.createAiravataCSClient(serverHost, serverPort);
- } catch (CredentialStoreException e) {
- throw new TException("Unable to create credential store client...", e);
- }
- }
+ // Client factory method removed - use direct handler calls
}
diff --git a/airavata-api/src/main/resources/airavata-server.properties b/airavata-api/src/main/resources/airavata-server.properties
index 8b61b1a..e44de08 100644
--- a/airavata-api/src/main/resources/airavata-server.properties
+++ b/airavata-api/src/main/resources/airavata-server.properties
@@ -26,6 +26,11 @@
apiserver.port=8930
apiserver.class=org.apache.airavata.api.server.AiravataAPIServer
+# Unified Airavata Service Configuration
+airavata.service.host=0.0.0.0
+airavata.service.port=9930
+airavata.service.class=org.apache.airavata.service.airavata.AiravataServiceServer
+
appcatalog.jdbc.driver=org.mariadb.jdbc.Driver
appcatalog.jdbc.password=123456
appcatalog.jdbc.url=jdbc:mariadb://airavata.host:13306/app_catalog
@@ -40,9 +45,10 @@
credential.store.jdbc.url=jdbc:mariadb://airavata.host:13306/credential_store
credential.store.jdbc.user=airavata
credential.store.jdbc.validationQuery=SELECT 1 from CONFIGURATION
-credential.store.server.host=localhost
-credential.store.server.port=8960
-credential.store.class=org.apache.airavata.credential.store.server.CredentialStoreServer
+# Internal service endpoints - no longer needed for unified service
+# credential.store.server.host=localhost
+# credential.store.server.port=8960
+# credential.store.class=org.apache.airavata.credential.store.server.CredentialStoreServer
data.analyzer.job.scanning.enable=false
data.parser.delete.container=true
@@ -102,10 +108,11 @@
metaschedluer.job.scanning.enable=false
-orchestrator.server.host=airavata.host
-orchestrator.server.min.threads=50
-orchestrator.server.port=8940
-orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer
+# Internal service endpoints - no longer needed for unified service
+# orchestrator.server.host=airavata.host
+# orchestrator.server.min.threads=50
+# orchestrator.server.port=8940
+# orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer
data.parser.storage.resource.id=CHANGE_ME
@@ -125,13 +132,14 @@
pre.workflow.manager.monitoring.port=9093
pre.workflow.manager.name=AiravataPreWM
-profile_service.class=org.apache.airavata.service.profile.server.ProfileServiceServer
+# Internal service endpoints - no longer needed for unified service
+# profile_service.class=org.apache.airavata.service.profile.server.ProfileServiceServer
profile.service.jdbc.driver=org.mariadb.jdbc.Driver
profile.service.jdbc.password=123456
profile.service.jdbc.url=jdbc:mariadb://airavata.host:13306/profile_service
profile.service.jdbc.user=airavata
-profile.service.server.host=airavata.host
-profile.service.server.port=8962
+# profile.service.server.host=airavata.host
+# profile.service.server.port=8962
profile.service.validationQuery=SELECT 1
# RabbitMQ Settings
@@ -150,10 +158,11 @@
registry.jdbc.url=jdbc:mariadb://airavata.host:13306/experiment_catalog
registry.jdbc.user=airavata
-regserver.server.host=localhost
-regserver.server.min.threads=50
-regserver.server.port=8970
-regserver=org.apache.airavata.registry.api.service.RegistryAPIServer
+# Internal service endpoints - no longer needed for unified service
+# regserver.server.host=localhost
+# regserver.server.min.threads=50
+# regserver.server.port=8970
+# regserver=org.apache.airavata.registry.api.service.RegistryAPIServer
replicacatalog.jdbc.driver=org.mariadb.jdbc.Driver
replicacatalog.jdbc.password=123456
@@ -161,9 +170,10 @@
replicacatalog.jdbc.user=airavata
replicacatalog.validationQuery=SELECT 1 from CONFIGURATION
-sharing_server=org.apache.airavata.sharing.registry.server.SharingRegistryServer
-sharing.registry.server.host=0.0.0.0
-sharing.registry.server.port=7878
+# Internal service endpoints - no longer needed for unified service
+# sharing_server=org.apache.airavata.sharing.registry.server.SharingRegistryServer
+# sharing.registry.server.host=0.0.0.0
+# sharing.registry.server.port=7878
sharingcatalog.jdbc.driver=org.mariadb.jdbc.Driver
sharingcatalog.jdbc.password=123456
sharingcatalog.jdbc.url=jdbc:mariadb://airavata.host:13306/sharing_catalog
diff --git a/airavata-api/src/main/resources/airavata-service.properties b/airavata-api/src/main/resources/airavata-service.properties
new file mode 100644
index 0000000..5495531
--- /dev/null
+++ b/airavata-api/src/main/resources/airavata-service.properties
@@ -0,0 +1,33 @@
+# Airavata Service Configuration
+# This file contains configuration for the unified AiravataService
+
+# Server configuration
+airavata_service.class=org.apache.airavata.service.airavata.AiravataServiceServer
+airavata.service.port=9930
+airavata.service.host=0.0.0.0
+airavata.service.min.threads=30
+airavata.service.max.threads=100
+
+# Database configuration (inherits from existing settings)
+# These settings are used by the individual service handlers
+
+# Registry service settings (for AiravataServerHandler)
+registry.server.host=localhost
+registry.server.port=9930
+
+# Credential store service settings (for AiravataServerHandler)
+credential.store.server.host=localhost
+credential.store.server.port=9930
+
+# Sharing registry service settings (for AiravataServerHandler)
+sharing.registry.server.host=localhost
+sharing.registry.server.port=9930
+
+# Profile service settings
+profile.service.server.port=9930
+
+# Orchestrator service settings
+orchestrator.server.port=9930
+
+# Workflow service settings
+workflow.server.port=9930
diff --git a/airavata-api/src/test/java/org/apache/airavata/service/airavata/AiravataServiceIntegrationTest.java b/airavata-api/src/test/java/org/apache/airavata/service/airavata/AiravataServiceIntegrationTest.java
new file mode 100644
index 0000000..081bf01
--- /dev/null
+++ b/airavata-api/src/test/java/org/apache/airavata/service/airavata/AiravataServiceIntegrationTest.java
@@ -0,0 +1,154 @@
+/**
+*
+* 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.service.airavata;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.apache.airavata.service.airavata.client.AiravataServiceClientFactory;
+import org.apache.thrift.TException;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Integration test for the unified AiravataService
+ */
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class AiravataServiceIntegrationTest {
+ private static final Logger logger = LoggerFactory.getLogger(AiravataServiceIntegrationTest.class);
+
+ private AiravataServiceServer server;
+ private AiravataServiceClientFactory.AiravataServiceClients clients;
+
+ @BeforeAll
+ public void setUp() throws Exception {
+ // Start the unified server
+ server = new AiravataServiceServer();
+ server.start();
+
+ // Wait for server to start
+ Thread.sleep(5000);
+
+ // Create clients
+ clients = AiravataServiceClientFactory.createAllClients("localhost", 9930);
+
+ logger.info("AiravataService integration test setup completed");
+ }
+
+ @AfterAll
+ public void tearDown() throws Exception {
+ if (server != null) {
+ server.stop();
+ }
+ logger.info("AiravataService integration test teardown completed");
+ }
+
+ @Test
+ public void testAiravataServiceVersion() throws TException {
+ String version = clients.airavata.getAPIVersion();
+ assertNotNull(version);
+ assertEquals("0.18.0", version);
+ logger.info("Airavata API version: {}", version);
+ }
+
+ @Test
+ public void testRegistryServiceAccess() throws TException {
+ // Test that we can access the registry service through the multiplexed connection
+ // This is a basic connectivity test
+ assertNotNull(clients.registry);
+ logger.info("Registry service client created successfully");
+ }
+
+ @Test
+ public void testCredentialStoreServiceAccess() throws TException {
+ // Test that we can access the credential store service through the multiplexed connection
+ assertNotNull(clients.credentialStore);
+ logger.info("Credential store service client created successfully");
+ }
+
+ @Test
+ public void testSharingRegistryServiceAccess() throws TException {
+ // Test that we can access the sharing registry service through the multiplexed connection
+ assertNotNull(clients.sharingRegistry);
+ logger.info("Sharing registry service client created successfully");
+ }
+
+ @Test
+ public void testOrchestratorServiceAccess() throws TException {
+ // Test that we can access the orchestrator service through the multiplexed connection
+ assertNotNull(clients.orchestrator);
+ logger.info("Orchestrator service client created successfully");
+ }
+
+ @Test
+ public void testWorkflowServiceAccess() throws TException {
+ // Test that we can access the workflow service through the multiplexed connection
+ assertNotNull(clients.workflow);
+ logger.info("Workflow service client created successfully");
+ }
+
+ @Test
+ public void testUserProfileServiceAccess() throws TException {
+ // Test that we can access the user profile service through the multiplexed connection
+ assertNotNull(clients.userProfile);
+ logger.info("User profile service client created successfully");
+ }
+
+ @Test
+ public void testTenantProfileServiceAccess() throws TException {
+ // Test that we can access the tenant profile service through the multiplexed connection
+ assertNotNull(clients.tenantProfile);
+ logger.info("Tenant profile service client created successfully");
+ }
+
+ @Test
+ public void testIamAdminServicesAccess() throws TException {
+ // Test that we can access the IAM admin services through the multiplexed connection
+ assertNotNull(clients.iamAdmin);
+ logger.info("IAM admin services client created successfully");
+ }
+
+ @Test
+ public void testGroupManagerServiceAccess() throws TException {
+ // Test that we can access the group manager service through the multiplexed connection
+ assertNotNull(clients.groupManager);
+ logger.info("Group manager service client created successfully");
+ }
+
+ @Test
+ public void testAllServicesAccessible() throws TException {
+ // Test that all 10 services are accessible through the unified server
+ assertNotNull(clients.airavata);
+ assertNotNull(clients.registry);
+ assertNotNull(clients.credentialStore);
+ assertNotNull(clients.sharingRegistry);
+ assertNotNull(clients.orchestrator);
+ assertNotNull(clients.workflow);
+ assertNotNull(clients.userProfile);
+ assertNotNull(clients.tenantProfile);
+ assertNotNull(clients.iamAdmin);
+ assertNotNull(clients.groupManager);
+
+ logger.info("All 10 services are accessible through the unified AiravataService");
+ }
+}
diff --git a/airavata-service-README.md b/airavata-service-README.md
new file mode 100644
index 0000000..683d1a3
--- /dev/null
+++ b/airavata-service-README.md
@@ -0,0 +1,166 @@
+# AiravataService - Unified Thrift Service
+
+## Overview
+
+AiravataService is a unified thrift service that combines all Airavata services into a single server process using TMultiplexedProcessor. This simplifies deployment and provides a foundation for future gRPC migration.
+
+## Services Included
+
+The unified service includes all 10 Airavata services:
+
+1. **Airavata API** - Main API service
+2. **Registry Service** - Data registry operations
+3. **Credential Store Service** - Credential management
+4. **Sharing Registry Service** - Data sharing operations
+5. **Orchestrator Service** - Workflow orchestration
+6. **Workflow Service** - Workflow management
+7. **User Profile Service** - User profile management
+8. **Tenant Profile Service** - Tenant/gateway management
+9. **IAM Admin Services** - Identity and access management
+10. **Group Manager Service** - Group management
+
+## Deployment
+
+### Starting the Unified Service
+
+```bash
+# Start only the unified service
+java -jar airavata-api.jar --servers=airavata-service
+
+# Or use the ServerMain class directly
+java org.apache.airavata.server.ServerMain --servers=airavata-service
+```
+
+### Configuration
+
+The service uses the following configuration properties:
+
+```properties
+# Server settings
+airavata_service.class=org.apache.airavata.service.airavata.AiravataServiceServer
+airavata.service.port=9930
+airavata.service.host=0.0.0.0
+airavata.service.min.threads=30
+airavata.service.max.threads=100
+```
+
+## Client Usage
+
+### Using the Unified Client Factory
+
+```java
+import org.apache.airavata.service.airavata.client.AiravataServiceClientFactory;
+
+// Create all clients with default settings (localhost:9930)
+AiravataServiceClientFactory.AiravataServiceClients clients =
+ AiravataServiceClientFactory.createAllClients();
+
+// Or specify host and port
+AiravataServiceClientFactory.AiravataServiceClients clients =
+ AiravataServiceClientFactory.createAllClients("localhost", 9930);
+
+// Access individual services
+String version = clients.airavata.getAPIVersion();
+// Use other services...
+```
+
+### Using Individual Service Clients
+
+```java
+// Create individual clients
+Airavata.Client airavataClient = AiravataServiceClientFactory.createAiravataClient("localhost", 9930);
+RegistryService.Client registryClient = AiravataServiceClientFactory.createRegistryClient("localhost", 9930);
+// ... other services
+```
+
+### Backward Compatibility
+
+Existing client code can continue to work by configuring all service hosts/ports to point to the unified server:
+
+```properties
+# Point all services to the unified server
+registry.server.host=localhost
+registry.server.port=9930
+credential.store.server.host=localhost
+credential.store.server.port=9930
+sharing.registry.server.host=localhost
+sharing.registry.server.port=9930
+# ... etc
+```
+
+## Benefits
+
+1. **Single Server Process** - Simplifies deployment and resource management
+2. **Backward Compatible** - Existing clients work with multiplexed protocol
+3. **Migration Path** - New client factory for simplified access
+4. **Foundation for gRPC** - Same structure can be replicated in gRPC
+5. **Reduced Network Overhead** - In-process calls instead of network calls between services
+
+## Development
+
+### Building
+
+```bash
+# Generate thrift stubs (includes airavata service)
+./thrift-interface-descriptions/generate-thrift-stubs.sh java
+
+# Build the project
+mvn clean compile
+```
+
+### Testing
+
+```bash
+# Run integration tests
+mvn test -Dtest=AiravataServiceIntegrationTest
+```
+
+## Architecture
+
+The unified service uses Apache Thrift's TMultiplexedProcessor to route calls to the appropriate service handlers:
+
+```
+Client Request → TMultiplexedProcessor → Service Handler
+ ↓
+ Service Name Router
+ ↓
+ [Airavata, Registry, CredentialStore, ...]
+```
+
+Each service maintains its original interface and behavior, but all run within the same JVM process.
+
+## Migration from Separate Services
+
+### For New Applications
+
+Use the new `AiravataServiceClientFactory` for simplified client management.
+
+### For Existing Applications
+
+1. **Option 1**: Update configuration to point all services to the unified server port
+2. **Option 2**: Gradually migrate to use the new client factory
+3. **Option 3**: Continue using separate services (backward compatible)
+
+## Future gRPC Migration
+
+The unified service structure provides a foundation for gRPC migration:
+
+1. The same service handlers can be used
+2. The multiplexed approach can be replicated with gRPC services
+3. Client factory pattern can be adapted for gRPC clients
+
+## Troubleshooting
+
+### Common Issues
+
+1. **Port conflicts**: Ensure port 9930 is available
+2. **Database initialization**: Check that all required databases are configured
+3. **Client connection**: Verify clients are using the correct host/port
+
+### Logs
+
+The service logs all operations. Check logs for:
+- Service startup messages
+- Database initialization status
+- Client connection attempts
+- Service routing information
diff --git a/thrift-interface-descriptions/airavata-service/airavata_service.thrift b/thrift-interface-descriptions/airavata-service/airavata_service.thrift
new file mode 100644
index 0000000..53bb698
--- /dev/null
+++ b/thrift-interface-descriptions/airavata-service/airavata_service.thrift
@@ -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.
+ *
+*/
+
+/**
+ * Unified Airavata Service Interface
+ * This service combines all Airavata thrift services into a single multiplexed service
+ * for simplified deployment and client interaction.
+ */
+
+// Include all existing data models
+include "../airavata-apis/airavata_errors.thrift"
+include "../airavata-apis/airavata_commons.thrift"
+include "../airavata-apis/security_model.thrift"
+include "../airavata-apis/messaging_events.thrift"
+include "../airavata-apis/db_event_model.thrift"
+
+include "../base-api/base_api.thrift"
+
+// Data models
+include "../data-models/credential_store_models.thrift"
+include "../data-models/status_models.thrift"
+include "../data-models/job_model.thrift"
+include "../data-models/experiment_model.thrift"
+include "../data-models/workspace_model.thrift"
+include "../data-models/scheduling_model.thrift"
+include "../data-models/application_io_models.thrift"
+include "../data-models/application_deployment_model.thrift"
+include "../data-models/application_interface_model.thrift"
+include "../data-models/parser_model.thrift"
+include "../data-models/account_provisioning_model.thrift"
+include "../data-models/compute_resource_model.thrift"
+include "../data-models/storage_resource_model.thrift"
+include "../data-models/gateway_resource_profile_model.thrift"
+include "../data-models/group_resource_profile_model.thrift"
+include "../data-models/user_resource_profile_model.thrift"
+include "../data-models/data_movement_models.thrift"
+include "../data-models/gateway_groups_model.thrift"
+include "../data-models/replica_catalog_models.thrift"
+include "../data-models/group_manager_model.thrift"
+include "../data-models/user_profile_model.thrift"
+include "../data-models/tenant_profile_model.thrift"
+include "../data-models/sharing_models.thrift"
+include "../data-models/workflow_data_model.thrift"
+include "../data-models/workflow_model.thrift"
+include "../data-models/process_model.thrift"
+include "../data-models/task_model.thrift"
+
+// Service definitions
+include "../airavata-apis/airavata_api.thrift"
+include "../airavata-apis/workflow_api.thrift"
+include "../service-cpis/registry-api.thrift"
+include "../service-cpis/credential-store-cpi.thrift"
+include "../service-cpis/sharing_cpi.thrift"
+include "../service-cpis/orchestrator-cpi.thrift"
+include "../service-cpis/profile-service/profile-user/profile-user-cpi.thrift"
+include "../service-cpis/profile-service/profile-tenant/profile-tenant-cpi.thrift"
+include "../service-cpis/profile-service/iam-admin-services/iam-admin-services-cpi.thrift"
+include "../service-cpis/profile-service/group-manager/group-manager-cpi.thrift"
+
+namespace java org.apache.airavata.service.airavata
+namespace php Airavata.Service.Airavata
+namespace cpp apache.airavata.service.airavata
+namespace perl ApacheAiravataService
+namespace py airavata.service.airavata
+namespace js ApacheAiravataService
+
+/**
+ * Airavata Service Interface Versions depend upon this Thrift Interface File. When making changes, please edit the
+ * Version Constants according to Semantic Versioning Specification (SemVer) http://semver.org.
+ *
+ * Note: The Airavata Service version may be different from the Airavata software release versions.
+ *
+ * The Airavata Service version is composed as a dot delimited string with major, minor, and patch level components.
+ *
+ * - Major: Incremented for backward incompatible changes. An example would be changes to interfaces.
+ * - Minor: Incremented for backward compatible changes. An example would be the addition of a new optional methods.
+ * - Patch: Incremented for bug fixes. The patch level should be increased for every edit that doesn't result
+ * in a change to major/minor version numbers.
+ *
+*/
+const string AIRAVATA_SERVICE_VERSION = "0.18.0"
+
+// Service name constants for TMultiplexedProcessor
+const string AIRAVATA_SERVICE_NAME = "Airavata"
+const string REGISTRY_SERVICE_NAME = "RegistryService"
+const string CREDENTIAL_STORE_SERVICE_NAME = "CredentialStoreService"
+const string SHARING_REGISTRY_SERVICE_NAME = "SharingRegistryService"
+const string ORCHESTRATOR_SERVICE_NAME = "OrchestratorService"
+const string WORKFLOW_SERVICE_NAME = "Workflow"
+const string USER_PROFILE_SERVICE_NAME = "UserProfileService"
+const string TENANT_PROFILE_SERVICE_NAME = "TenantProfileService"
+const string IAM_ADMIN_SERVICES_NAME = "IamAdminServices"
+const string GROUP_MANAGER_SERVICE_NAME = "GroupManagerService"
+
+/**
+ * AiravataService is a multiplexed service that combines all Airavata services.
+ * This service definition is used for documentation and client generation.
+ * The actual implementation uses TMultiplexedProcessor to route calls to the appropriate service handlers.
+ */
+service AiravataService extends base_api.BaseAPI {
+ /**
+ * This service combines all Airavata services:
+ * - Airavata API
+ * - Registry Service
+ * - Credential Store Service
+ * - Sharing Registry Service
+ * - Orchestrator Service
+ * - Workflow Service
+ * - User Profile Service
+ * - Tenant Profile Service
+ * - IAM Admin Services
+ * - Group Manager Service
+ *
+ * Clients should use TMultiplexedProtocol with the appropriate service name
+ * to access specific service methods.
+ */
+ string getServiceVersion()
+}
diff --git a/thrift-interface-descriptions/generate-thrift-stubs.sh b/thrift-interface-descriptions/generate-thrift-stubs.sh
index f260875..14fb84d 100755
--- a/thrift-interface-descriptions/generate-thrift-stubs.sh
+++ b/thrift-interface-descriptions/generate-thrift-stubs.sh
@@ -76,6 +76,7 @@
REGISTRY_THRIFT_FILE="${THRIFTDIR}/service-cpis/registry-api.thrift"
SHARING_API_THRIFT_FILE="${THRIFTDIR}/service-cpis/sharing_cpi.thrift"
PROFILE_SERVICE_THRIFT_FILE="${THRIFTDIR}/service-cpis/profile-service-cpi.thrift"
+ AIRAVATA_SERVICE_THRIFT_FILE="${THRIFTDIR}/airavata-service/airavata_service.thrift"
PHP_THRIFT_FILE="${THRIFTDIR}/stubs_php.thrift"
JAVA_THRIFT_FILE="${THRIFTDIR}/stubs_java.thrift"
@@ -196,6 +197,7 @@
generate_component_java_stubs ${REGISTRY_THRIFT_FILE} ${REGISTRY_SRC_DIR}
generate_component_java_stubs ${SHARING_API_THRIFT_FILE} ${SHARING_REGISTRY_SRC_DIR}
generate_component_java_stubs ${PROFILE_SERVICE_THRIFT_FILE} ${PROFILE_SERVICE_SRC_DIR}
+ generate_component_java_stubs ${AIRAVATA_SERVICE_THRIFT_FILE} ${JAVA_SRC_DIR}
echo "Successfully generated all Java stubs (API, CPI, and service)"
}