Package eu.mosaic_cloud.platform.interop.idl.IdlCommon

Examples of eu.mosaic_cloud.platform.interop.idl.IdlCommon.CompletionToken


  }

  @Override
  public CallbackCompletion<Void> makeDirectory(String dirNameFullPath) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Making `%s` (with request token `%s`)...", dirNameFullPath, token.getMessageId ());
   
    final DFSPayloads.MakeDir.Builder makeDirBuilder = DFSPayloads.MakeDir.newBuilder();
    makeDirBuilder.setToken(token);
    makeDirBuilder.setFullPath(dirNameFullPath);
    final Message message = new Message(DFSMessage.MKDIR, makeDirBuilder.build());
View Full Code Here


 
  @Override
  @SuppressWarnings ("unchecked")
  public CallbackCompletion<List<LsElement>> listDirectory(String path) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Listing `%s` (with request token `%s`)...", path, token.getMessageId ());
   
    final DFSPayloads.ListDir.Builder listDirBuilder = DFSPayloads.ListDir.newBuilder();
    listDirBuilder.setToken(token);
    listDirBuilder.setFullPath(path);
    final Message message = new Message(DFSMessage.LIST, listDirBuilder.build());
View Full Code Here

  @Override
  public abstract CallbackCompletion<TDfsFileConnector> openFile(String path, DfsModes mode);
 
  protected CallbackCompletion<TDfsFileConnector> openFile(String path, DfsModes mode, Class<TDfsFileConnector> connectorClass) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Opening file: `%s` (with request token `%s`)...", path, token.getMessageId ());

    final DFSPayloads.OpenFile.Builder openFileBuilder = DFSPayloads.OpenFile.newBuilder();
    openFileBuilder.setToken(token);
    openFileBuilder.setFullPath(path);
    openFileBuilder.setMode(translateOpenMode(mode));
View Full Code Here

    return null;
  }

  public CallbackCompletion<Void> write(String fileHandlerUUID, byte[] data) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Writing data to fileHandler: `%s` (with request token `%s`)...", fileHandlerUUID, token.getMessageId ());
   
    final DFSPayloads.WriteFile.Builder writeFileBuilder = DFSPayloads.WriteFile.newBuilder();
    writeFileBuilder.setToken(token);
    writeFileBuilder.setFileHandler(fileHandlerUUID);
    writeFileBuilder.setData(ByteString.copyFrom(data));
View Full Code Here

    return (this.sendRequest(message, token, Void.class));
  }

  public CallbackCompletion<byte[]> read(String fileHandlerUUID, long numOfBytes) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Reading data from fileHandler: `%s` (with request token `%s`)...", fileHandlerUUID, token.getMessageId ());
   
    final DFSPayloads.ReadFile.Builder readFileBuilder = DFSPayloads.ReadFile.newBuilder();
    readFileBuilder.setToken(token);
    readFileBuilder.setFileHandler(fileHandlerUUID);
    readFileBuilder.setNumBytes(numOfBytes);
View Full Code Here

    return (this.sendRequest(message, token, byte[].class)); //TODO check if this is okay
  }

  public CallbackCompletion<Void> close(String fileHandlerUUID) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Closing fileHandler: `%s` (with request token `%s`)...", fileHandlerUUID, token.getMessageId ());

    final DFSPayloads.CloseFile.Builder closeFileBuilder = DFSPayloads.CloseFile.newBuilder();
    closeFileBuilder.setToken(token);
    closeFileBuilder.setFileHandler(fileHandlerUUID);
   
View Full Code Here

    final DFSHandlerMessage dfsMsg = (DFSHandlerMessage)message.specification;
   
    switch(dfsMsg) {
      case SUCCESS: {
        final SuccessResponse successPayload = (SuccessResponse)message.payload;
        final CompletionToken token = successPayload.getToken();
        this.transcript.traceDebugging ("processing the success response for pending request with token `%s`...", token.getMessageId ());
        if(successPayload.getSuccessful()){
          this.pendingRequests.succeed(token.getMessageId(), null);
        }else {
          this.pendingRequests.fail(token.getMessageId()new Exception ("I/O exception")); //TODO err message?
        }
      }
        break;
      case BYTES: {
        final FileRead fileReadPayload = (FileRead)message.payload;
        final CompletionToken token = fileReadPayload.getToken();
        this.transcript.traceDebugging ("processing the BYTE response for pending request with token `%s`...", token.getMessageId ());
        this.pendingRequests.succeed(token.getMessageId(), fileReadPayload.getData().toByteArray());
      }
        break;
      default: {
        this.transcript.traceWarning ("processing unexpected message of type `%s`; ignoring...", message.specification);
      }
View Full Code Here

    final DFSMessage dfsMsg = (DFSMessage)message.specification;
   
    switch(dfsMsg) {
      case ERROR: {
        final IdlCommon.Error errorPayload = (Error)message.payload;
        final CompletionToken token = errorPayload.getToken();
        this.transcript.traceDebugging ("processing the failure (error) response for pending request with token `%s` with message `%s`...", token.getMessageId (), errorPayload.getErrorMessage ());
        this.pendingRequests.fail(token.getMessageId()new Exception (errorPayload.getErrorMessage ()));
      }
        break;
      case SUCCESS: {
        final SuccessResponse successPayload = (SuccessResponse)message.payload;
        final CompletionToken token = successPayload.getToken();
        this.transcript.traceDebugging ("processing the success response for pending request with token `%s`...", token.getMessageId ());
        if(successPayload.getSuccessful()){
          this.pendingRequests.succeed(token.getMessageId(), null);
        }else {
          this.pendingRequests.fail(token.getMessageId()new Exception ("I/O exception")); //TODO err message?
        }
      }
        break;
      case LISTING: {
        final ListResult listResultPayload = (ListResult)message.payload;
        final CompletionToken token = listResultPayload.getToken();
        this.transcript.traceDebugging ("processing the list response for pending request with token `%s`...", token.getMessageId ());
       
        List<LsElement> list = getLsResult(listResultPayload);
       
        this.pendingRequests.succeed(token.getMessageId(), list);
      }
        break;
      case HANDLER: {
        receivedHandlerRequest(message);
      }
View Full Code Here

  }
 
  protected void receivedHandlerRequest(Message message){
    final FileHandlerResponse fileHandlerResponsePayload = (FileHandlerResponse)message.payload;
    final CompletionToken token = fileHandlerResponsePayload.getToken();
    this.transcript.traceDebugging ("processing the FileHandler response for pending request with token `%s`...", token.getMessageId ());
   
    TDfsFileConnector dfsFileConnector = this.createFileConnector (fileHandlerResponsePayload.getFileHandler());
   
    this.pendingRequests.succeed(token.getMessageId(), dfsFileConnector);
  }
View Full Code Here

 
  @Override
  public CallbackCompletion<Void> copyFile(String sourceFullPath,
      String destinationFullPath) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Copying `%s` to `%s`(with request token `%s`)...",
        sourceFullPath, destinationFullPath, token.getMessageId ());
   
    final DFSPayloads.CopyFile.Builder copyFileBuilder = DFSPayloads.CopyFile.newBuilder();
    copyFileBuilder.setToken(token);
    copyFileBuilder.setFromPath(sourceFullPath);
    copyFileBuilder.setToPath(destinationFullPath);
View Full Code Here

TOP

Related Classes of eu.mosaic_cloud.platform.interop.idl.IdlCommon.CompletionToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.