@Override
	public List runBulkJobs(org.ggf.drmaa.JobTemplate jobTemplate, int start,
			int end, int incr) throws DrmaaException {
		if (jobTemplate == null) {
			throw new InvalidJobTemplateException(
					"The passed Job Template must not be null.");
		}
		if (!(jobTemplate instanceof JobTemplate)) {
			throw new InvalidJobTemplateException("Invalid Job Template. "
					+ "Use createJobTemplate() to allocate new Job Template");
		}
		JobTemplate jt = (JobTemplate) jobTemplate;
		Buffer eb = newErrorBuffer();
		Pointer<Pointer<DrmaaC.drmaa_job_ids_s>> jIdsPointer = Pointer
				.allocatePointer(DrmaaC.drmaa_job_ids_s.class);
		int result = drmaa_run_bulk_jobs(
				jIdsPointer,
				jt.getJtPointer().get(),
				start,
				end,
				incr,
				eb.getPointer(),
				eb.getLength());
		if (result != DRMAA_ERRNO_SUCCESS) {
			String errorMessage = eb.toString();
			DrmaaException e;
			switch (result) {
			case DRMAA_ERRNO_NO_ACTIVE_SESSION:
				e = new NoActiveSessionException(errorMessage);
				break;
			case DRMAA_ERRNO_TRY_LATER:
				e = new TryLaterException(errorMessage);
				break;
			case DRMAA_ERRNO_DENIED_BY_DRM:
				e = new DeniedByDrmException(errorMessage);
				break;
			default:
				e = new PlainDrmaaException(errorMessage);
				break;
			}
			throw e;
		}
		List<String> jobIdsList = Collections.emptyList();
		Pointer<SizeT> numOfJobsPt = allocateSizeT();
		drmaa_get_num_job_ids(jIdsPointer.get(), numOfJobsPt);
		int numOfJobs = numOfJobsPt.get().intValue();
		if (numOfJobs > 0) {
			jobIdsList = new ArrayList<String>(numOfJobs);
			int nextJidResult;
			do {
				Buffer jib = newJobIdBuffer();
				nextJidResult = drmaa_get_next_job_id(
						jIdsPointer.get(),
						jib.getPointer(),
						jib.getLength());
				jobIdsList.add(jib.toString());
			} while (nextJidResult != DRMAA_ERRNO_NO_MORE_ELEMENTS);
			drmaa_release_job_ids(jIdsPointer.get());
		}
		return jobIdsList;
	}