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

©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.