Merge branch 'blueprint' from controller
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMActionProviderService.java
1 /*
2  * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.dom.api;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ImmutableSet;
12 import java.util.Set;
13 import org.eclipse.jdt.annotation.NonNullByDefault;
14 import org.opendaylight.yangtools.concepts.ObjectRegistration;
15
16 /**
17  * A {@link DOMService} which allows registration of action implementations with a conceptual router. The client
18  * counterpart of this service is {@link DOMActionService}.
19  */
20 @Beta
21 @NonNullByDefault
22 public interface DOMActionProviderService
23         extends DOMExtensibleService<DOMActionProviderService, DOMActionProviderServiceExtension> {
24     /**
25      * Register an {@link DOMActionImplementation} object with this service.
26      *
27      * @param implementation action implementation, must not be null
28      * @param instances Set of supported operation identifiers. Must not be null, empty, or contain a null element.
29      * @return A {@link ObjectRegistration} object, guaranteed to be non-null.
30      * @throws NullPointerException if implementation or types is null
31      * @throws IllegalArgumentException if {@code instances} is empty
32      */
33     <T extends DOMActionImplementation> ObjectRegistration<T> registerActionImplementation(T implementation,
34             Set<DOMActionInstance> instances);
35
36     default <T extends DOMActionImplementation> ObjectRegistration<T> registerActionImplementation(
37             final T implementation, final DOMActionInstance... instances) {
38         return registerActionImplementation(implementation, ImmutableSet.copyOf(instances));
39     }
40 }