Merge "Improve documentation of BindingAware{Provider,Consumer}"
[controller.git] / opendaylight / netconf / netconf-cli / src / main / java / org / opendaylight / controller / netconf / cli / SchemaContextRegistry.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.netconf.cli;
9
10 import com.google.common.base.Optional;
11 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
12
13 /**
14  * Contains the local schema context (containing local commands) and remote schema context (remote commands)
15  *
16  * Remote commands are set only after the connection is fully established. So classes using the remote schema context
17  */
18 public class SchemaContextRegistry {
19
20     private final SchemaContext localSchemaContext;
21     private SchemaContext remoteSchemaContext;
22
23     public SchemaContextRegistry(final SchemaContext localSchemaContext) {
24         this.localSchemaContext = localSchemaContext;
25     }
26
27     public synchronized Optional<SchemaContext> getRemoteSchemaContext() {
28         return Optional.fromNullable(remoteSchemaContext);
29     }
30
31     public SchemaContext getLocalSchemaContext() {
32         return localSchemaContext;
33     }
34
35     public synchronized void setRemoteSchemaContext(final SchemaContext remoteSchemaContext) {
36         this.remoteSchemaContext = remoteSchemaContext;
37     }
38 }