public class ErpConfigContext extends Object implements ConfigContext, WithDestinationName
An ErpConfigContext
allows to define or obtain the SapClient
and Locale
that is used. In
addition, it defines the names of the destinations that are relevant to connect to the ERP via different protocols
which can require separate destinations.
The following table shows which protocols are supported based on the existence and configuration of destinations:
Destination type | Supported protocols | |
---|---|---|
d1 = getDestinationName() |
d2 = getDestinationNameRfc() |
|
HTTP | any | HTTP via d1 |
RFC | any | RFC via d1 |
HTTP | RFC | HTTP via d1, RFC via d2 |
The following table shows which protocols are required for different query types to certain editions of S/4HANA. Here, the usual setup for S/4HANA Cloud is to only use one single HTTP destination d1 (supporting all query types), while for S/4HANA on-premise systems, depending on the required query type, either a single RFC destination d1, or an HTTP destination d1 and an additional RFC destination d2 can be used to configure the connection to the respective system:
SAP S/4HANA | ODataQuery | BapiQuery | RfcQuery |
---|---|---|---|
Cloud | HTTP | HTTP | HTTP |
On-Premise | HTTP | RFC | RFC |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_LOCALE_PROPERTY
The default name of the destination property holding the
Locale for DestinationType.HTTP . |
static String |
DEFAULT_LOCALE_PROPERTY_RFC
The default name of the destination property holding the
Locale for DestinationType.RFC . |
static String |
DEFAULT_SAP_CLIENT_PROPERTY
The default name of the destination property holding the
SapClient for DestinationType.HTTP . |
static String |
DEFAULT_SAP_CLIENT_PROPERTY_RFC
The default name of the destination property holding the
SapClient for DestinationType.RFC . |
static String |
DESTINATION_NAME_SUFFIX_RFC
The name suffix for an additional destination that is considered for RFC communication if
getDestinationName() refers to an HTTP destination. |
Constructor and Description |
---|
ErpConfigContext()
Creates the default ERP configuration context using
default ERP destination name
ErpDestination.getDefaultName() ,
default SAP client property of this destination
DEFAULT_SAP_CLIENT_PROPERTY for DestinationType.HTTP or
DEFAULT_SAP_CLIENT_PROPERTY_RFC for DestinationType.RFC
if available - otherwise SapClient.DEFAULT . |
ErpConfigContext(Locale locale)
Creates an ERP configuration context using the default ERP destination name
ErpDestination.getDefaultName() and the default SAP client property of this destination:
DEFAULT_SAP_CLIENT_PROPERTY for DestinationType.HTTP or
DEFAULT_SAP_CLIENT_PROPERTY_RFC for DestinationType.RFC
If this destination property does not exist, SapClient.DEFAULT is used. |
ErpConfigContext(SapClient sapClient)
Creates an ERP configuration context using the default ERP destination name
ErpDestination.getDefaultName() and the current Locale . |
ErpConfigContext(String destinationName)
Creates an ERP configuration context using the default property of this destination
DEFAULT_LOCALE_PROPERTY for DestinationType.HTTP or
DEFAULT_LOCALE_PROPERTY_RFC for DestinationType.RFC
or SapClient.DEFAULT if this property does not exist, as well as the current Locale . |
ErpConfigContext(String destinationName,
SapClient sapClient)
Creates an ERP configuration context using the current
Locale . |
ErpConfigContext(String destinationName,
SapClient sapClient,
Locale locale)
Creates an ERP configuration context.
|
ErpConfigContext(String destinationName,
SapClient sapClient,
String sapClientProperty,
Locale locale,
String localeProperty)
Creates an ERP configuration context.
|
ErpConfigContext(String destinationName,
String destinationNameRfc,
SapClient sapClient,
String sapClientProperty,
Locale locale,
String localeProperty)
Creates an ERP configuration context.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canEqual(Object other) |
boolean |
equals(Object o) |
String |
getDestinationName()
The name of the destination to be used for connecting to the ERP via HTTP or RFC.
|
String |
getDestinationNameRfc()
The name of the additional destination that is considered for connecting to the ERP via the RFC protocol if
getDestinationName() refers to an HTTP destination. |
Locale |
getLocale()
The
Locale to be used for connecting to the ERP. |
SapClient |
getSapClient()
The
SapClient to be used for connecting to the ERP. |
int |
hashCode() |
String |
toString() |
public static final String DESTINATION_NAME_SUFFIX_RFC
getDestinationName()
refers to an HTTP destination. This suffix is appended to the given
destination name unless the name of the additional RFC destination is explicitly defined. This is required to
transparently support both HTTP and RFC communication via these two respective destinations (a destination can
only support either HTTP or RFC).public static final String DEFAULT_SAP_CLIENT_PROPERTY
SapClient
for DestinationType.HTTP
.public static final String DEFAULT_LOCALE_PROPERTY
Locale
for DestinationType.HTTP
.public static final String DEFAULT_SAP_CLIENT_PROPERTY_RFC
SapClient
for DestinationType.RFC
.public static final String DEFAULT_LOCALE_PROPERTY_RFC
Locale
for DestinationType.RFC
.public ErpConfigContext(@Nullable String destinationName, @Nullable String destinationNameRfc, @Nullable SapClient sapClient, @Nullable String sapClientProperty, @Nullable Locale locale, @Nullable String localeProperty) throws DestinationAccessException
destinationName
- The name of the ERP destination that can be used for HTTP or RFC communication. If this is
null
, the default name defined by ErpDestination.getDefaultName()
is used.destinationNameRfc
- The name of the additional destination that is considered for connecting to the ERP via the RFC
protocol if destinationName
refers to an HTTP destination. This is required to transparently
support both HTTP and RFC communication via these two respective destinations (a destination can only
support either HTTP or RFC). If this is null
, the default name is defined as:
destinationNameRfc = destinationName +
DESTINATION_NAME_SUFFIX_RFC
.sapClient
- The SAP client to be used. If this is null
, the destination configuration of
destinationName
is used to read the property with the name specified by
sapClientProperty
. If this destination property does not exist, SapClient.DEFAULT
is
used.sapClientProperty
- The name of the destination property to be used for reading the SAP client. If this is null
,
the following default property name is used:
locale
- The locale to be used. If this is null
, first, the destination configuration of
destinationName
is used to read the property with the name specified by localeProperty
. If this fails, the locale defined by LocaleAccessor.getCurrentLocale()
is used.localeProperty
- The name of the destination property to be used for reading the locale. If this is null
, the
following default property name is used:
DestinationAccessException
- If the configuration for the given destination cannot be found.public ErpConfigContext(@Nullable String destinationName, @Nullable SapClient sapClient, @Nullable String sapClientProperty, @Nullable Locale locale, @Nullable String localeProperty) throws DestinationAccessException
destinationName
- The name of the ERP destination that can be used for HTTP or RFC communication. If this is
null
, the default name defined by ErpDestination.getDefaultName()
is used.sapClient
- The SAP client to be used. If this is null
, the destination configuration of
destinationName
is used to read the property with the name specified by
sapClientProperty
. If this destination property does not exist, SapClient.DEFAULT
is
used.sapClientProperty
- The name of the destination property to be used for reading the SAP client. If this is null
,
the following default property name is used:
locale
- The locale to be used. If this is null
, first, the destination configuration of
destinationName
is used to read the property with the name specified by localeProperty
. If this fails, the locale defined by LocaleAccessor.getCurrentLocale()
is used.localeProperty
- The name of the destination property to be used for reading the locale. If this is null
, the
following default property name is used:
DestinationAccessException
- If the configuration for the given destination cannot be found.public ErpConfigContext(@Nullable String destinationName, @Nullable SapClient sapClient, @Nullable Locale locale) throws DestinationAccessException
destinationName
- The name of the ERP destination that can be used for HTTP or RFC communication. If this is
null
, the default name defined by ErpDestination.getDefaultName()
is used.sapClient
- The SAP client to be used. If this is null
, the destination configuration of
destinationName
is used to read the property with the following default property name:
DEFAULT_SAP_CLIENT_PROPERTY
for DestinationType.HTTP
orDEFAULT_SAP_CLIENT_PROPERTY_RFC
for DestinationType.RFC
SapClient.DEFAULT
is used.locale
- The locale to be used. If this is null
, first, the destination configuration of
destinationName
is used to read the property with the following default property name:
DEFAULT_LOCALE_PROPERTY
for DestinationType.HTTP
orDEFAULT_LOCALE_PROPERTY_RFC
for DestinationType.RFC
LocaleAccessor.getCurrentLocale()
is used.DestinationAccessException
- If the configuration for the given destination cannot be found.public ErpConfigContext(@Nullable String destinationName, @Nullable SapClient sapClient)
Locale
.destinationName
- The name of the ERP destination that can be used for HTTP or RFC communication. If this is
null
, the default name defined by ErpDestination.getDefaultName()
is used.sapClient
- The SAP client to be used. If this is null
, the destination configuration of
destinationName
is used to read the property with the following default property name:
DEFAULT_SAP_CLIENT_PROPERTY
for DestinationType.HTTP
orDEFAULT_SAP_CLIENT_PROPERTY_RFC
for DestinationType.RFC
SapClient.DEFAULT
is used.public ErpConfigContext(@Nullable String destinationName)
DEFAULT_LOCALE_PROPERTY
for DestinationType.HTTP
orDEFAULT_LOCALE_PROPERTY_RFC
for DestinationType.RFC
SapClient.DEFAULT
if this property does not exist, as well as the current Locale
.destinationName
- The name of the ERP destination that can be used for HTTP or RFC communication. If this is
null
, the default name defined by ErpDestination.getDefaultName()
is used.public ErpConfigContext(@Nullable SapClient sapClient)
ErpDestination.getDefaultName()
and the current Locale
.sapClient
- The SAP client to be used. If this is null
, the destination configuration of
destinationName
is used to read the property with name DEFAULT_SAP_CLIENT_PROPERTY
.
If this destination property does not exist, SapClient.DEFAULT
is used.public ErpConfigContext(@Nullable Locale locale)
ErpDestination.getDefaultName()
and the default SAP client property of this destination:
DEFAULT_SAP_CLIENT_PROPERTY
for DestinationType.HTTP
orDEFAULT_SAP_CLIENT_PROPERTY_RFC
for DestinationType.RFC
SapClient.DEFAULT
is used.locale
- The locale to be used. If this is null
, first, the destination configuration of
destinationName
is used to read the default locale property:
DEFAULT_LOCALE_PROPERTY
for DestinationType.HTTP
orDEFAULT_LOCALE_PROPERTY_RFC
for DestinationType.RFC
LocaleAccessor.getCurrentLocale()
is used.public ErpConfigContext()
ErpDestination.getDefaultName()
,
DEFAULT_SAP_CLIENT_PROPERTY
for DestinationType.HTTP
orDEFAULT_SAP_CLIENT_PROPERTY_RFC
for DestinationType.RFC
SapClient.DEFAULT
.
DEFAULT_LOCALE_PROPERTY
for DestinationType.HTTP
orDEFAULT_LOCALE_PROPERTY_RFC
for DestinationType.RFC
LocaleAccessor.getCurrentLocale()
.
protected boolean canEqual(Object other)
@Nonnull public String getDestinationName()
ErpDestination.getDefaultName()
.getDestinationName
in interface WithDestinationName
@Nonnull public String getDestinationNameRfc()
getDestinationName()
refers to an HTTP destination. This is required to transparently support both HTTP
and RFC communication via these two respective destinations (a destination can only support either HTTP or RFC).
Defaults to ErpDestination.getDefaultNameRfc()
= ErpDestination.getDefaultName()
+
DESTINATION_NAME_SUFFIX_RFC
.@Nonnull public SapClient getSapClient()
SapClient
to be used for connecting to the ERP. If not provided upon construction, this value is read
from the respective property of destination ErpDestination.getDefaultName()
. Defaults to
SapClient.DEFAULT
otherwise.@Nonnull public Locale getLocale()
Locale
to be used for connecting to the ERP. If not provided upon construction, this value is read
from the respective property of destination ErpDestination.getDefaultName()
. Defaults to
Locale.getDefault()
otherwise.Copyright © 2019 SAP SE. All rights reserved.