Search in sources :

Example 16 with Gateway

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;
    }
}
Also used : Gateway(org.apache.airavata.model.workspace.Gateway) RegistryService(org.apache.airavata.registry.api.RegistryService) SharingRegistryService(org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) CredentialStoreException(org.apache.airavata.credential.store.exception.CredentialStoreException) AiravataException(org.apache.airavata.common.exception.AiravataException) TException(org.apache.thrift.TException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) SecurityCheck(org.apache.airavata.service.security.interceptor.SecurityCheck)

Example 17 with Gateway

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();
    }
}
Also used : TException(org.apache.thrift.TException) Gateway(org.apache.airavata.model.workspace.Gateway) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 18 with Gateway

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();
    }
}
Also used : TException(org.apache.thrift.TException) Gateway(org.apache.airavata.model.workspace.Gateway) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 19 with Gateway

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();
    }
}
Also used : TException(org.apache.thrift.TException) Gateway(org.apache.airavata.model.workspace.Gateway) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 20 with Gateway

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;
    }
}
Also used : TenantProfileServiceException(org.apache.airavata.service.profile.tenant.cpi.exception.TenantProfileServiceException) Gateway(org.apache.airavata.model.workspace.Gateway) CredentialStoreException(org.apache.airavata.credential.store.exception.CredentialStoreException) TenantProfileServiceException(org.apache.airavata.service.profile.tenant.cpi.exception.TenantProfileServiceException) TException(org.apache.thrift.TException) AuthorizationException(org.apache.airavata.model.error.AuthorizationException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) SecurityCheck(org.apache.airavata.service.security.interceptor.SecurityCheck)

Aggregations

Gateway (org.apache.airavata.model.workspace.Gateway)24 TException (org.apache.thrift.TException)13 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)8 AuthzToken (org.apache.airavata.model.security.AuthzToken)6 SecurityCheck (org.apache.airavata.service.security.interceptor.SecurityCheck)4 HashMap (java.util.HashMap)3 AiravataException (org.apache.airavata.common.exception.AiravataException)3 CredentialStoreException (org.apache.airavata.credential.store.exception.CredentialStoreException)3 GatewayResourceProfile (org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile)3 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)3 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)3 RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)3 Airavata (org.apache.airavata.api.Airavata)2 CredentialStoreException (org.apache.airavata.credential.store.store.CredentialStoreException)2 PasswordCredential (org.apache.airavata.model.credential.store.PasswordCredential)2 DBEventMessage (org.apache.airavata.model.dbevent.DBEventMessage)2 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)2 AuthorizationException (org.apache.airavata.model.error.AuthorizationException)2 DuplicateEntryException (org.apache.airavata.model.error.DuplicateEntryException)2 UserProfile (org.apache.airavata.model.user.UserProfile)2