public abstract class AbstractDestinationFacade extends Object implements DestinationFacade
DestinationFacade
s that allows to use the environment variable "destinations" as
fallback, for example for local testing. The environment variable is expected to be in JSON format.
Example for environment variable "destinations":
[{
"name": "ErpQueryEndpoint",
"url": "https://my-erp.com",
"username": "username",
"password": "password",
"properties": [
{
"key": "proxyHost",
"value": "my-proxy.com"
},
{
"key": "proxyPort",
"value": "8080"
},
{
"key": "TrustAll",
"value": "false"
}
]
}]
Constructor and Description |
---|
AbstractDestinationFacade() |
Modifier and Type | Method and Description |
---|---|
protected void |
assertDestinationType(GenericDestination destination,
DestinationType expectedType) |
void |
declareDestinations(Collection<String> destinationNames)
Declares the given destination names.
|
Destination |
getDestination(String destinationName)
Returns the
Destination for the given name. |
Map<String,Destination> |
getDestinationsByName()
Returns all destinations that are of type
DestinationType.HTTP by their names. |
protected <DestinationT extends GenericDestination> |
getDestinationsForType(DestinationType destinationType) |
protected Map<String,com.google.gson.JsonObject> |
getDestinationsFromEnvironmentVariable() |
protected Map<String,GenericDestination> |
getDestinationsFromEnvironmentVariable(com.sap.cloud.sdk.cloudplatform.connectivity.DestinationFactory destinationFactory) |
DestinationType |
getDestinationType(String destinationName)
Returns the
DestinationType of the destination with the given name. |
GenericDestination |
getGenericDestination(String destinationName)
Returns the
GenericDestination for the given name. |
RfcDestination |
getRfcDestination(String destinationName)
Returns the
RfcDestination for the given name. |
Map<String,RfcDestination> |
getRfcDestinationsByName()
Returns all destinations that are of type
DestinationType.RFC by their names. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDestinationClass, getGenericDestinationClass, getGenericDestinationsByName, getRfcDestinationClass
@Nullable protected Map<String,com.google.gson.JsonObject> getDestinationsFromEnvironmentVariable() throws DestinationAccessException
DestinationAccessException
@Nonnull protected Map<String,GenericDestination> getDestinationsFromEnvironmentVariable(com.sap.cloud.sdk.cloudplatform.connectivity.DestinationFactory destinationFactory) throws DestinationAccessException
DestinationAccessException
public void declareDestinations(@Nonnull Collection<String> destinationNames)
DestinationFacade.getDestination(String)
and DestinationFacade.getDestinationsByName()
, for example, during application
startup within a ServletContextListener.
Notes:
declareDestinations
in interface DestinationFacade
destinationNames
- The collection of all destination names that should get declared.DestinationDeclarator
,
DestinationsRequestContextListener
@Nonnull public DestinationType getDestinationType(@Nonnull String destinationName) throws DestinationNotFoundException, DestinationAccessException
DestinationType
of the destination with the given name.getDestinationType
in interface DestinationFacade
destinationName
- The destination name to get the destination type for.DestinationNotFoundException
- If no destination with the given name can be found.DestinationAccessException
- If there is an issue while accessing destination information.@Nonnull public GenericDestination getGenericDestination(@Nonnull String destinationName) throws DestinationNotFoundException, DestinationAccessException
GenericDestination
for the given name.getGenericDestination
in interface DestinationFacade
destinationName
- The destination name to get the associated destination for.DestinationNotFoundException
- If the GenericDestination
cannot be found.DestinationAccessException
- If there is an issue while accessing destination information.@Nonnull public Destination getDestination(@Nonnull String destinationName) throws DestinationNotFoundException, DestinationAccessException
Destination
for the given name.
Note: The destination must be of type DestinationType.HTTP
, otherwise an exception is thrown. You can
check the type of the destination with DestinationFacade.getDestinationType(String)
.
getDestination
in interface DestinationFacade
destinationName
- The destination name to the get the HTTP-destination for.DestinationNotFoundException
- If the Destination
cannot be found.DestinationAccessException
- If the destination is not of type DestinationType.HTTP
or there is an issue while accessing
destination information.@Nonnull public RfcDestination getRfcDestination(@Nonnull String destinationName) throws DestinationNotFoundException, DestinationAccessException
RfcDestination
for the given name.
Note: The destination must be of type DestinationType.RFC
, otherwise an exception is thrown. You can
check the type of the destination with DestinationFacade.getDestinationType(String)
.
getRfcDestination
in interface DestinationFacade
destinationName
- The destination name to get the RFC-destination for.DestinationNotFoundException
- If the RfcDestination
cannot be found.DestinationAccessException
- If the destination is not of type DestinationType.RFC
or there is an issue while accessing
destination information.protected void assertDestinationType(@Nonnull GenericDestination destination, @Nonnull DestinationType expectedType) throws DestinationAccessException
DestinationAccessException
@Nonnull protected <DestinationT extends GenericDestination> Map<String,DestinationT> getDestinationsForType(@Nonnull DestinationType destinationType)
@Nonnull public Map<String,Destination> getDestinationsByName() throws DestinationAccessException
DestinationType.HTTP
by their names.
To get all destinations, irrespective of their type, use DestinationFacade.getGenericDestinationsByName()
.
getDestinationsByName
in interface DestinationFacade
DestinationAccessException
- If there is an issue while accessing destination information.@Nonnull public Map<String,RfcDestination> getRfcDestinationsByName() throws DestinationAccessException
DestinationType.RFC
by their names.
To get all destinations, irrespective of their type, use DestinationFacade.getGenericDestinationsByName()
.
getRfcDestinationsByName
in interface DestinationFacade
DestinationAccessException
- If there is an issue while accessing destination information.Copyright © 2018 SAP SE. All rights reserved.