Package gnu.hylafax

Examples of gnu.hylafax.HylaFAXClient


    Job<?> ioJob = new Job() {
      public Object run(ProgressMonitor monitor) throws Exception
      {
        monitor.setTotalSteps(3);
       
        HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
        monitor.work(1);

        monitor.setText(i18n.tr("Retrying job"));
        gnu.hylafax.Job editJob = client.getJob(jobID);
        client.suspend(editJob);
        editJob.setProperty("SENDTIME", "NOW");
        monitor.work(1);
       
        client.submit(editJob);
        monitor.work(1);

        return null;
      }
    };
View Full Code Here


    Job<?> ioJob = new Job() {
      public Object run(ProgressMonitor monitor) throws Exception
      {
        monitor.setTotalSteps(2);
       
        HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
        monitor.work(1);

        monitor.setText(i18n.tr("Resuming job"));
        gnu.hylafax.Job editJob = client.getJob(jobID);
        client.submit(editJob);
        monitor.work(1);

        return null;
      }
    };
View Full Code Here

    Job<FileStat[]> ioJob = new Job<FileStat[]>() {
      public FileStat[] run(ProgressMonitor monitor) throws Exception
      {
        monitor.setTotalSteps(2);
       
        HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
        monitor.work(1);

        monitor.setText(i18n.tr("Getting document filenames"));
        gnu.hylafax.Job editJob = client.getJob(jobID);
        String[] filenames = editJob.getDocumentName().split("\n");
       
        List<FileStat> results = new ArrayList<FileStat>(filenames.length);
        for (int i = 0; i < filenames.length; i++) {
          StringTokenizer t = new StringTokenizer(filenames[i]);
          String filetype = t.nextToken();
          if (t.hasMoreTokens() &&
              ("PS".equalsIgnoreCase(filetype) || "PDF".equalsIgnoreCase(filetype))) {
            String filename = t.nextToken();
            try {
              long filesize = client.size(filename);
              results.add(new FileStat(filename, filesize));
            }
            catch (FileNotFoundException e) {
            }
          }
View Full Code Here

    Job<?> ioJob = new Job() {
      public Object run(ProgressMonitor monitor) throws Exception
      {
        monitor.setTotalSteps(2);
        monitor.setText(i18n.tr("Deleting file"));
        HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
        monitor.work(1);
        client.dele(filename);
        monitor.work(1);
        return null;
      }
    };
   
View Full Code Here

    Job<?> ioJob = new Job() {
      public Object run(ProgressMonitor monitor) throws Exception
      {
        monitor.setTotalSteps(12);
       
        HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
        monitor.work(1);
       
        monitor.setText(i18n.tr("Setting mode"));
        client.mode(HylaFAXClient.MODE_STREAM);
        client.type(HylaFAXClient.TYPE_IMAGE);
        monitor.work(1);

        monitor.setText(i18n.tr("Downloading file"));
        TransferMonitor transferMonitor = new TransferMonitor(monitor, 10, size);
        OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
        try {
          client.addTransferListener(transferMonitor);
          client.get(filename, out);
        }
        finally {
          transferMonitor.transferCompleted();
          client.removeTransferListener(transferMonitor);
          out.close();
        }
        // check if monitor was cancelled
        monitor.work(0);
        return null;
View Full Code Here

    Job<?> ioJob = new Job() {
      public Object run(ProgressMonitor monitor) throws Exception
      {
        monitor.setTotalSteps(2);
       
        HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
        monitor.work(1);

        monitor.setText(i18n.tr("Removing job"));
        gnu.hylafax.Job editJob = client.getJob(jobID);
        client.kill(editJob);
        monitor.work(1);

        return null;
      }
    };
View Full Code Here

    Job<?> ioJob = new Job() {
      public Object run(ProgressMonitor monitor) throws Exception
      {
        monitor.setTotalSteps(2);
       
        HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
        monitor.work(1);

        monitor.setText(i18n.tr("Suspending job"));
        gnu.hylafax.Job editJob = client.getJob(jobID);
        client.suspend(editJob);
        monitor.work(1);

        return null;
      }
    };
View Full Code Here

  public static class StatusUpdateJob implements Job<StatusResponse> {
    @SuppressWarnings("unchecked")
    public StatusResponse run(ProgressMonitor monitor) throws Exception {       
      monitor.setTotalSteps(1 + 1 + 5 /* connection + status + queues*/);
     
      HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
      monitor.work(1);
     
      StatusResponse response = new StatusResponse();
     
      monitor.setText(i18n.tr("Getting Status"));
      List<String> lines = client.getList("status");
      StringBuffer sb = new StringBuffer();
      for (Iterator<String> it = lines.iterator(); it.hasNext();) {
        String line = it.next();
        if (response.status == null) {
          response.status = line;
        }
        sb.append(line + "\n");
      }
      response.verboseStatus = sb.toString();
      monitor.work(1);
     
      client.jobfmt(HylaFAXClientHelper.JOBFMT);
      client.rcvfmt(HylaFAXClientHelper.RCVFMT);
      client.filefmt(HylaFAXClientHelper.FILEFMT);
     
      response.recvq = getQueue(monitor, client, "recvq", ReceivedFax.class);
      response.sendq = getQueue(monitor, client, "sendq", FaxJob.class);
      response.pollq = getQueue(monitor, client, "pollq", FaxJob.class);
      response.doneq = getQueue(monitor, client, "doneq", FaxJob.class);
View Full Code Here

    Job<?> ioJob = new Job() {
      public Object run(ProgressMonitor monitor) throws Exception
      {
        monitor.setTotalSteps(4);
       
        HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
        monitor.work(1);
       
        gnu.hylafax.Job pollJob = client.createJob();
        HylaFAXClientHelper.applyParameter(pollJob, getJob());
        pollJob.setProperty("POLL", "\"\" \"\"");
        monitor.work(1);
               
        client.submit(pollJob);
        monitor.work(2);
       
        return null;
      }
    };
View Full Code Here

    Job<?> ioJob = new Job() {
      public Object run(ProgressMonitor monitor) throws Exception
      {
        monitor.setTotalSteps(4);
       
        HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
        monitor.work(1);
       
        gnu.hylafax.Job editJob = client.getJob(getJob().getID());
        client.suspend(editJob);
        HylaFAXClientHelper.applyParameter(editJob, getJob());
        monitor.work(1);
               
        client.submit(editJob);
        monitor.work(2);
       
        return null;
      }
    };
View Full Code Here

TOP

Related Classes of gnu.hylafax.HylaFAXClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.