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

java.lang.Object
  extended by org.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_MODE_IN_DISK
           
static int CACHE_MODE_IN_MEMORY
           
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 DATASET_DATA_LEN_STREAM
           
static int DATASET_DATA_STREAM
           
static int DATASET_META_STREAM
           
static int DIRECT_PRESENTATION
           
static int EXPR_META_STREAM
           
static int EXPR_ROWLEN_STREAM
           
static int EXPR_VALUE_STREAM
           
static int GROUP_INFO_STREAM
           
static int META_INDEX_STREAM
           
static int META_STREAM
           
static int MODE_GENERATION
          three defined mode
static int MODE_PRESENTATION
           
static int MODE_UPDATE
          this is a special mode, that a query which is running on a report document also needs to be stored into the same report document.
static int NAMING_RELATION_STREAM
           
static int ORIGINAL_QUERY_DEFN_STREAM
           
static int PLS_GROUPLEVEL_STREAM
           
static int QUERY_DEFN_STREAM
           
static int QUERYID_INFO_STREAM
           
static int ROW_INDEX_STREAM
           
static int SUBQUERY_INFO_STREAM
           
static int SUBQUERY_PARENTINDEX_STREAM
           
static int VERSION_INFO_STREAM
          stream id for internal use, don't use it externally
 
Method Summary
 void dropStream(java.lang.String streamPath)
          Directly drop stream
 void dropStream(java.lang.String streamID, java.lang.String subStreamID, int streamType)
           
 int getCacheCount()
           
 int getCacheOption()
           
 java.lang.ClassLoader getClassLoader()
           
 org.eclipse.birt.core.archive.IDocArchiveReader getDocReader()
           
 org.eclipse.birt.core.archive.IDocArchiveWriter getDocWriter()
           
 org.eclipse.birt.core.archive.RAInputStream 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()
           
 com.ibm.icu.util.ULocale getLocale()
           
 int getMode()
           
 org.eclipse.birt.core.archive.RAOutputStream 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.
static java.lang.String getPath(java.lang.String streamID, java.lang.String subStreamID, int streamType)
           
 org.eclipse.birt.core.script.ScriptContext getScriptContext()
           
 java.lang.String getTmpdir()
          get Dte temporary dir.
 boolean hasInStream(java.lang.String streamID, java.lang.String subStreamID, int streamType)
           
 boolean hasOutStream(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)
          Deprecated.  
static DataEngineContext newInstance(int mode, org.mozilla.javascript.Scriptable scope, org.eclipse.birt.core.archive.IDocArchiveReader reader, org.eclipse.birt.core.archive.IDocArchiveWriter writer, java.lang.ClassLoader classLoader)
          Deprecated.  
static DataEngineContext newInstance(int mode, org.eclipse.birt.core.script.ScriptContext context, org.eclipse.birt.core.archive.IDocArchiveReader reader, org.eclipse.birt.core.archive.IDocArchiveWriter writer, java.lang.ClassLoader classLoader)
           
 void setCacheOption(int option, int cacheCount)
          This method is used to set the cache option for current data engine instance.
 void setClassLoader(java.lang.ClassLoader classLoader)
          Set the classloader.
 void setLocale(java.util.Locale locale)
           
 void setTmpdir(java.lang.String tmpdir)
          set Dte temporary dir.
 
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

MODE_UPDATE

public static final int MODE_UPDATE
this is a special mode, that a query which is running on a report document also needs to be stored into the same report document. This is a update operation, and it is a combination mode of presentation and generation. One note is in running in this mode, the report document must be same for reading and writing.

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

CACHE_MODE_IN_MEMORY

public static final int CACHE_MODE_IN_MEMORY
See Also:
Constant Field Values

CACHE_MODE_IN_DISK

public static final int CACHE_MODE_IN_DISK
See Also:
Constant Field Values

VERSION_INFO_STREAM

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

See Also:
Constant Field Values

DATASET_DATA_STREAM

public static final int DATASET_DATA_STREAM
See Also:
Constant Field Values

DATASET_META_STREAM

public static final int DATASET_META_STREAM
See Also:
Constant Field Values

