/* Copyright 2009 Ramon Servadei Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package fulmine.demo; import java.io.IOException; import fulmine.Domain; import fulmine.Type; import fulmine.context.FTContext; import fulmine.context.FulmineContext; import fulmine.context.IFTContextStateListener; import fulmine.context.IFrameworkContext; import fulmine.context.IFulmineContext; import fulmine.distribution.connection.tcp.FTTcpNetwork; import fulmine.distribution.connection.tcp.TcpNetwork; import fulmine.event.EventFrameExecution; import fulmine.model.container.IContainer; import fulmine.model.field.StringField; public class FT2 { public static void main(String[] args) { final IFrameworkContext appContext = new FulmineContext("FTPublisher"); appContext.setNetwork(new TcpNetwork(null, 22222)); IFulmineContext context = new FTContext(appContext, new IFTContextStateListener() { public void didActivate() { System.out.println("FT2 didActivate"); } public void didStandby() { System.out.println("FT2 didStandby"); } public void willActivate() { System.out.println("FT2 willActivate"); // create the 'helloWorld' record because we're activating final IContainer record = appContext.getLocalContainer("helloWorld", Type.RECORD, Domain.get(1, "Tutorial")); // add a field to the record record.beginFrame(new EventFrameExecution()); try { record.add(new StringField("active context is", "FT2!")); } finally { record.flushFrame(); } } public void willStandby() { System.out.println("FT2 willStandby"); } public boolean isActive() { return false; } public void start() { System.out.println("FT2 start"); } public void destroy() { System.out.println("FT2 destroy"); } }, new FTTcpNetwork(null, 11112), 2, 30000); context.start(); try { System.in.read(); } catch (IOException e) { e.printStackTrace(); } } }