本文整理汇总了Java中com.espertech.esper.filter.FilterSpecCompiled类的典型用法代码示例。如果您正苦于以下问题:Java FilterSpecCompiled类的具体用法?Java FilterSpecCompiled怎么用?Java FilterSpecCompiled使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FilterSpecCompiled类属于com.espertech.esper.filter包,在下文中一共展示了FilterSpecCompiled类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: make
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
public static FilterStreamSpecification make(FilterStreamSpecCompiled fssc){
FilterStreamSpecification fss=new FilterStreamSpecification(fssc);
fss.setEventTypeName(fss.filterStreamSpec.getFilterSpec().getFilterForEventTypeName());
fss.setOptionalStreamName(fss.filterStreamSpec.getOptionalStreamName());
ViewSpecification[] vss=ViewSpecification.Factory.makeViewSpecs(fss.filterStreamSpec.getViewSpecs());
fss.setViewSpecs(vss);
FilterSpecCompiled fsc=fss.filterStreamSpec.getFilterSpec();
FilterSpecParam[] fsps=fsc.getParameters();
if(fsps!=null && fsps.length>0){
// if(fsps[0] instanceof FilterSpecParamExprNode){
// FilterSpecParamExprNode fspen=(FilterSpecParamExprNode)fsps[0];
// fss.filterExpr=(IBooleanExpression)(ExpressionFactory.toExpression(fspen.getExprNode()));
// }
fss.filterExpr=FilterFactory.toBooleanExpression(fsps, fss.getOptionalStreamName());
}
return fss;
}
示例2: getAuditProxy
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
public static EventStream getAuditProxy(String engineURI, String statementName, Annotation[] annotations, FilterSpecCompiled filterSpec, EventStream designated) {
Audit audit = AuditEnum.STREAM.getAudit(annotations);
if (audit == null) {
return designated;
}
StringWriter filterAndParams = new StringWriter();
filterAndParams.write(filterSpec.getFilterForEventType().getName());
if (filterSpec.getParameters() != null && !filterSpec.getParameters().isEmpty()) {
filterAndParams.write('(');
String delimiter = "";
for (FilterSpecParam param : filterSpec.getParameters()) {
filterAndParams.write(delimiter);
filterAndParams.write(param.getLookupable().getExpression());
filterAndParams.write(param.getFilterOperator().getTextualOp());
filterAndParams.write("...");
delimiter = ",";
}
filterAndParams.write(')');
}
return (EventStream) EventStreamProxy.newInstance(engineURI, statementName, filterAndParams.toString(), designated);
}
示例3: dropStream
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
/**
* See the method of the same name in {@link com.espertech.esper.view.stream.StreamFactoryService}.
* @param filterSpec is the filter definition
*/
public void dropStream(FilterSpecCompiled filterSpec, FilterService filterService, boolean isJoin, boolean isSubSelect, boolean isNamedWindowTrigger, boolean filterWithSameTypeSubselect, boolean stateless)
{
Pair<EventStream, EPStatementHandleCallback> pair;
boolean forceNewStream = isJoin || (!isReuseViews) || isSubSelect || isNamedWindowTrigger || filterWithSameTypeSubselect || stateless;
if (forceNewStream)
{
pair = eventStreamsIdentity.get(filterSpec);
if (pair == null)
{
throw new IllegalStateException("Filter spec object not in collection");
}
eventStreamsIdentity.remove(filterSpec);
filterService.remove(pair.getSecond());
}
else
{
pair = eventStreamsRefCounted.get(filterSpec);
boolean isLast = eventStreamsRefCounted.dereference(filterSpec);
if (isLast)
{
filterService.remove(pair.getSecond());
}
}
}
示例4: snapshot
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
/**
* Returns a snapshot of window contents, thread-safely
* @param filter filters if any
* @return window contents
*/
public Collection<EventBean> snapshot(FilterSpecCompiled filter, Annotation[] annotations)
{
if (tailView.getRevisionProcessor() != null)
{
return tailView.getRevisionProcessor().getSnapshot(agentInstanceContext.getEpStatementAgentInstanceHandle(), parent);
}
agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock().acquireReadLock();
try
{
return snapshotNoLock(filter, annotations);
}
finally
{
agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock().releaseReadLock();
}
}
示例5: snapshotNoLock
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
public Collection<EventBean> snapshotNoLock(FilterSpecCompiled filter, Annotation[] annotations)
{
if (tailView.getRevisionProcessor() != null) {
return tailView.getRevisionProcessor().getSnapshot(agentInstanceContext.getEpStatementAgentInstanceHandle(), parent);
}
Collection<EventBean> indexedResult = rootViewInstance.snapshot(filter, annotations);
if (indexedResult != null) {
return indexedResult;
}
Iterator<EventBean> it = parent.iterator();
if (!it.hasNext()) {
return Collections.EMPTY_LIST;
}
ArrayDeque<EventBean> list = new ArrayDeque<EventBean>();
while (it.hasNext()) {
list.add(it.next());
}
return list;
}
示例6: addFilters
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
private static void addFilters(List<StreamSpecCompiled> streams, List<FilterSpecCompiled> filters, List<NamedWindowConsumerStreamSpec> namedWindows) {
for (StreamSpecCompiled compiled : streams) {
if (compiled instanceof FilterStreamSpecCompiled) {
FilterStreamSpecCompiled c = (FilterStreamSpecCompiled) compiled;
filters.add(c.getFilterSpec());
}
if (compiled instanceof PatternStreamSpecCompiled) {
PatternStreamSpecCompiled r = (PatternStreamSpecCompiled) compiled;
EvalNodeAnalysisResult evalNodeAnalysisResult = EvalNodeUtil.recursiveAnalyzeChildNodes((r.getEvalFactoryNode()));
List<EvalFilterFactoryNode> filterNodes = evalNodeAnalysisResult.getFilterNodes();
for (EvalFilterFactoryNode filterNode : filterNodes)
{
filters.add(filterNode.getFilterSpec());
}
}
if (compiled instanceof NamedWindowConsumerStreamSpec) {
namedWindows.add((NamedWindowConsumerStreamSpec) compiled);
}
}
}
示例7: open
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
public void open(DataFlowOpOpenContext openContext) {
FilterValueSet valueSet;
try {
List<ExprNode> filters = Collections.emptyList();
if (filter != null) {
filters = Collections.singletonList(filter);
}
FilterSpecCompiled spec = FilterSpecCompiler.makeFilterSpec(eventType, eventType.getName(), filters, null,
null, null, new StreamTypeServiceImpl(eventType, eventType.getName(), true, agentInstanceContext.getEngineURI()), null, agentInstanceContext.getStatementContext(), new ArrayList<Integer>());
valueSet = spec.getValueSet(null, agentInstanceContext, null);
}
catch (ExprValidationException ex) {
throw new EPException("Failed to open filter: " + ex.getMessage(), ex);
}
EPStatementAgentInstanceHandle handle = new EPStatementAgentInstanceHandle(agentInstanceContext.getStatementContext().getEpStatementHandle(), agentInstanceContext.getAgentInstanceLock(), 0, new StatementAgentInstanceFilterVersion());
callbackHandle = new EPStatementHandleCallback(handle, this);
agentInstanceContext.getStatementContext().getFilterService().add(valueSet, callbackHandle);
}
示例8: startStatement
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
private AgentInstance startStatement(int contextId, ContextControllerStatementDesc statementDesc, ContextController originator, Object partitionKey, Map<String, Object> contextProperties, boolean isRecoveringResilient) {
// build filters
IdentityHashMap<FilterSpecCompiled, List<FilterValueSetParam>> filterAddendum = new IdentityHashMap<FilterSpecCompiled, List<FilterValueSetParam>>();
originator.getFactory().populateFilterAddendums(filterAddendum, statementDesc, partitionKey, contextId);
AgentInstanceFilterProxy proxy = new AgentInstanceFilterProxyImpl(filterAddendum);
// build built-in context properties
contextProperties.put(ContextPropertyEventType.PROP_CTX_NAME, contextName);
contextProperties.put(ContextPropertyEventType.PROP_CTX_ID, contextId);
MappedEventBean contextBean = (MappedEventBean) servicesContext.getEventAdapterService().adapterForTypedMap(contextProperties, contextDescriptor.getContextPropertyRegistry().getContextEventType());
// activate
StatementAgentInstanceFactoryResult result = StatementAgentInstanceUtil.start(servicesContext, statementDesc.getStatement(), false, contextId, contextBean, proxy, isRecoveringResilient);
// save only instance data
return new AgentInstance(result.getStopCallback(), result.getAgentInstanceContext(), result.getFinalView());
}
示例9: buildContextFactory
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
private static ContextControllerFactory buildContextFactory(ContextControllerFactoryContext factoryContext, ContextDetail detail, List<FilterSpecCompiled> optFiltersNested, ContextStateCache contextStateCache) throws ExprValidationException {
ContextControllerFactory factory;
if (detail instanceof ContextDetailInitiatedTerminated) {
factory = new ContextControllerInitTermFactory(factoryContext, (ContextDetailInitiatedTerminated) detail, contextStateCache);
}
else if (detail instanceof ContextDetailPartitioned) {
factory = new ContextControllerPartitionedFactory(factoryContext, (ContextDetailPartitioned) detail, optFiltersNested, contextStateCache);
}
else if (detail instanceof ContextDetailCategory) {
factory = new ContextControllerCategoryFactory(factoryContext, (ContextDetailCategory) detail, optFiltersNested, contextStateCache);
}
else if (detail instanceof ContextDetailHash) {
factory = new ContextControllerHashFactory(factoryContext, (ContextDetailHash) detail, optFiltersNested, contextStateCache);
}
else {
throw new UnsupportedOperationException("Context detail " + detail + " is not yet supported in a nested context");
}
return factory;
}
示例10: StreamFactorySvcImpl
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
/**
* Ctor.
* @param isReuseViews indicator on whether stream and view resources are to be reused between statements
*/
public StreamFactorySvcImpl(String engineURI, boolean isReuseViews)
{
this.engineURI = engineURI;
this.eventStreamsRefCounted = new RefCountedMap<FilterSpecCompiled, Pair<EventStream, EPStatementHandleCallback>>();
this.eventStreamsIdentity = new IdentityHashMap<Object, Pair<EventStream, EPStatementHandleCallback>>();
this.isReuseViews = isReuseViews;
}
示例11: registerAdapter
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
/**
* Register an adapter.
* @param epService engine
*/
public void registerAdapter(EPServiceProvider epService)
{
EPServiceProviderSPI spi = (EPServiceProviderSPI) epService;
EventType eventType = spi.getEventAdapterService().getExistsTypeByName(eventTypeName);
FilterValueSet fvs = new FilterSpecCompiled(eventType, null, new LinkedList<FilterSpecParam>(), null).getValueSet(null, null, null);
String name = "subscription:" + subscriptionName;
StatementMetricHandle metricsHandle = spi.getMetricReportingService().getStatementHandle(name, name);
EPStatementHandle statementHandle = new EPStatementHandle(name, name, name, name, false, metricsHandle, 0, false);
EPStatementAgentInstanceHandle agentHandle = new EPStatementAgentInstanceHandle(statementHandle, new StatementAgentInstanceRWLockImpl(name, false), -1, new StatementAgentInstanceFilterVersion());
EPStatementHandleCallback registerHandle = new EPStatementHandleCallback(agentHandle, this);
spi.getFilterService().add(fvs, registerHandle);
}
示例12: getFilterSpecsIfAny
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
public List<FilterSpecCompiled> getFilterSpecsIfAny() {
List<FilterSpecCompiled> filters = new ArrayList<FilterSpecCompiled>(items.size());
for (ContextDetailPartitionItem item : items) {
filters.add(item.getFilterSpecCompiled());
}
return filters;
}
示例13: getFilterSpecsIfAny
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
public List<FilterSpecCompiled> getFilterSpecsIfAny() {
List<FilterSpecCompiled> filters = new ArrayList<FilterSpecCompiled>(items.size());
for (ContextDetailHashItem item : items) {
filters.add(item.getFilterSpecCompiled());
}
return filters;
}
示例14: getFilterSpecsIfAny
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
public List<FilterSpecCompiled> getFilterSpecsIfAny() {
List<FilterSpecCompiled> startFS = start.getFilterSpecIfAny();
List<FilterSpecCompiled> endFS = end.getFilterSpecIfAny();
if (startFS == null && endFS == null) {
return null;
}
List<FilterSpecCompiled> filters = new ArrayList<FilterSpecCompiled>(2);
if (startFS != null) {
filters.addAll(startFS);
}
if (endFS != null) {
filters.addAll(endFS);
}
return filters;
}
示例15: analyzeFilters
import com.espertech.esper.filter.FilterSpecCompiled; //导入依赖的package包/类
public static StatementSpecCompiledAnalyzerResult analyzeFilters(StatementSpecCompiled spec) {
List<FilterSpecCompiled> filters = new ArrayList<FilterSpecCompiled>();
List<NamedWindowConsumerStreamSpec> namedWindows = new ArrayList<NamedWindowConsumerStreamSpec>();
addFilters(spec.getStreamSpecs(), filters, namedWindows);
for (ExprSubselectNode subselect : spec.getSubSelectExpressions()) {
addFilters(subselect.getStatementSpecCompiled().getStreamSpecs(), filters, namedWindows);
}
return new StatementSpecCompiledAnalyzerResult(filters, namedWindows);
}