com.sap.mw.jco
Class JCO.Client

java.lang.Object
  |
  +--com.sap.mw.jco.JCO.Connection
        |
        +--com.sap.mw.jco.JCO.Client
All Implemented Interfaces:
java.lang.Cloneable
Enclosing class:
JCO

public static class JCO.Client
extends JCO.Connection

This object holds all information necessary to establish a connection to a remote JCO server, i.e. either a SAP system or an external JCO compliant server, respectively.


Method Summary
 void abort(java.lang.String message)
          Aborts the connection to the remote system, i.e. tries to send a final message to the host before it disconnects.
 java.lang.Object clone()
          Returns a clone of this connection The cloned connection however will not be opened
 void confirmTID(java.lang.String tid)
          Confirms that a transaction has been successfull
 void connect()
          Opens a client connection to the remote system using the current connection parameters
 java.lang.String createTID()
          Creates a new transaction ID
 void disconnect()
          Closes the connection to the remote system.
 void execute(JCO.Function function)
          Executes the function on the remote server synchronously
 void execute(JCO.Function function, java.lang.String tid)
          Executes the function on the remote server in transactional mode (asynchronously)
 void execute(JCO.Function function, java.lang.String tid, java.lang.String queue_name)
          Executes the function on the remote server in queued transactional mode (asynchronously)
 void execute(JCO.Function function, java.lang.String tid, java.lang.String queue_name, int queue_pos)
          Executes the function on the remote server in transactional mode (asynchronously)
 JCO.Response execute(JCO.Request request)
          Executes the request on the remote server synchronously
 void execute(JCO.Request request, java.lang.String tid)
          Executes the request on the remote server asynchronously
 void execute(JCO.Request request, java.lang.String tid, java.lang.String queue_name)
          Executes the request on the remote server asynchronously
 void execute(JCO.Request request, java.lang.String tid, java.lang.String queue_name, int queue_pos)
          Executes the request on the remote server asynchronously
 void execute(java.lang.String name, JCO.ParameterList input, JCO.ParameterList output)
          Executes the function on the remote server synchronously
 void execute(java.lang.String name, JCO.ParameterList input, JCO.ParameterList output, JCO.ParameterList tables)
          Executes the function on the remote server synchronously
 void execute(java.lang.String name, JCO.ParameterList input, JCO.ParameterList tables, java.lang.String tid)
          Executes the function on the remote server in transactional mode (asynchronously)
 void execute(java.lang.String name, JCO.ParameterList input, JCO.ParameterList tables, java.lang.String tid, java.lang.String queue_name)
          Executes the function on the remote server in queued transactional mode (asynchronously)
 void execute(java.lang.String name, JCO.ParameterList input, JCO.ParameterList tables, java.lang.String tid, java.lang.String queue_name, int queue_pos)
          Executes the function on the remote server in transactional mode (asynchronously)
 boolean getAbapDebug()
          Returns whether debugging is enabled or not.
 java.lang.String getASHost()
          Returns the application server
 JCO.Attributes getAttributes()
          Returns the attributes object for this connection.
 java.lang.String getClient()
          Returns the client
 java.lang.String getGroup()
          Returns the group of application servers
 java.lang.String getGWHost()
          Returns the gateway server
 java.lang.String getGWServ()
          Returns the gateway service
 java.lang.String getHashKey(boolean personalized)
          Returns a hash key for this client connection
 java.lang.String getLanguage()
          Returns the logon language
 java.lang.String getMSHost()
          Returns the message server
 java.lang.String[][] getPropertyInfo()
          Returns the property info for the connection
 int getSapGui()
          Returns if a SAP GUI is being used during a call
 byte getState()
          Returns the state of the client as a bit vector
 java.lang.String getSystemID()
          Returns the SAP system ID
 java.lang.String getSystemNumber()
          Returns the system number
 java.lang.String getTPName()
          Returns the program ID of an registered JCO compliant server program
 boolean getTrace()
          Returns whether trace is enabled or not.
 java.net.URL getURL()
          Returns the url to the remote system
 java.lang.String getUser()
          Returns the user
 boolean isAlive()
          Checks whether the connection is still alive
 void ping()
          Sends a ping to the server
 void reset()
          Resets the client, i.e. frees all resources allocated by this connection on the client and server side.
 void send(java.lang.Object idoc, java.lang.String tid)
          Asynchronously sends an intermediate document (IDoc) to the remote server
 void send(java.lang.Object idoc, java.lang.String tid, char idoc_version)
          Asynchronously sends an intermediate document (IDoc) to the remote server
 void send(java.lang.Object idoc, java.lang.String tid, java.lang.String queue_name)
          Asynchronously sends an intermediate document (IDoc) to an inbound queue of a remote server
 void send(java.lang.Object idoc, java.lang.String tid, java.lang.String queue_name, char idoc_version)
          Asynchronously sends an intermediate document (IDoc) to an inbound queue of a remote server
 void setAbapDebug(boolean debug)
          Enables/disables abap debug.
