idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
9,700
public static File getMountSource ( Closeable handle ) { if ( handle instanceof MountHandle ) { return MountHandle . class . cast ( handle ) . getMountSource ( ) ; } return null ; }
Return the mount source File for a given mount handle .
9,701
private static VisitorAttributes checkAttributes ( VirtualFileFilter filter , VisitorAttributes attributes ) { if ( filter == null ) { throw MESSAGES . nullArgument ( "filter" ) ; } if ( attributes != null ) { return attributes ; } if ( filter instanceof VirtualFileFilterWithAttributes ) { return ( ( VirtualFileFilterW...
Check the attributes
9,702
protected String getPathName ( VirtualFile file ) { try { return file . toURI ( ) . toString ( ) ; } catch ( Exception e ) { return file . getPathName ( ) ; } }
Get the path name for the VirtualFile .
9,703
private static MountConfig getMountConfig ( MountOption [ ] mountOptions ) { final MountConfig config = new MountConfig ( ) ; for ( MountOption option : mountOptions ) { option . applyTo ( config ) ; } return config ; }
Creates a MountConfig and applies the provided mount options
9,704
public static boolean addHandle ( VirtualFile owner , Closeable handle ) { RegistryEntry entry = getEntry ( owner ) ; return entry . handles . add ( handle ) ; }
Add handle to owner to be auto closed .
9,705
public static boolean removeHandle ( VirtualFile owner , Closeable handle ) { RegistryEntry entry = getEntry ( owner ) ; return entry . handles . remove ( handle ) ; }
Remove handle from owner .
9,706
static RegistryEntry getEntry ( VirtualFile virtualFile ) { if ( virtualFile == null ) { throw MESSAGES . nullArgument ( "VirutalFile" ) ; } return rootEntry . find ( virtualFile ) ; }
Get the entry from the tree creating the entry if not present .
9,707
public static TempFileProvider create ( final String providerType , final ScheduledExecutorService executor , final boolean cleanExisting ) throws IOException { if ( cleanExisting ) { try { final File possiblyExistingProviderRoot = new File ( TMP_ROOT , providerType ) ; if ( possiblyExistingProviderRoot . exists ( ) ) ...
Create a temporary file provider for a given type .
9,708
public TempDir createTempDir ( String originalName ) throws IOException { if ( ! open . get ( ) ) { throw VFSMessages . MESSAGES . tempFileProviderClosed ( ) ; } final String name = createTempName ( originalName + "-" , "" ) ; final File f = new File ( providerRoot , name ) ; for ( int i = 0 ; i < RETRIES ; i ++ ) { if...
Create a temp directory into which temporary files may be placed .
9,709
private void openCurrent ( VirtualFile current ) throws IOException { if ( current . isDirectory ( ) ) { currentEntryStream = VFSUtils . emptyStream ( ) ; } else { currentEntryStream = current . openStream ( ) ; } }
Open the current virtual file as the current JarEntry stream .
9,710
public List < Article > get ( String url ) { if ( url . equals ( KEY_FAVORITES ) ) return getFavorites ( ) ; return articleMap . get ( url ) ; }
Looks up the specified URL String from the saved HashMap .
9,711
public void deleteAllFavorites ( ) { long time = System . currentTimeMillis ( ) ; log ( "Deleting all favorites..." ) ; favoriteDatabase . deleteAll ( ) ; log ( "Deleting all favorites took " + ( System . currentTimeMillis ( ) - time ) + "ms" ) ; }
Clears the favorites database .
9,712
private void insert ( String url , List < Article > newArticles ) { if ( ! articleMap . containsKey ( url ) ) articleMap . put ( url , new ArrayList < Article > ( ) ) ; List < Article > articleList = articleMap . get ( url ) ; articleList . addAll ( newArticles ) ; log ( "New size for " + url + " is " + articleList . s...
Inserts the passed list into the article map database . This will be cleared once the instance dies .
9,713
private void getRead ( ) { new AsyncTask < Void , Void , Void > ( ) { protected Void doInBackground ( Void ... params ) { int size = mPrefs . getInt ( "READ_ARRAY_SIZE" , 0 ) ; boolean value ; if ( size < 1 ) return null ; for ( int i = 0 , key ; i < size ; i ++ ) { key = mPrefs . getInt ( "READ_ARRAY_KEY_" + i , 0 ) ;...
Asynchronously loads read data .
9,714
private void writeRead ( ) { new AsyncTask < Void , Void , Void > ( ) { protected Void doInBackground ( Void ... params ) { SharedPreferences . Editor editor = mPrefs . edit ( ) ; int size = readList . size ( ) ; boolean value ; editor . putInt ( "READ_ARRAY_SIZE" , size ) ; for ( int i = 0 , key ; i < size ; i ++ ) { ...
Asynchronously saves read data .
9,715
private String pullImageLink ( String encoded ) { try { XmlPullParserFactory factory = XmlPullParserFactory . newInstance ( ) ; XmlPullParser xpp = factory . newPullParser ( ) ; xpp . setInput ( new StringReader ( encoded ) ) ; int eventType = xpp . getEventType ( ) ; while ( eventType != XmlPullParser . END_DOCUMENT )...
Pulls an image URL from an encoded String .
9,716
public boolean validate ( URL url ) throws SAXException { String xmlText = null ; try { xmlText = IOUtils . toString ( url . openStream ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return validate ( xmlText ) ; }
Validate XML text retrieved from URL
9,717
public boolean validate ( String xmlText ) throws SAXException { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; try { DocumentBuilder b = factory . newDocumentBuilder ( ) ; Document document = b . parse ( new ByteArrayInputStream ( xmlText . getBytes (...
Validate an XML text String against the STIX schema
9,718
public static String getNamespaceURI ( Object obj ) { Package pkg = obj . getClass ( ) . getPackage ( ) ; XmlSchema xmlSchemaAnnotation = pkg . getAnnotation ( XmlSchema . class ) ; return xmlSchemaAnnotation . namespace ( ) ; }
Return the namespace URI from the package for the class of the object .
9,719
public static String getName ( Object obj ) { try { return obj . getClass ( ) . getAnnotation ( XmlRootElement . class ) . name ( ) ; } catch ( NullPointerException e ) { return obj . getClass ( ) . getAnnotation ( XmlType . class ) . name ( ) ; } }
Return the name from the JAXB model object .
9,720
public static QName getQualifiedName ( Object obj ) { return new QName ( STIXSchema . getNamespaceURI ( obj ) , STIXSchema . getName ( obj ) ) ; }
Return the QualifiedNam from the JAXB model object .
9,721
public RequestCreator nextPage ( ) { Request request = data . build ( ) ; String url = request . url ; int page = request . page ; if ( request . search != null ) url += "?s=" + request . search ; Map < String , Integer > pageTracker = singleton . getPageTracker ( ) ; if ( pageTracker . containsKey ( url ) ) page = pag...
Loads the next page of the current RSS feed . If no page was previously loaded this will request the first page .
9,722
public static Document toDocument ( JAXBElement < ? > jaxbElement , boolean prettyPrint ) { Document document = null ; try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; documentBuilderFactory . setNamespaceAware ( true ) ; documentBuilderFactory . setIgnoringElementContent...
Returns a Document for a JAXBElement
9,723
public static String toXMLString ( JAXBElement < ? > jaxbElement , boolean prettyPrint ) { Document document = toDocument ( jaxbElement ) ; return toXMLString ( document , prettyPrint ) ; }
Returns a String for a JAXBElement
9,724
private final static void traverse ( Element element , ElementVisitor visitor ) { visitor . visit ( element ) ; NodeList children = element . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { Node node = children . item ( i ) ; if ( node . getNodeType ( ) != Node . ELEMENT_NODE ) continue ; ...
Used to traverse an XML document .
9,725
public static Document toDocument ( String xml ) { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; documentBuilderFactory . setNamespaceAware ( true ) ; documentBuilderFactory . setIgnoringElementContentWhitespace ( true ) ; documentBuilderFactory . isIgnoringComments ( ...
Creates a Document from XML String
9,726
public static String stripFormattingfromXMLString ( String xml ) { try { Document document = DocumentUtilities . toDocument ( xml ) ; DOMImplementationRegistry registry = DOMImplementationRegistry . newInstance ( ) ; DOMImplementationLS domImplementationLS = ( DOMImplementationLS ) registry . getDOMImplementation ( "LS...
Strips formatting from an XML String
9,727
public static PagerDuty create ( String apiKey ) { Retrofit retrofit = new Retrofit . Builder ( ) . baseUrl ( HOST ) . addConverterFactory ( GsonConverterFactory . create ( ) ) . build ( ) ; return create ( apiKey , retrofit ) ; }
Create a new instance using the specified API key .
9,728
public void add ( Article article ) { SQLiteDatabase db = this . getWritableDatabase ( ) ; ContentValues values = new ContentValues ( ) ; values . put ( KEY_TAGS , TextUtils . join ( "_PCX_" , article . getTags ( ) ) ) ; values . put ( KEY_MEDIA_CONTENT , Article . MediaContent . toByteArray ( article . getMediaContent...
Inserts an Article object to this database .
9,729
public void delete ( Article article ) { SQLiteDatabase db = this . getWritableDatabase ( ) ; db . delete ( TABLE_ARTICLES , KEY_ID + " = ?" , new String [ ] { String . valueOf ( article . getId ( ) ) } ) ; db . close ( ) ; }
Removes a specified Article from this database based on its ID value .
9,730
public void deleteAll ( ) { SQLiteDatabase db = this . getWritableDatabase ( ) ; db . delete ( TABLE_ARTICLES , null , null ) ; db . close ( ) ; }
Removes ALL content stored in this database!
9,731
public Article putExtra ( String key , String value ) { this . extras . putString ( key , value ) ; return this ; }
Inserts a given value into a Bundle associated with this Article instance .
9,732
public Article addMediaContent ( MediaContent mediaContent ) { if ( mediaContent == null ) return this ; if ( this . mediaContentVec == null ) this . mediaContentVec = new Vector < > ( ) ; this . mediaContentVec . add ( mediaContent ) ; return this ; }
Adds a single media content item to the list
9,733
public Article removeMediaContent ( MediaContent mediaContent ) { if ( mediaContent == null || this . mediaContentVec == null ) return this ; this . mediaContentVec . remove ( mediaContent ) ; return this ; }
Removes a single media content item from the list
9,734
public boolean markRead ( boolean read ) { if ( PkRSS . getInstance ( ) == null ) return false ; PkRSS . getInstance ( ) . markRead ( id , read ) ; return true ; }
Adds this article s id to the read index .
9,735
public boolean saveFavorite ( boolean favorite ) { if ( PkRSS . getInstance ( ) == null ) return false ; return PkRSS . getInstance ( ) . saveFavorite ( this , favorite ) ; }
Adds this article into the favorites database .
9,736
private boolean handleNode ( String tag , Article article ) { try { if ( xmlParser . next ( ) != XmlPullParser . TEXT ) return false ; if ( tag . equalsIgnoreCase ( "link" ) ) article . setSource ( Uri . parse ( xmlParser . getText ( ) ) ) ; else if ( tag . equalsIgnoreCase ( "title" ) ) article . setTitle ( xmlParser ...
Handles a node from the tag node and assigns it to the correct article value .
9,737
private void handleMediaContent ( String tag , Article article ) { String url = xmlParser . getAttributeValue ( null , "url" ) ; if ( url == null ) { throw new IllegalArgumentException ( "Url argument must not be null" ) ; } Article . MediaContent mc = new Article . MediaContent ( ) ; article . addMediaContent ( mc ) ;...
Parses the media content of the entry
9,738
public static boolean deleteDir ( File dir ) { if ( dir != null && dir . isDirectory ( ) ) { String [ ] children = dir . list ( ) ; for ( int i = 0 ; i < children . length ; i ++ ) { if ( ! deleteDir ( new File ( dir , children [ i ] ) ) ) return false ; } } return dir . delete ( ) ; }
Deletes the specified directory . Returns true if successful false if not .
9,739
public static Downloader createDefaultDownloader ( Context context ) { Downloader downloaderInstance = null ; try { Class . forName ( "com.squareup.okhttp.OkHttpClient" ) ; downloaderInstance = new OkHttpDownloader ( context ) ; } catch ( ClassNotFoundException ignored ) { } try { Class . forName ( "okhttp3.OkHttpClien...
Creates a Downloader object depending on the dependencies present .
9,740
public void start ( Class < ? extends Easing > clazz , EaseType type , double fromValue , double endValue , int durationMillis , long delayMillis ) { if ( ! mRunning ) { mEasing = createInstance ( clazz ) ; if ( null == mEasing ) { return ; } mMethod = getEasingMethod ( mEasing , type ) ; if ( mMethod == null ) { retur...
Start the easing with a delay
9,741
public static List < Map < String , Object > > mergeLists ( String [ ] names , List < Object > ... lists ) { List < Map < String , Object > > resultList = new ArrayList < Map < String , Object > > ( ) ; if ( lists . length != 0 ) { int expectedSize = lists [ 0 ] . size ( ) ; for ( int i = 1 ; i < lists . length ; i ++ ...
Merges any number of named lists into a single one containing their combined values . Can be very handy in case of a servlet request which might contain several lists of parameters that you want to iterate over in a combined way .
9,742
private void append ( StringBuilder buffer , char c ) { if ( c == escapeChar ) { if ( escaped || rawOutput ) { buffer . append ( c ) ; } escaped = ! escaped ; } else if ( c == quoteChar ) { if ( escaped ) { buffer . append ( c ) ; escaped = false ; } else { quoted = ! quoted ; if ( rawOutput ) { buffer . append ( c ) ;...
the heart of it all
9,743
public boolean variablesAvailable ( Map < String , Object > model , String ... vars ) { final TemplateContext context = new TemplateContext ( null , null , null , new ScopedMap ( model ) , modelAdaptor , this , new SilentErrorHandler ( ) , null ) ; for ( String var : vars ) { final IfToken token = new IfToken ( var , f...
Checks if all given variables are there and if so that they evaluate to true inside an if .
9,744
@ Deprecated ( ) public synchronized Set < String > getUsedVariables ( String template ) { Template templateImpl = getTemplate ( template , null ) ; return templateImpl . getUsedVariables ( ) ; }
Gets all variables used in the given template .
9,745
public synchronized List < VariableDescription > getUsedVariableDescriptions ( String template ) { Template templateImpl = getTemplate ( template , null ) ; return templateImpl . getUsedVariableDescriptions ( ) ; }
Gets all variables used in the given template as a detailed description .
9,746
public Token pop ( ) { if ( scopes . isEmpty ( ) ) { return null ; } else { Token token = scopes . remove ( scopes . size ( ) - 1 ) ; return token ; } }
Pops a token from the scope stack .
9,747
public Token peek ( ) { if ( scopes . isEmpty ( ) ) { return null ; } else { Token token = scopes . get ( scopes . size ( ) - 1 ) ; return token ; } }
Gets the top element from the stack without removing it .
9,748
public void notifyProcessListener ( Token token , Action action ) { if ( processListener != null ) { processListener . log ( this , token , action ) ; } }
Allows you to send additional notifications of executed processing steps .
9,749
public static String streamToString ( InputStream is , String charsetName ) { try { Reader r = null ; try { r = new BufferedReader ( new InputStreamReader ( is , charsetName ) ) ; return readerToString ( r ) ; } finally { if ( r != null ) { try { r . close ( ) ; } catch ( IOException e ) { } } } } catch ( Exception e )...
Transforms a stream into a string .
9,750
public static String resourceToString ( String resourceName , String charsetName ) { InputStream templateStream = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( resourceName ) ; String template = Util . streamToString ( templateStream , "UTF-8" ) ; return template ; }
Loads a stream from the classpath and transforms it into a string .
9,751
public static String readerToString ( Reader reader ) { try { StringBuilder sb = new StringBuilder ( ) ; char [ ] buf = new char [ 1024 ] ; int numRead = 0 ; while ( ( numRead = reader . read ( buf ) ) != - 1 ) { sb . append ( buf , 0 , numRead ) ; } return sb . toString ( ) ; } catch ( Exception e ) { throw new Runtim...
Transforms a reader into a string .
9,752
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public static List < Object > arrayAsList ( Object value ) { if ( value instanceof List ) { return ( List < Object > ) value ; } List list = null ; if ( value instanceof int [ ] ) { list = new ArrayList ( ) ; int [ ] array = ( int [ ] ) value ; for ( int i : array ) {...
Transforms any array to a matching list
9,753
public static String trimFront ( String input ) { int i = 0 ; while ( i < input . length ( ) && Character . isWhitespace ( input . charAt ( i ) ) ) i ++ ; return input . substring ( i ) ; }
Trims off white space from the beginning of a string .
9,754
public MisplacedClassProcessor getProcessorForName ( String name ) { if ( name == null ) { return getDefaultProcessor ( ) ; } switch ( Strategy . valueOf ( name . toUpperCase ( ) ) ) { case FATAL : return new FatalMisplacedClassProcessor ( ) ; case MOVE : return new MoveMisplacedClassProcessor ( ) ; case OMIT : return ...
Creates a MisplacedClassProcessor according for the given strategy name .
9,755
public static int safeRead ( final InputStream inputStream , final byte [ ] buffer ) throws IOException { int readBytes = inputStream . read ( buffer ) ; if ( readBytes == - 1 ) { return - 1 ; } if ( readBytes < buffer . length ) { int offset = readBytes ; int left = buffer . length ; left = left - readBytes ; do { try...
Read a number of bytes from the stream and store it in the buffer and fix the problem with incomplete reads by doing another read if we don t have all of the data yet .
9,756
public static boolean eofIsNext ( final RawPacket rawPacket ) { final ByteBuffer buf = rawPacket . getByteBuffer ( ) ; return ( buf . get ( 0 ) == ( byte ) 0xfe && buf . capacity ( ) < 9 ) ; }
Checks whether the next packet is EOF .
9,757
static RawPacket nextPacket ( final InputStream is ) throws IOException { byte [ ] lengthBuffer = readLengthSeq ( is ) ; int length = ( lengthBuffer [ 0 ] & 0xff ) + ( ( lengthBuffer [ 1 ] & 0xff ) << 8 ) + ( ( lengthBuffer [ 2 ] & 0xff ) << 16 ) ; if ( length == - 1 ) { return null ; } if ( length < 0 ) { throw new IO...
Get the next packet from the stream
9,758
public boolean execute ( final String query ) throws SQLException { startTimer ( ) ; try { if ( queryResult != null ) { queryResult . close ( ) ; } queryResult = protocol . executeQuery ( queryFactory . createQuery ( query ) ) ; if ( queryResult . getResultSetType ( ) == ResultSetType . SELECT ) { setResultSet ( new Dr...
executes a query .
9,759
public final int writeTo ( final OutputStream os , int offset , int maxWriteSize ) throws IOException { int bytesToWrite = Math . min ( blobReference . getBytes ( ) . length - offset , maxWriteSize ) ; os . write ( blobReference . getBytes ( ) , offset , blobReference . getBytes ( ) . length ) ; return bytesToWrite ; }
Writes the parameter to an outputstream .
9,760
public String readString ( final String charset ) throws IOException { byte ch ; int cnt = 0 ; final byte [ ] byteArrBuff = new byte [ byteBuffer . remaining ( ) ] ; while ( byteBuffer . remaining ( ) > 0 && ( ( ch = byteBuffer . get ( ) ) != 0 ) ) { byteArrBuff [ cnt ++ ] = ch ; } return new String ( byteArrBuff , 0 ,...
Reads a string from the buffer looks for a 0 to end the string
9,761
public ValueObject getValueObject ( final int i ) throws NoSuchColumnException { if ( i < 0 || i > resultSet . get ( rowPointer ) . size ( ) ) { throw new NoSuchColumnException ( "No such column: " + i ) ; } return resultSet . get ( rowPointer ) . get ( i ) ; }
gets the value at position i in the result set . i starts at zero!
9,762
public static String sqlEscapeString ( final String str ) { StringBuilder buffer = new StringBuilder ( str . length ( ) * 2 ) ; boolean neededEscaping = false ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { final char c = str . charAt ( i ) ; if ( needsEscaping ( ( byte ) c ) ) { neededEscaping = true ; buffer . ap...
escapes the given string new string length is at most twice the length of str
9,763
public static long unpackTime ( final int packedTime ) { final int hours = ( packedTime & MASK_HOURS ) ; final int minutes = ( packedTime & MASK_MINUTES ) >> ( START_BIT_MINUTES ) ; final int seconds = ( packedTime & MASK_SECONDS ) >> ( START_BIT_SECONDS ) ; final int millis = ( packedTime & MASK_MILLISECONDS ) >> ( ST...
unpacks an integer packed by packTime
9,764
public static boolean isJava5 ( ) { if ( ! java5Determined ) { try { java . util . Arrays . copyOf ( new byte [ 0 ] , 0 ) ; isJava5 = false ; } catch ( java . lang . NoSuchMethodError e ) { isJava5 = true ; } java5Determined = true ; } return isJava5 ; }
Returns if it is a Java version up to Java 5 .
9,765
public void setTime ( final int parameterIndex , final Time x ) throws SQLException { if ( x == null ) { setNull ( parameterIndex , Types . TIME ) ; return ; } setParameter ( parameterIndex , new TimeParameter ( x . getTime ( ) ) ) ; }
Since Drizzle has no TIME datatype time in milliseconds is stored in a packed integer
9,766
private QueryResult createDrizzleQueryResult ( final ResultSetPacket packet ) throws IOException , QueryException { final List < ColumnInformation > columnInformation = new ArrayList < ColumnInformation > ( ) ; for ( int i = 0 ; i < packet . getFieldCount ( ) ; i ++ ) { final RawPacket rawPacket = packetFetcher . getRa...
create a DrizzleQueryResult - precondition is that a result set packet has been read
9,767
public Time getTime ( ) throws ParseException { if ( rawBytes == null ) { return null ; } String rawValue = getString ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( "HH:mm:ss" ) ; sdf . setLenient ( false ) ; final java . util . Date utilTime = sdf . parse ( rawValue ) ; return new Time ( utilTime . getTime ( ) ) ...
Since drizzle has no TIME datatype JDBC Time is stored in a packed integer
9,768
public PreparedStatement prepareStatement ( final String sql ) throws SQLException { if ( parameterizedBatchHandlerFactory == null ) { this . parameterizedBatchHandlerFactory = new DefaultParameterizedBatchHandlerFactory ( ) ; } final String strippedQuery = Utils . stripQuery ( sql ) ; return new DrizzlePreparedStateme...
creates a new prepared statement . Only client side prepared statement emulation right now .
9,769
public boolean getAutoCommit ( ) throws SQLException { Statement stmt = createStatement ( ) ; ResultSet rs = stmt . executeQuery ( "select @@autocommit" ) ; rs . next ( ) ; boolean autocommit = rs . getBoolean ( 1 ) ; rs . close ( ) ; stmt . close ( ) ; return autocommit ; }
returns true if statements on this connection are auto commited .
9,770
public void close ( ) throws SQLException { if ( isClosed ( ) ) return ; try { this . timeoutExecutor . shutdown ( ) ; protocol . close ( ) ; } catch ( QueryException e ) { throw SQLExceptionMapper . get ( e ) ; } }
close the connection .
9,771
public DatabaseMetaData getMetaData ( ) throws SQLException { return new CommonDatabaseMetaData . Builder ( protocol . getDatabaseType ( ) , this ) . url ( "jdbc:drizzle://" + protocol . getHost ( ) + ":" + protocol . getPort ( ) + "/" + protocol . getDatabase ( ) ) . username ( protocol . getUsername ( ) ) . version (...
returns the meta data about the database .
9,772
public List < RawPacket > startBinlogDump ( final int position , final String logfile ) throws SQLException { try { return this . protocol . startBinlogDump ( position , logfile ) ; } catch ( BinlogDumpException e ) { throw SQLExceptionMapper . getSQLException ( "Could not dump binlog" , e ) ; } }
returns a list of binlog entries .
9,773
protected void addCommandLineArgument ( StringBuilder buffer , String argument , String value ) { if ( ( value != null ) && ( value . length ( ) > 0 ) ) { buffer . append ( argument ) ; buffer . append ( Fax4jExeConstants . SPACE_STR ) ; buffer . append ( Fax4jExeConstants . VALUE_WRAPPER ) ; buffer . append ( value ) ...
This function adds the given command line argument to the buffer .
9,774
protected String createProcessCommand ( String commandArguments ) { StringBuilder buffer = new StringBuilder ( 500 ) ; buffer . append ( "\"" ) ; buffer . append ( this . fax4jExecutableFileLocation ) ; buffer . append ( "\"" ) ; buffer . append ( Fax4jExeConstants . SPACE_STR ) ; buffer . append ( commandArguments ) ;...
This function creates and returns the fax4j . exe command .
9,775
protected String createProcessCommandArgumentsForSubmitFaxJob ( FaxJob faxJob ) { String targetAddress = faxJob . getTargetAddress ( ) ; String targetName = faxJob . getTargetName ( ) ; String senderName = faxJob . getSenderName ( ) ; File file = faxJob . getFile ( ) ; String fileName = null ; try { fileName = file . g...
This function creates and returns the command line arguments for the fax4j external exe when running the submit fax job action .
9,776
protected String createProcessCommandArgumentsForExistingFaxJob ( String faxActionTypeArgument , FaxJob faxJob ) { String faxJobID = faxJob . getID ( ) ; StringBuilder buffer = new StringBuilder ( ) ; this . addCommandLineArgument ( buffer , Fax4jExeConstants . ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT . toString ( ) , fa...
This function creates and returns the command line arguments for the fax4j external exe when running an action on an existing fax job .
9,777
public final synchronized void initialize ( Object flowOwner ) { if ( this . initialized ) { throw new FaxException ( "Vendor policy already initialized." ) ; } if ( flowOwner == null ) { throw new FaxException ( "Flow owner not provided." ) ; } this . initialized = true ; this . vendorPolicyFlowOwner = flowOwner ; thi...
This function initializes the vendor policy .
9,778
protected HTTPClientConfiguration createHTTPClientConfiguration ( ) { CommonHTTPClientConfiguration configuration = new CommonHTTPClientConfiguration ( ) ; configuration . setHostName ( "api.phaxio.com" ) ; configuration . setSSL ( true ) ; configuration . setMethod ( FaxActionType . SUBMIT_FAX_JOB , HTTPMethod . POST ...
This function creates and returns the HTTP configuration object .
9,779
public void updateFaxJob ( FaxJob faxJob , HTTPResponse httpResponse , FaxActionType faxActionType ) { String path = this . getPathToResponseData ( faxActionType ) ; String id = this . findValue ( httpResponse , path ) ; if ( id != null ) { faxJob . setID ( id ) ; } }
Updates the fax job based on the data from the HTTP response data .
9,780
public FaxJobStatus getFaxJobStatus ( HTTPResponse httpResponse ) { String path = this . getPathToResponseData ( FaxActionType . GET_FAX_JOB_STATUS ) ; String faxJobStatusStr = this . findValue ( httpResponse , path ) ; FaxJobStatus faxJobStatus = FaxJobStatus . UNKNOWN ; if ( faxJobStatusStr != null ) { faxJobStatus =...
This function extracts the fax job status from the HTTP response data .
9,781
protected String getVBSFailedLineErrorMessage ( String errorPut ) { String message = "" ; if ( errorPut != null ) { String prefix = ".vbs(" ; int start = errorPut . indexOf ( prefix ) ; if ( start != - 1 ) { start = start + prefix . length ( ) ; int end = errorPut . indexOf ( ", " , start - 1 ) ; if ( end != - 1 ) { St...
This function returns the VBS error line for the exception message .
9,782
protected void logEvent ( FaxClientSpiProxyEventType eventType , Method method , Object [ ] arguments , Object output , Throwable throwable ) { int amount = 3 ; int argumentsAmount = 0 ; if ( arguments != null ) { argumentsAmount = arguments . length ; } if ( eventType == FaxClientSpiProxyEventType . POST_EVENT_TYPE ) ...
This function logs the event .
9,783
public final void preMethodInvocation ( Method method , Object [ ] arguments ) { this . logEvent ( FaxClientSpiProxyEventType . PRE_EVENT_TYPE , method , arguments , null , null ) ; }
This function is invoked by the fax client SPI proxy before invoking the method in the fax client SPI itself .
9,784
public final void postMethodInvocation ( Method method , Object [ ] arguments , Object output ) { this . logEvent ( FaxClientSpiProxyEventType . POST_EVENT_TYPE , method , arguments , output , null ) ; }
This function is invoked by the fax client SPI proxy after invoking the method in the fax client SPI itself .
9,785
public final void onMethodInvocationError ( Method method , Object [ ] arguments , Throwable throwable ) { this . logEvent ( FaxClientSpiProxyEventType . ERROR_EVENT_TYPE , method , arguments , null , throwable ) ; }
This function is invoked by the fax client SPI proxy in of an error while invoking the method in the fax client SPI itself .
9,786
public FaxJobPriority getPriority ( ) { int priority = Job . PRIORITY_NORMAL ; try { priority = this . JOB . getPriority ( ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while extracting job priority." , exception ) ; } FaxJobPriority faxJobPriority = null ; switch ( priority ) { case Job . PRIOR...
This function returns the priority .
9,787
public void setPriority ( FaxJobPriority priority ) { try { if ( priority == FaxJobPriority . HIGH_PRIORITY ) { this . JOB . setPriority ( Job . PRIORITY_HIGH ) ; } else { this . JOB . setPriority ( Job . PRIORITY_NORMAL ) ; } } catch ( Exception exception ) { throw new FaxException ( "Error while setting job priority....
This function sets the priority .
9,788
public String getTargetAddress ( ) { String value = null ; try { value = this . JOB . getDialstring ( ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while extracting job target address." , exception ) ; } return value ; }
This function returns the fax job target address .
9,789
public void setTargetAddress ( String targetAddress ) { try { this . JOB . setDialstring ( targetAddress ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while setting job target address." , exception ) ; } }
This function sets the fax job target address .
9,790
public String getSenderName ( ) { String value = null ; try { value = this . JOB . getFromUser ( ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while extracting job sender name." , exception ) ; } return value ; }
This function returns the fax job sender name .
9,791
public void setSenderName ( String senderName ) { try { this . JOB . setFromUser ( senderName ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while setting job sender name." , exception ) ; } }
This function sets the fax job sender name .
9,792
public void setProperty ( String key , String value ) { try { this . JOB . setProperty ( key , value ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while setting job property." , exception ) ; } }
This function sets the fax job property .
9,793
protected String formatHTTPResource ( HTTPFaxClientSpi faxClientSpi , FaxActionType faxActionType , FaxJob faxJob ) { String resourceTemplate = faxClientSpi . getHTTPResource ( faxActionType ) ; String resource = SpiUtil . formatTemplate ( resourceTemplate , faxJob , SpiUtil . URL_ENCODER , false , false ) ; return res...
This function formats the HTTP resource .
9,794
protected String formatHTTPURLParameters ( HTTPFaxClientSpi faxClientSpi , FaxJob faxJob ) { String urlParametersTemplate = faxClientSpi . getHTTPURLParameters ( ) ; String urlParameters = SpiUtil . formatTemplate ( urlParametersTemplate , faxJob , SpiUtil . URL_ENCODER , false , false ) ; return urlParameters ; }
This function formats the HTTP URL parameters .
9,795
private static void loadProperties ( Properties properties , InputStream inputStream , boolean internal ) { try { properties . load ( inputStream ) ; LibraryConfigurationLoader . closeResource ( inputStream ) ; } catch ( Exception exception ) { LibraryConfigurationLoader . closeResource ( inputStream ) ; String prefix ...
This function loads the properties from the input stream to the provided properties object .
9,796
public static Properties readInternalConfiguration ( ) { Properties properties = new Properties ( ) ; ClassLoader classLoader = ReflectionHelper . getThreadContextClassLoader ( ) ; InputStream inputStream = classLoader . getResourceAsStream ( "org/fax4j/" + LibraryConfigurationLoader . CONFIGURATION_FILE_NAME ) ; Libra...
This function reads and returns the internal fax4j properties .
9,797
public static Properties readInternalAndExternalConfiguration ( ) { Properties properties = LibraryConfigurationLoader . readInternalConfiguration ( ) ; ClassLoader classLoader = ReflectionHelper . getThreadContextClassLoader ( ) ; InputStream inputStream = classLoader . getResourceAsStream ( LibraryConfigurationLoader...
This function reads and returns the internal and external fax4j properties .
9,798
public boolean implies ( final MqttTopicPermission other ) { if ( other == null ) { return false ; } return implies ( other . getTopic ( ) , other . splitTopic , other . getQos ( ) , other . getActivity ( ) ) ; }
Checks the MqttTopicPermission implies a given MqttTopicPermission
9,799
private boolean topicImplicity ( final String topic , final String [ ] splitTopic ) { try { return topicMatcher . matches ( stripedTopic , this . splitTopic , nonWildCard , endsWithWildCard , rootWildCard , topic , splitTopic ) ; } catch ( InvalidTopicException e ) { return false ; } }
Checks if the topic implies a given MqttTopicPermissions topic