Examples of StateFactory


Examples of com.tomgibara.pronto.state.StateFactory

        new Example().run();
    }

    StateGraph<State, Label> createGraph() {
        // create the editor
        StateFactory factory = StateFactory.getInstance();
        StateGraph<State, Label> empty = factory.emptyStateGraph();
        StateGraphEditor<State, Label> editor = empty.newEditor();
        // define the graph
        editor.addTransition(State.constructed, Label.init, State.initialized);
        editor.addTransition(State.initialized, Label.start, State.started);
        editor.addTransition(State.started, Label.stop, State.initialized);
View Full Code Here

Examples of com.tomgibara.pronto.state.StateFactory

        return editor.getGraph();
    }

    StateEngine<State, Label, Object> createEngine() {
        StateGraph<State, Label> graph = createGraph();
        StateFactory factory = StateFactory.getInstance();
        StateActivator<State, Label, Object> activator = new StateActivator<State, Label, Object>() {
            public void changeState(State state) {
                System.out.println(state);
            }

            public void transitionState(StateTransition<State, Label> transition, Object parameter) {
                System.out.println(transition);
            }
        };
        return factory.newEngine(graph, activator);
    }
View Full Code Here

Examples of railo.runtime.db.driver.state.StateFactory

  }

  public static Connection getConnection(String connStr, String user, String pass) throws SQLException {
    try {
      //return DriverManager.getConnection(dsn, user, pass);
      return new ConnectionProxy(new StateFactory(), DriverManager.getConnection(connStr, user, pass));
        }
        catch (SQLException e) {
   
          if(connStr.indexOf('?')!=-1) {
                connStr=connStr+"&user="+user+"&password="+pass;
          //return DriverManager.getConnection(connStr);
                return new ConnectionProxy(new StateFactory(), DriverManager.getConnection(connStr));
            }
          throw e;
        }
  }
View Full Code Here

Examples of storm.trident.state.StateFactory

    spout.setCycle(false);

    TridentConfig config = new TridentConfig("shorturl", "shortid");
    config.setBatch(false);

    StateFactory state = HBaseAggregateState.transactional(config);

    TridentTopology topology = new TridentTopology();
    topology
        .newStream("spout", spout)
        .each(new Fields("shortid", "date"), new DatePartitionFunction(),
View Full Code Here

Examples of storm.trident.state.StateFactory

                .withFileNameFormat(fileNameFormat)
                .withRecordFormat(recordFormat)
                .withRotationPolicy(rotationPolicy)
                .withFsUrl(hdfsUrl);

        StateFactory factory = new HdfsStateFactory().withOptions(options);

        TridentState state = stream
                .partitionPersist(factory, hdfsFields, new HdfsUpdater(), new Fields());

        return topology.build();
View Full Code Here

Examples of storm.trident.state.StateFactory

                .withSequenceFormat(new DefaultSequenceFormat("key", "sentence"))
                .withRotationPolicy(rotationPolicy)
                .withFsUrl(hdfsUrl)
                .addRotationAction(new MoveFileAction().toDestination("/dest2/"));

        StateFactory factory = new HdfsStateFactory().withOptions(seqOpts);

        TridentState state = stream
                .partitionPersist(factory, hdfsFields, new HdfsUpdater(), new Fields());

        return topology.build();
View Full Code Here

Examples of storm.trident.state.StateFactory

        clientConfig.put(StormCassandraConstants.CASSANDRA_STATE_KEYSPACE, KEYSPACE);
        Config config = new Config();
        config.setMaxSpoutPending(25);
        config.put("cassandra.config", clientConfig);

        StateFactory cassandraStateFactory = null;
        Options options = null;
        switch(txType){
        case TRANSACTIONAL:
            options = new Options<TransactionalValue>();
            options.columnFamily = "transactional";
View Full Code Here

Examples of storm.trident.state.StateFactory

                .withMapper(tridentHBaseMapper)
                .withProjectionCriteria(projectionCriteria)
                .withRowToStormValueMapper(rowToStormValueMapper)
                .withTableName("WordCount");

        StateFactory factory = new HBaseStateFactory(options);

        TridentTopology topology = new TridentTopology();
        Stream stream = topology.newStream("spout1", spout);

        stream.partitionPersist(factory, fields,  new HBaseUpdater(), new Fields());
View Full Code Here

Examples of storm.trident.state.StateFactory

        new Values("I like #california", now)
    );
    spout.setCycle(true);

    // In this state we will save the real-time counts per date for each hashtag
    StateFactory mapState = new MemoryMapState.Factory();

    // Real-time part of the system: a Trident topology that groups by hashtag and stores per-date counts
    TridentState hashTagCounts = topology
        .newStream("spout1", spout)
        // note how we carry the date around
View Full Code Here

Examples of storm.trident.state.StateFactory

    private static StormTopology externalState(LocalDRPC drpc, FeederBatchSpout spout) {
        TridentTopology topology = new TridentTopology();

        // You can reference existing data sources as well.
        // Here we are mocking up a "database"
        StateFactory stateFactory = new StateFactory() {
            @Override
            public State makeState(Map conf, IMetricsContext metrics, int partitionIndex, int numPartitions) {
                MemoryMapState<Integer> name_to_age = new MemoryMapState<Integer>("name_to_age");
                // This is a bit hard to read but it's just pre-populating the state
                List<List<Object>> keys = getKeys("ted", "mary", "jason", "tom", "chuck");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.