com.sap.mdm.net
Class SimpleConnectionFactory

java.lang.Object
  extended bycom.sap.mdm.net.SimpleConnectionFactory

public class SimpleConnectionFactory
extends Object

This class allows for creating a connection to the MDM server. A connection is needed whenever the MDM Java API needs to communicate with the MDM server. A connection is tied to a specific MDM server.

A simple connection is used, as opposed to a connection pool, in cases where there is no need for the more complex connection pool or when there exist a service that provide resource pooling.

Each call to getInstance returns a new instance.

Examples of connection tags:
localhost
The MDM server is on the local machine and the default port number of 59950.

MyMachine;40000
The MDM server is on the "MyMachine" and the port number is 40000.

Note: It is entirely up to the user to manage the lifetime of the simple connections. In addition, in certain circumstances, some operation system will not release the listening port on the server side until all client side sockets connecting to the listening port are closed.

See Also:
ConnectionPoolFactory

Field Summary
static int NO_TIMEOUT
          A constant for specifying no timeout.
 
Constructor Summary
SimpleConnectionFactory()
           
 
Method Summary
static int getConnectionCreationTimeout()
          Returns the SO_TIMEOUT used when establishing a new connection.
static SimpleConnection getInstance(String connectionTag)
          Returns a non-SSL connection to the MDM server.
static SimpleConnection getInstance(String connectionTag, SocketFactory socketFactory)
          Returns a SSL connection to the MDM server.
static SimpleConnection getInstance(String connectionTag, String connectionSource)
          Deprecated. there is really no way to make use of connection source
static SimpleConnection getInstance(String connectionTag, String connectionSource, SocketFactory socketFactory)
          Deprecated. there is really no way to make use of connection source
static int getTimeout()
          Returns the SO_TIMEOUT used during normal communication with the MDM server.
static void setConnectionCreationTimeout(int timeout)
          Sets the SO_TIMEOUT used when establishing a new connection.
static void setTimeout(int timeout)
          Sets the SO_TIMEOUT used during normal communication with the MDM server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_TIMEOUT

public static final int NO_TIMEOUT
A constant for specifying no timeout.

See Also:
Constant Field Values
Constructor Detail

SimpleConnectionFactory

public SimpleConnectionFactory()
Method Detail

getInstance

public static SimpleConnection getInstance(String connectionTag)
                                    throws ConnectionException
Returns a non-SSL connection to the MDM server.

Parameters:
connectionTag - the connection tag encoding the host name and the port number
Returns:
a connection to the MDM server
Throws:
ConnectionException - if not able to create a connection to the MDM server

getInstance

public static SimpleConnection getInstance(String connectionTag,
                                           SocketFactory socketFactory)
                                    throws ConnectionException
Returns a SSL connection to the MDM server.

Parameters:
connectionTag - the connection tag encoding the host name and the port number
socketFactory - the socket factory, if null, a plain socket is used
Returns:
a connection to the MDM server
Throws:
ConnectionException - if not able to create a connection to the MDM server
Since:
7.1.07

getInstance

public static SimpleConnection getInstance(String connectionTag,
                                           String connectionSource)
                                    throws ConnectionException
Deprecated. there is really no way to make use of connection source

Returns a non-SSL connection to the MDM server.

Parameters:
connectionTag - the connection tag encoding the host name and the port number
connectionSource - the connection source
Returns:
a connection to the MDM server
Throws:
ConnectionException - if not able to create a connection to the MDM server

getInstance

public static SimpleConnection getInstance(String connectionTag,
                                           String connectionSource,
                                           SocketFactory socketFactory)
                                    throws ConnectionException
Deprecated. there is really no way to make use of connection source

Returns a SSL connection to the MDM server.

Parameters:
connectionTag - the connection tag encoding the host name and the port number
connectionSource - the connection source
socketFactory - the socket factory, if null, a plain socket is used
Returns:
a connection to the MDM server
Throws:
ConnectionException - if not able to create a connection to the MDM server

setTimeout

public static void setTimeout(int timeout)
Sets the SO_TIMEOUT used during normal communication with the MDM server. The default is forever.

Parameters:
timeout - a timeout in milliseconds
See Also:
Socket.setSoTimeout(int)

getTimeout

public static int getTimeout()
Returns the SO_TIMEOUT used during normal communication with the MDM server.

Returns:
a timeout in milliseconds

getConnectionCreationTimeout

public static int getConnectionCreationTimeout()
Returns the SO_TIMEOUT used when establishing a new connection.

Returns:
a timeout in milliseconds
Since:
7.1

setConnectionCreationTimeout

public static void setConnectionCreationTimeout(int timeout)
Sets the SO_TIMEOUT used when establishing a new connection. If a new connection cannot be established within the specified timeout, an exception will be thrown. The default is one minute.

Parameters:
timeout - a timeout in milliseconds
Since:
7.1
See Also:
Socket.setSoTimeout(int)


Copyright 2004-2007 by SAP AG. All Rights Reserved.

SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.