Style Intelligence v12.0

inetsoft.uql.service
Class QueryRegistry

java.lang.Object
  extended by inetsoft.uql.service.QueryRegistry
Direct Known Subclasses:
RemoteQueryRegistry

public class QueryRegistry
extends Object

Query registry stores information about all queries. The data is stored in a XML file.


Field Summary
 inetsoft.util.DataChangeListener changeListener
          Listener added to be notified of the registry has changed in the data space.
static String QUERY
           
protected  long ts
           
 
Constructor Summary
protected QueryRegistry()
          Constructor.
protected QueryRegistry(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.
protected  boolean checkPermission(String resource, char access)
           
static void clear()
          Clear cached query registry.
protected  void fireEvent(long ots)
          Fire event.
protected  void fireModifiedEvent()
          Fire a modified event.
protected  inetsoft.util.ReportKey getKey()
          Gets the report key with which this instance is configured.
 Enumeration getQueries()
          Deprecated.  
 XQuery getQuery(String qname)
          Get query object by its name.
 String getQueryDatasource(String qname)
          Get data source of specified query.
 String getQueryFolder(String qname)
          Get folder of specified query.
 String[] getQueryNames()
          Get names of all the queries in this repository.
 String[] getQueryNames(String ds, String folder, boolean checkFolder)
          Get names of query in specified data source and folder.
 String getQueryType(String qname)
          Get type of specified query.
static QueryRegistry getRegistry()
          Get query registry.
protected  void heartbeat()
          Do a heartbeat to synchronize data.
protected  void init(boolean event)
          Initialize queries.
 boolean isLoaded(String qname)
          Check if the query has been created.
 boolean isQueryVisible(String qname)
          Return if query is visible or not.
 long lastModified()
          Get last modified timestamp.
 void load(InputStream in)
          Load query registry fom an input stream.
 void load(InputStream in, boolean overwrite)
          Load query registry fom an input stream.
 XQuery parseXQuery(Element elem)
          Parse an xml element to get a query object.
 void refresh(boolean event)
          Refresh query registry.
 void refresh(boolean event, boolean force)
          Refresh query registry.
 void removeAllQueries()
          Remove all quries.
 void removeModifiedListener(PropertyChangeListener listener)
          Remove a modified listener.
 void removeQuery(String qname)
          Remove a query from the repository.
 void removeRefreshedListener(PropertyChangeListener listener)
          Remove a refresh listener.
 void save()
          Save the registry xml representation to registry file.
 void save(OutputStream output)
          Save the registry xml representation to an output stream.
 void setQuery(XQuery dx)
          Add or replace a query in the repository.
 void setQuery(XQuery dx, String oname)
          Add or replace a query in the repository.
protected  void teardown()
          Tear down query registry.
 void updateQuery(XQuery dx, String oname)
          Update a query.
 void updateQuery(XQuery dx, String oname, Boolean actionRecord)
          Update a query.
 void writeXQuery(PrintWriter writer, XQuery dx)
          Write an xquery.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUERY

public static final String QUERY
See Also:
Constant Field Values

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

QueryRegistry

protected QueryRegistry()
                 throws Exception
Constructor.

Throws:
Exception

QueryRegistry

protected QueryRegistry(Object key)
                 throws Exception
Constructor.

Throws:
Exception
Method Detail

getRegistry

public static QueryRegistry getRegistry()
Get query registry.

Returns:
query registry if any, null otherwise.

clear

public static void clear()
Clear cached query 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 queries.

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

refresh

public void refresh(boolean event)
Refresh query registry.

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

refresh

public void refresh(boolean event,
                    boolean force)
Refresh query 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.

removeAllQueries

public void removeAllQueries()
Remove all quries.


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 query registry fom an input stream.

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

load

public void load(InputStream in,
                 boolean overwrite)
          throws Exception
Load query registry fom an input stream.

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

getQueryNames

public String[] getQueryNames()
Get names of all the queries in this repository.

Returns:
names of all the queries.

getQueryNames

public String[] getQueryNames(String ds,
                              String folder,
                              boolean checkFolder)
Get names of query in specified data source and folder.


getQueryDatasource

public String getQueryDatasource(String qname)
Get data source of specified query.


getQueryFolder

public String getQueryFolder(String qname)
Get folder of specified query.


getQueryType

public String getQueryType(String qname)
Get type of specified query.


isQueryVisible

public boolean isQueryVisible(String qname)
Return if query is visible or not.


getQuery

public XQuery getQuery(String qname)
Get query object by its name.

Parameters:
qname - the specified query name.
Returns:
corresponding query object if any, null otherwise.

getQueries

public Enumeration getQueries()
Deprecated. 

Get all the queries.

Returns:
all the queries.

setQuery

public void setQuery(XQuery dx)
Add or replace a query in the repository.

Parameters:
dx - the specified query object.

setQuery

public void setQuery(XQuery dx,
                     String oname)
Add or replace a query in the repository.

Parameters:
dx - the specified query object.
oname - only used in RempteQueryRegistry.

isLoaded

public boolean isLoaded(String qname)
Check if the query has been created.


removeQuery

public void removeQuery(String qname)
Remove a query from the repository.

Parameters:
qname - the specified query name.

updateQuery

public void updateQuery(XQuery dx,
                        String oname)
Update a query.


updateQuery

public void updateQuery(XQuery dx,
                        String oname,
                        Boolean actionRecord)
Update a query.


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 xml representation to an output stream.

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

writeXQuery

public void writeXQuery(PrintWriter writer,
                        XQuery dx)
                 throws Exception
Write an xquery.

Parameters:
writer - the speciefied print writer.
dx - the speciefied xquery.
Throws:
Exception

parseXQuery

public XQuery parseXQuery(Element elem)
Parse an xml element to get a query object.

Parameters:
elem - the specified xml element.
Returns:
the corresponding query object.

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.

checkPermission

protected boolean checkPermission(String resource,
                                  char access)

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