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.sal.restconf.binding.impl;
11 import java.util.concurrent.Future;
12 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
13 import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
14 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
15 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
16 import org.opendaylight.yangtools.concepts.ListenerRegistration;
17 import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext;
18 import org.opendaylight.yangtools.restconf.client.api.RestconfClientContextFactory;
19 import org.opendaylight.yangtools.restconf.client.api.UnsupportedProtocolException;
20 import org.opendaylight.yangtools.yang.binding.DataObject;
21 import org.opendaylight.yangtools.yang.binding.DataRoot;
22 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
23 import org.opendaylight.yangtools.yang.common.RpcResult;
24 import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
25 import org.opendaylight.yangtools.yang.model.api.SchemaContextHolder;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
29 public class DataBrokerServiceImpl implements DataBrokerService {
31 private static final Logger logger = LoggerFactory.getLogger(DataBrokerServiceImpl.class.toString());
32 private final RestconfClientContext restconfClientContext;
33 private final RestconfClientContextFactory restconfClientContextFactory = null;
35 public DataBrokerServiceImpl(URL baseUrl, BindingIndependentMappingService mappingService, SchemaContextHolder schemaContextHolder) throws UnsupportedProtocolException {
36 this.restconfClientContext = restconfClientContextFactory.getRestconfClientContext(baseUrl, mappingService, schemaContextHolder);
39 public <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType) {
44 public <T extends DataRoot> T getData(DataStoreIdentifier store, T filter) {
49 public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType) {
54 public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {
59 public RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {
64 public Future<RpcResult<Void>> commit(DataStoreIdentifier store) {
69 public DataObject getData(InstanceIdentifier<? extends DataObject> data) {
74 public DataObject getConfigurationData(InstanceIdentifier<?> data) {
79 public DataModificationTransaction beginTransaction() {
80 //TODO implementation using sal-remote
85 public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
90 public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
95 public DataObject readConfigurationData(InstanceIdentifier<? extends DataObject> path) {
96 //TODO implementation using restconf-client
102 public DataObject readOperationalData(InstanceIdentifier<? extends DataObject> path) {
103 //TODO implementation using restconf-client
108 public ListenerRegistration<DataChangeListener> registerDataChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener listener) {
109 //TODO implementation using restconf-client