com.uwyn.rife.cmf.dam.contentstores
Class DatabaseRawStore

java.lang.Object
  extended by com.uwyn.rife.database.DbQueryManager
      extended by com.uwyn.rife.cmf.dam.contentstores.DatabaseRawStore
All Implemented Interfaces:
ContentStore, Cloneable

public abstract class DatabaseRawStore
extends DbQueryManager
implements ContentStore


Constructor Summary
DatabaseRawStore(Datasource datasource)
           
 
Method Summary
protected  boolean _deleteContentData(Delete deleteContentInfo, Delete deleteContentChunk, int id)
           
protected  int _getSize(Select retrieveSize, int id)
           
protected  boolean _hasContentData(Select hasContentData, int id)
           
protected  boolean _install(CreateTable createTableContentInfo, CreateTable createTableContentChunk)
           
protected  boolean _remove(DropTable dropTableContentInfo, DropTable dropTableContentChunk)
           
protected  void _serveContentData(Select retrieveContentChunks, ElementSupport element, int id)
           
protected  boolean _storeContentData(Insert storeContentInfo, Insert storeContentChunk, int id, Content content, ContentTransformer transformer)
           
protected
<ResultType>
ResultType
_useContentData(Select retrieveContentChunks, int id, ContentDataUser user)
           
protected  void addMimeType(MimeType mimeType)
           
 String getContentForHtml(int id, ContentInfo info, ElementSupport element, String serveContentExitName)
          Retrieves a content data representation for use in html.
protected  String getContentSizeColumnName()
           
 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.
protected  DbPreparedStatement getStreamPreparedStatement(Query query, DbConnection connection)
           
 Collection<MimeType> getSupportedMimeTypes()
          Returns the collection of mime types that the content store supports.
protected  void serveChunks(DbResultSet resultset, OutputStream os, int size)
           
protected  int storeChunks(Insert storeContentChunk, int id, InputStream data)
           
protected  int storeChunksNoStream(Insert storeContentChunk, int id, InputStream data)
           
 
Methods inherited from class com.uwyn.rife.database.DbQueryManager
clone, executeFetchAll, executeFetchAll, executeFetchAllBeans, executeFetchAllBeans, executeFetchFirst, executeFetchFirst, executeFetchFirstBean, executeFetchFirstBean, executeGetFirstBoolean, executeGetFirstBoolean, executeGetFirstByte, executeGetFirstByte, executeGetFirstBytes, executeGetFirstBytes, executeGetFirstDate, executeGetFirstDate, executeGetFirstDate, executeGetFirstDate, executeGetFirstDouble, executeGetFirstDouble, executeGetFirstFloat, executeGetFirstFloat, executeGetFirstInt, executeGetFirstInt, executeGetFirstLong, executeGetFirstLong, executeGetFirstShort, executeGetFirstShort, executeGetFirstString, executeGetFirstString, executeGetFirstTime, executeGetFirstTime, executeGetFirstTime, executeGetFirstTime, executeGetFirstTimestamp, executeGetFirstTimestamp, executeGetFirstTimestamp, executeGetFirstTimestamp, executeHasResultRows, executeHasResultRows, executeQuery, executeQuery, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUseFirstAsciiStream, executeUseFirstAsciiStream, executeUseFirstBinaryStream, executeUseFirstBinaryStream, executeUseFirstCharacterStream, executeUseFirstCharacterStream, fetch, fetch, fetchAll, getConnection, getDatasource, inTransaction, reserveConnection
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.uwyn.rife.cmf.dam.ContentStore
deleteContentData, getSize, hasContentData, install, remove, serveContentData, storeContentData, useContentData
 

Constructor Detail

DatabaseRawStore

public DatabaseRawStore(Datasource datasource)
Method Detail

addMimeType

protected void addMimeType(MimeType mimeType)

getSupportedMimeTypes

public Collection<MimeType> getSupportedMimeTypes()
Description copied from interface: ContentStore
Returns the collection of mime types that the content store supports.

Specified by:
getSupportedMimeTypes in interface ContentStore
Returns:
the collection of supported mime types

getContentType

public String getContentType(ContentInfo contentInfo)
Description copied from interface: ContentStore
Generates the HTTP content type that corresponds best to the information in the provided ContentInfo.

Specified by:
getContentType in interface ContentStore
Parameters:
contentInfo - the content info instance for which the content type has to be generated
Returns:
the generated content type

getFormatter

public Formatter getFormatter(MimeType mimeType,
                              boolean fragment)
Description copied from interface: ContentStore
Returns a Formatter instance that will be used to load and to format the content data.

Specified by:
getFormatter in interface ContentStore
Parameters:
mimeType - the mime type for which the formatter will be returned
fragment - true if the content that has to be formatter is a fragment; or

false otherwise

Returns:
the corresponding formatter

getContentForHtml

public String getContentForHtml(int id,
                                ContentInfo info,
                                ElementSupport element,
                                String serveContentExitName)
                         throws ContentManagerException
Description copied from interface: ContentStore
Retrieves a content data representation for use in html.

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.

Specified by:
getContentForHtml in interface ContentStore
Parameters:
id - the id of the content whose data will be displayed
info - the content info instance for which the html content has to be generated
element - an active element instance
serveContentExitName - 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.
Returns:
the html content representation
Throws:
ContentManagerException - if an unexpected error occurred

_install

protected boolean _install(CreateTable createTableContentInfo,
                           CreateTable createTableContentChunk)
                    throws ContentManagerException
Throws:
ContentManagerException

_remove

protected boolean _remove(DropTable dropTableContentInfo,
                          DropTable dropTableContentChunk)
                   throws ContentManagerException
Throws:
ContentManagerException

_deleteContentData

protected boolean _deleteContentData(Delete deleteContentInfo,
                                     Delete deleteContentChunk,
                                     int id)
                              throws ContentManagerException
Throws:
ContentManagerException

_getSize

protected int _getSize(Select retrieveSize,
                       int id)
                throws ContentManagerException
Throws:
ContentManagerException

_hasContentData

protected boolean _hasContentData(Select hasContentData,
                                  int id)
                           throws ContentManagerException
Throws:
ContentManagerException

getContentSizeColumnName

protected String getContentSizeColumnName()

_storeContentData

protected boolean _storeContentData(Insert storeContentInfo,
                                    Insert storeContentChunk,
                                    int id,
                                    Content content,
                                    ContentTransformer transformer)
                             throws ContentManagerException
Throws:
ContentManagerException

storeChunks

protected int storeChunks(Insert storeContentChunk,
                          int id,
                          InputStream data)
                   throws IOException
Throws:
IOException

storeChunksNoStream

protected int storeChunksNoStream(Insert storeContentChunk,
                                  int id,
                                  InputStream data)
                           throws IOException
Throws:
IOException

_useContentData

protected <ResultType> ResultType _useContentData(Select retrieveContentChunks,
                                                  int id,
                                                  ContentDataUser user)
                              throws ContentManagerException
Throws:
ContentManagerException

getStreamPreparedStatement

protected DbPreparedStatement getStreamPreparedStatement(Query query,
                                                         DbConnection connection)

_serveContentData

protected void _serveContentData(Select retrieveContentChunks,
                                 ElementSupport element,
                                 int id)
                          throws ContentManagerException
Throws:
ContentManagerException

serveChunks

protected void serveChunks(DbResultSet resultset,
                           OutputStream os,
                           int size)
                    throws SQLException,
                           IOException
Throws:
SQLException
IOException


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.