storm.trident.operation.TridentOperationContext Java Examples

The following examples show how to use storm.trident.operation.TridentOperationContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EachProcessor.java    From jstorm with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
    List<Factory> parents = tridentContext.getParentTupleFactories();
    if (parents.size() != 1) {
        throw new RuntimeException("Each operation can only have one parent");
    }
    _context = tridentContext;
    _collector = new AppendCollector(tridentContext);
    _projection = new ProjectionFactory(parents.get(0), _inputFields);
    _function.prepare(conf, new TridentOperationContext(context, _projection));
}
 
Example #2
Source File: PartitionPersistProcessor.java    From jstorm with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
    List<Factory> parents = tridentContext.getParentTupleFactories();
    if (parents.size() != 1) {
        throw new RuntimeException("Partition persist operation can only have one parent");
    }
    _context = tridentContext;
    _state = (State) context.getTaskData(_stateId);
    _projection = new ProjectionFactory(parents.get(0), _inputFields);
    _collector = new FreshCollector(tridentContext);
    _updater.prepare(conf, new TridentOperationContext(context, _projection));
}
 
Example #3
Source File: StateQueryProcessor.java    From jstorm with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
    List<Factory> parents = tridentContext.getParentTupleFactories();
    if (parents.size() != 1) {
        throw new RuntimeException("State query operation can only have one parent");
    }
    _context = tridentContext;
    _state = (State) context.getTaskData(_stateId);
    _projection = new ProjectionFactory(parents.get(0), _inputFields);
    _collector = new AppendCollector(tridentContext);
    _function.prepare(conf, new TridentOperationContext(context, _projection));
}
 
Example #4
Source File: MapProcessor.java    From jstorm with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
    List<TridentTuple.Factory> parents = tridentContext.getParentTupleFactories();
    if(parents.size()!=1) {
        throw new RuntimeException("Map operation can only have one parent");
    }
    _context = tridentContext;
    _collector = new FreshCollector(tridentContext);
    _projection = new TridentTupleView.ProjectionFactory(parents.get(0), _inputFields);
    _function.prepare(conf, new TridentOperationContext(context, _projection));
}
 
Example #5
Source File: AggregateProcessor.java    From jstorm with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(Map conf, TopologyContext context, TridentContext tridentContext) {
    List<Factory> parents = tridentContext.getParentTupleFactories();
    if (parents.size() != 1) {
        throw new RuntimeException("Aggregate operation can only have one parent");
    }
    _context = tridentContext;
    _collector = new FreshCollector(tridentContext);
    _projection = new ProjectionFactory(parents.get(0), _inputFields);
    _agg.prepare(conf, new TridentOperationContext(context, _projection));
}
 
Example #6
Source File: RecentTweetsStateQuery.java    From first-stories-twitter with MIT License 5 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
	partitionNum = context.getPartitionIndex();
	numPartitions = context.numPartitions();
	myturn = partitionNum;
	threshold = Double.valueOf((String) conf.get("THRESHOLD"));
}
 
Example #7
Source File: VectorBuilder.java    From first-stories-twitter with MIT License 5 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
	int hashMapCapacity=Integer.valueOf((String) conf.get("UNIQUE_WORDS_EXPECTED"));
   	uniqWords = new HashMap<String, Integer>(hashMapCapacity);
       positionMap = new HashMap<String, Integer>(hashMapCapacity);
       idfMap = new HashMap<String, Double>(hashMapCapacity);

       tb = new TweetBuilder((String) conf.get("PATH_TO_OOV_FILE"));
}
 
Example #8
Source File: ChainedAggregatorImpl.java    From jstorm with Apache License 2.0 5 votes vote down vote up
public void prepare(Map conf, TridentOperationContext context) {
    _inputFactories = new ProjectionFactory[_inputFields.length];
    for (int i = 0; i < _inputFields.length; i++) {
        _inputFactories[i] = context.makeProjectionFactory(_inputFields[i]);
        _aggs[i].prepare(conf, new TridentOperationContext(context, _inputFactories[i]));
    }
}
 
Example #9
Source File: FilterExecutor.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
    _filter.prepare(conf, context);
}
 
Example #10
Source File: TrueFilter.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
}
 
Example #11
Source File: ReducerAggStateUpdater.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
}
 
Example #12
Source File: CombinerAggStateUpdater.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
}
 
Example #13
Source File: GroupedAggregator.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
    _inputFactory = context.makeProjectionFactory(_inFields);
    _groupFactory = context.makeProjectionFactory(_groupFields);
    _agg.prepare(conf, new TridentOperationContext(context, _inputFactory));
}
 
Example #14
Source File: SingleEmitAggregator.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
    _agg.prepare(conf, context);
    this.myPartitionIndex = context.getPartitionIndex();
    this.totalPartitions = context.numPartitions();
}
 
Example #15
Source File: DruidStateUpdater.java    From storm-example with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public void prepare(Map conf, TridentOperationContext context) {
}
 
Example #16
Source File: MapCombinerAggStateUpdater.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
    _groupFactory = context.makeProjectionFactory(_groupFields);
    _inputFactory = context.makeProjectionFactory(_inputFields);
}
 
Example #17
Source File: MapReducerAggStateUpdater.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
    _groupFactory = context.makeProjectionFactory(_groupFields);
    _inputFactory = context.makeProjectionFactory(_inputFields);
}
 
Example #18
Source File: WindowsStateUpdater.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
    windowsStore = windowStoreFactory.create();
}
 
Example #19
Source File: CombinerAggregatorInitImpl.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
}
 
Example #20
Source File: Negate.java    From jstorm with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
    _delegate.prepare(conf, context);
}
 
Example #21
Source File: CountAggKeep.java    From first-stories-twitter with MIT License 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
	keepFields = (List<String>) conf.get("countAggKeepFields");
}
 
Example #22
Source File: TextProcessor.java    From first-stories-twitter with MIT License 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
	tools = new Tools();
       tb = new TweetBuilder((String) conf.get("PATH_TO_OOV_FILE"));
}
 
Example #23
Source File: ComputeDistance.java    From first-stories-twitter with MIT License 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
	tools = new Tools();
}
 
Example #24
Source File: StringCounter.java    From trident-tutorial with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
    this.partitionId = context.getPartitionIndex();
    this.numPartitions = context.numPartitions();
}
 
Example #25
Source File: Print.java    From trident-tutorial with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map conf, TridentOperationContext context) {
    this.partitionIndex = context.getPartitionIndex();
    this.numPartitions = context.numPartitions();
}
 
Example #26
Source File: TridentThroughput.java    From flink-perf with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map map, TridentOperationContext tridentOperationContext) {}
 
Example #27
Source File: CassandraCqlIncrementalStateUpdater.java    From storm-cassandra-cql with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public void prepare(Map configuration, TridentOperationContext context) {
    LOG.debug("Preparing updater with [{}]", configuration);
}
 
Example #28
Source File: CassandraCqlStateUpdater.java    From storm-cassandra-cql with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public void prepare(Map configuration, TridentOperationContext context) {
    LOG.debug("Preparing updater with [{}]", configuration);
}
 
Example #29
Source File: DruidStateUpdater.java    From storm-example with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public void prepare(Map conf, TridentOperationContext context) {
}
 
Example #30
Source File: TickParser.java    From hadoop-arch-book with Apache License 2.0 4 votes vote down vote up
@Override
public void prepare(Map config,
                    TridentOperationContext context) {}