com.bigllc.retsiq.simpleclient
Class FileWriterObjectHandler

java.lang.Object
  extended by com.bigllc.retsiq.simpleclient.FileWriterObjectHandler
All Implemented Interfaces:
ObjectResponseHandler
Direct Known Subclasses:
DefaultObjectHandler

public abstract class FileWriterObjectHandler
extends java.lang.Object
implements ObjectResponseHandler

This abstract object response handler writes to files and generates the. file name contentId-objectId.extension. Where the extension is determined by the content type. Super classes should implement getDirectory() and return a File object that the file will be written to.

Author:
Marc G. Smith

Constructor Summary
FileWriterObjectHandler()
           
 
Method Summary
protected abstract  java.io.File getDirectory(java.lang.String contentType, java.lang.String contentId, java.lang.String objectId)
          Implementing super classes should return the directory to write this image to.
 java.lang.String object(java.lang.String contentType, java.lang.String contentId, java.lang.String objectId, java.io.InputStream in)
          This method is called by the getObject method for each object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileWriterObjectHandler

public FileWriterObjectHandler()
Method Detail

getDirectory

protected abstract java.io.File getDirectory(java.lang.String contentType,
                                             java.lang.String contentId,
                                             java.lang.String objectId)
Implementing super classes should return the directory to write this image to.


object

public java.lang.String object(java.lang.String contentType,
                               java.lang.String contentId,
                               java.lang.String objectId,
                               java.io.InputStream in)
                        throws RETSClientException
Description copied from interface: ObjectResponseHandler
This method is called by the getObject method for each object. The handler implementation is responsible for writing the object.

Specified by:
object in interface ObjectResponseHandler
Parameters:
contentType - the content type for the object
contentId - the content id of the object
objectId - the object id of the object
in - the input stream of the object
Returns:
The uri of the persisted object
Throws:
RETSClientException