2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.netconf.cli;
10 import com.google.common.base.Optional;
11 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
14 * Contains the local schema context (containing local commands) and remote schema context (remote commands)
16 * Remote commands are set only after the connection is fully established. So classes using the remote schema context
18 public class SchemaContextRegistry {
20 private final SchemaContext localSchemaContext;
21 private SchemaContext remoteSchemaContext;
23 public SchemaContextRegistry(final SchemaContext localSchemaContext) {
24 this.localSchemaContext = localSchemaContext;
27 public synchronized Optional<SchemaContext> getRemoteSchemaContext() {
28 return Optional.fromNullable(remoteSchemaContext);
31 public SchemaContext getLocalSchemaContext() {
32 return localSchemaContext;
35 public synchronized void setRemoteSchemaContext(final SchemaContext remoteSchemaContext) {
36 this.remoteSchemaContext = remoteSchemaContext;