signature:
public class ThreadJacksonMixInHolder { /** * 判断当前线程是否存在MixIn集合
 * @ return */
public static boolean isContainsMixIn ( ) { } }

implementation: if ( holderThreadLocal . get ( ) == null ) { return false ; } if ( holderThreadLocal . get ( ) . mixIns != null && holderThreadLocal . get ( ) . mixIns . size ( ) > 0 ) { return true ; } return false ;


signature:
public class StaxEventContentHandler { /** * Create and return a list of { @ code NameSpace } objects from the { @ code NamespaceContext } . */
private List < Namespace > createNamespaces ( SimpleNamespaceContext namespaceContext ) { } }

implementation: if ( namespaceContext == null ) { return null ; } List < Namespace > namespaces = new ArrayList < Namespace > ( ) ; String defaultNamespaceUri = namespaceContext . getNamespaceURI ( XMLConstants . DEFAULT_NS_PREFIX ) ; if ( StringUtils . hasLength ( defaultNamespaceUri ) ) { namespaces . add ( this . eventFactory . createNamespace ( defaultNamespaceUri ) ) ; } for ( Iterator < String > iterator = namespaceContext . getBoundPrefixes ( ) ; iterator . hasNext ( ) ; ) { String prefix = iterator . next ( ) ; String namespaceUri = namespaceContext . getNamespaceURI ( prefix ) ; namespaces . add ( this . eventFactory . createNamespace ( prefix , namespaceUri ) ) ; } return namespaces ;


signature:
public class Jackson1JavassistFilterPropertyHandler { /** * 根据指定的过滤表创建jackson对象 < br >
 * 2013-10-25 下午2:46:43
 * @ param map 过滤表
 * @ return ObjectMapper */
private ObjectMapper createObjectMapper ( Map < Class < ? > , Class < ? > > map ) { } }

implementation:
ObjectMapper mapper = new ObjectMapper ( ) ; Set < Entry < Class < ? > , Class < ? > > > entries = map . entrySet ( ) ; for ( Iterator < Entry < Class < ? > , Class < ? > > > iterator = entries . iterator ( ) ; iterator . hasNext ( ) ; ) { Entry < Class < ? > , Class < ? > > entry = iterator . next ( ) ; mapper . getSerializationConfig ( ) . addMixInAnnotations ( entry . getKey ( ) , entry . getValue ( ) ) ; // mapper . addMixInAnnotations ( entry . getKey ( ) , entry . getValue ( ) ) ;
} return mapper ;


signature:
public class MessageEncryptionHelper { /** * 将摘要信息转换为相应的编码
 * @ param code 编码类型
 * @ param message 摘要信息
 * @ return 相应的编码字符串 */
private static String encode ( String code , String message ) { } }

implementation: return encode ( code , message . getBytes ( ) ) ;


signature:
public class MessageEncryptionHelper { /** * 加密方法
 * < pre >
 * / / 1.1 首先要创建一个密匙
 * / / DES算法要求有一个可信任的随机数源
 * SecureRandom sr = new SecureRandom ( ) ;
 * / / 为我们选择的DES算法生成一个KeyGenerator对象
 * KeyGenerator kg = KeyGenerator . getInstance ( " DES " ) ;
 * kg . init ( sr ) ;
 * / / 生成密匙
 * SecretKey key = kg . generateKey ( ) ;
 * / / 获取密匙数据
 * byte rawKeyData [ ] = key . getEncoded ( ) ;
 * / / byte rawKeyData [ ] = " sucretsa " . getBytes ( ) ;
 * System . out . println ( " 密匙长度 = = = " + rawKeyData . length ) ;
 * System . out . println ( " 密匙Base64 = = = " + Base64 . encodeBytes ( rawKeyData ) ) ;
 * String str = " hi . baidu . com / beijingalana " ; / / 待加密数据
 * / / 2.1 调用加密方法
 * byte [ ] encryptedData = desEncrypt ( rawKeyData , str . getBytes ( ) ) ;
 * / / 3.1 调用解密方法
 * byte [ ] decrypt = desDecrypt ( rawKeyData , encryptedData ) ;
 * System . out . println ( " 解密 = = = " + new String ( decrypt ) ) ;
 * < / pre >
 * @ param rawKeyData 密钥
 * @ param data 要加密的数据
 * @ throws java . security . InvalidKeyException
 * @ throws NoSuchAlgorithmException
 * @ throws javax . crypto . IllegalBlockSizeException
 * @ throws javax . crypto . BadPaddingException
 * @ throws javax . crypto . NoSuchPaddingException
 * @ throws java . security . spec . InvalidKeySpecException */
public static byte [ ] desEncrypt ( byte rawKeyData [ ] , byte [ ] data ) throws InvalidKeyException , NoSuchAlgorithmException , IllegalBlockSizeException , BadPaddingException , NoSuchPaddingException , InvalidKeySpecException { } }

implementation:
// DES算法要求有一个可信任的随机数源
SecureRandom sr = new SecureRandom ( ) ; // 从原始密匙数据创建一个DESKeySpec对象
DESKeySpec dks = new DESKeySpec ( rawKeyData ) ; // 创建一个密匙工厂 , 然后用它把DESKeySpec转换成一个SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory . getInstance ( "DES" ) ; SecretKey key = keyFactory . generateSecret ( dks ) ; // Cipher对象实际完成加密操作
Cipher cipher = Cipher . getInstance ( "DES" ) ; // 用密匙初始化Cipher对象
cipher . init ( Cipher . ENCRYPT_MODE , key , sr ) ; // 现在 , 获取数据并加密
// byte data [ ] = str . getBytes ( ) ;
// 正式执行加密操作
byte [ ] encryptedData = cipher . doFinal ( data ) ; // System . out . println ( " 加密后 = = = > " + encryptedData ) ;
return encryptedData ;


signature:
public class MessageEncryptionHelper { /** * 解密方法
 * @ param rawKeyData
 * @ param encryptedData
 * @ return byte [ ]
 * @ throws IllegalBlockSizeException
 * @ throws BadPaddingException
 * @ throws InvalidKeyException
 * @ throws NoSuchAlgorithmException
 * @ throws NoSuchPaddingException
 * @ throws InvalidKeySpecException */
public static byte [ ] desDecrypt ( byte rawKeyData [ ] , byte [ ] encryptedData ) throws IllegalBlockSizeException , BadPaddingException , InvalidKeyException , NoSuchAlgorithmException , NoSuchPaddingException , InvalidKeySpecException { } }

implementation:
// DES算法要求有一个可信任的随机数源
SecureRandom sr = new SecureRandom ( ) ; // 从原始密匙数据创建一个DESKeySpec对象
DESKeySpec dks = new DESKeySpec ( rawKeyData ) ; // 创建一个密匙工厂 , 然后用它把DESKeySpec对象转换成一个SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory . getInstance ( "DES" ) ; SecretKey key = keyFactory . generateSecret ( dks ) ; // Cipher对象实际完成解密操作
Cipher cipher = Cipher . getInstance ( "DES" ) ; // 用密匙初始化Cipher对象
cipher . init ( Cipher . DECRYPT_MODE , key , sr ) ; // 正式执行解密操作
byte decryptedData [ ] = cipher . doFinal ( encryptedData ) ; // System . out . println ( " 解密后 = = = > " + new String ( decryptedData ) ) ;
return decryptedData ;


signature:
public class ClassFileFilterIsA { /** * Adds the given argument to the acceptance filter . The filter will only
 * return true for a Class a in the following condition :
 * < pre >
 * ( a instanceof c )
 * < / pre >
 * This method may be called several times . The accept method will return true
 * if the given Class is derived from any of the internal super classes .
 * @ param c
 * A non - final Class .
 * @ return true , if the given class could be added . It is not added , if
 * argument c is final ( makes no sense as a final class is never a
 * superclass ) or the given Class was already contained . */
public synchronized boolean addSuperClass ( Class c ) { } }

implementation: boolean ret = false ; if ( ( c . getModifiers ( ) & Modifier . FINAL ) != 0 ) { } else { ret = this . superclasses . add ( c ) ; } return ret ;


signature:
public class ClassFileFilterIsA { /** * Tries to detect ( from the file path and the Classloaders urls ) and load the
 * corresponding class and delegates to { @ link # accept ( Class ) } .
 * @ see java . io . FileFilter # accept ( java . io . File ) */
public boolean accept ( File pathname ) { } }

implementation:
boolean ret = false ; if ( pathname . isDirectory ( ) ) { ret = true ; } else { String ext = FileUtil . cutExtension ( pathname . getName ( ) ) . getValue ( ) . toString ( ) ; if ( ext . equals ( "jar" ) ) { // is a " directory " :
ret = true ; } else if ( ext . equals ( "class" ) ) { Class cl = this . forFile ( pathname ) ; if ( cl != null ) { ret = this . accept ( cl ) ; } } else { ret = false ; } } return ret ;


signature:
public class GelfAppender { /** * Factory method for creating a { @ link GelfTransport } provider within the plugin manager .
 * @ param name The name of the Appender .
 * @ param filter A Filter to determine if the event should be handled by this Appender .
 * @ param layout The Layout to use to format the LogEvent defaults to { @ code " % m % n " } .
 * @ param ignoreExceptions The default is { @ code true } , causing exceptions encountered while appending events
 * to be internally logged and then ignored . When set to { @ code false } exceptions will
 * be propagated to the caller , instead . Must be set to { @ code false } when wrapping this
 * Appender in a { @ link org . apache . logging . log4j . core . appender . FailoverAppender } .
 * @ param server The server name of the GELF server , defaults to { @ code localhost } .
 * @ param port The port the GELF server is listening on , defaults to { @ code 12201 } .
 * @ param hostName The host name of the machine generating the logs , defaults to local host name
 * or { @ code localhost } if it couldn ' t be detected .
 * @ param protocol The transport protocol to use , defaults to { @ code UDP } .
 * @ param tlsEnabled Whether TLS should be enabled , defaults to { @ code false } .
 * @ param tlsEnableCertificateVerification Whether TLS certificate chain should be checked , defaults to { @ code true } .
 * @ param tlsTrustCertChainFilename A X . 509 certificate chain file in PEM format for certificate verification , defaults to { @ code null }
 * @ param queueSize The size of the internally used queue , defaults to { @ code 512 } .
 * @ param connectTimeout The connection timeout for TCP connections in milliseconds , defaults to { @ code 1000 } .
 * @ param reconnectDelay The time to wait between reconnects in milliseconds , defaults to { @ code 500 } .
 * @ param sendBufferSize The size of the socket send buffer in bytes , defaults to { @ code - 1 } ( deactivate ) .
 * @ param tcpNoDelay Whether Nagle ' s algorithm should be used for TCP connections , defaults to { @ code false } .
 * @ param tcpKeepAlive Whether to try keeping alive TCP connections , defaults to { @ code false } .
 * @ param includeSource Whether the source of the log message should be included , defaults to { @ code true } .
 * @ param includeThreadContext Whether the contents of the { @ link org . apache . logging . log4j . ThreadContext } should be included , defaults to { @ code true } .
 * @ param includeStackTrace Whether a full stack trace should be included , defaults to { @ code true } .
 * @ param includeExceptionCause Whether the included stack trace should contain causing exceptions , defaults to { @ code false } .
 * @ param additionalFields Additional static key = value pairs that will be added to every log message .
 * @ return a new GELF provider */
@ PluginFactory @ SuppressWarnings ( "unused" ) public static GelfAppender createGelfAppender ( @ PluginElement ( "Filter" ) Filter filter , @ PluginElement ( "Layout" ) Layout < ? extends Serializable > layout , @ PluginElement ( value = "AdditionalFields" ) final KeyValuePair [ ] additionalFields , @ PluginAttribute ( value = "name" ) String name , @ PluginAttribute ( value = "ignoreExceptions" , defaultBoolean = true ) Boolean ignoreExceptions , @ PluginAttribute ( value = "server" , defaultString = "localhost" ) String server , @ PluginAttribute ( value = "port" , defaultInt = 12201 ) Integer port , @ PluginAttribute ( value = "protocol" , defaultString = "UDP" ) String protocol , @ PluginAttribute ( value = "hostName" ) String hostName , @ PluginAttribute ( value = "queueSize" , defaultInt = 512 ) Integer queueSize , @ PluginAttribute ( value = "connectTimeout" , defaultInt = 1000 ) Integer connectTimeout , @ PluginAttribute ( value = "reconnectDelay" , defaultInt = 500 ) Integer reconnectDelay , @ PluginAttribute ( value = "sendBufferSize" , defaultInt = - 1 ) Integer sendBufferSize , @ PluginAttribute ( value = "tcpNoDelay" , defaultBoolean = false ) Boolean tcpNoDelay , @ PluginAttribute ( value = "tcpKeepAlive" , defaultBoolean = false ) Boolean tcpKeepAlive , @ PluginAttribute ( value = "includeSource" , defaultBoolean = true ) Boolean includeSource , @ PluginAttribute ( value = "includeThreadContext" , defaultBoolean = true ) Boolean includeThreadContext , @ PluginAttribute ( value = "includeStackTrace" , defaultBoolean = true ) Boolean includeStackTrace , @ PluginAttribute ( value = "includeExceptionCause" , defaultBoolean = false ) Boolean includeExceptionCause , @ PluginAttribute ( value = "tlsEnabled" , defaultBoolean = false ) Boolean tlsEnabled , @ PluginAttribute ( value = "tlsEnableCertificateVerification" , defaultBoolean = true ) Boolean tlsEnableCertificateVerification , @ PluginAttribute ( value = "tlsTrustCertChainFilename" ) String tlsTrustCertChainFilename ) { } }

implementation: if ( name == null ) { LOGGER . error ( "No name provided for ConsoleAppender" ) ; return null ; } if ( ! "UDP" . equalsIgnoreCase ( protocol ) && ! "TCP" . equalsIgnoreCase ( protocol ) ) { LOG . warn ( "Invalid protocol {}, falling back to UDP" , protocol ) ; protocol = "UDP" ; } if ( hostName == null || hostName . trim ( ) . isEmpty ( ) ) { try { final String canonicalHostName = InetAddress . getLocalHost ( ) . getCanonicalHostName ( ) ; if ( isFQDN ( canonicalHostName ) ) { hostName = canonicalHostName ; } else { hostName = InetAddress . getLocalHost ( ) . getHostName ( ) ; } } catch ( UnknownHostException e ) { LOG . warn ( "Couldn't detect local host name, falling back to \"localhost\"" ) ; hostName = "localhost" ; } } final InetSocketAddress serverAddress = new InetSocketAddress ( server , port ) ; final GelfTransports gelfProtocol = GelfTransports . valueOf ( protocol . toUpperCase ( ) ) ; final GelfConfiguration gelfConfiguration = new GelfConfiguration ( serverAddress ) . transport ( gelfProtocol ) . queueSize ( queueSize ) . connectTimeout ( connectTimeout ) . reconnectDelay ( reconnectDelay ) . sendBufferSize ( sendBufferSize ) . tcpNoDelay ( tcpNoDelay ) . tcpKeepAlive ( tcpKeepAlive ) ; if ( tlsEnabled ) { if ( gelfProtocol . equals ( GelfTransports . TCP ) ) { gelfConfiguration . enableTls ( ) ; if ( ! tlsEnableCertificateVerification ) { LOG . warn ( "TLS certificate validation is disabled. This is unsecure!" ) ; gelfConfiguration . disableTlsCertVerification ( ) ; } if ( tlsEnableCertificateVerification && tlsTrustCertChainFilename != null ) { gelfConfiguration . tlsTrustCertChainFile ( new File ( tlsTrustCertChainFilename ) ) ; } } else { LOG . warn ( "Enabling of TLS is invalid for UDP Transport" ) ; } } return new GelfAppender ( name , layout , filter , ignoreExceptions , gelfConfiguration , hostName , includeSource , includeThreadContext , includeStackTrace , additionalFields , includeExceptionCause ) ;


signature:
public class HorizontalPicker { /** * TODO cache values
 * @ param text
 * @ return */
private boolean isRtl ( CharSequence text ) { } }

implementation: if ( textDir == null ) { textDir = getTextDirectionHeuristic ( ) ; } return textDir . isRtl ( text , 0 , text . length ( ) ) ;


signature:
public class HorizontalPicker { /** * Calculates text color for specified item based on its position and state .
 * @ param item Index of item to get text color for
 * @ return Item text color */
private int getTextColor ( int item ) { } }

implementation:
int scrollX = getScrollX ( ) ; // set color of text
int color = textColor . getDefaultColor ( ) ; int itemWithPadding = ( int ) ( itemWidth + dividerSize ) ; if ( scrollX > itemWithPadding * item - itemWithPadding / 2 && scrollX < itemWithPadding * ( item + 1 ) - itemWithPadding / 2 ) { int position = scrollX - itemWithPadding / 2 ; color = getColor ( position , item ) ; } else if ( item == pressedItem ) { color = textColor . getColorForState ( new int [ ] { android . R . attr . state_pressed } , color ) ; } return color ;


signature:
public class HorizontalPicker { /** * Sets values to choose from
 * @ param values New values to choose from */
public void setValues ( CharSequence [ ] values ) { } }

implementation:
if ( this . values != values ) { this . values = values ; if ( this . values != null ) { layouts = new BoringLayout [ this . values . length ] ; for ( int i = 0 ; i < layouts . length ; i ++ ) { layouts [ i ] = new BoringLayout ( this . values [ i ] , textPaint , itemWidth , Layout . Alignment . ALIGN_CENTER , 1f , 1f , boringMetrics , false , ellipsize , itemWidth ) ; } } else { layouts = new BoringLayout [ 0 ] ; } // start marque only if has already been measured
if ( getWidth ( ) > 0 ) { startMarqueeIfNeeded ( ) ; } requestLayout ( ) ; invalidate ( ) ; }


signature:
public class HorizontalPicker { /** * Calculates color for specific position on time picker
 * @ param scrollX
 * @ return */
private int getColor ( int scrollX , int position ) { } }

implementation: int itemWithPadding = ( int ) ( itemWidth + dividerSize ) ; float proportion = Math . abs ( ( ( 1f * scrollX % itemWithPadding ) / 2 ) / ( itemWithPadding / 2f ) ) ; if ( proportion > .5 ) { proportion = ( proportion - .5f ) ; } else { proportion = .5f - proportion ; } proportion *= 2 ; int defaultColor ; int selectedColor ; if ( pressedItem == position ) { defaultColor = textColor . getColorForState ( new int [ ] { android . R . attr . state_pressed } , textColor . getDefaultColor ( ) ) ; selectedColor = textColor . getColorForState ( new int [ ] { android . R . attr . state_pressed , android . R . attr . state_selected } , defaultColor ) ; } else { defaultColor = textColor . getDefaultColor ( ) ; selectedColor = textColor . getColorForState ( new int [ ] { android . R . attr . state_selected } , defaultColor ) ; } return ( Integer ) new ArgbEvaluator ( ) . evaluate ( proportion , selectedColor , defaultColor ) ;


signature:
public class HorizontalPicker { /** * Sets text size for items
 * @ param size New item text size in px . */
private void setTextSize ( float size ) { } }

implementation: if ( size != textPaint . getTextSize ( ) ) { textPaint . setTextSize ( size ) ; requestLayout ( ) ; invalidate ( ) ; }


signature:
public class HorizontalPicker { /** * Calculates x scroll position that is still in range of view scroller
 * @ param x Scroll position to calculate .
 * @ return { param x } if is within bounds of over scroller , otherwise it will return min / max
 * value of scoll position . */
private int getInBoundsX ( int x ) { } }

implementation: if ( x < 0 ) { x = 0 ; } else if ( x > ( ( itemWidth + ( int ) dividerSize ) * ( values . length - 1 ) ) ) { x = ( ( itemWidth + ( int ) dividerSize ) * ( values . length - 1 ) ) ; } return x ;


signature:
public class RemoteServerServlet { /** * Cleans up the path of an incoming request . Repeating / s are reduced to
 * one / . Trailing / s are removed . A < code > null < / code > or empty path is
 * converted to / .
 * @ param path
 * the path the client requested
 * @ return cleaned up path */
private static String cleanPath ( String path ) { } }

implementation: path = path == null ? "/" : path ; if ( ! path . startsWith ( "/" ) ) { path = "/" + path ; } path = path . replaceAll ( "/+" , "/" ) ; if ( path . length ( ) > 1 && path . endsWith ( "/" ) ) { path = path . substring ( 0 , path . length ( ) - 1 ) ; } return path ;


signature:
public class MyRemoteLibrary { /** * / * Starts jrobotremoteserver with an example library and returns . The application will shutdown when all of the
 * web server ' s threads exit . */
public static void main ( String [ ] args ) throws Exception { } }

implementation: RemoteServer . configureLogging ( ) ; RemoteServer server = new RemoteServer ( ) ; server . addLibrary ( MyRemoteLibrary . class , 8270 ) ; server . start ( ) ;


signature:
public class MyRemoteLibrary { /** * The introduction is stored in a text file resource because it is easier to edit than String constants . */
private String getIntro ( ) { } }

implementation: try { InputStream introStream = MyRemoteLibrary . class . getResourceAsStream ( "__intro__.txt" ) ; StringWriter writer = new StringWriter ( ) ; IOUtils . copy ( introStream , writer , Charset . defaultCharset ( ) ) ; return writer . toString ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; }


signature:
public class ServerMethods { /** * Get an array containing the names of the keywords that the library
 * implements .
 * @ return String array containing keyword names in the library */
public String [ ] get_keyword_names ( ) { } }

implementation: try { String [ ] names = servlet . getLibrary ( ) . getKeywordNames ( ) ; if ( names == null || names . length == 0 ) throw new RuntimeException ( "No keywords found in the test library" ) ; String [ ] newNames = Arrays . copyOf ( names , names . length + 1 ) ; newNames [ names . length ] = "stop_remote_server" ; return newNames ; } catch ( Throwable e ) { log . warn ( "" , e ) ; throw new RuntimeException ( e ) ; }


signature:
public class ServerMethods { /** * Run the given keyword and return the results .
 * @ param keyword
 * keyword to run
 * @ param args
 * arguments packed in an array to pass to the keyword method
 * @ param kwargs
 * keyword arguments to pass to the keyword method
 * @ return remote result Map containing the execution results */
public Map < String , Object > run_keyword ( String keyword , Object [ ] args , Map < String , Object > kwargs ) { } }

