Style Intelligence v12.0

inetsoft.uql.service
Class DataSourceRegistry

java.lang.Object
  extended by inetsoft.uql.service.DataSourceRegistry
Direct Known Subclasses:
RemoteDataSourceRegistry

public class DataSourceRegistry
extends Object

Data source registry stores information on all data sources. The information is stored in a XML file. Applications should not use the data source registry directly. The registry information can be accessed through the XRepository service API.


Field Summary
 inetsoft.util.DataChangeListener changeListener
          Listener added to be notified of the registry has changed in the data space.
static String DATASOURCE
          Data source.
static String DATASOURCEFOLDER
          Data source folder.
protected  long ts
           
 
Constructor Summary
protected DataSourceRegistry()
          Constructor.
protected DataSourceRegistry(Object key)
          Constructor.
 
Method Summary
 void addModifiedListener(PropertyChangeListener listener)
          Add a modified listener that will be notified if the query registry has changed when saved.
 void addRefreshedListener(PropertyChangeListener listener)
          Add a refresh listener that will be notified if the datasource registry has changed on disk.
 boolean checkPermission(String resource, char access)
           
static void clear()
          Clear cached data source registry.
 void clearCache()
          Clear source cache.
 boolean containDatasource(String dsname)
          Check if the specified data source exists in this repository.
 boolean containDataSourceFolder(String name)
          Check if the specified data source folder exists in this repository.
 boolean containObject(inetsoft.util.xml.XMLStorage.Filter[] filters)
           
protected  void fireEvent(long ots)
          Fire event.
protected  void fireModifiedEvent()
          Fire a modified event.
 String[] getAttributes(inetsoft.util.xml.XMLStorage.Filter[] filters, String attribute)
           
 XDataModel getDataModel(String datasource)
          Get data model object of a data source.
 XDataSource getDataSource(String dsname)
          Get data source object by its name.
 DataSourceFolder getDataSourceFolder(String name)
          Get data source folder object by its name.
 String[] getDataSourceFolderFullNames()
          Get all data source folder names in repository.
 String[] getDataSourceFolderNames()
          Get all data source folder names in repository.
 String[] getDataSourceFullNames()
          Get full names of all the data sources in this repository.
 String[] getDataSourceNames()
          Get simple names of all the data sources in this repository.
 XDomain getDomain(String datasource)
          Get domain object of a data source.
 String[] getExtendedLogicalModelNames(String ds, String base)
          Get names of extended logical model.
 String[] getExtendedPartitionNames(String ds, String base)
          Get names of extended partition.
protected  inetsoft.util.ReportKey getKey()
          Gets the report key with which this instance is configured.
 Object getObject(inetsoft.util.xml.XMLStorage.Filter[] filters)
           
static DataSourceRegistry getRegistry()
          Get data source registry.
 List getSubDataSourceNames(String path)
          Get the children data source from the specified data source folder path.
 List getSubfolderNames(String path)
          Get the children data source folder from the specified data source folder path.
protected  void heartbeat()
          Do a heartbeat to synchronize data.
protected  void init(boolean event)
          Initialize data sources.
 boolean isLoaded(inetsoft.util.xml.XMLStorage.Filter[] filters)
           
 long lastModified()
          Get last modified timestamp.
 void load(InputStream in)
          Load a registry, and will not check if datasources are duplicated.
 void load(InputStream in, boolean overwrite)
          Load a registry, and will check if datasources are duplicated.
 DataSourceFolder parseDataSourceFolder(Element elem)
          Parse data source folder.
 void parseDomain(Element rnode)
          Parse Domain.
 void parseXDataSource(Element rnode)
          Parse XDataSource.
 XDataSource parseXDataSource2(Element elem, boolean check)
          Parse XDataSource.
 void refresh(boolean event)
          Refresh data source registry.
 void refresh(boolean event, boolean force)
          Refresh data source registry.
 void removeAllDataSources()
          Remove all data sources.
protected  void removeDataModel(String datasource)
          Remove a data model from the repository.
 void removeDataSource(String dxname)
          Remove a data source from the repository.
 void removeDataSourceFolder(String name)
          Remove a data source folder and its children from the repository.
 void removeDomain(String datasource)
          Remove a domain object from the repository.
 void removeModifiedListener(PropertyChangeListener listener)
          Remove a modified listener.
 void removeObjects(inetsoft.util.xml.XMLStorage.Filter[] filters)
           
 void removeRefreshedListener(PropertyChangeListener listener)
          Remove a refresh listener.
 void renameDatasource(String oname, String nname)
          Data source renamed, sync data model and domain.
 void renameDataSourceFolder(String oname, String nname)
          Data source folder renamed, sync its subfolders and sub datasources.
 void save()
          Save the registry xml representation to registry file.
 void save(OutputStream output)
          Save the registry information to an output stream.
protected  void save(OutputStream output, boolean sync)
          Save the registry information to an output stream.
 void setDataModel(XDataModel dx)
          Add a data model object to the repository.
 void setDataSource(XDataSource dx)
          Add or replace a data source in the repository.
 void setDataSource(XDataSource dx, String oname, Boolean actionRecord)
          Add or replace a data source in the repository.
 void setDataSourceFolder(DataSourceFolder folder)
          Add or replace a data source folder.
 void setDomain(XDomain dx)
          Add a domain object to the repository.
 void setObject(inetsoft.util.xml.XMLStorage.Filter[] filters, Object obj)
           
protected  void teardown()
          Tear down query registry.
 void updateDataSource(String dxname, Element elem)
          Update a data source.
 void updateObject(inetsoft.util.xml.XMLStorage.Filter[] filters, Object obj, String[] attributes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATASOURCE

public static String DATASOURCE
Data source.


DATASOURCEFOLDER

public static String DATASOURCEFOLDER
Data source folder.


changeListener

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


ts

protected long ts
Constructor Detail

DataSourceRegistry

protected DataSourceRegistry()
                      throws Exception
Constructor.

Throws:
Exception

DataSourceRegistry

protected DataSourceRegistry(Object key)
                      throws Exception
Constructor.

Throws:
Exception
Method Detail

getRegistry

public static DataSourceRegistry getRegistry()
Get data source registry.

Returns:
data source registry if any, null otherwise.

clear

public static void clear()
Clear cached data source registry.


getKey

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

Returns:
the report key.

init

protected void init(boolean event)
             throws Exception
Initialize data sources.

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

refresh

public void refresh(boolean event)
Refresh data source registry.

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

refresh

public void refresh(boolean event,
                    boolean force)
Refresh data source registry.

Parameters:
event - true if should fire event when resource changes.
force - true if force registry to be reloaded no matter if it is up to date.

removeAllDataSources

public void removeAllDataSources()
Remove all data sources.


lastModified

public long lastModified()
Get last modified timestamp.

Returns:
last modified timestamp.

teardown

protected void teardown()
Tear down query registry.


heartbeat

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


load

public void load(InputStream in)
          throws Exception
Load a registry, and will not check if datasources are duplicated.

Parameters:
in - the specified input stream.
Throws:
Exception

load

public void load(InputStream in,
                 boolean overwrite)
          throws Exception
Load a registry, and will check if datasources are duplicated.

Parameters:
in - the specified input stream.
Throws:
Exception

parseDomain

public void parseDomain(Element rnode)
                 throws Exception
Parse Domain.

Throws:
Exception

parseXDataSource

public void parseXDataSource(Element rnode)
                      throws Exception
Parse XDataSource.

Throws:
Exception

parseXDataSource2

public XDataSource parseXDataSource2(Element elem,
                                     boolean check)
                              throws Exception
Parse XDataSource.

Throws:
Exception

parseDataSourceFolder

public DataSourceFolder parseDataSourceFolder(Element elem)
Parse data source folder.


containDatasource

public boolean containDatasource(String dsname)
Check if the specified data source exists in this repository.


containDataSourceFolder

public boolean containDataSourceFolder(String name)
Check if the specified data source folder exists in this repository.


getDataSourceNames

public String[] getDataSourceNames()
Get simple names of all the data sources in this repository.

Returns:
names of all the data sources.

getDataSourceFullNames

public String[] getDataSourceFullNames()
Get full names of all the data sources in this repository.

Returns:
full names of all the data sources.

getDataSourceFolderNames

public String[] getDataSourceFolderNames()
Get all data source folder names in repository.

Returns:
names of all the data source folders.

getDataSourceFolderFullNames

public String[] getDataSourceFolderFullNames()
Get all data source folder names in repository.

Returns:
full names of all the data source folders.

getDataSource

public XDataSource getDataSource(String dsname)
Get data source object by its name.

Parameters:
dsname - the specified data source.
Returns:
corresponding data source object if any, null otherwise.

getDataSourceFolder

public DataSourceFolder getDataSourceFolder(String name)
Get data source folder object by its name.

Parameters:
name - the specified data source folder.
Returns:
corresponding data source folder object if any, null otherwise.

setDataSource

public void setDataSource(XDataSource dx)
Add or replace a data source in the repository.

Parameters:
dx - the specified data source.

setDataSource

public void setDataSource(XDataSource dx,
                          String oname,
                          Boolean actionRecord)
Add or replace a data source in the repository.

Parameters:
dx - the specified data source.
oname - only used in RempteDataSourceRegistry.
actionRecord - only used in RemoteDataSourceRegistry.

setDataSourceFolder

public void setDataSourceFolder(DataSourceFolder folder)
Add or replace a data source folder.

Parameters:
folder - the specified data source folder.

removeDataSource

public void removeDataSource(String dxname)
Remove a data source from the repository.

Parameters:
dxname - the specified data source name.

updateDataSource

public void updateDataSource(String dxname,
                             Element elem)
                      throws Exception
Update a data source.

Parameters:
dxname - the specified data source name.
elem - the element with which the datasource will be updated.
Throws:
Exception

removeDataSourceFolder

public void removeDataSourceFolder(String name)
Remove a data source folder and its children from the repository.

Parameters:
name - the specified data source folder name.

getDomain

public XDomain getDomain(String datasource)
Get domain object of a data source.

Parameters:
datasource - the specified data source.
Returns:
domain object of the specified data source if any, null otherwise.

setDomain

public void setDomain(XDomain dx)
Add a domain object to the repository.

Parameters:
dx - the specified domain object to add.

renameDatasource

public void renameDatasource(String oname,
                             String nname)
Data source renamed, sync data model and domain.


renameDataSourceFolder

public void renameDataSourceFolder(String oname,
                                   String nname)
Data source folder renamed, sync its subfolders and sub datasources.


getSubfolderNames

public List getSubfolderNames(String path)
Get the children data source folder from the specified data source folder path.

Parameters:
path - the specified data source folder name.
Returns:
the children data source folder of the specified data source folder.

getSubDataSourceNames

public List getSubDataSourceNames(String path)
Get the children data source from the specified data source folder path.

Parameters:
path - the specified data source folder name.
Returns:
the children data source of the specified data source folder.

removeDomain

public void removeDomain(String datasource)
Remove a domain object from the repository.

Parameters:
datasource - the specified data source name.

getDataModel

public XDataModel getDataModel(String datasource)
Get data model object of a data source.

Parameters:
datasource - the specified data source name.
Returns:
data model object of the specified data source object if any, null otherwise.

setDataModel

public void setDataModel(XDataModel dx)
Add a data model object to the repository.

Parameters:
dx - the specified data model object.

removeDataModel

protected void removeDataModel(String datasource)
Remove a data model from the repository.

Parameters:
datasource - the specified data source name.

getExtendedLogicalModelNames

public String[] getExtendedLogicalModelNames(String ds,
                                             String base)
Get names of extended logical model.

Parameters:
ds - the name of data source.
base - the name of base logical model.

getExtendedPartitionNames

public String[] getExtendedPartitionNames(String ds,
                                          String base)
Get names of extended partition.

Parameters:
ds - the name of data source.
base - the name of base partition

save

public void save()
          throws Exception
Save the registry xml representation to registry file.

Throws:
Exception

save

public void save(OutputStream output)
          throws Exception
Save the registry information to an output stream.

Parameters:
output - the specified output stream.
Throws:
Exception

save

protected void save(OutputStream output,
                    boolean sync)
             throws Exception
Save the registry information to an output stream.

Parameters:
output - the specified output stream.
Throws:
Exception

fireEvent

protected void fireEvent(long ots)
Fire event.

Parameters:
ots - the specified last modified timestamp.

addRefreshedListener

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

Parameters:
listener - the specified refresh listener.

removeRefreshedListener

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

Parameters:
listener - the specified refresh listener.

fireModifiedEvent

protected void fireModifiedEvent()
Fire a modified event.


addModifiedListener

public void addModifiedListener(PropertyChangeListener listener)
Add a modified listener that will be notified if the query registry has changed when saved.

Parameters:
listener - the specified modified listener.

removeModifiedListener

public void removeModifiedListener(PropertyChangeListener listener)
Remove a modified listener.

Parameters:
listener - the specified modified listener.

isLoaded

public boolean isLoaded(inetsoft.util.xml.XMLStorage.Filter[] filters)

containObject

public boolean containObject(inetsoft.util.xml.XMLStorage.Filter[] filters)

setObject

public void setObject(inetsoft.util.xml.XMLStorage.Filter[] filters,
                      Object obj)

updateObject

public void updateObject(inetsoft.util.xml.XMLStorage.Filter[] filters,
                         Object obj,
                         String[] attributes)

getObject

public Object getObject(inetsoft.util.xml.XMLStorage.Filter[] filters)

removeObjects

public void removeObjects(inetsoft.util.xml.XMLStorage.Filter[] filters)

getAttributes

public String[] getAttributes(inetsoft.util.xml.XMLStorage.Filter[] filters,
                              String attribute)

checkPermission

public boolean checkPermission(String resource,
                               char access)

clearCache

public void clearCache()
Clear source cache.


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