de.enough.polish.content.source.impl
Class ResourceContentSource

java.lang.Object
  extended by de.enough.polish.content.source.ContentSource
      extended by de.enough.polish.content.source.impl.ResourceContentSource

public class ResourceContentSource
extends ContentSource

A sample HttpContentSource that receives byte[]

Author:
Andre Schmidt

Field Summary
static String PREFIX
          The prefix for this kind of source
 
Constructor Summary
ResourceContentSource(String id)
          Creates a new resource content source
 
Method Summary
protected  void destroy(StorageReference reference)
          Destroys the content specified by the storage reference
protected  Object load(ContentDescriptor descriptor)
          Load the specified content by the use of the content descriptor.
protected  Object load(StorageReference reference)
          Load the specified content by the use of the storage reference.
protected  Object store(ContentDescriptor descriptor, Object data)
          Stores the specified content
protected  Object[] storeContentAndGetDataSize(ContentDescriptor descriptor, Object data)
          Stores an object and returns a reference to it along with its stored size in one single step.
 
Methods inherited from class de.enough.polish.content.source.ContentSource
addContentTransform, attachSource, clean, clean, destroyContent, detachSource, getFilter, getSize, getStorageIndex, loadContent, loadContent, loadContentData, removeContentTransform, setContentFilter, shutdown, storeContent, sweep, toString, transformContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PREFIX

public static final String PREFIX
The prefix for this kind of source

See Also:
Constant Field Values
Constructor Detail

ResourceContentSource

public ResourceContentSource(String id)
Creates a new resource content source

Parameters:
id - the unique ID of this source
Method Detail

destroy

protected void destroy(StorageReference reference)
                throws IOException
Description copied from class: ContentSource
Destroys the content specified by the storage reference

Specified by:
destroy in class ContentSource
Parameters:
reference - the storage reference
Throws:
IOException - if an error occurs (obviously)

load

protected Object load(ContentDescriptor descriptor)
               throws IOException
Description copied from class: ContentSource
Load the specified content by the use of the content descriptor.

Specified by:
load in class ContentSource
Parameters:
descriptor - the content descriptor
Returns:
the loaded data
Throws:
IOException - if an error occurs (obviously)

load

protected Object load(StorageReference reference)
               throws IOException
Description copied from class: ContentSource
Load the specified content by the use of the storage reference.

Specified by:
load in class ContentSource
Parameters:
reference - the storage reference
Returns:
the loaded data
Throws:
IOException - if an error occurs (obviously)

store

protected Object store(ContentDescriptor descriptor,
                       Object data)
                throws IOException
Description copied from class: ContentSource
Stores the specified content

Specified by:
store in class ContentSource
Parameters:
descriptor - the content descriptor
data - the data
Returns:
the reference to the stored data
Throws:
IOException - if an error occurs (obviously)

storeContentAndGetDataSize

protected Object[] storeContentAndGetDataSize(ContentDescriptor descriptor,
                                              Object data)
                                       throws IOException
Description copied from class: ContentSource
Stores an object and returns a reference to it along with its stored size in one single step. Storages that support this should overwrite this method. Storages that do not support this should leave this method untouched.

Specified by:
storeContentAndGetDataSize in class ContentSource
Parameters:
descriptor - the content descriptor
data - the data that needs to be stored
Returns:
an Object [], the first element is an Integer object containing the stored object's data size, the second element is a reference to the stored object
Throws:
IOException