org.edg.info
Class RegistryInstance

java.lang.Object
  extended byorg.edg.info.InstanceBase
      extended byorg.edg.info.RegistryInstance

public class RegistryInstance
extends InstanceBase

RegistryInstance is an object that supports the RegistryServlet. It offers package-level methods that correspond to Registry API methods. Synchronization has been added to prevent the Registry write operations from interfering with a Replica update.


Field Summary
 
Fields inherited from class org.edg.info.InstanceBase
DEFAULT_TERMINATION_INTERVAL_MS, s_maxTerminationInterval, s_minTerminationInterval
 
Constructor Summary
RegistryInstance(org.glite.rgma.services.config.RegistryConfig registryConfig)
          Creates a new RegistryInstance object.
 
Method Summary
 void addReplica(Replica replica)
          Delegates the replica update to the ReplicaManager.
 void destroy()
          This is called when the servlet is destroyed.
 void flushQueue(java.lang.String queueName, java.lang.String host)
           
 Message getCurrentMessageInFastQueue()
           
 Message getCurrentMessageInMediumQueue()
           
 Message getCurrentMessageInSlowQueue()
           
 org.glite.rgma.system.ResultSet getFixedColumnData(java.lang.String producerURL, int connectionId, java.lang.String tableName)
          Returns the column names, values and types of those columns a producer has declared as fixed.
 org.edg.info.system.RelevantPublisherInfo getInfoForOneTimeQuery(java.lang.String query, int queryType)
          Returns information that is needed for planning a latest/history query.
 org.glite.rgma.system.ProducerTableEntryList getMatchingProducersForTables(java.lang.String[] tables, java.lang.String predicate, boolean complete)
          DOCUMENT ME!
 Message[] getMessagesInFastQueue()
           
 Message[] getMessagesInMediumQueue()
           
 Message[] getMessagesInSlowQueue()
           
 org.glite.rgma.system.ResultSet getProducerInfo(java.lang.String url, int connectionId)
          Returns the column names of a producers table.
 java.util.Vector getRelevantProducers(java.lang.String tableName, java.lang.String predicate, int flags)
          Returns producers that are relevant to a Consumer's query.
 long getReplicationIntervalMillis()
           
 org.edg.info.system.ServletConnection getServletConnection(java.lang.String servletURL, int connectionId)
          This method was added to aid testing, in future a better mechanism should be adopted.
 java.lang.String getVDBName()
           
 boolean isReplicating()
           
 java.util.Vector registerContinuousQuery(java.lang.String url, int connectionId, java.lang.String query, int queryType, long clientTimeStamp, long terminationTime)
          Registers consumer with a CONTINUOUS query in database and returns list of relevant producers (can't return republishers, as there is a block at the moment in flags.matches()).
 void registerProducerTable(java.lang.String producerURL, int producerId, java.lang.String tableName, java.lang.String predicate, int flags, long clientTimeStamp, long terminationTime)
          Registers a producer view.
 void setConsumerTerminationTime(java.lang.String consumerURL, int connectionId, long clientTimeStamp, long terminationTime)
          Sets the termination time for a consumer.
 void setProducerTerminationTime(java.lang.String producerURL, int connectionId, long clientTimeStamp, long terminationTime)
          Sets the termination time for a producer.
 void unRegisterConsumer(java.lang.String url, int connectionId)
          Unregisters the Consumer.
 void unRegisterProducer(java.lang.String url, int connectionId)
          Attempts to unregister all tables belonging to a Producer.
 void unRegisterProducerTable(java.lang.String url, int connectionId, java.lang.String tableName)
          Attempts to un registry a Producer table.
 
Methods inherited from class org.edg.info.InstanceBase
canDestroy, disconnect, getCreationTimeMillis, getLastRegistryUpdateTimeMillis, getRegistryUpdateIntervalMillis, getResourceId, getStatus, getTerminationInterval, getTerminationIntervalMillis, getUserLastContactTimeMillis, isDestroyed, isTupleCheckingEnabled, notifyRegistrationThread, reconnect, setCloseCalled, setDestroyed, setRegistrationThread, setTerminationInterval, showSignOfLife, updateLastContactTime, updateRegistry, wasCloseCalled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegistryInstance

public RegistryInstance(org.glite.rgma.services.config.RegistryConfig registryConfig)
                 throws org.glite.rgma.system.RGMAException
Creates a new RegistryInstance object.

Method Detail

setConsumerTerminationTime

public void setConsumerTerminationTime(java.lang.String consumerURL,
                                       int connectionId,
                                       long clientTimeStamp,
                                       long terminationTime)
                                throws org.glite.rgma.system.RGMAException
Sets the termination time for a consumer.

Throws:
org.glite.rgma.system.RGMAException

getFixedColumnData

public org.glite.rgma.system.ResultSet getFixedColumnData(java.lang.String producerURL,
                                                          int connectionId,
                                                          java.lang.String tableName)
                                                   throws org.glite.rgma.system.RGMAException
Returns the column names, values and types of those columns a producer has declared as fixed.

Throws:
org.glite.rgma.system.RGMAException

getInfoForOneTimeQuery

public org.edg.info.system.RelevantPublisherInfo getInfoForOneTimeQuery(java.lang.String query,
                                                                        int queryType)
                                                                 throws org.glite.rgma.system.RGMAException
Returns information that is needed for planning a latest/history query.

Throws:
org.glite.rgma.system.RGMAException

getProducerInfo

public org.glite.rgma.system.ResultSet getProducerInfo(java.lang.String url,
                                                       int connectionId)
                                                throws org.glite.rgma.system.RGMAException
Returns the column names of a producers table. Its old and ugly and will be removed in the new web services version.

Throws:
org.glite.rgma.system.RGMAException

getMatchingProducersForTables

public org.glite.rgma.system.ProducerTableEntryList getMatchingProducersForTables(java.lang.String[] tables,
                                                                                  java.lang.String predicate,
                                                                                  boolean complete)
                                                                           throws org.glite.rgma.system.RGMAException
DOCUMENT ME!

Parameters:
tables - DOCUMENT ME!
predicate - DOCUMENT ME!
complete - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
org.glite.rgma.system.RGMAException - DOCUMENT ME!

setProducerTerminationTime

public void setProducerTerminationTime(java.lang.String producerURL,
                                       int connectionId,
                                       long clientTimeStamp,
                                       long terminationTime)
                                throws org.glite.rgma.system.RGMAException
Sets the termination time for a producer.

Throws:
org.glite.rgma.system.RGMAException

getRelevantProducers

public java.util.Vector getRelevantProducers(java.lang.String tableName,
                                             java.lang.String predicate,
                                             int flags)
                                      throws org.glite.rgma.system.RGMAException
Returns producers that are relevant to a Consumer's query. The naming is somewhat awkward - getAllPublishersForTable() is better. It's used by the BrowserServlet but will probably be refactored under the new web services version.

Throws:
org.glite.rgma.system.RGMAException

getServletConnection

public org.edg.info.system.ServletConnection getServletConnection(java.lang.String servletURL,
                                                                  int connectionId)
                                                           throws org.glite.rgma.system.RGMAException
This method was added to aid testing, in future a better mechanism should be adopted.

Throws:
org.glite.rgma.system.RGMAException

addReplica

public void addReplica(Replica replica)
                throws org.glite.rgma.system.RGMAException
Delegates the replica update to the ReplicaManager.

Throws:
org.glite.rgma.system.RGMAException

destroy

public void destroy()
This is called when the servlet is destroyed.


registerContinuousQuery

public java.util.Vector registerContinuousQuery(java.lang.String url,
                                                int connectionId,
                                                java.lang.String query,
                                                int queryType,
                                                long clientTimeStamp,
                                                long terminationTime)
                                         throws org.glite.rgma.system.RGMAException
Registers consumer with a CONTINUOUS query in database and returns list of relevant producers (can't return republishers, as there is a block at the moment in flags.matches()).

Throws:
org.glite.rgma.system.RGMAException

registerProducerTable

public void registerProducerTable(java.lang.String producerURL,
                                  int producerId,
                                  java.lang.String tableName,
                                  java.lang.String predicate,
                                  int flags,
                                  long clientTimeStamp,
                                  long terminationTime)
                           throws org.glite.rgma.system.RGMAException
Registers a producer view. If necessary a new table is introduced into the schema. Also, any duplicate producers are removed.

Throws:
org.glite.rgma.system.RGMAException

unRegisterConsumer

public void unRegisterConsumer(java.lang.String url,
                               int connectionId)
                        throws org.glite.rgma.system.RGMAException
Unregisters the Consumer. If the record has been replicated to other Registries, the record will be marked for deletion, otherwise it will be removed immediately from the db.

Throws:
org.glite.rgma.system.RGMAException

unRegisterProducer

public void unRegisterProducer(java.lang.String url,
                               int connectionId)
                        throws org.glite.rgma.system.RGMAException
Attempts to unregister all tables belonging to a Producer.

Throws:
org.glite.rgma.system.RGMAException

unRegisterProducerTable

public void unRegisterProducerTable(java.lang.String url,
                                    int connectionId,
                                    java.lang.String tableName)
                             throws org.glite.rgma.system.RGMAException
Attempts to un registry a Producer table.

Throws:
org.glite.rgma.system.RGMAException

flushQueue

public void flushQueue(java.lang.String queueName,
                       java.lang.String host)
Parameters:
queueName -
host -

getVDBName

public java.lang.String getVDBName()
Returns:
Returns the vdb name of the registry instance.

isReplicating

public boolean isReplicating()
Returns:
Returns true if replication is running, false otherwise.

getReplicationIntervalMillis

public long getReplicationIntervalMillis()
Returns:
Returns the replication interval, defined in milliseconds.

getCurrentMessageInFastQueue

public Message getCurrentMessageInFastQueue()
See Also:
Messenger.getCopyOfCurrentMessageInFastQueue()

getMessagesInFastQueue

public Message[] getMessagesInFastQueue()
See Also:
Messenger.getCopyOfFastMessageQueue()

getCurrentMessageInSlowQueue

public Message getCurrentMessageInSlowQueue()
See Also:
Messenger.getCopyOfCurrentMessageInSlowQueue()

getMessagesInSlowQueue

public Message[] getMessagesInSlowQueue()
See Also:
Messenger.getCopyOfSlowMessageQueue()

getCurrentMessageInMediumQueue

public Message getCurrentMessageInMediumQueue()

getMessagesInMediumQueue

public Message[] getMessagesInMediumQueue()