implementation: Map < String , Object > result = new HashMap < String , Object > ( ) ; StdStreamRedirecter redirector = new StdStreamRedirecter ( ) ; redirector . redirectStdStreams ( ) ; try { result . put ( "status" , "PASS" ) ; Object retObj = "" ; if ( keyword . equalsIgnoreCase ( "stop_remote_server" ) ) { retObj = stopRemoteServer ( ) ; } else { try { retObj = servlet . getLibrary ( ) . runKeyword ( keyword , args , kwargs ) ; } catch ( Exception e ) { if ( illegalArgumentIn ( e ) ) { for ( int i = 0 ; i < args . length ; i ++ ) args [ i ] = arraysToLists ( args [ i ] ) ; retObj = servlet . getLibrary ( ) . runKeyword ( keyword , args , kwargs ) ; } else { throw ( e ) ; } } } if ( retObj != null && ! retObj . equals ( "" ) ) { result . put ( "return" , retObj ) ; } } catch ( Throwable e ) { result . put ( "status" , "FAIL" ) ; Throwable thrown = e . getCause ( ) == null ? e : e . getCause ( ) ; result . put ( "error" , getError ( thrown ) ) ; result . put ( "traceback" , ExceptionUtils . getStackTrace ( thrown ) ) ; boolean continuable = isFlagSet ( "ROBOT_CONTINUE_ON_FAILURE" , thrown ) ; if ( continuable ) { result . put ( "continuable" , true ) ; } boolean fatal = isFlagSet ( "ROBOT_EXIT_ON_FAILURE" , thrown ) ; if ( fatal ) { result . put ( "fatal" , true ) ; } } finally { String stdOut = StringUtils . defaultString ( redirector . getStdOutAsString ( ) ) ; String stdErr = StringUtils . defaultString ( redirector . getStdErrAsString ( ) ) ; if ( ! stdOut . isEmpty ( ) || ! stdErr . isEmpty ( ) ) { StringBuilder output = new StringBuilder ( stdOut ) ; if ( ! stdOut . isEmpty ( ) && ! stdErr . isEmpty ( ) ) { if ( ! stdOut . endsWith ( "\n" ) ) { output . append ( "\n" ) ; } boolean addLevel = true ; for ( String prefix : logLevelPrefixes ) { if ( stdErr . startsWith ( prefix ) ) { addLevel = false ; break ; } } if ( addLevel ) { output . append ( "*INFO*" ) ; } } result . put ( "output" , output . append ( stdErr ) . toString ( ) ) ; } redirector . resetStdStreams ( ) ; } return result ;


signature:
public class ServerMethods { /** * Run the given keyword and return the results .
 * @ param keyword
 * keyword to run
 * @ param args
 * arguments packed in an array to pass to the keyword method
 * @ return remote result Map containing the execution results */
public Map < String , Object > run_keyword ( String keyword , Object [ ] args ) { } }

implementation: return run_keyword ( keyword , args , null ) ;


signature:
public class ServerMethods { /** * Get an array of argument specifications for the given keyword .
 * @ param keyword
 * The keyword to lookup .
 * @ return A string array of argument specifications for the given keyword . */
public String [ ] get_keyword_arguments ( String keyword ) { } }

implementation: if ( keyword . equalsIgnoreCase ( "stop_remote_server" ) ) { return new String [ 0 ] ; } try { String [ ] args = servlet . getLibrary ( ) . getKeywordArguments ( keyword ) ; return args == null ? new String [ 0 ] : args ; } catch ( Throwable e ) { log . warn ( "" , e ) ; throw new RuntimeException ( e ) ; }


signature:
public class ServerMethods { /** * Get documentation for given keyword .
 * @ param keyword
 * The keyword to get documentation for .
 * @ return A documentation string for the given keyword . */
public String get_keyword_documentation ( String keyword ) { } }

implementation: if ( keyword . equalsIgnoreCase ( "stop_remote_server" ) ) { return "Stops the remote server.\n\nThe server may be configured so that users cannot stop it." ; } try { String doc = servlet . getLibrary ( ) . getKeywordDocumentation ( keyword ) ; return doc == null ? "" : doc ; } catch ( Throwable e ) { log . warn ( "" , e ) ; throw new RuntimeException ( e ) ; }


signature:
public class RemoteServer { /** * Main method for command line usage .
 * @ param args
 * @ throws Exception */
public static void main ( String [ ] args ) throws Exception { } }

implementation: configureLogging ( ) ; CommandLineHelper helper = new CommandLineHelper ( args ) ; if ( helper . getHelpRequested ( ) ) { System . out . print ( helper . getUsage ( ) ) ; System . exit ( 0 ) ; } RemoteServer remoteServer = new RemoteServer ( ) ; String error = helper . getError ( ) ; if ( error == null ) { try { for ( String path : helper . getLibraryMap ( ) . keySet ( ) ) remoteServer . putLibrary ( path , helper . getLibraryMap ( ) . get ( path ) ) ; } catch ( IllegalPathException e ) { error = e . getMessage ( ) ; } } if ( error != null ) { System . out . println ( "Error: " + error ) ; System . out . println ( ) ; System . out . println ( helper . getUsage ( ) ) ; System . exit ( 1 ) ; } remoteServer . setPort ( helper . getPort ( ) ) ; remoteServer . setAllowStop ( helper . getAllowStop ( ) ) ; remoteServer . setHost ( helper . getHost ( ) ) ; remoteServer . start ( ) ;


signature:
public class RemoteServer { /** * Map the given test library to the specified path . Paths must :
 * < ul >
 * < li > start with a / < / li >
 * < li > contain only alphanumeric characters or any of these : / - . _ ~ < / li >
 * < li > not end in a / < / li >
 * < li > not contain a repeating sequence of / s < / li >
 * < / ul >
 * Example : < code > putLibrary ( " / myLib " , new MyLibrary ( ) ) ; < / code >
 * @ param library
 * instance of the test library
 * @ param path
 * path to map the test library to
 * @ return the previous library mapped to the path , or null if there was no
 * mapping for the path */
public RemoteLibrary putLibrary ( String path , Object library ) { } }

implementation: RemoteLibrary oldLibrary = servlet . putLibrary ( path , library ) ; String name = servlet . getLibraryMap ( ) . get ( path ) . getName ( ) ; log . info ( String . format ( "Mapped path %s to library %s." , path , name ) ) ; return oldLibrary ;


signature:
public class RemoteServer { /** * This has been deprecated . Please use { @ link # putLibrary } and
 * { @ link # setPort } instead .
 * Map the given test library to / and sets the port for the server . The
 * server must be stopped when calling this .
 * @ param className
 * class name of the test library
 * @ param port
 * port for the server to listen on */
@ Deprecated public void addLibrary ( String className , int port ) { } }

