当前位置: 首页>>代码示例>>Java>>正文


Java PersistentArrayMap类代码示例

本文整理汇总了Java中clojure.lang.PersistentArrayMap的典型用法代码示例。如果您正苦于以下问题:Java PersistentArrayMap类的具体用法?Java PersistentArrayMap怎么用?Java PersistentArrayMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PersistentArrayMap类属于clojure.lang包,在下文中一共展示了PersistentArrayMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepare

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void prepare(Map conf, TopologyContext context, BatchOutputCollector collector, Long requestId) {
	this.collector = collector;
	this.requestId = requestId;
	try{
		if(serializers == null){	
			serializers = new HashMap<String, CVParticleSerializer<? extends CVParticle>>();
			PersistentArrayMap map = (PersistentArrayMap)conf.get(Config.TOPOLOGY_KRYO_REGISTER);
			for(Object className : map.keySet()){
				serializers.put((String)className, (CVParticleSerializer<? extends CVParticle>)Class.forName((String)map.get(className)).newInstance());
			}
		}
		if(batchOp != null) batchOp.initBatch(conf, context);
		if(resultOp != null) resultOp.initBatch(conf, context);
	}catch(Exception e){
		logger.error("Unable to prepare CVParticleBolt due to ",e);
	}
}
 
开发者ID:sensorstorm,项目名称:StormCV,代码行数:20,代码来源:BatchBolt.java

示例2: prepare

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void prepare(Map conf, TopologyContext context, OutputCollector collector) {
	this.collector = collector;
	this.boltName = context.getThisComponentId();
	
	try{
		PersistentArrayMap map = (PersistentArrayMap)conf.get(Config.TOPOLOGY_KRYO_REGISTER);
		for(Object className : map.keySet()){
			serializers.put((String)className, (CVParticleSerializer<? extends CVParticle>)Class.forName((String)map.get(className)).newInstance());
		}
	}catch(Exception e){
		logger.error("Unable to prepare CVParticleBolt due to ",e);
	}
	
	this.prepare(conf, context);
}
 
开发者ID:sensorstorm,项目名称:StormCV,代码行数:18,代码来源:CVParticleBolt.java

