use of org.apache.airavata.model.workspace.Gateway in project airavata by apache.
the class AiravataServerHandler method getGateway.
@Override
@SecurityCheck
public Gateway getGateway(AuthzToken authzToken, String gatewayId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
RegistryService.Client regClient = registryClientPool.getResource();
try {
Gateway result = regClient.getGateway(gatewayId);
registryClientPool.returnResource(regClient);
return result;
} catch (Exception e) {
logger.error("Error while getting the gateway", e);
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;
}
}
use of org.apache.airavata.model.workspace.Gateway in project airavata by apache.
the class CreateLaunchBES method createGateway.
public static void createGateway() {
try {
Gateway gateway = new Gateway();
gateway.setGatewayId("testGatewayId2");
gateway.setGatewayName("testGateway2");
gatewayId = airavataClient.addGateway(new AuthzToken(""), gateway);
System.out.println(gatewayId);
} catch (AiravataSystemException e) {
e.printStackTrace();
} catch (InvalidRequestException e) {
e.printStackTrace();
} catch (AiravataClientException e) {
e.printStackTrace();
} catch (TException e) {
e.printStackTrace();
}
}
use of org.apache.airavata.model.workspace.Gateway in project airavata by apache.
the class CreateLaunchBES method getGateway.
public static void getGateway(String gatewayId) {
try {
Gateway gateway = airavataClient.getGateway(new AuthzToken(""), gatewayId);
gateway.setDomain("testDomain");
airavataClient.updateGateway(new AuthzToken(""), gatewayId, gateway);
List<Gateway> allGateways = airavataClient.getAllGateways(new AuthzToken(""));
System.out.println(allGateways.size());
if (airavataClient.isGatewayExist(new AuthzToken(""), gatewayId)) {
Gateway gateway1 = airavataClient.getGateway(new AuthzToken(""), gatewayId);
System.out.println(gateway1.getGatewayName());
}
boolean b = airavataClient.deleteGateway(new AuthzToken(""), "testGatewayId2");
System.out.println(b);
} catch (AiravataSystemException e) {
e.printStackTrace();
} catch (InvalidRequestException e) {
e.printStackTrace();
} catch (AiravataClientException e) {
e.printStackTrace();
} catch (TException e) {
e.printStackTrace();
}
}
use of org.apache.airavata.model.workspace.Gateway in project airavata by apache.
the class CreateLaunchExperiment method getGateway.
public static void getGateway(String gatewayId) {
try {
Gateway gateway = airavataClient.getGateway(new AuthzToken(""), gatewayId);
gateway.setDomain("testDomain");
airavataClient.updateGateway(new AuthzToken(""), gatewayId, gateway);
List<Gateway> allGateways = airavataClient.getAllGateways(new AuthzToken(""));
System.out.println(allGateways.size());
if (airavataClient.isGatewayExist(new AuthzToken(""), gatewayId)) {
Gateway gateway1 = airavataClient.getGateway(new AuthzToken(""), gatewayId);
System.out.println(gateway1.getGatewayName());
}
boolean b = airavataClient.deleteGateway(new AuthzToken(""), "testGatewayId2");
System.out.println(b);
} catch (AiravataSystemException e) {
e.printStackTrace();
} catch (InvalidRequestException e) {
e.printStackTrace();
} catch (AiravataClientException e) {
e.printStackTrace();
} catch (TException e) {
e.printStackTrace();
}
}
use of org.apache.airavata.model.workspace.Gateway in project airavata by apache.
the class TenantProfileServiceHandler method deleteGateway.
@Override
@SecurityCheck
public boolean deleteGateway(AuthzToken authzToken, String airavataInternalGatewayId, String gatewayId) throws TenantProfileServiceException, AuthorizationException, TException {
try {
logger.debug("Deleting Airavata gateway-profile with ID: " + gatewayId + "Internal ID: " + airavataInternalGatewayId);
boolean deleteSuccess = tenantProfileRepository.delete(airavataInternalGatewayId);
if (deleteSuccess) {
// delete tenant at end-places
ProfileServiceUtils.getDbEventPublisher().publish(ProfileServiceUtils.getDBEventMessageContext(EntityType.TENANT, CrudType.DELETE, // approvalstatus is not used for delete, hence set dummy value
new Gateway(gatewayId, GatewayApprovalStatus.DEACTIVATED)), DBEventManagerConstants.getRoutingKey(DBEventService.DB_EVENT.toString()));
}
return deleteSuccess;
} catch (Exception ex) {
logger.error("Error deleting gateway-profile, reason: " + ex.getMessage(), ex);
TenantProfileServiceException exception = new TenantProfileServiceException();
exception.setMessage("Error deleting gateway-profile, reason: " + ex.getMessage());
throw exception;
}
}
Aggregations