implementation: Class < ? > clazz ; try { clazz = Class . forName ( className ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } addLibrary ( clazz , port ) ;


signature:
public class RemoteServer { /** * This has been deprecated . Please use { @ link # putLibrary } and
 * { @ link # setPort } instead .
 * Map the given test library to / and sets the port for the server . The
 * server must be stopped when calling this .
 * @ param clazz
 * class of the test library
 * @ param port
 * port for the server to listen on */
@ Deprecated public void addLibrary ( Class < ? > clazz , int port ) { } }

implementation:
if ( ! server . isStopped ( ) ) // old behavior
throw new IllegalStateException ( "Cannot add a library once the server is started" ) ; if ( connector . getPort ( ) != 0 && connector . getPort ( ) != port ) { throw new RuntimeException ( "Serving on multiple ports is no longer supported. Please use putLibrary with different paths instead." ) ; } if ( servlet . getLibraryMap ( ) . keySet ( ) . contains ( "/" ) ) { throw new RuntimeException ( "A library has already been mapped to /." ) ; } Object library ; try { library = clazz . newInstance ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } setPort ( port ) ; putLibrary ( "/" , library ) ;


signature:
public class RemoteServer { /** * A non - blocking method for stopping the remote server that allows requests
 * to complete within the given timeout before shutting down the server . New
 * connections will not be accepted after calling this .
 * @ param timeoutMS
 * the milliseconds to wait for existing request to complete
 * before stopping the server */
public void stop ( int timeoutMS ) throws Exception { } }

implementation: log . info ( "Robot Framework remote server stopping" ) ; if ( timeoutMS > 0 ) { server . setGracefulShutdown ( timeoutMS ) ; Thread stopper = new Thread ( ) { @ Override public void run ( ) { try { server . stop ( ) ; } catch ( Throwable e ) { log . error ( String . format ( "Failed to stop the server: %s" , e . getMessage ( ) ) , e ) ; } } } ; stopper . start ( ) ; } else { server . stop ( ) ; }


signature:
public class RemoteServer { /** * Starts the remote server . Add test libraries first before calling this .
 * @ throws Exception */
public void start ( ) throws Exception { } }

implementation: log . info ( "Robot Framework remote server starting" ) ; server . start ( ) ; log . info ( String . format ( "Robot Framework remote server started on port %d." , getLocalPort ( ) ) ) ;


signature:
public class RemoteServer { /** * Configures logging systems used by < tt > RemoteServer < / tt > and its
 * dependencies . Specifically ,
 * < ul >
 * < li > Configure Log4J to log to the console < / li >
 * < li > Set Log4J ' s log level to INFO < / li >
 * < li > Redirect the Jetty ' s logging to Log4J < / li >
 * < li > Set Jakarta Commons Logging to log to Log4J < / li >
 * < / ul >
 * This is convenient if you do not want to configure the logging yourself .
 * This will only affect future instances of
 * { @ link org . eclipse . jetty . util . log . Logger } and
 * { @ link org . apache . commons . logging . Log } , so this should be called as early
 * as possible . */
public static void configureLogging ( ) { } }

implementation: Logger root = Logger . getRootLogger ( ) ; root . removeAllAppenders ( ) ; BasicConfigurator . configure ( ) ; root . setLevel ( Level . INFO ) ; org . eclipse . jetty . util . log . Log . setLog ( new Jetty2Log4J ( ) ) ; LogFactory . releaseAll ( ) ; LogFactory . getFactory ( ) . setAttribute ( "org.apache.commons.logging.Log" , "org.apache.commons.logging.impl.Log4JLogger" ) ; log = LogFactory . getLog ( RemoteServer . class ) ;


signature:
public class ReflectiveHandlerMapping { /** * Removes the prefixes from all keys in this handler mapping assuming a String was used as the key and period was
 * used as a separator . Example : AccountsReceivable . Billing . getInvoice - > getInvoice */
@ SuppressWarnings ( "unchecked" ) public void removePrefixes ( ) { } }

implementation: Map < String , Object > newHandlerMap = new HashMap < String , Object > ( ) ; for ( Entry < String , Object > entry : ( Set < Entry < String , Object > > ) this . handlerMap . entrySet ( ) ) { String newKey = ( String ) entry . getKey ( ) ; if ( entry . getKey ( ) instanceof String ) { String key = ( String ) entry . getKey ( ) ; if ( key . contains ( "." ) ) { newKey = key . substring ( key . lastIndexOf ( "." ) + 1 ) ; } } newHandlerMap . put ( newKey , entry . getValue ( ) ) ; } this . handlerMap = newHandlerMap ;


signature:
public class PropertiesToJsonConverter { /** * Generate Json by given path to file with properties with only included domain keys .
 * @ param pathToFile path to File
 * @ param includeDomainKeys domain head keys which should be parsed to json < br >
 * example properties : < br >
 * object1 . field1 = value1 < br >
 * object1 . field2 = value2 < br >
 * someObject2 . field2 = value3 < br >
 * filter " object1 " < br >
 * will parse only nested domain for " object1 " < br >
 * @ return simple String with json
 * @ throws ReadInputException when cannot find file
 * @ throws ParsePropertiesException when structure of properties is not compatible with json structure */
public String convertPropertiesFromFileToJson ( String pathToFile , String ... includeDomainKeys ) throws ReadInputException , ParsePropertiesException { } }

implementation: return convertPropertiesFromFileToJson ( new File ( pathToFile ) , includeDomainKeys ) ;


signature:
public class PropertiesToJsonConverter { /** * Generate Json by given file with properties with only included domain keys .
 * @ param file file with properties
 * @ param includeDomainKeys domain head keys which should be parsed to json < br >
 * example properties : < br >
 * object1 . field1 = value1 < br >
 * object1 . field2 = value2 < br >
 * someObject2 . field2 = value3 < br >
 * filter " object1 " < br >
 * will parse only nested domain for " object1 " < br >
 * @ return simple String with json
 * @ throws ReadInputException when cannot find file
 * @ throws ParsePropertiesException when structure of properties is not compatible with json structure */
public String convertPropertiesFromFileToJson ( File file , String ... includeDomainKeys ) throws ReadInputException , ParsePropertiesException { } }

implementation: try { InputStream targetStream = new FileInputStream ( file ) ; return convertToJson ( targetStream , includeDomainKeys ) ; } catch ( FileNotFoundException e ) { throw new ReadInputException ( e ) ; }


signature:
public class PropertiesToJsonConverter { /** * generate Json by given InputStream and given filter .
 * @ param inputStream InputStream with properties
 * @ param includeDomainKeys domain head keys which should be parsed to json < br >
 * example properties : < br >
 * object1 . field1 = value1 < br >
 * object1 . field2 = value2 < br >
 * someObject2 . field2 = value3 < br >
 * filter " object1 " < br >
 * will parse only nested domain for " object1 " < br >
 * @ return simple String with json
 * @ throws ReadInputException when cannot find file
 * @ throws ParsePropertiesException when structure of properties is not compatible with json structure */
public String convertToJson ( InputStream inputStream , String ... includeDomainKeys ) throws ReadInputException , ParsePropertiesException { } }

implementation: return convertToJson ( inputStreamToProperties ( inputStream ) , includeDomainKeys ) ;


signature:
public class PropertiesToJsonConverter { /** * generate Json by given Java Properties
 * @ param properties Java Properties
 * @ return simple String with json
 * @ throws ParsePropertiesException when structure of properties is not compatible with json structure */
public String convertToJson ( Properties properties ) throws ParsePropertiesException { } }

implementation: for ( Map . Entry < Object , Object > entry : properties . entrySet ( ) ) { if ( ! ( entry . getKey ( ) instanceof String ) ) { throw new ParsePropertiesException ( format ( PROPERTY_KEY_NEEDS_TO_BE_STRING_TYPE , entry . getKey ( ) . getClass ( ) , entry . getKey ( ) == null ? "null" : entry . getKey ( ) ) ) ; } } return convertFromValuesAsObjectMap ( propertiesToMap ( properties ) ) ;


signature:
public class PropertiesToJsonConverter { /** * generate Json by given Map & lt ; String , String & gt ;
 * @ param properties Java Map with properties
 * @ return simple String with json
 * @ throws ParsePropertiesException when structure of properties is not compatible with json structure */
public String convertToJson ( Map < String , String > properties ) throws ParsePropertiesException { } }

implementation: return convertFromValuesAsObjectMap ( stringValueMapToObjectValueMap ( properties ) ) ;


signature:
public class PropertiesToJsonConverter { /** * generate Json by given Map & lt ; String , Object & gt ;
 * @ param properties Java Map with properties
 * @ return simple String with json
 * @ throws ParsePropertiesException when structure of properties is not compatible with json structure */
public String convertFromValuesAsObjectMap ( Map < String , Object > properties ) throws ParsePropertiesException { } }

implementation: ObjectJsonType coreObjectJsonType = new ObjectJsonType ( ) ; for ( String propertiesKey : getAllKeysFromProperties ( properties ) ) { addFieldsToJsonObject ( properties , coreObjectJsonType , propertiesKey ) ; } return prettifyOfJson ( coreObjectJsonType . toStringJson ( ) ) ;


signature:
public class PropertiesToJsonConverter { /** * generate Json by given Map & lt ; String , String & gt ; and given filter
 * @ param properties Java Map with properties
 * @ param includeDomainKeys domain head keys which should be parsed to json < br >
 * example properties : < br >
 * object1 . field1 = value1 < br >
 * object1 . field2 = value2 < br >
 * someObject2 . field2 = value3 < br >
 * filter " object1 " < br >
 * will parse only nested domain for " object1 " < br >
 * @ return simple String with json
 * @ throws ParsePropertiesException when structure of properties is not compatible with json structure */
public String convertFromValuesAsObjectMap ( Map < String , Object > properties , String ... includeDomainKeys ) throws ParsePropertiesException { } }

implementation: Map < String , Object > filteredProperties = new HashMap < > ( ) ; for ( String key : properties . keySet ( ) ) { for ( String requiredKey : includeDomainKeys ) { checkKey ( properties , filteredProperties , key , requiredKey ) ; } } return convertFromValuesAsObjectMap ( filteredProperties ) ;


signature:
public class PropertiesToJsonConverter { /** * generate Json by given Java Properties and given filter
 * @ param properties Java Properties
 * @ param includeDomainKeys domain head keys which should be parsed to json < br >
 * example properties : < br >
 * object1 . field1 = value1 < br >
 * object1 . field2 = value2 < br >
 * someObject2 . field2 = value3 < br >
 * filter " object1 " < br >
 * will parse only nested domain for " object1 " < br >
 * @ param includeDomainKeys domain head keys which should be parsed to json
 * @ return Simple String with json
 * @ throws ParsePropertiesException when structure of properties is not compatible with json structure */
public String convertToJson ( Properties properties , String ... includeDomainKeys ) throws ParsePropertiesException { } }

implementation: return convertFromValuesAsObjectMap ( propertiesToMap ( properties ) , includeDomainKeys ) ;


signature:
public class FloatingActionButton { /** * Sets background color for this button .
 * Xml attribute : { @ code app : floatingActionButtonColor }
 * NOTE : this method sets the < code > mColorStateList < / code > field to < code > null < / code >
 * @ param color color */
public void setColor ( int color ) { } }

implementation: boolean changed = mColor != color || mColorStateList != null ; mColor = color ; mColorStateList = null ; if ( changed ) { updateBackground ( ) ; }


signature:
public class FloatingActionButton { /** * Sets color state list as background for this button .
 * Xml attribute : { @ code app : floatingActionButtonColor }
 * @ param colorStateList color */
public void setColorStateList ( ColorStateList colorStateList ) { } }

implementation: boolean changed = mColorStateList != colorStateList ; mColorStateList = colorStateList ; if ( changed ) { updateBackground ( ) ; }


signature:
public class FloatingActionButton { /** * Inflate and initialize background drawable for this view with arguments
 * inflated from xml or specified using { @ link # setSize ( int ) } or { @ link # setColor ( int ) }
 * Invoked from constructor , but it ' s allowed to invoke this method manually from code . */
public void initBackground ( ) { } }

implementation: final int backgroundId ; if ( mSize == SIZE_MINI ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { backgroundId = R . drawable . com_shamanland_fab_circle_mini ; } else { backgroundId = R . drawable . com_shamanland_fab_mini ; } } else { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { backgroundId = R . drawable . com_shamanland_fab_circle_normal ; } else { backgroundId = R . drawable . com_shamanland_fab_normal ; } } updateBackground ( getResources ( ) . getDrawable ( backgroundId ) ) ;


signature:
public class FloatingActionButton { /** * Calculates required radius of shadow .
 * @ param shadow underlay drawable
 * @ param circle overlay drawable
 * @ return calculated radius , always > = 1 */
protected static int getShadowRadius ( Drawable shadow , Drawable circle ) { } }

implementation: int radius = 0 ; if ( shadow != null && circle != null ) { Rect rect = new Rect ( ) ; radius = ( circle . getIntrinsicWidth ( ) + ( shadow . getPadding ( rect ) ? rect . left + rect . right : 0 ) ) / 2 ; } return Math . max ( 1 , radius ) ;


signature:
public class OcspMultiClient { /** * Builder to create an instance of the client .
 * @ return Prepared client . */
public static Builder < OcspMultiClient > builder ( ) { } }

implementation: return new Builder < > ( new BuildHandler < OcspMultiClient > ( ) { @ Override public OcspMultiClient build ( Properties properties ) { return new OcspMultiClient ( properties ) ; } } ) ;


signature:
public class ApacheOcspFetcher { /** * Builder to create an instance of OcspFetcher using Apache HttpClient for connectivity .
 * @ return Prepared fetcher . */
public static Builder < OcspFetcher > builder ( ) { } }

implementation: return new Builder < > ( new BuildHandler < OcspFetcher > ( ) { @ Override public OcspFetcher build ( Properties properties ) { return new ApacheOcspFetcher ( properties ) ; } } ) ;


signature:
public class AbstractOcspClient { /** * Method for finding issuer by provided issuers in properties given an issued certificate .
 * @ param certificate Issued certificate .
 * @ return Issuer of the issued certificate .
 * @ throws OcspException Thrown when no issuer is found . */
protected X509Certificate findIntermediate ( X509Certificate certificate ) throws OcspException { } }

implementation: for ( X509Certificate issuer : properties . get ( INTERMEDIATES ) ) if ( issuer . getSubjectX500Principal ( ) . equals ( certificate . getIssuerX500Principal ( ) ) ) return issuer ; throw new OcspException ( "Unable to find issuer '%s'." , certificate . getIssuerX500Principal ( ) . getName ( ) ) ;


signature:
public class OcspClient { /** * Builder to create an instance of the client .
 * @ return Prepared client . */
public static Builder < OcspClient > builder ( ) { } }

implementation: return new Builder < > ( new BuildHandler < OcspClient > ( ) { @ Override public OcspClient build ( Properties properties ) { return new OcspClient ( properties ) ; } } ) ;


signature:
public class MdPageGeneratorMojo { /** * Execute the maven plugin .
 * @ throws MojoExecutionException Something went wrong */
@ Override public void execute ( ) throws MojoExecutionException { } }

implementation:
// First , if filtering is enabled , perform that using the Maven magic
if ( applyFiltering ) { performMavenPropertyFiltering ( new File ( inputDirectory ) , filteredOutputDirectory , getInputEncoding ( ) ) ; inputDirectory = filteredOutputDirectory . getAbsolutePath ( ) ; } getLog ( ) . info ( "Pre-processing markdown files from input directory: " + inputDirectory ) ; preprocessMarkdownFiles ( new File ( inputDirectory ) ) ; if ( ! markdownDTOs . isEmpty ( ) ) { getLog ( ) . info ( "Process Pegdown extension options" ) ; int options = getPegdownExtensions ( pegdownExtensions ) ; final Map < String , Attributes > attributesMap = processAttributes ( attributes ) ; getLog ( ) . info ( "Parse Markdown to HTML" ) ; processMarkdown ( markdownDTOs , options , attributesMap ) ; } // FIXME : This will possibly overwrite any filtering updates made in the maven property filtering step above
if ( StringUtils . isNotEmpty ( copyDirectories ) ) { getLog ( ) . info ( "Copy files from directories" ) ; for ( String dir : copyDirectories . split ( "," ) ) { for ( Entry < String , String > copyAction : getFoldersToCopy ( inputDirectory , outputDirectory , dir ) . entrySet ( ) ) { copyFiles ( copyAction . getKey ( ) , copyAction . getValue ( ) ) ; } } }


signature:
public class MdPageGeneratorMojo { /** * Parse attributes of the form NodeName : attributeName = attribute value : attributeName = attribute value . . .
 * @ param attributeList list of attributes
 * @ return map of Node class to attributable part and attributes */
private Map < String , Attributes > processAttributes ( String [ ] attributeList ) { } }

implementation: HashMap < String , Attributes > nodeAttributeMap = new HashMap < > ( ) ; for ( String attribute : attributeList ) { String [ ] nodeAttributes = attribute . split ( "\\|" ) ; Attributes attributes = new Attributes ( ) ; for ( int i = 1 ; i < nodeAttributes . length ; i ++ ) { String [ ] attributeNameValue = nodeAttributes [ i ] . split ( "=" , 2 ) ; if ( attributeNameValue . length > 1 ) { String value = attributeNameValue [ 1 ] ; if ( ! value . isEmpty ( ) ) { if ( value . charAt ( 0 ) == '"' && value . charAt ( value . length ( ) - 1 ) == '"' ) { value = value . substring ( 1 , value . length ( ) - 1 ) ; } else if ( value . charAt ( 0 ) == '\'' && value . charAt ( value . length ( ) - 1 ) == '\'' ) { value = value . substring ( 1 , value . length ( ) - 1 ) ; } } attributes . addValue ( attributeNameValue [ 0 ] , value ) ; } else { attributes . addValue ( attributeNameValue [ 0 ] , attributeNameValue [ 0 ] ) ; } } nodeAttributeMap . put ( nodeAttributes [ 0 ] , attributes ) ; } return nodeAttributeMap ;


signature:
public class MdPageGeneratorMojo { /** * Read Markdown files from directory .
 * @ return boolean
 * Is there files to read
 * @ throws MojoExecutionException Unable to load file */
@ SuppressWarnings ( "UnusedReturnValue" ) private boolean preprocessMarkdownFiles ( File inputDirectory ) throws MojoExecutionException { } }

implementation:
getLog ( ) . debug ( "Read files from: " + inputDirectory ) ; try { if ( ! inputDirectory . exists ( ) ) { getLog ( ) . info ( "There is no input folder for the project. Skipping." ) ; return false ; } int baseDepth = StringUtils . countMatches ( inputDirectory . getAbsolutePath ( ) , File . separator ) ; // Reading just the markdown dir and sub dirs if recursive option set
List < File > markdownFiles = getFilesAsArray ( FileUtils . iterateFiles ( inputDirectory , getInputFileExtensions ( ) , recursiveInput ) ) ; for ( File file : markdownFiles ) { getLog ( ) . debug ( "File getName() " + file . getName ( ) ) ; getLog ( ) . debug ( "File getAbsolutePath() " + file . getAbsolutePath ( ) ) ; getLog ( ) . debug ( "File getPath() " + file . getPath ( ) ) ; MarkdownDTO dto = new MarkdownDTO ( ) ; dto . markdownFile = file ; dto . folderDepth = StringUtils . countMatches ( file . getAbsolutePath ( ) , File . separator ) - ( baseDepth + 1 ) ; if ( alwaysUseDefaultTitle ) { dto . title = defaultTitle ; } else { List < String > raw = FileUtils . readLines ( file , getInputEncoding ( ) ) ; dto . title = getTitle ( raw ) ; } if ( applyFiltering ) { for ( String line : FileUtils . readLines ( file , getInputEncoding ( ) ) ) { if ( isVariableLine ( line ) ) { String key = line . replaceAll ( "(^\\{)|(=.*)" , "" ) ; String value = line . replaceAll ( "(^\\{(.*?)=)|(}$)" , "" ) ; getLog ( ) . debug ( "Substitute: '" + key + "' -> '" + value + "'" ) ; dto . substitutes . put ( key , value ) ; } } } String inputFileExtension = FilenameUtils . getExtension ( file . getName ( ) ) ; dto . htmlFile = new File ( recursiveInput ? outputDirectory + File . separator + file . getParentFile ( ) . getPath ( ) . substring ( inputDirectory . getPath ( ) . length ( ) ) + File . separator + file . getName ( ) . replaceAll ( "." + inputFileExtension , ".html" ) : outputDirectory + File . separator + file . getName ( ) . replaceAll ( "." + inputFileExtension , ".html" ) ) ; getLog ( ) . debug ( "File htmlFile() " + dto . htmlFile ) ; markdownDTOs . add ( dto ) ; } } catch ( IOException e ) { throw new MojoExecutionException ( "Unable to load file " + e . getMessage ( ) , e ) ; } return true ;


signature:
public class MdPageGeneratorMojo { /** * Replace variables with given pattern .
 * @ param template String to replace
 * @ param patternString regexp pattern
 * @ param variables variables to find
 * @ return result */
private String substituteVariables ( String template , String patternString , Map < String , String > variables ) { } }

implementation:
Pattern pattern = Pattern . compile ( patternString ) ; Matcher matcher = pattern . matcher ( template ) ; StringBuffer buffer = new StringBuffer ( ) ; while ( matcher . find ( ) ) { if ( variables . containsKey ( matcher . group ( 1 ) ) ) { String replacement = variables . get ( matcher . group ( 1 ) ) ; // quote to work properly with $ and { , } signs
matcher . appendReplacement ( buffer , replacement != null ? Matcher . quoteReplacement ( replacement ) : "null" ) ; } } matcher . appendTail ( buffer ) ; return buffer . toString ( ) ;


signature:
public class MdPageGeneratorMojo { /** * Going through list of DTOs and parsing the markdown into HTML .
 * Add header and footer to the big String .
 * @ throws MojoExecutionException Unable to write file */
private void processMarkdown ( List < MarkdownDTO > markdownDTOs , int options , final Map < String , Attributes > attributesMap ) throws MojoExecutionException { } }

implementation:
getLog ( ) . debug ( "Process Markdown" ) ; getLog ( ) . debug ( "inputEncoding: '" + getInputEncoding ( ) + "', outputEncoding: '" + getOutputEncoding ( ) + "'" ) ; // getLog ( ) . debug ( " parsingTimeout : " + getParsingTimeoutInMillis ( ) + " ms " ) ;
getLog ( ) . debug ( "applyFiltering: " + applyFiltering ) ; MutableDataHolder flexmarkOptions = PegdownOptionsAdapter . flexmarkOptions ( options ) . toMutable ( ) ; ArrayList < Extension > extensions = new ArrayList < Extension > ( ) ; for ( Extension extension : flexmarkOptions . get ( Parser . EXTENSIONS ) ) { extensions . add ( extension ) ; } if ( transformRelativeMarkdownLinks ) { flexmarkOptions . set ( PageGeneratorExtension . INPUT_FILE_EXTENSIONS , inputFileExtensions ) ; extensions . add ( PageGeneratorExtension . create ( ) ) ; } if ( ! attributesMap . isEmpty ( ) ) { flexmarkOptions . set ( AttributesExtension . ATTRIBUTE_MAP , attributesMap ) ; extensions . add ( AttributesExtension . create ( ) ) ; } flexmarkOptions . set ( Parser . EXTENSIONS , extensions ) ; Parser parser = Parser . builder ( flexmarkOptions ) . build ( ) ; HtmlRenderer renderer = HtmlRenderer . builder ( flexmarkOptions ) . build ( ) ; for ( MarkdownDTO dto : markdownDTOs ) { getLog ( ) . debug ( "dto: " + dto ) ; try { String headerHtml = "" ; String footerHtml = "" ; try { if ( StringUtils . isNotEmpty ( headerHtmlFile ) ) { headerHtml = FileUtils . readFileToString ( new File ( headerHtmlFile ) , getInputEncoding ( ) ) ; headerHtml = addTitleToHtmlFile ( headerHtml , dto . title ) ; headerHtml = replaceVariables ( headerHtml , dto . substitutes ) ; headerHtml = updateRelativePaths ( headerHtml , dto . folderDepth ) ; } if ( StringUtils . isNotEmpty ( footerHtmlFile ) ) { footerHtml = FileUtils . readFileToString ( new File ( footerHtmlFile ) , getInputEncoding ( ) ) ; footerHtml = replaceVariables ( footerHtml , dto . substitutes ) ; footerHtml = updateRelativePaths ( footerHtml , dto . folderDepth ) ; } } catch ( FileNotFoundException e ) { if ( failIfFilesAreMissing ) { throw e ; } else { getLog ( ) . warn ( "header and/or footer file is missing." ) ; headerHtml = "" ; footerHtml = "" ; } } catch ( Exception e ) { throw new MojoExecutionException ( "Error while processing header/footer: " + e . getMessage ( ) , e ) ; } String markdown = FileUtils . readFileToString ( dto . markdownFile , getInputEncoding ( ) ) ; markdown = replaceVariables ( markdown , dto . substitutes ) ; // getLog ( ) . debug ( markdown ) ;
String markdownAsHtml ; Node document = parser . parse ( markdown ) ; markdownAsHtml = renderer . render ( document ) ; String data = headerHtml + markdownAsHtml + footerHtml ; FileUtils . writeStringToFile ( dto . htmlFile , data , getOutputEncoding ( ) ) ; } catch ( MojoExecutionException e ) { throw e ; } catch ( IOException e ) { getLog ( ) . error ( "Error : " + e . getMessage ( ) , e ) ; throw new MojoExecutionException ( "Unable to write file " + e . getMessage ( ) , e ) ; } }


signature:
public class MdPageGeneratorMojo { /** * Get the first h1 for the title .
 * @ param raw The markdown as a list of strings
 * @ return The first # h1 in the Markdown file */
private String getTitle ( List < String > raw ) { } }

implementation:
if ( raw == null ) { return defaultTitle ; } String previousLine = "" ; for ( String line : raw ) { line = line . trim ( ) ; if ( line . startsWith ( "#" ) ) { line = line . replace ( "#" , "" ) ; return line ; } // Checking for Setext style headers .
// Line is considered a match if it passes :
// Starts with either = or -
// It has the same number of characters as the previous line
// It only contains - or = and nothing else .
// If there is a match we consider the previous line to be the title .
if ( ( line . startsWith ( "=" ) && StringUtils . countMatches ( line , "=" ) == previousLine . length ( ) && line . matches ( "^=+$" ) ) || ( line . startsWith ( "-" ) && StringUtils . countMatches ( line , "-" ) == previousLine . length ( ) && line . matches ( "^-+$" ) ) ) { return previousLine ; } previousLine = line ; } return defaultTitle ;


signature:
public class MdPageGeneratorMojo { /** * Adds the title to the html file .
 * @ param html The HTML string
 * @ param title The title */
private String addTitleToHtmlFile ( String html , String title ) { } }

implementation: if ( html == null ) { return html ; } if ( title != null ) { getLog ( ) . debug ( "Setting the title in the HTML file to: " + title ) ; return html . replaceFirst ( "titleToken" , title ) ; } else { getLog ( ) . debug ( "Title was null, setting the title in the HTML file to an empty string" ) ; return html . replaceFirst ( "titleToken" , "" ) ; }


signature:
public class MdPageGeneratorMojo { /** * Replace variables in the html file .
 * @ param initialContent html
 * @ param variables variable map
 * @ return the updated html */
private String replaceVariables ( String initialContent , Map < String , String > variables ) { } }

implementation:
String newContent = initialContent ; // Only apply substitution if filtering is enabled and there is actually something to
// substitute , otherwise just return the original content .
if ( applyFiltering && newContent != null ) { newContent = newContent . replaceAll ( "\\{\\w*=.*}" , "" ) ; if ( variables != null ) { newContent = substituteVariables ( newContent , "\\$\\{(.+?)\\}" , variables ) ; } } return newContent ;


signature:
public class MdPageGeneratorMojo { /** * Update relative include paths corresponding to the markdown file ' s location in the folder structure .
 * @ param html The HTML string
 * @ param folderDepth Current markdown file ' s folder depth */
private String updateRelativePaths ( String html , int folderDepth ) { } }

implementation: if ( html == null ) { return html ; } getLog ( ) . debug ( "Updating relative paths in html includes (css, js)." ) ; return html . replaceAll ( "##SITE_BASE##" , getSiteBasePrefix ( folderDepth ) ) ;


signature:
public class MdPageGeneratorMojo { /** * Copy files from one dir to another based on file extensions .
 * @ param fromDir the directory to copy from
 * @ param toDir the directory to copy to
 * @ throws MojoExecutionException Unable to copy file */
private void copyFiles ( String fromDir , String toDir ) throws MojoExecutionException { } }

implementation: getLog ( ) . debug ( "fromDir=" + fromDir + "; toDir=" + toDir ) ; try { File fromDirFile = new File ( fromDir ) ; if ( fromDirFile . exists ( ) ) { Iterator < File > files = FileUtils . iterateFiles ( new File ( fromDir ) , null , false ) ; while ( files . hasNext ( ) ) { File file = files . next ( ) ; if ( file . exists ( ) ) { FileUtils . copyFileToDirectory ( file , new File ( toDir ) ) ; } else { getLog ( ) . error ( "File '" + file . getAbsolutePath ( ) + "' does not exist. Skipping copy" ) ; } } } } catch ( IOException e ) { throw new MojoExecutionException ( "Unable to copy file " + e . getMessage ( ) , e ) ; }


signature:
public class MdPageGeneratorMojo { /** * This solves https : / / issues . apache . org / jira / browse / MRESOURCES - 99 . < br / >
 * BUT : < br / >
 * This should be done different than defining those properties a second time , cause they have already being defined
 * in Maven Model Builder ( package org . apache . maven . model . interpolation ) via BuildTimestampValueSource . But those
 * can ' t be found in the context which can be got from the maven core . < br / >
 * A solution could be to put those values into the context by Maven core so they are accessible everywhere . ( I ' m
 * not sure if this is a good idea ) . Better ideas are always welcome .
 * The problem at the moment is that maven core handles usage of properties and replacements in
 * the model , but does not the resource filtering which needed some of the properties .
 * @ return the new instance with those properties . */
private Properties addSeveralSpecialProperties ( ) { } }

implementation: String timeStamp = new MavenBuildTimestamp ( new Date ( ) , timestampFormat ) . formattedTimestamp ( ) ; Properties additionalProperties = new Properties ( ) ; additionalProperties . put ( "mdpagegenerator.timestamp" , timeStamp ) ; if ( project . getBasedir ( ) != null ) { additionalProperties . put ( "project.baseUri" , project . getBasedir ( ) . getAbsoluteFile ( ) . toURI ( ) . toString ( ) ) ; } return additionalProperties ;


signature:
public class BaseClient { /** * When retrieving ' more ' statements , LRS will return full path . . the client will have part in the URI already so cut that off */
protected String checkPath ( String path ) { } }

implementation: if ( path . toLowerCase ( ) . contains ( "statements" ) && path . toLowerCase ( ) . contains ( "more" ) ) { int pathLength = this . _host . getPath ( ) . length ( ) ; return path . substring ( pathLength , path . length ( ) ) ; } return path ;


signature:
public class CrossfadeDrawerLayout { /** * this will wrap the view which is added to the slider into another layout so we can then overlap the small and large view
 * @ param child
 * @ param index
 * @ return */
private View wrapSliderContent ( View child , int index ) { } }

implementation:
// TODO ! !
if ( index == 1 && child . getId ( ) != - 1 ) { mLargeView = ( ViewGroup ) child ; mContainer = new ScrimInsetsRelativeLayout ( getContext ( ) ) ; mContainer . setGravity ( Gravity . START ) ; mContainer . setLayoutParams ( child . getLayoutParams ( ) ) ; mContainer . addView ( mLargeView , ViewGroup . LayoutParams . MATCH_PARENT , ViewGroup . LayoutParams . MATCH_PARENT ) ; mSmallView = new LinearLayout ( getContext ( ) ) ; mContainer . addView ( mSmallView , ViewGroup . LayoutParams . MATCH_PARENT , ViewGroup . LayoutParams . MATCH_PARENT ) ; mLargeView . setAlpha ( 0 ) ; mLargeView . setVisibility ( View . GONE ) ; // correct fitsSystemWindows handling
mContainer . setFitsSystemWindows ( true ) ; mSmallView . setFitsSystemWindows ( true ) ; return mContainer ; } return child ;


signature:
public class CrossfadeDrawerLayout { /** * animate to the large view
 * @ param duration */
public void fadeUp ( int duration ) { } }

implementation:
// animate up
mContainer . clearAnimation ( ) ; ResizeWidthAnimation anim = new ResizeWidthAnimation ( mContainer , mMaxWidth , new ApplyTransformationListener ( ) { @ Override public void applyTransformation ( int width ) { overlapViews ( width ) ; } } ) ; anim . setDuration ( duration ) ; mContainer . startAnimation ( anim ) ;


signature:
public class CrossfadeDrawerLayout { /** * animate to the small view
 * @ param duration */
public void fadeDown ( int duration ) { } }

implementation:
// fade down
mContainer . clearAnimation ( ) ; ResizeWidthAnimation anim = new ResizeWidthAnimation ( mContainer , mMinWidth , new ApplyTransformationListener ( ) { @ Override public void applyTransformation ( int width ) { overlapViews ( width ) ; } } ) ; anim . setDuration ( duration ) ; mContainer . startAnimation ( anim ) ;


signature:
public class CrossfadeDrawerLayout { /** * calculate the percentage to how many percent the slide is already visible
 * @ param width
 * @ return */
private float calculatePercentage ( int width ) { } }

implementation:
int absolute = mMaxWidth - mMinWidth ; int current = width - mMinWidth ; float percentage = 100.0f * current / absolute ; // we can assume that we are crossfaded if the percentage is > 90
mIsCrossfaded = percentage > 90 ; return percentage ;


signature:
public class CrossfadeDrawerLayout { /** * overlap the views and provide the crossfade effect
 * @ param width */
private void overlapViews ( int width ) { } }

implementation:
if ( width == mWidth ) { return ; } // remember this width so it is ' t processed twice
mWidth = width ; float percentage = calculatePercentage ( width ) ; float alpha = percentage / 100 ; mSmallView . setAlpha ( 1 ) ; mSmallView . setClickable ( false ) ; mLargeView . bringToFront ( ) ; mLargeView . setAlpha ( alpha ) ; mLargeView . setClickable ( true ) ; mLargeView . setVisibility ( alpha > 0.01f ? View . VISIBLE : View . GONE ) ; // notify the crossfadeListener
if ( mCrossfadeListener != null ) { mCrossfadeListener . onCrossfade ( mContainer , calculatePercentage ( width ) , width ) ; }


signature:
public class UseActivityInterceptor { /** * The intent to launch the Activity .
 * @ param targetPackage The package of the Activity .
 * @ param activityClass The Activity class send the intent to .
 * @ param bundleCreator Bundle creator instance that will give a bundle to the activity .
 * @ param < T > The specific Activity type .
 * @ return The intent to start the activity . */
protected < T extends Activity > Intent getLaunchIntent ( String targetPackage , Class < T > activityClass , BundleCreator bundleCreator ) { } }

implementation: Intent intent = new Intent ( Intent . ACTION_MAIN ) ; intent . setClassName ( targetPackage , activityClass . getName ( ) ) ; intent . putExtras ( bundleCreator . createBundle ( ) ) ; intent . addFlags ( Intent . FLAG_ACTIVITY_NEW_TASK ) ; return intent ;


signature:
public class UseActivityInterceptor { /** * Launch the activity if needed . */
@ SuppressWarnings ( "unchecked" ) private void launchActivity ( ) { } }

implementation: if ( activity != null && ActivityRunMode . SPECIFICATION . equals ( activityRunMode ) ) return ; String targetPackage = instrumentation . getTargetContext ( ) . getPackageName ( ) ; Intent intent = getLaunchIntent ( targetPackage , activityClass , bundleCreator ) ; activity = instrumentation . startActivitySync ( intent ) ; instrumentation . waitForIdleSync ( ) ;


signature:
public class TodosApi { /** * getTodos
 * Retrieves all todos a user can read .
 * @ param type Specifies the todo type ( optional )
 * @ param status Specifies the todo status ( optional )
 * @ param factSheetId Specifies the ID of the Fact Sheet the todo is connected to - only works with manual Todos ( optional )
 * @ param userId Specify the user Id for the user to look for ( optional )
 * @ param workspaceId Id of the workspace to get the TodoItems from . ( optional )
 * @ param getArchived If set to true , then todos associated with archived factsheets are retrieved as well ( optional , default to false )
 * @ param size Specifies the number of Todos to get , ( optional , default to 10)
 * @ param page Specifies the page of Todos to get , ( optional , default to 1)
 * @ return TodoListResponse
 * @ throws ApiException if fails to make API call */
public TodoListResponse getTodos ( String type , String status , UUID factSheetId , UUID userId , UUID workspaceId , Boolean getArchived , Integer size , Integer page ) throws ApiException { } }

implementation:
Object localVarPostBody = null ; // create path and map variables
String localVarPath = "/todos" . replaceAll ( "\\{format\\}" , "json" ) ; // query params
List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "type" , type ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "status" , status ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "factSheetId" , factSheetId ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "userId" , userId ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "workspaceId" , workspaceId ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "getArchived" , getArchived ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "size" , size ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "page" , page ) ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { "application/json" } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "token" } ; GenericType < TodoListResponse > localVarReturnType = new GenericType < TodoListResponse > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "GET" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ;


