public class FaxClient extends Object implements FaxClientActions
// get new instance of a fax client (based on internal + external fax4j.properties file data) FaxClient faxClient = FaxClientFactory.createFaxClient(); // create a new fax job FaxJob faxJob = faxClient.createFaxJob(); // set fax job values faxJob.setFile(new File("./my_document.txt")); faxJob.setPriority(FaxJobPriority.HIGH_PRIORITY); faxJob.setTargetAddress("555-555"); faxJob.setTargetName("YourName"); faxJob.setSenderEmail("myemail@mycompany.com"); faxJob.setSenderName("MyName"); // submit fax job faxClient.submitFaxJob(faxJob); // print submitted fax job ID (may not be supported by all SPIs) System.out.println("Fax job submitted, ID: " + faxJob.getID());The engine behind the fax client is the fax client SPI which is used internally.
Name | Description | Preconfigured Value | Default Value | Mandatory |
org.fax4j.spi.type.map.xxx | For each SPI type, there is a property that (with prefix: org.fax4j.spi.type.map. and type name for example:
org.fax4j.spi.type.map.adapter) which defines the SPI class name for the given SPI type. For example: org.fax4j.spi.type.map.adapter=org.fax4j.spi.adapter.AdapterFaxClientSpi Means that for SPI type adapter, the SPI class to be used is org.fax4j.spi.adapter.AdapterFaxClientSpi |
org.fax4j.spi.type.map.adapter=org.fax4j.spi.adapter.AdapterFaxClientSpi org.fax4j.spi.type.map.windows=org.fax4j.spi.windows.WindowsFaxClientSpi org.fax4j.spi.type.map.vbs=org.fax4j.spi.vbs.VBSFaxClientSpi org.fax4j.spi.type.map.mail=org.fax4j.spi.email.MailFaxClientSpi org.fax4j.spi.type.map.http=org.fax4j.spi.http.HTTPFaxClientSpi org.fax4j.spi.type.map.process=org.fax4j.spi.process.ProcessFaxClientSpi org.fax4j.spi.type.map.linux=org.fax4j.spi.linux.LinuxFaxClientSpi org.fax4j.spi.type.map.mac=org.fax4j.spi.mac.MacFaxClientSpi org.fax4j.spi.type.map.hylafax=org.fax4j.spi.hylafax.HylaFaxClientSpi org.fax4j.spi.type.map.comm=org.fax4j.spi.comm.CommFaxClientSpi org.fax4j.spi.type.map.interfax=org.fax4j.spi.interfax.InterfaxMailFaxClientSpi org.fax4j.spi.type.map.nextivafax=org.fax4j.spi.nextivafax.NextivafaxMailFaxClientSpi org.fax4j.spi.type.map.send2fax=org.fax4j.spi.send2fax.Send2FaxMailFaxClientSpi org.fax4j.spi.type.map.metrofax=org.fax4j.spi.metrofax.MetroFaxMailFaxClientSpi org.fax4j.spi.type.map.faxage=org.fax4j.spi.faxage.FaxAgeMailFaxClientSpi org.fax4j.spi.type.map.extremefax=org.fax4j.spi.extremefax.ExtremeFaxMailFaxClientSpi org.fax4j.spi.type.map.efax=org.fax4j.spi.efax.EFaxMailFaxClientSpi org.fax4j.spi.type.map.phaxio=org.fax4j.spi.phaxio.PhaxioFaxClientSpi org.fax4j.spi.type.map.hoiio=org.fax4j.spi.hoiio.HoiioFaxClientSpi org.fax4j.spi.type.map.rfax=org.fax4j.spi.java4less.RFaxFaxClientSpi |
NA | NA |
org.fax4j.spi.default.type | In case the SPI type was not provided in the createFaxClientSpi method, the type will be taken from this property value. | adapter | none | false |
org.fax4j.logger.class.name | Defines the internal fax4j logger class name. The logger must implement the org.fax4j.common.Logger interface and have an empty constructor. This property can only be set in the internal fax4j.properties and the fax4j.properties on the classpath, providing these values as part of the java.util.Properties input of the createFaxClientSpi will have no affect. |
org.fax4j.common.SimpleLogger | org.fax4j.common.SimpleLogger | false |
org.fax4j.logger.log.level | Defines the internal fax4j logger log level. The possible values are: DEBUG, INFO and ERROR. This property can only be set in the internal fax4j.properties and the fax4j.properties on the classpath, providing these values as part of the java.util.Properties input of the createFaxClientSpi will have no effect. |
ERROR | ERROR | false |
org.fax4j.client.class.name | Defines the fax client class name. Since the fax client redirects the operations to the SPI (the engine) classes, creating a custom fax client is not required. |
org.fax4j.FaxClient | org.fax4j.FaxClient | false |
Constructor and Description |
---|
FaxClient(FaxClientSpi faxClientSpi)
This is the default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addFaxClientActionEventListener(FaxClientActionEventListener listener)
This function adds the fax client action event listener to the internal fax event listeners data structure.
|
void |
addFaxMonitorEventListener(FaxMonitorEventListener listener)
This function adds the fax monitor event listener to the internal fax event listeners data structure.
Fax jobs will be monitored only if there are active listeners registered. If the listeners are added after a fob job was submitted, that fax job would not be monitored. Not all SPIs support monitoring events, in which case this method will throw an exception. |
void |
cancelFaxJob(FaxJob faxJob)
This function will cancel an existing fax job.
|
FaxJob |
createFaxJob()
This function creates a new fax job instance to be used by the caller to submit a new fax job and so on.
|
protected FaxClientSpi |
getFaxClientSpi()
This function returns the fax client SPI.
|
FaxJobStatus |
getFaxJobStatus(FaxJob faxJob)
This function returns the fax job status.
Not all SPIs support extraction of the fax job status. In case the SPI is unable to extract or does not support extracting of the fax job status, it will return the UNKNOWN status. |
Provider |
getProvider()
This function returns the provider.
|
void |
removeAllFaxClientActionEventListeners()
This function removes all fax client action event listeners from the internal fax event listeners data structure.
|
void |
removeAllFaxMonitorEventListeners()
This function removes all fax monitor event listeners from the internal fax event listeners data structure.
Not all SPIs support monitoring events. |
void |
removeFaxClientActionEventListener(FaxClientActionEventListener listener)
This function removes the fax client action event listener from the internal fax event listeners data structure.
|
void |
removeFaxMonitorEventListener(FaxMonitorEventListener listener)
This function removes the fax monitor event listener from the internal fax event listeners data structure.
Not all SPIs support monitoring events. |
void |
resumeFaxJob(FaxJob faxJob)
This function will resume an existing fax job.
|
void |
submitFaxJob(FaxJob faxJob)
This function will submit a new fax job.
The fax job ID may be populated by this method in the provided fax job object. |
void |
suspendFaxJob(FaxJob faxJob)
This function will suspend an existing fax job.
|
public FaxClient(FaxClientSpi faxClientSpi)
faxClientSpi
- The fax client SPIprotected final FaxClientSpi getFaxClientSpi()
public final Provider getProvider()
getProvider
in interface ProviderImplementation
public FaxJob createFaxJob()
createFaxJob
in interface FaxClientActions
public void submitFaxJob(FaxJob faxJob)
submitFaxJob
in interface FaxClientActions
faxJob
- The fax job object containing the needed informationpublic void suspendFaxJob(FaxJob faxJob)
suspendFaxJob
in interface FaxClientActions
faxJob
- The fax job object containing the needed informationpublic void resumeFaxJob(FaxJob faxJob)
resumeFaxJob
in interface FaxClientActions
faxJob
- The fax job object containing the needed informationpublic void cancelFaxJob(FaxJob faxJob)
cancelFaxJob
in interface FaxClientActions
faxJob
- The fax job object containing the needed informationpublic FaxJobStatus getFaxJobStatus(FaxJob faxJob)
getFaxJobStatus
in interface FaxClientActions
faxJob
- The fax job object containing the needed informationpublic void addFaxClientActionEventListener(FaxClientActionEventListener listener)
addFaxClientActionEventListener
in interface FaxClientActions
listener
- The fax client action event listenerpublic void removeFaxClientActionEventListener(FaxClientActionEventListener listener)
removeFaxClientActionEventListener
in interface FaxClientActions
listener
- The fax client action event listenerpublic void removeAllFaxClientActionEventListeners()
removeAllFaxClientActionEventListeners
in interface FaxClientActions
public void addFaxMonitorEventListener(FaxMonitorEventListener listener)
addFaxMonitorEventListener
in interface FaxClientActions
listener
- The fax monitor event listenerpublic void removeFaxMonitorEventListener(FaxMonitorEventListener listener)
removeFaxMonitorEventListener
in interface FaxClientActions
listener
- The fax monitor event listenerpublic void removeAllFaxMonitorEventListeners()
removeAllFaxMonitorEventListeners
in interface FaxClientActions
Copyright © 2009–2020 fax4j. All rights reserved.