Download User`s Manual - Community RTI Connext Users
Transcript
Chapter 8
8.3.6.4
Implementing the Adapter Class
In this section you will create the adapter class for the simple file adapter.
Every Java adapter has to create an Adapter class that implements the com.rti.routingservice.adapter.Adapter interface.
Adapter classes are registered with RTI Routing Service using the tag <class_name>
within <java_adapter_plugin> (Section 8.1).
Using your favorite Java editor, create a file called SimpleFileAdapter.java under
<Adapter directory>1/routingservice/adapter/simplefile.
Insert the following content:
/******************************************************************/
/*
Simple File Adapter
*/
/******************************************************************/
package routingservice.adapter.simplefile;
import
import
import
import
import
import
com.rti.routingservice.adapter.Adapter;
com.rti.routingservice.adapter.Connection;
com.rti.routingservice.adapter.StreamReaderListener;
com.rti.routingservice.adapter.infrastructure.AdapterException;
com.rti.routingservice.adapter.infrastructure.Version;
java.util.Properties;
/**
* Simple file adapter.
*/
public class SimpleFileAdapter implements Adapter {
String verbosity;
/**
* Entry point to the adapter.
*/
public SimpleFileAdapter(Properties props) {
verbosity = props.getProperty("rti.routingservice.verbosity");
if (verbosity.equals("debug")) {
System.out.println("CREATE " + getClass().getName());
}
}
1. c:\adapters\SimpleFileAdapter for Windows systems, or /opt/adapters/simplefile for UNIX-based
systems.
8-56