ibis.ipl
Class PortType

java.lang.Object
  extended byibis.ipl.PortType

public abstract class PortType
extends java.lang.Object

A PortType represents a class of send and receive ports with specific properties and with a specific role in the program. Each class also serves as the factory to create instances of these ports. Ports can only connect to other ports of the same type. A PortType is created using the Ibis.createPortType(String, StaticProperties) method.

Support for connection downcalls can be explicitly turned on and off, because it might incur some overhead. Moreover, if downcalls are used, the amount of administration that must be kept is dependent on the frequency of the user downcalls. If the user never does a downcall, the administration is kept indefinitely.


Constructor Summary
PortType()
          Dummy constructor; do not use: a PortType is created using the Ibis.createPortType(String, StaticProperties) method.
 
Method Summary
 ReceivePort createReceivePort(java.lang.String name)
          Creates a named ReceivePort of this PortType, with explicit receipt communication.
 ReceivePort createReceivePort(java.lang.String name, boolean connectionDowncalls)
          Creates a named ReceivePort of this PortType, with explicit receipt communication.
 ReceivePort createReceivePort(java.lang.String name, ReceivePortConnectUpcall cU)
          Creates a named ReceivePort of this PortType, with explicit receipt communication.
 ReceivePort createReceivePort(java.lang.String name, Upcall u)
          Creates a named ReceivePort of this PortType, with upcall based communication.
 ReceivePort createReceivePort(java.lang.String name, Upcall u, boolean connectionDowncalls)
          Creates a named ReceivePort of this PortType, with upcall based communication.
 ReceivePort createReceivePort(java.lang.String name, Upcall u, ReceivePortConnectUpcall cU)
          Creates a named ReceivePort of this PortType, with upcall based communication.
 SendPort createSendPort()
          Creates a anonymous SendPort of this PortType.
 SendPort createSendPort(boolean connectionDowncalls)
          Creates a anonymous SendPort of this PortType.
 SendPort createSendPort(java.lang.String name)
          Creates a named SendPort of this PortType.
 SendPort createSendPort(java.lang.String name, boolean connectionDowncalls)
          Creates a named SendPort of this PortType.
 SendPort createSendPort(java.lang.String name, SendPortConnectUpcall cU)
          Creates a named SendPort of this PortType.
abstract  boolean equals(java.lang.Object other)
          The equals method is mentioned here just as a reminder that an implementation must probably redefine it, because two objects representing the same porttype must compare equal (and result in the same hashcode).
abstract  int hashCode()
          The hashCode method is mentioned here just as a reminder that an implementation must probably redefine it, because two objects representing the same porttype must result in the same hashcode (and compare equal).
abstract  java.lang.String name()
          Returns the name given to this PortType upon creation.
abstract  StaticProperties properties()
          Returns the properties given to this PortType upon creation.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortType

public PortType()
Dummy constructor; do not use: a PortType is created using the Ibis.createPortType(String, StaticProperties) method.

Method Detail

name

public abstract java.lang.String name()
Returns the name given to this PortType upon creation.

Returns:
the name of this port type.

properties

public abstract StaticProperties properties()
Returns the properties given to this PortType upon creation.

Returns:
the static properties of this port type.

createSendPort

public SendPort createSendPort()
                        throws java.io.IOException
Creates a anonymous SendPort of this PortType.

Returns:
the new sendport.
Throws:
java.io.IOException - is thrown when the port could not be created.

createSendPort

public SendPort createSendPort(java.lang.String name)
                        throws java.io.IOException
Creates a named SendPort of this PortType. The name does not have to be unique.

Parameters:
name - the name of this sendport.
Returns:
the new sendport.
Throws:
java.io.IOException - is thrown when the port could not be created.
IbisConfigurationException - is thrown when the port type does not match what is required here.

createSendPort

public SendPort createSendPort(boolean connectionDowncalls)
                        throws java.io.IOException
Creates a anonymous SendPort of this PortType.

Parameters:
connectionDowncalls - set when this port must keep connection administration to support the lostConnections downcall.
Returns:
the new sendport.
Throws:
java.io.IOException - is thrown when the port could not be created.
IbisConfigurationException - is thrown when the port type does not match what is required here.

createSendPort

public SendPort createSendPort(java.lang.String name,
                               boolean connectionDowncalls)
                        throws java.io.IOException
Creates a named SendPort of this PortType. The name does not have to be unique.

Parameters:
name - the name of this sendport.
connectionDowncalls - set when this port must keep connection administration to support the lostConnections downcall.
Returns:
the new sendport.
Throws:
java.io.IOException - is thrown when the port could not be created.
IbisConfigurationException - is thrown when the port type does not match what is required here.

createSendPort

public SendPort createSendPort(java.lang.String name,
                               SendPortConnectUpcall cU)
                        throws java.io.IOException
Creates a named SendPort of this PortType. The name does not have to be unique. When a connection is lost, a ConnectUpcall is performed.

