/*
  @Override
  protected TaskResult createReference(Connection connection) throws Exception {
  			if (!resultsFile.exists()) throw new ResourceException(Status.SERVER_ERROR_INTERNAL,"No results available!");
  			try {

  				RemoteTask task = new RemoteTask(new Reference(dataset_service),MediaType.TEXT_URI_LIST,
  						new FileRepresentation(resultsFile,MediaType.APPLICATION_RDF_XML),Method.POST);
  				//wait to complete, so that we can delete the tmp file
  				Thread.sleep(200);
  				while (!task.isDone()) {
  					task.poll();
  					Thread.sleep(800);
  					Thread.yield();
  				}
  				if (task.isERROR())
  					throw task.getError();
  				else
  					return new TaskResult(task.getResult().toString());
  			} catch (Exception x) {
  				throw x;
  			} finally {
  				try { if (resultsFile.exists()) resultsFile.delete();} catch (Exception x) {}
  				try { if (target.exists()) target.delete();} catch (Exception x) {}
  			}
  		return null;
  }
  */
  @Override
  protected ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor> createProcessors()
      throws Exception {
    ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor> p1 =
        new ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor>();

    IProcessor<IStructureRecord, IStructureRecord> writer = getWriter();
    if (writer != null) p1.add(writer);

    return p1;
  }
  protected ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor> createProcessors()
      throws Exception {

    ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor> p1 =
        new ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor>();

    p1.add(new ProcessorStructureRetrieval());
    p1.add(new MoleculeReader());
    p1.add(new FingerprintGenerator(new Fingerprinter()));
    p1.add(
        new DefaultAmbitProcessor<BitSet, BitSet>() {
          /** */
          private static final long serialVersionUID = -2978697147490545478L;

          public BitSet process(BitSet target) throws AmbitException {
            builder.getTrainingData().add(target);
            return target;
          }
        });
    p1.setAbortOnError(true);

    return p1;
  }