Skip to content
Permalink
Browse files
Merge pull request #89 from isururanawaka/master
Airavata datalake service
  • Loading branch information
isururanawaka committed May 10, 2022
2 parents 1c9c7eb + fc34360 commit 32c841870ced1f80c217eab43d85c5902f7f1617
Showing 6 changed files with 300 additions and 301 deletions.
@@ -17,7 +17,6 @@

package org.apache.airavata.datalake.orchestrator.handlers.mft;

import com.google.protobuf.Struct;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import org.apache.airavata.datalake.drms.DRMSServiceAuthToken;
@@ -29,11 +28,12 @@
import org.apache.airavata.mft.api.service.MFTApiServiceGrpc;
import org.apache.airavata.mft.common.AuthToken;
import org.apache.airavata.mft.common.UserTokenAuth;
import org.apache.custos.clients.CustosClientProvider;
import org.apache.custos.identity.management.client.IdentityManagementClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@@ -108,10 +108,10 @@ public MFTDownloadResponse mftDownload(@RequestHeader("Authorization") String au

StoragePreferenceSearchResponse stoPrefResults = stoPrefClient
.searchStoragePreference(StoragePreferenceSearchRequest.newBuilder()
.setAuthToken(authToken)
.addQueries(StoragePreferenceSearchQuery.newBuilder()
.setField("storageId")
.setValue(storageId).build()).build());
.setAuthToken(authToken)
.addQueries(StoragePreferenceSearchQuery.newBuilder()
.setField("storageId")
.setValue(storageId).build()).build());

List<AnyStoragePreference> storagesPreferenceList = stoPrefResults.getStoragesPreferenceList();

@@ -148,21 +148,5 @@ public MFTDownloadResponse mftDownload(@RequestHeader("Authorization") String au
return new MFTDownloadResponse().setUrl(downloadResponse.getUrl()).setAgentId(downloadResponse.getTargetAgent());
}

private static String getAccessToken() {
try {

CustosClientProvider custosClientProvider = new CustosClientProvider.Builder().setServerHost("custos.scigap.org")
.setServerPort(31499)
.setClientId("custos-ii8g0cfwsz6ruwezykn9-10002640")
.setClientSec("OxXECszt9dL4lHJQyL444UOU0lKN317D51ez067R").build();

IdentityManagementClient identityManagementClient = custosClientProvider.getIdentityManagementClient();
Struct struct = identityManagementClient.getToken(null, null, "isjarana", "emcadmin@1", null, "password");
return struct.getFieldsMap().get("access_token").getStringValue();
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}

}
@@ -277,6 +277,9 @@ public static void main(String ar[]) {
// resourceServiceBlockingStub.fetchResourceMetadata(addResourceMetadataRequest);





} catch (Exception ex) {
ex.printStackTrace();
}

0 comments on commit 32c8418

Please sign in to comment.