com.bigdata.service
Class ResourceService.ReadResourceTask

java.lang.Object
  extended by com.bigdata.service.ResourceService.FetchResourceTask<UUID,File>
      extended by com.bigdata.service.ResourceService.ReadResourceTask
All Implemented Interfaces:
Callable<File>
Enclosing class:
ResourceService

public static class ResourceService.ReadResourceTask
extends ResourceService.FetchResourceTask<UUID,File>

Task sends a request for a file's data and then receives the data onto a local file.

TODO:
Receive file's data using NIO to transfer from a FileChannel to the caller using a SocketChannel.

Field Summary
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
ResourceService.ReadResourceTask(InetSocketAddress addr, UUID uuid, File file)
           
 
Method Summary
 File call()
          Return the File on which the resource was written.
 UUID logId()
          The logical identifier for the resource.
 File logResource()
          The resource.
 
Methods inherited from class com.bigdata.service.ResourceService.FetchResourceTask
transfer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
Constructor Detail

ResourceService.ReadResourceTask

public ResourceService.ReadResourceTask(InetSocketAddress addr,
                                        UUID uuid,
                                        File file)
Parameters:
addr - The Internet address and port at which the service from which the resource will be read is accepting connections.
port - The port at which to connect to the service from which the resource will be read.
uuid - The UUID which identifies the desired resource.
file - The local file on which the received data will be written. The file may exist but if it exists then it must be empty.
Method Detail

logId

public UUID logId()
Description copied from class: ResourceService.FetchResourceTask
The logical identifier for the resource.


logResource

public File logResource()
Description copied from class: ResourceService.FetchResourceTask
The resource.


call

public File call()
          throws Exception
Return the File on which the resource was written. If the operation fails, then the caller is responsible deciding whether or not the File specified to the constructor needs to be deleted.

Throws:
IOException - if the file exists and is not empty.
IOException - if another process has a lock on the file.
Exception


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.