2 * Copyright (c) 2023 PANTHEON.tech s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.callhome.server;
10 import io.netty.channel.Channel;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.eclipse.jdt.annotation.Nullable;
15 * Manager service for active Call-Home connections. Serves session context per id mapping (registry).
17 * @param <T> class representing transport specific implementation of {@link CallHomeSessionContext}
19 public interface CallHomeSessionContextManager<T extends CallHomeSessionContext> extends AutoCloseable {
22 * Checks if contexts with same id already defined.
24 * @param id unique session context identifier
25 * @return {@code true} if context with same id exists in registry, {@code false} otherwise
27 boolean exists(@NonNull String id);
30 * Registers (maps) new context object.
32 * @param context context object associated with new incoming connection
34 void register(T context);
37 * Searches for session context associated with requested {@link Channel}.
39 * @param channel {@link Channel} instance
40 * @return session context instance if found, {@code null} otherwise
42 @Nullable T findByChannel(@NonNull Channel channel);
45 * Removes session context by id from registry. Connection associated with removed context will be closed if open.
47 * @param id unique session context identifier
49 void remove(@NonNull String id);