Proxy MD-SAL interfaces in DOMMountPointServiceImpl
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / data / LogicalDatastoreType.java
1 /*
2  * Copyright (c) 2014 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.md.sal.common.api.data;
9
10 import org.eclipse.jdt.annotation.NonNullByDefault;
11
12 @NonNullByDefault
13 public enum LogicalDatastoreType {
14     /**
15      * Logical atastore representing operational state of the system
16      * and it's components
17      *
18      * <p>
19      * This datastore is used to describe operational state of
20      * the system and it's operation related data.
21      *
22      */
23     OPERATIONAL {
24         @Override
25         public org.opendaylight.mdsal.common.api.LogicalDatastoreType toMdsal() {
26             return org.opendaylight.mdsal.common.api.LogicalDatastoreType.OPERATIONAL;
27         }
28     },
29     /**
30      * Logical Datastore representing configuration state of the system
31      * and it's components.
32      *
33      * <p>
34      * This datastore is used to describe intended state of
35      * the system and intended operation mode.
36      *
37      */
38     CONFIGURATION {
39         @Override
40         public org.opendaylight.mdsal.common.api.LogicalDatastoreType toMdsal() {
41             return org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION;
42         }
43     };
44
45     /**
46      * Convert this logical datastore type to its MD-SAL counterpart.
47      *
48      * @return MD-SAL counterpart of this type.
49      */
50     public abstract org.opendaylight.mdsal.common.api.LogicalDatastoreType toMdsal();
51
52     /**
53      * Convert MD-SAL logical datastore type to this counterpart.
54      *
55      * @param type MD-SAL counterpart of this type.
56      * @return Corresponding value in this type.
57      */
58     public static LogicalDatastoreType fromMdsal(final org.opendaylight.mdsal.common.api.LogicalDatastoreType type) {
59         switch (type) {
60             case CONFIGURATION:
61                 return CONFIGURATION;
62             case OPERATIONAL:
63                 return OPERATIONAL;
64             default:
65                 throw new IllegalArgumentException("Unhandled type " + type);
66         }
67     }
68 }