@Override
	public void refreshMachineState(IMachine machine) throws InvalidObjectException, ConnectorException {
		try {
			String vmName = machine.getName();
			MachineState currentState = machine.getState();
			VappClient vApp = VappClientLocator.getInstance().getVApp(machine, controllerServices);
			
			if(currentState == MachineState.STARTING) 
			{
				if(vApp.isPoweredOn(vmName))
				{
					machine.setState(MachineState.STARTED);
					// installs vm tools
//					vApp.updateVm(machine);
				} 
				else 
				{
					vApp.powerOn(vmName);
				}
			}
			
			else if(currentState == MachineState.STOPPING)
			{
				if(vApp.isPoweredOn(vmName))
				{
					vApp.shutDown(machine);
					machine.setState(MachineState.STOPPED);
				}
				else 
				{
					machine.setState(MachineState.STOPPED);
				}
			}
		}
		catch(Exception e){
			throw new ConnectorException("Failed to retrieve vm status: ", e);
		}
	}