Merge "Reduce verbosity/criticality of inconsistent yangstore messages"
[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 org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
11 import org.opendaylight.yangtools.concepts.Identifiable;
12 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
13
14 import javax.management.ObjectName;
15
16 /**
17  * Each new {@link org.opendaylight.controller.config.spi.Module} can receive
18  * resolver from {@link org.opendaylight.controller.config.spi.ModuleFactory}
19  * for looking up dependencies during validation and second phase commit.
20  *
21  * @see org.opendaylight.controller.config.spi.Module
22  */
23 public interface DependencyResolver extends Identifiable<ModuleIdentifier> {
24
25     /**
26      * To be used during validation phase to validate serice interface of
27      * dependent module.
28      *
29      * @param expectedServiceInterface
30      *            MBean/MXBean interface which will back the proxy object.
31      * @param objectName
32      *            ObjectName of dependent module without transaction name
33      *            (platformON).
34      * @param jmxAttribute
35      * @throws {@link IllegalArgumentException} when module is not found
36      * @throws {@link IllegalStateException} if module does not export this
37      *         service interface.
38      */
39     void validateDependency(
40             Class<? extends AbstractServiceInterface> expectedServiceInterface,
41             ObjectName objectName, JmxAttribute jmxAttribute);
42
43     /**
44      * To be used during commit phase to wire actual dependencies.
45      *
46      * @return dependency instance using
47      *         {@link org.opendaylight.controller.config.spi.Module#getInstance()}
48      * @throws {@link IllegalArgumentException} when module is not found
49      */
50     <T> T resolveInstance(Class<T> expectedType, ObjectName objectName,
51             JmxAttribute jmxAttribute);
52
53     // TODO finish javadoc
54
55     /**
56      * To be used during commit phase to resolve identity-ref config attributes.
57      *
58      * @return actual class object generated from identity
59      */
60     <T extends BaseIdentity> Class<? extends T> resolveIdentity(IdentityAttributeRef identityRef, Class<T> expectedBaseClass);
61
62     <T extends BaseIdentity> void validateIdentity(IdentityAttributeRef identityRef, Class<T> expectedBaseClass, JmxAttribute jmxAttribute);
63
64 }