org.eclipse.birt.report.model.api
Class ModuleUtil

java.lang.Object
  extended byorg.eclipse.birt.report.model.api.ModuleUtil

public class ModuleUtil
extends java.lang.Object

Provides some tool methods about the modules.


Field Summary
static int INVALID_MODULE
          The invalid module.
static int LIBRARY
          The library type.
static int REPORT_DESIGN
          The report design type.
 
Constructor Summary
ModuleUtil()
           
 
Method Summary
static int checkModule(SessionHandle sessionHandle, java.lang.String fileName, java.io.InputStream is)
          Checks the input stream with given file name.
static ActionHandle deserializeAction(java.io.InputStream streamData)
          Deserialize an input stream into an Action.
static ActionHandle deserializeAction(java.lang.String strData)
          Deserialize a string into an ActionHandle, notice that the handle is faked, the action is not in the design tree, the operation to the handle is not able to be undoned.
static boolean isValidDesign(SessionHandle sessionHandle, java.lang.String fileName, java.io.InputStream is)
          Justifies whether a given input stream is a valid report design.
static boolean isValidLibrary(SessionHandle sessionHandle, java.lang.String fileName, java.io.InputStream is)
          Justifies whether a library resource with the given file name is a valid library.
static java.lang.String serializeAction(ActionHandle action)
          Serialize an action into a stream, the stream is in UTF-8 encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIBRARY

public static final int LIBRARY
The library type.

See Also:
Constant Field Values

REPORT_DESIGN

public static final int REPORT_DESIGN
The report design type.

See Also:
Constant Field Values

INVALID_MODULE

public static final int INVALID_MODULE
The invalid module.

See Also:
Constant Field Values
Constructor Detail

ModuleUtil

public ModuleUtil()
Method Detail

deserializeAction

public static ActionHandle deserializeAction(java.io.InputStream streamData)
                                      throws DesignFileException
Deserialize an input stream into an Action.

Parameters:
streamData - a stream represent an action.
Returns:
an internal Action structure
Throws:
DesignFileException - if the exception occur when interpret the stream data.

deserializeAction

public static ActionHandle deserializeAction(java.lang.String strData)
                                      throws DesignFileException
Deserialize a string into an ActionHandle, notice that the handle is faked, the action is not in the design tree, the operation to the handle is not able to be undoned.

Parameters:
strData - a string represent an action.
Returns:
a handle to the action.
Throws:
DesignFileException - if the exception occur when interpret the stream data.

serializeAction

public static java.lang.String serializeAction(ActionHandle action)
                                        throws java.io.IOException
Serialize an action into a stream, the stream is in UTF-8 encoding.

Parameters:
action - a given action structure.
Returns:
an output stream represent the action xml data.
Throws:
java.io.IOException - if I/O exception occur when writing the stream.

isValidDesign

public static boolean isValidDesign(SessionHandle sessionHandle,
                                    java.lang.String fileName,
                                    java.io.InputStream is)
Justifies whether a given input stream is a valid report design.

Parameters:
sessionHandle - the current session of the report design
fileName - the file name of the report design
is - the input stream of the report design
Returns:
true if the input stream is a valid report design, otherwise false

isValidLibrary

public static boolean isValidLibrary(SessionHandle sessionHandle,
                                     java.lang.String fileName,
                                     java.io.InputStream is)
Justifies whether a library resource with the given file name is a valid library.

Parameters:
sessionHandle - the current session of the library
fileName - the file name of the library
is - the input stream of the library
Returns:
true if the library resource is a valid library, otherwise false

checkModule

public static int checkModule(SessionHandle sessionHandle,
                              java.lang.String fileName,
                              java.io.InputStream is)
Checks the input stream with given file name. If it is a valid design/library, return ModuleUtil.REPORT_DESIGN/ModuleUtil.LIBRARY, otherwise, ModuleUtil.INVALID is return.

Parameters:
sessionHandle - the current session of the library
fileName - the file name of the library
is - the input stream of the library
Returns:
ModuleUtil.REPORT_DESIGN if the input stream is a report design, ModuleUtil.LIBRARY if the input stream is a library, ModuleUtil.INVALID otherwise.


Copyright © 2005 Actuate Corp. All rights reserved.