X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fnetconf%2Fnetconf-monitoring%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fmonitoring%2Fosgi%2FNetconfMonitoringOperationService.java;h=602c762113d43e2c20f0c59b045b3c17965bd1f9;hb=1f43b99185e388e435f68bd494d91936f61cf3cf;hp=fe01847f59cb7fde0ea2fbac79c7f41e7d2cd922;hpb=ac65af650d550ae56dd02b660e1c5eef24b78740;p=controller.git diff --git a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringOperationService.java b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringOperationService.java index fe01847f59..602c762113 100644 --- a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringOperationService.java +++ b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringOperationService.java @@ -1,100 +1,32 @@ /* -* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -* -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0 which accompanies this distribution, -* and is available at http://www.eclipse.org/legal/epl-v10.html -*/ + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + package org.opendaylight.controller.netconf.monitoring.osgi; -import com.google.common.base.Charsets; -import com.google.common.base.Optional; -import com.google.common.base.Preconditions; import com.google.common.collect.Sets; -import com.google.common.io.Files; +import java.util.Set; import org.opendaylight.controller.netconf.api.monitoring.NetconfMonitoringService; -import org.opendaylight.controller.netconf.mapping.api.Capability; import org.opendaylight.controller.netconf.mapping.api.NetconfOperation; -import org.opendaylight.controller.netconf.mapping.api.NetconfOperationFilter; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService; import org.opendaylight.controller.netconf.monitoring.Get; -import org.opendaylight.controller.netconf.monitoring.MonitoringConstants; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Schemas; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import org.opendaylight.controller.netconf.monitoring.GetSchema; public class NetconfMonitoringOperationService implements NetconfOperationService { - public static final HashSet CAPABILITIES = Sets.newHashSet(new Capability() { - - @Override - public String getCapabilityUri() { - return MonitoringConstants.URI; - } - - @Override - public Optional getModuleNamespace() { - return Optional.of(MonitoringConstants.NAMESPACE); - } - - @Override - public Optional getModuleName() { - return Optional.of(MonitoringConstants.MODULE_NAME); - } - - @Override - public Optional getRevision() { - return Optional.of(MonitoringConstants.MODULE_REVISION); - } - - @Override - public Optional getCapabilitySchema() { - return Optional.absent(); - } - - @Override - public Optional> getLocation() { - return Optional.absent(); - } - }); - private final NetconfMonitoringService monitor; - public NetconfMonitoringOperationService(NetconfMonitoringService monitor) { + public NetconfMonitoringOperationService(final NetconfMonitoringService monitor) { this.monitor = monitor; } - private static String readSchema() { - String schemaLocation = "/META-INF/yang/ietf-netconf-monitoring.yang"; - URL resource = Schemas.class.getClassLoader().getResource(schemaLocation); - Preconditions.checkNotNull(resource, "Unable to read schema content from %s", schemaLocation); - File file = new File(resource.getFile()); - try { - return Files.toString(file, Charsets.UTF_8); - } catch (IOException e) { - throw new RuntimeException("Unable to load schema from " + schemaLocation, e); - } - } - - @Override - public Set getCapabilities() { - return CAPABILITIES; - } - @Override public Set getNetconfOperations() { - return Collections.emptySet(); - } - - @Override - public Set getFilters() { - return Sets.newHashSet(new Get(monitor)); + return Sets.newHashSet(new Get(monitor), new GetSchema(monitor)); } @Override