com.sap.mw.jco

Class JCO.Repository

java.lang.Object
  extended bycom.sap.mw.jco.JCO.BasicRepository
      extended bycom.sap.mw.jco.JCO.Repository
All Implemented Interfaces:
IRepository
Enclosing class:
JCO

public static class JCO.Repository
extends JCO.BasicRepository
implements IRepository

Implementation of the SAP system repository. The repository queries a remote SAP system(s) for function interfaces and/or structure definitions.

In order to retrieve the necessary information from the SAP system's data dictionary, the repository needs to call a number of RFMs for which the access rights have to be granted (Authorization Object: S_RFC, ACTVT: 16, FUGR).

R/3 ReleaseFunction Groups
since 3.1H RFC1, SG00, SRFC, SUNI, SYST
since 4.0A RFC1, SDIF, SG00, SRFC, SYST, SYSU, SUNI
since 4.6A RFC1, SDIF, SG00, SRFC, SYST, SYSU
since 4.6D RFC1, SDIFRUNTIME, SG00, SRFC, SYST, SYSU

Note: The Repository class is designed to cache the once queried metadata and fetch the missing metadata on the fly. Since the repository calls are very expensive and each repository uses up a significant amount of heap memory, it is essential to reuse the available repository instances. The repository instances synchronize the access from different threads and therefore can be used in concurrent environments. We recommend always to create repositories with a pool of connection especially in concurrent environments. It lets you to avoid bottlenecks and makes the repository instance resistant against a failure on a connection.

Note: SAP recommends to use the logon data of a technical user only with necessary permissions for repository connections.


Field Summary
protected static char[] ABAP_EXIDS
           
protected static String[] ABAP_TYPES
           
protected  JCO.Client client
          Client
protected static JCO.MetaData ddtypelist_v5
           
protected static JCO.MetaData ddtypelist_v6u
           
protected static JCO.MetaData dfies_v4
           
protected static JCO.MetaData dfies_v5
           
protected static JCO.MetaData dfies_v6u
           
protected static JCO.MetaData fields_v2
           
protected static JCO.MetaData fields_v3
           
protected static JCO.MetaData funint_v2
           
protected static JCO.MetaData funint_v3
           
protected static JCO.MetaData funint_v4
           
protected static JCO.MetaData funint_v5
           
protected static JCO.MetaData funint_v6u
           
protected  String[] pool_names
          The manager that provides client connections
protected  int repository_version
          The version of the remote dictionary
protected static JCO.MetaData rsexc_v3
           
protected static JCO.MetaData rsimp_v3
           
protected static JCO.MetaData rstbl_v3
           
protected static JCO.MetaData x030l_v4
           
protected static JCO.MetaData x030l_v5
           
protected static JCO.MetaData x030l_v6u
           
 
Fields inherited from class com.sap.mw.jco.JCO.BasicRepository
function_cache, name, next_repository, structure_cache
 
Constructor Summary
JCO.Repository(String name, JCO.Client client)
          Creates a new SAP system repository
JCO.Repository(String name, String pool_name)
          Creates a new SAP system repository
JCO.Repository(String name, String[] pool_names)
          Creates a new SAP system repository
 
Method Summary
protected  void execute(JCO.Client client, JCO.Function function)
          Executes a function and applies proper synchronization
 IMetaData getFunctionInterface(String function_name)
          Returns the meta data for the specified function
 String[] getPoolNames()
          Returns the array of pool names
 IMetaData getStructureDefinition(String structure_name)
          Returns the meta data for the specified structure.
protected  int getVersion(JCO.Client client)
          Checks and returns the repository version.
 IMetaData queryFunctionInterface(JCO.Client client, String name)
          Queries the function meta data for the passed function name.
protected  IMetaData queryFunctionInterface(String function_name, String pool_name)
          Queries the function interface from a remote SAP system.
protected  void queryFunctionInterfaceEpilog(JCO.Client client, JCO.MetaData meta_data, JCO.Table funint)
          Hook for derived classes which might want to do further processing
 IMetaData queryStructureDefinition(JCO.Client client, String name)
          Queries the meta data for the structure with the specified name.
