package org.kne.cloud.network;

import java.net.DatagramSocket;

import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;

public class SocketType {
	private SocketFactory socketFactory;
	private ServerSocketFactory serverSocketFactory;

	private SocketChannelFactory socketChannelFactory;
	private ServerSocketChannelFactory serverSocketChannelFactory;
	
	private DatagramSocketFactory datagramSocketFactory;
	private DatagramServerSocketFactory datagramServerSocketFactory;
	private boolean stream;
	private int defaultPort=-1;
	
	public SocketFactory Channel() {
		return socketFactory;
	}

	public ServerSocketFactory getServerSocketFactory() {
		return serverSocketFactory;
	}

	public DatagramSocketFactory getDatagramSocketFactory() {
		return datagramSocketFactory;
	}
	

	public SocketChannelFactory getSocketChannelFactory() {
		return socketChannelFactory;
	}

	public ServerSocketChannelFactory getServerSocketChannelFactory() {
		return serverSocketChannelFactory;
	}

	public SocketFactory getSocketFactory() {
		return socketFactory;
	}

	public DatagramServerSocketFactory getDatagramServerSocketFactory() {
		return datagramServerSocketFactory;
	}
	
	public SocketType(SocketFactory socketFactory, ServerSocketFactory serverSocketFactory,
			SocketChannelFactory socketChannelFactory, ServerSocketChannelFactory serverSocketChannelFactory) {
		super();
		this.socketFactory = socketFactory;
		this.serverSocketFactory = serverSocketFactory;
		this.socketChannelFactory = socketChannelFactory;
		this.serverSocketChannelFactory = serverSocketChannelFactory;
		this.stream=true;
	}

	public SocketType(SocketFactory socketFactory, ServerSocketFactory serverSocketFactory) {
		super();
		this.socketFactory = socketFactory;
		this.serverSocketFactory = serverSocketFactory;
		this.stream=true;
	}

	public SocketType(DatagramSocketFactory datagramSocketFactory,
			DatagramServerSocketFactory datagramServerSocketFactory) {
		super();
		this.datagramSocketFactory = datagramSocketFactory;
		this.datagramServerSocketFactory = datagramServerSocketFactory;
		this.stream=false;
	}

	public boolean isStream() {
		return stream;
	}

	public int getDefaultPort(){
		return defaultPort;
	}
}
