package com.customsource;

import org.apache.flink.api.connector.source.Boundedness;
import org.apache.flink.api.connector.source.Source;
import org.apache.flink.api.connector.source.SourceReader;
import org.apache.flink.api.connector.source.SourceReaderContext;
import org.apache.flink.api.connector.source.SplitEnumerator;
import org.apache.flink.api.connector.source.SplitEnumeratorContext;
import org.apache.flink.core.io.SimpleVersionedSerializer;

/**
 * A source function that reads strings from a socket. The source will read
 * bytes from the socket stream and convert them to characters, each byte
 * individually. When the delimiter character is received, the function will
 * output the current string, and begin a new string.
 *
 * <p>
 * The function strips trailing <i>carriage return</i> characters (\r) when the
 * delimiter is the newline character (\n).
 *
 * <p>
 * The function can be set to reconnect to the server socket in case that the
 * stream is closed on the server side.
 */
public class SSLServerCustomSocketStreamFunction_Copy implements Source<String, SocketAsSplit, SocketAsEnum> {	

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public Boundedness getBoundedness() {
		// TODO Auto-generated method stub
		return Boundedness.CONTINUOUS_UNBOUNDED;
	}

	@Override
	public SourceReader<String, SocketAsSplit> createReader(SourceReaderContext paramSourceReaderContext)
			throws Exception {
		// TODO Auto-generated method stub
		return new SocketReader();
	}

	@Override
	public SplitEnumerator<SocketAsSplit, SocketAsEnum> createEnumerator(
			SplitEnumeratorContext<SocketAsSplit> paramSplitEnumeratorContext) throws Exception {
		// TODO Auto-generated method stub
		return new SocketEnumerator(9999, paramSplitEnumeratorContext);
	}

	@Override
	public SplitEnumerator<SocketAsSplit, SocketAsEnum> restoreEnumerator(
			SplitEnumeratorContext<SocketAsSplit> paramSplitEnumeratorContext, SocketAsEnum paramEnumChkT)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public SimpleVersionedSerializer<SocketAsSplit> getSplitSerializer() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public SimpleVersionedSerializer<SocketAsEnum> getEnumeratorCheckpointSerializer() {
		// TODO Auto-generated method stub
		return null;
	}
	
		
}
