Merge "Unified implementations of BrokerService Proxies which are provided to Consume...
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / api / DependencyResolver.java
1 /*
2  * Copyright (c) 2013 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.controller.config.api;
9
10 import javax.management.ObjectName;
11
12 import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
13 import org.opendaylight.yangtools.concepts.Identifiable;
14
15 /**
16  * Each new {@link org.opendaylight.controller.config.spi.Module} can receive
17  * resolver from {@link org.opendaylight.controller.config.spi.ModuleFactory}
18  * for looking up dependencies during validation and second phase commit.
19  *
20  * @see org.opendaylight.controller.config.spi.Module
21  */
22 public interface DependencyResolver extends Identifiable<ModuleIdentifier> {
23
24     /**
25      * To be used during validation phase to validate serice interface of
26      * dependent module.
27      *
28      * @param expectedServiceInterface
29      *            MBean/MXBean interface which will back the proxy object.
30      * @param objectName
31      *            ObjectName of dependent module without transaction name
32      *            (platformON).
33      * @param jmxAttribute
34      * @throws {@link IllegalArgumentException} when module is not found
35      * @throws {@link IllegalStateException} if module does not export this
36      *         service interface.
37      */
38     void validateDependency(
39             Class<? extends AbstractServiceInterface> expectedServiceInterface,
40             ObjectName objectName, JmxAttribute jmxAttribute);
41
42     /**
43      * To be used during commit phase to wire actual dependencies.
44      *
45      * @return dependency instance using
46      *         {@link org.opendaylight.controller.config.spi.Module#getInstance()}
47      * @throws {@link IllegalArgumentException} when module is not found
48      */
49     <T> T resolveInstance(Class<T> expectedType, ObjectName objectName,
50             JmxAttribute jmxAttribute);
51
52 }