Package com.sap.conn.jco
Interface JCoRepository
- All Known Subinterfaces:
JCoCustomRepository
public interface JCoRepository
JCo metadata repositories are needed to get the technical description
of functions and parameters used for fulfilling RFC calls.
This interface covers the implementation of basic repository functionality such as
caching and the persistence of metadata.
The JCoCustomRepository serves as a base interface for more elaborate repositories. To fetch the metadata at runtime from a back-end system use the JCoRepository instance returned by a JCoDestination.
Keep in mind, that the functions and parameter definitions are always the same inside of one cluster of SAP application server hosts, but can differ from other clusters.
The JCoCustomRepository serves as a base interface for more elaborate repositories. To fetch the metadata at runtime from a back-end system use the JCoRepository instance returned by a JCoDestination.
Keep in mind, that the functions and parameter definitions are always the same inside of one cluster of SAP application server hosts, but can differ from other clusters.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear allows to empty both the function template cache as well as the record metadata cache completely.String[]
Returns the names of the cached classes as a string array.String[]
Returns the names of the cached functions as a string array.String[]
Returns the names of the cached structures as a string array.getClassMetaData
(String className) Returns the metadata for the passed class/interface name.getFunction
(String functionName) Returns a JCoFunction with initial parameters for the passed function name.getFunctionInterface
(String functionName) Returns the metadata for the passed function.getFunctionTemplate
(String functionName) Returns the template for the passed function.Returns a newly created or available monitor instance for the repository.getName()
Returns the repository name.getRecordMetaData
(String recordName) Returns the metadata for the passed structure/table name.getRequest
(String functionName) Returns a JCoRequest with initial parameters for the passed function name.getStructureDefinition
(String structureName) Returns the metadata for the passed structure/table name.boolean
Returns whether the repository contains both Unicode and non-Unicode metadata.void
Loads the repository from the given reader.void
removeClassMetaDataFromCache
(String className) Removes a class metadata instance from the local cache.void
removeFunctionTemplateFromCache
(String functionName) Removes a function template from the local cache.
Note: Only the specified function template is removed from the local cache, but not any record metadata which the function template potentially refers to.int
Removes outdated metadata from the local cache.void
removeRecordMetaDataFromCache
(String recordName) Removes a record metadata object from the local cache.
Note: Only the specified record metadata object is removed from the local cache, but not any other record metadata which this record metadata object potentially refers to or is referred by.void
Saves this repository using the given writer.
-
Method Details
-
getName
String getName()Returns the repository name.- Returns:
- the name of the repository
-
getFunctionTemplate
Returns the template for the passed function.- Parameters:
functionName
- the name of the function for which the template shall be returned- Returns:
- the template for the function or null if the function template could not be found
- Throws:
JCoException
- if another error occurred during the retrieval of the function interface with the group field set appropriately
-
getFunction
Returns a JCoFunction with initial parameters for the passed function name.- Parameters:
functionName
- the name of the function for which the JCoFunction shall be returned- Returns:
- the JCoFunction for the function name or null if the underlying function template could not be found
- Throws:
JCoException
- if another error occurred during the retrieval of the function interface with the group field set appropriately
-
getRequest
Returns a JCoRequest with initial parameters for the passed function name.- Parameters:
functionName
- the name of the function for which the request shall be returned- Returns:
- the request for the function name or null if the underlying function template could not be found
- Throws:
JCoException
- if another error occurred during the retrieval of the function interface with the group field set appropriately
-
getFunctionInterface
Returns the metadata for the passed function.- Parameters:
functionName
- the name of the function for which the metadata shall be returned- Returns:
- the metadata for the function or null if the function could not be found
- Throws:
JCoException
- if an error occurred during the retrieval of the function interface
-
getRecordMetaData
Returns the metadata for the passed structure/table name.- Parameters:
recordName
- the name of the structure or table for which the metadata shall be returned- Returns:
- the metadata for the given name or null if the structure could not be found
- Throws:
JCoException
- if an error occurred during the retrieval of the data structure definition
-
getStructureDefinition
Returns the metadata for the passed structure/table name.- Parameters:
structureName
- the name of the structure or table for which the metadata shall be being returned- Returns:
- the metadata for the given name or null if the structure could not be found
- Throws:
JCoException
- if an error occurred during the retrieval of the data structure definition
-
getClassMetaData
Returns the metadata for the passed class/interface name.- Parameters:
className
- the name of the class or interface for which the metadata shall be being returned- Returns:
- the metadata for the given name or null if the class could not be found
- Throws:
JCoException
- if an error occurred during the retrieval of the class metadata definition
-
removeFunctionTemplateFromCache
Removes a function template from the local cache.
Note: Only the specified function template is removed from the local cache, but not any record metadata which the function template potentially refers to.- Parameters:
functionName
- the name of the function to be removed from the cache
-
removeRecordMetaDataFromCache
Removes a record metadata object from the local cache.
Note: Only the specified record metadata object is removed from the local cache, but not any other record metadata which this record metadata object potentially refers to or is referred by.- Parameters:
recordName
- the name of the structure or table metadata to be removed from the cache
-
removeClassMetaDataFromCache
Removes a class metadata instance from the local cache.- Parameters:
className
- the name of the class to be removed from the cache
-
removeOutdatedMetaDataFromCache
Removes outdated metadata from the local cache. The SAP associated back-end is checked, if function template and/or record metadata have been changed compared to the cached objects, and if so, the identified objects will be removed from the cache, so that the next invocation to get the respective metadata from the repository will perform a new metadata retrieval from the SAP back-end.
Limitation: Class metadata will not be checked or removed by invoking this method.
Note: The prerequisite for this method to work is, that the remote function moduleRFC_METADATA_GET_TIMESTAMP
is available in the associated SAP back-end system and the user IDs of the used repository destinations for querying metadata have the RFC execute permission for this function module.- Returns:
- the number of cached metadata objects which were removed from the local
cache. Return value
0
indicates that no outdated metadata was detected. - Throws:
JCoException
- if an error occurred during the retrieval of information about changed metadata objects- Since:
- JCo 3.1.7
-
getCachedFunctionTemplateNames
String[] getCachedFunctionTemplateNames()Returns the names of the cached functions as a string array.- Returns:
- a string array of the cached functions (length 0 if the cache is empty)
-
getCachedRecordMetaDataNames
String[] getCachedRecordMetaDataNames()Returns the names of the cached structures as a string array.- Returns:
- a string array of the cached structures (length 0 if the cache is empty)
-
getCachedClassMetaDataNames
String[] getCachedClassMetaDataNames()Returns the names of the cached classes as a string array.- Returns:
- a string array of the cached classes (length 0 if the cache is empty)
-
isUnicode
boolean isUnicode()Returns whether the repository contains both Unicode and non-Unicode metadata.
Repositories containing metadata for SAP systems running on non-Unicode codepages cannot contain metadata for unicode structures.- Returns:
- true, if the repository contains the metadata for Unicode representation of the contained metadata, false otherwise
-
clear
void clear()Clear allows to empty both the function template cache as well as the record metadata cache completely.
All metadata will be looked up again in the original source, which is generally much more expensive than looking it up in the cache. Therefore use this method carefully and avoid it in application code. -
getMonitor
JCoRepositoryMonitor getMonitor()Returns a newly created or available monitor instance for the repository.- Returns:
- JCoRepositoryMonitor instance
-
load
Loads the repository from the given reader.
Note that the existing cache is cleared completely before reading. That is, after successful completion of the load operation this repository's cache contains only the metadata read. In case of an error the cache will be empty.
This method does not close the given reader. Obsolete trailing characters are ignored and remain available for further reading.- Parameters:
reader
- the reader to be used for loading this repository- Throws:
IOException
- if an I/O error occursJCoRuntimeException
- with key JCO_ERROR_REPOSITORY_SERIALIZATION if the data read is syntactically or semantically incorrect- Since:
- 3.0.10
-
save
Saves this repository using the given writer.
This method does not close the given writer.- Parameters:
writer
- the writer used to save this repository- Throws:
IOException
- if an I/O error occurs- Since:
- 3.0.10
-