signature:
public class FactSheetsApi { /** * getFactSheets
 * Retrieves all Fact Sheets
 * @ param type Only list Fact Sheets with this type ( optional )
 * @ param relationTypes Comma separated list of relation types to show on the Fact Sheets ( optional )
 * @ param pageSize Number of Fact Sheets to return , maximum is 100 ( optional , default to 40)
 * @ param cursor Marks the position of the first element that should be returned ( optional )
 * @ param permissions Show a permission field for the Fact Sheet ( optional , default to false )
 * @ return FactSheetListResponse
 * @ throws ApiException if fails to make API call */
public FactSheetListResponse getFactSheets ( String type , String relationTypes , Integer pageSize , String cursor , Boolean permissions ) throws ApiException { } }

implementation:
Object localVarPostBody = null ; // create path and map variables
String localVarPath = "/factSheets" . replaceAll ( "\\{format\\}" , "json" ) ; // query params
List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "type" , type ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "relationTypes" , relationTypes ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "pageSize" , pageSize ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "cursor" , cursor ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "permissions" , permissions ) ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { "application/json" } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "token" } ; GenericType < FactSheetListResponse > localVarReturnType = new GenericType < FactSheetListResponse > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "GET" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ;


signature:
public class ApiClient { /** * Set the connect timeout ( in milliseconds ) .
 * A value of 0 means no timeout , otherwise values must be between 1 and
 * { @ link Integer # MAX _ VALUE } . */
public ApiClient setConnectTimeout ( int connectionTimeout ) { } }

