Style Intelligence v12.0

inetsoft.report
Class LibManager

java.lang.Object
  extended by inetsoft.report.LibManager
All Implemented Interfaces:
inetsoft.report.internal.ParameterSheetRepository
Direct Known Subclasses:
RemoteLibManager

public class LibManager
extends Object
implements inetsoft.report.internal.ParameterSheetRepository

This class manages the bean, table style, and script library. It is a singleton class. The library is created inside the designer. Any beans or table styles used in a report are automatically handled by the report engine. The library is only of interest to a program if it needs to manipulate the library programmatically instead of through the designer.


Field Summary
static int BEAN_ADDED
          Action event ID if bean is added.
static int BEAN_MODIFIED
          Action event ID if bean is modified.
static int BEAN_REMOVED
          Action event ID if bean is removed.
 inetsoft.util.DataChangeListener changeListener
          Listener added to be notified of the manager has change in the data space.
static int META_REPORT_ADDED
          Action event ID if meta sheet is added.
static int META_REPORT_MODIFIED
          Action event ID if meta sheet is modified.
static int META_REPORT_REMOVED
          Action event ID if meta sheet is removed.
static int PARAMETER_SHEET_ADDED
          Action event ID if parameter sheet is added.
static int PARAMETER_SHEET_MODIFIED
          Action event ID if parameter sheet is modified.
static int PARAMETER_SHEET_REMOVED
          Action event ID if parameter sheet is removed.
static int SCRIPT_ADDED
          Action event ID if script is added.
static int SCRIPT_MODIFIED
          Action event ID if script is modified.
static int SCRIPT_RELOADED
          Action event ID if script is reloaded.
static int SCRIPT_REMOVED
          Action event ID if script is removed.
static String SEPARATOR
          Table style separator.
static int STYLE_ADDED
          Action event ID if style is added.
static int STYLE_MODIFIED
          Action event ID if style is modified.
static int STYLE_REMOVED
          Action event ID if style is removed.
protected  long ts
           
static String USER_DEFINE
          The user define style .
 
Fields inherited from interface inetsoft.report.internal.ParameterSheetRepository
EMBED_PARAMETER_SHEET, EMBED_SECTION
 
Constructor Summary
protected LibManager()
          Constructor.
 
Method Summary
 void addActionListener(ActionListener listener)
          Add a listener to be notified when the library has been changed.
 void addRefreshedListener(PropertyChangeListener listener)
          Add a refresh listener that will be notified if the datasource registry has changed.
 void addTableStyleFolder(String folder)
          Add a table style folder.
 void addTableStyleFolder(String folder, boolean rename)
          Add a table style folder.
protected  boolean checkPermission(String resource, char access)
          Determines if the current user has permission for the specified access to a resource.
static void clear()
          Clear cached library manager.
 boolean containsFolder(String folder)
          Check if contains a folder.
static void copyLibrary(File in, File out)
          Copies a library from one location to another.
 String findBeanName(String name)
          Find a bean with the same name by ignoring the case.
 String findMetaReportName(String name)
          Find a meta report with the same name by ignoring the case.
 String findParameterSheetName(String name)
          Find a parameter sheet with the same name by ignoring the case.
 String findScriptName(String name)
          Find a function with the same name by ignoring the case.
protected  void fireActionEvent(String name, int actionID)
          Fire an action event.
protected  void fireEvent(long ots)
          Fire event.
 BeanSheet getBean(String name)
          Get a report bean by its name.
 String getBeanComment(String name)
          Get comments of a bean.
 Enumeration getBeans()
          Get all the bean names.
 String[] getDependedFile(String identifier)
          Get the depended file.
 InputStream getFileInputStream(String path)
          Get the file input stream from the path.
protected  inetsoft.util.ReportKey getKey()
          Gets the key with which this manager is configured.
