org.teleal.cling.support.connectionmanager
Class AbstractPeeringConnectionManagerService

java.lang.Object
  extended by org.teleal.cling.support.connectionmanager.ConnectionManagerService
      extended by org.teleal.cling.support.connectionmanager.AbstractPeeringConnectionManagerService

public abstract class AbstractPeeringConnectionManagerService
extends ConnectionManagerService

Support for setup and teardown of an arbitrary number of connections with a manager peer.

Author:
Christian Bauer, Alessio Gaeta

Field Summary
 
Fields inherited from class org.teleal.cling.support.connectionmanager.ConnectionManagerService
activeConnections, propertyChangeSupport, sinkProtocolInfo, sourceProtocolInfo
 
Constructor Summary
protected AbstractPeeringConnectionManagerService(ConnectionInfo... activeConnections)
           
protected AbstractPeeringConnectionManagerService(PropertyChangeSupport propertyChangeSupport, ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo, ConnectionInfo... activeConnections)
           
protected AbstractPeeringConnectionManagerService(ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo, ConnectionInfo... activeConnections)
           
 
Method Summary
protected abstract  void closeConnection(ConnectionInfo connectionInfo)
           
 void closeConnectionWithPeer(org.teleal.cling.controlpoint.ControlPoint controlPoint, org.teleal.cling.model.meta.Service peerService, ConnectionInfo connectionInfo)
          Close the connection with the peer, remove the connection details.
 void closeConnectionWithPeer(org.teleal.cling.controlpoint.ControlPoint controlPoint, org.teleal.cling.model.meta.Service peerService, int connectionID)
          Close the connection with the peer, remove the connection details.
 void connectionComplete(int connectionID)
           
protected abstract  ConnectionInfo createConnection(int connectionID, int peerConnectionId, org.teleal.cling.model.ServiceReference peerConnectionManager, ConnectionInfo.Direction direction, ProtocolInfo protocolInfo)
           
 int createConnectionWithPeer(org.teleal.cling.model.ServiceReference localServiceReference, org.teleal.cling.controlpoint.ControlPoint controlPoint, org.teleal.cling.model.meta.Service peerService, ProtocolInfo protInfo, ConnectionInfo.Direction direction)
          Generate a new local connection identifier, prepare the peer, store connection details.
protected  int getNewConnectionId()
           
protected abstract  void peerFailure(org.teleal.cling.model.action.ActionInvocation invocation, org.teleal.cling.model.message.UpnpResponse operation, String defaultFailureMessage)
          Called when connection creation or closing with a peer failed.
 ConnectionInfo prepareForConnection(ProtocolInfo remoteProtocolInfo, org.teleal.cling.model.ServiceReference peerConnectionManager, int peerConnectionId, String direction)
           
protected  void removeConnection(int connectionID)
           
protected  void storeConnection(ConnectionInfo info)
           
 
Methods inherited from class org.teleal.cling.support.connectionmanager.ConnectionManagerService
getCurrentConnectionIDs, getCurrentConnectionInfo, getPropertyChangeSupport, getProtocolInfo, getSinkProtocolInfo, getSourceProtocolInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPeeringConnectionManagerService

protected AbstractPeeringConnectionManagerService(ConnectionInfo... activeConnections)

AbstractPeeringConnectionManagerService

protected AbstractPeeringConnectionManagerService(ProtocolInfos sourceProtocolInfo,
                                                  ProtocolInfos sinkProtocolInfo,
                                                  ConnectionInfo... activeConnections)

AbstractPeeringConnectionManagerService

protected AbstractPeeringConnectionManagerService(PropertyChangeSupport propertyChangeSupport,
                                                  ProtocolInfos sourceProtocolInfo,
                                                  ProtocolInfos sinkProtocolInfo,
                                                  ConnectionInfo... activeConnections)
Method Detail

getNewConnectionId

protected int getNewConnectionId()

storeConnection

protected void storeConnection(ConnectionInfo info)

removeConnection

protected void removeConnection(int connectionID)

prepareForConnection

public ConnectionInfo prepareForConnection(ProtocolInfo remoteProtocolInfo,
                                           org.teleal.cling.model.ServiceReference peerConnectionManager,
                                           int peerConnectionId,
                                           String direction)
                                    throws org.teleal.cling.model.action.ActionException
Throws:
org.teleal.cling.model.action.ActionException

connectionComplete

public void connectionComplete(int connectionID)
                        throws org.teleal.cling.model.action.ActionException
Throws:
org.teleal.cling.model.action.ActionException

createConnectionWithPeer

public int createConnectionWithPeer(org.teleal.cling.model.ServiceReference localServiceReference,
                                    org.teleal.cling.controlpoint.ControlPoint controlPoint,
                                    org.teleal.cling.model.meta.Service peerService,
                                    ProtocolInfo protInfo,
                                    ConnectionInfo.Direction direction)
Generate a new local connection identifier, prepare the peer, store connection details.

Returns:
-1 if the peerFailure(org.teleal.cling.model.action.ActionInvocation, org.teleal.cling.model.message.UpnpResponse, String) method had to be called, otherwise the local identifier of the established connection.

closeConnectionWithPeer

public void closeConnectionWithPeer(org.teleal.cling.controlpoint.ControlPoint controlPoint,
                                    org.teleal.cling.model.meta.Service peerService,
                                    int connectionID)
                             throws org.teleal.cling.model.action.ActionException
Close the connection with the peer, remove the connection details.

Throws:
org.teleal.cling.model.action.ActionException

closeConnectionWithPeer

public void closeConnectionWithPeer(org.teleal.cling.controlpoint.ControlPoint controlPoint,
                                    org.teleal.cling.model.meta.Service peerService,
                                    ConnectionInfo connectionInfo)
                             throws org.teleal.cling.model.action.ActionException
Close the connection with the peer, remove the connection details.

Throws:
org.teleal.cling.model.action.ActionException

createConnection

protected abstract ConnectionInfo createConnection(int connectionID,
                                                   int peerConnectionId,
                                                   org.teleal.cling.model.ServiceReference peerConnectionManager,
                                                   ConnectionInfo.Direction direction,
                                                   ProtocolInfo protocolInfo)
                                            throws org.teleal.cling.model.action.ActionException
Throws:
org.teleal.cling.model.action.ActionException

closeConnection

protected abstract void closeConnection(ConnectionInfo connectionInfo)

peerFailure

protected abstract void peerFailure(org.teleal.cling.model.action.ActionInvocation invocation,
                                    org.teleal.cling.model.message.UpnpResponse operation,
                                    String defaultFailureMessage)
Called when connection creation or closing with a peer failed.

This is the failure result of an action invocation on the peer's connection management service. The execution of the createConnectionWithPeer(org.teleal.cling.model.ServiceReference, org.teleal.cling.controlpoint.ControlPoint, org.teleal.cling.model.meta.Service, org.teleal.cling.support.model.ProtocolInfo , org.teleal.cling.support.model.ConnectionInfo.Direction) and closeConnectionWithPeer(org.teleal.cling.controlpoint.ControlPoint, org.teleal.cling.model.meta.Service, org.teleal.cling.support.model.ConnectionInfo) methods will block until this method completes handling any failure.

Parameters:
invocation - The underlying action invocation of the remote connection manager service.
operation - The network message response if there was a response, or null.
defaultFailureMessage - A user-friendly error message generated from the invocation exception and response.


Copyright © 2011 Teleal GmbH, Switzerland. All Rights Reserved.