Class AbstractNode
- java.lang.Object
- 
- com.ericsson.otp.erlang.AbstractNode
 
- 
- All Implemented Interfaces:
- OtpTransportFactory
 - Direct Known Subclasses:
- OtpLocalNode,- OtpPeer
 
 public class AbstractNode extends java.lang.Object implements OtpTransportFactory Represents an OTP node. About nodenames: Erlang nodenames consist of two components, an alivename and a hostname separated by '@'. Additionally, there are two nodename formats: short and long. Short names are of the form "alive@hostname", while long names are of the form "alive@host.fully.qualified.domainname". Erlang has special requirements regarding the use of the short and long formats, in particular they cannot be mixed freely in a network of communicating nodes, however Jinterface makes no distinction. See the Erlang documentation for more information about nodenames. The constructors for the AbstractNode classes will create names exactly as you provide them as long as the name contains '@'. If the string you provide contains no '@', it will be treated as an alivename and the name of the local host will be appended, resulting in a shortname. Nodenames longer than 255 characters will be truncated without warning. Upon initialization, this class attempts to read the file .erlang.cookie in the user's home directory, and uses the trimmed first line of the file as the default cookie by those constructors lacking a cookie argument. If for any reason the file cannot be found or read, the default cookie will be set to the empty string (""). The location of a user's home directory is determined using the system property "user.home", which may not be automatically set on all platforms. Instances of this class cannot be created directly, use one of the subclasses instead. 
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractNode(OtpTransportFactory transportFactory)protectedAbstractNode(java.lang.String node)Create a node with the given name and default cookie and transport factory.protectedAbstractNode(java.lang.String node, OtpTransportFactory transportFactory)Create a node with the given name, transport factory and the default cookie.protectedAbstractNode(java.lang.String name, java.lang.String cookie)Create a node with the given name, cookie and default transport factory.protectedAbstractNode(java.lang.String name, java.lang.String cookie, OtpTransportFactory transportFactory)Create a node with the given name, cookie and transport factory.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringalive()Get the alivename part of the hostname.java.lang.Stringcookie()Get the authorization cookie used by this node.OtpServerTransportcreateServerTransport(int port)Create instance ofOtpServerTransportOtpServerTransportcreateServerTransport(OtpLocalNode node)Create a server-side transport for alternative distribution protocols using a transport factory extending the OtpGenericTransportFactory abstract class.OtpTransportcreateTransport(OtpPeer peer)Create a client-side transport for alternative distribution protocols using a transport factory extending the OtpGenericTransportFactory abstract class.OtpTransportcreateTransport(java.lang.String addr, int port)Create instance ofOtpTransportOtpTransportcreateTransport(java.net.InetAddress addr, int port)Create instance ofOtpTransportjava.lang.Stringhost()Get the hostname part of the nodename.java.lang.Stringnode()Get the name of this node.java.lang.StringsetCookie(java.lang.String cookie)Set the authorization cookie used by this node.java.lang.StringtoString()
 
- 
- 
- 
Constructor Detail- 
AbstractNodeprotected AbstractNode(OtpTransportFactory transportFactory) 
 - 
AbstractNodeprotected AbstractNode(java.lang.String node) Create a node with the given name and default cookie and transport factory.
 - 
AbstractNodeprotected AbstractNode(java.lang.String node, OtpTransportFactory transportFactory)Create a node with the given name, transport factory and the default cookie.
 - 
AbstractNodeprotected AbstractNode(java.lang.String name, java.lang.String cookie)Create a node with the given name, cookie and default transport factory.
 - 
AbstractNodeprotected AbstractNode(java.lang.String name, java.lang.String cookie, OtpTransportFactory transportFactory)Create a node with the given name, cookie and transport factory.
 
- 
 - 
Method Detail- 
nodepublic java.lang.String node() Get the name of this node.- Returns:
- the name of the node represented by this object.
 
 - 
hostpublic java.lang.String host() Get the hostname part of the nodename. Nodenames are composed of two parts, an alivename and a hostname, separated by '@'. This method returns the part of the nodename following the '@'.- Returns:
- the hostname component of the nodename.
 
 - 
alivepublic java.lang.String alive() Get the alivename part of the hostname. Nodenames are composed of two parts, an alivename and a hostname, separated by '@'. This method returns the part of the nodename preceding the '@'.- Returns:
- the alivename component of the nodename.
 
 - 
cookiepublic java.lang.String cookie() Get the authorization cookie used by this node.- Returns:
- the authorization cookie used by this node.
 
 - 
setCookiepublic java.lang.String setCookie(java.lang.String cookie) Set the authorization cookie used by this node.- Returns:
- the previous authorization cookie used by this node.
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
createTransportpublic OtpTransport createTransport(java.lang.String addr, int port) throws java.io.IOException Description copied from interface:OtpTransportFactoryCreate instance ofOtpTransport- Specified by:
- createTransportin interface- OtpTransportFactory
- Parameters:
- addr- host name or IP address string
- port- port number
- Returns:
- new socket object
- Throws:
- java.io.IOException
 
 - 
createTransportpublic OtpTransport createTransport(java.net.InetAddress addr, int port) throws java.io.IOException Description copied from interface:OtpTransportFactoryCreate instance ofOtpTransport- Specified by:
- createTransportin interface- OtpTransportFactory
- Parameters:
- addr- peer address
- port- port number
- Returns:
- new socket object
- Throws:
- java.io.IOException
 
 - 
createServerTransportpublic OtpServerTransport createServerTransport(int port) throws java.io.IOException Description copied from interface:OtpTransportFactoryCreate instance ofOtpServerTransport- Specified by:
- createServerTransportin interface- OtpTransportFactory
- Parameters:
- port- port number to listen on
- Returns:
- new socket object
- Throws:
- java.io.IOException
 
 - 
createTransportpublic OtpTransport createTransport(OtpPeer peer) throws java.io.IOException Create a client-side transport for alternative distribution protocols using a transport factory extending the OtpGenericTransportFactory abstract class. Connect it to the specified server.- Parameters:
- peer- the peer identifying the server to connect to
- Throws:
- java.io.IOException
 
 - 
createServerTransportpublic OtpServerTransport createServerTransport(OtpLocalNode node) throws java.io.IOException Create a server-side transport for alternative distribution protocols using a transport factory extending the OtpGenericTransportFactory abstract class.- Parameters:
- node- the local node identifying the transport to create server-side
- Throws:
- java.io.IOException
 
 
- 
 
-