// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java
// public interface IConnection {
// 
// 	public void setConfig(Object object);
// 	
// 	
// 	public void connect() throws Exception;
// 	public void disconnect() throws Exception;
// 	
// 	public void setListener(IConnectionListener listener);
// 	public Object send(Object object) throws Exception;
// 	
// }
// 
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java
// public interface IConnectionListener {
// 
// 	public void receive(Object object) throws Exception;
// }
// 
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java
// public interface IDevice {
// 
// 	public void setConfig(Object object);
// 	public void setEnvironments(IEnvironments environments);
// 	
// 	public void setup() throws Exception;
// 	public void start() throws Exception;
// 	public void stop() throws Exception;
// 	public void teardown() throws Exception;
// 	
// 	public void step() throws Exception;
// 	
// }
// 
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java
// public interface IEnvironments {
// 
// 	public void setup(String environment) throws Exception;
// 	public void start(String environment) throws Exception;
// 	public void stop(String environment) throws Exception;
// 	public void teardown(String environment) throws Exception;
// 	
// 	
// 	public void registerConnectionFactory(String name, IConnectionFactory factory); 
// 	public void deregisterConnectionFactory(String name);
// 	public IConnection getConnection(String name) throws Exception;
// 	
// 	public void registerDeviceFactory(String name, IDeviceFactory factory); 
// 	public void deregisterDeviceFactory(String name);
// 	public IDevice getDevice(String name) throws Exception;
// 	
// 	
// 	
// }
// 
// Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java
// public class AutoSIMDeviceConfig {
// 
// 	public String name;
// 
// 	public String deviceClassName;
// 	public String connectionName;
// }


import java.util.Random;
import com.automatski.autosim.environments.IConnection;
import com.automatski.autosim.environments.IConnectionListener;
import com.automatski.autosim.environments.IDevice;
import com.automatski.autosim.environments.IEnvironments;
import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;

	@Override
	public void setup() throws Exception {
		// get a connection
		connection = environments.getConnection(config.connectionName);
		connection.setListener(this);
	}


	@Override
	public void start() throws Exception {
		connection.connect();
		
	}

	@Override
	public void step() throws Exception {
		Random rnd = new Random();
		String product = "{\"qty\":"+(1+rnd.nextInt(999))+",\"name\":\"iPad "+(1+rnd.nextInt(6))+"\"}";
		connection.send(product);
	}

	@Override
	public void stop() throws Exception {
		connection.disconnect();
		
	}

	@Override
	public void teardown() throws Exception {
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java
// public interface IConnection {
// 
// 	public void setConfig(Object object);
// 	
// 	
// 	public void connect() throws Exception;
// 	public void disconnect() throws Exception;
// 	
// 	public void setListener(IConnectionListener listener);
// 	public Object send(Object object) throws Exception;
// 	
// }
// 
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java
// public interface IConnectionListener {
// 
// 	public void receive(Object object) throws Exception;
// }
// 
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java
// public interface IDevice {
// 
// 	public void setConfig(Object object);
// 	public void setEnvironments(IEnvironments environments);
// 	
// 	public void setup() throws Exception;
// 	public void start() throws Exception;
// 	public void stop() throws Exception;
// 	public void teardown() throws Exception;
// 	
// 	public void step() throws Exception;
// 	
// }
// 
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java
// public interface IEnvironments {
// 
// 	public void setup(String environment) throws Exception;
// 	public void start(String environment) throws Exception;
// 	public void stop(String environment) throws Exception;
// 	public void teardown(String environment) throws Exception;
// 	
// 	
// 	public void registerConnectionFactory(String name, IConnectionFactory factory); 
// 	public void deregisterConnectionFactory(String name);
// 	public IConnection getConnection(String name) throws Exception;
// 	
// 	public void registerDeviceFactory(String name, IDeviceFactory factory); 
// 	public void deregisterDeviceFactory(String name);
// 	public IDevice getDevice(String name) throws Exception;
// 	
// 	
// 	
// }
// 
// Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java
// public class AutoSIMDeviceConfig {
// 
// 	public String name;
// 
// 	public String deviceClassName;
// 	public String connectionName;
// }


// Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyRestDevice.java
import java.util.Random;
import com.automatski.autosim.environments.IConnection;
import com.automatski.autosim.environments.IConnectionListener;
import com.automatski.autosim.environments.IDevice;
import com.automatski.autosim.environments.IEnvironments;
import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;


	@Override
	public void setup() throws Exception {
		// get a connection
		connection = environments.getConnection(config.connectionName);
		connection.setListener(this);
	}


	@Override
	public void start() throws Exception {
		connection.connect();
		
	}

	@Override
	public void step() throws Exception {
		Random rnd = new Random();
		String product = "{\"qty\":"+(1+rnd.nextInt(999))+",\"name\":\"iPad "+(1+rnd.nextInt(6))+"\"}";
		connection.send(product);
	}

	@Override
	public void stop() throws Exception {
		connection.disconnect();
		
	}

	@Override
	public void teardown() throws Exception {
		connection.setListener(null);