public abstract class JCo extends Object
Constructor and Description |
---|
JCo() |
Modifier and Type | Method and Description |
---|---|
static void |
addTraceListener(JCoTraceListener listener)
Adds a trace listener, that receives all trace events of JCo.
|
static JCoAbapObject |
createAbapObject(JCoClassMetaData classMetaData,
Map<String,Object> initialValues)
This is a constructor for an instance of an ABAP class.
|
static JCoBackgroundUnitAttributes |
createBackgroundUnitAttributes()
Creates an empty instance of function/request unit attributes.
|
static JCoClassMetaData |
createClassMetaData(JCoClassMetaData metaData)
Returns a newly created instance of JCoClassMetaData, which is initially
a copy of the passed JCoClassMetaData.
|
static JCoClassMetaData |
createClassMetaData(String name)
Returns a newly created and empty instance of JCoClassMetaData
with the passed initial capacity for new field information.
|
static JCoClassMetaData |
createClassMetaData(String name,
String[] parentClasses,
String[] implementedInterfaces,
int capacity)
Returns a newly created and empty instance of JCoClassMetaData
with the passed initial capacity for new field information.
|
static JCoCustomRepository |
createCustomRepository(String name)
Returns a custom repository, which allows to add custom defined
function templates and record metadata definitions.
|
static JCoFunctionTemplate |
createFunctionTemplate(String name,
JCoListMetaData imports,
JCoListMetaData exports,
JCoListMetaData changing,
JCoListMetaData tables,
AbapException[] exceptions)
This factory method allows to create a JCoFunctionTemplate that can be used
in later function module executions.
|
static JCoFunctionTemplate |
createFunctionTemplate(String name,
JCoListMetaData imports,
JCoListMetaData exports,
JCoListMetaData changing,
JCoListMetaData tables,
AbapException[] exceptions,
boolean supportsASXML)
This factory method allows to create a JCoFunctionTemplate that can be used
in later function module executions.
|
static JCoFunctionUnit |
createFunctionUnit(JCoBackgroundUnitAttributes unitAttributes)
Creates a new (empty) unit of functions, which is used for bgRFC communication in the
function model.
|
static JCoFunctionUnit |
createFunctionUnit(String unitID,
JCoBackgroundUnitAttributes unitAttributes)
Creates a new (empty) unit of functions, which is used for bgRFC communication in the
function model.
|
static JCoListMetaData |
createListMetaData(JCoListMetaData metaData)
Returns a newly created instance of JCoListMetaData, which is initially
a copy of the passed JCoListMetaData.
|
static JCoListMetaData |
createListMetaData(String name)
Returns a newly created and empty instance of JCoListMetaData.
|
static JCoListMetaData |
createListMetaData(String name,
int capacity)
Returns a newly created and empty instance of JCoListMetaData
with the passed initial capacity for new field information.
|
static JCoRecordMetaData |
createRecordMetaData(JCoRecordMetaData metaData)
Returns a newly created instance of JCoRecordMetaData, which is initially
a copy of the passed JCoRecordMetaData.
|
static JCoRecordMetaData |
createRecordMetaData(String name)
Returns a newly created and empty instance of JCoRecordMetaData.
|
static JCoRecordMetaData |
createRecordMetaData(String name,
int capacity)
Returns a newly created and empty instance of JCoRecordMetaData
with the passed initial capacity for new field information.
|
static JCoRequestUnit |
createRequestUnit(JCoBackgroundUnitAttributes unitAttributes)
Creates a new (empty) unit of requests, which is used for bgRFC communication in the
request/response model.
|
static JCoRequestUnit |
createRequestUnit(String unitID,
JCoBackgroundUnitAttributes unitAttributes)
Creates a new (empty) unit of requests, which is used for bgRFC communication in the
request/response model.
|
static JCoStructure |
createStructure(JCoRecordMetaData metaData)
Returns a newly created instance of JCoStructure with the passed metadata
information.
|
static JCoStructure |
createStructure(JCoTable table,
int row)
Returns a newly created instance of JCoStructure with the metadata
used for the given table instance.
|
static JCoTable |
createTable(JCoRecordMetaData metaData)
Returns a newly created instance of JCoTable with the passed metadata
information.
|
static JCoThroughput |
createThroughput()
Returns a newly created instance of JCoThroughput.
|
static JCoUnitIdentifier |
createUnitIdentifier(String unitID,
JCoUnitIdentifier.Type unitType)
Creates a new unit identifier.
|
static JCoConnectionMonitor |
getConnectionMonitor()
Returns the connection monitor for all currently available connections.
|
static List<String> |
getCustomDestinationIDs(String destinationID)
Creates and returns a list with IDs of all custom destinations created by the destination with
the given destinationID.
|
static List<String> |
getDestinationIDs()
Creates and returns a list containing IDs of all available cached destinations.
|
static JCoDestinationMonitor |
getDestinationMonitor(String destinationID)
Retrieves a monitoring object for a specific destination identified by the given ID.
|
static String |
getMiddlewareProperty(String key)
Returns the current value for the given middleware property or null,
if there is no value set.
|
static String |
getProperty(String key)
Returns the current value for the given JCo property or null,
if there is no value set.
|
static JCoRepository |
getRepository(String repositoryID)
Returns the repository instance corresponding to the given repository ID or null if
the repository isn't available.
|
static String |
getRepositoryDestinationID(String destinationID)
Returns the destination ID used by repository instances internally.
|
static JCoDestinationMonitor |
getRepositoryDestinationMonitor(String destinationID)
Retrieves a monitoring object for a specific repository destination of the destination
identified by the given ID.
|
static List<String> |
getRepositoryIDs()
Returns a list containing IDs of all repository instances that are kept internally.
|
static int |
getTraceLevel()
Returns the current trace level.
|
static String |
getTracePath()
Returns the current trace path.
|
static String |
getVersion()
Returns the version of the JCo implementation.
|
static JCoRepositoryQueryResult |
queryMetaDataSet(JCoRepository repository,
List<String> functions,
List<String> types,
List<String> classes)
Queries the metadata for function, type and class lists.
|
static void |
removeTraceListener(JCoTraceListener listener)
Removes the given trace listener from the list of JCoTraceListeners.
|
static void |
setMiddlewareProperty(String key,
String value)
Sets a value for the given middleware property.
|
static void |
setProperty(String key,
String value)
Sets a value for the given JCo property.
|
static void |
setTrace(int level,
String path)
Turns on the JCo trace.
|
public static String getVersion()
public static JCoCustomRepository createCustomRepository(String name)
name
- The name of the repository to create.public static JCoRecordMetaData createRecordMetaData(String name)
name
- The name of the record metadata.public static JCoRecordMetaData createRecordMetaData(String name, int capacity)
name
- The name of the record metadata.capacity
- The initial capacity for this metadata object.public static JCoRecordMetaData createRecordMetaData(JCoRecordMetaData metaData)
metaData
- the JCoRecordMetaData object to copy fromJCoMetaData.setName(String)
public static JCoListMetaData createListMetaData(String name)
name
- The name of the list metadata.public static JCoListMetaData createListMetaData(String name, int capacity)
name
- The name of the list metadata.capacity
- The initial capacity for this metadata object.public static JCoListMetaData createListMetaData(JCoListMetaData metaData)
metaData
- the JCoListMetaData object to copy frompublic static JCoClassMetaData createClassMetaData(String name, String[] parentClasses, String[] implementedInterfaces, int capacity)
name
- class type nameparentClasses
- parent classes of the class type being createdimplementedInterfaces
- interfaces implemented by the class type being createdcapacity
- the number of preallocated field expected for that class metadata objectpublic static JCoClassMetaData createClassMetaData(String name)
name
- class type namepublic static JCoClassMetaData createClassMetaData(JCoClassMetaData metaData)
metaData
- the JCoClassMetaData object to copy frompublic static JCoFunctionTemplate createFunctionTemplate(String name, JCoListMetaData imports, JCoListMetaData exports, JCoListMetaData changing, JCoListMetaData tables, AbapException[] exceptions)
name
- the name of the function module which is represented by the function template definitionimports
- the metadata for all import parameters of the represented function moduleexports
- the metadata for all export parameters of the represented function modulechanging
- the metadata for all changing parameters of the represented function moduletables
- the metadata for all table parameters of the represented function moduleexceptions
- array of AbapExceptions, that belong to the represented function moduleIllegalArgumentException
- in case a metadata object passed as parameter is not locked.public static JCoFunctionTemplate createFunctionTemplate(String name, JCoListMetaData imports, JCoListMetaData exports, JCoListMetaData changing, JCoListMetaData tables, AbapException[] exceptions, boolean supportsASXML)
name
- the name of the function module which is represented by the function template definitionimports
- the metadata for all import parameters of the represented function moduleexports
- the metadata for all export parameters of the represented function modulechanging
- the metadata for all changing parameters of the represented function moduletables
- the metadata for all table parameters of the represented function moduleexceptions
- array of AbapExceptions, that belong to the represented function modulesupportsASXML
- flag indicating whether this function module supports the ASXML semantics for serialization in the RFC protocolIllegalArgumentException
- in case a metadata object passed as parameter is not locked.public static JCoStructure createStructure(JCoRecordMetaData metaData)
metaData
- the metadata instance.IllegalArgumentException
- if metaData is null or is not lockedpublic static JCoStructure createStructure(JCoTable table, int row)
table
- the table is being used as template for the structure.row
- the table line index used to copy the values.IllegalArgumentException
- row is out of bounds or table is nullpublic static JCoTable createTable(JCoRecordMetaData metaData)
metaData
- the metadata instance.IllegalArgumentException
- if metaData is null or is not lockedpublic static JCoAbapObject createAbapObject(JCoClassMetaData classMetaData, Map<String,Object> initialValues)
setValue()
methods.classMetaData
- The metadata describing the ABAP object.initialValues
- A map whose entries will be used as initial values for the instance. Unknown fields will be
ignored.ConversionException
- if one of the values could not be converted into the corresponding attribute typepublic static JCoFunctionUnit createFunctionUnit(String unitID, JCoBackgroundUnitAttributes unitAttributes)
unitID
- ID to be assigned to the function unitunitAttributes
- attributes to be assigned to the function unitpublic static JCoFunctionUnit createFunctionUnit(JCoBackgroundUnitAttributes unitAttributes)
unitAttributes
- attributes to be assigned to the function unitpublic static JCoRequestUnit createRequestUnit(String unitID, JCoBackgroundUnitAttributes unitAttributes)
unitID
- ID to be assigned to the request unitunitAttributes
- attributes to be assigned to the function unitpublic static JCoRequestUnit createRequestUnit(JCoBackgroundUnitAttributes unitAttributes)
unitAttributes
- attributes to be assigned to the function unitpublic static JCoBackgroundUnitAttributes createBackgroundUnitAttributes()
public static JCoUnitIdentifier createUnitIdentifier(String unitID, JCoUnitIdentifier.Type unitType)
unitID
- 16-byte ID string in hexadecimal format to be set for the unit identifierunitType
- type to be set for the unit identifierpublic static List<String> getRepositoryIDs()
public static JCoRepository getRepository(String repositoryID) throws JCoRuntimeException
repositoryID
- ID of the requested repositoryJCoRuntimeException
- if an internal exception occurs, e.g. repositoryID is nullpublic static List<String> getDestinationIDs()
public static List<String> getCustomDestinationIDs(String destinationID) throws JCoRuntimeException
destinationID
- ID of the destination used for the creation of the custom destinationsJCoRuntimeException
public static String getRepositoryDestinationID(String destinationID) throws JCoRuntimeException
destinationID
- of the destinationJCoRuntimeException
- is thrown if destination id null or the destination id does not existspublic static JCoDestinationMonitor getDestinationMonitor(String destinationID) throws JCoRuntimeException
destinationID
- the unique destination ID for which the monitor should be returnedJCoRuntimeException
- in case of issues while getting and creating the destination monitorpublic static JCoDestinationMonitor getRepositoryDestinationMonitor(String destinationID) throws JCoRuntimeException
destinationID
- the unique destination ID for which the monitor for the repository destination should be returnedJCoRuntimeException
- in case of issues while getting and creating the destination monitorpublic static JCoConnectionMonitor getConnectionMonitor()
JCoRuntimeException
- if an unexpected situation occurs while creating the monitorUnsupportedOperationException
- if the monitor is not supported in the current environmentpublic static JCoThroughput createThroughput()
public static String getMiddlewareProperty(String key)
key
- the name of the property for which you want to get the valuepublic static String getProperty(String key)
key
- the name of the property for which you want to get the valuepublic static void setMiddlewareProperty(String key, String value)
The following properties are supported:
Property name | Description |
---|---|
jco.middleware.max_startup_delay | The maximum time in seconds between restart tries for a JCoServer. Serves as default value, if there is no server specific one. Values below 60 seconds are not allowed. (Default: 3600) |
jco.middleware.wait_for_request_time | Sets the trace level for JCo. Alternative to JCo.setTrace() . Find details there. |
jco.middleware.snc_lib | The location of the SNC library. Serves as default value, if there is no server or destination specific configuration. (Default: "") |
jrfc.client_connect_timeout | The timeout for a logon try after having established the technical client connection to an ABAP server. Provide it in seconds (Default: 60s) |
key
- the name of the property for which you want to set the valuevalue
- the new value, that the property should getJCoRuntimeException
- if the value is not fitting to the propertypublic static void setProperty(String key, String value)
The following properties are supported:
Property name | Description |
---|---|
jco.trace_path | Sets the location of the path for JCo trace files. Alternative to JCo.setTrace() . Find details there. |
jco.trace_level | Sets the trace level for JCo. Alternative to JCo.setTrace() . Find details there. |
jco.trace.format | Allows defining the trace format. Allowed values are jco and log4j. (Default: jco) |
jco.jarm | If set to 1, turns on jarm performance monitoring. In that case the jarm libraries need to be in the classpath. (Default: 0) |
jco.jdsr | If set to 1, turns on DSR. In that case the jdsr libraries need to be in the classpath. (Default: 0) |
jco.jdsr.comp_name | The component name to use when creating DSR records. (Default: SAP Java Connector) |
jco.session_timeout | The idle timeout for JCo session contexts in minutes. (Default: 10) |
jco.session_timeout.check_interval | The time interval for checking whether JCo session contexts have been expired in minutes. (Default: 5) |
jco.cpic_maxconv | The maximum number of connections allowed by the CPIC layer. (Default: runtime environment dependent, min. 202) |
jco.cpic_keep_alive_period | The time a server connection has been idle, after which a keep alive ping event is sent, in seconds (Default: 300) |
jco.cpic_keep_alive_timeout | Timeout for a ping in ms. After that time a connection is considered as broken. (Default: 10) |
jco.ni.dnscache.ttl | >Caching time (time to live) in seconds of host names for successful DNS lookups (Default: value of Java security property networkaddress.cache.ttl , valid range is 0 [off] to 86400 [one day]) |
jco.ni.dnscache.negative.ttl | Caching time (time to live) in seconds of host names for failed DNS lookups (Default: value of Java security property networkaddress.cache.negative.ttl , valid range is 0 [off] to 86400 [one day]) |
cpic.trace | The trace level for the CPIC layer. The valid value range is from 0 (trace is off) to 3 (most verbose trace) (Default: 0) |
jrfc.trace | If set to 1, RFC trace is turned on for all connections within JCo. (Default: 0) |
jco.delta_management | If set to 0, delta management in RFC protocol is turned off in general. (Default: 1) |
jco.use_repository_roundtrip_optimization | If set to 1, the JCo repository tries to use the function module for roundtrip optimization for metadata lookups. (Default: 0) See SAP note 1456826 regarding back-end prerequisites. |
Note: The property jco.session_timeout
specifies the timeout period since the last access to a
session context after which the registered SessionReferenceProvider
instance will be regularly called
for checking, if the associated JCo session is still alive or not. Only if the method
SessionReferenceProvider.isSessionAlive(sessionID)
returns false
for the specified sessionID,
the associated JCo session context will be released, which means that also all still running RFC requests belonging
to this context will be immediately canceled.
Most of the above properties can also be passed as a Java system property with the -D argument when starting the JVM.
These are: jco.trace_path
, jco.trace_level
, jco.trace.format
, jco.jarm
, jco.jdsr
,
jco.session_timeout
, jco.session_timeout.check_interval
, jco.cpic_maxconv
,
jco.cpic_keep_alive_period
, jco.cpic_keep_alive_timeout
,
jco.ni.dnscache.ttl
, jco.ni.dnscache.negative.ttl
, cpic.trace
,
jrfc.trace
, jco.delta_management
and jco.use_repository_roundtrip_optimization
.
Some other properties can only exclusively be passed as a Java system property with the -D argument when starting the JVM.
That means they cannot be modified during runtime after the JCo framework initialization anymore. This applies to the
following properties listed below:
Property name | Description |
---|---|
jco.allow_non_abap_partner | If set to 1 the RFC extern-to-extern communication is allowed. (Default: 0) For further details see SAP note 1877907 regarding the SAP JCo standalone environment and SAP note 1729203 regarding the SAP NetWeaver AS Java environment. |
jco.program_name | The RFC caller program name. (Default: SAPJCo<VersionNumber> [e.g. SAPJCo30 ]) |
Caution: For security reasons SAP discourages to run extern-to-extern RFC communication scenarios. External or registered RFC server programs are not able to check and authenticate incoming RFC requests from external non-ABAP programs with regard to the pure RFC protocol data. Each of such external RFC requests must be regarded as insecure. It is highly recommended to secure such RFC communications with SNC (Secure Network Communication).
key
- the name of the property for which a value should be setvalue
- the new value for the propertyJCoRuntimeException
- if the value is not fitting to the propertypublic static void addTraceListener(JCoTraceListener listener)
listener
- An instance of JCoTraceListener, that shall be added to the listener listpublic static void removeTraceListener(JCoTraceListener listener)
listener
- An instance of JCoTraceListener, that shall be removed from the listener listpublic static void setTrace(int level, String path)
null
, stdout
, stderr
or
an existing path are allowed.
If path is equals null
or stdout
or stderr
JCo will trace out to the standard output (error) stream. If at least one
JCoTraceListener
is registered, the trace output will be sent
to the listener only. To redirect the JCo trace into a file, the path value
has to be set to an existing directory.level
- [0 .. 10]path
- null
, stdout
, stderr
or an existing pathpublic static int getTraceLevel()
setTrace(int, String)
public static String getTracePath()
setTrace(int, String)
public static JCoRepositoryQueryResult queryMetaDataSet(JCoRepository repository, List<String> functions, List<String> types, List<String> classes) throws JCoException
repository
- repository, that will be used for the query. Only repositories connected to the ABAP system are allowedfunctions
- list of functions to be queried or nulltypes
- list of types to be queried or nullclasses
- list of classes to be queried or nullJCoException
- if a communication error will happen an JCoException with the key JCO_ERROR_COMMUNICATION will be thrown.
If the specified repository instance is not connected to an ABAP system a JCoException with key JCO_ERROR_ILLEGAL_ARGUMENT will be thrown.Copyright © 2017 SAP. All Rights Reserved.