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
8 package org.opendaylight.controller.netconf.monitoring.xml.model;
10 import com.google.common.base.Function;
11 import com.google.common.collect.Collections2;
12 import org.opendaylight.controller.netconf.api.monitoring.NetconfMonitoringService;
13 import org.opendaylight.controller.netconf.monitoring.MonitoringConstants;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Schemas;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Sessions;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.schemas.Schema;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.sessions.Session;
19 import javax.annotation.Nullable;
20 import javax.xml.bind.annotation.XmlElement;
21 import javax.xml.bind.annotation.XmlElementWrapper;
22 import javax.xml.bind.annotation.XmlRootElement;
23 import java.util.Collection;
25 @XmlRootElement(name = MonitoringConstants.NETCONF_MONITORING_XML_ROOT_ELEMENT)
26 public final class NetconfState {
28 private Schemas schemas;
29 private Sessions sessions;
31 public NetconfState(NetconfMonitoringService monitoringService) {
32 this.sessions = monitoringService.getSessions();
33 this.schemas = monitoringService.getSchemas();
36 public NetconfState() {
41 @XmlElementWrapper(name="schemas")
42 @XmlElement(name="schema")
43 public Collection<MonitoringSchema> getSchemas() {
44 return Collections2.transform(schemas.getSchema(), new Function<Schema, MonitoringSchema>() {
47 public MonitoringSchema apply(@Nullable Schema input) {
48 return new MonitoringSchema(input);
53 @XmlElementWrapper(name="sessions")
54 @XmlElement(name="session")
55 public Collection<MonitoringSession> getSessions() {
56 return Collections2.transform(sessions.getSession(), new Function<Session, MonitoringSession>() {
59 public MonitoringSession apply(@Nullable Session input) {
60 return new MonitoringSession(input);