protected  IMetaData queryStructureDefinition(String structure_name, String pool_name)
          Queries the structure definition from a remote SAP system.
protected  void queryStructureInterfaceEpilog(JCO.Client client, JCO.MetaData meta_data, JCO.Table fields)
          Hook for derived classes which might want to do further processing
 IMetaData queryTableDefinition(JCO.Client client, String name)
          Queries the meta data for the table with the specified the name.
 void setName(String name)
          Sets the repository name
 void setPoolNames(String[] pool_names)
          Sets the array of pool names
 
Methods inherited from class com.sap.mw.jco.JCO.BasicRepository
addFunctionInterfaceToCache, addFunctionInterfaceToCache, addStructureDefinitionToCache, addStructureDefinitionToCache, getCachedFunctionInterfaces, getCachedStructureDefinitions, getFunctionTemplate, getName, getNextRepository, getTableDefinition, load, removeFunctionInterfaceFromCache, removeStructureDefinitionFromCache, save, setNextRepository, writeHTML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sap.mw.jco.IRepository
addFunctionInterfaceToCache, addStructureDefinitionToCache, getCachedFunctionInterfaces, getCachedStructureDefinitions, getFunctionTemplate, getName, getNextRepository, getTableDefinition, load, removeFunctionInterfaceFromCache, removeStructureDefinitionFromCache, save, setNextRepository
 

Field Detail

funint_v2

protected static final JCO.MetaData funint_v2

fields_v2

protected static final JCO.MetaData fields_v2

funint_v3

protected static final JCO.MetaData funint_v3

fields_v3

protected static final JCO.MetaData fields_v3

rsexc_v3

protected static final JCO.MetaData rsexc_v3

rsimp_v3

protected static final JCO.MetaData rsimp_v3

rstbl_v3

protected static final JCO.MetaData rstbl_v3

funint_v4

protected static final JCO.MetaData funint_v4

x030l_v4

protected static final JCO.MetaData x030l_v4

dfies_v4

protected static final JCO.MetaData dfies_v4

funint_v5

protected static final JCO.MetaData funint_v5

dfies_v5

protected static final JCO.MetaData dfies_v5

x030l_v5

protected static final JCO.MetaData x030l_v5

ddtypelist_v5

protected static final JCO.MetaData ddtypelist_v5

funint_v6u

protected static final JCO.MetaData funint_v6u

dfies_v6u

protected static final JCO.MetaData dfies_v6u

x030l_v6u

protected static final JCO.MetaData x030l_v6u

ddtypelist_v6u

protected static final JCO.MetaData ddtypelist_v6u

ABAP_TYPES

protected static final String[] ABAP_TYPES

ABAP_EXIDS

protected static final char[] ABAP_EXIDS

pool_names

protected String[] pool_names
The manager that provides client connections


repository_version

protected int repository_version
The version of the remote dictionary


client

protected JCO.Client client
Client

Constructor Detail

JCO.Repository

public JCO.Repository(String name,
                      String pool_name)
Creates a new SAP system repository

Parameters:
name - the name of the repository
pool_name - the name of the pool

JCO.Repository

public JCO.Repository(String name,
                      String[] pool_names)
Creates a new SAP system repository

Parameters:
name - the name of the repository
pool_names - the array of pool names

JCO.Repository

public JCO.Repository(String name,
                      JCO.Client client)
Creates a new SAP system repository

Parameters:
name - the name of the repository
client - the client to use
Method Detail

setName

public void setName(String name)
Sets the repository name

Parameters:
name - the name of the repository

getPoolNames

public String[] getPoolNames()
Returns the array of pool names

Returns:
a string array of pool names

setPoolNames

public void setPoolNames(String[] pool_names)
Sets the array of pool names

Parameters:
pool_names - the new array of pool names

getVersion

protected final int getVersion(JCO.Client client)
Checks and returns the repository version.

Parameters:
client - the connection to the remote system which supplies the repository information
Returns:
the repository version

execute

protected void execute(JCO.Client client,
                       JCO.Function function)
Executes a function and applies proper synchronization

Parameters:
client - the client to be used for executing the function
function - the function to execute

