com.sapportals.portal.prt.service.jco

Interface IJCOClientService

All Superinterfaces:
IService

public interface IJCOClientService
extends IService

IJCOClientService Created: Wed Dec 06 12:00:00 2000


Field Summary
static String HTTP_SESSION_TIMEOUT_LISTENER
           
static String KEY
           
 
Method Summary
 boolean deleteRepository(String destination, IPortalComponentRequest request)
          Deletes a repository from the cache.
 com.sap.mw.jco.JCO.Client getJCOClient(String destinationName, IPortalComponentRequest request)
          Deprecated. Please switch to client pooling.
 com.sap.mw.jco.JCO.Client getJCOClient(String context, String destinationName, IPortalComponentRequest request)
          Deprecated. Please switch to client pooling. If authorization trace is enabled in the service configuration, the client is delivered connected and with authorization trace started (if available in the target system).
 IJCOClientPoolEntry getJCOClientPoolEntry(String destination, IPortalComponentRequest request)
          Delivers a connected JCo Client.
 IJCOClientPoolEntry getJCOClientPoolEntry(String destination, IPortalComponentRequest request, boolean connect)
          Delivers a connected JCo Client.
 IJCOClientPoolEntry getJCOClientPoolEntry(String destination, IPortalComponentRequest request, boolean connect, long timeout)
          Delivers a connected JCo Client.
 IJCOClientPoolEntry getJCOClientPoolEntry(String destination, IPortalComponentRequest request, boolean connect, long timeout, long lifetime)
          Delivers a pool entry which enclosed a JCo client.
 IJCOClientPoolEntry getJCOClientPoolEntry(String destination, IPortalComponentRequest request, long timeout)
          Delivers a connected JCo Client.
 String getMonitorInformation()
          Obtain pool monitor information.
 com.sap.mw.jco.JCO.Repository getRepository(String destination, IPortalComponentRequest request)
          This method provides JCo repositories.
 boolean startAuthorizationTrace(String destination, String serviceName, com.sap.mw.jco.JCO.Client client)
          Starts authorization trace in the R/3 system if it is enabled in the service configuration.
 
Methods inherited from interface com.sapportals.portal.prt.service.IService
afterInit, configure, destroy, getContext, getKey, init, release
 

Field Detail

KEY

static final String KEY
See Also:
Constant Field Values

HTTP_SESSION_TIMEOUT_LISTENER

static final String HTTP_SESSION_TIMEOUT_LISTENER
See Also:
Constant Field Values
Method Detail

getJCOClient

com.sap.mw.jco.JCO.Client getJCOClient(String context,
                                       String destinationName,
                                       IPortalComponentRequest request)
                                       throws JCOClientServiceException
Deprecated. Please switch to client pooling. If authorization trace is enabled in the service configuration, the client is delivered connected and with authorization trace started (if available in the target system).

Throws:
JCOClientServiceException

getJCOClient

com.sap.mw.jco.JCO.Client getJCOClient(String destinationName,
                                       IPortalComponentRequest request)
Deprecated. Please switch to client pooling.

Request a JCO.Client instance based on the destination name given in parameters. This method does not support client pooling. If authorization trace is enabled in the service configuration, the client is delivered connected and with authorization trace started (if available in the target system).

Parameters:
destinationName - the name of the System to connect
request - the request

getJCOClientPoolEntry

IJCOClientPoolEntry getJCOClientPoolEntry(String destination,
                                          IPortalComponentRequest request)
Delivers a connected JCo Client. This method behaves like:
   getJCOClientPoolEntry(destination, request, true, timeout, 0) where timeout is the default timeout specified in service.xml


getJCOClientPoolEntry

IJCOClientPoolEntry getJCOClientPoolEntry(String destination,
                                          IPortalComponentRequest request,
                                          long timeout)
Delivers a connected JCo Client. This method behaves like:
    getJCOClientPoolEntry(destination, request, true, timeout, 0);


getJCOClientPoolEntry

IJCOClientPoolEntry getJCOClientPoolEntry(String destination,
                                          IPortalComponentRequest request,
                                          boolean connect)
Delivers a connected JCo Client. This method behaves like:
    getJCOClientPoolEntry(destination, request, connect, timeout, 0) where timeout is the default timeout specified in service.xml


getJCOClientPoolEntry

IJCOClientPoolEntry getJCOClientPoolEntry(String destination,
                                          IPortalComponentRequest request,
                                          boolean connect,
                                          long timeout)
Delivers a connected JCo Client. This method behaves like:
    getJCOClientPoolEntry(destination, request, connect, timeout, 0)


getJCOClientPoolEntry

IJCOClientPoolEntry getJCOClientPoolEntry(String destination,
                                          IPortalComponentRequest request,
                                          boolean connect,
                                          long timeout,
                                          long lifetime)
Delivers a pool entry which enclosed a JCo client.

For every user, JCo destination and session (the combination of these three) a pool is created. Each pool is initial empty. When releasing a JCOClientPoolEntry, the enclosed JCo client is put into a pool. Therefore it is mandatory to call release on a JCOClientPoolEntry if it is not used anymore. If the parameter connect is true, only connected clients are returned. If this parameter is false, newly created clients are returned in not connected state and clients coming from the pool are not checked if they are connected.

The pool provides the following features:

1) Disconnect clients when a HTTP session timeout occurred.

2) Timeout for clients contained in a pool.

