// Path: gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/shared/Utils.java
// public static boolean isHollow(String string) {
// 	return isEmpty(string) || string.matches("^\\s+$");
// }
// 
// Path: gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/client/features/BusyFeatureConsumer.java
// public class BusyFeatureConsumer extends FeatureConsumer<String, Void> implements FeatureCommonConst {
// 	
// 	private static final Logger LOG = Logger.getLogger(BusyFeatureConsumer.class.getName());
// 	
// 	private static BusyFeatureConsumer instance;
// 	
// 	public static BusyFeatureConsumer get() {
// 		if (instance == null)
// 			instance = new BusyFeatureConsumer();
// 		return instance;
// 	}
// 
// 	private BusyFeatureConsumer() {
// 		LOG.info("BusyFeatureConsumer: instantiated");
// 	}
// 	
// 	@Override
// 	public String getType() {
// 		return FEATURE_BUSY;
// 	}
// 
// 	@Override
// 	public String getModuleName() {
// 		return MODULE_HOST;
// 	}
// 	
// 	public void call(boolean busy) {
// 		LOG.info("BusyFeatureConsumer.call: busy=" + busy);
// 		call(Boolean.toString(busy), null);
// 	}
// }
// 
// Path: gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/client/services/BusyEvent.java
// public interface BusyHandler extends EventHandler {
// 
// 	void onChange(BusyEvent event);
// }
// 
// Path: gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/client/services/BusyEvent.java
// public interface HasBusyHandlers extends HasHandlers {
// 
// 	HandlerRegistration addBusyHandler(BusyHandler handler);
// }


import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.rpc.AsyncCallback;
import static org.gwt.dynamic.common.shared.Utils.isHollow;
import java.util.logging.Logger;
import org.fusesource.restygwt.client.Method;
import org.fusesource.restygwt.client.MethodCallback;
import org.fusesource.restygwt.client.Resource;
import org.fusesource.restygwt.client.RestService;
import org.fusesource.restygwt.client.RestServiceProxy;
import org.gwt.dynamic.common.client.features.BusyFeatureConsumer;
import org.gwt.dynamic.common.client.services.BusyEvent.BusyHandler;
import org.gwt.dynamic.common.client.services.BusyEvent.HasBusyHandlers;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.GwtEvent;
		if (!$wnd.__config || !$wnd.__config[moduleName]) return null;
		return $wnd.__config[moduleName].service_url;
	}-*/;
	
	public static String getServiceUrl() {
		String result = GWT.isProdMode() ? getServiceUrl0(GWT.getModuleName()) : null;
		if (isHollow(result)) result = GWT.getHostPageBaseURL() + REST_ROOT_PATH;
		return result;
	}

	protected AbstractServiceConsumer(R rest) {
		if (rest == null) throw new IllegalArgumentException("Rest service cannot be a null");
		this.rest = rest;
		RestServiceProxy restProxy = (RestServiceProxy) this.rest;
		String serviceUrl = getServiceUrl();
		String resourceUrl = restProxy.getResource().getUri();
		if (resourceUrl.startsWith(GWT.getModuleBaseURL()))
			serviceUrl += resourceUrl.substring(GWT.getModuleBaseURL().length() - 1);
		LOG.info("AbstractServiceConsumer: resourceUrl=" + resourceUrl + "; serviceUrl=" + serviceUrl);
		restProxy.setResource(new Resource(serviceUrl));
	}

	private void setBusy(boolean busy) {
		LOG.info("AbstractServiceConsumer.setBusy: busy=" + busy);
		fireEvent(new BusyEvent(busy));
		BusyFeatureConsumer.get().call(busy);
	}

	@Override
	public void fireEvent(GwtEvent<?> event) {
// Path: gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/shared/Utils.java
// public static boolean isHollow(String string) {
// 	return isEmpty(string) || string.matches("^\\s+$");
// }
// 
// Path: gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/client/features/BusyFeatureConsumer.java
// public class BusyFeatureConsumer extends FeatureConsumer<String, Void> implements FeatureCommonConst {
// 	
// 	private static final Logger LOG = Logger.getLogger(BusyFeatureConsumer.class.getName());
// 	
// 	private static BusyFeatureConsumer instance;
// 	
// 	public static BusyFeatureConsumer get() {
// 		if (instance == null)
// 			instance = new BusyFeatureConsumer();
// 		return instance;
// 	}
// 
// 	private BusyFeatureConsumer() {
// 		LOG.info("BusyFeatureConsumer: instantiated");
// 	}
// 	
// 	@Override
// 	public String getType() {
// 		return FEATURE_BUSY;
// 	}
// 
// 	@Override
// 	public String getModuleName() {
// 		return MODULE_HOST;
// 	}
// 	
// 	public void call(boolean busy) {
// 		LOG.info("BusyFeatureConsumer.call: busy=" + busy);
// 		call(Boolean.toString(busy), null);
// 	}
// }
// 
// Path: gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/client/services/BusyEvent.java
// public interface BusyHandler extends EventHandler {
// 
// 	void onChange(BusyEvent event);
// }
// 
// Path: gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/client/services/BusyEvent.java
// public interface HasBusyHandlers extends HasHandlers {
// 
// 	HandlerRegistration addBusyHandler(BusyHandler handler);
// }


// Path: gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/client/services/AbstractServiceConsumer.java
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.rpc.AsyncCallback;
import static org.gwt.dynamic.common.shared.Utils.isHollow;
import java.util.logging.Logger;
import org.fusesource.restygwt.client.Method;
import org.fusesource.restygwt.client.MethodCallback;
import org.fusesource.restygwt.client.Resource;
import org.fusesource.restygwt.client.RestService;
import org.fusesource.restygwt.client.RestServiceProxy;
import org.gwt.dynamic.common.client.features.BusyFeatureConsumer;
import org.gwt.dynamic.common.client.services.BusyEvent.BusyHandler;
import org.gwt.dynamic.common.client.services.BusyEvent.HasBusyHandlers;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.GwtEvent;

		if (!$wnd.__config || !$wnd.__config[moduleName]) return null;
		return $wnd.__config[moduleName].service_url;
	}-*/;
	
	public static String getServiceUrl() {
		String result = GWT.isProdMode() ? getServiceUrl0(GWT.getModuleName()) : null;
		if (isHollow(result)) result = GWT.getHostPageBaseURL() + REST_ROOT_PATH;
		return result;
	}

	protected AbstractServiceConsumer(R rest) {
		if (rest == null) throw new IllegalArgumentException("Rest service cannot be a null");
		this.rest = rest;
		RestServiceProxy restProxy = (RestServiceProxy) this.rest;
		String serviceUrl = getServiceUrl();
		String resourceUrl = restProxy.getResource().getUri();
		if (resourceUrl.startsWith(GWT.getModuleBaseURL()))
			serviceUrl += resourceUrl.substring(GWT.getModuleBaseURL().length() - 1);
		LOG.info("AbstractServiceConsumer: resourceUrl=" + resourceUrl + "; serviceUrl=" + serviceUrl);
		restProxy.setResource(new Resource(serviceUrl));
	}

	private void setBusy(boolean busy) {
		LOG.info("AbstractServiceConsumer.setBusy: busy=" + busy);
		fireEvent(new BusyEvent(busy));
		BusyFeatureConsumer.get().call(busy);
	}

	@Override
	public void fireEvent(GwtEvent<?> event) {
		if (handlerManager != null)