org.glite.rgma
Interface Consumer

All Superinterfaces:
Resource

public interface Consumer
extends Resource

A client uses a Consumer to retrieve data from one or more producers. A Consumer is created using a ConsumerFactory.

See Also:
ConsumerFactory.createConsumer(org.glite.rgma.TimeInterval, java.lang.String, org.glite.rgma.QueryProperties)

Method Summary
 void abort()
          Aborts the current query.
 int count()
          Deprecated.  
 boolean hasAborted()
          Determines if the last query has aborted.
 boolean isExecuting()
          Deprecated. Use ResultSet#endOfResults
 ResultSet pop(int maxCount)
          Retrieves at most maxCount tuples from the consumer that it has received from producers.
 ResultSet popAll()
          Deprecated.  
 void start(TimeInterval timeout)
          Starts this consumer's query, using the mediator to locate producers, terminating after the specified time interval.
 void start(TimeInterval timeout, ResourceEndpointList producers)
          Starts this consumer's query, contacting the specified producers, terminating after the specified time interval.
 
Methods inherited from interface org.glite.rgma.Resource
close, destroy, getResourceEndpoint, getTerminationInterval, setTerminationInterval, showSignOfLife
 

Method Detail

isExecuting

public boolean isExecuting()
                    throws UnknownResourceException,
                           RemoteException
Deprecated. Use ResultSet#endOfResults

Determines whether the last query is still executing.

Returns:
true if the query is still executing.
Throws:
UnknownResourceException - If the consumer resource is not found.
RemoteException - If the service could not be contacted.
See Also:
start(TimeInterval), start(TimeInterval, ResourceEndpointList), abort(), hasAborted(), ResultSet.endOfResults()

abort

public void abort()
           throws RGMAException,
                  UnknownResourceException,
                  RemoteException
Aborts the current query.

Throws:
RGMAException - If the query has not been started.
UnknownResourceException - If the consumer resource is not found.
RemoteException - If the service could not be contacted.
See Also:
hasAborted(), start(TimeInterval), start(TimeInterval, ResourceEndpointList), isExecuting()

count

public int count()
          throws UnknownResourceException,
                 RemoteException
Deprecated.  

Returns the number of tuples that are available to pop. While a query is still executing, the number of tuples available to a pop call may be greater than the number returned by a previous call to count, as tuples can be added in the intervening time. Once isExecuting returns false, the value of count can no longer increase, but will just decrease as tuples are popped.

Returns:
The number of tuples that are available to pop.
Throws:
UnknownResourceException - If the consumer resource is not found.
RemoteException - If the service could not be contacted.
See Also:
pop(int), popAll(), isExecuting()

hasAborted

public boolean hasAborted()
                   throws UnknownResourceException,
                          RemoteException
Determines if the last query has aborted.

Returns:
true if the query was aborted and didn't stop of its own accord.
Throws:
UnknownResourceException - If the consumer resource is not found.
RemoteException - If the service could not be contacted.
See Also:
abort(), start(TimeInterval), start(TimeInterval, ResourceEndpointList), isExecuting()

pop

public ResultSet pop(int maxCount)
              throws UnknownResourceException,
                     RemoteException,
                     RGMAException
Retrieves at most maxCount tuples from the consumer that it has received from producers.

Parameters:
maxCount - The maximum number of tuples to retrieve.
Returns:
A ResultSet containing the received tuples. An empty ResultSet with no metadata is returned if no tuples were found.
Throws:
UnknownResourceException - If the consumer resource is not found.
RemoteException - If the service could not be contacted.
RGMAException - If the query hasn't been started.
See Also:
popAll(), count()

popAll

public ResultSet popAll()
                 throws UnknownResourceException,
                        RemoteException,
                        RGMAException
Deprecated.  

Retrieves all data from the consumer that it has received from producers. To guarantee that this returns the full response to a query, it should be called after the query has finished executing (when isExecuting is false).

Returns:
A ResultSet containing the received tuples. An empty ResultSet with no metadata is returned if no tuples were found.
Throws:
UnknownResourceException - If the consumer resource is not found.
RemoteException - If the service could not be contacted.
RGMAException - If the query hasn't been started.
See Also:
pop(int), count()

start

public void start(TimeInterval timeout)
           throws UnknownResourceException,
                  RemoteException,
                  RGMAException
Starts this consumer's query, using the mediator to locate producers, terminating after the specified time interval. There is no infinite interval; just set the timeout to be very large if this is the effect you want (e.g. 1000 days).

Parameters:
timeout - Time interval after which the query will automatically be aborted.
Throws:
UnknownResourceException - If the consumer resource is not found.
RemoteException - If the service could not be contacted.
RGMAException - If the query is currently executing.
See Also:
abort(), start(TimeInterval, ResourceEndpointList), isExecuting()

start

public void start(TimeInterval timeout,
                  ResourceEndpointList producers)
           throws UnknownResourceException,
                  RemoteException,
                  RGMAException
Starts this consumer's query, contacting the specified producers, terminating after the specified time interval. There is no infinite interval; just set the timeout to be very large if this is the effect you want (e.g. 1000 days).

Parameters:
timeout - Time interval after which the query will automatically be aborted.
producers - List of producers to contact.
Throws:
UnknownResourceException - If the consumer resource is not found.
RemoteException - If the service could not be contacted.
RGMAException - If the query is currently executing.
See Also:
start(TimeInterval)