static LibManager getManager()
          Get library manager contains bean, script function, table style, parameter sheet, meta template, etc.
 MetaReport getMetaReport(String name)
          Get a meta report sheet by its name.
 String getMetaReportComment(String name)
          Get comments of a meta report.
 Enumeration getMetaReports()
          Get all the meta report names.
 String getNextStyleID(String name)
          Get next available table style id.
 ParameterSheet getParameterSheet(String name)
          Get a parameter sheet.
 String getParameterSheetComment(String name)
          Get comments of a parameter sheet.
 Enumeration getParameterSheets()
          Get all the parameter sheet names.
 String getScript(String name)
          Get a script function by its name.
 String getScriptComment(String name)
          Get comments of a script function.
 Enumeration getScripts()
          Get all the script function names.
 inetsoft.report.style.XTableStyle getTableStyle(String name)
          Get a table style by its name.
 String getTableStyleComment(String name)
          Get comments of a table style.
 String[] getTableStyleFolders(String folder)
          Get table style folders.
 Enumeration getTableStyles()
          Get all the table style names.
 inetsoft.report.style.XTableStyle[] getTableStyles(String folder)
          Get table styles under a folder.
 String getUserSignature(String name)
          Get a user defined function's signature by its name.
protected  void heartbeat()
          Do a heartbeat to synchronize data.
protected  void init(boolean event)
          Initialize this library manager.
 long lastModified()
          Get last modified timestamp.
 void loadLibrary(InputStream input)
          Deprecated. use loadLibrary(String) instead
 void loadLibrary(InputStream input, boolean overwrite)
          Deprecated. use loadLibrary(String) instead
 void loadLibrary(String path)
          Load one library (srl) file.
protected  void movePermission(String oresource, String nresource)
          Moves a permission from one resource path to another.
 void refresh(boolean event)
          Refresh lib manager.
 void removeActionListener(ActionListener listener)
          Remove a listener.
 void removeAllElements()
          Remove all elements contained in the library manager.
 void removeBean(String name)
          Remove a bean from the library.
 void removeMetaReport(String name)
          Remove a meta report from the library.
 void removeParameterSheet(String name)
          Remove a parameter sheet from the library.
 void removeRefreshedListener(PropertyChangeListener listener)
          Remove a refresh listener.
 void removeScript(String name)
          Remove a script function from the library.
 void removeTableStyle(String name)
          Remove a table style from the library.
 Object removeTableStyleFolder(String folder)
          Remove a table style folder.
 Object removeTableStyleFolder(String folder, boolean rename)
          Remove a table style folder.
 void renameBean(String oldName, String newName)
          Rename a bean.
 void renameMetaReport(String oldName, String newName)
          Rename a meta report.
 void renameParameterSheet(String oldName, String newName)
          Rename a parameter sheet.
 void renameScript(String oldName, String newName)
          Rename a script function.
static void restart()
          Restart library manager.
 void save()
          Save the library contents to the library file.
 void save(OutputStream output)
          Deprecated. use save() instead.
 void setBean(String name, BeanSheet report)
          Set a new bean or replace an existing bean.
 void setBeanComment(String name, String comment)
          Set comments of a bean.
 void setMetaReport(String name, MetaReport report)
          Set a new meta report or replace an existing meta report.
 void setMetaReportComment(String name, String comment)
          Set comments of a meta report.
 void setParameterSheet(String name, ParameterSheet report)
          Set a new parameter sheet or replace an existing parameter sheet.
 void setParameterSheetComment(String name, String comment)
          Set comments of a parameter sheet.
 void setScript(String name, String func)
          Set a new script function or replace an existing script function.
 void setScriptComment(String name, String comment)
          Set comments of a script function.
 void setTableStyle(String name, inetsoft.report.style.XTableStyle style)
          Set a new table style or replace an existing table style.
 void setTableStyle(String name, inetsoft.report.style.XTableStyle style, boolean checkParent)
          Set a new table style or replace an existing table style.
 void setTableStyleComment(String name, String comment)
          Set comments of a table style.
protected  void tearDown()
          Tear down lib manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEAN_REMOVED

public static final int BEAN_REMOVED
Action event ID if bean is removed.

See Also:
Constant Field Values

BEAN_ADDED

public static final int BEAN_ADDED
Action event ID if bean is added.

See Also:
Constant Field Values

BEAN_MODIFIED

public static final int BEAN_MODIFIED
Action event ID if bean is modified.

See Also:
Constant Field Values

STYLE_REMOVED

public static final int STYLE_REMOVED
Action event ID if style is removed.

See Also:
Constant Field Values

STYLE_ADDED

public static final int STYLE_ADDED
Action event ID if style is added.

See Also:
Constant Field Values

STYLE_MODIFIED

public static final int STYLE_MODIFIED
Action event ID if style is modified.

See Also:
Constant Field Values

SCRIPT_REMOVED

public static final int SCRIPT_REMOVED
Action event ID if script is removed.

See Also:
Constant Field Values

