package com.kbstar.eai.flowcontrol.action;

import com.eactive.eai.flowcontrol.action.RouteActionException;
import com.eactive.eai.flowcontrol.action.RouteActionSupport;
import com.eactive.eai.transformer.util.IConv;

public class KUKAdapterRouteAction extends RouteActionSupport  {
	
	public String[] getRouteKeys(byte[] message) throws Exception {
		// 
		String[] keys = new String[1];
		int keyIndex = 0;
		try {
			//keys[0] = strncpy(message, 0, 1) + strncpy(message, 53, 2);
			byte[] resBytes = new byte[2];
			System.arraycopy(message, 1, resBytes, 0, resBytes.length );
			keys[0] = IConv.ebcdicToASCII(resBytes);
		} catch(Exception e) {
			throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
		}
        return keys;        
	}
	
	public String getDescription() {
		return "키추출방식 : 전문 [1,2]";
	}
}