implementation: this . connectionTimeout = connectionTimeout ; httpClient . property ( ClientProperties . CONNECT_TIMEOUT , connectionTimeout ) ; return this ;


signature:
public class ApiClient { /** * Set the date format used to parse / format date parameters . */
public ApiClient setDateFormat ( DateFormat dateFormat ) { } }

implementation:
this . dateFormat = dateFormat ; // also set the date format for model ( de ) serialization with Date properties
this . json . setDateFormat ( ( DateFormat ) dateFormat . clone ( ) ) ; return this ;


signature:
public class ApiClient { /** * Serialize the given Java object into string entity according the given
 * Content - Type ( only JSON is supported for now ) . */
public Entity < ? > serialize ( Object obj , Map < String , Object > formParams , String contentType ) throws ApiException { } }

implementation:
Entity < ? > entity = null ; if ( contentType . startsWith ( "multipart/form-data" ) ) { MultiPart multiPart = new MultiPart ( ) ; for ( Entry < String , Object > param : formParams . entrySet ( ) ) { if ( param . getValue ( ) instanceof File ) { File file = ( File ) param . getValue ( ) ; FormDataContentDisposition contentDisp = FormDataContentDisposition . name ( param . getKey ( ) ) . fileName ( file . getName ( ) ) . size ( file . length ( ) ) . build ( ) ; multiPart . bodyPart ( new FormDataBodyPart ( contentDisp , file , MediaType . APPLICATION_OCTET_STREAM_TYPE ) ) ; } else { FormDataContentDisposition contentDisp = FormDataContentDisposition . name ( param . getKey ( ) ) . build ( ) ; multiPart . bodyPart ( new FormDataBodyPart ( contentDisp , parameterToString ( param . getValue ( ) ) ) ) ; } } entity = Entity . entity ( multiPart , MediaType . MULTIPART_FORM_DATA_TYPE ) ; } else if ( contentType . startsWith ( "application/x-www-form-urlencoded" ) ) { Form form = new Form ( ) ; for ( Entry < String , Object > param : formParams . entrySet ( ) ) { form . param ( param . getKey ( ) , parameterToString ( param . getValue ( ) ) ) ; } entity = Entity . entity ( form , MediaType . APPLICATION_FORM_URLENCODED_TYPE ) ; } else { // We let jersey handle the serialization
entity = Entity . entity ( obj , contentType ) ; } return entity ;


