|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jxcell.server.ChartServerComponent
ChartServerComponent is a server based chart producing engine. This class handles image generation, image caching and resource management. There should be only one instance of this class per ServletContext
Constructor Summary | |
ChartServerComponent()
Creates a new instance of image server component with properties initialized from the configuration file |
|
ChartServerComponent(JcImageServer icimageserver)
Internal constructor |
Method Summary | |
void |
destroy()
Destroys the server component and all images stored in cache. |
void |
finalize()
|
void |
gc()
Runs the garbage collector that removes the expired images from memory or destroys the files. |
byte[] |
getBytes(ChartDescription chartDescription)
Returns the actual bytes of the image based on its description. |
byte[] |
getCachedBuffer(java.lang.String guid)
Returns the actual bytes of the image based on the unique image's id. |
java.lang.String |
getCachedImageMap(java.lang.String guid)
Returns image map based on the unique image's id. |
static ChartServerComponent |
getDefaultInstance(ServletContext servletcontext)
Returns server component instance for the servlet context. |
java.lang.String |
getHtmlReport()
Returns a brief description of the component status in HTML format suitable for displaying in a browser |
int |
getImageCount()
Returns the number of the currently cached images |
java.lang.String |
getImageID(ChartDescription chartDescription)
Returns a unique image ID for the image description. |
java.lang.String |
getImageTag(ChartDescription chartDescription,
java.lang.String dsc)
Returns |
java.lang.String |
getImageTag(ChartDescription chartDescription,
java.lang.String hostname,
java.lang.String attributes,
boolean unique)
Returns |
java.lang.String |
getImageTag(ChartDescription chartDescription,
java.lang.String hostname,
java.lang.String attributes,
boolean unique,
boolean https)
Returns |
long |
getMemorySize()
Returns the amount of memory that cached images take |
ResourceRepository |
getProperties()
Returns the current server settings. |
ChartDescription |
newImageSpec()
Creates and returns a new chart specification structure |
void |
saveBufferTo(ChartDescription chartDescription,
java.lang.String path)
Produces the chart in the required format and saves it into a file. |
void |
writeBufferTo(ChartDescription chartDescription,
HttpServletResponse httpservletresponse)
This method obtains the image bytes using getBytes method, sets the content type based on the image type, writes the bytes into the response, and closes the output. |
void |
writeCachedBufferTo(java.lang.String guid,
HttpServletResponse httpservletresponse)
This method obtains the image bytes using getCachedBuffer method, sets the content type tbased on the image type, writes the bytes into the response, and closes the output. |
void |
writeCachedBufferTo(java.lang.String guid,
JspWriter jspwriter,
HttpServletResponse httpservletresponse)
Used by the getImage.jsp to write cached bytes out - some servers will not allow us to getOutputStream from response and instead the writer should be used. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ChartServerComponent()
public ChartServerComponent(JcImageServer icimageserver)
icimageserver
- serverMethod Detail |
public static ChartServerComponent getDefaultInstance(ServletContext servletcontext)
servletcontext
- servlet context
public ChartDescription newImageSpec()
public java.lang.String getImageTag(ChartDescription chartDescription, java.lang.String hostname, java.lang.String attributes, boolean unique, boolean https)
chartDescription
- chart's descriptionhostname
- image retrieval urlattributes
- aditional HTML attributesunique
- when set to true this function will produce a unique image with unique id even if the same image already exists in the cachehttps
- use https in plugins codebases
public java.lang.String getImageTag(ChartDescription chartDescription, java.lang.String hostname, java.lang.String attributes, boolean unique)
chartDescription
- chart's descriptionhostname
- image retrieval urlattributes
- aditional HTML attributesunique
- when set to true this function will produce a unique image with unique id even if the same image already exists in the cache
public java.lang.String getImageTag(ChartDescription chartDescription, java.lang.String dsc)
chartDescription
- - chart's descriptiondsc
- - chart's description
public java.lang.String getImageID(ChartDescription chartDescription)
chartDescription
- chart's description
public byte[] getCachedBuffer(java.lang.String guid)
guid
- unique image ID returned by getID() function or ID that was embedded into the image tag by getImageTag function
public java.lang.String getCachedImageMap(java.lang.String guid)
guid
- - unique image ID
public byte[] getBytes(ChartDescription chartDescription)
chartDescription
- chartDescription
public void saveBufferTo(ChartDescription chartDescription, java.lang.String path)
chartDescription
- - chart descriptionpath
- - file pathpublic void gc()
public void destroy()
public void finalize() throws java.lang.Throwable
java.lang.Throwable
public int getImageCount()
public long getMemorySize()
public java.lang.String getHtmlReport()
public void writeBufferTo(ChartDescription chartDescription, HttpServletResponse httpservletresponse) throws java.io.IOException
chartDescription
- discriptionhttpservletresponse
- response
java.io.IOException
- exceptionpublic void writeCachedBufferTo(java.lang.String guid, HttpServletResponse httpservletresponse) throws java.io.IOException
guid
- - unique image ID returned by getImageID function or embedded into HTML fragment by getImageTag functionhttpservletresponse
- servlet response stream
java.io.IOException
- exceptionpublic void writeCachedBufferTo(java.lang.String guid, JspWriter jspwriter, HttpServletResponse httpservletresponse) throws java.io.IOException
guid
- idjspwriter
- jspwriterhttpservletresponse
- response
java.io.IOException
- exceptionpublic ResourceRepository getProperties()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |