Search in sources :

Example 91 with AuthzToken

use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.

the class RegisterUS3Application method registerApplicationDeployment.

public static void registerApplicationDeployment() {
    try {
        System.out.println("#### Registering Application Deployments on Stampede #### \n");
        // Register Stampede
        String ultascanStamplede = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(ultrascanModuleId, stampedeResourceId, "/home1/01623/us3/bin/us_mpi_analysis", ApplicationParallelismType.MPI, "ultrascan application", null, null, null));
        System.out.println("Ultrascan on stampede deployment Id " + ultascanStamplede);
        String ultascanTrestles = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(ultrascanModuleId, trestlesResourceId, "/home/us3/trestles/bin/us_mpi_analysis", ApplicationParallelismType.MPI, "ultrascan application", null, null, null));
        System.out.println("Ultrascan on trestles deployment Id " + ultascanTrestles);
        String ultascanLonestar = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(ultrascanModuleId, lonestarResourceId, "/home1/01623/us3/bin/us_mpi_analysis", ApplicationParallelismType.MPI, "ultrascan application", null, null, null));
        System.out.println("Ultrascan on lonestar deployment Id " + ultascanLonestar);
        String ultascanAlamo = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(ultrascanModuleId, alamoResourceId, "/home/us3/bin/us_mpi_analysis.sh", ApplicationParallelismType.MPI, "ultrascan application", null, null, null));
        System.out.println("Ultrascan on alamo deployment Id " + ultascanAlamo);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : AuthzToken(org.apache.airavata.model.security.AuthzToken) TException(org.apache.thrift.TException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException)

Example 92 with AuthzToken

use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.

the class MigrationManager method migrateUserProfilesToAiravata.

/* Method used to migrate User profiles to Airavata DB by making a call to User profile thrift Service */
private boolean migrateUserProfilesToAiravata(List<UserProfileDAO> ISProfileList) throws TException, ApplicationSettingsException {
    System.out.println("Initiating migration to Airavata internal DB ...");
    UserProfileService.Client client = ProfileServiceClientFactory.createUserProfileServiceClient(profileServiceServerHost, profileServiceServerPort);
    UserProfile airavataUserProfile = new UserProfile();
    // Here are the data associations...
    for (UserProfileDAO ISProfile : ISProfileList) {
        airavataUserProfile.setAiravataInternalUserId(ISProfile.getUserName() + "@" + ISProfile.getGatewayID());
        airavataUserProfile.setFirstName(ISProfile.getFirstName());
        airavataUserProfile.setLastName(ISProfile.getLastName());
        airavataUserProfile.setUserId(ISProfile.getUserName());
        airavataUserProfile.setGatewayId(ISProfile.getGatewayID());
        List<String> emails = new ArrayList<String>();
        emails.add(ISProfile.getEmail());
        airavataUserProfile.setEmails(emails);
        airavataUserProfile.setHomeOrganization(ISProfile.getOrganization());
        airavataUserProfile.setPhones(ISProfile.getPhones());
        airavataUserProfile.setCountry(ISProfile.getCountry());
        airavataUserProfile.setCreationTime(new Date().getTime());
        airavataUserProfile.setLastAccessTime(new Date().getTime());
        airavataUserProfile.setValidUntil(-1);
        airavataUserProfile.setState(Status.ACTIVE);
        // TODO: fix authtzToken, for now we are using empty token, but need to properly populate claims map
        AuthzToken authzToken = new AuthzToken("dummy_token");
        Map<String, String> claimsMap = new HashMap<>();
        claimsMap.put(Constants.USER_NAME, ISProfile.getUserName());
        claimsMap.put(Constants.GATEWAY_ID, ISProfile.getGatewayID());
        authzToken.setClaimsMap(claimsMap);
        client.addUserProfile(authzToken, airavataUserProfile);
    }
    return false;
}
Also used : UserProfile(org.apache.airavata.model.user.UserProfile) UserProfileService(org.apache.airavata.service.profile.user.cpi.UserProfileService) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Aggregations

AuthzToken (org.apache.airavata.model.security.AuthzToken)92 TException (org.apache.thrift.TException)71 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)46 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)44 ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)33 UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)28 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)28 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)15 Project (org.apache.airavata.model.workspace.Project)13 ArrayList (java.util.ArrayList)12 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)8 HashMap (java.util.HashMap)7 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)7 Gateway (org.apache.airavata.model.workspace.Gateway)6 CommandObject (org.apache.airavata.model.appcatalog.appdeployment.CommandObject)5 SCPDataMovement (org.apache.airavata.model.data.movement.SCPDataMovement)5 ComputeResourcePreference (org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)4 GatewayResourceProfile (org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile)4 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)2 JobSubmissionInterface (org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface)2