// Path: library/src/main/java/de/tubs/ibr/dtn/api/ServiceNotAvailableException.java
// public class ServiceNotAvailableException extends Exception {
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 876730276266296815L;
// 	
// 	public ServiceNotAvailableException() {}
// 
//     public ServiceNotAvailableException(Exception innerException) {
//         this.innerException = innerException;
//     }
//     
// 	public ServiceNotAvailableException(String what) {
// 		this.what = null;
// 	}
// 	
//     @Override
// 	public String toString() {
//     	if ((innerException == null) && (what == null)) return super.toString();
//     	return "ServiceNotAvailableException: " + ((innerException == null) ? what : innerException.toString());
// 	}
// 
// 	public Exception innerException = null;
//     public String what = null;
// }


import java.util.List;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.net.Uri;
import de.tubs.ibr.dtn.api.ServiceNotAvailableException;
		private final String mClassName;
		private final Integer mVersion;
		
		private Service(String className, Integer version) {
			mClassName = className;
			mVersion = version;
		}
		
		public String getClassName() {
			return mClassName;
		}
		
		public Integer getVersion() {
			return mVersion;
		}
		
		public Intent getIntent(Context context, String action) throws ServiceNotAvailableException {
			Intent queryIntent = new Intent(mClassName);
			List<ResolveInfo> list = context.getPackageManager().queryIntentServices(queryIntent, 0);
			if (list.size() == 0) throw new ServiceNotAvailableException();
			
			// get the first found service
			ServiceInfo serviceInfo = list.get(0).serviceInfo;
			
			// create bind intent to the first service
			Intent intent = new Intent(action);
			intent.setClassName(serviceInfo.packageName, serviceInfo.name);
			return intent;
		}
		
// Path: library/src/main/java/de/tubs/ibr/dtn/api/ServiceNotAvailableException.java
// public class ServiceNotAvailableException extends Exception {
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 876730276266296815L;
// 	
// 	public ServiceNotAvailableException() {}
// 
//     public ServiceNotAvailableException(Exception innerException) {
//         this.innerException = innerException;
//     }
//     
// 	public ServiceNotAvailableException(String what) {
// 		this.what = null;
// 	}
// 	
//     @Override
// 	public String toString() {
//     	if ((innerException == null) && (what == null)) return super.toString();
//     	return "ServiceNotAvailableException: " + ((innerException == null) ? what : innerException.toString());
// 	}
// 
// 	public Exception innerException = null;
//     public String what = null;
// }


// Path: library/src/main/java/de/tubs/ibr/dtn/Services.java
import java.util.List;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.net.Uri;
import de.tubs.ibr.dtn.api.ServiceNotAvailableException;

		private final String mClassName;
		private final Integer mVersion;
		
		private Service(String className, Integer version) {
			mClassName = className;
			mVersion = version;
		}
		
		public String getClassName() {
			return mClassName;
		}
		
		public Integer getVersion() {
			return mVersion;
		}
		
		public Intent getIntent(Context context, String action) throws ServiceNotAvailableException {
			Intent queryIntent = new Intent(mClassName);
			List<ResolveInfo> list = context.getPackageManager().queryIntentServices(queryIntent, 0);
			if (list.size() == 0) throw new ServiceNotAvailableException();
			
			// get the first found service
			ServiceInfo serviceInfo = list.get(0).serviceInfo;
			
			// create bind intent to the first service
			Intent intent = new Intent(action);
			intent.setClassName(serviceInfo.packageName, serviceInfo.name);
			return intent;
		}
		
		public void bind(Context context, ServiceConnection conn, int flags) throws ServiceNotAvailableException {