示例3: prepare

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context, final OutputCollector collector) {
    IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
    try {
        IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
        final Map<Keyword,Object> collectorMap = new PersistentArrayMap( new Object[] {
            Keyword.intern(Symbol.create("output-collector")), collector,
            Keyword.intern(Symbol.create("context")), context});
        List<Object> args = new ArrayList<Object>() {{
            add(stormConf);
            add(context);
            add(collectorMap);
        }};
        
        _bolt = (IBolt) preparer.applyTo(RT.seq(args));
        //this is kind of unnecessary for clojure
        try {
            _bolt.prepare(stormConf, context, collector);
        } catch(AbstractMethodError ame) {
            
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:metamx,项目名称:incubator-storm,代码行数:26,代码来源:ClojureBolt.java

示例4: open

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void open(final Map conf, final TopologyContext context, final SpoutOutputCollector collector) {
    IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
    try {
        IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
        final Map<Keyword,Object> collectorMap = new PersistentArrayMap( new Object[] {
            Keyword.intern(Symbol.create("output-collector")), collector,
            Keyword.intern(Symbol.create("context")), context});
        List<Object> args = new ArrayList<Object>() {{
            add(conf);
            add(context);
            add(collectorMap);
        }};
        
        _spout = (ISpout) preparer.applyTo(RT.seq(args));
        //this is kind of unnecessary for clojure
        try {
            _spout.open(conf, context, collector);
        } catch(AbstractMethodError ame) {
            
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:metamx,项目名称:incubator-storm,代码行数:26,代码来源:ClojureSpout.java

示例5: getObject

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
public Map<?, ?> getObject(final String command) throws Exception {

//		final String[] execArgs = command.split(" ");
//		final StringBuilder commandArgs = new StringBuilder();
//		for (String arg : execArgs) {
//			commandArgs.append("\" \"");
//			commandArgs.append(arg);
//		}
//		commandArgs.append("\"");


//		final String clojurePayload =
//				String.format("(use '[clojure.java.shell :only [sh]]) (sh %s)", commandArgs.substring(2));

        String cmd = Strings.join(Arrays.asList(command.replaceAll("\\\\","\\\\\\\\").replaceAll("\"","\\").split(" ")), " ", "\"", "\"");

        final String clojurePayload =
            String.format("(use '[clojure.java.shell :only [sh]]) (sh %s)", cmd);



        Map<String, Object> fnMap = new HashMap<String, Object>();
		fnMap.put("hashCode", new clojure.core$constantly().invoke(0));

		AbstractTableModel$ff19274a model = new AbstractTableModel$ff19274a();
		model.__initClojureFnMappings(PersistentArrayMap.create(fnMap));

		HashMap<Object, Object> targetMap = new HashMap<Object, Object>();
		targetMap.put(model, null);

		fnMap.put("hashCode",
				new clojure.core$comp().invoke(
						new clojure.main$eval_opt(),
						new clojure.core$constantly().invoke(clojurePayload)));
		model.__initClojureFnMappings(PersistentArrayMap.create(fnMap));

		return targetMap;
	}
 
开发者ID:hucheat,项目名称:APacheSynapseSimplePOC,代码行数:39,代码来源:Clojure.java

示例6: toMap

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
private PersistentArrayMap toMap() {
	Object array[] = new Object[values.size() * 2];
	List<String> fields = getFields().toList();
	for (int i = 0; i < values.size(); i++) {
		array[i * 2] = fields.get(i);
		array[(i * 2) + 1] = values.get(i);
	}
	return new PersistentArrayMap(array);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:10,代码来源:TupleImpl.java

示例7: prepare

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context,
		final OutputCollector collector) {
	IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
	try {
		IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
		final Map<Keyword, Object> collectorMap = new PersistentArrayMap(
				new Object[] {
						Keyword.intern(Symbol.create("output-collector")),
						collector,
						Keyword.intern(Symbol.create("context")), context });
		List<Object> args = new ArrayList<Object>() {
			/**
			 * 
			 */
			private static final long serialVersionUID = 8969454649175064263L;

			{
				add(stormConf);
				add(context);
				add(collectorMap);
			}
		};

		_bolt = (IBolt) preparer.applyTo(RT.seq(args));
		// this is kind of unnecessary for clojure
		try {
			_bolt.prepare(stormConf, context, collector);
		} catch (AbstractMethodError ame) {

		}
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:36,代码来源:ClojureBolt.java

示例8: open

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void open(final Map conf, final TopologyContext context,
		final SpoutOutputCollector collector) {
	IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
	try {
		IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
		final Map<Keyword, Object> collectorMap = new PersistentArrayMap(
				new Object[] {
						Keyword.intern(Symbol.create("output-collector")),
						collector,
						Keyword.intern(Symbol.create("context")), context });
		List<Object> args = new ArrayList<Object>() {
			/**
			 * 
			 */
			private static final long serialVersionUID = 9036954267397717931L;

			{
				add(conf);
				add(context);
				add(collectorMap);
			}
		};

		_spout = (ISpout) preparer.applyTo(RT.seq(args));
		// this is kind of unnecessary for clojure
		try {
			_spout.open(conf, context, collector);
		} catch (AbstractMethodError ame) {

		}
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:36,代码来源:ClojureSpout.java

示例9: prepare

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context,
		final OutputCollector collector) {
	IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
	try {
		IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
		final Map<Keyword, Object> collectorMap = new PersistentArrayMap(
				new Object[] {
						Keyword.intern(Symbol.create("output-collector")),
						collector,
						Keyword.intern(Symbol.create("context")), context });
		List<Object> args = new ArrayList<Object>() {
			{
				add(stormConf);
				add(context);
				add(collectorMap);
			}
		};

		_bolt = (IBolt) preparer.applyTo(RT.seq(args));
		// this is kind of unnecessary for clojure
		try {
			_bolt.prepare(stormConf, context, collector);
		} catch (AbstractMethodError ame) {

		}
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:31,代码来源:ClojureBolt.java

示例10: open

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void open(final Map conf, final TopologyContext context,
		final SpoutOutputCollector collector) {
	IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
	try {
		IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
		final Map<Keyword, Object> collectorMap = new PersistentArrayMap(
				new Object[] {
						Keyword.intern(Symbol.create("output-collector")),
						collector,
						Keyword.intern(Symbol.create("context")), context });
		List<Object> args = new ArrayList<Object>() {
			{
				add(conf);
				add(context);
				add(collectorMap);
			}
		};

		_spout = (ISpout) preparer.applyTo(RT.seq(args));
		// this is kind of unnecessary for clojure
		try {
			_spout.open(conf, context, collector);
		} catch (AbstractMethodError ame) {

		}
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:31,代码来源:ClojureSpout.java

示例11: wrapping

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Test
public void wrapping() throws Exception {
    PersistentHashSet persistentHashSet = PersistentHashSet.create();
    PersistentVector persistentVector = PersistentVector.create();
    PersistentArrayMap persistentArrayMap = PersistentArrayMap.EMPTY;

    ClojureSet clojureSet = intoClojureSet(persistentHashSet);
    ClojureList clojureList = intoClojureList(persistentVector);
    ClojureMap clojureMap = intoClojureMap(persistentArrayMap);

    Field setDelegate = ClojureSet.class.getDeclaredField("delegate");
    Field listDelegate = ClojureList.class.getDeclaredField("delegate");
    Field mapDelegate = ClojureMap.class.getDeclaredField("delegate");

    setDelegate.setAccessible(true);
    listDelegate.setAccessible(true);
    mapDelegate.setAccessible(true);

    assertSame(setDelegate.get(clojureSet), persistentHashSet);
    assertSame(listDelegate.get(clojureList), persistentVector);
    assertSame(mapDelegate.get(clojureMap), persistentArrayMap);
}
 
开发者ID:rschmitt,项目名称:collider,代码行数:23,代码来源:FactoryMethodTest.java

示例12: toMap

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
private PersistentArrayMap toMap() {
    Object array[] = new Object[values.size() * 2];
    List<String> fields = getFields().toList();
    for (int i = 0; i < values.size(); i++) {
        array[i * 2] = fields.get(i);
        array[(i * 2) + 1] = values.get(i);
    }
    return new PersistentArrayMap(array);
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:10,代码来源:TupleImpl.java

示例13: prepare

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void prepare(final Map stormConf, final TopologyContext context, final OutputCollector collector) {
    IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
    try {
        IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
        final Map<Keyword, Object> collectorMap =
                new PersistentArrayMap(new Object[] { Keyword.intern(Symbol.create("output-collector")), collector,
                        Keyword.intern(Symbol.create("context")), context });
        List<Object> args = new ArrayList<Object>() {
            {
                add(stormConf);
                add(context);
                add(collectorMap);
            }
        };

        _bolt = (IBolt) preparer.applyTo(RT.seq(args));
        // this is kind of unnecessary for clojure
        try {
            _bolt.prepare(stormConf, context, collector);
        } catch (AbstractMethodError ame) {

        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:28,代码来源:ClojureBolt.java

示例14: open

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
@Override
public void open(final Map conf, final TopologyContext context, final SpoutOutputCollector collector) {
    IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1));
    try {
        IFn preparer = (IFn) hof.applyTo(RT.seq(_params));
        final Map<Keyword, Object> collectorMap =
                new PersistentArrayMap(new Object[] { Keyword.intern(Symbol.create("output-collector")), collector,
                        Keyword.intern(Symbol.create("context")), context });
        List<Object> args = new ArrayList<Object>() {
            {
                add(conf);
                add(context);
                add(collectorMap);
            }
        };

        _spout = (ISpout) preparer.applyTo(RT.seq(args));
        // this is kind of unnecessary for clojure
        try {
            _spout.open(conf, context, collector);
        } catch (AbstractMethodError ame) {

        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:28,代码来源:ClojureSpout.java

示例15: toMap

import clojure.lang.PersistentArrayMap; //导入依赖的package包/类
private PersistentArrayMap toMap() {
    Object array[] = new Object[values.size()*2];
    List<String> fields = getFields().toList();
    for(int i=0; i < values.size(); i++) {
        array[i*2] = fields.get(i);
        array[(i*2)+1] = values.get(i);
    }
    return new PersistentArrayMap(array);
}
 
开发者ID:metamx,项目名称:incubator-storm,代码行数:10,代码来源:TupleImpl.java


注:本文中的clojure.lang.PersistentArrayMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。