idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
9,800
private boolean getQosImplicity ( final QOS qos ) { if ( this . getQos ( ) == QOS . ALL ) { return true ; } if ( qos == QOS . ALL ) { return false ; } else if ( this . getQos ( ) == QOS . ZERO_ONE ) { return ( qos == QOS . ZERO ) || ( qos == QOS . ONE ) || ( qos == QOS . ZERO_ONE ) ; } else if ( this . getQos ( ) == QO...
Checks if the MqttTopicPermission implies a given QoS
9,801
private boolean getActivityImplicity ( final ACTIVITY activity ) { if ( this . activity == ACTIVITY . ALL ) { return true ; } if ( ( activity == ACTIVITY . SUBSCRIBE ) && ( this . activity == ACTIVITY . PUBLISH ) ) { return false ; } else if ( ( activity == ACTIVITY . PUBLISH ) && ( this . activity == ACTIVITY . SUBSCR...
Checks if an activity implies another activity
9,802
protected void initializeMailTemplates ( ) { this . mailAddressTemplate = FaxClientSpiConfigurationConstants . MAIL_ADDRESS_TEMPLATE_VALUE . toString ( ) ; this . mailSubjectTemplate = FaxClientSpiConfigurationConstants . MAIL_SUBJECT_TEMPLATE_VALUE . toString ( ) ; }
This function initializes the mail templates .
9,803
protected Object [ ] setupSubmitFaxJobInput ( FaxJob faxJob ) { List < Object > inputList = new LinkedList < Object > ( ) ; inputList . add ( this . faxServerName ) ; File file = faxJob . getFile ( ) ; inputList . add ( file ) ; String documentName = faxJob . getProperty ( FaxJobExtendedPropertyConstants . DOCUMENT_NAM...
This function creates an input array with the needed info to submit a new fax job based on the provided data .
9,804
protected Object formatObject ( Object object ) { Object formattedObject = object ; if ( object == null ) { formattedObject = "" ; } else if ( object instanceof String ) { String string = ( String ) object ; string = string . replaceAll ( "\n" , "" ) ; string = string . replaceAll ( "\r" , "" ) ; string = string . repl...
This function formats the provided object to enable embedding in VBS code .
9,805
protected FaxJobStatus invokeExistingFaxJobAction ( String scriptName , FaxJob faxJob , FaxActionType faxActionType ) { Object [ ] input = new String [ 2 ] ; input [ 0 ] = this . faxServerName ; input [ 1 ] = faxJob . getID ( ) ; return this . invokeScript ( faxJob , scriptName , input , faxActionType ) ; }
Invokes a basic fax action
9,806
protected FaxJobStatus invokeScript ( FaxJob faxJob , String name , Object [ ] input , FaxActionType faxActionType ) { String script = this . generateScript ( name , input ) ; ProcessOutput processOutput = this . invokeScript ( script ) ; this . processOutputValidator . validateProcessOutput ( this , processOutput , fa...
Invokes the VB script and returns its output .
9,807
protected ProcessOutput invokeScript ( String script ) { File file = null ; try { file = File . createTempFile ( "fax4j_" , ".vbs" ) ; } catch ( IOException exception ) { throw new FaxException ( "Unable to create temporary vbscript file." , exception ) ; } file . deleteOnExit ( ) ; StringBuilder buffer = new StringBui...
Invokes the VB script and returns the output .
9,808
protected String generateScript ( String name , Object [ ] input ) { String template = VBSFaxClientSpi . VBS_SCRIPTS . get ( name ) ; if ( ( template == null ) || ( template . length ( ) == 0 ) ) { this . throwUnsupportedException ( ) ; } String commonScript = VBSFaxClientSpi . VBS_SCRIPTS . get ( VBSFaxClientSpi . VBS...
This function generates the script and returns it .
9,809
protected static final Logger initializeLogger ( ) { Logger logger = Logger . getLogger ( FaxClient . class . getName ( ) ) ; logger . setLevel ( Level . ALL ) ; logger . setFilter ( null ) ; logger . setUseParentHandlers ( true ) ; Formatter formatter = new SimpleFormatter ( ) ; Handler handler = new StreamHandler ( S...
This function initializes and returns the logger .
9,810
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 .
9,811
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 .
9,812
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 .
9,813
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 .
9,814
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 .
9,815
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 .
9,816
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 .
9,817
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 .
9,818
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 .
9,819
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 .
9,820
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 .
9,821
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 .
9,822
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 .
9,823
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 .
9,824
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 .
9,825
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 .
9,826
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 .
9,827
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 .
9,828
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 .
9,829
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 .
9,830
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 .
9,831
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 .
9,832
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 .
9,833
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 .
9,834
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
9,835
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 .
9,836
protected void addAdditionalContentParts ( HTTPFaxClientSpi faxClientSpi , FaxActionType faxActionType , FaxJob faxJob , List < ContentPart < ? > > contentList ) { }
This function enables extending classes to add additional content parts .
9,837
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 .
9,838
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 .
9,839
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 .
9,840
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 .
9,841
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 .
9,842
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 .
9,843
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 .
9,844
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 .
9,845
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 .
9,846
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 .
9,847
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 .
9,848
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 .
9,849
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 .
9,850
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 .
9,851
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 .
9,852
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 .
9,853
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 .
9,854
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 .
9,855
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 .
9,856
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 .
9,857
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 .
9,858
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 .
9,859
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 .
9,860
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 .
9,861
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 .
9,862
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 .
9,863
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 .
9,864
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 .
9,865
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 .
9,866
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 .
9,867
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 .
9,868
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 .
9,869
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 .
9,870
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 .
9,871
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 .
9,872
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 .
9,873
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 .
9,874
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 .
9,875
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 .
9,876
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 .
9,877
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 .
9,878
public final void setLogLevel ( LogLevel logLevel ) { LogLevel updatedLogLevel = logLevel ; if ( updatedLogLevel == null ) { updatedLogLevel = LogLevel . NONE ; } this . logLevel = updatedLogLevel ; }
Sets the minimum log level .
9,879
public void logDebug ( Object [ ] message , Throwable throwable ) { this . log ( LogLevel . DEBUG , message , throwable ) ; }
Logs the provided data at the debug level .
9,880
public void logInfo ( Object [ ] message , Throwable throwable ) { this . log ( LogLevel . INFO , message , throwable ) ; }
Logs the provided data at the info level .
9,881
public void logError ( Object [ ] message , Throwable throwable ) { this . log ( LogLevel . ERROR , message , throwable ) ; }
Logs the provided data at the error level .
9,882
public final void fireFaxMonitorEvent ( FaxMonitorEventID id , FaxJob faxJob , FaxJobStatus faxJobStatus ) { this . fireFaxEvent ( id , faxJob , faxJobStatus ) ; }
This function fires a new fax monitor event .
9,883
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 .
9,884
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 .
9,885
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 .
9,886
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
9,887
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 .
9,888
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 .
9,889
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 .
9,890
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 .
9,891
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 .
9,892
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 .
9,893
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 .
9,894
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 .
9,895
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 .
9,896
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 .
9,897
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 .
9,898
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 .
9,899
public static ClassLoader getThreadContextClassLoader ( ) { Thread thread = Thread . currentThread ( ) ; ClassLoader classLoader = thread . getContextClassLoader ( ) ; return classLoader ; }
This function returns the thread context class loader .