DATASET_DATA_LEN_STREAM

public static final int DATASET_DATA_LEN_STREAM
See Also:
Constant Field Values

EXPR_VALUE_STREAM

public static final int EXPR_VALUE_STREAM
See Also:
Constant Field Values

EXPR_META_STREAM

public static final int EXPR_META_STREAM
See Also:
Constant Field Values

EXPR_ROWLEN_STREAM

public static final int EXPR_ROWLEN_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

QUERY_DEFN_STREAM

public static final int QUERY_DEFN_STREAM
See Also:
Constant Field Values

ORIGINAL_QUERY_DEFN_STREAM

public static final int ORIGINAL_QUERY_DEFN_STREAM
See Also:
Constant Field Values

ROW_INDEX_STREAM

public static final int ROW_INDEX_STREAM
See Also:
Constant Field Values

QUERYID_INFO_STREAM

public static final int QUERYID_INFO_STREAM
See Also:
Constant Field Values

SUBQUERY_PARENTINDEX_STREAM

public static final int SUBQUERY_PARENTINDEX_STREAM
See Also:
Constant Field Values

META_STREAM

public static final int META_STREAM
See Also:
Constant Field Values

META_INDEX_STREAM

public static final int META_INDEX_STREAM
See Also:
Constant Field Values

NAMING_RELATION_STREAM

public static final int NAMING_RELATION_STREAM
See Also:
Constant Field Values

PLS_GROUPLEVEL_STREAM

public static final int PLS_GROUPLEVEL_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,
                                            java.lang.ClassLoader classLoader)
                                     throws org.eclipse.birt.core.exception.BirtException
Deprecated. 

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. When mode is PRESENTATION_AND_GENERATION, both the write stream and the read steram of archive will be used.

Parameters:
mode -
scope -
reader -
writer -
the - ClassLoader used for this data engine.
Returns:
an instance of DataEngineContext
Throws:
org.eclipse.birt.core.exception.BirtException

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
Deprecated. 

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

newInstance

public static DataEngineContext newInstance(int mode,
                                            org.eclipse.birt.core.script.ScriptContext context,
                                            org.eclipse.birt.core.archive.IDocArchiveReader reader,
                                            org.eclipse.birt.core.archive.IDocArchiveWriter writer,
                                            java.lang.ClassLoader classLoader)
                                     throws org.eclipse.birt.core.exception.BirtException
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 org.eclipse.birt.core.archive.RAOutputStream 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

hasOutStream

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

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

hasInStream

public boolean hasInStream(java.lang.String streamID,
                           java.lang.String subStreamID,
                           int streamType)
Parameters:
streamID -
subStreamID -
streamType -
Returns:

dropStream

public void dropStream(java.lang.String streamID,
                       java.lang.String subStreamID,
                       int streamType)
Parameters:
streamID -
subStreamID -
streamType -

dropStream

public void dropStream(java.lang.String streamPath)
Directly drop stream

Parameters:
streamPath -

getInputStream

public org.eclipse.birt.core.archive.RAInputStream 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

setLocale

public void setLocale(java.util.Locale locale)
Parameters:
locale - The current task's locale

getLocale

public com.ibm.icu.util.ULocale getLocale()
Returns:
The current locale

getTmpdir

public java.lang.String getTmpdir()
get Dte temporary dir.

Returns:

setTmpdir

public void setTmpdir(java.lang.String tmpdir)
set Dte temporary dir.

Parameters:
tmpdir -

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
Set the classloader.

Parameters:
classLoader -

getDocReader

public org.eclipse.birt.core.archive.IDocArchiveReader getDocReader()
Returns:

getDocWriter

public org.eclipse.birt.core.archive.IDocArchiveWriter getDocWriter()
Returns:

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns:

getPath

public static java.lang.String getPath(java.lang.String streamID,
                                       java.lang.String subStreamID,
                                       int streamType)
Parameters:
streamType -
Returns:
relative path, notice in reading data from file, directory can not be created.

getScriptContext

public org.eclipse.birt.core.script.ScriptContext getScriptContext()
Returns:


Copyright © 2008 Actuate Corp. All rights reserved.