ctakes-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Britt Fitch <britt.fi...@wiredinformatics.com>
Subject Re: build tool suggestion
Date Wed, 06 May 2015 15:00:21 GMT
There is a Sonar plugin for Jenkins that's pretty rad. 

Sent from my iPhone

> On May 6, 2015, at 10:57 AM, Masanz, James J. <Masanz.James@mayo.edu> wrote:
> 
> 
> Sorry, I wasn't clear, when I said "at build time", I meant the Jenkins automated build.

> 
> 
> -----Original Message-----
> From: Finan, Sean [mailto:Sean.Finan@childrens.harvard.edu] 
> Sent: Wednesday, May 06, 2015 9:52 AM
> To: dev@ctakes.apache.org
> Subject: RE: build tool suggestion
> 
> Your IDE should have settings that allow custom warnings.  Also check out findbugs --
http://en.wikipedia.org/wiki/FindBugs
> 
> There might be a configurable maven plugin.  
> 
> It is a process ...
> 
> -----Original Message-----
> From: Masanz, James J. [mailto:Masanz.James@mayo.edu] 
> Sent: Tuesday, May 05, 2015 8:01 PM
> To: dev@ctakes.apache.org
> Subject: build tool suggestion
> 
> 
> Do you know offhand, would it be easy to have something run at build time that flags
uses of FileReader?
> 
> Related - do we have anything at build time that produces warnings that are looked at?
 When I check in a change, I just check whether the next build is successful or not.  I don't
look for warnings other than what I see when I try a compile of my own on my own system. 
Ideally I think it would be good to have the use of FileReader cause a meaningful warning.
 But if there's no relatively easy way to do that, might we consider having it cause a build
failure?  I think the benefits would outweigh the drawbacks.
> 
> -- James
> 
> ________________________________________
> From: Chen, Pei [Pei.Chen@childrens.harvard.edu]
> Sent: Tuesday, May 05, 2015 5:55 PM
> To: dev@ctakes.apache.org
> Subject: RE: svn commit: r1677903 - in /ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2:
concept/BsvConceptFactory.java dictionary/BsvRareWordDictionary.java util/JdbcConnectionFactory.java
> 
> Can we use InputStreamReader instead of FileReader?
> That way the resource can also be read from within a jar (potentially from maven central,
etc.) and doesn't have to be fixed to a physical file...
> 
> i.e.
> Instead of new BufferedReader(new FileReader(path)) new BufferedReader(new InputStreamReader(FileLocator.getAsStream(path)))
> 
> --Pei
> 
> -----Original Message-----
> From: seanfinan@apache.org [mailto:seanfinan@apache.org]
> Sent: Tuesday, May 05, 2015 6:42 PM
> To: commits@ctakes.apache.org
> Subject: svn commit: r1677903 - in /ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2:
concept/BsvConceptFactory.java dictionary/BsvRareWordDictionary.java util/JdbcConnectionFactory.java
> 
> Author: seanfinan
> Date: Tue May  5 22:41:26 2015
> New Revision: 1677903
> 
> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__svn.apache.org_r1677903&d=BQICaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=huK2MFkj300qccT8OSuuoYhy_xEYujfPwiAxhPVz5WY&m=9sLhiql1kiKYdaC8Nx3dTASt89nXQA3uy4kwesnHIag&s=wuwFl1DxU-yGWdGewROupvowHfYFay_u5LYKJUJF2VA&e=
> Log:
> Use FileLocator to find BSV dictionaries
> 
> Modified:
>    ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/concept/BsvConceptFactory.java
>    ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/BsvRareWordDictionary.java
>    ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/JdbcConnectionFactory.java
> 
> Modified: ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/concept/BsvConceptFactory.java
> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__svn.apache.org_viewvc_ctakes_trunk_ctakes-2Ddictionary-2Dlookup-2Dfast_src_main_java_org_apache_ctakes_dictionary_lookup2_concept_BsvConceptFactory.java-3Frev-3D1677903-26r1-3D1677902-26r2-3D1677903-26view-3Ddiff&d=BQICaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=huK2MFkj300qccT8OSuuoYhy_xEYujfPwiAxhPVz5WY&m=9sLhiql1kiKYdaC8Nx3dTASt89nXQA3uy4kwesnHIag&s=N_IOanbEYnXUTZ4ZO3vIjOeYun186kZGjXPKWp-Wi7k&e=
> ==============================================================================
> --- ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/concept/BsvConceptFactory.java
(original)
> +++ ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/
> +++ ctakes/dictionary/lookup2/concept/BsvConceptFactory.java Tue May  5
> +++ 22:41:26 2015
> @@ -1,5 +1,6 @@
> package org.apache.ctakes.dictionary.lookup2.concept;
> 
> +import org.apache.ctakes.core.resource.FileLocator;
> import org.apache.ctakes.dictionary.lookup2.util.CuiCodeUtil;
> import org.apache.ctakes.dictionary.lookup2.util.LookupUtil;
> import org.apache.ctakes.dictionary.lookup2.util.TuiCodeUtil;
> @@ -34,11 +35,12 @@ final public class BsvConceptFactory imp
>    }
> 
>    public BsvConceptFactory( final String name, final String bsvFilePath ) {
> -      this( name, new File( bsvFilePath ) );
> -   }
> -
> -   public BsvConceptFactory( final String name, final File bsvFile ) {
> -      final Collection<CuiTuiTerm> cuiTuiTerms = parseBsvFile( bsvFile );
> +//      this( name, new File( bsvFilePath ) );
> +//   }
> +//
> +//   public BsvConceptFactory( final String name, final File bsvFile ) {
> +//      final Collection<CuiTuiTerm> cuiTuiTerms = parseBsvFile( bsvFile );
> +      final Collection<CuiTuiTerm> cuiTuiTerms = parseBsvFile( 
> +bsvFilePath );
>       final Map<Long, Concept> conceptMap = new HashMap<>( cuiTuiTerms.size()
);
>       for ( CuiTuiTerm cuiTuiTerm : cuiTuiTerms ) {
>          final CollectionMap<ConceptCode, String, ? extends Collection<String>>
codes @@ -90,11 +92,21 @@ final public class BsvConceptFactory imp
>     * CUI|TUI|Text|PreferredTerm
>     * </p>
>     * If the TUI column is omitted then the entityId for the dictionary is used as the
TUI
> +    * <p/>
> +    * //    * @param bsvFile file containing term rows and bsv columns
>     *
> -    * @param bsvFile file containing term rows and bsv columns
> +    * @param bsvFilePath file containing term rows and bsv columns
>     * @return collection of all valid terms read from the bsv file
>     */
> -   static private Collection<CuiTuiTerm> parseBsvFile( final File bsvFile ) {
> +//   static private Collection<CuiTuiTerm> parseBsvFile( final File bsvFile )
{
> +   static private Collection<CuiTuiTerm> parseBsvFile( final String bsvFilePath
) {
> +      File bsvFile = null;
> +      try {
> +         bsvFile = FileLocator.locateFile( bsvFilePath );
> +      } catch ( IOException ioE ) {
> +         ioE.getMessage();
> +         return Collections.emptyList();
> +      }
>       final Collection<CuiTuiTerm> cuiTuiTerms = new ArrayList<>();
>       try ( final BufferedReader reader = new BufferedReader( new FileReader( bsvFile
) ) ) {
>          String line = reader.readLine();
> 
> Modified: ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/BsvRareWordDictionary.java
> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__svn.apache.org_viewvc_ctakes_trunk_ctakes-2Ddictionary-2Dlookup-2Dfast_src_main_java_org_apache_ctakes_dictionary_lookup2_dictionary_BsvRareWordDictionary.java-3Frev-3D1677903-26r1-3D1677902-26r2-3D1677903-26view-3Ddiff&d=BQICaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=huK2MFkj300qccT8OSuuoYhy_xEYujfPwiAxhPVz5WY&m=9sLhiql1kiKYdaC8Nx3dTASt89nXQA3uy4kwesnHIag&s=2mhfaak7geaJl8hCTk1LX9lWoSX7h9cRaSwYmnf6w0k&e=
> ==============================================================================
> --- ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/BsvRareWordDictionary.java
(original)
> +++ ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/
> +++ ctakes/dictionary/lookup2/dictionary/BsvRareWordDictionary.java Tue 
> +++ May  5 22:41:26 2015
> @@ -18,6 +18,7 @@
>  */
> package org.apache.ctakes.dictionary.lookup2.dictionary;
> 
> +import org.apache.ctakes.core.resource.FileLocator;
> import org.apache.ctakes.dictionary.lookup2.term.RareWordTerm;
> import org.apache.ctakes.dictionary.lookup2.util.FastLookupToken;
> import org.apache.ctakes.dictionary.lookup2.util.LookupUtil;
> @@ -31,6 +32,7 @@ import java.io.FileReader;  import java.io.IOException;  import java.util.ArrayList;
 import java.util.Collection;
> +import java.util.Collections;
> import java.util.Properties;
> 
> import static org.apache.ctakes.dictionary.lookup2.dictionary.RareWordTermMapCreator.CuiTerm;
> @@ -59,11 +61,12 @@ final public class BsvRareWordDictionary
> 
> 
>    public BsvRareWordDictionary( final String name, final String bsvFilePath ) {
> -      this( name, new File( bsvFilePath ) );
> -   }
> -
> -   public BsvRareWordDictionary( final String name, final File bsvFile ) {
> -      final Collection<CuiTerm> cuiTerms = parseBsvFile( bsvFile );
> +//      this( name, new File( bsvFilePath ) );
> +//   }
> +//
> +//   public BsvRareWordDictionary( final String name, final File bsvFile ) {
> +//      final Collection<CuiTerm> cuiTerms = parseBsvFile( bsvFile );
> +      final Collection<CuiTerm> cuiTerms = parseBsvFile( bsvFilePath );
>       final CollectionMap<String, RareWordTerm, ? extends Collection<RareWordTerm>>
rareWordTermMap
>             = RareWordTermMapCreator.createRareWordTermMap( cuiTerms );
>       _delegateDictionary = new MemRareWordDictionary( name, rareWordTermMap ); @@ -109,11
+112,21 @@ final public class BsvRareWordDictionary
>     * CUI|TUI|Text|PreferredTerm
>     * </p>
>     * If the TUI column is omitted then the entityId for the dictionary is used as the
TUI
> +    * <p/>
> +    * //    * @param bsvFile file containing term rows and bsv columns
>     *
> -    * @param bsvFile file containing term rows and bsv columns
> +    * @param bsvFilePath path to file containing term rows and bsv 
> + columns
>     * @return collection of all valid terms read from the bsv file
>     */
> -   static private Collection<CuiTerm> parseBsvFile( final File bsvFile ) {
> +//   static private Collection<CuiTerm> parseBsvFile( final File bsvFile ) {
> +   static private Collection<CuiTerm> parseBsvFile( final String bsvFilePath )
{
> +      File bsvFile = null;
> +      try {
> +         bsvFile = FileLocator.locateFile( bsvFilePath );
> +      } catch ( IOException ioE ) {
> +         ioE.getMessage();
> +         return Collections.emptyList();
> +      }
>       final Collection<CuiTerm> cuiTerms = new ArrayList<>();
>       try ( final BufferedReader reader = new BufferedReader( new FileReader( bsvFile
) ) ) {
>          String line = reader.readLine();
> 
> Modified: ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/JdbcConnectionFactory.java
> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__svn.apache.org_viewvc_ctakes_trunk_ctakes-2Ddictionary-2Dlookup-2Dfast_src_main_java_org_apache_ctakes_dictionary_lookup2_util_JdbcConnectionFactory.java-3Frev-3D1677903-26r1-3D1677902-26r2-3D1677903-26view-3Ddiff&d=BQICaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=huK2MFkj300qccT8OSuuoYhy_xEYujfPwiAxhPVz5WY&m=9sLhiql1kiKYdaC8Nx3dTASt89nXQA3uy4kwesnHIag&s=Zojydr1XQ2pr1l6pOrj2iBFd-7iR3__MBP6GNOBDIlQ&e=
> ==============================================================================
> --- ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/JdbcConnectionFactory.java
(original)
> +++ ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/
> +++ ctakes/dictionary/lookup2/util/JdbcConnectionFactory.java Tue May  5
> +++ 22:41:26 2015
> @@ -21,8 +21,6 @@ import java.util.*;
> public enum JdbcConnectionFactory {
>    INSTANCE;
> 
> -   static private final String CTAKES_HOME = "CTAKES_HOME";
> -
>    static final private Logger LOGGER = Logger.getLogger( "JdbcConnectionFactory" );
>    static final private Logger DOT_LOGGER = Logger.getLogger( "ProgressAppender" );
>    static final private Logger EOL_LOGGER = Logger.getLogger( "ProgressDone" );
> 
> 

Mime
View raw message