public class DataSourceConfigurationManager
extends java.lang.Object
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.DataSourceConfiguration
,
Datasource
Modifier and Type | Field and Description |
---|---|
static int |
ALL_PREFERENCES
Deprecated.
As of i-net Clear Reports 20.0
|
static int |
APPLICATION
This scope store the configuration in the persistence of the application.
|
static int |
NO_STORE
This scope does not store the configuration.
|
static int |
SYSTEM_PREFERENCES
This scope store the configuration in the system preferences.
|
static int |
TEMPORARY_PREFERENCES
This scope store the configuration only in the memory.
|
static int |
USER_PREFERENCES
This scope store the configuration in the user preferences.
|
static int |
USER_SESSION
This scope store the configuration in the servlet session.
|
Modifier and Type | Method and Description |
---|---|
static void |
addDataSourceConfigurationListener(DataSourceConfigurationChangeListener dscl)
Add here a
DataSourceConfigurationChangeListener to get informed when
a DataSourceConfiguration was edited. |
static DataSourceConfiguration |
createDataSourceConfiguration(java.lang.String configurationName,
int scope)
Creates a new
DataSourceConfiguration using the first parameter
as configuration name. |
static boolean |
exists(java.lang.String configurationName)
Checks if the
DataSourceConfiguration specified by the given configuration name
does exist for user or system scope. |
static boolean |
exists(java.lang.String configurationName,
int preferenceScope)
Checks if the
DataSourceConfiguration specified by the given configuration name
does exist for the given scope. |
static void |
exportDataSourceConfigurations(DataSourceConfiguration[] configs,
java.io.File exportFile)
Exports data source configurations to the given file in an XML format.
|
static void |
exportDataSourceConfigurations(DataSourceConfiguration[] configs,
java.io.OutputStream stream)
Exports data source configurations to the given file in an XML format.
|
static void |
forceImportDataSourceConfigurations(int preferenceScope,
java.io.File fileToImport)
Imports data source configurations, replacing any existing ones with the same name
|
static DataSourceConfiguration |
getDataSource(java.lang.String name)
Returns the
DataSourceConfiguration specified by the given name. |
static DataSourceConfiguration |
getDataSource(com.inet.id.GUID uid)
Returns the
DataSourceConfiguration specified by the given uid. |
static DataSourceConfiguration |
getDataSourceConfiguration(java.lang.String configurationName,
int preferenceScope)
Returns the
DataSourceConfiguration specified by the given configuration
name and scope. |
static DataSourceConfigurationChangeListener[] |
getDataSourceConfigurationListeners()
Returns the list of listeners.
|
static java.lang.String[] |
getDataSourceConfigurationNames()
Returns the configuration names of all
DataSourceConfiguration s
stored for user and system scope. |
static java.lang.String[] |
getDataSourceConfigurationNames(int preferenceScope)
Returns the configuration names of all
DataSourceConfiguration s
stored for the given scope. |
static DataSourceConfiguration[] |
getDataSourceConfigurations(int scope)
Returns the
DataSourceConfiguration objects stored for the given scope. |
static java.lang.String |
getUniqueName(java.lang.String configurationName,
int preferenceScope)
Creates a unique configuration name from the supplied name for the given scope.
|
static void |
importDataSourceConfigurations(int preferenceScope,
java.io.File importFile)
Imports one or more data source configurations from an XML file.
|
static void |
importDataSourceConfigurations(int preferenceScope,
java.io.File importFile,
boolean ignoreIfExist)
Imports one or more data source configurations from an XML file.
|
static DataSourceConfiguration[] |
importDataSourceConfigurations(int preferenceScope,
java.io.InputStream importStream)
Imports one or more data source configurations from an XML file.
|
static DataSourceConfiguration[] |
importDataSourceConfigurations(int preferenceScope,
java.io.InputStream importStream,
boolean ignoreIfExist)
Imports one or more data source configurations from an XML file.
|
static boolean |
isReadable(int preferenceScope)
Check if the scope is readable.
|
static boolean |
isWriteable(int preferenceScope)
Check if the scope is writable.
|
static void |
removeDataSourceConfigurationListener(DataSourceConfigurationChangeListener dscl)
Removes the listener from list.
|
static void |
removeDatasourceConfiguration(java.lang.String configurationName,
int preferenceScope)
Deprecated.
As of i-net Clear Reports 20.0, use
removeDatasourceConfiguration(DataSourceConfiguration) instead |
static void |
removeDatasourceConfiguration(DataSourceConfiguration dsc)
Removes the datasource configuration.
|
static void |
removeDatasourceConfigurations(DataSourceConfiguration[] configs,
int preferenceScope)
Removes a collection of
DataSourceConfiguration s from the given scope. |
public static final int NO_STORE
public static final int SYSTEM_PREFERENCES
public static final int USER_PREFERENCES
@Deprecated public static final int ALL_PREFERENCES
APPLICATION
) configurations.APPLICATION
,
Constant Field Valuespublic static final int TEMPORARY_PREFERENCES
public static final int USER_SESSION
public static final int APPLICATION
public static java.lang.String getUniqueName(java.lang.String configurationName, int preferenceScope)
configurationName
- the name that will be used as a basis for the unique name.preferenceScope
- Possible values:
String
- a unique configuration name.public static java.lang.String[] getDataSourceConfigurationNames()
DataSourceConfiguration
s
stored for user and system scope.String[]
which contains the datasource configuration names.getDataSourceConfigurationNames(int)
public static java.lang.String[] getDataSourceConfigurationNames(int preferenceScope)
DataSourceConfiguration
s
stored for the given scope.preferenceScope
- Possible values:
String[]
which contains the datasource configuration names.java.lang.IllegalArgumentException
- if the given preferenceScope
parameter
is not equal to a valid parameter value listed below.getDataSourceConfigurationNames()
public static DataSourceConfiguration[] getDataSourceConfigurations(int scope)
DataSourceConfiguration
objects stored for the given scope.scope
- Possible values:
DataSourceConfiguration[]
which contains the datasource configurations of the given scope.java.lang.IllegalArgumentException
- if the given preferenceScope
parameter
is not equal to a valid parameter value listed below.java.lang.IllegalStateException
- If the scope is USER_SCOPE and no HttpSession is available.getDataSourceConfiguration(String, int)
public static DataSourceConfiguration getDataSourceConfiguration(java.lang.String configurationName, int preferenceScope)
DataSourceConfiguration
specified by the given configuration
name and scope.configurationName
- the name identifies the datasource configuration.preferenceScope
- Possible values:
DataSourceConfiguration
- the specified configuration if exists ORnull
- if the specified configuration does not exist.java.lang.IllegalArgumentException
- if the given preferenceScope
parameter
is not equal to a valid parameter value listed below.java.lang.IllegalStateException
- If the scope is USER_SCOPE and no HttpSession is available.public static boolean exists(java.lang.String configurationName)
DataSourceConfiguration
specified by the given configuration name
does exist for user or system scope.configurationName
- the name identifies the datasource configuration.true
- if the datasource configuration is known, otherwise false
.exists(String, int)
public static boolean isWriteable(int preferenceScope)
preferenceScope
- Possible values:
java.lang.IllegalArgumentException
- if the given preferenceScope
parameter
is not equal to a valid parameter value listed below.public static boolean isReadable(int preferenceScope)
preferenceScope
- Possible values:
java.lang.IllegalArgumentException
- if the given preferenceScope
parameter
is not equal to a valid parameter value listed below.public static boolean exists(java.lang.String configurationName, int preferenceScope)
DataSourceConfiguration
specified by the given configuration name
does exist for the given scope.configurationName
- the name identifies the datasource configuration.preferenceScope
- Possible values:
true
if the datasource configuration exist for the given scope, otherwise false
.exists(String)
public static DataSourceConfiguration createDataSourceConfiguration(java.lang.String configurationName, int scope) throws java.lang.SecurityException
DataSourceConfiguration
using the first parameter
as configuration name. Afterwards the configuration properties will be saved for
user or system scope, considering the second parameter.configurationName
- the name identifies the specific datasource configuration.
Must not be empty or null
scope
- determines the scope for the new configuration.DataSourceConfiguration
- a new datasource configuration object.java.lang.NullPointerException
- If the supplied configuration name is null.java.lang.IllegalArgumentException
- If the supplied configuration name is
empty or if the given preferenceScope
parameter is not equal to a valid parameter value listed below.java.lang.SecurityException
- if there is no write access to the given Java Preferencessave(DataSourceConfiguration, int)
,
DataSourceConfiguration
,
DatabaseTables.createDatasource(String)
public static void removeDatasourceConfigurations(DataSourceConfiguration[] configs, int preferenceScope)
DataSourceConfiguration
s from the given scope.configs
- An array of DataSourceConfigurations to remove.preferenceScope
- Possible values:
@Deprecated public static void removeDatasourceConfiguration(java.lang.String configurationName, int preferenceScope) throws java.lang.IllegalArgumentException, java.lang.SecurityException
removeDatasourceConfiguration(DataSourceConfiguration)
insteadconfigurationName
- the unique name identifies the configuration.preferenceScope
- Possible values:
java.lang.IllegalArgumentException
- If the supplied configuration name isjava.lang.SecurityException
- if you have no write rights to the preferences scope.
null
or empty or if the given preferenceScope
parameter is not equal to a valid parameter value listed below.createDataSourceConfiguration(String, int)
public static void removeDatasourceConfiguration(DataSourceConfiguration dsc) throws java.lang.IllegalArgumentException, java.lang.SecurityException
dsc
- the datasource configuration to removejava.lang.IllegalArgumentException
- If the supplied configuration is nulljava.lang.SecurityException
- if you have no write rights to the preferences scope.
null
or empty or if the given preferenceScope
parameter is not equal to a valid parameter value listed below.getDataSource(GUID)
public static void forceImportDataSourceConfigurations(int preferenceScope, java.io.File fileToImport) throws ReportException, java.lang.SecurityException
preferenceScope
- scope to import into.
Possible values:
fileToImport
- representation of the XML file which contains the data source
configurations for importReportException
- If the file can't be imported.java.lang.SecurityException
- if there is no write access to the given Java PreferencesimportDataSourceConfigurations(int, File)
public static void importDataSourceConfigurations(int preferenceScope, java.io.File importFile) throws ReportException
preferenceScope
- Possible values:
importFile
- representation of the XML file which contains the data source configurations for importReportException
- If the file can't imported.exportDataSourceConfigurations(DataSourceConfiguration[], File)
public static void importDataSourceConfigurations(int preferenceScope, java.io.File importFile, boolean ignoreIfExist) throws ReportException, java.lang.SecurityException
preferenceScope
- Possible values:
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.ReportException
- If the file can't import.java.lang.SecurityException
- if there is no write access to the given Java PreferencesexportDataSourceConfigurations(DataSourceConfiguration[], File)
public static DataSourceConfiguration[] importDataSourceConfigurations(int preferenceScope, java.io.InputStream importStream) throws ReportException
preferenceScope
- Possible values:
importStream
- input stream of the XML content which contains the data source configurations for importReportException
- If the file can't imported.exportDataSourceConfigurations(DataSourceConfiguration[], File)
public static DataSourceConfiguration[] importDataSourceConfigurations(int preferenceScope, java.io.InputStream importStream, boolean ignoreIfExist) throws ReportException, java.lang.SecurityException
preferenceScope
- Possible values:
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.ReportException
- If the file can't import.java.lang.SecurityException
- if there is no write access to the given Java PreferencesexportDataSourceConfigurations(DataSourceConfiguration[], File)
public static void exportDataSourceConfigurations(DataSourceConfiguration[] configs, java.io.File exportFile) throws ReportException
configs
- Array which contains the DataSourceConfiguration
s for exportexportFile
- representation of the target XML fileReportException
- if any error occur on savingimportDataSourceConfigurations(int, File)
public static void exportDataSourceConfigurations(DataSourceConfiguration[] configs, java.io.OutputStream stream) throws ReportException
configs
- Array which contains the DataSourceConfiguration
s for exportstream
- the target XML outputReportException
- if any error occur on savingimportDataSourceConfigurations(int, File)
public static void addDataSourceConfigurationListener(DataSourceConfigurationChangeListener dscl)
DataSourceConfigurationChangeListener
to get informed when
a DataSourceConfiguration
was edited.dscl
- the DataSourceConfigurationChangeListener
that get informed about changes of DataSourceConfiguration
objects.public static DataSourceConfigurationChangeListener[] getDataSourceConfigurationListeners()
public static void removeDataSourceConfigurationListener(DataSourceConfigurationChangeListener dscl)
dscl
- the listener to be removed.public static DataSourceConfiguration getDataSource(java.lang.String name)
DataSourceConfiguration
specified by the given name.
The search order is session, temporary, application, user, systemname
- the name identifies the data source.DataSourceConfiguration
- the specified data source if exists OR null
public static DataSourceConfiguration getDataSource(com.inet.id.GUID uid)
DataSourceConfiguration
specified by the given uid.
This method does not search in the session scope.uid
- the unique id of the data source.DataSourceConfiguration
- the specified data source if exists OR null
Copyright © 1999-2020 by i-net software GmbH