IBM WebSphere Extended Deployment (XD)TM, Release 6.1
ObjectGrid API Specification

com.ibm.websphere.objectgrid.streamquery
Interface StreamQuerySet


public interface StreamQuerySet

This interface represents a set of stream query streams and views. Usually a stream query set consist of streams and views, where views only use the streams and other views defined in this set.

A StreamQuerySet object serves as a containment object for the stream and view metadata. It can be deployed or undeployed by calling setDeployed(boolean). Trying to deploy a deployed StreamQuerySet object or undeploy a non-deployed StreamQuerySet object will result in an exception.

A StreamQuerySet object can optionally provide an array of partition IDs. This is used when the maps used in this stream query set are partitioned. Users can specifically deploy this StreamQuerySet in particular partitions. If the partition array is not specified, then the stream query set will be deployed to all partitions.

Users can add a stream query set dynamically to an ObjectGrid instance and then deploy it. For example.

 // Add a stream query set 
 StreamQuerySet sqs = objectGrid.addStreamQuerySet("transactionVolumes");
 
 // Add a stream metadata 
 StreamMetadata stream = sqs.addStreamMetadata();
 
 // set the stream metadata values
 stream.setValueClass(SellBids.class).setSql("...");
 
 // Add a view metadata 
 ViewMetadata view = sqs.addViewMetadata();
 
 // set the view metadata values
 view.setSql("...");
 
 // deploy the stream query set 
 sqs.setDeployed(true);
 
This interface is designed to work with Spring-style programming. Please refer to StreamQueryManager for the example.

Since:
WAS XD 6.1
See Also:
StreamMetadata, ViewMetadata

Method Summary
 StreamMetadata addStreamMetadata()
          Create a StreamMetadata and add it to the StreamMetadata list of this StreamQuerySet.
 ViewMetadata addViewMetadata()
          Create a ViewMetadata and add it to the ViewMetadata list of this StreamQuerySet.
 StreamQuerySet copy()
          Deep copy this stream query set.
 StreamMetadata createStreamMetadata()
          This method creates a StreamMetadata.
 ViewMetadata createViewMetadata()
          This method create a ViewMetadata.
 java.lang.String getName()
           
 int[] getPartitions()
           
 java.util.List getStreamMetadatas()
          Returns the current list of StreamMetadatas.
 java.util.List getViewMetadatas()
          Returns the current list of ViewMetadatas.
 boolean isDeployed()
           
 boolean isViewResultsToListenersOnly()
           
 void setDeployed(boolean deployed)
          Deploy or undeploy this StreamQuerySet.
 void setName(java.lang.String name)
          Set the name of the stream query set
 void setPartitions(int[] partitions)
          Set the partitions to which the remote dynamic stream query is executed.
 void setStreamMetadatas(java.util.List streamMetadatas)
          This overwrites the current list of StreamMetadatas and replaces it with the supplied List of StreamMetadatas.
 void setViewMetadatas(java.util.List viewMetadatas)
          This overwrites the current list of ViewMetadatas and replaces it with the supplied List of ViewMetadatas.
 void setViewResultsToListenersOnly(boolean viewResultsToListenersOnly)
          This method is used to optimize the performance of retrieving the view results.
 

Method Detail

getName

java.lang.String getName()
Returns:
the name of the stream query set

setName

void setName(java.lang.String name)
Set the name of the stream query set

Parameters:
name - the name of the stream query set

createStreamMetadata

StreamMetadata createStreamMetadata()
This method creates a StreamMetadata.

Returns:
a StreamMetadata

addStreamMetadata

StreamMetadata addStreamMetadata()
Create a StreamMetadata and add it to the StreamMetadata list of this StreamQuerySet.

Returns:
a StreamMetadata
Throws:
java.lang.IllegalStateException - thrown if the StreamQuerySet is deployed.

getStreamMetadatas

java.util.List getStreamMetadatas()
Returns the current list of StreamMetadatas.

Returns:
the current list of StreamMetadatas.
See Also:
createStreamMetadata(), setStreamMetadatas(List)

setStreamMetadatas

void setStreamMetadatas(java.util.List streamMetadatas)
This overwrites the current list of StreamMetadatas and replaces it with the supplied List of StreamMetadatas.