SCRIPT_ADDED

public static final int SCRIPT_ADDED
Action event ID if script is added.

See Also:
Constant Field Values

SCRIPT_MODIFIED

public static final int SCRIPT_MODIFIED
Action event ID if script is modified.

See Also:
Constant Field Values

SCRIPT_RELOADED

public static final int SCRIPT_RELOADED
Action event ID if script is reloaded.

See Also:
Constant Field Values

PARAMETER_SHEET_REMOVED

public static final int PARAMETER_SHEET_REMOVED
Action event ID if parameter sheet is removed.

See Also:
Constant Field Values

PARAMETER_SHEET_ADDED

public static final int PARAMETER_SHEET_ADDED
Action event ID if parameter sheet is added.

See Also:
Constant Field Values

PARAMETER_SHEET_MODIFIED

public static final int PARAMETER_SHEET_MODIFIED
Action event ID if parameter sheet is modified.

See Also:
Constant Field Values

META_REPORT_REMOVED

public static final int META_REPORT_REMOVED
Action event ID if meta sheet is removed.

See Also:
Constant Field Values

META_REPORT_ADDED

public static final int META_REPORT_ADDED
Action event ID if meta sheet is added.

See Also:
Constant Field Values

META_REPORT_MODIFIED

public static final int META_REPORT_MODIFIED
Action event ID if meta sheet is modified.

See Also:
Constant Field Values

SEPARATOR

public static final String SEPARATOR
Table style separator.

See Also:
Constant Field Values

USER_DEFINE

public static final String USER_DEFINE
The user define style .

See Also:
Constant Field Values

changeListener

public inetsoft.util.DataChangeListener changeListener
Listener added to be notified of the manager has change in the data space.


ts

protected long ts
Constructor Detail

LibManager

protected LibManager()
Constructor.

Method Detail

getManager

public static LibManager getManager()
Get library manager contains bean, script function, table style, parameter sheet, meta template, etc.

Returns:
library manager.

restart

public static void restart()
Restart library manager.


clear

public static void clear()
Clear cached library manager.


init

protected void init(boolean event)
Initialize this library manager.

Parameters:
event - true if should fire event when resource changes.

removeAllElements

public void removeAllElements()
Remove all elements contained in the library manager.


getKey

protected final inetsoft.util.ReportKey getKey()
Gets the key with which this manager is configured.

Returns:
the report key.

lastModified

public long lastModified()
Get last modified timestamp.

Returns:
last modified timestamp.

refresh

public void refresh(boolean event)
Refresh lib manager.

Parameters:
event - true if should fire event when resource changes.

tearDown

protected void tearDown()
Tear down lib manager.


heartbeat

protected void heartbeat()
Do a heartbeat to synchronize data.


copyLibrary

public static void copyLibrary(File in,
                               File out)
                        throws Exception
Copies a library from one location to another. If in or out point to a directory, the library at that location will be exploded. If the referenced file does not exist or is a regular file, an archive file will be used.

Parameters:
in - the library to read.
out - the library to write.
Throws:
Exception - if the library could not be copied.

loadLibrary

public void loadLibrary(String path)
                 throws Exception
Load one library (srl) file.

Parameters:
path - the specified file path.
Throws:
Exception

loadLibrary

@Deprecated
public void loadLibrary(InputStream input)
                 throws IOException
Deprecated. use loadLibrary(String) instead

Load a library from an input stream.

Parameters:
input - the specified input stream.
Throws:
IOException

loadLibrary

@Deprecated
public void loadLibrary(InputStream input,
                                   boolean overwrite)
                 throws IOException
Deprecated. use loadLibrary(String) instead

Loads a library from an input stream.

Parameters:
input - the specified input stream.
overwrite - true to overwrite existing entries in this library.
Throws:
IOException

getNextStyleID

public String getNextStyleID(String name)
Get next available table style id.


getBeans

public Enumeration getBeans()
Get all the bean names.

Returns:
all the bean names.

getBean

public BeanSheet getBean(String name)
Get a report bean by its name.

Parameters:
name - the specified bean name.
Returns:
corresponding bean.

findBeanName

public String findBeanName(String name)
Find a bean with the same name by ignoring the case.


setBean

public void setBean(String name,
                    BeanSheet report)
Set a new bean or replace an existing bean.

Parameters:
name - the specified bean name.
report - the specified bean.

renameBean

public void renameBean(String oldName,
                       String newName)
Rename a bean.

Parameters:
oldName - old name of the bean.
newName - new name for the bean.

removeBean

public void removeBean(String name)
Remove a bean from the library.

Parameters:
name - the specified bean name.

getBeanComment

public String getBeanComment(String name)
Get comments of a bean.

Parameters:
name - the specified bean name.
Returns:
comments of the specified bean name.

setBeanComment

public void setBeanComment(String name,
                           String comment)
Set comments of a bean.

Parameters:
name - the specified bean name.
comment - the specified comments.

getParameterSheets

public Enumeration getParameterSheets()
Get all the parameter sheet names.

Returns:
all the parameter sheet names.

findParameterSheetName

public String findParameterSheetName(String name)
Find a parameter sheet with the same name by ignoring the case.


getParameterSheet

public ParameterSheet getParameterSheet(String name)
Get a parameter sheet.

Specified by:
getParameterSheet in interface inetsoft.report.internal.ParameterSheetRepository
Parameters:
name - the specified parameter sheet name.

setParameterSheet

public void setParameterSheet(String name,
                              ParameterSheet report)
Set a new parameter sheet or replace an existing parameter sheet.

Parameters:
name - the specified parameter sheet name.
report - the specified parameter sheet.

renameParameterSheet

public void renameParameterSheet(String oldName,
                                 String newName)
Rename a parameter sheet.

Parameters:
oldName - old name of the parameter sheet.
newName - new name for the parameter sheet.

removeParameterSheet

public void removeParameterSheet(String name)
Remove a parameter sheet from the library.

Parameters:
name - the specified parameter sheet name.

getParameterSheetComment

public String getParameterSheetComment(String name)
Get comments of a parameter sheet.

Parameters:
name - the specified parameter sheet name.
Returns:
comments of the parameter sheet.

setParameterSheetComment

public void setParameterSheetComment(String name,
                                     String comment)
Set comments of a parameter sheet.

Parameters:
name - the specified parameter sheet name.s
comment - the specified comments

getMetaReports

public Enumeration getMetaReports()
Get all the meta report names.

Returns:
all the meta report names.

findMetaReportName

public String findMetaReportName(String name)
Find a meta report with the same name by ignoring the case.


getMetaReport

public MetaReport getMetaReport(String name)
Get a meta report sheet by its name.

Parameters:
name - the specified meta report name.

setMetaReport

public void setMetaReport(String name,
                          MetaReport report)
Set a new meta report or replace an existing meta report.

Parameters:
name - the specified meta report name.
report - the specified meta report.

renameMetaReport

public void renameMetaReport(String oldName,
                             String newName)
Rename a meta report.

Parameters:
oldName - old name of the meta report.
newName - new name for the meta report.

removeMetaReport

public void removeMetaReport(String name)
Remove a meta report from the library.

Parameters:
name - the specified meta report name.

getMetaReportComment

public String getMetaReportComment(String name)
Get comments of a meta report.

Parameters:
name - the specified meta report name.
Returns:
comments of the specified meta report.

setMetaReportComment

public void setMetaReportComment(String name,
                                 String comment)
Set comments of a meta report.

Parameters:
name - the specified meta report name.
comment - the specified meta report comment.

getScripts

public Enumeration getScripts()
Get all the script function names.

Returns:
all the script function names.

findScriptName

public String findScriptName(String name)
Find a function with the same name by ignoring the case.


getScript

public String getScript(String name)
Get a script function by its name.

Parameters:
name - the specified script function name.
Returns:
corresponding script function.

setScript

public void setScript(String name,
                      String func)
Set a new script function or replace an existing script function.

Parameters:
name - the specified script function name.
func - the specified script function.

renameScript

public void renameScript(String oldName,
                         String newName)
Rename a script function.

Parameters:
oldName - old name of the script function.
newName - new name of the script function.

removeScript

public void removeScript(String name)
Remove a script function from the library.

Parameters:
name - the specified script function name.

getScriptComment

public String getScriptComment(String name)
Get comments of a script function.

Parameters:
name - the specified script function name.

setScriptComment

public void setScriptComment(String name,
                             String comment)
Set comments of a script function.

Parameters:
name - the specified script function name.
comment - the specified comments.

getUserSignature

public String getUserSignature(String name)
Get a user defined function's signature by its name.

Parameters:
name - the specified script function name.
Returns:
corresponding script function's signature.

containsFolder

