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

com.ibm.websphere.objectgrid.streamquery
Interface StreamQueryManager

All Known Subinterfaces:
ObjectGrid

public interface StreamQueryManager

This interface represents a stream query manager. A stream query manager serves as a factory for stream query sets.

A StreamQueryManager can have multiple StreamQuerySet objects. This is useful in a client-server environment where you have multiple map sets defined for one ObjectGrid. Maps used by streams and views in one StreamQuerySet should be in the same map set. This guarantees no cross-server data access with one StreamQuerySet. Users can define one or more stream query sets for each map set.

For users who want to use simplified programming model, addStreamQuerySet() can be called to create and add a dynamic StreamQuerySet object. Properties can then be added to the StreamQuerySet object.

Here is an example:

 // create and add a stream query set to the ObjectGrid 
 StreamQuerySet sqs = objectGrid.addStreamQuerySet();
 
 // create and add a stream metadata to sqs 
 StreamMetadata stream1 = sqs.addStreamMetadata();
 
 // set the stream metadata values
 stream1.setMapName("stream1").setValueClass(SellBids.class).setSql("...");
 
 // create and add another stream metadata to sqs 
 StreamMetadata stream2 = sqs.addStreamMetadata();
 
 // set the stream metadata values
 stream2.setMapName("stream2").setValueClass(BuyBids.class).setSql("...");
 
 // create and add a view metadata to sqs 
 ViewMetadata view = sqs.addViewMetadata();
 
 // set the view metadata values
 view.setMapName("viewMap").setValueClass(TransactionVolume.class).setSql("...");
 
 // deploy the stream query set 
 sqs.setDeployed(true);
 
Alternatively, users can use createStreamQuerySet() to create a StreamQuerySet object, and then create its stream and view metadatas. After that, users can call setStreamQuerySets(List) to set the StreamQuerySet list. This pattern follows the Spring framework pattern, so users can use Spring framework to add a list of StreamQuerySet.

Here is an example which follows Spring framework pattern:

 // create a stream query set 
 StreamQuerySet sqs = objectGrid.createStreamQuerySet();
 
 // initialize the stream list
 List streamList = new ArrayList();
 
 // create a stream metadata 
 StreamMetadata stream1 = sqs.createStreamMetadata();
 
 // set the stream metadata values
 stream1.setMapName("stream1").setValueClass(SellBids.class).setSql("...");
 
 // add stream 1 to the list
 streamList.add(stream1); 
 
 // create another stream metadata 
 StreamMetadata stream2 = sqs.createStreamMetadata();
 
 // set the stream metadata values
 stream2.setMapName("stream2").setValueClass(BuyBids.class).setSql("...");
 
 // add stream 2 to the list
 streamList.add(stream2);
  
 // initialize the view list
 List viewList = new ArrayList();

 // Add a view metadata 
 ViewMetadata view = sqs.createViewMetadata();
 
 // add view to the view list
 viewList.add(view);
 
 // set the view metadata values
 view.setMapName("viewMap").setSql("...");
 
 // set the stream and view metadata list to the streamQuerySet
 sqs.setStreamMetadatas(streamList);
 sqs.setViewMetadatas(viewList);
 
 // Add the stream Query Set to a list
 List sqsList = new ArrayList();
 sqsList.add(sqs);
 
 // Set the stream query set list to the ObjectGrid instance
 objectGrid.setStreamQuerySets(sqsList);

 // deploy the stream query set 
 sqs.setDeployed(true);
 

Since:
WAS XD 6.1
See Also:
StreamQuerySet

Method Summary
 StreamQuerySet addStreamQuerySet()
          Create and add a StreamQuerySet to this manager.
 StreamQuerySet createStreamQuerySet()
          This method creates a StreamQuerySet with all attributes set to null.
 java.util.List getStreamQuerySets()
          Returns the current list of StreamQuerySets.
 void removeStreamQuerySet(StreamQuerySet streamQuerySet)
          Removes a StreamQuerySet.
 void setStreamQuerySets(java.util.List streamQuerySets)
          This overwrites the current list of StreamQuerySets and replaces it with the supplied List of StreamQuerySets.
 

Method Detail

createStreamQuerySet

StreamQuerySet createStreamQuerySet()
                                    throws StreamQueryException
This method creates a StreamQuerySet with all attributes set to null.

Returns:
the newly created StreamQuerySet object.
Throws:
StreamQueryException - if a StreamQuerySet object cannot be created.
See Also:
StreamQuerySet

addStreamQuerySet

StreamQuerySet addStreamQuerySet()
                                 throws StreamQueryException
Create and add a StreamQuerySet to this manager. Not only does this method create a StreamQuerySet, it also adds it to the StreamQuerySet list.

Throws:
StreamQueryException - if a StreamQuerySet object cannot be created.
See Also:
StreamQuerySet

getStreamQuerySets

java.util.List getStreamQuerySets()
Returns the current list of StreamQuerySets.

Returns:
the current list of StreamQuerySets.
See Also:
setStreamQuerySets(List), createStreamQuerySet()

setStreamQuerySets

void setStreamQuerySets(java.util.List streamQuerySets)
                        throws StreamQueryException
This overwrites the current list of StreamQuerySets and replaces it with the supplied List of StreamQuerySets.

This method will associate each StreamQuerySet with this StreamQueryManager but it will not deploy it. Users need to call StreamQuerySet.setDeployed(boolean) to deploy each StreamQuerySet.

This method should not be called if the ObjectGrid is already being initalized.

Parameters:
streamQuerySets - List of StreamQuerySets
Throws:
java.lang.ClassCastException - if one of the elements in the provided list is not an instance of StreamQuerySet
java.lang.IllegalArgumentException - if streamQuerySets is null or contains a null reference.
java.lang.IllegalStateException - if the ObjectGrid is initialized.
StreamQueryException
See Also:
StreamQuerySet

removeStreamQuerySet

void removeStreamQuerySet(StreamQuerySet streamQuerySet)
Removes a StreamQuerySet.

This method removes a StreamQuerySet that was previously added to this object using the addStreamQuerySet(StreamQuerySet) or setStreamQuerySets(List) method. If the desired StreamQuerySet is not found, no error will be returned.

Parameters:
streamQuerySet - An instance of StreamQuerySet
Throws:
java.lang.IllegalArgumentException - if streamQuerySet is null
See Also:
addStreamQuerySet(), setStreamQuerySets(List), StreamQuerySet

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

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