All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.infrautils.caches.testutils.CacheModule Maven / Gradle / Ivy

There is a newer version: 2.0.16
Show newest version
/*
 * Copyright (c) 2017 Red Hat, Inc. 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.infrautils.caches.testutils;

import com.google.inject.AbstractModule;
import org.opendaylight.infrautils.caches.CacheManagers;
import org.opendaylight.infrautils.caches.CacheProvider;
import org.opendaylight.infrautils.caches.baseimpl.CacheManagersRegistry;
import org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl;
import org.opendaylight.infrautils.caches.standard.StandardCacheProvider;

/**
 * Guice Module for tests requiring a CacheProvider.
 *
 * @author Michael Vorburger.ch
 * @deprecated This interface will be retired as part of https://jira.opendaylight.org/browse/INFRAUTILS-82
 */
@Deprecated(since = "2.0.7", forRemoval = true)
public class CacheModule extends AbstractModule {

    private final Class providerClass;

    public CacheModule() {
        this(StandardCacheProvider.class);
    }

    public CacheModule(Class providerClass) {
        this.providerClass = providerClass;
    }

    @Override
    protected void configure() {
        bind(CacheProvider.class).to(providerClass);

        CacheManagersRegistry monitor = new CacheManagersRegistryImpl();
        bind(CacheManagersRegistry.class).toInstance(monitor);
        bind(CacheManagers.class).toInstance(monitor);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy