Skip to content

Package: RegistrationProcessorProvider

RegistrationProcessorProvider

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Red Hat Inc and others.
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Red Hat Inc - initial API and implementation
12: * Eurotech
13: *******************************************************************************/
14: package org.eclipse.kapua.security.registration;
15:
16: import java.util.Collection;
17: import java.util.ServiceLoader;
18:
19: /**
20: * A provider of {@link RegistrationProcessor}s
21: * <p>
22: * This class is intended to be used in combination with Java's {@link ServiceLoader} framework.
23: * Providers can be registered with the service framework and then be iterated over, creating new
24: * instances of {@link RegistrationProcessor}.
25: * </p>
26: * <p>
27: * The reason from splitting this up in two classes is that the providers don't require a lifecycle
28: * and can just be discarded, while the processors implement {@link AutoCloseable} and most be
29: * properly closed. So the providers are considered simple and lightweight classes.
30: * </p>
31: */
32: public interface RegistrationProcessorProvider {
33:
34: /**
35: * Create a collection of supported {@link RegistrationProcessor}s
36: * <p>
37: * <b>Note:</b> The caller takes ownership of the returned resources and must close them
38: * properly once they are no longer used.
39: * </p>
40: *
41: * @return A collection of processors provided by this provider
42: */
43: Collection<? extends RegistrationProcessor> createAll();
44: }