Klasse DataSourceConfigurationManager
java.lang.Object
com.inet.report.config.datasource.DataSourceConfigurationManager
This is the main class to manage data source configurations in i-net Clear Reports.
A datasource configuration defines from which location/ by which way
the data for a report will set.
For GUI application you can open the DataSource-Manager dialog with
DataSourceConfigurationManager.openDataSourceManagerDialog(Frame,DataSourceConfiguration).
If a data source configuration is already created, it is easy to configure a report to use
this configuration. The datasource configuration will be stored by using
java.util.prefs.Preferences.- Seit:
- 7.0
- Siehe auch:
-
Feldübersicht
FelderModifikator und TypFeldBeschreibungstatic final intVeraltet.As of i-net Clear Reports 20.0static final intThis scope store the configuration in the persistence of the application.static final intThis scope does not store the configuration.static final intThis scope does not store the configuration.static final intThis scope store the configuration in the system preferences.static final intThis scope store the configuration only in the memory.static final intThis scope store the configuration in the user preferences.static final intThis scope store the configuration in the servlet session. -
Methodenübersicht
Modifikator und TypMethodeBeschreibungstatic voidAdd here aDataSourceConfigurationChangeListenerto get informed when aDataSourceConfigurationwas edited.static @Nonnull DataSourceConfigurationcreateDataSourceConfiguration(String configurationName, int scope) Creates a newDataSourceConfigurationusing the first parameter as configuration name.static booleanChecks if theDataSourceConfigurationspecified by the given configuration name does exist for user or system scope.static booleanChecks if theDataSourceConfigurationspecified by the given configuration name does exist for the given scope.static voidexportDataSourceConfigurations(DataSourceConfiguration[] configs, File exportFile) Exports data source configurations to the given file in an XML format.static voidexportDataSourceConfigurations(DataSourceConfiguration[] configs, OutputStream stream) Exports data source configurations to the given file in an XML format.static voidforceImportDataSourceConfigurations(int preferenceScope, File fileToImport) Imports data source configurations, replacing any existing ones with the same namestatic DataSourceConfigurationgetDataSource(com.inet.id.GUID uid) Returns theDataSourceConfigurationspecified by the given uid.static DataSourceConfigurationgetDataSource(String name) Returns theDataSourceConfigurationspecified by the given name.static DataSourceConfigurationgetDataSourceConfiguration(String configurationName, int preferenceScope) Returns theDataSourceConfigurationspecified by the given configuration name and scope.Returns the list of listeners.static String[]Returns the configuration names of allDataSourceConfigurations stored for user and system scope.static String[]getDataSourceConfigurationNames(int preferenceScope) Returns the configuration names of allDataSourceConfigurations stored for the given scope.static DataSourceConfiguration[]getDataSourceConfigurations(int scope) Returns theDataSourceConfigurationobjects stored for the given scope.static StringgetUniqueName(String configurationName, int preferenceScope) Creates a unique configuration name from the supplied name for the given scope.static voidimportDataSourceConfigurations(int preferenceScope, File importFile) Imports one or more data source configurations from an XML file.static voidimportDataSourceConfigurations(int preferenceScope, File importFile, boolean ignoreIfExist) Imports one or more data source configurations from an XML file.static DataSourceConfiguration[]importDataSourceConfigurations(int preferenceScope, InputStream importStream) Imports one or more data source configurations from an XML file.static DataSourceConfiguration[]importDataSourceConfigurations(int preferenceScope, InputStream importStream, boolean ignoreIfExist) Imports one or more data source configurations from an XML file.static booleanisReadable(int preferenceScope) Check if the scope is readable.static booleanisWriteable(int preferenceScope) Check if the scope is writable.static voidRemoves the datasource configuration.static voidremoveDatasourceConfiguration(String configurationName, int preferenceScope) Veraltet.As of i-net Clear Reports 20.0, useremoveDatasourceConfiguration(DataSourceConfiguration)insteadstatic voidRemoves the listener from list.static voidremoveDatasourceConfigurations(DataSourceConfiguration[] configs, int preferenceScope) Removes a collection ofDataSourceConfigurations from the given scope.
-
Felddetails
-
NO_STORE_UNSAFE
public static final int NO_STORE_UNSAFEThis scope does not store the configuration. It is for one time API usage. It ignore the check to prevent unknown datasources. The caller must check the security.- Seit:
- 25.10
- Siehe auch:
-
NO_STORE
public static final int NO_STOREThis scope does not store the configuration. It is for one time usage. Also used from rpt file parser if the datasource in the rpt file was not found.- Seit:
- 20.0
- Siehe auch:
-
SYSTEM_PREFERENCES
public static final int SYSTEM_PREFERENCESThis scope store the configuration in the system preferences. The current user need the required rights.- Siehe auch:
-
USER_PREFERENCES
public static final int USER_PREFERENCESThis scope store the configuration in the user preferences. The current user need the required rights. In a not signed Java applet the user does not have the rights. On Windows the system account of a service has also not the rights.- Siehe auch:
-
ALL_PREFERENCES
Veraltet.As of i-net Clear Reports 20.0This scope is used to return all (withoutAPPLICATION) configurations.- Siehe auch:
-
TEMPORARY_PREFERENCES
public static final int TEMPORARY_PREFERENCESThis scope store the configuration only in the memory.- Seit:
- 7.5
- Siehe auch:
-
USER_SESSION
public static final int USER_SESSIONThis scope store the configuration in the servlet session. It is only in a servlet environment available.- Seit:
- 11.1
- Siehe auch:
-
APPLICATION
public static final int APPLICATIONThis scope store the configuration in the persistence of the application.- Seit:
- 20.0
- Siehe auch:
-
-
Methodendetails
-
getUniqueName
Creates a unique configuration name from the supplied name for the given scope.- Parameter:
configurationName- the name that will be used as a basis for the unique name.preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
- DataSourceConfigurationManager.ALL_PREFERENCES
- Gibt zurück:
String- a unique configuration name.- Seit:
- 7.5
-
getDataSourceConfigurationNames
Returns the configuration names of allDataSourceConfigurations stored for user and system scope.- Gibt zurück:
String[]which contains the datasource configuration names.- Seit:
- 7.5
- Siehe auch:
-
getDataSourceConfigurationNames
Returns the configuration names of allDataSourceConfigurations stored for the given scope.- Parameter:
preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
- DataSourceConfigurationManager.ALL_PREFERENCES
- Gibt zurück:
String[]which contains the datasource configuration names.- Löst aus:
IllegalArgumentException- if the givenpreferenceScopeparameter is not equal to a valid parameter value listed below.- Seit:
- 7.5
- Siehe auch:
-
getDataSourceConfigurations
Returns theDataSourceConfigurationobjects stored for the given scope.- Parameter:
scope- Possible values:- SYSTEM_PREFERENCES
- USER_PREFERENCES
- TEMPORARY_PREFERENCES
- USER_SESSION
- APPLICATION
- Gibt zurück:
DataSourceConfiguration[]which contains the datasource configurations of the given scope.- Löst aus:
IllegalArgumentException- if the givenpreferenceScopeparameter is not equal to a valid parameter value listed below.IllegalStateException- If the scope is USER_SCOPE and no HttpSession is available.- Seit:
- 7.5
- Siehe auch:
-
getDataSourceConfiguration
public static DataSourceConfiguration getDataSourceConfiguration(String configurationName, int preferenceScope) Returns theDataSourceConfigurationspecified by the given configuration name and scope.- Parameter:
configurationName- the name identifies the datasource configuration.preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.ALL_PREFERENCES
- Gibt zurück:
DataSourceConfiguration- the specified configuration if exists OR
null- if the specified configuration does not exist.- Löst aus:
IllegalArgumentException- if the givenpreferenceScopeparameter is not equal to a valid parameter value listed below.IllegalStateException- If the scope is USER_SCOPE and no HttpSession is available.- Seit:
- 7.5
-
exists
Checks if theDataSourceConfigurationspecified by the given configuration name does exist for user or system scope.- Parameter:
configurationName- the name identifies the datasource configuration.- Gibt zurück:
true- if the datasource configuration is known, otherwisefalse.- Seit:
- 7.5
- Siehe auch:
-
isWriteable
public static boolean isWriteable(int preferenceScope) Check if the scope is writable. The temporary scope is ever writable.- Parameter:
preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
- DataSourceConfigurationManager.ALL_PREFERENCES
- Gibt zurück:
- true if the scope is writable.
- Löst aus:
IllegalArgumentException- if the givenpreferenceScopeparameter is not equal to a valid parameter value listed below.- Seit:
- 7.5
-
isReadable
public static boolean isReadable(int preferenceScope) Check if the scope is readable. The temporary scope and all scope are ever readable.- Parameter:
preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
- DataSourceConfigurationManager.ALL_PREFERENCES
- Gibt zurück:
- true if the scope is readable.
- Löst aus:
IllegalArgumentException- if the givenpreferenceScopeparameter is not equal to a valid parameter value listed below.- Seit:
- 7.5
-
exists
Checks if theDataSourceConfigurationspecified by the given configuration name does exist for the given scope.- Parameter:
configurationName- the name identifies the datasource configuration.preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.APPLICATION
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
- Gibt zurück:
trueif the datasource configuration exist for the given scope, otherwisefalse.- Seit:
- 7.5
- Siehe auch:
-
createDataSourceConfiguration
public static @Nonnull DataSourceConfiguration createDataSourceConfiguration(String configurationName, int scope) throws SecurityException Creates a newDataSourceConfigurationusing the first parameter as configuration name. Afterwards the configuration properties will be saved for user or system scope, considering the second parameter.
This method ensures that the name of each created configuration object is unique. If the given configuration name is already used by an existing configuration in the same scope, the name will be changed by appending a count.- Parameter:
configurationName- the name identifies the specific datasource configuration. Must not be empty ornullscope- determines the scope for the new configuration.
Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.APPLICATION
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
- Gibt zurück:
DataSourceConfiguration- a new datasource configuration object.- Löst aus:
NullPointerException- If the supplied configuration name is null.IllegalArgumentException- If the supplied configuration name is empty or if the givenpreferenceScopeparameter is not equal to a valid parameter value listed below.SecurityException- if there is no write access to the given Java Preferences- Seit:
- 7.5
- Siehe auch:
-
removeDatasourceConfigurations
public static void removeDatasourceConfigurations(DataSourceConfiguration[] configs, int preferenceScope) Removes a collection ofDataSourceConfigurations from the given scope.- Parameter:
configs- An array of DataSourceConfigurations to remove.preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.APPLICATION
- Seit:
- 7.5
-
removeDatasourceConfiguration
@Deprecated public static void removeDatasourceConfiguration(String configurationName, int preferenceScope) throws IllegalArgumentException, SecurityException Veraltet.As of i-net Clear Reports 20.0, useremoveDatasourceConfiguration(DataSourceConfiguration)insteadRemoves the datasource configuration from the given scope.- Parameter:
configurationName- the unique name identifies the configuration.preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.APPLICATION
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
- Löst aus:
IllegalArgumentException- If the supplied configuration name isSecurityException- if you have no write rights to the preferences scope.nullor empty or if the givenpreferenceScopeparameter is not equal to a valid parameter value listed below.- Seit:
- 7.5
- Siehe auch:
-
removeDatasourceConfiguration
public static void removeDatasourceConfiguration(DataSourceConfiguration dsc) throws IllegalArgumentException, SecurityException Removes the datasource configuration. The method will take care of removing the datasource configuration from the scope it is currently stored in.- Parameter:
dsc- the datasource configuration to remove- Löst aus:
IllegalArgumentException- If the supplied configuration is nullSecurityException- if you have no write rights to the preferences scope.nullor empty or if the givenpreferenceScopeparameter is not equal to a valid parameter value listed below.- Seit:
- 20.0
- Siehe auch:
-
forceImportDataSourceConfigurations
public static void forceImportDataSourceConfigurations(int preferenceScope, File fileToImport) throws ReportException, SecurityException Imports data source configurations, replacing any existing ones with the same name- Parameter:
preferenceScope- scope to import into. Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.APPLICATION
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
fileToImport- representation of the XML file which contains the data source configurations for import- Löst aus:
ReportException- If the file can't be imported.SecurityException- if there is no write access to the given Java Preferences- Seit:
- 10.0
- Siehe auch:
-
importDataSourceConfigurations
public static void importDataSourceConfigurations(int preferenceScope, File importFile) throws ReportException Imports one or more data source configurations from an XML file. The supplied DataSourceConfiguration will be renamed if a DataSourceConfiguration with this name already exists.- Parameter:
preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.APPLICATION
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
importFile- representation of the XML file which contains the data source configurations for import- Löst aus:
ReportException- If the file can't imported.- Seit:
- 7.5
- Siehe auch:
-
importDataSourceConfigurations
public static void importDataSourceConfigurations(int preferenceScope, File importFile, boolean ignoreIfExist) throws ReportException, SecurityException Imports one or more data source configurations from an XML file.- Parameter:
preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.APPLICATION
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
importFile- representation of the XML file which contains the data source configurations for importignoreIfExist- True if the supplied DataSourceConfiguration should be ignored if a DataSourceConfiguration with this name already exists or false if the supplied DataSourceConfiguration should be renamed if a DataSourceConfiguration with this name already exists.- Löst aus:
ReportException- If the file can't import.SecurityException- if there is no write access to the given Java Preferences- Seit:
- 7.5
- Siehe auch:
-
importDataSourceConfigurations
public static DataSourceConfiguration[] importDataSourceConfigurations(int preferenceScope, InputStream importStream) throws ReportException Imports one or more data source configurations from an XML file. The supplied DataSourceConfiguration will be renamed if a DataSourceConfiguration with this name already exists.- Parameter:
preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
importStream- input stream of the XML content which contains the data source configurations for import- Gibt zurück:
- returns the list of configurations found in the import file
- Löst aus:
ReportException- If the file can't imported.- Seit:
- 7.5
- Siehe auch:
-
importDataSourceConfigurations
public static DataSourceConfiguration[] importDataSourceConfigurations(int preferenceScope, InputStream importStream, boolean ignoreIfExist) throws ReportException, SecurityException Imports one or more data source configurations from an XML file.- Parameter:
preferenceScope- Possible values:- DataSourceConfigurationManager.SYSTEM_PREFERENCES
- DataSourceConfigurationManager.USER_PREFERENCES
- DataSourceConfigurationManager.TEMPORARY_PREFERENCES
- DataSourceConfigurationManager.USER_SESSION
importStream- input stream of the XML content which contains the data source configurations for importignoreIfExist- True if the supplied DataSourceConfiguration should be ignored if a DataSourceConfiguration with this name already exists or false if the supplied DataSourceConfiguration should be renamed if a DataSourceConfiguration with this name already exists.- Gibt zurück:
- returns the list of configurations found by the import
- Löst aus:
ReportException- If the file can't import.SecurityException- if there is no write access to the given Java Preferences- Seit:
- 20.0
- Siehe auch:
-
exportDataSourceConfigurations
public static void exportDataSourceConfigurations(DataSourceConfiguration[] configs, File exportFile) throws ReportException Exports data source configurations to the given file in an XML format.- Parameter:
configs- Array which contains theDataSourceConfigurations for exportexportFile- representation of the target XML file- Löst aus:
ReportException- if any error occur on saving- Seit:
- 7.5
- Siehe auch:
-
exportDataSourceConfigurations
public static void exportDataSourceConfigurations(DataSourceConfiguration[] configs, OutputStream stream) throws ReportException Exports data source configurations to the given file in an XML format.- Parameter:
configs- Array which contains theDataSourceConfigurations for exportstream- the target XML output- Löst aus:
ReportException- if any error occur on saving- Seit:
- 20.0
- Siehe auch:
-
addDataSourceConfigurationListener
Add here aDataSourceConfigurationChangeListenerto get informed when aDataSourceConfigurationwas edited.- Parameter:
dscl- theDataSourceConfigurationChangeListenerthat get informed about changes ofDataSourceConfigurationobjects.- Seit:
- 7.5
-
getDataSourceConfigurationListeners
Returns the list of listeners. This can be used to fire own events to all registered listeners.- Gibt zurück:
- an array of DataSourceConfigurationChangeListener
- Seit:
- 8.0
-
removeDataSourceConfigurationListener
public static void removeDataSourceConfigurationListener(DataSourceConfigurationChangeListener dscl) Removes the listener from list. It will receive no notification after unregistering.- Parameter:
dscl- the listener to be removed.- Seit:
- 7.5
-
getDataSource
Returns theDataSourceConfigurationspecified by the given name. The search order is session, temporary, application, user, system- Parameter:
name- the name identifies the data source.- Gibt zurück:
DataSourceConfiguration- the specified data source if exists ORnull- Seit:
- 20.0
-
getDataSource
Returns theDataSourceConfigurationspecified by the given uid. This method does not search in the session scope.- Parameter:
uid- the unique id of the data source.- Gibt zurück:
DataSourceConfiguration- the specified data source if exists ORnull- Seit:
- 20.0
-