Parameters:
streamMetadatas - List of StreamMetadatas
Throws:
java.lang.ClassCastException - if one of the elements in the provided list is not an instance of StreamMetadata
java.lang.IllegalArgumentException - if streamMetadatas contains a null reference or an invalid StreamMetadata
java.lang.IllegalStateException - thrown if the StreamQuerySet is deployed
See Also:
StreamMetadata

createViewMetadata

ViewMetadata createViewMetadata()
This method create a ViewMetadata.

Returns:
a ViewMetadata

addViewMetadata

ViewMetadata addViewMetadata()
Create a ViewMetadata and add it to the ViewMetadata list of this StreamQuerySet.

Returns:
a ViewMetadata

getViewMetadatas

java.util.List getViewMetadatas()
Returns the current list of ViewMetadatas.

Returns:
the current list of ViewMetadatas.
See Also:
createViewMetadata(), setViewMetadatas(List)

setViewMetadatas

void setViewMetadatas(java.util.List viewMetadatas)
This overwrites the current list of ViewMetadatas and replaces it with the supplied List of ViewMetadatas.

Parameters:
viewMetadatas - List of ViewMetadatas
Throws:
java.lang.ClassCastException - if one of the elements in the provided list is not an instance of ViewMetadata
java.lang.IllegalArgumentException - if viewMetadatas is null or empty, or it contains a null reference or an invalid ViewMetadata object.
java.lang.IllegalStateException - thrown if the StreamQuerySet is deployed.
See Also:
ViewMetadata

isDeployed

boolean isDeployed()
Returns:
true if the stream query set has been deployed, false otherwise.

setDeployed

void setDeployed(boolean deployed)
                 throws StreamQueryException
Deploy or undeploy this StreamQuerySet. This method will use a default Session object to deploy or undeploy the StreamQuerySet.

When security is enabled, this method requires an com.ibm.websphere.objectgrid.security.ObjectGridPermission with action "streamquery" if it is invoked from client.

Parameters:
deployed - set to true will deploy this StreamQuerySet; set to false will undeploy this StreamQuerySet.
Throws:
StreamQueryException - any exception during the deployment or undeployment
java.lang.IllegalStateException - deploy an already-deployed StreamQuerySet, or undeploy an undeployed StreamQuerySet

setPartitions

void setPartitions(int[] partitions)
Set the partitions to which the remote dynamic stream query is executed. If the partitions array is null or empty, then the stream query set will be deployed to all partitions.

Parameters:
partitions - the array containing the partition IDs
Throws:
java.lang.IllegalArgumentException - if the partitions are not valid for maps used by this stream query set
java.lang.IllegalStateException - if no view metadata is set or none of the view maps is specified; if the stream query set does not belongs to a client ObjectGrid

getPartitions

int[] getPartitions()
Returns:
the partitions to which the remote dynamic stream query is executed.
See Also:
setPartitions(int[])

setViewResultsToListenersOnly

void setViewResultsToListenersOnly(boolean viewResultsToListenersOnly)
This method is used to optimize the performance of retrieving the view results. This method can only be called by a stream query set to be deployed in a local ObjectGrid. If the stream query set is deployed to a distributed (client-server) objectGrid, this setting will not take effect; we always store the view results in ObjectMap.

Parameters:
viewResultsToListenersOnly - If this value is set to true, then the stream query view results will not be stored in the ObjectMap in the local ObjectGrid. These results will be notified to the ObjectGridEventListener(s) set on the ObjectGrid instance only. If this value is set to false, which is the default value, then the results will be stored in the ObjectMap, and thus changes will be notified to the ObjectGridEventListener(s).

isViewResultsToListenersOnly

boolean isViewResultsToListenersOnly()
Returns:
true if the stream query view results will not be stored in the ObjectMap; false if the stream query view results will be stored in the ObjectMap
See Also:
setViewResultsToListenersOnly(boolean)

copy

StreamQuerySet copy()
Deep copy this stream query set. It will copy the stream metadatas and view metadata configured for this stream query set.

Returns:
a copy of this object

IBM WebSphere Extended Deployment (XD)TM, Release 6.1
ObjectGrid API Specification

© Copyright International Business Machines Corp 2005-2007. All rights reserved.