Package com.ericsson.otp.erlang

This package provides support for communication with Erlang and representation of Erlang datatypes.

See:
          Description

Class Summary
AbstractConnection Maintains a connection between a Java process and a remote Erlang, Java or C node.
AbstractNode Represents an OTP node.
GenericQueue This class implements a generic FIFO queue.
OtpConnection Maintains a connection between a Java process and a remote Erlang, Java or C node.
OtpCookedConnection Maintains a connection between a Java process and a remote Erlang, Java or C node.
OtpEpmd Provides methods for registering, unregistering and looking up nodes with the Erlang portmapper daemon (Epmd).
OtpErlangAtom Provides a Java representation of Erlang atoms.
OtpErlangBinary Provides a Java representation of Erlang binaries.
OtpErlangBoolean Provides a Java representation of Erlang booleans, which are special cases of atoms with values 'true' and 'false'.
OtpErlangByte Provides a Java representation of Erlang integral types.
OtpErlangChar Provides a Java representation of Erlang integral types.
OtpErlangDouble Provides a Java representation of Erlang floats and doubles.
OtpErlangFloat Provides a Java representation of Erlang floats and doubles.
OtpErlangInt Provides a Java representation of Erlang integral types.
OtpErlangList Provides a Java representation of Erlang lists.
OtpErlangLong Provides a Java representation of Erlang integral types.
OtpErlangObject Base class of the Erlang data type classes.
OtpErlangPid Provides a Java representation of Erlang PIDs.
OtpErlangPort Provides a Java representation of Erlang ports.
OtpErlangRef Provides a Java representation of Erlang refs.
OtpErlangShort Provides a Java representation of Erlang integral types.
OtpErlangString Provides a Java representation of Erlang strings.
OtpErlangTuple Provides a Java representation of Erlang tuples.
OtpErlangUInt Provides a Java representation of Erlang integral types.
OtpErlangUShort Provides a Java representation of Erlang integral types.
OtpExternal Provides a collection of constants used when encoding and decoding Erlang terms.
OtpInputStream Provides a stream for decoding Erlang terms from external format.
OtpLocalNode This class represents local node types.
OtpMbox Provides a simple mechanism for exchanging messages with Erlang processes or other instances of this class.
OtpMsg Provides a carrier for Erlang messages.
OtpNode Represents a local OTP node.
OtpNodeStatus Provides a callback mechanism for receiving status change information about other nodes in the system.
OtpOutputStream Provides a stream for encoding Erlang terms to external format, for transmission or storage.
OtpPeer Represents a remote OTP node.
OtpSelf Represents an OTP node.
OtpServer Deprecated. the functionality of this class has been moved to OtpSelf.
 

Exception Summary
OtpAuthException Exception raised when a node attempts to establish a communication channel when it is not authorized to do so, or when a node sends a message containing an invalid cookie on an established channel.
OtpErlangDecodeException Exception raised when an attempt is made to create an Erlang term by decoding a sequence of bytes that does not represent the type of term that was requested.
OtpErlangException Base class for the other OTP erlang exception classes.
OtpErlangExit Exception raised when a communication channel is broken.
OtpErlangRangeException Exception raised when an attempt is made to create an Erlang term with data that is out of range for the term in question.
OtpException Base class for the other OTP exception classes.
 

Package com.ericsson.otp.erlang Description

This package provides support for communication with Erlang and representation of Erlang datatypes.

The classes OtpPeer, OtpSelf and OtpServer are used to represent OTP nodes and are neccessary in order to set up communication between the Java thread and a remote node. Once a connection has been established, it is represented by an OtpConnection, through which all communication goes.

The classes OtpErlangList, OtpErlangTuple, OtpErlangBinary, OtpErlangAtom, OtpErlangBoolean, OtpErlangByte, OtpErlangChar, OtpErlangDouble, OtpErlangFloat, OtpErlangLong, OtpErlangInt, OtpErlangUInt, OtpErlangShort, OtpErlangUShort, OtpErlangString, OtpErlangObject, OtpErlangPid, OtpErlangPort, and OtpErlangRef represent the various Erlang datatypes.

Setting up a connection with a remote node is straightforward. You create objects representing the local and remote nodes, then call the local node's connect() method:

  OtpSelf self = new OtpSelf("client","cookie");
  OtpPeer other = new OtpPeer("server");
  OtpConnection conn = self.connect(other);

The OtpSelf used in the previous example is a client-only node, i.e. it can make outgoing connections but it cannot accept incoming ones. If your Java node also needs to be able to accept incoming connections, you must use an OtpServer instead, which can do both:

  OtpServer self = new OtpServer("client","cookie");
  self.publishPort();
  OtpConnection conn = self.accept();

Once the connection is established by one of the above methods (connect() or accept()), you can use the resulting OtpConnection to send and receive messages:

  OtpErlangAtom msg = new ErlangOtpAtom("hello");
  conn.send("echoserver", msg);
  
  OtpErlangObject reply = conn.receive();
  System.out.println("Received " + reply);