signature:
public class CBFileUtil { /** * 按照UTF - 8编码保存到相应内容到指定路径的文件
 * @ param content 文件内容
 * @ param filePath 文件路径
 * @ throws IOException io exception */
public static void saveContentToFile ( String content , String filePath ) throws IOException { } }

implementation: saveContentToFile ( content , filePath , DEFAULT_CHARSET ) ;


signature:
public class CBFileUtil { /** * 按照UTF - 8编码保存到相应内容到指定路径的文件
 * @ param content 文件内容
 * @ param filePath 文件路径
 * @ param append 是否追加
 * @ throws IOException io exception */
public static void saveContentToFile ( String content , String filePath , boolean append ) throws IOException { } }

implementation: saveContentToFile ( content , new File ( filePath ) , DEFAULT_CHARSET , append ) ;


signature:
public class CBFileUtil { /** * 按照UTF - 8编码保存到相应内容到指定文件
 * @ param content 文件内容
 * @ param file 文件
 * @ throws IOException io exception */
public static void saveContentToFile ( String content , File file ) throws IOException { } }

implementation: saveContentToFile ( content , file , DEFAULT_CHARSET , false ) ;


signature:
public class CBFileUtil { /** * 按照UTF - 8编码保存到相应内容到指定文件
 * @ param content 文件内容
 * @ param file 文件
 * @ param append 是否追加
 * @ throws IOException io exception */
public static void saveContentToFile ( String content , File file , boolean append ) throws IOException { } }

implementation: saveContentToFile ( content , file , DEFAULT_CHARSET , append ) ;


signature:
public class CBFileUtil { /** * 保存网络文件到指定路径
 * @ param url 文件地址
 * @ param filePath 文件路径
 * @ throws IOException io exception */
public static void saveContentToFile ( URL url , String filePath ) throws IOException { } }

implementation: saveContentToFile ( url , new File ( filePath ) ) ;


signature:
public class CBFileUtil { /** * 保存网络文件到指定文件
 * @ param url 文件地址
 * @ param file 文件
 * @ throws IOException io exception */
public static void saveContentToFile ( URL url , File file ) throws IOException { } }

implementation: InputStream is = url . openStream ( ) ; FileOutputStream fos = new FileOutputStream ( file ) ; byte [ ] b = new byte [ 1024 ] ; int len ; while ( ( len = is . read ( b ) ) != - 1 ) { fos . write ( b , 0 , len ) ; } fos . flush ( ) ; fos . close ( ) ; is . close ( ) ;


signature:
public class CBFileUtil { /** * 按照指定编码保存相应内容到指定路径的文件
 * @ param content 文件内容
 * @ param filePath 文件路径
 * @ param encoding 编码
 * @ throws IOException io exception */
public static void saveContentToFile ( String content , String filePath , String encoding ) throws IOException { } }

implementation: saveContentToFile ( content , new File ( filePath ) , encoding , false ) ;


signature:
public class CBFileUtil { /** * 按照指定编码保存相应内容到指定文件
 * @ param content 文件内容
 * @ param file 文件
 * @ param encoding 编码
 * @ param append 是否追加
 * @ throws IOException io exception */
public static void saveContentToFile ( String content , File file , String encoding , boolean append ) throws IOException { } }

implementation: BufferedWriter buff = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( file , append ) , encoding ) ) ; buff . write ( content ) ; buff . flush ( ) ; buff . close ( ) ;


signature:
public class CBTaskController { /** * 开始执行 */
public void startAllTasks ( ) { } }

implementation: while ( queue . size ( ) != 0 && ! stopSign ) { ICBTask task = queue . poll ( ) ; if ( task == null ) { continue ; } setAndStartTask ( task ) ; }


signature:
public class CBTaskController { /** * 开始执行并且等待结束
 * @ throws InterruptedException exception */
public void startAllTasksAndWaiting ( ) throws InterruptedException { } }

implementation: List < ICBTask > taskList = new ArrayList < > ( ) ; while ( queue . size ( ) != 0 && ! stopSign ) { ICBTask task = queue . poll ( ) ; if ( task == null ) { continue ; } taskList . add ( task ) ; setAndStartTask ( task ) ; } for ( ICBTask task : taskList ) { if ( ! task . isTaskFinished ( ) ) { task . waitForEnd ( ) ; } }


signature:
public class CBTaskController { /** * 设置任务的监听器并开始任务
 * @ param task 任务 */
private void setAndStartTask ( ICBTask task ) { } }

implementation: task . setTaskListener ( new CBTaskListener ( ) { @ Override public void onTaskStart ( ) { lock . lock ( ) ; if ( currentExecuteTaskNumber > maxTaskNumber ) { try { condition . await ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } currentExecuteTaskNumber ++ ; lock . unlock ( ) ; } @ Override public void onTaskEnd ( ) { lock . lock ( ) ; currentExecuteTaskNumber -- ; condition . signal ( ) ; lock . unlock ( ) ; } } ) ; task . startTask ( ) ;


signature:
public class CBTaskController { /** * 停止任务 */
public void stopAllTasks ( ) { } }

implementation: ICBTask task ; stopSign = true ; while ( ( task = queue . poll ( ) ) != null ) { task . stopTask ( ) ; }


signature:
public class HttpServletResponseEncodingContext { /** * Encodes the URL by :
 * < ol >
 * < li > Encoding the path elements with the current response character encoding . < / li >
 * < li > Calling response . encodeURL ( ) < / li >
 * < / ol >
 * @ see UrlUtils # encodeUrlPath ( java . lang . String , java . lang . String )
 * @ see HttpServletResponse # encodeRedirectURL ( java . lang . String ) */
@ Override public String encodeURL ( String href ) throws UnsupportedEncodingException { } }

implementation: return response . encodeURL ( UrlUtils . encodeUrlPath ( href , response . getCharacterEncoding ( ) ) ) ;


signature:
public class AbstractMigratoryMojo { /** * Creates the datasource config based on the provided parameters . */
private DBI createDBI ( ) throws Exception { } }

implementation: if ( driver != null ) { Class . forName ( driver ) . newInstance ( ) ; } return new DBI ( url , user , password ) ;


signature:
public class JDBCEntityDAOSupport { /** * Appends LIMIT and OFFSET for POSTGRESQL SQL queries
 * < code >
 * SELECT select _ list
 * FROM table _ expression
 * [ ORDER BY . . . ]
 * [ LIMIT { number | ALL } ] [ OFFSET number ]
 * < / code >
 * @ param sql
 * @ param page */
protected void appendLimitAndOffSet ( final StringBuilder sql , final Page page ) { } }

implementation: sql . append ( " LIMIT " ) . append ( page . getPageSize ( ) ) . append ( " OFFSET " ) . append ( page . getOffset ( ) ) ;


signature:
public class DataTreeCreator { /** * Creates an example { @ link DocumentRoot } object with data from the SBOL2.0 proposed data model .
 * Included SBOL objects are Module , Interaction , Participation , ComponentInstantiation and Model .
 * @ return { @ link DocumentRoot } */
public static DocumentRoot < QName > makeSBOL2Document ( ) { } }

implementation: NestedDocument < QName > instantiationLacI = NestedDocument ( Sbol2Terms . instantiation . componentInstantiation , sbolExample . namespacedUri ( "module_LacI_inverter/LacI_instantiation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "LacI" ) ) ) ; NestedDocument < QName > instantiationIPTG = NestedDocument ( Sbol2Terms . instantiation . componentInstantiation , sbolExample . namespacedUri ( "module_LacI_inverter/IPTG" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "IPTG" ) ) ) ; NestedDocument < QName > instantiationIPTGLacI = NestedDocument ( Sbol2Terms . instantiation . componentInstantiation , sbolExample . namespacedUri ( "module_LacI_inverter/IPTG_LacI_complex" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "IPTG LacI complex" ) ) ) ; NestedDocument < QName > instantiationpLac = NestedDocument ( Sbol2Terms . instantiation . componentInstantiation , sbolExample . namespacedUri ( "module_LacI_inverter/pLac_instantiation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "pLac promoter" ) ) ) ; NestedDocument < QName > instantiationcTetR = NestedDocument ( Sbol2Terms . instantiation . componentInstantiation , sbolExample . namespacedUri ( "module_LacI_inverter/cTetR_instantiation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "cTetR" ) ) ) ; NestedDocument < QName > instantiationTetR = NestedDocument ( Sbol2Terms . instantiation . componentInstantiation , sbolExample . namespacedUri ( "module_LacI_inverter/TetR_instantiation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "TetR" ) ) ) ; NestedDocument < QName > interactionIPTGBinding = NestedDocument ( Sbol2Terms . module . interaction , sbolExample . namespacedUri ( "module_LacI_inverter/interaction/IPTG_binding" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "IPTG Binding" ) , NamedProperty ( RdfTerms . rdfType , URI . create ( "http://purl.obolibrary.org/obo/non_covalent_binding" ) ) , NamedProperty ( Sbol2Terms . module . hasParticipation , NestedDocument ( Sbol2Terms . module . participation , partsRegistry . namespacedUri ( "module_LacI_inverter/interaction/IPTG_Binding/LacI_participation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . module . role , URI . create ( "http://purl.obolibrary.org/obo/reactant" ) ) , NamedProperty ( Sbol2Terms . module . participant , instantiationLacI . getIdentity ( ) ) ) ) ) , NamedProperty ( Sbol2Terms . module . hasParticipation , NestedDocument ( Sbol2Terms . module . participation , partsRegistry . namespacedUri ( "module_LacI_inverter/interaction/IPTG_Binding/IPTGLacI_participation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . module . role , URI . create ( "http://purl.obolibrary.org/obo/product" ) ) , NamedProperty ( Sbol2Terms . module . participant , instantiationIPTGLacI . getIdentity ( ) ) ) ) ) , NamedProperty ( Sbol2Terms . module . hasParticipation , NestedDocument ( Sbol2Terms . module . participation , partsRegistry . namespacedUri ( "module_LacI_inverter/interaction/IPTG_Binding/IPTG_participation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . module . role , URI . create ( "http://purl.obolibrary.org/obo/reactant" ) ) , NamedProperty ( Sbol2Terms . module . participant , instantiationIPTG . getIdentity ( ) ) ) ) ) ) ) ; NestedDocument < QName > interactionLacIRepression = NestedDocument ( Sbol2Terms . module . interaction , sbolExample . namespacedUri ( "module_LacI_inverter/interaction/LacI_repression" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "LacI Repression" ) , NamedProperty ( RdfTerms . rdfType , URI . create ( "http://purl.obolibrary.org/obo/repression" ) ) , NamedProperty ( Sbol2Terms . module . hasParticipation , NestedDocument ( Sbol2Terms . module . participation , partsRegistry . namespacedUri ( "module_LacI_inverter/interaction/LacI_repression/LacI" ) , NamedProperties ( NamedProperty ( Sbol2Terms . module . role , URI . create ( "http://purl.obolibrary.org/obo/repressor" ) ) , NamedProperty ( Sbol2Terms . module . participant , instantiationLacI . getIdentity ( ) ) ) ) ) , NamedProperty ( Sbol2Terms . module . hasParticipation , NestedDocument ( Sbol2Terms . module . participation , partsRegistry . namespacedUri ( "module_LacI_inverter/interaction/LacI_repression/pLac" ) , NamedProperties ( NamedProperty ( Sbol2Terms . module . role , URI . create ( "http://purl.obolibrary.org/obo/repressed" ) ) , NamedProperty ( Sbol2Terms . module . participant , instantiationpLac . getIdentity ( ) ) ) ) ) ) ) ; NestedDocument < QName > interactionTetRTranscriptionTranslation = NestedDocument ( Sbol2Terms . module . interaction , sbolExample . namespacedUri ( "module_LacI_inverter/interaction/TetR_transcription_translation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "TetR Transcription Translation" ) , NamedProperty ( RdfTerms . rdfType , URI . create ( "http://purl.obolibrary.org/obo/genetic_production" ) ) , NamedProperty ( RdfTerms . rdfType , URI . create ( "http://made.up.terms.org/unicorns" ) ) , NamedProperty ( Sbol2Terms . module . hasParticipation , NestedDocument ( Sbol2Terms . module . participation , partsRegistry . namespacedUri ( "module_LacI_inverter/interaction/TetR_transcription_translation/TetR_participation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . module . role , URI . create ( "http://purl.obolibrary.org/obo/product" ) ) , NamedProperty ( Sbol2Terms . module . participant , instantiationTetR . getIdentity ( ) ) ) ) ) , NamedProperty ( Sbol2Terms . module . hasParticipation , NestedDocument ( Sbol2Terms . module . participation , partsRegistry . namespacedUri ( "module_LacI_inverter/interaction/TetR_transcription_translation/cTetR_participation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . module . role , URI . create ( "http://purl.obolibrary.org/obo/transcribed" ) ) , NamedProperty ( Sbol2Terms . module . participant , instantiationcTetR . getIdentity ( ) ) ) ) ) , NamedProperty ( Sbol2Terms . module . hasParticipation , NestedDocument ( Sbol2Terms . module . participation , partsRegistry . namespacedUri ( "module_LacI_inverter/interaction/TetR_transcription_translation/pLac_participation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . module . role , URI . create ( "http://purl.obolibrary.org/obo/modifier" ) ) , NamedProperty ( Sbol2Terms . module . participant , instantiationpLac . getIdentity ( ) ) ) ) ) ) ) ; TopLevelDocument < QName > modelLacIInverter = TopLevelDocument ( NamespaceBindings ( utah ) , Sbol2Terms . model . model , sbolExample . namespacedUri ( "model/LacI_inverter" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "LacI Inverter Model" ) , NamedProperty ( Sbol2Terms . model . source , URI . create ( "http://www.async.ece.utah.edu/LacI_Inverter.xml" ) ) , NamedProperty ( Sbol2Terms . model . language , "SBML" ) , NamedProperty ( Sbol2Terms . model . framework , "ODE" ) , NamedProperty ( Sbol2Terms . model . role , "simulation" ) ) ) ; TopLevelDocument < QName > moduleLacIInverter = TopLevelDocument ( Sbol2Terms . module . module , sbolExample . namespacedUri ( "module/LacI_inverter" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "LacI Inverter" ) , NamedProperty ( Sbol2Terms . module . hasInteraction , interactionIPTGBinding ) , NamedProperty ( Sbol2Terms . module . hasInteraction , interactionLacIRepression ) , NamedProperty ( Sbol2Terms . module . hasInteraction , interactionTetRTranscriptionTranslation ) , NamedProperty ( Sbol2Terms . instantiation . hasComponentInstantiation , instantiationLacI ) , NamedProperty ( Sbol2Terms . instantiation . hasComponentInstantiation , instantiationIPTG ) , NamedProperty ( Sbol2Terms . instantiation . hasComponentInstantiation , instantiationIPTGLacI ) , NamedProperty ( Sbol2Terms . instantiation . hasComponentInstantiation , instantiationpLac ) , NamedProperty ( Sbol2Terms . instantiation . hasComponentInstantiation , instantiationcTetR ) , NamedProperty ( Sbol2Terms . instantiation . hasComponentInstantiation , instantiationTetR ) , NamedProperty ( Sbol2Terms . module . hasModel , modelLacIInverter . getIdentity ( ) ) ) ) ; return DocumentRoot ( NamespaceBindings ( RdfTerms . rdf , SbolTerms . sbol2 , partsRegistry , sbolExample , obo ) , TopLevelDocuments ( moduleLacIInverter , modelLacIInverter ) ) ;


signature:
public class DataTreeCreator { /** * Creates an example { @ link DocumentRoot } object with data from the SBOL2.0 proposed data model .
 * Included SBOL objects from the data model are SequenceComponent , ComponentInstantiation , SequenceAnnotation and SequenceComponent .
 * @ return { @ link DocumentRoot } */
public static DocumentRoot < QName > makeSBOL2SequenceComponent ( ) { } }

implementation: TopLevelDocument < QName > pLac = TopLevelDocument ( Sbol2Terms . component . sequenceComponent , sbolExample . namespacedUri ( "sequenceComponent/pLac" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "pLac" ) , NamedProperty ( Sbol2Terms . documented . displayId , "pLac" ) , NamedProperty ( RdfTerms . rdfType , URI . create ( "DNA" ) ) , NamedProperty ( Sbol2Terms . component . sequenceType , URI . create ( "http://purl.org/obo/owl/SO#SO_0000167" ) ) ) ) ; NestedDocument < QName > instantiationpLac = NestedDocument ( Sbol2Terms . instantiation . componentInstantiation , sbolExample . namespacedUri ( "sequenceComponent/pLac/instantiation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "pLac" ) , NamedProperty ( Sbol2Terms . component . component , pLac . getIdentity ( ) ) ) ) ; NestedDocument < QName > pLacAnnotation = NestedDocument ( Sbol2Terms . component . sequenceAnnotation , sbolExample . namespacedUri ( "sequenceComponent/UU_002/pLac_annotation" ) , NamedProperties ( NamedProperty ( Sbol2Terms . component . orientation , "inline" ) , NamedProperty ( Sbol2Terms . instantiation . subComponentInstantiation , instantiationpLac ) ) ) ; TopLevelDocument < QName > lacIRepressibleGeneSequence = TopLevelDocument ( Sbol2Terms . component . sequence , sbolExample . namespacedUri ( "sequenceComponent/UU_002/sequence" ) , NamedProperties ( NamedProperty ( Sbol2Terms . component . elements , "atg" ) ) ) ; TopLevelDocument < QName > lacIRepressibleGene = TopLevelDocument ( Sbol2Terms . component . sequenceComponent , sbolExample . namespacedUri ( "sequenceComponent/UU_002" ) , NamedProperties ( NamedProperty ( Sbol2Terms . documented . name , "LacI Repressible Gene" ) , NamedProperty ( Sbol2Terms . documented . displayId , "UU_002" ) , NamedProperty ( RdfTerms . rdfType , URI . create ( "DNA" ) ) , NamedProperty ( Sbol2Terms . component . sequenceType , URI . create ( "http://purl.org/obo/owl/SO#SO_0000774" ) ) , NamedProperty ( Sbol2Terms . component . annotation , pLacAnnotation ) , NamedProperty ( Sbol2Terms . component . hasSequence , lacIRepressibleGeneSequence . getIdentity ( ) ) ) ) ; return DocumentRoot ( NamespaceBindings ( SbolTerms . sbol2 ) , TopLevelDocuments ( lacIRepressibleGene , pLac , lacIRepressibleGeneSequence ) ) ;


signature:
public class DataTreeCreator { /** * Creates an example { @ link DocumentRoot } object with data from the SBOL1.1 data model .
 * Included SBOL objects are DnaComponent , SequenceAnnotation and DnaSequence .
 * @ return { @ link DocumentRoot } */
public static DocumentRoot < QName > makeDocument ( ) { } }

implementation: return DocumentRoot ( NamespaceBindings ( SbolTerms . sbol2 ) , TopLevelDocuments ( TopLevelDocument ( SbolTerms . dnaComponent , partsRegistry . namespacedUri ( "Part:BBa_I0462" ) , NamedProperties ( NamedProperty ( SbolTerms . name , "I0462" ) , NamedProperty ( SbolTerms . description , "LuxR protein generator" ) , NamedProperty ( SbolTerms . dnaSequence , partsRegistry . namespacedUri ( "Part:BBa_I0462/sequence" ) ) , NamedProperty ( SbolTerms . sequenceAnnotation , NestedDocument ( SbolTerms . annotation , partsRegistry . namespacedUri ( "Part:BBa_I0462/anot/1234567" ) , NamedProperties ( NamedProperty ( SbolTerms . bioStart , 1 ) , NamedProperty ( SbolTerms . bioEnd , 12 ) , NamedProperty ( SbolTerms . strand , "+" ) , NamedProperty ( SbolTerms . subComponent , partsRegistry . namespacedUri ( "Part:BBa_B0034" ) ) ) ) ) , NamedProperty ( SbolTerms . annotation , NestedDocument ( SbolTerms . sequenceAnnotation , partsRegistry . namespacedUri ( "Part:BBa_I0462/annotation/2345678" ) , NamedProperties ( NamedProperty ( SbolTerms . bioStart , 19 ) , NamedProperty ( SbolTerms . bioEnd , 774 ) , NamedProperty ( SbolTerms . subComponent , partsRegistry . namespacedUri ( "Part:BBa_C0062" ) ) ) ) ) ) ) , TopLevelDocument ( SbolTerms . dnaSequence , partsRegistry . namespacedUri ( "Part:BBa_I0462/sequence" ) , NamedProperties ( NamedProperty ( SbolTerms . nucleotides , "aaagaggagaaatactagatgaaaaacataaatgccgacgacacatacagaataattaataaaattaaagcttgtagaagcaataatgatattaatcaatgcttatctgatatgactaaaatggtacattgtgaatattatttactcgcgatcatttatcctcattctatggttaaatctgatatttcaatcctagataattaccctaaaaaatggaggcaatattatgatgacgctaatttaataaaatatgatcctatagtagattattctaactccaatcattcaccaattaattggaatatatttgaaaacaatgctgtaaataaaaaatctccaaatgtaattaaagaagcgaaaacatcaggtcttatcactgggtttagtttccctattcatacggctaacaatggcttcggaatgcttagttttgcacattcagaaaaagacaactatatagatagtttatttttacatgcgtgtatgaacataccattaattgttccttctctagttgataattatcgaaaaataaatatagcaaataataaatcaaacaacgatttaaccaaaagagaaaaagaatgtttagcgtgggcatgcgaaggaaaaagctcttgggatatttcaaaaatattaggttgcagtgagcgtactgtcactttccatttaaccaatgcgcaaatgaaactcaatacaacaaaccgctgccaaagtatttctaaagcaattttaacaggagcaattgattgcccatactttaaaaattaataacactgatagtgctagtgtagatcactactagagccaggcatcaaataaaacgaaaggctcagtcgaaagactgggcctttcgttttatctgttgtttgtcggtgaacgctctctactagagtcacactggctcaccttcgggtgggcctttctgcgtttata" ) ) ) , TopLevelDocument ( SbolTerms . dnaComponent , partsRegistry . namespacedUri ( "Part:BBa_B0034" ) , NamedProperties ( NamedProperty ( SbolTerms . name , "I0462" ) , NamedProperty ( SbolTerms . displayId , "BBa_B0034" ) , NamedProperty ( RdfTerms . rdfType , URI . create ( "http://purl.obolibrary.org/obo/SO_0000139" ) ) ) ) , TopLevelDocument ( SbolTerms . dnaComponent , partsRegistry . namespacedUri ( "Part:BBa_C0062" ) , NamedProperties ( NamedProperty ( SbolTerms . name , "luxR" ) , NamedProperty ( SbolTerms . displayId , "BBa_C0062" ) , NamedProperty ( RdfTerms . rdfType , URI . create ( "http://purl.obolibrary.org/obo/SO_0000316" ) ) ) ) ) ) ;


signature:
public class DataTreeCreator { /** * Creates a { @ link SchemaCatalog } for the SBOL20 core objects
 * @ return { @ link SchemaCatalog } */
public static SchemaCatalog makeCoreSchemaCatalog ( ) { } }

implementation: return SchemaCatalog ( Sbol2Terms . sbol2 . namespacedUri ( "/schemaexample/core" ) , ImportedSchemas ( ) , DocumentSchemas ( DocumentSchema ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/identified" ) , Extends ( ) , IdentifierSchemas ( ) , TypeSchemas ( ) , PropertySchemas ( ) ) , DocumentSchema ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/documented" ) , Extends ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/identified" ) ) , IdentifierSchemas ( ) , TypeSchemas ( ) , PropertySchemas ( PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . documented . displayId ) ) , cardinality . required , PropertyValueSchemas ( propertyType . string ) ) , PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . documented . name ) ) , cardinality . optional , PropertyValueSchemas ( propertyType . string ) ) , PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . documented . description ) ) , cardinality . optional , PropertyValueSchemas ( propertyType . string ) ) ) ) ) ) ;


signature:
public class DataTreeCreator { /** * Creates a { @ link SchemaCatalog } for the SBOL20 instantiation objects
 * @ return { @ link SchemaCatalog } */
public static SchemaCatalog makeInstantiationSchemaCatalog ( ) { } }

implementation: return SchemaCatalog ( Sbol2Terms . sbol2 . namespacedUri ( "/schemaexample/instantiation" ) , ImportedSchemas ( ) , DocumentSchemas ( DocumentSchema ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/component_instantiation" ) , Extends ( ) , IdentifierSchemas ( ) , TypeSchemas ( TypeSchema ( Sbol2Terms . instantiation . componentInstantiation ) ) , PropertySchemas ( PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . instantiation . hasComponentInstantiation ) ) , cardinality . required , PropertyValueSchemas ( ReferenceValue ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/sequence_component" ) ) ) ) ) ) ) ) ;


signature:
public class DataTreeCreator { /** * Creates a { @ link SchemaCatalog } for the SBOL20 component objects
 * @ return { @ link SchemaCatalog } */
public static SchemaCatalog makeComponentSchemaCatalog ( ) { } }

implementation: return SchemaCatalog ( Sbol2Terms . sbol2 . namespacedUri ( "/schemaexample/component" ) , ImportedSchemas ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/core" ) , Sbol2Terms . sbol2 . namespacedUri ( "/schema/instantiation" ) ) , DocumentSchemas ( DocumentSchema ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/sequence" ) , Extends ( ) , IdentifierSchemas ( ) , TypeSchemas ( TypeSchema ( Sbol2Terms . component . sequence ) ) , PropertySchemas ( PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . component . elements ) ) , cardinality . required , PropertyValueSchemas ( propertyType . string ) ) ) ) , DocumentSchema ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/sequence_component" ) , Extends ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/documented" ) ) , IdentifierSchemas ( ) , TypeSchemas ( TypeSchema ( Sbol2Terms . component . sequenceComponent ) ) , PropertySchemas ( PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . component . hasSequence ) ) , cardinality . optional , PropertyValueSchemas ( ReferenceValue ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/sequence" ) ) ) ) , PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . component . annotation ) ) , cardinality . many , PropertyValueSchemas ( DocumentValue ( DocumentSchema ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/sequence_annotation" ) , Extends ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/documented" ) ) , IdentifierSchemas ( ) , TypeSchemas ( TypeSchema ( Sbol2Terms . component . sequenceComponent ) ) , PropertySchemas ( PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . instantiation . subComponentInstantiation ) ) , cardinality . required , PropertyValueSchemas ( ReferenceValue ( Sbol2Terms . sbol2 . namespacedUri ( "/schema/component_instantiation" ) ) ) ) , PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . component . orientation ) ) , cardinality . required , PropertyValueSchemas ( propertyType . oneOf ( "inline" , "reverse_compliment" ) ) ) , PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . component . start ) ) , cardinality . optional , PropertyValueSchemas ( propertyType . integer ) ) , PropertySchema ( TypeSchemas ( TypeSchema ( Sbol2Terms . component . end ) ) , cardinality . optional , PropertyValueSchemas ( propertyType . integer ) ) ) ) ) ) ) ) ) ) ) ;


signature:
public class MavenDryResultAction { /** * { @ inheritDoc } */
public MavenAggregatedReport createAggregatedAction ( final MavenModuleSetBuild build , final Map < MavenModule , List < MavenBuild > > moduleBuilds ) { } }

implementation: return new MavenDryResultAction ( build , getHealthDescriptor ( ) , defaultEncoding , new DryResult ( build , defaultEncoding , new ParserResult ( ) , false ) ) ;


signature:
public class Datatree { /** * Factory for { @ link TopLevelDocuments } .
 * Used by the { @ link DocumentRoot } factory methods .
 * @ param documents the documents to wrap
 * @ param < N > the property name type
 * @ return a new TopLevelDocuments that wraps up documents */
@ SafeVarargs public static < N > TopLevelDocuments < N > TopLevelDocuments ( TopLevelDocument < N > ... documents ) { } }

implementation: return TopLevelDocuments ( Arrays . asList ( documents ) ) ;


signature:
public class Datatree { /** * Factory for { @ link TopLevelDocuments } .
 * Used by the { @ link DocumentRoot } factory methods .
 * @ param documents the documents to wrap
 * @ param < N > the property name type
 * @ return a new TopLevelDocuments that wraps up documents */
public static < N > TopLevelDocuments < N > TopLevelDocuments ( final List < TopLevelDocument < N > > documents ) { } }

implementation: return new TopLevelDocuments . Impl < > ( documents ) ;


signature:
public class Datatree { /** * Factory for { @ link NamedProperties } .
 * Used by { @ link org . sbolstandard . core . datatree . NestedDocument }
 * factory methods .
 * @ param properties properties
 * @ return a new NamedProperties wrapping the properties */
@ SafeVarargs public static < N > NamedProperties < N > NamedProperties ( final NamedProperty < N > ... properties ) { } }

implementation: return NamedProperties ( Arrays . asList ( properties ) ) ;


signature:
public class Datatree { /** * Factory for { @ link NamedProperties } .
 * Used by { @ link org . sbolstandard . core . datatree . NestedDocument }
 * factory methods .
 * @ param properties properties list
 * @ return a new NamedProperties wrapping the properties */
public static < N > NamedProperties < N > NamedProperties ( final List < NamedProperty < N > > properties ) { } }

implementation: return new NamedProperties . Impl < > ( properties ) ;


signature:
public class Datatree { /** * Factory for { @ link TopLevelDocument } .
 * This builds a new TopLevelDocument using the supplied data .
 * @ param type the type of the document
 * @ param identity the identity of the document
 * @ param properties the property list of the document
 * @ param < N > the property name type
 * @ return a new TopLevelDocument instance */
public static < N > TopLevelDocument < N > TopLevelDocument ( final N type , final URI identity , final NamedProperties < N > properties ) { } }

implementation: return TopLevelDocument ( NamespaceBindings ( ) , type , identity , properties ) ;


signature:
public class Datatree { /** * Factory for { @ link TopLevelDocument } .
 * This builds a new TopLevelDocument using the supplied data .
 * @ param bindings the namespace bindings
 * @ param type the type of the document
 * @ param identity the identity of the document
 * @ param < N > the property name type
 * @ return a new TopLevelDocument instance */
public static < N > TopLevelDocument < N > TopLevelDocument ( final NamespaceBindings bindings , final N type , final URI identity ) { } }

implementation: return TopLevelDocument ( bindings , type , identity , Datatree . < N > NamedProperties ( ) ) ;


signature:
public class Datatree { /** * Factory for { @ link TopLevelDocument } .
 * This builds a new TopLevelDocument using the supplied data .
 * @ param bindings the namespace bindings
 * @ param type the type of the document
 * @ param identity the identity of the document
 * @ param properties the property list of the document
 * @ param < N > the property name type
 * @ return a new TopLevelDocument instance */
public static < N > TopLevelDocument < N > TopLevelDocument ( final NamespaceBindings bindings , final N type , final URI identity , final NamedProperties < N > properties ) { } }

implementation: return new TopLevelDocument . Impl < > ( bindings . getBindings ( ) , type , identity , properties . getProperties ( ) ) ;


signature:
public class Datatree { /** * Factory for { @ link NestedDocument } .
 * This builds a new NestedDocument using the supplied data .
 * @ param type the type of the document
 * @ param identity the identity of the document
 * @ param properties the property list of the document
 * @ param < N > the property name type
 * @ return a new TopLevelDocument instance */
public static < N > NestedDocument < N > NestedDocument ( final N type , final URI identity , final NamedProperties < N > properties ) { } }

implementation: return NestedDocument ( NamespaceBindings ( ) , type , identity , properties ) ;


signature:
public class Datatree { /** * Factory for { @ link DocumentRoot } .
 * This builds a new DocumentRoot instance using the supplied data .
 * @ param documents the top - level documents
 * @ param < N > the property name type
 * @ return a new DocumentRoot instance */
public static < N > DocumentRoot < N > DocumentRoot ( final TopLevelDocuments < N > documents ) { } }

implementation: return DocumentRoot ( NamespaceBindings ( ) , documents ) ;


signature:
public class Datatree { /** * Factory for { @ link DocumentRoot } .
 * This builds a new DocumentRoot instance using the supplied data .
 * @ param bindings the namespace bindings
 * @ param documents the top - level documents
 * @ param < N > the property name type
 * @ return a new DocumentRoot instance */
public static < N > DocumentRoot < N > DocumentRoot ( final NamespaceBindings bindings , final TopLevelDocuments < N > documents ) { } }

implementation: return new DocumentRoot . Impl < > ( bindings . getBindings ( ) , documents . getDocuments ( ) ) ;


signature:
public class Datatree { /** * Create a value property from a literal value .
 * @ param name the property name
 * @ param value the property value
 * @ param < N > the property name type
 * @ return a new NamedProperty with the supplied name and value */
public static < N > NamedProperty < N > NamedProperty ( final N name , final PropertyValue < N > value ) { } }

implementation: return new NamedProperty . Impl < > ( name , value ) ;


signature:
public class Datatree { /** * Create a value property from a string value .
 * @ param name the property name
 * @ param value the property value
 * @ param < N > the property name type
 * @ return a new NamedProperty with the supplied name and value */
public static < N > NamedProperty < N > NamedProperty ( final N name , final String value ) { } }

implementation: return NamedProperty ( name , Datatree . < N > Literal ( value ) ) ;


signature:
public class Datatree { /** * Create a value property from a nested document value .
 * @ param name the property name
 * @ param value the property value
 * @ param < N > the property name type
 * @ return a new NamedProperty with the supplied name and value */
public static < N > NamedProperty < N > NamedProperty ( final N name , final NestedDocument < N > value ) { } }


signature:
public class Datatree { /** * Create a string literal .
 * @ param value the property value
 * @ return a new NamedProperty with the supplied name and value */
public static < N > Literal . StringLiteral < N > Literal ( final String value ) { } }

implementation: return new Literal . StringLiteral < > ( value ) ;


signature:
public class Datatree { /** * Create a URI literal .
 * @ param value the property value
 * @ return a new NamedProperty with the supplied name and value */
public static < N > Literal . UriLiteral < N > Literal ( final URI value ) { } }

implementation: return new Literal . UriLiteral < > ( value ) ;


signature:
public class Datatree { /** * Create a typed literal .
 * @ param value the property value
 * @ return a new NamedProperty with the supplied name and value */
public static < N > Literal . TypedLiteral < N > Literal ( final String value , final QName type ) { } }

implementation: return new Literal . TypedLiteral < > ( value , type ) ;


signature:
public class Datatree { /** * Create a QName from a namespace URI , local part and prefix .
 * @ param namespaceURI the namespace URI
 * @ param localPart the local part
 * @ param prefix the prefix
 * @ return a QName with the supplied namespace URI , localPart and prefix */
public static QName QName ( String namespaceURI , String localPart , String prefix ) { } }

implementation: return new QName ( namespaceURI , localPart , prefix ) ;


signature:
public class GraphvizExample { /** * Exports two example DocumentRoot objects ( SBOL 1.1.0 and SBOL 2.0 objects ) in the GraphViz format .
 * @ param args command - line argument
 * @ throws Exception if anything goes wrong */
public static void main ( String [ ] args ) throws Exception { } }

implementation: System . out . println ( "SBOL 1 example" ) ; write ( new OutputStreamWriter ( System . out ) , DataTreeCreator . makeDocument ( ) ) ; System . out . println ( ) ; System . out . println ( "----------------------------------------" ) ; System . out . println ( ) ; System . out . println ( "SBOL 2 example" ) ; write ( new OutputStreamWriter ( System . out ) , DataTreeCreator . makeSBOL2Document ( ) ) ;


signature:
public class CORSFilter { /** * Converts the initial filter parameters ( typically specified in the
 * { @ code web . xml } file ) to a Java properties hashtable . The parameter
 * names become property keys .
 * @ param config The filter configuration .
 * @ return The context parameters as Java properties . */
private static Properties getFilterInitParameters ( final FilterConfig config ) { } }

implementation: Properties props = new Properties ( ) ; Enumeration en = config . getInitParameterNames ( ) ; while ( en . hasMoreElements ( ) ) { String key = ( String ) en . nextElement ( ) ; String value = config . getInitParameter ( key ) ; props . setProperty ( key , value ) ; } return props ;


signature:
public class CORSFilter { /** * This method is invoked by the web container to initialise the
 * filter at startup .
 * @ param filterConfig The filter configuration .
 * @ throws ServletException On a filter initialisation exception . */
public void init ( final FilterConfig filterConfig ) throws ServletException { } }

implementation:
// Get the init params
Properties props = getFilterInitParameters ( filterConfig ) ; // Extract and parse all required CORS filter properties
try { config = new CORSConfiguration ( props ) ; } catch ( CORSConfigurationException e ) { throw new ServletException ( e ) ; } handler = new CORSRequestHandler ( config ) ;


signature:
public class CORSFilter { /** * Produces a simple HTTP text / plain response with the specified status
 * code and message .
 * < p > Note : The CORS filter avoids falling back to the default web
 * container error page ( typically a richly - formatted HTML page ) to make
 * it easier for XHR debugger tools to identify the cause of failed
 * requests .
 * @ param sc The HTTP status code .
 * @ param message The message .
 * @ throws IOException On a I / O exception .
 * @ throws ServletException On a general request processing exception . */
private void printMessage ( final HttpServletResponse response , final int sc , final String msg ) throws IOException , ServletException { } }

