本文整理汇总了Java中storm.trident.operation.TridentOperationContext类的典型用法代码示例。如果您正苦于以下问题:Java TridentOperationContext类的具体用法?Java TridentOperationContext怎么用?Java TridentOperationContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TridentOperationContext类属于storm.trident.operation包,在下文中一共展示了TridentOperationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@Override
public void prepare(Map conf, TridentOperationContext context) {
logger = RbLogger.getLogger(ProcessMse10Association.class.getName());
cache = new HashMap<>();
cache.put(0, "IDLE");
cache.put(1, "AAA_PENDING");
cache.put(2, "AUTHENTICATED");
cache.put(3, "ASSOCIATED");
cache.put(4, "POWERSAVE");
cache.put(5, "DISASSOCIATED");
cache.put(6, "TO_BE_DELETED");
cache.put(7, "PROBING");
cache.put(8, "BLACK_LISTED");
cache.put(256, "WAIT_AUTHENTICATED");
cache.put(257, "WAIT_ASSOCIATED");
}
示例2: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
/**
* Initializing the database reference and patterns.
*/
@Override
public void prepare(Map conf, TridentOperationContext context) {
try {
_city = new LookupService(CITY_DB_PATH, LookupService.GEOIP_MEMORY_CACHE);
_city6 = new LookupService(CITY_V6_DB_PATH, LookupService.GEOIP_MEMORY_CACHE);
_asn = new LookupService(ASN_DB_PATH, LookupService.GEOIP_MEMORY_CACHE);
_asn6 = new LookupService(ASN_V6_DB_PATH, LookupService.GEOIP_MEMORY_CACHE);
VALID_IPV4_PATTERN = Pattern.compile(ipv4Pattern, Pattern.CASE_INSENSITIVE);
VALID_IPV6_PATTERN = Pattern.compile(ipv6Pattern, Pattern.CASE_INSENSITIVE);
} catch (IOException ex) {
Logger.getLogger(GeoIpFunction.class.getName()).log(Level.SEVERE, ex.toString());
} catch (PatternSyntaxException e) {
Logger.getLogger(GeoIpFunction.class.getName()).log(Level.SEVERE, "Unable to compile IP check patterns");
}
}
示例3: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@Override
public void prepare(Map conf, TridentOperationContext context){
if (conf.get(backtype.storm.Config.TOPOLOGY_DEBUG).equals(true)) {
testMode = true;
CSVReader reader;
try {
reader = new CSVReader(new BufferedReader(
new InputStreamReader(
DocumentFetchFunction.class
.getResourceAsStream("docs.csv"))));
List<String[]> myEntries = reader.readAll();
for(String[] row : myEntries){
testData.put(row[0], row[1]);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例4: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@Override
public void prepare(Map conf, TridentOperationContext context) {
try {
String path = (String) conf.get("DOCUMENT_PATH");
schema = Schema.parse(PersistDocumentFunction.class
.getResourceAsStream("/document.avsc"));
File file = new File(path);
DatumWriter<GenericRecord> datumWriter = new GenericDatumWriter<GenericRecord>(schema);
dataFileWriter = new DataFileWriter<GenericRecord>(datumWriter);
if(file.exists())
dataFileWriter.appendTo(file);
else
dataFileWriter.create(schema, file);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例5: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@Override
public void prepare(Map conf, TridentOperationContext context) {
_count = new HashMap<>();
_sec_count = 0;
_mean = 0;
_totalMean = 0;
System.out.println("Starting throughput metrics [ " + _position + " ]");
}
示例6: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@Override
public void prepare(Map conf, TridentOperationContext context) {
// logger = RbLogger.getLogger(PostgreSQLocation.class.getName());
PostgresqlManager.initConfig(uri, user, pass, updateTime, failUpdateTime);
_manager = PostgresqlManager.getInstance();
_manager.init();
}
示例7: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@Override
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]));
}
}
示例8: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@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));
}
示例9: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@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));
}
示例10: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@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));
}
示例11: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@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));
}
示例12: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@Override
public void prepare(Map conf, TridentOperationContext context) {
Properties props = new Properties();
props.put("metadata.broker.list", conf.get(CrawlerConfig.KAFKA_PRODUCER_HOST_NAME)+":"+conf.get( CrawlerConfig.KAFKA_PRODUCER_HOST_PORT) );
props.put("serializer.class", "kafka.serializer.StringEncoder");
this.producer = new kafka.javaapi.producer.Producer<String, String>(new ProducerConfig(props));
this.kafkaTopic = (String) conf.get( CrawlerConfig.KAFKA_TOPIC_NAME );
}
示例13: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
@Override
public void prepare(Map conf, TridentOperationContext context) {
bloomFilter = new RedisBloomFilter<String>(Integer.parseInt(conf.get(CrawlerConfig.BLOOM_FILTER_EXPECTED_ELEMENT_COUNT).toString()),
Double.parseDouble(conf.get(CrawlerConfig.BLOOM_FILTER_DESIRED_FALSE_POSITIVE).toString()),
conf.get(CrawlerConfig.REDIS_HOST_NAME).toString(),
Short.parseShort(conf.get(CrawlerConfig.REDIS_HOST_PORT).toString()),
conf.get(CrawlerConfig.BLOOM_FILTER_NAME).toString()
);
}
示例14: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
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]));
}
}
示例15: prepare
import storm.trident.operation.TridentOperationContext; //导入依赖的package包/类
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]));
}
}