Note:If the connection is already established the method will close and reopen the connection.
 void setProperty(java.lang.String key, java.lang.String value)
          Sets the property for the given key.
 void setSapGui(int use_sapgui)
          Sets the use_sapgui parameter
 void setTrace(boolean trace)
          Enables/disables trace.
Note:If the connection is already established the method will close and reopen the connection.
 
Methods inherited from class com.sap.mw.jco.JCO.Connection
getProperties, getProperty, getThroughput, isValid, setThroughput
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

clone

public java.lang.Object clone()
Returns a clone of this connection The cloned connection however will not be opened
Overrides:
clone in class JCO.Connection
Returns:
a copy of the client

reset

public void reset()
Resets the client, i.e. frees all resources allocated by this connection on the client and server side.
Throws:
JCO.Exception - thrown if the client could not be resetted
Since:
JCo 2.0

getPropertyInfo

public final java.lang.String[][] getPropertyInfo()
Returns the property info for the connection
Overrides:
getPropertyInfo in class JCO.Connection

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets the property for the given key. If value is null the property will be removed from the property list.

getUser

public final java.lang.String getUser()
Returns the user
Returns:
the user

getClient

public final java.lang.String getClient()
Returns the client
Returns:
the client

getLanguage

public final java.lang.String getLanguage()
Returns the logon language
Returns:
the client logon

getSystemNumber

public final java.lang.String getSystemNumber()
Returns the system number
Returns:
the system number

getASHost

public final java.lang.String getASHost()
Returns the application server
Returns:
the application server

getMSHost

public final java.lang.String getMSHost()
Returns the message server
Returns:
the message server

getGWHost

public final java.lang.String getGWHost()
Returns the gateway server
Returns:
the gateway server

getGWServ

public final java.lang.String getGWServ()
Returns the gateway service
Returns:
the gateway service

getSystemID

public final java.lang.String getSystemID()
Returns the SAP system ID
Returns:
the SAP system ID

getGroup

public final java.lang.String getGroup()
Returns the group of application servers
Returns:
the group of application servers

getTPName

public final java.lang.String getTPName()
Returns the program ID of an registered JCO compliant server program
Returns:
Program ID of an registered JCO compliant server program

getURL

public final java.net.URL getURL()
Returns the url to the remote system
Returns:
the url to the remote system or null if not set or malformed

getTrace

public final boolean getTrace()
Returns whether trace is enabled or not.
Overrides:
getTrace in class JCO.Connection
Returns:
true if trace is enabled, false otherwise

setTrace

public final void setTrace(boolean trace)
Enables/disables trace.
Note:If the connection is already established the method will close and reopen the connection. Any states associated with the connection might get lost.
Overrides:
setTrace in class JCO.Connection
Parameters:
trace - if true enables the trace and disables it otherwise.

getAbapDebug

public boolean getAbapDebug()
Returns whether debugging is enabled or not.
Returns:
true if debugging is enabled, false otherwise

setAbapDebug

public void setAbapDebug(boolean debug)
Enables/disables abap debug.
Note:If the connection is already established the method will close and reopen the connection. Any states associated with the connection might get lost.
Parameters:
debug - if true enables ABAP debugging, disables it otherwise

getSapGui

public int getSapGui()
Returns if a SAP GUI is being used during a call
Returns:
0 if no GUI, 1 if visible GUI, and 2 if invisible GUI is being used

setSapGui

public void setSapGui(int use_sapgui)
Sets the use_sapgui parameter
Parameters:
use_sapgui - 0/1/2: without/with/invisible SAPGUI

getState

public byte getState()
Returns the state of the client as a bit vector
Returns:
the state of the client as a bit vector
Flag Description
JCO.STATE_DISCONNECTEDThe client is disconnected
JCO.STATE_CONNECTED The client is connected to the remote server
JCO.STATE_BUSY The client is currently executing a remote function call
JCO.STATE_USED A pooled connection has been allocated by a program

getAttributes

