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

io.bigdime.core.AdaptorContextImpl Maven / Gradle / Ivy

There is a newer version: 0.9.3
Show newest version
/**
 * Copyright (C) 2015 Stubhub.
 */
package io.bigdime.core;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * Singleton implementation of {@link AdaptorContext} interface. Provides the
 * information about the Adaptor.
 * 
 * @author Neeraj Jain
 *
 */
public final class AdaptorContextImpl implements AdaptorContext {
	private String name;
	private Collection sources;
	private Collection sinks;
	private Collection channels;

	private static AdaptorContext instance = new AdaptorContextImpl();

	public static AdaptorContext getInstance() {
		return instance;
	}

	private AdaptorContextImpl() {
	}

	@Override
	public void setAdaptorName(String name) {
		this.name = name;
	}

	@Override
	public String getAdaptorName() {
		return name;
	}

	@Override
	public Collection getSources() {
		return sources;
	}

	@Override
	public Collection getSinks() {
		return sinks;
	}

	@Override
	public Collection getChannels() {
		return channels;
	}

	@Override
	public void setSources(Collection sources) {
		this.sources = sources;
	}

	@Override
	public void setSinks(Collection sinks) {
		this.sinks = sinks;
	}

	@Override
	public void setChannels(Collection channels) {
		this.channels = channels;
	}

	@Override
	public Map getChannelMap() {
		final Map channelMap = new HashMap<>();
		for (DataChannel channel : getChannels()) {
			channelMap.put(channel.getName(), channel);
		}
		return channelMap;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy