org.eclipse.ditto.connectivity.model.AbstractConnectionBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ditto-connectivity-model Show documentation
Show all versions of ditto-connectivity-model Show documentation
Eclipse Ditto is a framework for creating and managing digital twins in the IoT.
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.ditto.connectivity.model;
import static org.eclipse.ditto.base.model.common.ConditionChecker.checkArgument;
import static org.eclipse.ditto.base.model.common.ConditionChecker.checkNotNull;
import java.text.MessageFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
/**
* Abstract implementation for common aspects of {@link ConnectionBuilder}.
*
* @since 3.2.0
*/
@Immutable
abstract class AbstractConnectionBuilder implements ConnectionBuilder {
private static final String MIGRATED_MAPPER_ID = "javascript";
// required but changeable:
@Nullable ConnectionId id;
@Nullable ConnectivityStatus connectionStatus;
String uri;
// optional:
@Nullable String name = null;
@Nullable Credentials credentials;
@Nullable MappingContext mappingContext = null;
@Nullable String trustedCertificates;
@Nullable ConnectionLifecycle lifecycle = null;
@Nullable ConnectionRevision revision = null;
@Nullable Instant modified = null;
@Nullable Instant created = null;
@Nullable SshTunnel sshTunnel = null;
// optional with default:
Set tags = new LinkedHashSet<>();
boolean failOverEnabled = true;
boolean validateCertificate = true;
final List