|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ContentStore
A ContentStore stores the actual content data and is
responsible for managing it.
The store doesn't work with paths, but with content ids. Each id identifies a specific content instance at a certain location and with a certain version number.
Each store is only capable of storing content with certain mime types. The store is optimized for a certain kind of content and will maybe not be able to correctly handle other types.
| Method Summary | ||
|---|---|---|
boolean |
deleteContentData(int id)
Deletes the content data for a certain content id. |
|
String |
getContentForHtml(int id,
ContentInfo info,
ElementSupport element,
String serveContentExitName)
Retrieves a content data representation for use in html. |
|
String |
getContentType(ContentInfo contentInfo)
Generates the HTTP content type that corresponds best to the information in the provided ContentInfo. |
|
Formatter |
getFormatter(MimeType mimeType,
boolean fragment)
Returns a Formatter instance that will be used to load and
to format the content data. |
|
int |
getSize(int id)
Retrieves the size of the content data for a certain content id. |
|
Collection<MimeType> |
getSupportedMimeTypes()
Returns the collection of mime types that the content store supports. |
|
boolean |
hasContentData(int id)
Checks whether content data is available for a certain content id. |
|
boolean |
install()
Installs a content store. |
|
boolean |
remove()
Removes a content store. |
|
void |
serveContentData(ElementSupport element,
int id)
Serves content data for a certain content id through the provided element. |
|
boolean |
storeContentData(int id,
Content content,
ContentTransformer transformer)
Stores the content data for a certain content id. |
|
|
useContentData(int id,
ContentDataUser user)
Use the data of a certain content id. |
|
| Method Detail |
|---|
boolean install()
throws ContentManagerException
true if the installation was successful; or
false if it wasn't.
ContentManagerException - if an unexpected error occurred
boolean remove()
throws ContentManagerException
true if the removal was successful; or
false if it wasn't.
ContentManagerException - if an unexpected error occurredCollection<MimeType> getSupportedMimeTypes()
String getContentType(ContentInfo contentInfo)
ContentInfo.
contentInfo - the content info instance for which the content type
has to be generated
Formatter getFormatter(MimeType mimeType,
boolean fragment)
Formatter instance that will be used to load and
to format the content data.
mimeType - the mime type for which the formatter will be returnedfragment - true if the content that has to be
formatter is a fragment; or
false otherwise
boolean storeContentData(int id,
Content content,
ContentTransformer transformer)
throws ContentManagerException
id - the id of the content whose data will be storedcontent - the content whose data has to be storedtransformer - a transformer that will modify the content data; or
null if the content data should stay intact
true if the storing was successfully; or
false if it wasn't.
ContentManagerException - if an unexpected error occurred
boolean deleteContentData(int id)
throws ContentManagerException
id - the id of the content whose data will be deleted
true if the deletion was successfully; or
false if it wasn't.
ContentManagerException - if an unexpected error occurred
<ResultType> ResultType useContentData(int id,
ContentDataUser user)
throws ContentManagerException
Some content data will only be available during this method call due to their volatile nature (certain streams for instance). Therefore, one has to be careful when trying to move the data that is provided to the content user outside this method. The behaviour is undefined.
id - the id of the content whose data will be useduser - the content user instance that will be called to use
content data
ContentDataUser.useContentData(Object)
returns after its usage
ContentManagerException - if an unexpected error occurred
boolean hasContentData(int id)
throws ContentManagerException
id - the id of the content whose data availability will be checked
true if content data is available; or
false if it isn't.
ContentManagerException - if an expected error occurred
int getSize(int id)
throws ContentManagerException
Note that the result is specific to the data store. For instance, text data could return the number of characters, while image data could return the number of bytes.
id - the id of the content whose data size will be returned
-1 if no data is available for the provided
content id; or
the requested content data size.
ContentManagerException - if an unexpected error occurred
void serveContentData(ElementSupport element,
int id)
throws ContentManagerException
This is intended to take over the complete handling of the request, so no other content should be output and no headers manipulated in the element if this method is called.
element - an active element instanceid - the id of the content whose data will be served
ContentManagerException - if an unexpected error occurred
String getContentForHtml(int id,
ContentInfo info,
ElementSupport element,
String serveContentExitName)
throws ContentManagerException
This is mainly used to integrate content data inside a html document. For instance, html content will be displayed as-is, while image content will cause an image tag to be generated with the correct source URL to serve the image.
id - the id of the content whose data will be displayedinfo - the content info instance for which the html content
has to be generatedelement - an active element instanceserveContentExitName - the exit namet that leads to a ServeContent element. This will
be used to generate URLs for content that can't be directly displayed
in-line.
ContentManagerException - if an unexpected error occurred
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||