/* 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 FT1 { public static void main(String[] args) { final IFrameworkContext appContext = new FulmineContext("FTPublisher"); appContext.setNetwork(new TcpNetwork()); IFulmineContext context = new FTContext(appContext, new IFTContextStateListener() { public void didActivate() { System.out.println("FT1 didActivate"); } public void didStandby() { System.out.println("FT1 didStandby"); } public void willActivate() { System.out.println("FT1 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", "FT1!")); } finally { record.flushFrame(); } } public void willStandby() { System.out.println("FT1 willStandby"); } public boolean isActive() { return false; } public void start() { System.out.println("FT1 start"); } public void destroy() { System.out.println("FT1 destroy"); } }, new FTTcpNetwork(null, 11111), 1, 30000); context.start(); try { System.in.read(); } catch (IOException e) { e.printStackTrace(); } } }