OpenTTCN/Developer corner/Implementing external functions/Skeletons/Java/Main.java
From OpenTTCN
Home | Developer's corner | Knowledge base | Working documents | Documentation | OpenTTCN IDE | Tutorials | Training | How do I | Frequently asked questions | Technical support |
Main.java
package extFuncAdapter;
import com.openttcn.sdk.*;
public class Main {
private static final int SLEEP_INTERVAL_IN_MILLIS = 100000;
private static void sleepForever() {
while (true) {
try { Thread.sleep(SLEEP_INTERVAL_IN_MILLIS); } catch (Exception e) { }
}
}
//////////////////////////////////////////////////////////////////
// Program entry point
public static void main(String[] args) {
try {
StartHere.initialize();
System.out.println("\nOpenTTCN SDK for Java " + StartHere.getVersion());
System.out.println("Adapter for 'ext_func_example' example.\n");
// Register codec:
StartHereCD.registerCodecImpl(new CD_impl());
// Register the adapter to OpenTTCN server as platform adapter
// in the ext_func_example session:
StartHerePA.registerPlatformAdapter("ext_func_example", new PA_impl());
System.out.println("Adapter initialisation complete.");
sleepForever();
}
catch (SdkException e) {
System.err.println("Error occured: " + e.getMessage());
e.printStackTrace();
}
catch (Throwable e) {
System.err.println("ERROR: Exception caught: " + e.toString());
e.printStackTrace();
}
}
}
