
com.sap.cloud.sdk.cloudplatform.connectivity.ScpXfDestination Maven / Gradle / Ivy
Show all versions of connectivity-scp-cf Show documentation
/*
* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
*/
package com.sap.cloud.sdk.cloudplatform.connectivity;
import java.security.KeyStore;
import java.util.Collections;
import java.util.Optional;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException;
import com.sap.cloud.sdk.cloudplatform.security.BasicCredentials;
import lombok.ToString;
/**
* Implementation of the {@link Destination} used in context of the ExtensionFactory on SAP Cloud Platform Cloud
* Foundry.
*
* You can let the SAP Cloud SDK read this type of destinations automatically from {@code VCAP_SERVICES} environment
* variable (written to by the ExtensionFactory) by providing the {@link ScpXfDestinationFacade} to the
* {@link DestinationAccessor}.
*
* In case you want to retrieve destinations from both, the regular destination service as well as the ExtensionFactory,
* you can consider using the {@link FallbackDestinationFacade}.
*/
@ToString( callSuper = true )
@Beta
public class ScpXfDestination extends AbstractDestination
{
/**
* Creates a new {@code ScpXfDestination} based on information obtainable in the VCAP_SERVICES environment variable.
*
* @param name
* The name of the destination.
* @param description
* The description of the destination. Usually the plan in the ExtensionFactory case.
* @param uri
* The URI this destination points to.
* @param authenticationType
* The {@code AuthenticationType} of this destination. Usually
* {@link AuthenticationType#BASIC_AUTHENTICATION} in the ExtensionFactory case.
* @param basicCredentials
* The basic credentials to be used in the communication with the system.
*/
public ScpXfDestination(
@Nonnull final String name,
@Nullable final String description,
@Nonnull final String uri,
@Nonnull final AuthenticationType authenticationType,
@Nullable final BasicCredentials basicCredentials )
{
super(
name,
description,
uri,
authenticationType,
basicCredentials,
ProxyType.INTERNET,
null,
true,
null,
null,
null,
null,
Collections.emptyMap());
}
@Nonnull
@Override
public Optional getTrustStore()
throws DestinationAccessException
{
return Optional.empty();
}
@Nonnull
@Override
public Optional getKeyStore()
throws DestinationAccessException
{
return Optional.empty();
}
}