signature:
public class ApiClient { /** * Deserialize response body to Java object according to the Content - Type . */
public < T > T deserialize ( Response response , GenericType < T > returnType ) throws ApiException { } }

implementation:
// Handle file downloading .
if ( returnType . equals ( File . class ) ) { @ SuppressWarnings ( "unchecked" ) T file = ( T ) downloadFileFromResponse ( response ) ; return file ; } String contentType = null ; List < Object > contentTypes = response . getHeaders ( ) . get ( "Content-Type" ) ; if ( contentTypes != null && ! contentTypes . isEmpty ( ) ) contentType = String . valueOf ( contentTypes . get ( 0 ) ) ; if ( contentType == null ) throw new ApiException ( 500 , "missing Content-Type in response" ) ; return response . readEntity ( returnType ) ;


signature:
public class ApiClient { /** * Download file from the given response .
 * @ throws ApiException If fail to read file content from response and write to disk */
public File downloadFileFromResponse ( Response response ) throws ApiException { } }

implementation: try { File file = prepareDownloadFile ( response ) ; Files . copy ( response . readEntity ( InputStream . class ) , file . toPath ( ) ) ; return file ; } catch ( IOException e ) { throw new ApiException ( e ) ; }


signature:
public class ApiClient { /** * Invoke API by sending HTTP request with the given options .
 * @ param path The sub - path of the HTTP URL
 * @ param method The request method , one of " GET " , " POST " , " PUT " , and " DELETE "
 * @ param queryParams The query parameters
 * @ param body The request body object
 * @ param headerParams The header parameters
 * @ param formParams The form parameters
 * @ param accept The request ' s Accept header
 * @ param contentType The request ' s Content - Type header
 * @ param authNames The authentications to apply
 * @ param returnType The return type into which to deserialize the response
 * @ return The response body in type of string */
public < T > T invokeAPI ( String path , String method , List < Pair > queryParams , Object body , Map < String , String > headerParams , Map < String , Object > formParams , String accept , String contentType , String [ ] authNames , GenericType < T > returnType ) throws ApiException { } }

implementation:
updateParamsForAuth ( new String [ ] { "token" , "apiKey" } /* authNames */
, queryParams , headerParams ) ; // Not using ` . target ( this . basePath ) . path ( path ) ` below ,
// to support ( constant ) query string in ` path ` , e . g . " / posts ? draft = 1"
WebTarget target = httpClient . target ( this . basePath + path ) ; if ( queryParams != null ) { for ( Pair queryParam : queryParams ) { if ( queryParam . getValue ( ) != null ) { target = target . queryParam ( queryParam . getName ( ) , queryParam . getValue ( ) ) ; } } } Invocation . Builder invocationBuilder = target . request ( ) . accept ( accept ) ; for ( String key : headerParams . keySet ( ) ) { String value = headerParams . get ( key ) ; if ( value != null ) { invocationBuilder = invocationBuilder . header ( key , value ) ; } } for ( String key : defaultHeaderMap . keySet ( ) ) { if ( ! headerParams . containsKey ( key ) ) { String value = defaultHeaderMap . get ( key ) ; if ( value != null ) { invocationBuilder = invocationBuilder . header ( key , value ) ; } } } Entity < ? > entity = serialize ( body , formParams , contentType ) ; Response response = null ; if ( "GET" . equals ( method ) ) { response = invocationBuilder . get ( ) ; } else if ( "POST" . equals ( method ) ) { response = invocationBuilder . post ( entity ) ; } else if ( "PUT" . equals ( method ) ) { response = invocationBuilder . put ( entity ) ; } else if ( "DELETE" . equals ( method ) ) { response = invocationBuilder . delete ( ) ; } else { throw new ApiException ( 500 , "unknown method type " + method ) ; } statusCode = response . getStatusInfo ( ) . getStatusCode ( ) ; responseHeaders = buildResponseHeaders ( response ) ; if ( response . getStatus ( ) == Status . NO_CONTENT . getStatusCode ( ) ) { return null ; } else if ( response . getStatusInfo ( ) . getFamily ( ) . equals ( Status . Family . SUCCESSFUL ) ) { if ( returnType == null ) return null ; else return deserialize ( response , returnType ) ; } else { String message = "error" ; String respBody = null ; if ( response . hasEntity ( ) ) { try { respBody = String . valueOf ( response . readEntity ( String . class ) ) ; message = respBody ; } catch ( RuntimeException e ) { // e . printStackTrace ( ) ;
} } throw new ApiException ( response . getStatus ( ) , message , buildResponseHeaders ( response ) , respBody ) ; }


signature:
public class ApiClient { /** * Build the Client used to make HTTP requests . */
private Client buildHttpClient ( boolean debugging ) { } }

implementation: final ClientConfig clientConfig = new ClientConfig ( ) ; clientConfig . register ( MultiPartFeature . class ) ; clientConfig . register ( json ) ; clientConfig . register ( JacksonFeature . class ) ; if ( debugging ) { clientConfig . register ( LoggingFilter . class ) ; } return ClientBuilder . newClient ( clientConfig ) ;


signature:
public class ModelsApi { /** * createAccessControlEntity
 * Creates an access control entity
 * @ param body New access control entity ( optional )
 * @ return AccessControlEntityResponse
 * @ throws ApiException if fails to make API call */
public AccessControlEntityResponse createAccessControlEntity ( AccessControlEntity body ) throws ApiException { } }

implementation:
Object localVarPostBody = body ; // create path and map variables
String localVarPath = "/models/accessControlEntities" . replaceAll ( "\\{format\\}" , "json" ) ; // query params
List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { "application/json" } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "token" } ; GenericType < AccessControlEntityResponse > localVarReturnType = new GenericType < AccessControlEntityResponse > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "POST" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ;


signature:
public class ModelsApi { /** * updateDataModel
 * Updates the data model for a workspace
 * @ param body the data model for the workspace ( required )
 * @ param force whether changes should be forced ( optional , default to false )
 * @ param workspaceId ( optional )
 * @ return DataModelUpdateResponse
 * @ throws ApiException if fails to make API call */
public DataModelUpdateResponse updateDataModel ( DataModel body , Boolean force , String workspaceId ) throws ApiException { } }

implementation:
Object localVarPostBody = body ; // verify the required parameter ' body ' is set
if ( body == null ) { throw new ApiException ( 400 , "Missing the required parameter 'body' when calling updateDataModel" ) ; } // create path and map variables
String localVarPath = "/models/dataModel" . replaceAll ( "\\{format\\}" , "json" ) ; // query params
List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "force" , force ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "workspaceId" , workspaceId ) ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { "application/json" } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "token" } ; GenericType < DataModelUpdateResponse > localVarReturnType = new GenericType < DataModelUpdateResponse > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "PUT" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ;


signature:
public class ExportsApi { /** * createFullExport
 * Creates a full export of the workspace data , or an export of the changelog , depending on given type
 * @ param exportType The type of the export , must be either SNAPSHOT , AUDIT _ LOG or AUDIT _ LOG _ LEGACY ( optional )
 * @ param startDate The start date of the audit log export in ISO - 8601 format . ( optional )
 * @ param endDate The end date of the audit log export in ISO - 8601 format . If left empty today is assumed ( optional )
 * @ return JobResponse
 * @ throws ApiException if fails to make API call */
public JobResponse createFullExport ( String exportType , String startDate , String endDate ) throws ApiException { } }

implementation:
Object localVarPostBody = null ; // create path and map variables
String localVarPath = "/exports/fullExport" . replaceAll ( "\\{format\\}" , "json" ) ; // query params
List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "exportType" , exportType ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "startDate" , startDate ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "endDate" , endDate ) ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { "application/json" } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { } ; GenericType < JobResponse > localVarReturnType = new GenericType < JobResponse > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "POST" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ;


signature:
public class ExportsApi { /** * getExports
 * Lists all exports of the given type in the workspace of the authorized user
 * @ param exportType Comma separated list of types of exports to return , if left empty AUDIT _ LOG and SNAPSHOT , and AUDIT _ LOG _ LEGACY exports are returned ( optional )
 * @ param userId Retrieve exports initiated by the given user ( optional )
 * @ param pageSize Number of Exports to return , maximum is 100 ( optional , default to 40)
 * @ param cursor Marks the position of the first element that should be returned ( optional )
 * @ param sorting the field to sort the results by ( optional , default to createdAt )
 * @ param sortDirection the direction of the sorting ( optional , default to ASC )
 * @ return ExportListResponse
 * @ throws ApiException if fails to make API call */
public ExportListResponse getExports ( String exportType , UUID userId , Integer pageSize , String cursor , String sorting , String sortDirection ) throws ApiException { } }

implementation:
Object localVarPostBody = null ; // create path and map variables
String localVarPath = "/exports" . replaceAll ( "\\{format\\}" , "json" ) ; // query params
List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "exportType" , exportType ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "userId" , userId ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "pageSize" , pageSize ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "cursor" , cursor ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "sorting" , sorting ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "sortDirection" , sortDirection ) ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { } ; GenericType < ExportListResponse > localVarReturnType = new GenericType < ExportListResponse > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "GET" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ;


signature:
public class BookmarkWorkingCopy { /** * Get state
 * @ return state */
@ ApiModelProperty ( example = "null" , required = true , value = "" ) public Map < String , Object > getState ( ) { } }

implementation: return state ;


signature:
public class ApiClientBuilder { /** * Specifies all urls needed to get an access token based on given host name and common url naming convention .
 * @ param host
 * @ return */
public ApiClientBuilder withTokenProviderHost ( String host ) { } }

implementation: withOAuth2TokenUrl ( URI . create ( String . format ( "https://%s/services/mtm/v1/oauth2/token" , host ) ) ) ; return this ;


signature:
public class ApiClientBuilder { /** * Sets your client Id and client Secret .
 * @ param clientId
 * @ param clientSecret
 * @ return */
public ApiClientBuilder withClientCredentials ( String clientId , String clientSecret ) { } }

implementation: this . clientId = clientId ; this . clientSecret = clientSecret ; return this ;


signature:
public class GraphqlApi { /** * processGraphQLMultipart
 * Processes GraphQL requests , supporting multipart documents
 * @ param graphQLRequest ( required )
 * @ param file ( required )
 * @ return GraphQLResult
 * @ throws ApiException if fails to make API call */
public GraphQLResult processGraphQLMultipart ( String graphQLRequest , File file ) throws ApiException { } }

implementation:
Object localVarPostBody = null ; // verify the required parameter ' graphQLRequest ' is set
if ( graphQLRequest == null ) { throw new ApiException ( 400 , "Missing the required parameter 'graphQLRequest' when calling processGraphQLMultipart" ) ; } // verify the required parameter ' file ' is set
if ( file == null ) { throw new ApiException ( 400 , "Missing the required parameter 'file' when calling processGraphQLMultipart" ) ; } // create path and map variables
String localVarPath = "/graphql/upload" . replaceAll ( "\\{format\\}" , "json" ) ; // query params
List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; if ( graphQLRequest != null ) localVarFormParams . put ( "graphQLRequest" , graphQLRequest ) ; if ( file != null ) localVarFormParams . put ( "file" , file ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { "multipart/form-data" } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "token" } ; GenericType < GraphQLResult > localVarReturnType = new GenericType < GraphQLResult > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "POST" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ;


