8e0a9d7cde8d638d7fdc4ecc768e30c23271f29b
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / operations / getconfig / CandidateDatastoreQueryStrategy.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.netconf.confignetconfconnector.operations.getconfig;
10
11 import java.util.Set;
12
13 import javax.management.ObjectName;
14
15 import org.opendaylight.controller.config.util.ConfigRegistryClient;
16 import org.opendaylight.controller.config.util.ConfigTransactionClient;
17 import org.opendaylight.controller.netconf.confignetconfconnector.transactions.TransactionProvider;
18
19 public class CandidateDatastoreQueryStrategy implements DatastoreQueryStrategy {
20
21     private final TransactionProvider transactionProvider;
22
23     public CandidateDatastoreQueryStrategy(TransactionProvider transactionProvider) {
24         this.transactionProvider = transactionProvider;
25     }
26
27     @Override
28     public Set<ObjectName> queryInstances(ConfigRegistryClient configRegistryClient) {
29         ObjectName on = transactionProvider.getOrCreateTransaction();
30         ConfigTransactionClient proxy = configRegistryClient.getConfigTransactionClient(on);
31         return proxy.lookupConfigBeans();
32     }
33
34 }