public final JCO.Attributes getAttributes()
Returns the attributes object for this connection.
Overrides:
getAttributes in class JCO.Connection
Returns:
the attributes object for this connection.
Throws:
JCO.Exception - thrown if the attributes could not be retrieved.
See Also:
JCO.Attributes

getHashKey

public java.lang.String getHashKey(boolean personalized)
Returns a hash key for this client connection
Parameters:
personalized - if true include the user into the key generation
Returns:
a hash key for this client connection
Since:
JCo 2.0

isAlive

public boolean isAlive()
Checks whether the connection is still alive
Overrides:
isAlive in class JCO.Connection
Returns:
true if the connection is alive, false otherwise

connect

public void connect()
Opens a client connection to the remote system using the current connection parameters
Throws:
JCO.Exception - if the connection could not be established

disconnect

public void disconnect()
Closes the connection to the remote system.
Overrides:
disconnect in class JCO.Connection
Throws:
JCO.Exception - with the error group set to JCO.Exception.JCO_ERROR_RESOURCE, must be released back to its pool by using JCO.releaseClient().
See Also:
JCO.releaseClient(com.sap.mw.jco.JCO.Client)

abort

public void abort(java.lang.String message)
Aborts the connection to the remote system, i.e. tries to send a final message to the host before it disconnects.
Overrides:
abort in class JCO.Connection
Parameters:
message - the final message which will be sent to the remote system.

execute

public void execute(JCO.Function function)
Executes the function on the remote server synchronously
Parameters:
function - the function to execute on the remote server
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc.

execute

public void execute(JCO.Function function,
                    java.lang.String tid)
Executes the function on the remote server in transactional mode (asynchronously)
Parameters:
function - the function to execute on the remote server
tid - the transaction id to use for this call
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc. Note: Don't forget to call confirmTID() if this call was successful

execute

public void execute(JCO.Function function,
                    java.lang.String tid,
                    java.lang.String queue_name)
Executes the function on the remote server in queued transactional mode (asynchronously)
Parameters:
function - the function to execute on the remote server
tid - the transaction id to use for this call
queue_name - the queue name were to insert the transaction to. if queue_name is null the call will be executed in normal transaction mode.
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc. Note: Don't forget to call confirmTID() if this call was successful
Since:
JCo 1.1

execute

public void execute(JCO.Function function,
                    java.lang.String tid,
                    java.lang.String queue_name,
                    int queue_pos)
Executes the function on the remote server in transactional mode (asynchronously)
Parameters:
function - the function to execute on the remote server
tid - the transaction id to use for this call
queue_name - the queue name were to insert the transaction to. if queue_name is null the call will be executed in normal transaction mode.
queue_pos - the position in the queue were to insert the transaction
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc. Note: Don't forget to call confirmTID() if this call was successful
Since:
JCo 1.1

execute

public void execute(java.lang.String name,
                    JCO.ParameterList input,
                    JCO.ParameterList output)
Executes the function on the remote server synchronously
Parameters:
name - the name of the remote function to execute
input - the list of parameters to send to the remote function module
output - the list of parameters to receive from the remote function module
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc.

execute

public void execute(java.lang.String name,
                    JCO.ParameterList input,
                    JCO.ParameterList output,
                    JCO.ParameterList tables)
Executes the function on the remote server synchronously
Parameters:
name - the name of the remote function to execute
input - the list of parameters to send to the remote function module
output - the list of parameters to receive from the remote function module
tables - the list of tables to pass on to the remote function module
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc.

execute

public void execute(java.lang.String name,
                    JCO.ParameterList input,
                    JCO.ParameterList tables,
                    java.lang.String tid)
Executes the function on the remote server in transactional mode (asynchronously)
Parameters:
name - the name of the remote function to execute
input - the list of parameters to send to the remote function module
tables - the list of tables to pass on to the remote function module
tid - the transaction id to use for this call
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc. Note: Don't forget to call confirmTID() if this call was successful

execute

public void execute(java.lang.String name,
                    JCO.ParameterList input,
                    JCO.ParameterList tables,
                    java.lang.String tid,
                    java.lang.String queue_name)
Executes the function on the remote server in queued transactional mode (asynchronously)
Parameters:
name - the name of the remote function to execute
input - the list of parameters to send to the remote function module
tables - the list of tables to pass on to the remote function module
tid - the transaction id to use for this call
queue_name - the queue name were to insert the transaction to. if queue_name is null the call will be executed in normal transaction mode.
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc. Note: Don't forget to call confirmTID() if this call was successful
Since:
JCo 1.1

execute

