All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.edc.connector.callback.CallbackProtocolResolverRegistryImpl Maven / Gradle / Ivy

There is a newer version: 0.10.1
Show newest version
/*
 *  Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
 *
 *  This program and the accompanying materials are made available under the
 *  terms of the Apache License, Version 2.0 which is available at
 *  https://www.apache.org/licenses/LICENSE-2.0
 *
 *  SPDX-License-Identifier: Apache-2.0
 *
 *  Contributors:
 *       Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
 *
 */

package org.eclipse.edc.connector.callback;


import org.eclipse.edc.connector.spi.callback.CallbackProtocolResolver;
import org.eclipse.edc.connector.spi.callback.CallbackProtocolResolverRegistry;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class CallbackProtocolResolverRegistryImpl implements CallbackProtocolResolverRegistry {

    private final List resolvers = new ArrayList<>();

    @Override
    public void registerResolver(CallbackProtocolResolver resolver) {
        resolvers.add(resolver);
    }

    @Override
    public String resolve(String scheme) {
        return resolvers.stream()
                .map(resolver -> resolver.resolve(scheme))
                .filter(Objects::nonNull)
                .findFirst()
                .orElse(null);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy