ushaheu commented on issue #92:
URL: https://github.com/apache/airavata-mft/issues/92#issuecomment-1478523250

   Hi @DImuthuUpe thanks once again for your support.
   I have written a small application for a local transfer on my laptop from 
one directory to another. I first of all created the storage entry for local as 
commented in my code. Then I used the sample you shared. However, the file was 
not transferred as expected.
   
   `public class APIManager {
       public static void main(String[] args) throws InterruptedException {
           MFTApiClient mftApiClient = 
MFTApiClient.MFTApiClientBuilder.newBuilder()
                   .withResourceServicePort(7003)
                   .withSecretServicePort(7003)
                   .withTransferServicePort(7003).build();
   
           
//mftApiClient.getStorageServiceClient().local().createLocalStorage(LocalStorageCreateRequest.newBuilder().setStorageId(UUID.randomUUID().toString()).setName("Mac
 Local").build());
           String s3StorageId = "b6336695-7127-4c84-9ea4-c6a157032f32";
           String scpStorageId = "50292023-f4ff-496f-8382-e5c20632244e";
           String localSourcePath = 
"/Users/ushahembaukange/Downloads/visa-clearing-2021-09-03-1731c3c2-febe-43ae-b832-f91d043fc173.ecf";
           String localDestinationPath = 
"/Users/ushahembaukange/Documents/filetransfer/visa-clearing-2021-09-03-1731c3c2-febe-43ae-b832-f91d043fc173.ecf";
   
   
           SecretForStorage scpSecret = mftApiClient.getStorageServiceClient()
                   .common()
                   
.getSecretForStorage(SecretForStorageGetRequest.newBuilder().setStorageId(scpStorageId).build());
   
           SecretForStorage s3Secret = mftApiClient.getStorageServiceClient()
                   .common()
                   
.getSecretForStorage(SecretForStorageGetRequest.newBuilder().setStorageId(s3StorageId).build());
   
           EndpointPaths endpoints = EndpointPaths.newBuilder()
                   .setSourcePath(localSourcePath)
                   .setDestinationPath(localDestinationPath).build();
   
           TransferApiResponse transferResponse = 
mftApiClient.getTransferClient().submitTransfer(TransferApiRequest.newBuilder()
                   .setSourceSecretId(scpSecret.getSecretId())
                   
.setSourceStorageId(scpStorageId).setDestinationSecretId(s3Secret.getSecretId())
                   
.setDestinationStorageId(s3StorageId).addEndpointPaths(endpoints).build()); // 
You can add many endpointpaths into one request
   
           String transferId = transferResponse.getTransferId();
           System.out.println("Transfer Id: " + transferId);
   
           // Monitoring transfer progress. You can write your own logic to do 
this
           for (int i = 0; i < 10; i ++) {
               TransferStateSummaryResponse transferStateSummary = 
mftApiClient.getTransferClient()
                       .getTransferStateSummary(
                               
TransferStateApiRequest.newBuilder().setTransferId(transferId).build());
               System.out.println("Transfer state: " + 
transferStateSummary.getPercentage());
               Thread.sleep(1000);
           }
       }
   }`
   
   Kindly find the logs from `mft log`
   
   <img width="1438" alt="Screenshot 2023-03-21 at 21 07 19" 
src="https://user-images.githubusercontent.com/20520399/226729876-907c6b03-b181-4314-ad99-7554ed69a647.png";>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to