本文整理汇总了Java中org.apache.mina.statemachine.StateMachine类的典型用法代码示例。如果您正苦于以下问题:Java StateMachine类的具体用法?Java StateMachine怎么用?Java StateMachine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StateMachine类属于org.apache.mina.statemachine包,在下文中一共展示了StateMachine类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIsdnClientStateMachineHandler
import org.apache.mina.statemachine.StateMachine; //导入依赖的package包/类
public static ChannelHandler getIsdnClientStateMachineHandler(IsdnChannel channel, String handlerName) {
StateMachine sm = StateMachineFactory.getInstance(Transition.class).create(IsdnConnectionHandler.PLCI_IDLE,
new IsdnConnectionHandler());
StateContextLookup stateContextLookup = new ChannelHandlerContextLookup(new DefaultStateContextFactory(),
channel, handlerName);
StateMachineProxyBuilder proxyBuilder = new StateMachineProxyBuilder();
proxyBuilder.setName("IsdnClientChannelStateMachine");
proxyBuilder.setStateContextLookup(stateContextLookup);
// proxyBuilder.setEventArgumentsInterceptor(new
// NettyEventInterceptor());
proxyBuilder.setEventFactory(new NettyEventFactory());
IStateMachineChannelHandler engine = proxyBuilder.create(IStateMachineChannelHandler.class, sm);
return new ChannelAllCoverageWrapper(new DefaultStateMachineChannelHandler(engine));
}
示例2: getAcceptedChannelStateMachineHandler
import org.apache.mina.statemachine.StateMachine; //导入依赖的package包/类
public static ChannelHandler getAcceptedChannelStateMachineHandler(IsdnChannel channel, String handlerName) {
StateMachine sm = StateMachineFactory.getInstance(Transition.class).create(
IsdnConnectionHandler.P4_WF_CONNECT_ACTIVE_IND, new IsdnConnectionHandler());
StateContextLookup stateContextLookup = new ChannelHandlerContextLookup(new DefaultStateContextFactory(),
channel, handlerName);
StateMachineProxyBuilder proxyBuilder = new StateMachineProxyBuilder();
proxyBuilder.setName("IsdnAcceptedChannelStateMachine");
proxyBuilder.setStateContextLookup(stateContextLookup);
// proxyBuilder.setEventArgumentsInterceptor(new
// NettyEventInterceptor());
proxyBuilder.setEventFactory(new NettyEventFactory());
IStateMachineChannelHandler engine = proxyBuilder.create(IStateMachineChannelHandler.class, sm);
return new ChannelAllCoverageWrapper(new DefaultStateMachineChannelHandler(engine));
}
示例3: createIoHandler
import org.apache.mina.statemachine.StateMachine; //导入依赖的package包/类
private static IoHandler createIoHandler() {
StateMachine sm = StateMachineFactory.getInstance(
IoHandlerTransition.class).create(ServerHandler.NOT_CONNECTED,
new ServerHandler());
return new StateMachineProxyBuilder().setStateContextLookup(
new IoSessionStateContextLookup(new StateContextFactory() {
public StateContext create() {
return new ServerHandler.TetrisServerContext();
}
})).create(IoHandler.class, sm);
}
示例4: ConstructionProject
import org.apache.mina.statemachine.StateMachine; //导入依赖的package包/类
ConstructionProject(ConstructionType constructionType, MapAnalyzer mapAnalyzer, InteractionHandler interactionHandler, UnitInventory myInventory, Queue<Project> projects, TilePosition constructionSite, SCV builder) {
this.constructionSMImpl = new ConstructionStateMachineImpl(constructionType, mapAnalyzer, interactionHandler, myInventory, projects, constructionSite, builder);
StateMachine stateMachine = StateMachineFactory.getInstance(Transition.class).create(ConstructionStateMachineImpl.QUEUED, this.constructionSMImpl);
this.constructionSM = new StateMachineProxyBuilder().create(ConstructionStateMachine.class, stateMachine);
}