org.simantics.databoard.method
Class Client

java.lang.Object
  extended by org.simantics.databoard.method.Client
All Implemented Interfaces:
MethodInterface

public class Client
extends java.lang.Object
implements MethodInterface

Proxy InterfaceBinding over a socket.

Author:
Toni Kalajainen

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.simantics.databoard.method.MethodInterface
MethodInterface.AsyncRequestStatus, MethodInterface.AsyncResult, MethodInterface.ExecutionError, MethodInterface.InvokeListener, MethodInterface.Method
 
Constructor Summary
Client(java.net.InetAddress addr, int port)
          Create a new method interface client.
Client(java.net.InetAddress addr, int port, MethodInterface localMethodHandler)
          Create a new method interface client.
Client(java.net.InetSocketAddress sa)
          Create a new method interface client.
Client(java.lang.String addr, int port)
          Create a new method interface client.
 
Method Summary
 void close()
           
 TcpConnection getConnection()
           
 Interface getInterface()
          Get remote method descriptions
 MethodInterface.Method getMethod(MethodTypeBinding binding)
          Get an access to the implementation of a method.
 MethodInterface.Method getMethod(MethodTypeDefinition description)
          Get an access to the implementation of a method.
 void setConnectListener(TcpConnection.ConnectionListener listener)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Client

public Client(java.lang.String addr,
              int port)
       throws java.io.IOException,
              SerializationException,
              BindingException
Create a new method interface client. On successful construction the connection is established over TCP/IP channel.

Parameters:
addr -
port -
Throws:
java.io.IOException - connection error
SerializationException - handshake communication error
BindingException - handshake communication error

Client

public Client(java.net.InetSocketAddress sa)
       throws java.io.IOException,
              SerializationException,
              BindingException
Create a new method interface client. On successful construction the connection is established over TCP/IP channel.

Parameters:
sa -
Throws:
java.io.IOException - connection error
SerializationException - handshake communication error
BindingException - handshake communication error

Client

public Client(java.net.InetAddress addr,
              int port)
       throws java.io.IOException,
              SerializationException,
              BindingException
Create a new method interface client. On successful construction the connection is established over TCP/IP channel.

Parameters:
addr -
port -
Throws:
java.io.IOException - connection error
SerializationException - handshake communication error
BindingException - handshake communication error

Client

public Client(java.net.InetAddress addr,
              int port,
              MethodInterface localMethodHandler)
       throws java.io.IOException,
              SerializationException,
              BindingException
Create a new method interface client. On successful construction the connection is established over TCP/IP channel.

Parameters:
addr -
port -
localMethodHandler - handles requests sent by the server
Throws:
java.io.IOException
BindingException
SerializationException
Method Detail

setConnectListener

public void setConnectListener(TcpConnection.ConnectionListener listener)

getInterface

public Interface getInterface()
Get remote method descriptions

Specified by:
getInterface in interface MethodInterface
Returns:
method descriptions

getMethod

public MethodInterface.Method getMethod(MethodTypeBinding binding)
                                 throws MethodNotSupportedException
Description copied from interface: MethodInterface
Get an access to the implementation of a method. The binding is suggested by the consumer.

Specified by:
getMethod in interface MethodInterface
Parameters:
binding - binding to use
Returns:
method access
Throws:
MethodNotSupportedException

getMethod

public MethodInterface.Method getMethod(MethodTypeDefinition description)
                                 throws MethodNotSupportedException
Description copied from interface: MethodInterface
Get an access to the implementation of a method. The binding is suggested by the producer.

Specified by:
getMethod in interface MethodInterface
Parameters:
description - method description
Returns:
method access
Throws:
MethodNotSupportedException

getConnection

public TcpConnection getConnection()

close

public void close()