signature:
public class WebCallbackValidator { /** * Get params
 * @ return params */
@ ApiModelProperty ( example = "null" , required = true , value = "" ) public Map < String , String > getParams ( ) { } }

implementation: return params ;


signature:
public class BookmarksApi { /** * getBookmarks
 * Retrieves all stored bookmarks a user can read .
 * @ param bookmarkType Specifies the bookmark type ( required )
 * @ param groupKey A key used to separate bookmarks within the same query type ( optional )
 * @ param sharingType Specifies the sharing type which the returned bookmarks need to have ( optional )
 * @ return BookmarkListResponse
 * @ throws ApiException if fails to make API call */
public BookmarkListResponse getBookmarks ( String bookmarkType , String groupKey , String sharingType ) throws ApiException { } }

implementation:
Object localVarPostBody = null ; // verify the required parameter ' bookmarkType ' is set
if ( bookmarkType == null ) { throw new ApiException ( 400 , "Missing the required parameter 'bookmarkType' when calling getBookmarks" ) ; } // create path and map variables
String localVarPath = "/bookmarks" . replaceAll ( "\\{format\\}" , "json" ) ; // query params
List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "bookmarkType" , bookmarkType ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "groupKey" , groupKey ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "sharingType" , sharingType ) ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { "application/json" } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "token" } ; GenericType < BookmarkListResponse > localVarReturnType = new GenericType < BookmarkListResponse > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "GET" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ;


signature:
public class MarkLogicDatasetGraph { /** * Maps Jena bindings defined by a variable name and a
 * { @ link org . apache . jena . graph . Node } to MarkLogic
 * { @ link com . marklogic . client . semantics . SPARQLQueryDefinition } bindings .
 * @ param qdef
 * A { @ link com . marklogic . client . semantics . SPARQLQueryDefinition }
 * to decorate with a binding .
 * @ param variableName
 * Name of the variable
 * @ param objectNode
 * An RDF node with the value of variableName .
 * @ return The query definition , with binding set . */
public static SPARQLQueryDefinition bindObject ( SPARQLQueryDefinition qdef , String variableName , Node objectNode ) { } }

implementation:
SPARQLBindings bindings = qdef . getBindings ( ) ; if ( objectNode . isURI ( ) ) { bindings . bind ( variableName , objectNode . getURI ( ) ) ; } else if ( objectNode . isLiteral ( ) ) { if ( ! "" . equals ( objectNode . getLiteralLanguage ( ) ) ) { String languageTag = objectNode . getLiteralLanguage ( ) ; bindings . bind ( variableName , objectNode . getLiteralLexicalForm ( ) , Locale . forLanguageTag ( languageTag ) ) ; } else if ( objectNode . getLiteralDatatype ( ) != null ) { try { String xsdType = objectNode . getLiteralDatatypeURI ( ) ; String fragment = new URI ( xsdType ) . getFragment ( ) ; bindings . bind ( variableName , objectNode . getLiteralLexicalForm ( ) , RDFTypes . valueOf ( fragment . toUpperCase ( ) ) ) ; } catch ( URISyntaxException e ) { throw new MarkLogicJenaException ( "Unrecognized binding type.  Use XSD only." , e ) ; } } else { // is this a hole , no type string ?
bindings . bind ( variableName , objectNode . getLiteralLexicalForm ( ) , RDFTypes . STRING ) ; } } qdef . setBindings ( bindings ) ; return qdef ;


signature:
public class MarkLogicDatasetGraph { /** * @ see org . apache . jena . sparql . core . DatasetGraphTriplesQuads Internally uses
 * a write cache to hold batches of quad updates . @ see sync ( ) */
@ Override protected void addToDftGraph ( Node s , Node p , Node o ) { } }

implementation: checkIsOpen ( ) ; Node s1 = skolemize ( s ) ; Node p1 = skolemize ( p ) ; Node o1 = skolemize ( o ) ; client . sinkQuad ( null , s1 , p1 , o1 ) ;


signature:
public class MarkLogicDatasetGraph { /** * Merges triples into a graph on the MarkLogic server . mergeGraph ( ) is NOT
 * part of Jena ' s DatasetGraph interface .
 * @ param graphName
 * The graph to merge with server state .
 * @ param graph
 * The graph data . */
public void mergeGraph ( Node graphName , Graph graph ) { } }

implementation: checkIsOpen ( ) ; sync ( ) ; client . mergeGraph ( graphName . getURI ( ) , graph ) ;


signature:
public class MarkLogicDatasetGraph { /** * Adds permissions to a graph .
 * @ param graphName
 * the node with the graph ' s name .
 * @ param permissions
 * A { @ link com . marklogic . client . semantics . GraphPermissions }
 * object holding the graph ' s permissions . */
public void addPermissions ( Node graphName , GraphPermissions permissions ) { } }

implementation: checkIsOpen ( ) ; client . mergeGraphPermissions ( graphName . getURI ( ) , permissions ) ;


signature:
public class MarkLogicDatasetGraph { /** * Sets the permissions on a graph .
 * @ param graphName
 * the node with the graph ' s name .
 * @ param permissions
 * A { @ link com . marklogic . client . semantics . GraphPermissions }
 * object holding the graph ' s permissions . */
public void writePermissions ( Node graphName , GraphPermissions permissions ) { } }

implementation: checkIsOpen ( ) ; client . writeGraphPermissions ( graphName . getURI ( ) , permissions ) ;


signature:
public class MarkLogicDatasetGraph { /** * Fluent setter for rulesets .
 * @ param rulesets
 * Zero - or - more rulesets to apply to queries .
 * @ return The MarkLogicDatasetGraph , with rulesets set . */
public MarkLogicDatasetGraph withRulesets ( SPARQLRuleset ... rulesets ) { } }

implementation: if ( this . rulesets == null ) { this . rulesets = rulesets ; } else { Collection < SPARQLRuleset > collection = new ArrayList < SPARQLRuleset > ( ) ; collection . addAll ( Arrays . asList ( this . rulesets ) ) ; collection . addAll ( Arrays . asList ( rulesets ) ) ; this . rulesets = collection . toArray ( new SPARQLRuleset [ ] { } ) ; } return this ;


signature:
public class JenaDatabaseClient { /** * Close the connection and free resources */
public void close ( ) { } }

implementation: if ( writeBuffer != null ) { writeBuffer . cancel ( ) ; } if ( timer != null ) { timer . cancel ( ) ; } client = null ;


signature:
public class JenaDatabaseClient { /** * synchronization needed because of setting of page length */
public synchronized InputStreamHandle executeSelect ( SPARQLQueryDefinition qdef , InputStreamHandle handle , Long offset , Long limit ) { } }

implementation: if ( limit == null ) { this . sparqlQueryManager . clearPageLength ( ) ; } else { this . sparqlQueryManager . setPageLength ( limit ) ; } if ( offset != null ) { return this . sparqlQueryManager . executeSelect ( qdef , handle , offset , currentTransaction ) ; } else { return this . sparqlQueryManager . executeSelect ( qdef , handle , currentTransaction ) ; }


signature:
public class JenaDatabaseClient { /** * If timer is turned on ( periodicFlush = true in constructor )
 * this method puts a quad into the cache which is periodically sent to MarkLogic
 * otherwise it sends the quad directly
 * @ param g
 * Graph node .
 * @ param s
 * Subject node
 * @ param p
 * Property node .
 * @ param o
 * Object Node . */
public void sinkQuad ( Node g , Node s , Node p , Node o ) { } }

implementation: if ( writeBuffer != null ) { writeBuffer . add ( g , s , p , o ) ; } else { Graph graph = GraphFactory . createDefaultGraph ( ) ; graph . add ( Triple . create ( s , p , o ) ) ; mergeGraph ( g . getURI ( ) , graph ) ; return ; }


signature:
public class MarkLogicDatasetGraphFactory { /** * Creates a MarkLogicDatasetGraph from an existing
 * { @ link com . marklogic . client . DatabaseClient } .
 * @ param client
 * An instance of DatabaseClient .
 * @ return A MarkLogicDatasetGraph instance wrapping MarkLogic . */
public static MarkLogicDatasetGraph createDatasetGraph ( DatabaseClient client ) { } }

implementation: JenaDatabaseClient jenaClient = new JenaDatabaseClient ( client ) ; MarkLogicDatasetGraph datasetGraph = new MarkLogicDatasetGraph ( jenaClient ) ; MarkLogicQueryEngine . unregister ( ) ; MarkLogicQueryEngine . register ( ) ; MarkLogicUpdateEngine . unregister ( ) ; MarkLogicUpdateEngine . register ( ) ; return datasetGraph ;


signature:
public class MarkLogicDatasetGraphFactory { /** * Creates MarkLogicDatasetGraph from access parameters to a REST MarkLogic
 * server .
 * @ param host
 * the host with the REST server
 * @ param port
 * the port for the REST server
 * @ param user
 * the user with read , write , or administrative privileges
 * @ param password
 * the password for the user
 * @ param type
 * the type of authentication applied to the request
 * @ return A MarkLogicDatasetGraph instance wrapping MarkLogic . */
static public MarkLogicDatasetGraph createDatasetGraph ( String host , int port , String user , String password , Authentication type ) { } }

implementation: DatabaseClient client = DatabaseClientFactory . newClient ( host , port , user , password , type ) ; return MarkLogicDatasetGraphFactory . createDatasetGraph ( client ) ;


signature:
public class PooledGMService { /** * { @ inheritDoc } */
@ Override public String execute ( @ Nonnull String command , String ... arguments ) throws IOException , GMException , GMServiceException { } }

implementation: PooledGMConnection connection = pool . borrowObject ( ) ; try { return connection . execute ( command , arguments ) ; } finally { pool . returnObject ( connection ) ; }


signature:
public class GMConnectionPool { /** * { @ inheritDoc }
 * This implementation delegates to super class but ensures that there is no other checked exception except
 * { @ link GMServiceException } will be thrown . */
@ Override @ Nonnull public PooledGMConnection borrowObject ( ) throws GMServiceException { } }

implementation: try { return super . borrowObject ( ) ; } catch ( GMServiceException e ) { throw e ; } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new GMServiceException ( e . getMessage ( ) , e ) ; }


signature:
public class GMConnectionPool { /** * { @ inheritDoc }
 * This implementation delegates to super class but ensures that there is no other checked exception except
 * { @ link GMServiceException } will be thrown . */
@ Override public void returnObject ( @ Nonnull PooledGMConnection connection ) throws GMServiceException { } }

implementation: try { super . returnObject ( connection ) ; } catch ( GMServiceException e ) { throw e ; } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new GMServiceException ( e . getMessage ( ) , e ) ; }


signature:
public class GMBatchCommand { /** * { @ inheritDoc }
 * This implementation uses { @ link GMExecutor } to execute the command . */
@ Override protected int run ( @ Nonnull LinkedList < String > pArgs ) throws Exception { } }

implementation: int rc ; try { String result = executor . execute ( pArgs ) ; if ( outputConsumer != null && result != null ) outputConsumer . consumeOutput ( stringToStream ( result ) ) ; rc = 0 ; } catch ( GMException e ) { if ( errorConsumer != null ) errorConsumer . consumeError ( stringToStream ( e . getMessage ( ) ) ) ; else throw e ; rc = 1 ; } finished ( rc ) ; return rc ;


signature:
public class SimpleGMService { /** * Sets the path to GraphicsMagick executable .
 * @ param gmPath
 * the path to GraphicsMagick executable */
public void setGMPath ( @ Nonnull String gmPath ) { } }

implementation: if ( gmPath == null ) throw new NullPointerException ( "gmPath" ) ; factory = builder . buildFactory ( gmPath ) ;