2 * Copyright (c) 2013 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
9 package org.opendaylight.netconf.test.tool.monitoring;
11 import com.google.common.base.Preconditions;
12 import com.google.common.collect.Collections2;
13 import java.util.Collection;
14 import javax.xml.bind.annotation.XmlElement;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.Yang;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.schemas.Schema;
18 final class MonitoringSchema {
20 private final Schema schema;
22 MonitoringSchema(final Schema schema) {
26 @XmlElement(name = "identifier")
27 public String getIdentifier() {
28 return schema.getIdentifier();
31 @XmlElement(name = "namespace")
32 public String getNamespace() {
33 return schema.getNamespace().getValue();
36 @XmlElement(name = "location")
37 public Collection<String> getLocation() {
38 return Collections2.transform(schema.getLocation(), input -> input.getEnumeration().toString());
41 @XmlElement(name = "version")
42 public String getVersion() {
43 return schema.getVersion();
46 @XmlElement(name = "format")
47 public String getFormat() {
48 Preconditions.checkState(schema.getFormat() == Yang.class, "Only yang format permitted, but was %s",