org.eclipse.birt.data.engine.api
Class DataEngineContext

java.lang.Object
  extended byorg.eclipse.birt.data.engine.api.DataEngineContext

public class DataEngineContext
extends java.lang.Object

Define in which context Data Engine is running. The context can be divided into three types: generation, presentation and direct presentation.


Field Summary
static int CACHE_USE_ALWAYS
          Always use cached data if available, disregard data set cache setting and AppContext.
static int CACHE_USE_DEFAULT
          AppContext and Data Set cache count setting decide whether cache is used, which is default value for data engine context.
static int CACHE_USE_DISABLE
          Do not use cache, regardless of data set cache setting
static int DIRECT_PRESENTATION
           
static int EXPR_VALUE_STREAM
          stream id for internal use, don't use it externally
static int GROUP_INFO_STREAM
           
static int MODE_GENERATION
          three defined mode
static int MODE_PRESENTATION
           
static int RESULTCLASS_STREAM
           
static int SUBQUERY_INFO_STREAM
           
 
Method Summary
 int getCacheCount()
           
 int getCacheOption()
           
 java.io.InputStream getInputStream(java.lang.String streamID, java.lang.String subStreamID, int streamType)
          According to the paramters of streamID, subStreamID and streamType, an input stream will be created for it.
 org.mozilla.javascript.Scriptable getJavaScriptScope()
           
 int getMode()
           
 java.io.OutputStream getOutputStream(java.lang.String streamID, java.lang.String subStreamID, int streamType)
          According to the paramters of streamID, subStreamID and streamType, an output stream will be created for it.
 boolean hasStream(java.lang.String streamID, java.lang.String subStreamID, int streamType)
          Determins whether one particular stream exists
static DataEngineContext newInstance(int mode, org.mozilla.javascript.Scriptable scope, org.eclipse.birt.core.archive.IDocArchiveReader reader, org.eclipse.birt.core.archive.IDocArchiveWriter writer)
          When mode is MODE_GENERATION, the writer stream of archive will be used.
 void setCacheOption(int option, int cacheCount)
          This method is used to set the cache option for current data engine instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_GENERATION

public static final int MODE_GENERATION
three defined mode

See Also:
Constant Field Values

MODE_PRESENTATION

public static final int MODE_PRESENTATION
See Also:
Constant Field Values

DIRECT_PRESENTATION

public static final int DIRECT_PRESENTATION
See Also:
Constant Field Values

CACHE_USE_DEFAULT

public static final int CACHE_USE_DEFAULT
AppContext and Data Set cache count setting decide whether cache is used, which is default value for data engine context.

See Also:
Constant Field Values

CACHE_USE_DISABLE

public static final int CACHE_USE_DISABLE
Do not use cache, regardless of data set cache setting

See Also:
Constant Field Values

CACHE_USE_ALWAYS

public static final int CACHE_USE_ALWAYS
Always use cached data if available, disregard data set cache setting and AppContext. cachRowCount parameter decides cache count.

See Also:
Constant Field Values

EXPR_VALUE_STREAM

public static final int EXPR_VALUE_STREAM
stream id for internal use, don't use it externally

See Also:
Constant Field Values

RESULTCLASS_STREAM

public static final int RESULTCLASS_STREAM
See Also:
Constant Field Values

GROUP_INFO_STREAM

public static final int GROUP_INFO_STREAM
See Also:
Constant Field Values

SUBQUERY_INFO_STREAM

public static final int SUBQUERY_INFO_STREAM
See Also:
Constant Field Values
Method Detail

newInstance

public static DataEngineContext newInstance(int mode,
                                            org.mozilla.javascript.Scriptable scope,
                                            org.eclipse.birt.core.archive.IDocArchiveReader reader,
                                            org.eclipse.birt.core.archive.IDocArchiveWriter writer)
                                     throws org.eclipse.birt.core.exception.BirtException
When mode is MODE_GENERATION, the writer stream of archive will be used. When mode is MODE_PRESENTATION, the reader stream of archive will be used. When mode is DIRECT_PRESENTATION, the archive will not be used.

Parameters:
mode -
scope -
reader -
writer -
Returns:
an instance of DataEngineContext
Throws:
org.eclipse.birt.core.exception.BirtException

getMode

public int getMode()
Returns:
current context mode

getJavaScriptScope

public org.mozilla.javascript.Scriptable getJavaScriptScope()
Returns:
current top scope

getCacheOption

public int getCacheOption()
Returns:
cacheCount

getCacheCount

public int getCacheCount()
Returns:
cacheCount

setCacheOption

public void setCacheOption(int option,
                           int cacheCount)
                    throws org.eclipse.birt.core.exception.BirtException
This method is used to set the cache option for current data engine instance. These option values will override the values defined in individual data set and its application context. The option value has three posible values, CACHE_USE_DEFAULT, CACHE_USE_DISABLE, CACHE_USE_ALWAYS. The cacheCount values can be larger than 0, which indicates the count of how many rows will be ccached, equal to 0, which indicates cache will not be used, less than 0, which indicates the entire data set will be cached. Please notice, this cache function only available for DIRECT_PRESENTATION. In other cases, exception will be thrown.

Parameters:
option -
cacheCount -
Throws:
org.eclipse.birt.core.exception.BirtException

getOutputStream

public java.io.OutputStream getOutputStream(java.lang.String streamID,
                                            java.lang.String subStreamID,
                                            int streamType)
                                     throws org.eclipse.birt.data.engine.core.DataException
According to the paramters of streamID, subStreamID and streamType, an output stream will be created for it. To make stream close simply, the stream needs to be closed by caller, and then caller requires to add buffer stream layer when needed.

Parameters:
streamID -
subStreamID -
streamType -
Returns:
output stream for specified streamID, subStreamID and streamType
Throws:
org.eclipse.birt.data.engine.core.DataException

hasStream

public boolean hasStream(java.lang.String streamID,
                         java.lang.String subStreamID,
                         int streamType)
Determins whether one particular stream exists

Parameters:
streamID -
subStreamID -
streamType -
Returns:
boolean value

getInputStream

public java.io.InputStream getInputStream(java.lang.String streamID,
                                          java.lang.String subStreamID,
                                          int streamType)
                                   throws org.eclipse.birt.data.engine.core.DataException
According to the paramters of streamID, subStreamID and streamType, an input stream will be created for it. To make stream close simply, the stream needs to be closed by caller, and then caller requires to add buffer stream layer when needed.

Parameters:
streamID -
subStreamID -
streamType -
Returns:
input stream for specified streamID, subStreamID and streamType
Throws:
org.eclipse.birt.data.engine.core.DataException


Copyright © 2005 Actuate Corp. All rights reserved.