implementation:
// Set the status code
response . setStatus ( sc ) ; // Write the error message
response . resetBuffer ( ) ; response . setContentType ( "text/plain" ) ; PrintWriter out = response . getWriter ( ) ; out . println ( "Cross-Origin Resource Sharing (CORS) Filter: " + msg ) ;


signature:
public class CORSFilter { /** * Filters an HTTP request / reponse pair according to the configured CORS
 * policy . Also tags the request with CORS information to downstream
 * handlers .
 * @ param request The servlet request .
 * @ param response The servlet response .
 * @ param chain The filter chain .
 * @ throws IOException On a I / O exception .
 * @ throws ServletException On a general request processing exception . */
private void doFilter ( final HttpServletRequest request , final HttpServletResponse response , final FilterChain chain ) throws IOException , ServletException { } }

implementation:
// Tag
handler . tagRequest ( request ) ; CORSRequestType type = CORSRequestType . detect ( request ) ; try { if ( type == CORSRequestType . ACTUAL ) { // Simple / actual CORS request
handler . handleActualRequest ( request , response ) ; chain . doFilter ( request , response ) ; } else if ( type == CORSRequestType . PREFLIGHT ) { // Preflight CORS request , handle but don ' t pass
// further down the chain
handler . handlePreflightRequest ( request , response ) ; } else if ( config . allowGenericHttpRequests ) { // Not a CORS request , but allow it through
request . setAttribute ( "cors.isCorsRequest" , false ) ; // tag
chain . doFilter ( request , response ) ; } else { // Generic HTTP requests denied
request . setAttribute ( "cors.isCorsRequest" , false ) ; // tag
printMessage ( response , HttpServletResponse . SC_FORBIDDEN , "Generic HTTP requests not allowed" ) ; } } catch ( InvalidCORSRequestException e ) { request . setAttribute ( "cors.isCorsRequest" , false ) ; // tag
printMessage ( response , HttpServletResponse . SC_BAD_REQUEST , e . getMessage ( ) ) ; } catch ( CORSOriginDeniedException e ) { String msg = e . getMessage ( ) + ": " + e . getRequestOrigin ( ) ; printMessage ( response , HttpServletResponse . SC_FORBIDDEN , msg ) ; } catch ( UnsupportedHTTPMethodException e ) { String msg = e . getMessage ( ) ; HTTPMethod method = e . getRequestedMethod ( ) ; if ( method != null ) msg = msg + ": " + method . toString ( ) ; printMessage ( response , HttpServletResponse . SC_METHOD_NOT_ALLOWED , msg ) ; } catch ( UnsupportedHTTPHeaderException e ) { String msg = e . getMessage ( ) ; HeaderFieldName header = e . getRequestHeader ( ) ; if ( header != null ) msg = msg + ": " + header . toString ( ) ; printMessage ( response , HttpServletResponse . SC_FORBIDDEN , msg ) ; }


signature:
public class DomainVersionedEntity { /** * Call this method when the entity is updated to increment its version and update its lastupdatedByEntityId
 * @ param lastupdatedByEntityId */
public void created ( final UUID createdByEntityId ) { } }

implementation: if ( this . entityId != null ) { throw new IllegalStateException ( "This entity has already been created: entityId = " + entityId ) ; } this . entityId = UUID . randomUUID ( ) ; this . entityVersion = 1 ; this . createdByEntityId = createdByEntityId ; this . updatedByEntityId = createdByEntityId ; this . entityCreatedOn = System . currentTimeMillis ( ) ; this . entityUpdatedOn = this . entityCreatedOn ;


signature:
public class DomainVersionedEntity { /** * Knows how to parse the following JSON fields :
 * < ul >
 * < li > entityId < / li >
 * < li > entityVersion < / li >
 * < li > entityCreatedOn < / li >
 * < li > createdByEntityId < / li >
 * < li > entityUpdatedOn < / li >
 * < li > updatedByEntityId < / li >
 * < / ul >
 * For any other field , JSON parsing is delegated to init ( JsonParser parser ) */
@ SuppressWarnings ( "incomplete-switch" ) @ Override public void init ( InputStream json ) throws IOException { } }

implementation: try ( final JsonParser parser = JsonUtils . createJsonParser ( json ) ) { JsonToken tk ; while ( ( tk = parser . nextToken ( ) ) != null ) { switch ( tk ) { case FIELD_NAME : final String fieldName = parser . getCurrentName ( ) ; if ( fieldName . equals ( "entityId" ) ) { setEntityId ( UUID . fromString ( parser . nextTextValue ( ) ) ) ; } else if ( fieldName . equals ( "entityVersion" ) ) { setEntityVersion ( parser . nextLongValue ( 0 ) ) ; } else if ( fieldName . equals ( "entityCreatedOn" ) ) { setEntityCreatedOn ( parser . nextLongValue ( 0 ) ) ; } else if ( fieldName . equals ( "createdByEntityId" ) ) { setCreatedBy ( UUID . fromString ( parser . nextTextValue ( ) ) ) ; } else if ( fieldName . equals ( "entityUpdatedOn" ) ) { setEntityUpdatedOn ( parser . nextLongValue ( 0 ) ) ; } else if ( fieldName . equals ( "updatedByEntityId" ) ) { setUpdatedBy ( UUID . fromString ( parser . nextTextValue ( ) ) ) ; } else { init ( parser ) ; } break ; } } }


signature:
public class DomainVersionedEntity { /** * Sub - classes should override this to parse sub - class specific fields .
 * This is invoked by init ( InputStream ) , when an unknown field is encountered
 * @ param parser */
protected void init ( JsonParser parser ) throws IOException { } }

implementation: LoggerFactory . getLogger ( getClass ( ) ) . warn ( "init(JsonParser parser) invoked to handle field: {}" , parser . getCurrentName ( ) ) ;


signature:
public class DomainVersionedEntity { /** * Call this method when the entity is updated before it is persisted to increment its version and update its lastupdatedByEntityId
 * @ param lastupdatedByEntityId
 * REQUIRED */
public void updated ( final UUID lastupdatedByEntityId ) { } }

implementation: if ( this . entityId == null ) { throw new IllegalStateException ( "The entity has not yet been created : entityId == null" ) ; } Assert . notNull ( lastupdatedByEntityId , "lastupdatedByEntityId is required" ) ; entityVersion ++ ; updatedByEntityId = lastupdatedByEntityId ; entityUpdatedOn = System . currentTimeMillis ( ) ;


signature:
public class CpdParser { /** * Converts the internal structure to the annotations API .
 * @ param duplications
 * the internal maven module
 * @ param moduleName
 * name of the maven module
 * @ return a maven module of the annotations API */
private Collection < DuplicateCode > convert ( final List < Duplication > duplications , final String moduleName ) { } }

implementation:
List < DuplicateCode > annotations = new ArrayList < DuplicateCode > ( ) ; for ( Duplication duplication : duplications ) { List < DuplicateCode > codeBlocks = new ArrayList < DuplicateCode > ( ) ; boolean isDerived = false ; for ( SourceFile file : duplication . getFiles ( ) ) { // TODO : check why PMD reports a length + 1
DuplicateCode annotation = new DuplicateCode ( getPriority ( duplication . getLines ( ) ) , file . getLine ( ) , duplication . getLines ( ) , file . getPath ( ) , isDerived ) ; annotation . setSourceCode ( duplication . getCodeFragment ( ) ) ; annotation . setModuleName ( moduleName ) ; codeBlocks . add ( annotation ) ; isDerived = true ; } for ( DuplicateCode block : codeBlocks ) { block . linkTo ( codeBlocks ) ; block . setPackageName ( PackageDetectors . detectPackageName ( block . getFileName ( ) ) ) ; } annotations . addAll ( codeBlocks ) ; } return annotations ;


signature:
public class BSDMServiceContainer { /** * With the current implementation , a service must be registered before the
 * message broker is started . . . or restart the broker to activate messaging for
 * that service . */
@ Override public void registerService ( ISemanticLocator packedServiceDescriptor ) throws ServiceExecutionException { } }

implementation: try { BSDFLogger . getLogger ( ) . info ( "Deploys service(s) from: " + packedServiceDescriptor . toString ( ) ) ; Collection < ISemanticIdentifier > deployedServices = this . deploy ( packedServiceDescriptor , bsdmServiceRegistry ) ; for ( ISemanticIdentifier deployedService : deployedServices ) { this . messageBroker . registerService ( this . bsdmServiceRegistry . getService ( deployedService ) . applyConnectorURL ( this . urlContainer ) ) ; } } catch ( ModelException ex ) { BSDFLogger . getLogger ( ) . debug ( "Cannot deploy service(s) from: " + packedServiceDescriptor . toString ( ) + " . Exception: " + ex . toString ( ) ) ; throw new ServiceExecutionException ( ex . getMessage ( ) , ex ) ; }


signature:
public class SecurityServiceSpringConfiguration { /** * Will try to lookup the HashServiceConfiguration using the name specified by { @ link # getHashServiceConfigurationName ( ) }
 * @ return */
@ Transactional protected HashServiceConfiguration hashServiceConfiguration ( ) { } }

implementation:
Exception exception = null ; for ( int i = 0 ; i < 3 ; i ++ ) { final HashServiceConfiguration config = hashServiceConfigurationDAO . findByName ( getHashServiceConfigurationName ( ) ) ; if ( config != null ) { return config ; } try { return hashServiceConfigurationDAO . create ( newHashServiceConfiguration ( ) ) ; } catch ( Exception e ) { exception = e ; try { Thread . sleep ( ( long ) ( Math . random ( ) * 1000 ) ) ; } catch ( InterruptedException e2 ) { // ignore
} } } throw new RuntimeException ( "hashServiceConfiguration() failed" , exception ) ;


signature:
public class Server { /** * Closes a port . All connections on this port will be closed .
 * @ param port The port to close . A value of less than - 1 closes all ports */
public void close ( int port ) { } }

implementation: for ( Iterator i = _listeners . keySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Object k = i . next ( ) ; Object s = _listeners . get ( k ) ; if ( s instanceof SocketHandler ) { SocketHandler sh = ( SocketHandler ) s ; if ( port == - 1 || sh . isPort ( port ) ) { sh . interrupt ( ) ; sh . close ( ) ; _transactions . remove ( s ) ; _listeners . remove ( k ) ; } } }


signature:
public class Server { /** * Incoming mesages from clients come here , and are delivered to listeners ,
 * both intra - VM and network .
 * @ param c the command
 * @ param h the headers
 * @ param b the message
 * @ param y the thing that received the message and passed it to us */
protected void receive ( Command c , Map h , String b , Authenticatable y ) { } }