3) Limitation of connections for a specific user/ destination combination.

Following an explanation of the features:

1) If a HTTP session timeout occurs, all clients obtained within this session will be disconnected. This applies to clients in the pool as well as to clients currently "delivered" from the pool. If a delivered client was disconnected, this information can be obtained from the pool entry. (see IJCOClientPoolEntry). The HTTP session timeout is specified in the file web.xml. This file is located in the folder WEB-INF of the servlet engine.

If a client is needed, with an extra long lifetime it can be obtained by using the parameter lifetime. This should be used with care and only for clients that need to execute a process that last longer than the HTTP session timeout. When using the parameter lifetime, it is guarantied that the client will not be disconnected before the lifetime is over, even if there is an HTTP timeout before. The disadvantage is that such a client can be disconnected (after a HTTP session timeout occurred), even directly after an interaction from a HTTP session. Therefore use this with care. The information that a client is in its extra lifetime can be obtained from the pool entry. (see IJCOClientPoolEntry).

2) If a client remains longer than a specific timeout in the pool, it will be disconnected. There is a default timeout defined in service.xml, e.g.:

        AvailableClientTimeoutDefault = "180000"
This can be overwritten for each destination, e.g.:
        AvailableClientTimeout = "QW2=5000;AX8=10000"
Values specified there are in milliseconds.

3) The number of clients to a specific destination can be limited per user. This means the pools tracks the number of requested clients and if the specified limit is exceeded, it will not deliver clients until other pool entries are released, deleted or finalized.

Per default, a destination is NOT limited. A limit can be defined in service.xml:

        PoolSizeDefault = "8"
        PoolSize = "QW2=6"
        LimitPerUserForDestination = "QW2;AX8"

This limits the number of connections per user to QW2 to 6 and to AX8 to 8. The limit equals always the pool size defined for a destination. If the pool cannot provide a pool entry to a limited destination in a certain time, a TimeoutException occurs. The time to wait for a client is specified in service.xml:

        WaitForConnectionTimeout = "3000"
Values specified there are in milliseconds. Other values can be used when requesting the pool entry using the timeout parameter.

Pool configuration:

The pool size for each destination can be specified in service.xml:

        PoolSizeDefault = "8"
        PoolSize = "QW2=6"
Other entries in service.xml for internal pool configuration:
        PoolTableInitialSize = "100"
This should roughly be the number of sessions from that the jco client pool is accessed.
        NumberOfTimers = "3"
The number of timers used by the pool. Should be roughly PoolTableInitialSize/30

If authorization trace is enabled in the service configuration, the client enclosed in the pool entry is delivered connected and with authorization trace started (if available in the target system).

Parameters:
destination - the R/3 destination
request - the component request
connect - delivered clients are connected
timeout - specifies the maximum time to wait for a connection. This has only effect when working with a limited destination; otherwise there is always a connection returned immediately; the value is given in milliseconds
lifetime - the delivered client pool entry will live the specified time also if a HTTP session timeout has occurred; do only use this when absolutely necessary, i.e. for long running task; long running means here, a task that performs ONE continuous JCo execute with a duration longer than the HTTP session timeout; the value is given in milliseconds
Returns:
the newly created pool entry
Throws:
TimeoutException - if the pool entry could not be provided within the timeout
See Also:
IJCOClientPoolEntry

getRepository

com.sap.mw.jco.JCO.Repository getRepository(String destination,
                                            IPortalComponentRequest request)

This method provides JCo repositories. Such a repository uses a cache which is shared between multiple repositories. Thus, the content of repositories is shared between Portal users. If information is requested from the repository, it is checked if the shared cache contains this information. If yes, the information is returned. If not, the backend is queried for the requested information. To query the backend, a JCo connection is used which is created when the call to getRepository() is made. This connection is created with the users credentials. The retrieved information is then put in the shared cache before returning it to the user.

In case the shared repository cache should be cleared, the service com.sap.portal.runtime.application.jcoclient.clearRepositoryCacheService can be used.

The usage of this method saves resources because repositories can be reused in different parts of components or services, even across business packages.

The obtained JCo connection is closed, when the user logs off from the Portal or the HTTP session timeout is reached.

This method is thread safe.

Returns:
The repository

deleteRepository

boolean deleteRepository(String destination,
                         IPortalComponentRequest request)
Deletes a repository from the cache.

Use this method only in cases the repository obtained from getRepository() is corrupt, i.e. it throws exceptions when used. This method will close the connection of the repository and delete it. The shared repository cache will remain.

This method is thread safe.

Returns:
True if there was a repository found and deleted for the given parameters, false if there was no repository found

startAuthorizationTrace

boolean startAuthorizationTrace(String destination,
                                String serviceName,
                                com.sap.mw.jco.JCO.Client client)
Starts authorization trace in the R/3 system if it is enabled in the service configuration. To start the authorization trace it is checked whether authorization trace is active in a the R/3 destination. If so, then a specific function module is called that traces all function modules called with the specified JCo client. Authorization trace is switched off in the method release of JCOClientPoolEntry.

Returns:
true if authorizaton trace could be enabled for the JCO client, otherwise false

getMonitorInformation

String getMonitorInformation()
Obtain pool monitor information. For internal use only.

Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] EP-APPS-EXT [sap.com] tc/ep/apps/ext/api api EP-PIN


Copyright 2015 SAP AG Complete Copyright Notice