本文整理汇总了Java中com.espertech.esper.view.std.MergeViewFactory类的典型用法代码示例。如果您正苦于以下问题:Java MergeViewFactory类的具体用法?Java MergeViewFactory怎么用?Java MergeViewFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MergeViewFactory类属于com.espertech.esper.view.std包,在下文中一共展示了MergeViewFactory类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateNoDataWindowOnNamedWindow
import com.espertech.esper.view.std.MergeViewFactory; //导入依赖的package包/类
public static void validateNoDataWindowOnNamedWindow(List<ViewFactory> viewFactories) throws ExprValidationException {
for (ViewFactory viewFactory : viewFactories) {
if ((viewFactory instanceof GroupByViewFactory) || ((viewFactory instanceof MergeViewFactory))) {
continue;
}
if (viewFactory instanceof DataWindowViewFactory) {
throw new ExprValidationException(NamedWindowMgmtService.ERROR_MSG_NO_DATAWINDOW_ALLOWED);
}
}
}
示例2: validateNoDataWindowOnNamedWindow
import com.espertech.esper.view.std.MergeViewFactory; //导入依赖的package包/类
public static void validateNoDataWindowOnNamedWindow(List<ViewFactory> viewFactories) throws ExprValidationException {
for (ViewFactory viewFactory : viewFactories)
{
if ((viewFactory instanceof GroupByViewFactory) || ((viewFactory instanceof MergeViewFactory)))
{
continue;
}
if (viewFactory instanceof DataWindowViewFactory)
{
throw new ExprValidationException(NamedWindowService.ERROR_MSG_NO_DATAWINDOW_ALLOWED);
}
}
}
示例3: createFactories
import com.espertech.esper.view.std.MergeViewFactory; //导入依赖的package包/类
public ViewFactoryChain createFactories(int streamNum,
EventType parentEventType,
ViewSpec[] viewSpecDefinitions,
StreamSpecOptions options,
StatementContext context,
boolean isSubquery,
int subqueryNumber)
throws ViewProcessingException {
// Clone the view spec list to prevent parameter modification
List<ViewSpec> viewSpecList = new ArrayList<ViewSpec>(Arrays.asList(viewSpecDefinitions));
// Inspect views and add merge views if required
ViewServiceHelper.addMergeViews(viewSpecList);
// Instantiate factories, not making them aware of each other yet
List<ViewFactory> viewFactories = ViewServiceHelper.instantiateFactories(streamNum, viewSpecList, context, isSubquery, subqueryNumber);
ViewFactory parentViewFactory = null;
List<ViewFactory> attachedViewFactories = new ArrayList<ViewFactory>();
for (int i = 0; i < viewFactories.size(); i++) {
ViewFactory factoryToAttach = viewFactories.get(i);
try {
factoryToAttach.attach(parentEventType, context, parentViewFactory, attachedViewFactories);
attachedViewFactories.add(viewFactories.get(i));
parentEventType = factoryToAttach.getEventType();
} catch (ViewParameterException ex) {
String text = "Error attaching view to parent view";
if (i == 0) {
text = "Error attaching view to event stream";
}
throw new ViewProcessingException(text + ": " + ex.getMessage(), ex);
}
}
// obtain count of data windows
int dataWindowCount = 0;
int firstNonDataWindowIndex = -1;
for (int i = 0; i < viewFactories.size(); i++) {
ViewFactory factory = viewFactories.get(i);
if (factory instanceof DataWindowViewFactory) {
dataWindowCount++;
continue;
}
if ((factory instanceof GroupByViewFactoryMarker) || (factory instanceof MergeViewFactory)) {
continue;
}
if (firstNonDataWindowIndex == -1) {
firstNonDataWindowIndex = i;
}
}
boolean isAllowMultipleExpiry = context.getConfigSnapshot().getEngineDefaults().getViewResources().isAllowMultipleExpiryPolicies();
boolean isRetainIntersection = options.isRetainIntersection();
boolean isRetainUnion = options.isRetainUnion();
// Set the default to retain-intersection unless allow-multiple-expiry is turned on
if ((!isAllowMultipleExpiry) && (!isRetainUnion)) {
isRetainIntersection = true;
}
// handle multiple data windows with retain union.
// wrap view factories into the union view factory and handle a group-by, if present
if ((isRetainUnion || isRetainIntersection) && dataWindowCount > 1) {
viewFactories = getRetainViewFactories(parentEventType, viewFactories, isRetainUnion, context);
}
return new ViewFactoryChain(parentEventType, viewFactories);
}
示例4: createFactories
import com.espertech.esper.view.std.MergeViewFactory; //导入依赖的package包/类
public ViewFactoryChain createFactories(int streamNum,
EventType parentEventType,
List<ViewSpec> viewSpecDefinitions,
StreamSpecOptions options,
StatementContext context)
throws ViewProcessingException
{
// Clone the view spec list to prevent parameter modification
List<ViewSpec> viewSpecList = new ArrayList<ViewSpec>(viewSpecDefinitions);
// Inspect views and add merge views if required
ViewServiceHelper.addMergeViews(viewSpecList);
// Instantiate factories, not making them aware of each other yet
List<ViewFactory> viewFactories = ViewServiceHelper.instantiateFactories(streamNum, viewSpecList, context);
ViewFactory parentViewFactory = null;
List<ViewFactory> attachedViewFactories = new ArrayList<ViewFactory>();
for (int i = 0; i < viewFactories.size(); i++)
{
ViewFactory factoryToAttach = viewFactories.get(i);
try
{
factoryToAttach.attach(parentEventType, context, parentViewFactory, attachedViewFactories);
attachedViewFactories.add(viewFactories.get(i));
parentEventType = factoryToAttach.getEventType();
}
catch (ViewParameterException ex)
{
String text = "Error attaching view to parent view";
if (i == 0)
{
text = "Error attaching view to event stream";
}
throw new ViewProcessingException(text + ": " + ex.getMessage(), ex);
}
}
// obtain count of data windows
int dataWindowCount = 0;
int firstNonDataWindowIndex = -1;
for (int i = 0; i < viewFactories.size(); i++)
{
ViewFactory factory = viewFactories.get(i);
if (factory instanceof DataWindowViewFactory)
{
dataWindowCount++;
continue;
}
if ((factory instanceof GroupByViewFactoryMarker) || (factory instanceof MergeViewFactory))
{
continue;
}
if (firstNonDataWindowIndex == -1)
{
firstNonDataWindowIndex = i;
}
}
boolean isAllowMultipleExpiry = context.getConfigSnapshot().getEngineDefaults().getViewResources().isAllowMultipleExpiryPolicies();
boolean isRetainIntersection = options.isRetainIntersection();
boolean isRetainUnion = options.isRetainUnion();
// Set the default to retain-intersection unless allow-multiple-expiry is turned on
if ((!isAllowMultipleExpiry) && (!isRetainUnion))
{
isRetainIntersection = true;
}
// handle multiple data windows with retain union.
// wrap view factories into the union view factory and handle a group-by, if present
if ((isRetainUnion || isRetainIntersection) && dataWindowCount > 1)
{
viewFactories = getRetainViewFactories(parentEventType, viewFactories, isRetainUnion, context);
}
return new ViewFactoryChain(parentEventType, viewFactories);
}