/* * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.mdsal.binding.javav2.dom.adapter.impl.operation.invoker; import com.google.common.annotations.Beta; import com.google.common.base.Preconditions; import java.lang.reflect.Method; import java.util.Map; import java.util.concurrent.Future; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opendaylight.mdsal.binding.javav2.spec.base.Instantiable; import org.opendaylight.mdsal.binding.javav2.spec.base.Operation; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.RpcResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Provides single method invocation of operations on supplied instance. * *
* Operation Service invoker provides common invocation interface for any subtype of operation. via
* {@link #invoke(Operation, QName, Instantiable)} method.
*/
@Beta
public abstract class OperationServiceInvoker {
private static final Logger LOG = LoggerFactory.getLogger(OperationServiceInvoker.class);
/**
* Creates OperationServiceInvoker for specified operation type.
*
* @param type
* operation interface, which was generated from model.
* @return Cached instance of {@link OperationServiceInvoker} for supplied operation type.
*
*/
public static OperationServiceInvoker from(final Class extends Operation> type) {
return ClassBasedOperationServiceInvoker.instanceFor(type);
}
/**
* Creates an OperationServiceInvoker for specified QName-<Method mapping.
*
* @param qnameToMethod
* translation mapping, must not be null nor empty.
* @return An {@link OperationMethodInvoker} instance.
*/
public static OperationServiceInvoker from(final Map