streamcruncher.api
Class WindowSizeProvider

java.lang.Object
  extended by streamcruncher.api.WindowSizeProvider
All Implemented Interfaces:
Provider
Direct Known Subclasses:
TimeWindowSizeProvider

public class WindowSizeProvider
extends java.lang.Object
implements Provider

This Provider Class enables Window sizes in Partitions to be customized at Run-time. The default value is the one provided in the Query as part of the Partition definition.

If the Partition definition is .. from test (partition by country, state, city store latest 10) .. ., then the size is 10.

Note: This object is not Thread-safe.

See Also:
provideSize(Object[])

Field Summary
static java.lang.String name
           
 
Constructor Summary
WindowSizeProvider()
           
 
Method Summary
static java.lang.String getName()
           
 int getSize()
           
 int provideSize(java.lang.Object[] levelValues)
           
 void setSize(int size)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public static final java.lang.String name
See Also:
Constant Field Values
Constructor Detail

WindowSizeProvider

public WindowSizeProvider()
Method Detail

getName

public static java.lang.String getName()
Returns:
"WindowSize/Default".

getSize

public int getSize()

setSize

public void setSize(int size)

provideSize

public int provideSize(java.lang.Object[] levelValues)
Parameters:
levelValues - The Partition values at each level for that Partition.

Ex: For .. from test (partition by country, state, city store latest 10) .., where there are 2 Events - ("US", "California", "San Jose", "warp-drive", .. more properties) and ("India", "Karnataka", "Bangalore", "force-field" .. other props) the parameter will contain ["US", "California", "San Jose"] and ["India", "Karnataka", "Bangalore"] respectively.

This method is invoked before creating a Window for that Partition (level values). Also, if the Partition gets destroyed - in Time based Windows and Tumbling Windows, and gets re-created later, then this method gets invoked for that Partition.

Once the Window gets created with the specified size (default or otherwise), this method will not get invoked unless it gets re-created.

If the Partition is anonymous (.. partition by store latest 10.. ), then this parameter will be a zero length Array.
Returns:
size.


Copyright © 2006 - 2008 Ashwin Jayaprakash. All Rights Reserved. (Docs generated on 3-November-2007 )