org.opendaylight.ocpplugin.impl.services.AbstractSimpleService Maven / Gradle / Ivy
/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
* Copyright (c) 2015 Foxconn Corporation
*
* 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.ocpplugin.impl.services;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.FutureCallback;
import org.opendaylight.ocpplugin.api.ocp.device.DeviceContext;
import org.opendaylight.ocpplugin.api.ocp.device.RequestContext;
import org.opendaylight.ocpplugin.api.ocp.device.RequestContextStack;
import org.opendaylight.yang.gen.v1.urn.opendaylight.ocp.common.types.rev150811.OcpHeader;
import org.opendaylight.yangtools.yang.binding.DataObject;
/*
* @author Richard Chien
*
*/
public abstract class AbstractSimpleService extends AbstractService {
private final Class clazz;
protected AbstractSimpleService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class clazz) {
super(requestContextStack, deviceContext);
this.clazz = Preconditions.checkNotNull(clazz);
}
@Override
protected final FutureCallback createCallback(final RequestContext context, final Class> requestType) {
return SimpleRequestCallback.create(context, requestType, clazz);
}
}