idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
133,500
protected boolean validateCondition ( String key , String value ) { boolean valid = false ; FaxClientSpiConfigurationConstants condition = FaxClientSpiConfigurationConstants . getEnum ( key ) ; String propertyValue = null ; switch ( condition ) { case PROPERTY_CONDITION : propertyValue = this . getConfigurationValue ( ...
Validates the SPI condition .
133,501
protected void createFaxClientSpi ( String type ) { Properties configuration = this . createFaxClientSpiConfiguration ( ) ; this . faxClientSpi = FaxClientSpiFactory . createChildFaxClientSpi ( type , configuration ) ; }
This function creates a new fax client SPI based on the provided configuration .
133,502
protected Properties createFaxClientSpiConfiguration ( ) { Map < String , String > configuration = this . getConfiguration ( ) ; Properties internalSPIConfiguration = new Properties ( ) ; Properties overrideConfiguration = new Properties ( ) ; Iterator < Entry < String , String > > iterator = configuration . entrySet (...
This function creates and returns the internal fax client SPI configuration .
133,503
public List < String > getSupportedCipherSuites ( ) throws SslException { try { final SSLEngine engine = getDefaultSslEngine ( ) ; return ImmutableList . copyOf ( engine . getSupportedCipherSuites ( ) ) ; } catch ( NoSuchAlgorithmException | KeyManagementException e ) { throw new SslException ( "Not able to get list of...
Returns a list of all supported Cipher Suites of the JVM .
133,504
protected Transport createTransport ( Session session ) { Transport transport = null ; try { transport = session . getTransport ( this . transportProtocol ) ; if ( this . transportPort > 0 ) { transport . connect ( this . transportHost , this . transportPort , this . userName , this . password ) ; } else { transport . ...
This function returns a transport for the provided session .
133,505
private static File getFax4jInternalTemporaryDirectoryImpl ( ) { File temporaryFile = null ; try { temporaryFile = File . createTempFile ( "temp_" , ".temp" ) ; } catch ( IOException exception ) { throw new FaxException ( "Unable to create temporary file." , exception ) ; } File temporaryDirectory = temporaryFile . get...
This function returns the fax4j library internal temporary directory .
133,506
private static String getEncodingToUse ( String encoding ) { String updatedEncoding = encoding ; if ( updatedEncoding == null ) { updatedEncoding = IOHelper . getDefaultEncoding ( ) ; } return updatedEncoding ; }
This function returns the encoding to use . If provided encoding is null the default system encoding is returend .
133,507
public static byte [ ] convertStringToBinary ( String text , String encoding ) { byte [ ] data = null ; if ( text != null ) { if ( text . length ( ) == 0 ) { data = new byte [ 0 ] ; } else { LoggerManager loggerManager = LoggerManager . getInstance ( ) ; Logger logger = loggerManager . getLogger ( ) ; String encodingTo...
This function converts the provided string to binary data .
133,508
public static Reader createReader ( InputStream inputStream , String encoding ) { String updatedEncoding = IOHelper . getEncodingToUse ( encoding ) ; Reader reader = null ; try { reader = new InputStreamReader ( inputStream , updatedEncoding ) ; } catch ( UnsupportedEncodingException exception ) { throw new FaxExceptio...
This function creates and returns a new reader for the provided input stream .
133,509
public static Writer createWriter ( OutputStream outputStream , String encoding ) { String updatedEncoding = IOHelper . getEncodingToUse ( encoding ) ; Writer writer = null ; try { writer = new OutputStreamWriter ( outputStream , updatedEncoding ) ; } catch ( UnsupportedEncodingException exception ) { throw new FaxExce...
This function creates and returns a new writer for the provided output stream .
133,510
public static String readTextStream ( Reader reader ) throws IOException { char [ ] buffer = new char [ 5000 ] ; Writer stringWriter = new StringWriter ( ) ; int read = - 1 ; try { do { read = reader . read ( buffer ) ; if ( read != - 1 ) { stringWriter . write ( buffer , 0 , read ) ; } } while ( read != - 1 ) ; } fina...
Reads the text from the stream .
133,511
public static String readTextFile ( File file ) throws IOException { InputStream inputStream = new FileInputStream ( file ) ; Reader reader = IOHelper . createReader ( inputStream , null ) ; String text = IOHelper . readTextStream ( reader ) ; return text ; }
Reads the text from the file .
133,512
public static void writeTextFile ( String text , File file ) throws IOException { Writer writer = null ; try { OutputStream outputStream = new FileOutputStream ( file ) ; writer = IOHelper . createWriter ( outputStream , null ) ; writer . write ( text ) ; } finally { IOHelper . closeResource ( writer ) ; } }
Writes the text to the file .
133,513
public static void readAndWriteStreams ( InputStream inputStream , OutputStream outputStream ) throws IOException { byte [ ] buffer = new byte [ 5000 ] ; int read = - 1 ; try { do { read = inputStream . read ( buffer ) ; if ( read != - 1 ) { outputStream . write ( buffer , 0 , read ) ; } } while ( read != - 1 ) ; } fin...
Reads the data from the input stream and writes to the output stream .
133,514
public static byte [ ] readStream ( InputStream inputStream ) throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( 5000 ) ; IOHelper . readAndWriteStreams ( inputStream , outputStream ) ; byte [ ] data = outputStream . toByteArray ( ) ; return data ; }
Reads the data from the stream .
133,515
public static byte [ ] readFile ( File file ) throws IOException { InputStream inputStream = new FileInputStream ( file ) ; byte [ ] data = IOHelper . readStream ( inputStream ) ; return data ; }
Reads the data from the file .
133,516
public static void writeFile ( byte [ ] content , File file ) throws IOException { OutputStream outputStream = null ; try { outputStream = new FileOutputStream ( file ) ; outputStream . write ( content ) ; } finally { IOHelper . closeResource ( outputStream ) ; } }
Writes the content to the file .
133,517
public static File getFileFromPathList ( String fileNameWithNoPath , String [ ] pathList ) { File foundFile = null ; if ( pathList != null ) { int amount = pathList . length ; String directoryPath = null ; File file = null ; for ( int index = 0 ; index < amount ; index ++ ) { directoryPath = pathList [ index ] ; file =...
This function returns the file object of the first location in which the requested file is found .
133,518
public static File getFileFromNativePath ( String fileNameWithNoPath ) { String systemPath = System . getProperty ( "java.library.path" ) ; String pathSeperator = System . getProperty ( "path.separator" ) ; String [ ] systemPathElements = systemPath . split ( pathSeperator ) ; File file = IOHelper . getFileFromPathList...
This function returns the file object of the first location in which the requested file is found . The path list used is the current native path of the process .
133,519
public FaxJob submitFaxJob ( T inputData ) { if ( inputData == null ) { throw new FaxException ( "Input data not provided." ) ; } FaxJob faxJob = this . createFaxJob ( ) ; this . requestParser . updateFaxJobFromInputData ( inputData , faxJob ) ; FileInfo fileInfo = this . requestParser . getFileInfoFromInputData ( inpu...
This function will submit a new fax job .
133,520
protected String getTargetAddress ( Message mailMessage ) throws MessagingException { String subject = mailMessage . getSubject ( ) ; String targetAddress = null ; if ( ( subject != null ) && ( subject . startsWith ( "fax:" ) ) && ( subject . length ( ) > 4 ) ) { targetAddress = subject . substring ( 4 ) ; } return tar...
Returns the target address from the provided mail object .
133,521
protected String getSenderEmail ( Message mailMessage ) throws MessagingException { Address [ ] addresses = mailMessage . getFrom ( ) ; String senderEmail = null ; if ( ( addresses != null ) && ( addresses . length > 0 ) ) { Address address = addresses [ 0 ] ; senderEmail = address . toString ( ) ; } return senderEmail...
Returns the sender email from the provided mail object .
133,522
protected Map < String , String > initializeAdditionalParameters ( ) { Map < String , String > configuration = this . getConfiguration ( ) ; String propertyPart = this . getPropertyPart ( ) ; String prefix = FaxJob2HTTPRequestConverterConfigurationConstants . ADDITIONAL_PARAMETER_PROPERTY_KEY_PREFIX . toString ( ) ; pr...
This function builds and returns the additional parameters map .
133,523
protected HTTPRequest createCommonHTTPRequest ( HTTPFaxClientSpi faxClientSpi , FaxActionType faxActionType ) { HTTPRequest httpRequest = new HTTPRequest ( ) ; String resource = faxClientSpi . getHTTPResource ( faxActionType ) ; httpRequest . setResource ( resource ) ; String urlParameters = faxClientSpi . getHTTPURLPa...
Creates a HTTP request with the common data .
133,524
protected final void addContentPart ( List < ContentPart < ? > > contentList , String key , String value ) { if ( ( key != null ) && ( value != null ) && ( value . length ( ) > 0 ) ) { if ( this . shouldAddContentPart ( key ) ) { contentList . add ( new ContentPart < String > ( key , value , ContentPartType . STRING ) ...
This function adds a string content part
133,525
protected final void addAdditionalParameters ( List < ContentPart < ? > > contentList ) { if ( this . additionalParameters != null ) { Iterator < Entry < String , String > > iterator = this . additionalParameters . entrySet ( ) . iterator ( ) ; Entry < String , String > entry = null ; String key = null ; String value =...
This function adds the additional parameters .
133,526
protected void addAdditionalContentParts ( HTTPFaxClientSpi faxClientSpi , FaxActionType faxActionType , FaxJob faxJob , List < ContentPart < ? > > contentList ) { }
This function enables extending classes to add additional content parts .
133,527
public FileInfo getFileInfoFromInputData ( T inputData ) { if ( ! this . initialized ) { throw new FaxException ( "Fax bridge not initialized." ) ; } FileInfo fileInfo = this . getFileInfoFromInputDataImpl ( inputData ) ; return fileInfo ; }
This function returns the file info from the input data .
133,528
protected FaxJobStatus getFaxJobStatusFromWindowsFaxJobStatusString ( String faxJobStatusStr ) { FaxJobStatus faxJobStatus = FaxJobStatus . UNKNOWN ; if ( ( faxJobStatusStr != null ) && ( faxJobStatusStr . length ( ) > 0 ) ) { if ( ( faxJobStatusStr . equalsIgnoreCase ( "Pending" ) ) || ( faxJobStatusStr . equalsIgnore...
This function returns the fax job status based on the windows fax job status string value .
133,529
protected void updateFaxJob ( FaxJob faxJob , HTTPResponse httpResponse , FaxActionType faxActionType ) { this . httpResponseHandler . updateFaxJob ( faxJob , httpResponse , faxActionType ) ; }
Updates the fax job based on the data from the HTTP response .
133,530
public final synchronized void initialize ( String type , Properties configuration , Object flowOwner ) { if ( this . initialized ) { throw new FaxException ( "Fax bridge already initialized." ) ; } this . initialized = true ; Map < String , String > map = new HashMap < String , String > ( ) ; SpiUtil . copyPropertiesT...
This function initializes the fax bridge .
133,531
public static void copyPropertiesToMap ( Properties source , Map < String , String > target ) { if ( source != null ) { Iterator < Entry < Object , Object > > iterator = source . entrySet ( ) . iterator ( ) ; Entry < Object , Object > entry = null ; String key = null ; String value = null ; while ( iterator . hasNext (...
This function copies all mappings from source properties to target map .
133,532
public static String replaceTemplateParameter ( String template , String parameter , String value , TemplateParameterEncoder encoder ) { String text = template ; if ( ( text != null ) && ( parameter != null ) ) { String updatedValue = value ; if ( updatedValue == null ) { updatedValue = SpiUtil . EMPTY_STRING ; } else ...
This function replaces the parameter with the provided value .
133,533
public static String urlEncode ( String text ) { String urlEncodedString = text ; if ( text != null ) { try { urlEncodedString = URLEncoder . encode ( text , SpiUtil . UTF_8_ENCODING_NAME ) ; } catch ( UnsupportedEncodingException exception ) { throw new FaxException ( "Error while URL encoding text." , exception ) ; }...
This function URL encodes the given text .
133,534
public static String urlDecode ( String text ) { String urlEncodedString = text ; if ( text != null ) { try { urlEncodedString = URLDecoder . decode ( text , SpiUtil . UTF_8_ENCODING_NAME ) ; } catch ( UnsupportedEncodingException exception ) { throw new FaxException ( "Error while URL decoding text." , exception ) ; }...
This function URL decodes the given text .
133,535
private static String getFileParameterValue ( FaxJob faxJob ) { String value = null ; File file = faxJob . getFile ( ) ; if ( file != null ) { try { value = IOHelper . readTextFile ( faxJob . getFile ( ) ) ; } catch ( IOException exception ) { throw new FaxException ( "Error while reading file." , exception ) ; } } ret...
This function returns the file parameter value based on the file content .
133,536
protected void initializeImpl ( ) { this . data = new HashMap < FaxClientSpi , Map < FaxJob , FaxJobStatus > > ( 20 ) ; String value = this . getConfigurationValue ( FaxJobMonitorImpl . POLLING_INTERVAL_IN_MILLIES_PROPERTY_KEY ) ; this . pollingInterval = 5000 ; if ( value != null ) { this . pollingInterval = Long . pa...
This function initializes the fax job monitor .
133,537
protected void runPollingCycle ( ) { synchronized ( this . LOCK ) { Set < Entry < FaxClientSpi , Map < FaxJob , FaxJobStatus > > > entrySet = this . data . entrySet ( ) ; Iterator < Entry < FaxClientSpi , Map < FaxJob , FaxJobStatus > > > faxClientSpiIterator = entrySet . iterator ( ) ; Entry < FaxClientSpi , Map < Fax...
Runs the polling cycle to fetch and create monitor events .
133,538
protected final String getConfigurationValue ( String key ) { String value = this . monitorConfiguration . get ( key ) ; if ( value != null ) { value = value . trim ( ) ; if ( value . length ( ) == 0 ) { value = null ; } } this . monitorLogger . logDebug ( new Object [ ] { "Extracted configuration for key: " , key , " ...
Returns the value from the monitor configuration based on the provided configuration key .
133,539
public static void loadNativeLibrary ( Logger logger ) { synchronized ( WindowsFaxClientSpiHelper . NATIVE_LOCK ) { if ( ! WindowsFaxClientSpiHelper . nativeLibraryLoaded ) { try { File directory = IOHelper . getFax4jInternalTemporaryDirectory ( ) ; File dllFile = new File ( directory , "fax4j.dll" ) ; String path = dl...
Loads the native library if not loaded before .
133,540
public static String getServerNameFromConfiguration ( FaxClientSpi faxClientSpi ) { Logger logger = faxClientSpi . getLogger ( ) ; String faxServerName = faxClientSpi . getConfigurationValue ( FaxClientSpiConfigurationConstants . FAX_SERVER_NAME_PROPERTY_KEY ) ; logger . logDebug ( new Object [ ] { "Fax server name: " ...
This function returns the server name from the SPI configuration .
133,541
public static String getOutputPart ( ProcessOutput processOutput , String prefix ) { String output = processOutput . getOutputText ( ) ; if ( output != null ) { boolean validOutput = false ; int index = output . indexOf ( prefix ) ; if ( index != - 1 ) { index = index + prefix . length ( ) ; if ( output . length ( ) > ...
This function returns the relevant part from the process output .
133,542
public InputStream getInputStream ( ) { InputStream stream = null ; try { stream = this . commPort . getInputStream ( ) ; } catch ( IOException exception ) { throw new FaxException ( "Unable to extract input stream." , exception ) ; } return stream ; }
This function returns the input stream to the COMM port .
133,543
public OutputStream getOutputStream ( ) { OutputStream stream = null ; try { stream = this . commPort . getOutputStream ( ) ; } catch ( IOException exception ) { throw new FaxException ( "Unable to extract output stream." , exception ) ; } return stream ; }
This function returns the output stream to the COMM port .
133,544
private static Logger getLogger ( ) { if ( FaxClientSpiFactory . logger == null ) { synchronized ( FaxClientSpiFactory . class ) { if ( FaxClientSpiFactory . logger == null ) { LoggerManager loggerManager = LoggerManager . getInstance ( ) ; Logger localLogger = loggerManager . getLogger ( ) ; localLogger . logDebug ( n...
This function returns the internal logger for the fax4j framework .
133,545
private static FaxJobMonitor getFaxJobMonitor ( ) { Map < String , String > systemConfig = LibraryConfigurationLoader . getSystemConfiguration ( ) ; if ( FaxClientSpiFactory . faxJobMonitor == null ) { synchronized ( FaxClientSpiFactory . class ) { if ( FaxClientSpiFactory . faxJobMonitor == null ) { FaxJobMonitor loca...
This function returns the fax job monitor .
133,546
private static FaxJobMonitor createFaxJobMonitor ( Map < String , String > systemConfig ) { String className = systemConfig . get ( FaxClientSpiFactory . FAX_JOB_MONITOR_CLASS_NAME_PROPERTY_KEY ) ; if ( ( className == null ) || ( className . length ( ) == 0 ) ) { className = FaxJobMonitorImpl . class . getName ( ) ; } ...
This function creates the fax job monitor used by the fax4j framework .
133,547
private static FaxClientSpiProxy createFaxClientSpiProxy ( FaxClientSpi faxClientSpi ) { FaxClientSpiInterceptor [ ] interceptors = FaxClientSpiFactory . createFaxClientSpiInterceptors ( faxClientSpi ) ; String className = faxClientSpi . getConfigurationValue ( FaxClientSpiFactory . SPI_PROXY_CLASS_NAME_PROPERTY_KEY ) ...
This function creates the fax client SPI proxy .
133,548
private static FaxClientSpiInterceptor [ ] createFaxClientSpiInterceptors ( FaxClientSpi faxClientSpi ) { String typeListStr = faxClientSpi . getConfigurationValue ( FaxClientSpiFactory . SPI_INTERCEPTOR_LIST_PROPERTY_KEY ) ; FaxClientSpiInterceptor [ ] interceptors = null ; if ( typeListStr != null ) { String [ ] type...
This function creates the fax client SPI interceptors .
133,549
protected void preNativeCall ( ) { Logger logger = this . getLogger ( ) ; LogLevel logLevel = logger . getLogLevel ( ) ; boolean debugMode = false ; if ( logLevel . equals ( LogLevel . DEBUG ) ) { debugMode = true ; } WindowsJNIFaxClientSpi . setDebugModeNative ( debugMode ) ; }
This function is invoked before any native call to set the native layer debug mode .
133,550
private String winGetFaxJobStatus ( String serverName , int faxJobID ) { String status = null ; synchronized ( WindowsFaxClientSpiHelper . NATIVE_LOCK ) { this . preNativeCall ( ) ; status = WindowsJNIFaxClientSpi . getFaxJobStatusNative ( serverName , faxJobID ) ; } return status ; }
This function returns the fax job status .
133,551
protected String getContentPartAsString ( Map < String , ContentPart < ? > > contentPartsMap , String parameter ) { String stringValue = null ; ContentPart < ? > contentPart = contentPartsMap . get ( parameter ) ; if ( contentPart != null ) { ContentPartType contentPartType = contentPart . getType ( ) ; Object content ...
This function returns the content part string value .
133,552
protected Map < String , ContentPart < ? > > getContentPartsAsMap ( HTTPRequest httpRequest ) { Map < String , ContentPart < ? > > contentPartsMap = null ; ContentType contentType = httpRequest . getContentType ( ) ; switch ( contentType ) { case MULTI_PART : contentPartsMap = new HashMap < String , HTTPRequest . Conte...
This function returns the HTTP request multi parts as map .
133,553
public static String getProductInfoPrintout ( ) { Properties properties = LibraryConfigurationLoader . readInternalConfiguration ( ) ; String name = properties . getProperty ( "org.fax4j.product.name" ) ; String version = properties . getProperty ( "org.fax4j.product.version" ) ; StringBuilder buffer = new StringBuilde...
Returns the product info printout .
133,554
protected List < String > parseCommand ( ConfigurationHolder configurationHolder , String command ) { List < String > commandList = new LinkedList < String > ( ) ; StringBuilder buffer = new StringBuilder ( command ) ; String part = null ; int quoteIndex = - 1 ; int spaceIndex = - 1 ; int length = - 1 ; do { quoteIndex...
This function parsers the command and converts to a command array .
133,555
public void initialize ( FaxClientSpi faxClientSpi ) { if ( this . initialized ) { throw new FaxException ( "Fax Modem Adapter already initialized." ) ; } this . initialized = true ; Logger logger = faxClientSpi . getLogger ( ) ; logger . logDebug ( new Object [ ] { "Initializing fax modem adapter of type: " , this . g...
This function initializes the fax modem adapter .
133,556
protected final MailConnectionFactory createMailConnectionFactoryImpl ( String className ) { String factoryClassName = className ; if ( factoryClassName == null ) { factoryClassName = MailConnectionFactoryImpl . class . getName ( ) ; } MailConnectionFactory factory = ( MailConnectionFactory ) ReflectionHelper . createI...
Creates and returns the mail connection factory .
133,557
protected Connection < MailResourcesHolder > createMailConnection ( ) { Connection < MailResourcesHolder > mailConnection = this . connectionFactory . createConnection ( ) ; Logger logger = this . getLogger ( ) ; logger . logInfo ( new Object [ ] { "Created mail connection." } , null ) ; return mailConnection ; }
Creates and returns the mail connection to be used to send the fax via mail .
133,558
protected void closeMailConnection ( Connection < MailResourcesHolder > mailConnection ) throws IOException { if ( mailConnection != null ) { Logger logger = this . getLogger ( ) ; logger . logInfo ( new Object [ ] { "Closing mail connection." } , null ) ; mailConnection . close ( ) ; } }
This function closes the provided mail connection .
133,559
protected Connection < MailResourcesHolder > getMailConnection ( ) { Connection < MailResourcesHolder > mailConnection = null ; if ( this . usePersistentConnection ) { synchronized ( this ) { if ( this . connection == null ) { this . connection = this . createMailConnection ( ) ; } } mailConnection = this . connection ...
Returns the mail connection to be used to send the fax via mail .
133,560
protected void sendMail ( FaxJob faxJob , Connection < MailResourcesHolder > mailConnection , Message message ) { if ( message == null ) { this . throwUnsupportedException ( ) ; } else { MailResourcesHolder mailResourcesHolder = mailConnection . getResource ( ) ; Transport transport = mailResourcesHolder . getTransport...
This function will send the mail message .
133,561
protected void updateFaxJobWithFileInfo ( FaxJob faxJob , FileInfo fileInfo ) { File file = fileInfo . getFile ( ) ; if ( file == null ) { String fileName = fileInfo . getName ( ) ; byte [ ] content = fileInfo . getContent ( ) ; try { file = File . createTempFile ( "fax_" , fileName ) ; IOHelper . writeFile ( content ,...
This function stores the file in the local machine and updates the fax job with the new file data .
133,562
protected Map < String , String > convertParametersTextToMap ( HTTPRequest request ) { Map < String , String > map = new HashMap < String , String > ( ) ; String parametersText = request . getParametersText ( ) ; if ( parametersText != null ) { String [ ] keyValuePairs = parametersText . split ( "&" ) ; int pairsAmount...
This function converts the provided query string to a map object .
133,563
protected String createSubmitFaxCommand ( FaxJob faxJob ) { StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( this . submitCommand ) ; buffer . append ( " " ) ; buffer . append ( this . printQueueParameter ) ; buffer . append ( " " ) ; buffer . append ( this . printQueueName ) ; buffer . append ( " " ) ;...
Creates and returns the submit fax command .
133,564
protected ProcessOutput executeProcess ( String command , FaxActionType faxActionType ) { ProcessOutput processOutput = ProcessExecutorHelper . executeProcess ( this , command ) ; this . processOutputValidator . validateProcessOutput ( this , processOutput , faxActionType ) ; return processOutput ; }
This function executes the external command to send the fax .
133,565
protected String formatLogMessage ( LogLevel level , Object [ ] message , Throwable throwable ) { String messageText = this . format ( message ) ; String throwableText = this . format ( throwable ) ; StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( "[fax4j][" ) ; buffer . append ( level . getName ( ) ) ...
Converts the provided data to string .
133,566
protected String format ( Object [ ] message ) { String text = null ; if ( message != null ) { StringBuilder buffer = new StringBuilder ( ) ; int amount = message . length ; Object object = null ; for ( int index = 0 ; index < amount ; index ++ ) { object = message [ index ] ; buffer . append ( object ) ; } text = buff...
Converts the provided message object array to string .
133,567
protected String format ( Throwable throwable ) { String text = null ; if ( throwable != null ) { StringWriter writer = new StringWriter ( 1500 ) ; throwable . printStackTrace ( new PrintWriter ( writer ) ) ; text = writer . toString ( ) ; } return text ; }
Converts the provided throwable to string .
133,568
public final void setLogLevel ( LogLevel logLevel ) { LogLevel updatedLogLevel = logLevel ; if ( updatedLogLevel == null ) { updatedLogLevel = LogLevel . NONE ; } this . logLevel = updatedLogLevel ; }
Sets the minimum log level .
133,569
public void logDebug ( Object [ ] message , Throwable throwable ) { this . log ( LogLevel . DEBUG , message , throwable ) ; }
Logs the provided data at the debug level .
133,570
public void logInfo ( Object [ ] message , Throwable throwable ) { this . log ( LogLevel . INFO , message , throwable ) ; }
Logs the provided data at the info level .
133,571
public void logError ( Object [ ] message , Throwable throwable ) { this . log ( LogLevel . ERROR , message , throwable ) ; }
Logs the provided data at the error level .
133,572
public final void fireFaxMonitorEvent ( FaxMonitorEventID id , FaxJob faxJob , FaxJobStatus faxJobStatus ) { this . fireFaxEvent ( id , faxJob , faxJobStatus ) ; }
This function fires a new fax monitor event .
133,573
protected void invokeFaxJobIDValidation ( FaxJob faxJob ) { this . invokeFaxJobNullValidation ( faxJob ) ; String faxJobID = faxJob . getID ( ) ; if ( ( faxJobID == null ) || ( faxJobID . length ( ) == 0 ) ) { throw new FaxException ( "Fax job ID not provided." ) ; } }
This function invokes the fax job null validation .
133,574
public final void setHeaderProperties ( Properties headerProperties ) { this . headerProperties = null ; if ( headerProperties != null ) { this . headerProperties = new Properties ( ) ; this . headerProperties . putAll ( headerProperties ) ; } }
This function sets the header properties .
133,575
public HTTPClientConfiguration createHTTPClientConfiguration ( ConfigurationHolder configurationHolder ) { String hostName = configurationHolder . getConfigurationValue ( HTTPClientConfigurationConstants . HOST_NAME_PROPERTY_KEY ) ; if ( hostName == null ) { throw new FaxException ( "Host name not defined in property: ...
This function creates the HTTP client configuration to be used later on by this HTTP client type .
133,576
public static File findAbsoluteAndRelative ( final String fileLocation ) { final File file = new File ( fileLocation ) ; if ( file . isAbsolute ( ) ) { return file ; } else { return new File ( getHiveMQHomeFolder ( ) , fileLocation ) ; } }
Tries to find a file in the given absolute path or relative to the HiveMQ home folder
133,577
protected HttpMethodBase createMethod ( String url , HTTPMethod httpMethod ) { if ( httpMethod == null ) { throw new FaxException ( "HTTP method not provided." ) ; } if ( ( url == null ) || ( url . length ( ) == 0 ) ) { throw new FaxException ( "HTTP URL not provided." ) ; } HttpMethodBase httpMethodClient = null ; swi...
This function creates and returns a new HTTP method .
133,578
protected HTTPResponse createHTTPResponse ( int statusCode , String responseContent ) { HTTPResponse httpResponse = new HTTPResponse ( ) ; httpResponse . setStatusCode ( statusCode ) ; httpResponse . setContent ( responseContent ) ; return httpResponse ; }
This function creates and returns the HTTP response object .
133,579
protected void appendParameters ( StringBuilder buffer , String parameters ) { if ( ( parameters != null ) && ( parameters . length ( ) > 0 ) ) { String updatedParameters = parameters ; if ( parameters . startsWith ( "?" ) ) { updatedParameters = parameters . substring ( 1 ) ; } if ( updatedParameters . length ( ) > 0 ...
This function appends the parameters text to the base URL .
133,580
protected String createURL ( HTTPRequest httpRequest , HTTPClientConfiguration configuration ) { StringBuilder buffer = new StringBuilder ( 100 ) ; String resource = httpRequest . getResource ( ) ; this . appendBaseURL ( buffer , resource , configuration ) ; String parameters = httpRequest . getParametersText ( ) ; thi...
This function creates the full URL from the provided values .
133,581
protected void setupHTTPRequestHeaderProperties ( HTTPRequest httpRequest , HttpMethodBase httpMethodClient ) { Properties headerProperties = httpRequest . getHeaderProperties ( ) ; if ( headerProperties != null ) { Iterator < Entry < Object , Object > > iterator = headerProperties . entrySet ( ) . iterator ( ) ; Entry...
This function sets the header properties in the HTTP method .
133,582
protected RequestEntity createStringRequestContent ( HTTPRequest httpRequest ) { RequestEntity requestEntity = null ; String contentString = httpRequest . getContentAsString ( ) ; if ( contentString != null ) { try { requestEntity = new StringRequestEntity ( contentString , "text/plain" , null ) ; } catch ( Unsupported...
This function creates a string type request entity and populates it with the data from the provided HTTP request .
133,583
protected RequestEntity createBinaryRequestContent ( HTTPRequest httpRequest ) { RequestEntity requestEntity = null ; byte [ ] contentBinary = httpRequest . getContentAsBinary ( ) ; if ( contentBinary != null ) { requestEntity = new ByteArrayRequestEntity ( contentBinary , "binary/octet-stream" ) ; } return requestEnti...
This function creates a binary type request entity and populates it with the data from the provided HTTP request .
133,584
protected RequestEntity createMultiPartRequestContent ( HTTPRequest httpRequest , HttpMethodBase httpMethodClient ) { RequestEntity requestEntity = null ; ContentPart < ? > [ ] contentParts = httpRequest . getContentAsParts ( ) ; if ( contentParts != null ) { int partsAmount = contentParts . length ; if ( partsAmount >...
This function creates a multi part type request entity and populates it with the data from the provided HTTP request .
133,585
protected void setRequestContent ( HTTPRequest httpRequest , HttpMethodBase httpMethodClient ) { if ( httpMethodClient instanceof EntityEnclosingMethod ) { EntityEnclosingMethod pushMethod = ( EntityEnclosingMethod ) httpMethodClient ; RequestEntity requestEntity = null ; ContentType contentType = httpRequest . getCont...
This function sets the request content .
133,586
public void releaseConnection ( Connection < T > connection ) { if ( connection != null ) { try { this . LOGGER . logInfo ( new Object [ ] { "Closing connection using factory type: " , this . getClass ( ) . getName ( ) } , null ) ; T resource = connection . getResource ( ) ; this . releaseResource ( resource ) ; Closea...
Releases the connection .
133,587
protected final HylaFAXClientConnectionFactory createHylaFAXClientConnectionFactory ( String className ) { HylaFAXClientConnectionFactory factory = ( HylaFAXClientConnectionFactory ) ReflectionHelper . createInstance ( className ) ; factory . initialize ( this ) ; return factory ; }
Creates and returns the hylafax client connection factory .
133,588
protected synchronized HylaFAXClient getHylaFAXClient ( ) { HylaFAXClient client = null ; if ( this . connection == null ) { this . connection = this . connectionFactory . createConnection ( ) ; } client = this . connection . getResource ( ) ; return client ; }
Returns an instance of the hyla fax client .
133,589
public static ClassLoader getThreadContextClassLoader ( ) { Thread thread = Thread . currentThread ( ) ; ClassLoader classLoader = thread . getContextClassLoader ( ) ; return classLoader ; }
This function returns the thread context class loader .
133,590
public static Class < ? > getType ( String className ) { ClassLoader classLoader = ReflectionHelper . getThreadContextClassLoader ( ) ; Class < ? > type = null ; try { type = classLoader . loadClass ( className ) ; } catch ( ClassNotFoundException exception ) { throw new FaxException ( "Unable to load class: " + classN...
This function returns the class based on the class name .
133,591
public static Object invokeMethod ( Class < ? > type , Object instance , String methodName , Class < ? > [ ] inputTypes , Object [ ] input ) { Method method = null ; try { method = type . getDeclaredMethod ( methodName , inputTypes ) ; } catch ( Exception exception ) { throw new FaxException ( "Unable to extract method...
This function invokes the requested method .
133,592
public static Field getField ( Class < ? > type , String fieldName ) { Field field = null ; try { field = type . getDeclaredField ( fieldName ) ; } catch ( Exception exception ) { throw new FaxException ( "Unable to extract field: " + fieldName + " from type: " + type , exception ) ; } field . setAccessible ( true ) ; ...
This function returns the field wrapper for the requested field
133,593
protected ProcessOutputValidator createProcessOutputValidator ( ) { String className = this . getConfigurationValue ( FaxClientSpiConfigurationConstants . PROCESS_OUTPUT_VALIDATOR_PRE_FORMAT_PROPERTY_KEY ) ; ProcessOutputValidator validator = null ; if ( className == null ) { className = ExitCodeProcessOutputValidator ...
This function creates and returns the process output validator .
133,594
protected ProcessOutputHandler createProcessOutputHandler ( ) { String className = this . getConfigurationValue ( FaxClientSpiConfigurationConstants . PROCESS_OUTPUT_HANDLER_PRE_FORMAT_PROPERTY_KEY ) ; ProcessOutputHandler handler = null ; if ( className != null ) { handler = ( ProcessOutputHandler ) ReflectionHelper ....
This function creates and returns the process output handler .
133,595
protected ProcessOutput executeProcess ( FaxJob faxJob , String command , FaxActionType faxActionType ) { if ( command == null ) { this . throwUnsupportedException ( ) ; } String updatedCommand = command ; if ( this . useWindowsCommandPrefix ) { StringBuilder buffer = new StringBuilder ( updatedCommand . length ( ) + t...
Executes the process and returns the output .
133,596
public String getFilePath ( ) { File fileInstance = this . getFile ( ) ; String filePath = null ; if ( fileInstance != null ) { filePath = fileInstance . getPath ( ) ; } return filePath ; }
This function returns the path to the file to fax .
133,597
public void setFilePath ( String filePath ) { File fileInstance = null ; if ( filePath != null ) { fileInstance = new File ( filePath ) ; } this . setFile ( fileInstance ) ; }
This function sets the path to the file to fax .
133,598
protected StringBuilder addToStringAttributes ( String faxJobType ) { StringBuilder buffer = new StringBuilder ( 500 ) ; buffer . append ( faxJobType ) ; buffer . append ( ":" ) ; buffer . append ( Logger . SYSTEM_EOL ) ; buffer . append ( "ID: " ) ; buffer . append ( this . getID ( ) ) ; buffer . append ( Logger . SYS...
This function adds the common attributes for the toString printing .
133,599
protected final CommPortConnectionFactory createCommPortConnectionFactory ( ) { CommPortConnectionFactory factory = ( CommPortConnectionFactory ) ReflectionHelper . createInstance ( this . commConnectionFactoryClassName ) ; factory . initialize ( this ) ; return factory ; }
Creates and returns the COMM port connection factory .