public void execute(java.lang.String name,
                    JCO.ParameterList input,
                    JCO.ParameterList tables,
                    java.lang.String tid,
                    java.lang.String queue_name,
                    int queue_pos)
Executes the function on the remote server in transactional mode (asynchronously)
Parameters:
name - the name of the remote function to execute
input - the list of parameters to send to the remote function module
tables - the list of tables to pass on to the remote function module
tid - the transaction id to use for this call
queue_name - the queue name were to insert the transaction to. if queue_name is null the call will be executed in normal transaction mode.
queue_pos - the position in the queue were to insert the transaction
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc. Note: Don't forget to call confirmTID() if this call was successful
Since:
JCo 1.1

execute

public JCO.Response execute(JCO.Request request)
Executes the request on the remote server synchronously
Parameters:
request - the request to execute on the remote server
Returns:
JCO.Response the response for null if the called function does not export any data
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc.
Since:
JCo 2.0

execute

public void execute(JCO.Request request,
                    java.lang.String tid)
Executes the request on the remote server asynchronously
Parameters:
request - the request to execute on the remote server
tid - the transaction id to use for this call
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc.
Since:
JCo 2.0

execute

public void execute(JCO.Request request,
                    java.lang.String tid,
                    java.lang.String queue_name)
Executes the request on the remote server asynchronously
Parameters:
request - the request to execute on the remote server
tid - the transaction id to use for this call
queue_name - the queue name were to insert the transaction to. if queue_name is null the call will be executed in normal transaction mode.
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc.
Since:
JCo 2.0

execute

public void execute(JCO.Request request,
                    java.lang.String tid,
                    java.lang.String queue_name,
                    int queue_pos)
Executes the request on the remote server asynchronously
Parameters:
request - the request to execute on the remote server
tid - the transaction id to use for this call
queue_name - the queue name were to insert the transaction to. if queue_name is null the call will be executed in normal transaction mode.
queue_pos - the position in the queue were to insert the transaction
Throws:
JCO.AbapException - thrown if something went awry in the called function.
JCO.Exception - thrown if something went wrong during communication, marshalling, etc.
Since:
JCo 2.0

send

public void send(java.lang.Object idoc,
                 java.lang.String tid)
Asynchronously sends an intermediate document (IDoc) to the remote server
Parameters:
idoc - the intermediate document to send. This has to be an implementation of the JCO.IDocument interface.
tid - the transaction id to use for this call
Throws:
JCO.Exception - thrown if something went wrong
Since:
JCo 2.0

send

public void send(java.lang.Object idoc,
                 java.lang.String tid,
                 java.lang.String queue_name)
Asynchronously sends an intermediate document (IDoc) to an inbound queue of a remote server
Parameters:
idoc - the intermediate document to send. The passed object must have the JCO.IDocument interface implemented.
tid - the transaction id to use for this call
queue_name - the queue name were to insert the transaction to. if queue_name is null the call will be executed in normal transaction mode.
Throws:
JCO.Exception - thrown if something went wrong during communication.
Since:
JCo 2.0

send

public void send(java.lang.Object idoc,
                 java.lang.String tid,
                 char idoc_version)
Asynchronously sends an intermediate document (IDoc) to the remote server
Parameters:
idoc - the intermediate document to send. The passed object must have the JCO.IDocument interface implemented.
tid - the transaction id to use for this call
idoc_version - the idoc version
Throws:
JCO.Exception - thrown if something went wrong during communication.
Since:
JCo 2.0

send

public void send(java.lang.Object idoc,
                 java.lang.String tid,
                 java.lang.String queue_name,
                 char idoc_version)
Asynchronously sends an intermediate document (IDoc) to an inbound queue of a remote server
Parameters:
idoc - the intermediate document to send. The passed object must have the JCO.IDocument interface implemented.
tid - the transaction id to use for this call
queue_name - the queue name were to insert the transaction to. if queue_name is null the call will be executed in normal transaction mode.
idoc_version - the idoc version
Throws:
JCO.Exception - thrown if something went wrong during communication.
Since:
JCo 2.0

createTID

public java.lang.String createTID()
Creates a new transaction ID
Returns:
the newly created transaction ID as a string
Throws:
JCO.Exception - thrown if something went wrong during the creation

confirmTID

public void confirmTID(java.lang.String tid)
Confirms that a transaction has been successfull
Parameters:
tid - the ID of the transaction to confirm
Throws:
JCO.Exception - thrown if something went wrong during the confirmation

ping

public final void ping()
Sends a ping to the server
Throws:
JCO.Exception - thrown if the ping could not be executed