// Path: src/main/java/com/inovex/zabbixmobile/exceptions/ZabbixLoginRequiredException.java
// public class ZabbixLoginRequiredException extends Exception {
// 
// 	private static final long serialVersionUID = 537466652124519153L;
// 
// 	public ZabbixLoginRequiredException() {
// 
// 	}
// 
// 	public ZabbixLoginRequiredException(Throwable t) {
// 		super(t);
// 	}
// }


import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import com.inovex.zabbixmobile.R;
import com.inovex.zabbixmobile.exceptions.FatalException;
import com.inovex.zabbixmobile.exceptions.FatalException.Type;
import com.inovex.zabbixmobile.exceptions.ZabbixLoginRequiredException;
/*
This file is part of ZAX.

	ZAX is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	ZAX is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with ZAX.  If not, see <http://www.gnu.org/licenses/>.
*/

package com.inovex.zabbixmobile.data;



/**
 * Represents an asynchronous Zabbix API call. This handles
 * {@link ZabbixLoginRequiredException} by retrying the API call and
 * {@link FatalException} by sending a broadcast containing the error message to
 * be displayed by the UI.
 * 
 */
public abstract class RemoteAPITask extends AsyncTask<Void, Integer, Void> {

	private static final String TAG = RemoteAPITask.class.getSimpleName();
	private final ZabbixRemoteAPI api;
	private Context context;
	private FatalException ex = null;

	public RemoteAPITask(ZabbixRemoteAPI api, Context context) {
		this.api = api;
		this.context = context;
	}

	@Override
	protected Void doInBackground(Void... params) {
		try {
			executeTask();
// Path: src/main/java/com/inovex/zabbixmobile/exceptions/ZabbixLoginRequiredException.java
// public class ZabbixLoginRequiredException extends Exception {
// 
// 	private static final long serialVersionUID = 537466652124519153L;
// 
// 	public ZabbixLoginRequiredException() {
// 
// 	}
// 
// 	public ZabbixLoginRequiredException(Throwable t) {
// 		super(t);
// 	}
// }


// Path: src/main/java/com/inovex/zabbixmobile/data/RemoteAPITask.java
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import com.inovex.zabbixmobile.R;
import com.inovex.zabbixmobile.exceptions.FatalException;
import com.inovex.zabbixmobile.exceptions.FatalException.Type;
import com.inovex.zabbixmobile.exceptions.ZabbixLoginRequiredException;

/*
This file is part of ZAX.

	ZAX is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	ZAX is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with ZAX.  If not, see <http://www.gnu.org/licenses/>.
*/

package com.inovex.zabbixmobile.data;



/**
 * Represents an asynchronous Zabbix API call. This handles
 * {@link ZabbixLoginRequiredException} by retrying the API call and
 * {@link FatalException} by sending a broadcast containing the error message to
 * be displayed by the UI.
 * 
 */
public abstract class RemoteAPITask extends AsyncTask<Void, Integer, Void> {

	private static final String TAG = RemoteAPITask.class.getSimpleName();
	private final ZabbixRemoteAPI api;
	private Context context;
	private FatalException ex = null;

	public RemoteAPITask(ZabbixRemoteAPI api, Context context) {
		this.api = api;
		this.context = context;
	}

	@Override
	protected Void doInBackground(Void... params) {
		try {
			executeTask();
		} catch (ZabbixLoginRequiredException e) {