+ public java.lang.AutoCloseable createInstance() {
+ final WaitingServiceTracker<JSONRestconfService> tracker =
+ WaitingServiceTracker.create(JSONRestconfService.class, bundleContext);
+ final JSONRestconfService service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
+ final class AutoCloseableJSONRestconfService implements JSONRestconfService, AutoCloseable {
+ @Override
+ public void close() {
+ tracker.close();
+ }
+
+ @Override
+ public void delete(String uriPath) throws OperationFailedException {
+ service.delete(uriPath);
+ }
+
+
+ @Override
+ public void put(String uriPath, String payload) throws OperationFailedException {
+ service.put(uriPath, payload);
+ }
+
+ @Override
+ public void post(String uriPath, String payload) throws OperationFailedException {
+ service.post(uriPath, payload);
+ }
+
+ @Override
+ public Optional<String> get(String uriPath, LogicalDatastoreType datastoreType)
+ throws OperationFailedException {
+ return service.get(uriPath, datastoreType);
+ }
+
+ @Override
+ public Optional<String> invokeRpc(String uriPath, Optional<String> input) throws OperationFailedException {
+ return service.invokeRpc(uriPath, input);
+ }
+ }
+
+ return new AutoCloseableJSONRestconfService();