View Javadoc

1   package gnu.hylafax.util;
2   
3   import gnu.hylafax.HylaFAXClient;
4   
5   import org.apache.commons.logging.Log;
6   import org.apache.commons.logging.LogFactory;
7   import org.apache.log4j.BasicConfigurator;
8   
9   public class JobTest {
10  
11      private static final Log log = LogFactory.getLog(JobTest.class);
12  
13      public static void main(String[] args) throws Exception {
14  
15  	BasicConfigurator.configure();
16  
17  	String[] params = { "dialstring", "external", "retrytime", "lasttime",
18  		"sendtime", "document" };
19  	HylaFAXClient hyfc = new HylaFAXClient();
20  	// Connect to server:
21  	hyfc.open("hylafax");
22  	if (hyfc.user("autofax")) {
23  	    // hyfc.pass("fax");
24  	}
25  
26  	// Replace 110 with the number of an existing job!
27  	hyfc.job(16839);
28  	System.out.println("Current job parameters (existing job):");
29  	for (int index = 0; index < params.length; index++) {
30  	    log.debug("RESP:" + params[index] + ": "
31  		    + hyfc.jparm(params[index]));
32  	}
33  
34  	hyfc.jnew();
35  	for (int index = 0; index < params.length; index++) {
36  	    log.debug("RESP:" + params[index] + ": "
37  		    + hyfc.jparm(params[index]));
38  	}
39  
40  	hyfc.quit();
41      }
42  }