/*******************************************************************************
 *  Copyright 2017-2018 Centre for Development of Advanced Computing(C-DAC), Pune
 *  
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  
 *   http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package cdac.medinfo.sdk.dcm30_04.services.scp.commons;

import java.io.IOException;

import cdac.medinfo.sdk.dcm30_04.exceptions.DicomException;
import cdac.medinfo.sdk.dcm30_04.services.dicomnetcommons.EnumErrorCode;
/**
 * The Process Handler interface for processing user request.
 * The implementor of this interface should provide the implementation of methods
 * to process user request.
 */
public interface IProcessHandler
{
	
	/**
	 * Accept connection.
	 * 
	 * @param objClientSession object of Client Session.
	 */
	public void onConnect(ClientSession objClientSession);

	/**
	 * Process association.
	 * 
	 * @param objClientSession object of client session.
	 * 
	 * @throws IOException Signals that an IO Exception occurs.
	 */
	public void onAssociateReceive(ClientSession objClientSession);

	/**
	 * Process service request.
	 * 
	 * @param objClientSession object of Client Session.
	 * 
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	public void onServiceRequest(ClientSession objClientSession) throws IOException;
	
	/**
	 * Closess the Connection.
	 * @param objClientSession object of Client Session.
	 */
	public void onClose(ClientSession objClientSession);
	
	/**
	 * Gets automatically invoked when exception occur while processing  data received  
	 * @param objClientSession - object of Client Session.
	 * @param ex - the exception object
	 * @param ErrorCode - the reason of the DicomException
	 */
	public void onException(ClientSession objClientSession,DicomException ex,EnumErrorCode ErrorCode);
}
