hu.midori.kosmos.server
Class AbstractKosmosService

java.lang.Object
  extended by hu.midori.kosmos.server.AbstractKosmosService
All Implemented Interfaces:
org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
AbstractJiraServiceImpl, CcServiceImpl, SfServiceImpl, SvnServiceImpl

public abstract class AbstractKosmosService
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware

Each Kosmos service must extend this baseclass. Services are implemented as POJOs.

Version:
$Id$
Author:
Aron Gombas

Field Summary
protected  org.springframework.web.context.WebApplicationContext applicationContext
          Spring web-application context.
protected static int MAX_LIST_SIZE
          Heavy lists will be trimmed to this size or set to -1 if you want to disable trimming.
 
Constructor Summary
AbstractKosmosService()
           
 
Method Summary
protected  void beginStoreSession()
          Must be called before the first file gets stored.
protected  void endStoreSession()
          Must be called after the last file got stored.
protected  java.lang.String getResourceString(java.lang.String baseName, java.lang.String key)
          Returns the localized string resource from the given resource bundle.
 java.util.Date getTimestamp()
          Returns the timestamp when the cache was most recently updated.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setStore(StaticContentStore store)
           
protected  ZoomableImageLocator storeChart(java.lang.String fileName, org.jfree.chart.JFreeChart chart)
          Stores the images generated from the passed chart in 2 resolutions.
protected  java.lang.String storeFile(java.lang.String fileName, java.io.InputStream in)
          Stores the passed stream to an implementation-dependent "storage".
protected  java.util.List trimList(java.util.List data)
          Trims long lists to some limited size to avoid large datasets that would result in huge network transfers and unuseable web pages.
protected  void updateTimestamp()
          Updates the timestamp at service method calls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LIST_SIZE

protected static final int MAX_LIST_SIZE
Heavy lists will be trimmed to this size or set to -1 if you want to disable trimming.

See Also:
trimList(List), Constant Field Values

applicationContext

protected org.springframework.web.context.WebApplicationContext applicationContext
Spring web-application context.

Constructor Detail

AbstractKosmosService

public AbstractKosmosService()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

setStore

public void setStore(StaticContentStore store)

getTimestamp

public java.util.Date getTimestamp()
Returns the timestamp when the cache was most recently updated. This can be invoked only after the service method was called.


updateTimestamp

protected void updateTimestamp()
Updates the timestamp at service method calls.


getResourceString

protected java.lang.String getResourceString(java.lang.String baseName,
                                             java.lang.String key)
Returns the localized string resource from the given resource bundle. For caching, it assumes that only one bundle is used per service. The locale is defined globally for the servlet, not as method parameter.


beginStoreSession

protected void beginStoreSession()
Must be called before the first file gets stored.

See Also:
StaticContentStore

endStoreSession

protected void endStoreSession()
Must be called after the last file got stored.

See Also:
StaticContentStore

storeFile

protected java.lang.String storeFile(java.lang.String fileName,
                                     java.io.InputStream in)
Stores the passed stream to an implementation-dependent "storage".

Returns:
the absolute URL that points to the resulted file.
See Also:
StaticContentStore

storeChart

protected ZoomableImageLocator storeChart(java.lang.String fileName,
                                          org.jfree.chart.JFreeChart chart)
Stores the images generated from the passed chart in 2 resolutions.

Parameters:
fileName - must not contain the file extension.
Returns:
the locator with absolute URLs pointing to the resulted images.
See Also:
storeFile(String, InputStream)

trimList

protected java.util.List trimList(java.util.List data)
Trims long lists to some limited size to avoid large datasets that would result in huge network transfers and unuseable web pages.