implementation:
long id = ( int ) ( Math . random ( ) * 10000 ) ; try { // Convert to MESSAGE and distribute
if ( c == Command . COMMIT ) { synchronized ( _transactions ) { List trans = ( List ) _transactions . remove ( y ) ; trans = new ArrayList ( trans ) ; for ( Iterator i = trans . iterator ( ) ; i . hasNext ( ) ; ) { Message m = ( Message ) i . next ( ) ; try { receive ( m . command ( ) , m . headers ( ) , m . body ( ) , y ) ; } catch ( Exception e ) { // Don ' t allow listener code to break us
} } } } else if ( c == Command . ABORT ) { synchronized ( _transactions ) { _transactions . remove ( y ) ; } } else if ( _transactions . get ( y ) != null ) { synchronized ( _transactions ) { ( ( List ) _transactions . get ( y ) ) . add ( new Message ( c , h , b ) ) ; } } else { if ( h == null ) h = new HashMap ( ) ; String destination = ( String ) h . get ( "destination" ) ; if ( c == Command . SEND ) { if ( y instanceof IntraVMClient || _authenticator . authorizeSend ( y . token ( ) , destination ) ) { synchronized ( _listeners ) { List l = ( List ) _listeners . get ( destination ) ; if ( l != null ) { l = new ArrayList ( l ) ; for ( Iterator i = l . iterator ( ) ; i . hasNext ( ) ; ) { Listener sh = ( Listener ) i . next ( ) ; try { sh . message ( h , b ) ; } catch ( Exception e ) { // Don ' t allow listener code to break us
} } } } } else { Map error_headers = new HashMap ( ) ; error_headers . put ( "message:" , "authorization refused" ) ; error_headers . put ( "type:" , "send" ) ; error_headers . put ( "channel:" , destination ) ; y . error ( error_headers , "The message:\n-----\n" + b + "\n-----\nAuthentication token refused for this channel" ) ; } } else if ( c == Command . SUBSCRIBE ) { if ( y instanceof IntraVMClient || _authenticator . authorizeSubscribe ( y . token ( ) , destination ) ) { synchronized ( _listeners ) { List l = ( List ) _listeners . get ( destination ) ; if ( l == null ) { l = new ArrayList ( ) ; _listeners . put ( destination , l ) ; } if ( ! l . contains ( y ) ) l . add ( y ) ; } } else { Map error_headers = new HashMap ( ) ; error_headers . put ( "message:" , "authorization refused" ) ; error_headers . put ( "type:" , "subscription" ) ; error_headers . put ( "channel:" , destination ) ; y . error ( error_headers , "The message:\n-----\n" + b + "\n-----\nAuthentication token refused for this channel" ) ; } } else if ( c == Command . UNSUBSCRIBE ) { synchronized ( _listeners ) { List l = ( List ) _listeners . get ( destination ) ; if ( l != null ) l . remove ( y ) ; } } else if ( c == Command . BEGIN ) { synchronized ( _transactions ) { List trans = new ArrayList ( ) ; _transactions . put ( y , trans ) ; } } else if ( c == Command . DISCONNECT ) { synchronized ( _listeners ) { for ( Iterator i = _listeners . values ( ) . iterator ( ) ; i . hasNext ( ) ; ) { List l = ( List ) i . next ( ) ; l . remove ( y ) ; } } } } if ( h != null ) { String receipt = ( String ) h . get ( "receipt" ) ; if ( receipt != null ) { HashMap headers = new HashMap ( ) ; headers . put ( "receipt-id" , receipt ) ; y . receive ( Command . RECEIPT , headers , null ) ; } } } catch ( Exception e ) { // Don ' t allow listener code to break us
}


signature:
public class Server { /** * Gozirra is probably not the best choice for a stand - alone server . If
 * you are tempted to use it as such , you might want to look at ActiveMQ ,
 * which is a feature - rich MOM solution . Gozirra is intended primarily
 * to be an ultra - light embedded messaging library .
 * If you still want to run Gozirra as a stand - alone server , then you ' ll
 * need to know about how to call it . The main ( ) method takes a single
 * argument : a port to run on . It will run until you ^ C it . */
public static final void main ( String [ ] args ) { } }

implementation: if ( args . length != 1 ) { System . err . println ( "A single argument -- a port -- is required" ) ; System . exit ( 1 ) ; } int port = Integer . valueOf ( args [ 0 ] ) . intValue ( ) ; System . out . println ( Version . VERSION ) ; try { new Server ( port ) ; } catch ( Exception e ) { System . err . println ( "Failed to start server" ) ; e . printStackTrace ( System . err ) ; }


signature:
public class Validator { /** * This method will only be called if we know that JSR 303 1.0 Bean Validation API
 * and compliant implementation are available on classpath . */
public void validateOpts ( Object instance ) { } }

implementation:
final Set < ConstraintViolation < Object > > set = validator . validate ( instance ) ; final StringBuilder sb = new StringBuilder ( ) ; for ( ConstraintViolation < Object > violation : set ) { final Path path = violation . getPropertyPath ( ) ; final String msg = violation . getMessage ( ) ; sb . append ( path . toString ( ) ) . append ( " " ) . append ( msg ) . append ( ". " ) ; } if ( sb . length ( ) > 0 ) { // is ConstraintViolationException more appropriate ,
// letting user choose their error message ?
throw new ValidationException ( OPT_VIOLATION_MSG + ": " + sb . toString ( ) ) ; }


signature:
public class Validator { /** * This method will only be called if we know that JSR 303 1.1 Bean Validation API
 * and compliant implementation are available on classpath .
 * Method validation was first introduced in version 1.1 */
public void validateArgs ( List < Object > args , Object instance , Method m , Command cmd ) { } }

implementation:
final Set < ConstraintViolation < Object > > set = validator . validateParameters ( instance , m , args . toArray ( ) ) ; final StringBuilder sb = new StringBuilder ( ) ; for ( ConstraintViolation < Object > violation : set ) { final Path path = violation . getPropertyPath ( ) ; final String msg = violation . getMessage ( ) ; String var = path . toString ( ) ; try { int pos = Integer . parseInt ( "" + var . charAt ( var . length ( ) - 1 ) ) ; Argument arg = cmd . getArguments ( ) . get ( pos ) ; sb . append ( arg . getName ( ) ) . append ( " " ) . append ( msg ) . append ( ". " ) ; } catch ( Exception e ) { sb . append ( var ) . append ( " " ) . append ( msg ) . append ( ". " ) ; } } if ( sb . length ( ) > 0 ) { // is ConstraintViolationException more appropriate ,
// letting user choose their error message ?
throw new ValidationException ( ARG_VIOLATION_MSG + ": " + sb . toString ( ) ) ; }


signature:
public class Stomp { /** * Commits a transaction , causing any messages sent since begin ( )
 * was called to be delivered . This method does not return until
 * the server has confirmed that the commit was successfull . */
public void commitW ( Map header ) throws InterruptedException { } }

implementation: String receipt = addReceipt ( header ) ; transmit ( Command . COMMIT , header ) ; waitOnReceipt ( receipt ) ;


signature:
public class Stomp { /** * Subscribe to a channel .
 * @ param name The name of the channel to listen on
 * @ param headers Additional headers to send to the server .
 * @ param listener A listener to receive messages sent to the channel */
public void subscribe ( String name , Listener listener , Map headers ) { } }

implementation: synchronized ( _listeners ) { if ( listener != null ) { List list = ( List ) _listeners . get ( name ) ; if ( list == null ) { list = new ArrayList ( ) ; _listeners . put ( name , list ) ; } if ( ! list . contains ( listener ) ) list . add ( listener ) ; } } if ( headers == null ) headers = new HashMap ( ) ; headers . put ( "destination" , name ) ; transmit ( Command . SUBSCRIBE , headers ) ;


signature:
public class Stomp { /** * Subscribe to a channel . This method blocks until it receives a
 * receipt from the server .
 * @ param name The name of the channel to listen on
 * @ param header Additional headers to send to the server .
 * @ param listener A listener to receive messages sent to the channel */
public void subscribeW ( String name , Listener listener , Map header ) throws InterruptedException { } }

implementation: String receipt = addReceipt ( header ) ; subscribe ( name , listener , header ) ; waitOnReceipt ( receipt ) ;


signature:
public class Stomp { /** * Subscribe to a channel . This method blocks until it receives a
 * receipt from the server .
 * @ param name The name of the channel to listen on
 * @ param listener A listener to receive messages sent to the channel */
public void subscribeW ( String name , Listener listener ) throws InterruptedException { } }

implementation: subscribeW ( name , listener , null ) ;


signature:
public class Stomp { /** * Unsubscribe a single listener from a channel . This does not
 * send a message to the server unless the listener is the only
 * listener of this channel .
 * @ param name The name of the channel to unsubscribe from .
 * @ param l The listener to unsubscribe */
public void unsubscribe ( String name , Listener l ) { } }

implementation: synchronized ( _listeners ) { List list = ( List ) _listeners . get ( name ) ; if ( list != null ) { list . remove ( l ) ; if ( list . size ( ) == 0 ) { unsubscribe ( name ) ; } } }


signature:
public class Stomp { /** * Unsubscribe from a channel . Automatically unregisters all
 * listeners of the channel . To re - subscribe with listeners ,
 * subscribe must be passed the listeners again .
 * @ param name The name of the channel to unsubscribe from .
 * @ param header Additional headers to send to the server . */
public void unsubscribe ( String name , Map header ) { } }

implementation: if ( header == null ) header = new HashMap ( ) ; synchronized ( _listeners ) { _listeners . remove ( name ) ; } header . put ( "destination" , name ) ; transmit ( Command . UNSUBSCRIBE , header ) ;


signature:
public class Stomp { /** * Unsubscribe from a channel . Automatically unregisters all
 * listeners of the channel . To re - subscribe with listeners ,
 * subscribe must be passed the listeners again . This method
 * blocks until a receipt is received from the server .
 * @ param name The name of the channel to unsubscribe from . */
public void unsubscribeW ( String name , Map header ) throws InterruptedException { } }

implementation: String receipt = addReceipt ( header ) ; unsubscribe ( name , ( HashMap ) null ) ; waitOnReceipt ( receipt ) ;


signature:
public class Stomp { /** * Send a message to a channel synchronously . This method does
 * not return until the server acknowledges with a receipt .
 * @ param dest The name of the channel to send the message to
 * @ param mesg The message to send . */
public void sendW ( String dest , String mesg ) throws InterruptedException { } }

implementation: sendW ( dest , mesg , null ) ;


signature:
public class Stomp { /** * Send a message to a channel synchronously . This method does
 * not return until the server acknowledges with a receipt .
 * @ param dest The name of the channel to send the message to
 * @ param mesg The message to send . */
public void sendW ( String dest , String mesg , Map header ) throws InterruptedException { } }

implementation: String receipt = addReceipt ( header ) ; send ( dest , mesg , header ) ; waitOnReceipt ( receipt ) ;


signature:
public class Stomp { /** * Send a message to a channel .
 * @ param dest The name of the channel to send the message to
 * @ param mesg The message to send .
 * @ param header Additional headers to send to the server . */
public void send ( String dest , String mesg , Map header ) { } }

implementation: if ( header == null ) header = new HashMap ( ) ; header . put ( "destination" , dest ) ; transmit ( Command . SEND , header , mesg ) ;


signature:
public class Stomp { /** * Get the next unconsumed message for a particular channel . This is
 * non - blocking .
 * @ param name the name of the channel to search for
 * @ return the next message for the channel , or null if the queue
 * contains no messages for the channel . */
public Message getNext ( String name ) { } }

implementation: synchronized ( _queue ) { for ( int idx = 0 ; idx < _queue . size ( ) ; idx ++ ) { Message m = ( Message ) _queue . get ( idx ) ; if ( m . headers ( ) . get ( "destination" ) . equals ( name ) ) { _queue . remove ( idx ) ; return m ; } } } return null ;


signature:
public class Stomp { /** * Checks to see if a receipt has come in .
 * @ param receipt _ id the id of the receipts to find */
public boolean hasReceipt ( String receipt_id ) { } }

implementation: synchronized ( _receipts ) { for ( Iterator i = _receipts . iterator ( ) ; i . hasNext ( ) ; ) { String o = ( String ) i . next ( ) ; if ( o . equals ( receipt_id ) ) return true ; } } return false ;


signature:
public class Stomp { /** * Deletes all receipts with a given ID
 * @ param receipt _ id the id of the receipts to delete */
public void clearReceipt ( String receipt_id ) { } }

implementation: synchronized ( _receipts ) { for ( Iterator i = _receipts . iterator ( ) ; i . hasNext ( ) ; ) { String o = ( String ) i . next ( ) ; if ( o . equals ( receipt_id ) ) i . remove ( ) ; } }


signature:
public class SimianParser { /** * Converts the internal structure to the annotations API .
 * @ param duplications
 * the internal maven module
 * @ param moduleName
 * name of the maven module
 * @ return a maven module of the annotations API */
private Collection < DuplicateCode > convert ( final List < Set > duplications , final String moduleName ) { } }

implementation: List < DuplicateCode > annotations = new ArrayList < DuplicateCode > ( ) ; for ( Set duplication : duplications ) { List < DuplicateCode > codeBlocks = new ArrayList < DuplicateCode > ( ) ; boolean isDerived = false ; for ( Block file : duplication . getBlocks ( ) ) { DuplicateCode annotation = new DuplicateCode ( getPriority ( duplication . getLineCount ( ) ) , file . getStartLineNumber ( ) , duplication . getLineCount ( ) , file . getSourceFile ( ) , isDerived ) ; annotation . setModuleName ( moduleName ) ; codeBlocks . add ( annotation ) ; isDerived = true ; } for ( DuplicateCode block : codeBlocks ) { block . linkTo ( codeBlocks ) ; String packageName = PackageDetectors . detectPackageName ( block . getFileName ( ) ) ; block . setPackageName ( packageName ) ; } annotations . addAll ( codeBlocks ) ; } return annotations ;


signature:
public class EventBusServiceImpl { /** * Logs dead event as warnings . Dead events are events that posted , but there are no registered subscribers for that
 * event type .
 * @ param deadEvent */
@ Subscribe public void logDeadEvent ( final DeadEvent deadEvent ) { } }