Parameters:
name - the name of this sendport.
cU - object implementing the SendPortConnectUpcall.lostConnection(SendPort, ReceivePortIdentifier, Exception) method.
Returns:
the new sendport.
Throws:
java.io.IOException - is thrown when the port could not be created.
IbisConfigurationException - is thrown when the port type does not match what is required here.

createReceivePort

public ReceivePort createReceivePort(java.lang.String name)
                              throws java.io.IOException
Creates a named ReceivePort of this PortType, with explicit receipt communication. New connections will not be accepted until ReceivePort.enableConnections() is invoked. This is done to avoid upcalls during initialization.

Parameters:
name - the unique name of this receiveport (or null, in which case a name is invented).
Returns:
the new receiveport.
Throws:
java.io.IOException - is thrown when the port could not be created.
IbisConfigurationException - is thrown when the port type does not match what is required here.

createReceivePort

public ReceivePort createReceivePort(java.lang.String name,
                                     boolean connectionDowncalls)
                              throws java.io.IOException
Creates a named ReceivePort of this PortType, with explicit receipt communication. New connections will not be accepted until ReceivePort.enableConnections() is invoked. This is done to avoid upcalls during initialization.

Parameters:
name - the unique name of this receiveport (or null, in which case a name is invented).
connectionDowncalls - set when this port must keep connection administration to support the lostConnections and newConnections downcalls.
Returns:
the new receiveport.
Throws:
java.io.IOException - is thrown when the port could not be created.
IbisConfigurationException - is thrown when the port type does not match what is required here.

createReceivePort

public ReceivePort createReceivePort(java.lang.String name,
                                     Upcall u)
                              throws java.io.IOException
Creates a named ReceivePort of this PortType, with upcall based communication. New connections will not be accepted until ReceivePort.enableConnections() is invoked. This is done to avoid upcalls during initialization.

Parameters:
name - the unique name of this receiveport (or null, in which case a name is invented).
u - the upcall handler.
Returns:
the new receiveport.
Throws:
java.io.IOException - is thrown when the port could not be created.
IbisConfigurationException - is thrown when the port type does not match what is required here.

createReceivePort

public ReceivePort createReceivePort(java.lang.String name,
                                     Upcall u,
                                     boolean connectionDowncalls)
                              throws java.io.IOException
Creates a named ReceivePort of this PortType, with upcall based communication. New connections will not be accepted until ReceivePort.enableConnections() is invoked. This is done to avoid upcalls during initialization.

Parameters:
name - the unique name of this receiveport (or null, in which case a name is invented).
u - the upcall handler.
connectionDowncalls - set when this port must keep connection administration to support the lostConnections and newConnections downcalls.
Returns:
the new receiveport.
Throws:
java.io.IOException - is thrown when the port could not be created.
IbisConfigurationException - is thrown when the port type does not match what is required here.

createReceivePort

public ReceivePort createReceivePort(java.lang.String name,
                                     ReceivePortConnectUpcall cU)
                              throws java.io.IOException
Creates a named ReceivePort of this PortType, with explicit receipt communication. New connections will not be accepted until ReceivePort.enableConnections() is invoked. This is done to avoid upcalls during initialization. When a new connection request arrives, or when a connection is lost, a ConnectUpcall is performed.

Parameters:
name - the unique name of this receiveport (or null, in which case a name is invented).
cU - object implementing gotConnection() and lostConnection() upcalls.
Returns:
the new receiveport.
Throws:
java.io.IOException - is thrown when the port could not be created.
IbisConfigurationException - is thrown when the port type does not match what is required here.

createReceivePort

public ReceivePort createReceivePort(java.lang.String name,
                                     Upcall u,
                                     ReceivePortConnectUpcall cU)
                              throws java.io.IOException
Creates a named ReceivePort of this PortType, with upcall based communication. New connections will not be accepted until ReceivePort.enableConnections() is invoked. This is done to avoid upcalls during initialization. When a new connection request arrives, or when a connection is lost, a ConnectUpcall is performed.

Parameters:
name - the unique name of this receiveport (or null, in which case a name is invented).
u - the upcall handler.
cU - object implementing gotConnection() and lostConnection() upcalls.
Returns:
the new receiveport.
Throws:
java.io.IOException - is thrown when the port could not be created.
IbisConfigurationException - is thrown when the port type does not match what is required here.

hashCode

public abstract int hashCode()
The hashCode method is mentioned here just as a reminder that an implementation must probably redefine it, because two objects representing the same porttype must result in the same hashcode (and compare equal). To explicitly specify it here does not help, because java.lang.Object already implements it, but, anyway, here it is.

Returns:
the hashcode.

equals

public abstract boolean equals(java.lang.Object other)
The equals method is mentioned here just as a reminder that an implementation must probably redefine it, because two objects representing the same porttype must compare equal (and result in the same hashcode). To explicitly specify it here does not help, because java.lang.Object already implements it, but, anyway, here it is.

Parameters:
other - the object to compare with.
Returns:
the result of the comparison.


The Ibis project