public boolean containsFolder(String folder)
Check if contains a folder.

Parameters:
folder - the specified folder name.
Returns:
true if contains, false otherwise.

addTableStyleFolder

public void addTableStyleFolder(String folder)
Add a table style folder.

Parameters:
folder - the specified folder name.

addTableStyleFolder

public void addTableStyleFolder(String folder,
                                boolean rename)
Add a table style folder.

Parameters:
folder - the specified folder name.

removeTableStyleFolder

public Object removeTableStyleFolder(String folder)
Remove a table style folder.

Parameters:
folder - the folder name to be removed.
Returns:
the removed folder if exists.

removeTableStyleFolder

public Object removeTableStyleFolder(String folder,
                                     boolean rename)
Remove a table style folder.

Parameters:
folder - the folder name to be removed.
Returns:
the removed folder if exists.

getTableStyleFolders

public String[] getTableStyleFolders(String folder)
Get table style folders.

Parameters:
folder - parent folder.
Returns:
sub folders of the specified parent folder.

getTableStyles

public inetsoft.report.style.XTableStyle[] getTableStyles(String folder)
Get table styles under a folder.

Parameters:
folder - parent folder.
Returns:
table styles under the specified parent folder.

getTableStyles

public Enumeration getTableStyles()
Get all the table style names.

Returns:
all the table style names.

getTableStyle

public inetsoft.report.style.XTableStyle getTableStyle(String name)
Get a table style by its name.

Parameters:
name - the specified table style name.
Returns:
corresponding table style object.

setTableStyle

public void setTableStyle(String name,
                          inetsoft.report.style.XTableStyle style)
Set a new table style or replace an existing table style.

Parameters:
name - the specified table style name.
style - the specified table style.

setTableStyle

public void setTableStyle(String name,
                          inetsoft.report.style.XTableStyle style,
                          boolean checkParent)
Set a new table style or replace an existing table style.

Parameters:
name - the specified table style name.
style - the specified table style.
checkParent - true to check parent permission.

removeTableStyle

public void removeTableStyle(String name)
Remove a table style from the library.

Parameters:
name - the specified table style name.

getTableStyleComment

public String getTableStyleComment(String name)
Get comments of a table style.

Parameters:
name - the specified table style name.

setTableStyleComment

public void setTableStyleComment(String name,
                                 String comment)
Set comments of a table style.

Parameters:
name - the specified table style name.
comment - the specified table style comments.

save

public void save()
          throws Exception
Save the library contents to the library file. The file is defined by the stylereport.library.file property.

Throws:
Exception

save

@Deprecated
public void save(OutputStream output)
          throws IOException
Deprecated. use save() instead.

Save the library into an output stream.

Parameters:
output - the specified output stream.
Throws:
IOException - if an I/O error occurs.

addActionListener

public void addActionListener(ActionListener listener)
Add a listener to be notified when the library has been changed.

Parameters:
listener - the specified listener to add.

removeActionListener

public void removeActionListener(ActionListener listener)
Remove a listener.

Parameters:
listener - the specified listener to remove

addRefreshedListener

public void addRefreshedListener(PropertyChangeListener listener)
Add a refresh listener that will be notified if the datasource registry has changed.

Parameters:
listener - the specified refresh listener.

removeRefreshedListener

public void removeRefreshedListener(PropertyChangeListener listener)
Remove a refresh listener.

Parameters:
listener - the specified refresh listener.

fireActionEvent

protected void fireActionEvent(String name,
                               int actionID)
Fire an action event.

Parameters:
name - the changed object name.
actionID - the event actionID defined in this class.

fireEvent

protected void fireEvent(long ots)
Fire event.

Parameters:
ots - the specified last modified timestamp.

getFileInputStream

public InputStream getFileInputStream(String path)
Get the file input stream from the path. If the path does not exist, null will be returned.

Parameters:
path - the path of a file.

getDependedFile

public String[] getDependedFile(String identifier)
Get the depended file.


checkPermission

protected boolean checkPermission(String resource,
                                  char access)
Determines if the current user has permission for the specified access to a resource.

Parameters:
resource - the name of the resource.
access - the type of access.
Returns:
true if allowed; false otherwise.

movePermission

protected void movePermission(String oresource,
                              String nresource)
Moves a permission from one resource path to another. This is done in response to renaming a component.

Parameters:
oresource - the old resource path.
nresource - the new resource path.

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.