implementation: final Object event = deadEvent . getEvent ( ) ; log . warn ( "{} : DeadEvent : {} : {}" , beanName , event . getClass ( ) . getName ( ) , event ) ;


signature:
public class Conversion { /** * Convert a value to a specific class .
 * The algorithm for finding a suitable converter is as follows :
 * Find converters that is able to convert both source and target ; a exact or
 * superclass match . Pick the converter that have the best target match , if both
 * are equal , pick the one with best source match .
 * That is , the converter that is most specialized in converting a value to
 * a specific target class will be prioritized , as long as it recognizes the source
 * value .
 * @ param source value to convert .
 * @ param targetclass class to convert to .
 * @ return converted value */
public < T > T convert ( final Object source , final Class < T > targetclass ) { } }

implementation: if ( source == null ) { return null ; } final Class < ? > sourceclass = source . getClass ( ) ; final SourceTargetPairKey key = new SourceTargetPairKey ( sourceclass , targetclass ) ; Converter converter = cache . get ( key ) ; if ( converter != null ) { return ( T ) converter . convert ( source , targetclass ) ; } final LinkedList < SourceTargetPairMatch > matches = new LinkedList < SourceTargetPairMatch > ( ) ; for ( SourceTargetPair pair : converters . values ( ) ) { SourceTargetPairMatch match = pair . match ( sourceclass , targetclass ) ; if ( match . matchesSource ( ) && match . matchesTarget ( ) ) { matches . add ( match ) ; } } if ( matches . size ( ) == 0 ) { throw new ConversionException ( "No suitable converter found for target class [" + targetclass . getName ( ) + "] and source value [" + sourceclass . getName ( ) + "]. The following converters are available [" + converters . keySet ( ) + "]" ) ; } Collections . sort ( matches , SourceTargetPairMatch . bestTargetMatch ( ) ) ; converter = matches . get ( 0 ) . pair . converter ; cache . put ( key , converter ) ; return ( T ) converter . convert ( source , targetclass ) ;


signature:
public class AbstractDryParser { /** * { @ inheritDoc } */
public Collection < FileAnnotation > parse ( final File file , final String moduleName ) throws InvocationTargetException { } }

implementation: FileInputStream inputStream = null ; try { inputStream = new FileInputStream ( file ) ; if ( accepts ( inputStream ) ) { IOUtils . closeQuietly ( inputStream ) ; inputStream = new FileInputStream ( file ) ; Set < FileAnnotation > warnings = Sets . newHashSet ( ) ; warnings . addAll ( parse ( inputStream , moduleName ) ) ; return warnings ; } else { throw new IOException ( "Can't parse CPD file " + file . getAbsolutePath ( ) ) ; } } catch ( IOException exception ) { throw new InvocationTargetException ( exception ) ; } finally { IOUtils . closeQuietly ( inputStream ) ; }


signature:
public class AbstractDryParser { /** * Returns the priority of the warning .
 * @ param lines
 * number of duplicate lines
 * @ return the priority of the warning */
protected Priority getPriority ( final int lines ) { } }

implementation: if ( lines >= highThreshold ) { return Priority . HIGH ; } else if ( lines >= normalThreshold ) { return Priority . NORMAL ; } else { return Priority . LOW ; }


signature:
public class ValidatedOrigin { /** * Returns the suffix which is made up of the host name / IP address and
 * port ( if a non - default port is specified ) .
 * < p > Example :
 * < pre >
 * http : / / example . com = > example . com
 * http : / / example . com : 8080 = > example . com : 8080
 * < / pre >
 * @ return The suffix . */
public String getSuffix ( ) { } }

implementation: String s = host ; if ( port != - 1 ) s = s + ":" + port ; return s ;


signature:
public class Command { /** * Execute this command according to the user input arguments
 * parsed by the parser . */
public void execute ( GNUishParser p ) { } }

implementation: if ( instance == null ) { instance = Utils . newInstance ( className ) ; } final Class < ? > clazz = instance . getClass ( ) ; final Method [ ] methods = clazz . getDeclaredMethods ( ) ; for ( Method m : methods ) { m . setAccessible ( true ) ; if ( ! m . getName ( ) . equals ( p . getCommand ( ) ) ) { continue ; } final List < Object > args = adjustArgs ( p . getArgs ( ) , m ) ; injectOpts ( p , clazz ) ; try { validateArgs ( args , instance , m , this ) ; m . invoke ( instance , args . toArray ( ) ) ; return ; } catch ( InvocationTargetException e ) { final Throwable ex = e . getTargetException ( ) ; if ( ex instanceof RuntimeException ) { throw ( RuntimeException ) e . getCause ( ) ; } else { throw new RuntimeException ( e . getTargetException ( ) ) ; } } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } System . out . println ( p . getCommand ( ) + ": command not found" ) ;


signature:
public class Command { /** * Convert options to appropriate type and inject them into
 * the command instance . */
private void injectOpts ( GNUishParser p , Class < ? > clazz ) { } }

