// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/fsm/ContextWrapper.java
// public class ContextWrapper<CT> {
// 	
// 	private CT context;
// 	
// 	public ContextWrapper(CT context) {
// 		this.context = context;
// 	}
// 
// 	public CT getContext() {
// 		return context;
// 	}
// }
// 
// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/FSMHarness.java
// public interface FSMHarness {
// 
// 	public Object onEvent(String event, Object id, Object[] parms) throws TooBusyException;
// 
// 	public Object onEvent(String event, Object[] parms) throws TooBusyException, InstantiationException;
// 
// }
// 
// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/Factory.java
// public interface Factory<T, CT> {
// 	
// 	/**
// 	 * Called to create an instance of the StatefulEntity
// 	 * 
// 	 * @param clazz The type of the StatefulEntity
// 	 * @param event The incoming Event
// 	 * @param context The Request Context
// 	 * @return A new instance of the StatefulEntity
// 	 */
// 	T create(Class<T> clazz, String event, CT context);
// 
// }
// 
// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/Finder.java
// public interface Finder<T, CT> {
// 
// 	/**
// 	 * This find method is invoked when no Id can be determined from the input from the EndpointBinder.
// 	 * 
// 	 * @param clazz The Class of the Stateful Event
// 	 * @param event The Event
// 	 * @param context The Request Context
// 	 * 
// 	 * @return The Stateful Entity
// 	 */
// 	T find(Class<T> clazz, String event, CT context);
// 	
// 	/**
// 	 * @param clazz
// 	 * @param id
// 	 * @param event
// 	 * @param context
// 	 * @return
// 	 */
// 	T find(Class<T> clazz, Object id, String event, CT context);
// 	
// }
// 
// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/StatefulFSM.java
// public interface StatefulFSM<T> {
// 	
// 	/**
// 	 * Pass an event to the FSM for a non-existent Stateful Entity.  The StatefulJ framework will instiate a 
// 	 * new Stateful Event by invoking the {@link Factory}
// 	 * 
// 	 * @param event the Event
// 	 * @param parms Optional parameters passed into the Action method
// 	 * @return the returned Object from the Action Method
// 	 * @throws TooBusyException thrown if the FSM cannot process the event
// 	 */
// 	Object onEvent(String event, Object... parms)  throws TooBusyException ;
// 
// 	/**
// 	 * Pass an event to the FSM for existing Stateful Entity
// 	 * 
// 	 * @param stateful the Stateful Entity
// 	 * @param event the Event
// 	 * @param parms Optional parameters passed into the Action method
// 	 * @return the returned Object from the Action Method
// 	 * @throws TooBusyException thrown if the FSM cannot process the event
// 	 */
// 	Object onEvent(T stateful, String event, Object... parms)  throws TooBusyException ;
// 
// }
// 
// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/TooBusyException.java
// public class TooBusyException extends Exception {
// 
// 	private static final long serialVersionUID = 1L;
// 
// }


import java.util.ArrayList;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.statefulj.framework.core.fsm.ContextWrapper;
import org.statefulj.framework.core.model.FSMHarness;
import org.statefulj.framework.core.model.Factory;
import org.statefulj.framework.core.model.Finder;
import org.statefulj.framework.core.model.StatefulFSM;
import org.statefulj.fsm.TooBusyException;
/***
 * 
 * Copyright 2014 Andrew Hall
 *
 * 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 org.statefulj.framework.core.model.impl;



public class FSMHarnessImpl<T, CT> implements FSMHarness {
	
	private static final Logger logger = LoggerFactory.getLogger(FSMHarnessImpl.class);
	
	private Factory<T, CT> factory;
	
// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/fsm/ContextWrapper.java
// public class ContextWrapper<CT> {
// 	
// 	private CT context;
// 	
// 	public ContextWrapper(CT context) {
// 		this.context = context;
// 	}
// 
// 	public CT getContext() {
// 		return context;
// 	}
// }
// 
// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/FSMHarness.java
// public interface FSMHarness {
// 
// 	public Object onEvent(String event, Object id, Object[] parms) throws TooBusyException;
// 
// 	public Object onEvent(String event, Object[] parms) throws TooBusyException, InstantiationException;
// 
// }
// 
// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/Factory.java
// public interface Factory<T, CT> {
// 	
// 	/**
// 	 * Called to create an instance of the StatefulEntity
// 	 * 
// 	 * @param clazz The type of the StatefulEntity
// 	 * @param event The incoming Event
// 	 * @param context The Request Context
// 	 * @return A new instance of the StatefulEntity
// 	 */
// 	T create(Class<T> clazz, String event, CT context);
// 
// }
// 
// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/Finder.java
// public interface Finder<T, CT> {
// 
// 	/**
// 	 * This find method is invoked when no Id can be determined from the input from the EndpointBinder.
// 	 * 
// 	 * @param clazz The Class of the Stateful Event
// 	 * @param event The Event
// 	 * @param context The Request Context
// 	 * 
// 	 * @return The Stateful Entity
// 	 */
// 	T find(Class<T> clazz, String event, CT context);
// 	
// 	/**
// 	 * @param clazz
// 	 * @param id
// 	 * @param event
// 	 * @param context
// 	 * @return
// 	 */
// 	T find(Class<T> clazz, Object id, String event, CT context);
// 	
// }
// 
// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/StatefulFSM.java
// public interface StatefulFSM<T> {
// 	
// 	/**
// 	 * Pass an event to the FSM for a non-existent Stateful Entity.  The StatefulJ framework will instiate a 
// 	 * new Stateful Event by invoking the {@link Factory}
// 	 * 
// 	 * @param event the Event
// 	 * @param parms Optional parameters passed into the Action method
// 	 * @return the returned Object from the Action Method
// 	 * @throws TooBusyException thrown if the FSM cannot process the event
// 	 */
// 	Object onEvent(String event, Object... parms)  throws TooBusyException ;
// 
// 	/**
// 	 * Pass an event to the FSM for existing Stateful Entity
// 	 * 
// 	 * @param stateful the Stateful Entity
// 	 * @param event the Event
// 	 * @param parms Optional parameters passed into the Action method
// 	 * @return the returned Object from the Action Method
// 	 * @throws TooBusyException thrown if the FSM cannot process the event
// 	 */
// 	Object onEvent(T stateful, String event, Object... parms)  throws TooBusyException ;
// 
// }
// 
// Path: statefulj-fsm/src/main/java/org/statefulj/fsm/TooBusyException.java
// public class TooBusyException extends Exception {
// 
// 	private static final long serialVersionUID = 1L;
// 
// }


// Path: statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/model/impl/FSMHarnessImpl.java
import java.util.ArrayList;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.statefulj.framework.core.fsm.ContextWrapper;
import org.statefulj.framework.core.model.FSMHarness;
import org.statefulj.framework.core.model.Factory;
import org.statefulj.framework.core.model.Finder;
import org.statefulj.framework.core.model.StatefulFSM;
import org.statefulj.fsm.TooBusyException;

/***
 * 
 * Copyright 2014 Andrew Hall
 *
 * 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 org.statefulj.framework.core.model.impl;



public class FSMHarnessImpl<T, CT> implements FSMHarness {
	
	private static final Logger logger = LoggerFactory.getLogger(FSMHarnessImpl.class);
	
	private Factory<T, CT> factory;
	
	private Finder<T, CT> finder;