queryFunctionInterface

protected IMetaData queryFunctionInterface(String function_name,
                                           String pool_name)
Queries the function interface from a remote SAP system.

Parameters:
function_name - the name of the function
pool_name - the name of the connection pool to be used to query the interface from.
Returns:
the meta data for the requested function.
Throws:
JCO.Exception - if an error occurred during the retrieval of the function interface.

queryStructureDefinition

protected IMetaData queryStructureDefinition(String structure_name,
                                             String pool_name)
Queries the structure definition from a remote SAP system.

Parameters:
structure_name - the name of the structure
pool_name - the name of the connection pool to be used to query the structure information from.
Returns:
the meta data for the requested structure or null if not found.
Throws:
JCO.Exception - if an error occurred during the retrieval of the data structure definition.

getFunctionInterface

public IMetaData getFunctionInterface(String function_name)
Returns the meta data for the specified function

Specified by:
getFunctionInterface in interface IRepository
Overrides:
getFunctionInterface in class JCO.BasicRepository
Parameters:
function_name - the name of the function for which the meta data is being returned.
Returns:
the meta data for the function or null if the function could not be found.
Throws:
JCO.Exception - if an error occurred during the retrieval of the function interface.

getStructureDefinition

public IMetaData getStructureDefinition(String structure_name)
Returns the meta data for the specified structure.

Specified by:
getStructureDefinition in interface IRepository
Overrides:
getStructureDefinition in class JCO.BasicRepository
Parameters:
structure_name - the name of the structure for which the meta data is being returned.
Returns:
the meta data for the structure or null if the structure could not be found.
Throws:
JCO.Exception - if an error occurred during the retrieval of the data structure definition.

queryFunctionInterface

public final IMetaData queryFunctionInterface(JCO.Client client,
                                              String name)
Queries the function meta data for the passed function name. This method is mainly used internally and will hardly be called directly by other applications.

Parameters:
client - the client connection to the remote SAP system.
name - the name of the function for which the meta data should be returned.
Returns:
The meta data that describe the parameters of the function.
Throws:
JCO.Exception - if either the function interface could not be found or another error occurred during the query.

queryFunctionInterfaceEpilog

protected void queryFunctionInterfaceEpilog(JCO.Client client,
                                            JCO.MetaData meta_data,
                                            JCO.Table funint)
Hook for derived classes which might want to do further processing

Parameters:
client - the JCO client which can be used to retrieve additional data
meta_data - the meta data assembled so far
funint - the table of raw meta data as returned from RFC_GET_FUNCTION_INTERFACE. Note:the composition of funint depends on the release of the SAP system

queryStructureDefinition

public final IMetaData queryStructureDefinition(JCO.Client client,
                                                String name)
Queries the meta data for the structure with the specified name. This method is mainly used internally and will hardly be called directly by other applications.

Parameters:
client - the client connection to the remote SAP system.
name - the name of the structure for which the meta data should be returned.
Returns:
The meta data that describe the fields of the structure.
Throws:
JCO.Exception - if either the data structure definition could not be found or another error occurred during the query.

queryStructureInterfaceEpilog

protected void queryStructureInterfaceEpilog(JCO.Client client,
                                             JCO.MetaData meta_data,
                                             JCO.Table fields)
Hook for derived classes which might want to do further processing

Parameters:
client - the JCO client which can be used to retrieve additional data
meta_data - the meta data assembled so far
fields - the table of raw meta data as returned from RFC_GET_STRUCTURE_DEFINITION for DDIF_FIELDINFO_GET Note:the composition of the fields table depends on the release of the SAP system

queryTableDefinition

public final IMetaData queryTableDefinition(JCO.Client client,
                                            String name)
Queries the meta data for the table with the specified the name. This method is mainly used internally and will hardly be called directly by other applications.

Parameters:
client - the client connection to the remote SAP system.
name - the table name for which the meta data should be returned.
Returns:
The meta data which describe the columns of the table.
Throws:
JCO.Exception - if either the table definition could not be found or another error occurred during the query.


Copyright 2006 SAP AG Complete Copyright Notice