2 * Copyright (c) 2015 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.xsql;
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
11 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
12 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
13 import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
14 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQL;
15 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQLBuilder;
16 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19 * @author Sharon Aicler(saichler@gmail.com)
22 * To be removed in Nitrogen
25 public class XSQLProvider implements AutoCloseable {
27 public static final InstanceIdentifier<XSQL> ID = InstanceIdentifier.builder(XSQL.class).build();
28 //public static final InstanceIdentifier<SalTest> ID2 = InstanceIdentifier.builder(SalTest.class).build();
33 public XSQL buildXSQL(DataBroker dps) {
34 XSQLAdapter.log("Building XSL...");
35 XSQLBuilder builder = new XSQLBuilder();
36 builder.setPort("34343");
37 XSQL xsql = builder.build();
40 XSQLAdapter.log("Starting TRansaction...");
41 WriteTransaction t = dps.newReadWriteTransaction();
42 t.delete(LogicalDatastoreType.OPERATIONAL, ID);
43 t.put(LogicalDatastoreType.OPERATIONAL,ID,xsql);
44 XSQLAdapter.log("Submitting...");
47 } catch (Exception e) {