Package clojure.lang

Examples of clojure.lang.PersistentArrayMap


    @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);
View Full Code Here


    @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);
View Full Code Here

             "(context \"/coroutineSocketAndCompojure\" [] coroutine-socket-test-handler)" +
//             "coroutine-socket-test-handler" +
           ")";
    IFn fn = (IFn)RT.var("clojure.core", "eval").invoke(RT.var("clojure.core","read-string").invoke(code));
    //{:uri "/simple", :scheme :http, :request-method :get, :headers {}}
    PersistentArrayMap request = new PersistentArrayMap(new Object[] {
        RT.keyword(null, "uri"), "/coroutineSocketAndCompojure/simple"
//        RT.keyword(null, "uri"), "/simple"
          ,RT.keyword(null, "scheme"), RT.keyword(null, "http")
          ,RT.keyword(null, "request-method"), RT.keyword(null, "get")
          ,RT.keyword(null, "headers"), PersistentArrayMap.EMPTY
View Full Code Here

            co.resume();
          };
        };
        selfresume.start();
        Coroutine.yield();
        PersistentArrayMap resp = new PersistentArrayMap(new Object[]{
            RT.keyword(null, "status"), "200",
            RT.keyword(null, "headers"), "",
            RT.keyword(null, "body"), "Simple Response\n"
        });
       
        return resp;
      }
    };
    Runnable runnable = new Runnable() {
     
      @Override
      public void run() throws SuspendExecution {

        //{:uri "/simple", :scheme :http, :request-method :get, :headers {}}
        PersistentArrayMap request = new PersistentArrayMap(new Object[] {
            RT.keyword(null, "uri"), "/coroutineSocketAndCompojure/simple"
//            RT.keyword(null, "uri"), "/simple"
              ,RT.keyword(null, "scheme"), RT.keyword(null, "http")
              ,RT.keyword(null, "request-method"), RT.keyword(null, "get")
              ,RT.keyword(null, "headers"), PersistentArrayMap.EMPTY
View Full Code Here

//             "(context \"/coroutineSocketAndCompojure\" [] coroutine-socket-test-handler)" +
             "coroutine-socket-test-handler" +
           ")";
    IFn fn = (IFn)RT.var("clojure.core", "eval").invoke(RT.var("clojure.core","read-string").invoke(code));
    //{:uri "/simple", :scheme :http, :request-method :get, :headers {}}
    PersistentArrayMap request = new PersistentArrayMap(new Object[] {
//        RT.keyword(null, "uri"), "/coroutineSocketAndCompojure/simple"
        RT.keyword(null, "uri"), "/simple"
          ,RT.keyword(null, "scheme"), RT.keyword(null, "http")
          ,RT.keyword(null, "request-method"), RT.keyword(null, "get")
          ,RT.keyword(null, "headers"), PersistentArrayMap.EMPTY
View Full Code Here

////             "(context \"/coroutineSocketAndCompojure\" [] coroutine-socket-test-handler)" +
//             "coroutine-socket-test-handler" +
//           ")";
//    IFn fn = (IFn)RT.var("clojure.core", "eval").invoke(RT.var("clojure.core","read-string").invoke(code));
    //{:uri "/simple", :scheme :http, :request-method :get, :headers {}}
    PersistentArrayMap request = new PersistentArrayMap(new Object[] {
//        RT.keyword(null, "uri"), "/coroutineSocketAndCompojure/simple"
        RT.keyword(null, "uri"), "/simple2"
          ,RT.keyword(null, "scheme"), RT.keyword(null, "http")
          ,RT.keyword(null, "request-method"), RT.keyword(null, "get")
          ,RT.keyword(null, "headers"), PersistentArrayMap.EMPTY
View Full Code Here

           
          };
        }.start();
        Coroutine.yield();
        System.out.println("after");
        return new PersistentArrayMap(new Object[]{
            RT.keyword(null, "body"), "Simple Response\n",
            RT.keyword(null, "headers"), PersistentArrayMap.EMPTY,
            RT.keyword(null, "status"), "200",
        });
      }
    };
    //{:uri "/simple", :scheme :http, :request-method :get, :headers {}}
    PersistentArrayMap request = new PersistentArrayMap(new Object[] {
//        RT.keyword(null, "uri"), "/coroutineSocketAndCompojure/simple"
        RT.keyword(null, "uri"), "/simple"
          ,RT.keyword(null, "scheme"), RT.keyword(null, "http")
          ,RT.keyword(null, "request-method"), RT.keyword(null, "get")
          ,RT.keyword(null, "headers"), PersistentArrayMap.EMPTY
View Full Code Here

        public IPersistentMap read(Kryo kryo, Input input, Class<IPersistentMap> type) {
            final int size = input.readInt();
            Object[] array = new Object[size * 2];
            for (int i = 0; i < array.length; i++)
                array[i] = kryo.readClassAndObject(input);
            return new PersistentArrayMap(array);
        }
View Full Code Here

    }
   
    /* IMeta */
    public IPersistentMap meta() {
        if(_meta==null) {
            _meta = new PersistentArrayMap( new Object[] {
            makeKeyword("stream"), getSourceStreamId(),
            makeKeyword("component"), getSourceComponent(),
            makeKeyword("task"), getSourceTask()});
        }
        return _meta;
View Full Code Here

        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);
    }
View Full Code Here

TOP

Related Classes of clojure.lang.PersistentArrayMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.