implementation: for ( Field f : clazz . getDeclaredFields ( ) ) { f . setAccessible ( true ) ; final CliOption anno = f . getAnnotation ( CliOption . class ) ; if ( anno == null ) { continue ; } String value = p . getShortOpt ( anno . shortName ( ) ) ; if ( value == null ) { value = p . getLongOpt ( f . getName ( ) ) ; if ( value == null ) { continue ; } } try { f . set ( instance , c . convert ( value , f . getType ( ) ) ) ; } catch ( ConversionException e ) { throw CliException . WRONG_OPT_TYPE ( f . getName ( ) , f . getType ( ) . getName ( ) , value ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } validateOpts ( instance ) ;


signature:
public class Command { /** * Add or remove parameters to fit the method declaration and also convert them
 * to appropriate data type . */
private List < Object > adjustArgs ( List < String > args , Method m ) { } }

implementation: final List < Object > result = new ArrayList < Object > ( ) ; final Class < ? > [ ] types = m . getParameterTypes ( ) ; if ( m . isVarArgs ( ) ) { types [ types . length - 1 ] = types [ types . length - 1 ] . getComponentType ( ) ; if ( ! String . class . isAssignableFrom ( types [ types . length - 1 ] ) ) { throw new CliException ( "Only String varargs is supported." ) ; } types [ types . length - 1 ] = String . class ; } List < Object > varargs = new ArrayList < > ( ) ; for ( int i = 0 ; i < args . size ( ) ; i ++ ) { try { if ( m . isVarArgs ( ) && i >= types . length - 1 ) { varargs . add ( c . convert ( args . get ( i ) , types [ types . length - 1 ] ) ) ; } else { result . add ( c . convert ( args . get ( i ) , types [ i ] ) ) ; } } catch ( ConversionException e ) { throw CliException . WRONG_ARG_TYPE ( getArguments ( ) . get ( i ) . getName ( ) , types [ i ] . getName ( ) , args . get ( i ) ) ; } } if ( m . isVarArgs ( ) ) { result . add ( varargs . toArray ( new String [ 0 ] ) ) ; } return result ;


signature:
public class InternalMigrator { /** * Performs the migration of a personality . This must be run under the table lock so that only one thread can use it at a time . */
private List < MigrationResult > migratePersonality ( final MetadataManager metadataManager , final String personalityName , final Integer targetVersion , final MigratoryOption [ ] options ) { } }

implementation:
final Integer currentVersion = metadataManager . getCurrentVersion ( personalityName ) ; if ( currentVersion == null && ! migratoryConfig . isCreatePersonalities ( ) ) { throw new MigratoryException ( Reason . NEW_PERSONALITIES_DENIED ) ; } // Make sure that the current state of the personality is sane .
final List < MetadataInfo > history = metadataManager . getPersonalityHistory ( personalityName ) ; final MigrationManager migrationManager = new MigrationManager ( migratoryContext , personalityName ) ; // if null , this is a new personality . Don ' t validate it .
if ( history != null && ! history . isEmpty ( ) ) { // " No verify " option skips this step .
if ( ! MigratoryOption . containsOption ( MigratoryOption . NO_VERIFY , options ) ) { final DbValidator dbValidator = new DbValidator ( migrationManager ) ; final ValidationResult validationResult = dbValidator . validate ( history ) ; if ( validationResult . getValidationStatus ( ) != ValidationStatus . OK ) { throw new MigratoryException ( Reason . VALIDATION_FAILED , "Validation for Personality '%s' failed" , personalityName ) ; } } else { LOG . info ( "Skipped verification." ) ; } } final MigrationPlanner migrationPlanner = new MigrationPlanner ( migrationManager , currentVersion , targetVersion ) ; migrationPlanner . plan ( ) ; LOG . info ( "{}" , migrationPlanner . toString ( ) ) ; switch ( migrationPlanner . getDirection ( ) ) { case FORWARD : if ( ! migratoryConfig . isAllowRollForward ( ) ) { throw new MigratoryException ( Reason . ROLL_FORWARD_DENIED ) ; } break ; case BACK : if ( ! migratoryConfig . isAllowRollBack ( ) ) { throw new MigratoryException ( Reason . ROLL_BACK_DENIED ) ; } break ; case DO_NOTHING : return null ; default : LOG . warn ( "Encountered State {}. This should never happen!" , migrationPlanner . getDirection ( ) ) ; return null ; } final DbMigrator migrator = new DbMigrator ( migratoryContext , migrationPlanner ) ; final List < MigrationResult > results = migrator . migrate ( options ) ; LOG . info ( "Migration finished in '{}' steps, result is {}" , results . size ( ) , MigrationResult . determineMigrationState ( results ) ) ; return results ;


signature:
public class DryMavenResultAction { /** * { @ inheritDoc } */
public MavenAggregatedReport createAggregatedAction ( final MavenModuleSetBuild build , final Map < MavenModule , List < MavenBuild > > moduleBuilds ) { } }

implementation: return new DryMavenResultAction ( build , getHealthDescriptor ( ) , getDefaultEncoding ( ) , new DryResult ( build , getDefaultEncoding ( ) , new ParserResult ( ) , false ) ) ;


signature:
public class CalendarNameService { /** * Return the list of objects to act as calendars for the { @ link Note } s to attach to the specified " notable "
 * domain object , as per { @ link CalendarNameRepository } , or a default name otherwise .
 * May return null if there are none ( in which case a default name will be used ) . */
@ Programmatic public Collection < String > calendarNamesFor ( final Object notable ) { } }

implementation: final Set < String > fallback = Collections . singleton ( DEFAULT_CALENDAR_NAME ) ; if ( calendarNameRepository == null ) { return fallback ; } final Collection < String > calendarNames = calendarNameRepository . calendarNamesFor ( notable ) ; return calendarNames != null ? calendarNames : fallback ;


signature:
public class ClasspathLoader { /** * This method loads a file from a classpath : / . . . URI . */
@ Override public String loadFile ( final URI fileUri ) { } }

implementation: try { final URL urlLocation = Resources . getResource ( this . getClass ( ) , fileUri . getPath ( ) ) ; return Resources . toString ( urlLocation , Charsets . UTF_8 ) ; } catch ( IOException e ) { throw new MigratoryException ( Reason . INTERNAL , e ) ; }


signature:
public class FileLoader { /** * This method loads a file from a file : / . . . URI . This is probably not what you are looking for . */
@ Override public String loadFile ( final URI fileUri ) throws IOException { } }

implementation: final File fileLocation = new File ( fileUri ) ; if ( fileLocation . exists ( ) && fileLocation . canRead ( ) ) { if ( fileLocation . isFile ( ) ) { return Files . toString ( fileLocation , charset ) ; } else { throw new MigratoryException ( Reason . INTERNAL , "%s is not a file!" , fileLocation ) ; } } else { throw new MigratoryException ( Reason . INTERNAL , "Can not access %s!" , fileLocation ) ; }


signature:
public class AsyncMessageBroker { /** * Set this broker object to receive messages during a given period of time , blocking execution . */
public synchronized void receiveMessagesSyncronously ( long ms ) throws ServiceGroundingException { } }

implementation: for ( IChannelConsumer chConsumer : this . serviceChannelConsumers ) { if ( chConsumer instanceof AbstractJMSChannelConsumer ) { AbstractJMSChannelConsumer achConsumer = ( AbstractJMSChannelConsumer ) chConsumer ; achConsumer . receiveOrWait ( ms ) ; } if ( chConsumer instanceof AbstractStompChannelConsumer ) { AbstractStompChannelConsumer achConsumer = ( AbstractStompChannelConsumer ) chConsumer ; achConsumer . receiveOrWait ( ms ) ; } }


signature:
public class CORSRequestHandler { /** * Serialises the items of a set into a string . Each item must have a
 * meaningful { @ code toString ( ) } method .
 * @ param set The set to serialise .
 * @ param sep The string separator to apply .
 * @ return The serialised set as string . */
private static String serialize ( final Set set , final String sep ) { } }

implementation: Iterator it = set . iterator ( ) ; String s = "" ; while ( it . hasNext ( ) ) { s = s + it . next ( ) . toString ( ) ; if ( it . hasNext ( ) ) s = s + sep ; } return s ;


signature:
public class CORSRequestHandler { /** * Parses a header value consisting of zero or more space / comma /
 * space + comma separated strings . The input string is trimmed before
 * splitting .
 * @ param headerValue The header value , may be { @ code null } .
 * @ return A string array of the parsed string items , empty if none
 * were found or the input was { @ code null } . */
private static String [ ] parseMultipleHeaderValues ( final String headerValue ) { } }

implementation: if ( headerValue == null ) return new String [ 0 ] ; String trimmedHeaderValue = headerValue . trim ( ) ; if ( trimmedHeaderValue . isEmpty ( ) ) return new String [ 0 ] ; return trimmedHeaderValue . split ( "\\s*,\\s*|\\s+" ) ;


signature:
public class CORSRequestHandler { /** * Tags an HTTP servlet request to provide CORS information to
 * downstream handlers .
 * < p > Tagging is provided via { @ code HttpServletRequest . setAttribute ( ) } .
 * < ul >
 * < li > { @ code cors . isCorsRequest } set to { @ code true } or { @ code false } .
 * < li > { @ code cors . origin } set to the value of the " Origin " header ,
 * { @ code null } if undefined .
 * < li > { @ code cors . requestType } set to " actual " or " preflight " ( for
 * CORS requests ) .
 * < li > { @ code cors . requestHeaders } set to the value of the
 * " Access - Control - Request - Headers " or { @ code null } if
 * undefined ( added for preflight CORS requests only ) .
 * < / ul >
 * @ param request The servlet request to inspect and tag . Must not be
 * { @ code null } . */
public void tagRequest ( final HttpServletRequest request ) { } }

implementation: final CORSRequestType type = CORSRequestType . detect ( request ) ; switch ( type ) { case ACTUAL : request . setAttribute ( "cors.isCorsRequest" , true ) ; request . setAttribute ( "cors.origin" , request . getHeader ( "Origin" ) ) ; request . setAttribute ( "cors.requestType" , "actual" ) ; break ; case PREFLIGHT : request . setAttribute ( "cors.isCorsRequest" , true ) ; request . setAttribute ( "cors.origin" , request . getHeader ( "Origin" ) ) ; request . setAttribute ( "cors.requestType" , "preflight" ) ; request . setAttribute ( "cors.requestHeaders" , request . getHeader ( "Access-Control-Request-Headers" ) ) ; break ; case OTHER : request . setAttribute ( "cors.isCorsRequest" , false ) ; }


signature:
public class CORSRequestHandler { /** * Handles a simple or actual CORS request .
 * < p > CORS specification : < a href = " http : / / www . w3 . org / TR / access - control / # resource - requests " > Simple Cross - Origin Request , Actual Request , and Redirects < / a >
 * @ param request The HTTP request .
 * @ param response The HTTP response .
 * @ throws InvalidCORSRequestException If not a valid CORS simple /
 * actual request .
 * @ throws CORSOriginDeniedException If the origin is not allowed .
 * @ throws UnsupportedHTTPMethodException If the requested HTTP method
 * is not supported by the CORS
 * policy . */
public void handleActualRequest ( final HttpServletRequest request , final HttpServletResponse response ) throws InvalidCORSRequestException , CORSOriginDeniedException , UnsupportedHTTPMethodException { } }

implementation:
if ( CORSRequestType . detect ( request ) != CORSRequestType . ACTUAL ) throw new InvalidCORSRequestException ( "Invalid simple/actual CORS request" ) ; // Check origin against allow list
Origin requestOrigin = new Origin ( request . getHeader ( "Origin" ) ) ; if ( ! config . isAllowedOrigin ( requestOrigin ) ) throw new CORSOriginDeniedException ( "CORS origin denied" , requestOrigin ) ; // Check method
HTTPMethod method = null ; try { method = HTTPMethod . valueOf ( request . getMethod ( ) ) ; } catch ( Exception e ) { // Parse exception
throw new UnsupportedHTTPMethodException ( "Unsupported HTTP method: " + request . getMethod ( ) ) ; } if ( ! config . isSupportedMethod ( method ) ) throw new UnsupportedHTTPMethodException ( "Unsupported HTTP method" , method ) ; // Success , append response headers
response . addHeader ( "Access-Control-Allow-Origin" , requestOrigin . toString ( ) ) ; if ( config . supportsCredentials ) response . addHeader ( "Access-Control-Allow-Credentials" , "true" ) ; if ( ! exposedHeaders . isEmpty ( ) ) response . addHeader ( "Access-Control-Expose-Headers" , exposedHeaders ) ; // Tag request
request . setAttribute ( "cors.origin" , requestOrigin . toString ( ) ) ; request . setAttribute ( "cors.requestType" , "actual" ) ;


signature:
public class CORSRequestHandler { /** * Handles a preflight CORS request .
 * < p > CORS specification : < a href = " http : / / www . w3 . org / TR / access - control / # resource - preflight - requests " > Preflight Request < / a >
 * @ param request The HTTP request .
 * @ param response The HTTP response .
 * @ throws InvalidCORSRequestException If not a valid CORS preflight
 * request .
 * @ throws CORSOriginDeniedException If the origin is not allowed .
 * @ throws UnsupportedHTTPMethodException If the requested HTTP method
 * is not supported by the CORS
 * policy .
 * @ throws UnsupportedHTTPHeaderException If the requested HTTP header
 * is not supported by the CORS
 * policy . */
public void handlePreflightRequest ( final HttpServletRequest request , final HttpServletResponse response ) throws InvalidCORSRequestException , CORSOriginDeniedException , UnsupportedHTTPMethodException , UnsupportedHTTPHeaderException { } }

implementation:
if ( CORSRequestType . detect ( request ) != CORSRequestType . PREFLIGHT ) throw new InvalidCORSRequestException ( "Invalid preflight CORS request" ) ; // Check origin against allow list
Origin requestOrigin = new Origin ( request . getHeader ( "Origin" ) ) ; if ( ! config . isAllowedOrigin ( requestOrigin ) ) throw new CORSOriginDeniedException ( "CORS origin denied" , requestOrigin ) ; // Parse requested method
// Note : method checking must be done after header parsing , see CORS spec
String requestMethodHeader = request . getHeader ( "Access-Control-Request-Method" ) ; if ( requestMethodHeader == null ) throw new InvalidCORSRequestException ( "Invalid preflight CORS request: Missing Access-Control-Request-Method header" ) ; HTTPMethod requestedMethod = null ; try { requestedMethod = HTTPMethod . valueOf ( requestMethodHeader . toUpperCase ( ) ) ; } catch ( Exception e ) { // Parse exception
throw new UnsupportedHTTPMethodException ( "Unsupported HTTP method: " + requestMethodHeader ) ; } // Parse custom headers
final String [ ] requestHeaderValues = parseMultipleHeaderValues ( request . getHeader ( "Access-Control-Request-Headers" ) ) ; final HeaderFieldName [ ] requestHeaders = new HeaderFieldName [ requestHeaderValues . length ] ; for ( int i = 0 ; i < requestHeaders . length ; i ++ ) { try { requestHeaders [ i ] = new HeaderFieldName ( requestHeaderValues [ i ] ) ; } catch ( IllegalArgumentException e ) { // Invalid header name
throw new InvalidCORSRequestException ( "Invalid preflight CORS request: Bad request header value" ) ; } } // Now , do method check
if ( ! config . isSupportedMethod ( requestedMethod ) ) throw new UnsupportedHTTPMethodException ( "Unsupported HTTP method" , requestedMethod ) ; // Author request headers check
for ( int i = 0 ; i < requestHeaders . length ; i ++ ) { if ( ! config . supportedHeaders . contains ( requestHeaders [ i ] ) ) throw new UnsupportedHTTPHeaderException ( "Unsupported HTTP request header" , requestHeaders [ i ] ) ; } // Success , append response headers
if ( config . supportsCredentials ) { response . addHeader ( "Access-Control-Allow-Origin" , requestOrigin . toString ( ) ) ; response . addHeader ( "Access-Control-Allow-Credentials" , "true" ) ; } else { if ( config . allowAnyOrigin ) response . addHeader ( "Access-Control-Allow-Origin" , "*" ) ; else response . addHeader ( "Access-Control-Allow-Origin" , requestOrigin . toString ( ) ) ; } if ( config . maxAge > 0 ) response . addHeader ( "Access-Control-Max-Age" , Integer . toString ( config . maxAge ) ) ; response . addHeader ( "Access-Control-Allow-Methods" , supportedMethods ) ; if ( ! supportedHeaders . isEmpty ( ) ) response . addHeader ( "Access-Control-Allow-Headers" , supportedHeaders ) ;


signature:
public class HeaderFieldName { /** * Applies a { @ code Aaa - Bbb - Ccc } format to a header field name .
 * @ param name The header field name to format , must not be an empty
 * string or { @ code null } .
 * @ return The formatted header field name .
 * @ throws IllegalArgumentException On a empty or invalid header field
 * name . */
protected static String formatCanonical ( final String name ) { } }

implementation:
String nameTrimmed = name . trim ( ) ; if ( nameTrimmed . isEmpty ( ) ) throw new IllegalArgumentException ( "The header field name must not be an empty string" ) ; // Check for valid syntax : must begin with letter , then only word and dash chars allowed
if ( ! nameTrimmed . matches ( "^[a-zA-Z][\\w-]*$" ) ) throw new IllegalArgumentException ( "Invalid header field name syntax" ) ; String [ ] tokens = nameTrimmed . toLowerCase ( ) . split ( "-" ) ; String out = "" ; for ( int i = 0 ; i < tokens . length ; i ++ ) { char [ ] c = tokens [ i ] . toCharArray ( ) ; // Capitalise first char
c [ 0 ] = Character . toUpperCase ( c [ 0 ] ) ; if ( i >= 1 ) out = out + "-" ; out = out + new String ( c ) ; } return out ;


signature:
public class MinDeps { /** * Sets the commandline options .
 * @ param optionsthe options to use
 * @ returntrue if successful
 * @ throws Exceptionin case of an invalid option */
public boolean setOptions ( String [ ] options ) throws Exception { } }

implementation: ArgumentParser parser ; Namespace ns ; parser = ArgumentParsers . newArgumentParser ( MinDeps . class . getName ( ) ) ; parser . addArgument ( "--java-home" ) . type ( Arguments . fileType ( ) . verifyExists ( ) . verifyIsDirectory ( ) ) . dest ( "javahome" ) . required ( true ) . help ( "The java home directory of the JDK that includes the jdeps binary, default is taken from JAVA_HOME environment variable." ) ; parser . addArgument ( "--class-path" ) . dest ( "classpath" ) . required ( true ) . help ( "The CLASSPATH to use for jdeps." ) ; parser . addArgument ( "--classes" ) . type ( Arguments . fileType ( ) . verifyExists ( ) . verifyIsFile ( ) . verifyCanRead ( ) ) . dest ( "classes" ) . required ( true ) . help ( "The file containing the classes to determine the dependencies for. Empty lines and lines starting with # get ignored." ) ; parser . addArgument ( "--additional" ) . type ( Arguments . fileType ( ) ) . setDefault ( new File ( "." ) ) . required ( false ) . dest ( "additional" ) . help ( "The file with additional class names to just include." ) ; parser . addArgument ( "--output" ) . type ( Arguments . fileType ( ) ) . setDefault ( new File ( "." ) ) . required ( false ) . dest ( "output" ) . help ( "The file for storing the determined class names in." ) ; parser . addArgument ( "package" ) . dest ( "packages" ) . required ( true ) . nargs ( "+" ) . help ( "The packages to keep, eg 'weka'." ) ; try { ns = parser . parseArgs ( options ) ; } catch ( ArgumentParserException e ) { parser . handleError ( e ) ; return false ; } setJavaHome ( ns . get ( "javahome" ) ) ; setClassPath ( ns . getString ( "classpath" ) ) ; setClassesFile ( ns . get ( "classes" ) ) ; setAdditionalFile ( ns . get ( "additional" ) ) ; setPackages ( ns . getList ( "packages" ) ) ; setOutputFile ( ns . get ( "output" ) ) ; return true ;


signature:
public class MinDeps { /** * Reads the file into the the provided list .
 * Skips empty lines and lines starting with # .
 * @ param filethe file to read
 * @ param lines the lines to add the content to
 * @ return null if successful , otherwise error message */
protected String readFile ( File file , List < String > lines ) { } }

implementation: int i ; try { lines . addAll ( Files . readAllLines ( file . toPath ( ) ) ) ; i = 0 ; while ( i < lines . size ( ) ) { if ( lines . get ( i ) . trim ( ) . isEmpty ( ) ) { lines . remove ( i ) ; continue ; } if ( lines . get ( i ) . startsWith ( "#" ) ) { lines . remove ( i ) ; continue ; } i ++ ; } } catch ( Exception e ) { return "Failed to read file: " + file + "\n" + e ; } return null ;


signature:
public class MinDeps { /** * Performs some checks .
 * @ returnnull if successful , otherwise error message */
protected String check ( ) { } }

implementation:
String error ; if ( ! m_JavaHome . exists ( ) ) return "Java home directory does not exist: " + m_JavaHome ; if ( ! m_JavaHome . isDirectory ( ) ) return "Java home does not point to a directory: " + m_JavaHome ; if ( System . getProperty ( "os.name" ) . toLowerCase ( ) . contains ( "windows" ) ) m_Jdeps = new File ( m_JavaHome . getAbsolutePath ( ) + File . separator + "bin" + File . separator + "jdeps.exe" ) ; else m_Jdeps = new File ( m_JavaHome . getAbsolutePath ( ) + File . separator + "bin" + File . separator + "jdeps" ) ; if ( ! m_Jdeps . exists ( ) ) return "jdeps binary does not exist: " + m_Jdeps ; if ( ! m_ClassesFile . exists ( ) ) return "File with class names does not exist: " + m_ClassesFile ; if ( m_ClassesFile . isDirectory ( ) ) return "File with class names points to directory: " + m_ClassesFile ; // read classes
error = readFile ( m_ClassesFile , m_Classes ) ; if ( error != null ) return error ; // read resources
if ( ( m_AdditionalFile != null ) && m_AdditionalFile . exists ( ) && ( ! m_AdditionalFile . isDirectory ( ) ) ) { error = readFile ( m_AdditionalFile , m_Resources ) ; if ( error != null ) return error ; } return null ;


signature:
public class MinDeps { /** * Filters the list of strings with a regular expression .
 * @ param linesthe list to filter
 * @ param regexpthe regular expression to use
 * @ param invertwhether to invert the matching sense
 * @ returnthe filtered list */
protected List < String > filter ( List < String > lines , String regexp , boolean invert ) { } }

implementation: List < String > result ; Pattern pattern ; result = new ArrayList < > ( ) ; pattern = Pattern . compile ( regexp ) ; for ( String line : lines ) { if ( invert ) { if ( ! pattern . matcher ( line ) . matches ( ) ) result . add ( line ) ; } else { if ( pattern . matcher ( line ) . matches ( ) ) result . add ( line ) ; } } return result ;


signature:
public class MinDeps { /** * Builds the regular expression for the packages to keep .
 * @ returnthe regexp */
protected String packagesRegExp ( ) { } }

implementation: StringBuilder result ; int i ; String pkg ; result = new StringBuilder ( ) ; result . append ( ".* (" ) ; for ( i = 0 ; i < m_Packages . size ( ) ; i ++ ) { if ( i > 0 ) result . append ( "|" ) ; pkg = m_Packages . get ( i ) ; if ( ! pkg . endsWith ( "." ) ) pkg = pkg + "." ; pkg = pkg . replace ( "." , "\\." ) ; result . append ( pkg ) ; } result . append ( ").*$" ) ; return result . toString ( ) ;


signature:
public class MinDeps { /** * Determines the dependencies .
 * @ returnnull if successful , otherwise error message */
protected String determine ( ) { } }

implementation:
String [ ] cmd ; ProcessBuilder builder ; CollectingProcessOutput output ; List < String > lines ; int i ; String line ; for ( String cls : m_Classes ) { // progress
System . err . println ( cls ) ; cmd = new String [ ] { m_Jdeps . getAbsolutePath ( ) , "-cp" , m_ClassPath , "-recursive" , "-verbose:class" , cls } ; builder = new ProcessBuilder ( ) ; builder . command ( cmd ) ; output = new CollectingProcessOutput ( ) ; try { output . monitor ( builder ) ; } catch ( Exception e ) { return "Failed to execute: " + builder . toString ( ) + "\n" + e ; } // filter output
lines = new ArrayList < > ( Arrays . asList ( output . getStdOut ( ) . replace ( "\r" , "" ) . split ( "\n" ) ) ) ; lines = filter ( lines , packagesRegExp ( ) , false ) ; lines = filter ( lines , ".*\\$.*" , true ) ; lines = filter ( lines , ".*\\.jar\\)" , true ) ; // clean up
for ( i = 0 ; i < lines . size ( ) ; i ++ ) { line = lines . get ( i ) ; line = line . replaceFirst ( ".* -> " , "" ) ; line = line . replaceFirst ( " .*$" , "" ) ; line = line . trim ( ) ; lines . set ( i , line ) ; } // add to result
m_DependentClasses . addAll ( lines ) ; System . err . println ( "--> " + m_DependentClasses . size ( ) ) ; } return null ;


signature:
public class MinDeps { /** * Determines the dependencies .
 * @ returnnull if successful , otherwise error message */
public String execute ( ) { } }

implementation: String result ; initialize ( ) ; result = check ( ) ; if ( result == null ) result = determine ( ) ; if ( result == null ) { m_Dependencies = new ArrayList < > ( ) ; m_Dependencies . addAll ( m_Classes ) ; for ( String cls : m_DependentClasses ) { if ( ! m_Dependencies . contains ( cls ) ) m_Dependencies . add ( cls ) ; } for ( String cls : m_Resources ) { if ( ! m_Dependencies . contains ( cls ) ) m_Dependencies . add ( cls ) ; } Collections . sort ( m_Dependencies ) ; } return result ;


signature:
public class MinDeps { /** * Outputs the dependencies on stdout . */
public void output ( ) { } }

implementation: if ( ( m_OutputFile == null || m_OutputFile . isDirectory ( ) ) ) { for ( String dep : m_Dependencies ) System . out . println ( dep ) ; } else { try { Files . write ( m_OutputFile . toPath ( ) , m_Dependencies , StandardOpenOption . CREATE , StandardOpenOption . TRUNCATE_EXISTING ) ; } catch ( Exception e ) { System . err . println ( "Failed to write dependencies to: " + m_OutputFile ) ; e . printStackTrace ( ) ; } }


signature:
public class InstanceProvider { /** * Default implementation of compareTo for the InstanceManager . */
@ Override public int compareTo ( InstanceProvider instanceProvider ) { } }

implementation: if ( this . getPriority ( ) . equals ( instanceProvider . getPriority ( ) ) ) { return this . getName ( ) . compareTo ( instanceProvider . getName ( ) ) ; } else { return this . getPriority ( ) . compareTo ( instanceProvider . getPriority ( ) ) ; }


signature:
public class CommandServiceImpl { /** * ( non - Javadoc )
 * @ see com . azaptree . services . command . impl . CommandServiceJmxApi # getCommandCatalogNames ( ) */
@ ManagedAttribute @ Override public String [ ] getCommandCatalogNames ( ) { } }

implementation: final Set < String > catalogNames = new TreeSet < > ( commandCatalogs . keySet ( ) ) ; return catalogNames . toArray ( new String [ catalogNames . size ( ) ] ) ;


signature:
public class CommandServiceImpl { /** * ( non - Javadoc )
 * @ see com . azaptree . services . command . impl . CommandServiceJmxApi # getCommandNames ( java . lang . String ) */
@ Override @ ManagedOperation @ ManagedOperationParameters ( { } }

implementation: @ ManagedOperationParameter ( name = "catalogName" , description = "Catalog name" ) } ) public String [ ] getCommandNames ( final String catalogName ) { Assert . hasText ( catalogName , "catalogName is required" ) ; final CommandCatalog catalog = getCommandCatalog ( catalogName ) ; return catalog . getCommandNames ( ) ;


signature:
public class UtilsFactory { /** * Retrieve IOUtils implementation
 * @ return IOUtils instance */
public static IOUtils getIOUtils ( ) { } }

implementation: if ( ioUtils == null ) { try { Class clazz = Class . forName ( IO_UTILS ) ; ioUtils = ( IOUtils ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { LOGGER . warn ( "Cannot instanciate util: {}" , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } return ioUtils ;


signature:
public class UtilsFactory { /** * Retrieve ImageUtils implementation
 * @ return ImageUtils instance */
public static ImageUtils getImageUtils ( ) { } }

implementation: if ( imageUtils == null ) { try { Class clazz = Class . forName ( IMAGE_UTILS ) ; imageUtils = ( ImageUtils ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { LOGGER . warn ( "Cannot instanciate util: {}" , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } return imageUtils ;


signature:
public class UtilsFactory { /** * Retrieve PriceUtils implementation
 * @ return PriceUtils instance */
public static PriceUtils getPriceUtils ( ) { } }

implementation: if ( priceUtils == null ) { try { Class clazz = Class . forName ( PRICE_UTILS ) ; priceUtils = ( PriceUtils ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { LOGGER . warn ( "Cannot instanciate util: {}" , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } return priceUtils ;


signature:
public class UtilsFactory { /** * Retrieve ResourceUtils implementation
 * @ return ResourceUtils instance */
public static ResourceUtils getResourceUtils ( ) { } }

implementation: if ( resourceUtils == null ) { try { Class clazz = Class . forName ( RESOURCE_UTILS ) ; resourceUtils = ( ResourceUtils ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { LOGGER . warn ( "Cannot instanciate util: {}" , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } return resourceUtils ;


signature:
public class UtilsFactory { /** * Retrieve ZipUtils implementation
 * @ return ZipUtils instance */
public static ZipUtils getZipUtils ( ) { } }

implementation: if ( zipUtils == null ) { try { Class clazz = Class . forName ( ZIP_UTILS ) ; zipUtils = ( ZipUtils ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { LOGGER . warn ( "Cannot instanciate util: {}" , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } return zipUtils ;


signature:
public class UtilsFactory { /** * Retrieve DigestUtils implementation
 * @ return DigestUtils instance */
public static DigestUtils getDigestUtils ( ) { } }

implementation: if ( digestUtils == null ) { try { Class clazz = Class . forName ( DIGEST_UTILS ) ; digestUtils = ( DigestUtils ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { LOGGER . warn ( "Cannot instanciate util: {}" , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } return digestUtils ;


signature:
public class UtilsFactory { /** * Retrieve StringUtils implementation
 * @ return StringUtils instance */
public static StringUtils getStringUtils ( ) { } }

implementation: if ( stringUtils == null ) { try { Class clazz = Class . forName ( STRING_UTILS ) ; stringUtils = ( StringUtils ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { LOGGER . warn ( "Cannot instanciate util: {}" , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } return stringUtils ;


signature:
public class UtilsFactory { /** * Retrieve ResourceService implementation
 * @ return ResourceService instance */
public static ResourceService getResourceService ( ) { } }

implementation: if ( resourceService == null ) { try { Class clazz = Class . forName ( RESOURCE_SERVICE ) ; resourceService = ( ResourceService ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { LOGGER . warn ( "Cannot instanciate util: {}" , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } return resourceService ;


signature:
public class UtilsFactory { /** * Retrieve PricingService implementation
 * @ return PricingService instance */
public static PricingService getPricingService ( ) { } }

implementation: if ( pricingService == null ) { try { Class clazz = Class . forName ( PRICING_SERVICE ) ; pricingService = ( PricingService ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { LOGGER . warn ( "Cannot instanciate util: {}" , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } return pricingService ;


signature:
public class UtilsFactory { /** * Retrieve InstanceService implementation
 * @ return InstanceService instance */
public static InstanceService getInstanceService ( ) { } }

implementation: if ( instanceService == null ) { try { Class clazz = Class . forName ( INSTANCE_SERVICE ) ; instanceService = ( InstanceService ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException e ) { LOGGER . warn ( "Cannot instanciate util: {}" , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } return instanceService ;