Initial code drop of yang model driven configuration system
[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
14 /**
15  * Each new {@link org.opendaylight.controller.config.spi.Module} can receive
16  * resolver from {@link org.opendaylight.controller.config.spi.ModuleFactory}
17  * for looking up dependencies during validation and second phase commit.
18  *
19  * @see org.opendaylight.controller.config.spi.Module
20  */
21 public interface DependencyResolver {
22
23     /**
24      * To be used during validation phase to validate serice interface of
25      * dependent module.
26      *
27      * @param expectedServiceInterface
28      *            MBean/MXBean interface which will back the proxy object.
29      * @param objectName
30      *            ObjectName of dependent module without transaction name
31      *            (platformON).
32      * @param jmxAttribute
33      * @throws {@link IllegalArgumentException} when module is not found
34      * @throws {@link IllegalStateException} if module does not export this
35      *         service interface.
36      */
37     void validateDependency(
38             Class<? extends AbstractServiceInterface> expectedServiceInterface,
39             ObjectName objectName, JmxAttribute jmxAttribute);
40
41     @Deprecated
42     // TODO remove once all config code is generated
43     void validateDependency(
44             Class<? extends AbstractServiceInterface> expectedServiceInterface,
45             ObjectName objectName, String attributeNameForErrorReporting);
46
47     /**
48      * To be used during commit phase to wire actual dependencies.
49      *
50      * @return dependency instance using
51      *         {@link org.opendaylight.controller.config.spi.Module#getInstance()}
52      * @throws {@link IllegalArgumentException} when module is not found
53      */
54     <T> T resolveInstance(Class<T> expectedType, ObjectName objectName,
55             JmxAttribute jmxAttribute);
56
57     @Deprecated
58     <T> T resolveInstance(Class<T> expectedType, ObjectName objectName);
59
60 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.