Skip to content

Commit

Permalink
Rename MessageErrors class to Messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ryahiaoui authored and ryahiaoui committed Jan 3, 2017
1 parent 0cf14cf commit a988c80
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 42 deletions.
16 changes: 8 additions & 8 deletions src/main/java/org/inra/yedgen/graph/managers/GraphExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.inra.yedgen.graph.entities.Edge;
import org.inra.yedgen.processor.entities.Node;
import static java.util.stream.Collectors.toList;
import org.inra.yedgen.processor.errors.MessageErrors;
import org.inra.yedgen.processor.errors.Messages;

/**
*
Expand Down Expand Up @@ -502,7 +502,7 @@ else if ( jsonObject.getJSONObject("data").has("y:ArcEdge") ) {

}
else {
MessageErrors.printExtractionError() ;
Messages.printExtractionError() ;
}
}

Expand Down Expand Up @@ -547,7 +547,7 @@ else if(jsonObject.getJSONArray("data")
}
}
else {
MessageErrors.printNotFoundLabelError() ;
Messages.printNotFoundLabelError() ;
}

String id = jsonObject.getString("id") ;
Expand All @@ -562,7 +562,7 @@ else if(jsonObject.getJSONArray("data")

}
else {
MessageErrors.printExtractionError() ;
Messages.printExtractionError() ;
}
}
}
Expand All @@ -578,7 +578,7 @@ private void process( String pathFile ) throws IOException {
public void genGraphPopulatingManagers( String directory ,
String extensionFile ) throws Exception {

MessageErrors.printMessageExtractGraph( directory ) ;
Messages.printMessageExtractGraph( directory ) ;

boolean processed = false ;

Expand All @@ -588,7 +588,7 @@ public void genGraphPopulatingManagers( String directory ,

if(path.toString().endsWith(extensionFile )) {

MessageErrors.printMessageProcessingGraphFile( path.toAbsolutePath()
Messages.printMessageProcessingGraphFile( path.toAbsolutePath()
.toString()) ;

process(path.toString() ) ;
Expand All @@ -598,12 +598,12 @@ public void genGraphPopulatingManagers( String directory ,

if ( ! processed ) {

MessageErrors.printMessageFilesNotFoundExtentsion( directory,
Messages.printMessageFilesNotFoundExtentsion( directory,
extensionFile ) ;
System.exit ( 0 ) ;
}

MessageErrors.printSeparator();
Messages.printSeparator();
}

public Map<Integer, Map<Integer, String>> getMapUris() {
Expand Down
22 changes: 10 additions & 12 deletions src/main/java/org/inra/yedgen/processor/Processor.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.inra.yedgen.graph.managers.ManagerConcept;
import org.inra.yedgen.graph.managers.GraphExtractor;
import org.inra.yedgen.processor.managers.ManagerNode;
import org.inra.yedgen.processor.errors.MessageErrors;
import org.inra.yedgen.processor.errors.Messages;
import org.inra.yedgen.processor.factories.FactoryNode;
import org.inra.yedgen.processor.managers.ManagerQuery;
import org.inra.yedgen.processor.managers.ManagerVariable;
Expand Down Expand Up @@ -134,7 +134,7 @@ public boolean processFull ( String outputFile, String csvFile ) {

public boolean processOnlyGraphVariables ( String outputFile ) {

MessageErrors.printMessageStartProcessVariableGraphGeneration() ;
Messages.printMessageStartProcessVariableGraphGeneration() ;

for( Variable variable : managerVariable.getVariables()) {

Expand Down Expand Up @@ -163,7 +163,7 @@ public boolean processOnlyGraphVariables ( String outputFile ) {
Writer.checkFile( outFile ) ;
Writer.writeTextFile(outPut, outFile) ;

MessageErrors.printMessageInfoGeneratedVariable( variable.getVariableName() ,
Messages.printMessageInfoGeneratedVariable( variable.getVariableName() ,
outFile ) ;

} catch (IOException ex) {
Expand All @@ -177,10 +177,10 @@ public boolean processOnlyGraphVariables ( String outputFile ) {

public boolean processOnlyCSV ( String outputFile , String csvFile ) {

MessageErrors.printMessageStartProcessCsvVariableGeneration( csvFile ) ;
Messages.printMessageStartProcessCsvVariableGeneration( csvFile ) ;

if( ! Writer.existFile ( csvFile ) ) {
MessageErrors.printMessageErrorCSV ( csvFile) ;
Messages.printMessageErrorCSV ( csvFile) ;
return true ;
}

Expand All @@ -192,15 +192,13 @@ public boolean processOnlyCSV ( String outputFile , String csvFile ) {
pattVariable == null ||
pattParallel == null ) {

MessageErrors.printMessageMetaPatternsNull() ;
Messages.printMessageMetaPatternsNull() ;
return false ;
}

try {

Files.lines ( Paths.get(csvFile) ).skip(1).forEach (

(String line) -> {
Files.lines ( Paths.get(csvFile) ).skip(1).forEach ((String line) -> {

List<String> outPut = new ArrayList<>() ;

Expand Down Expand Up @@ -235,7 +233,7 @@ public boolean processOnlyCSV ( String outputFile , String csvFile ) {
Writer.checkFile( outFile ) ;
Writer.writeTextFile(outPut, outFile) ;

MessageErrors.printMessageInfoGeneratedVariable( variable.getVariableName() ,
Messages.printMessageInfoGeneratedVariable( variable.getVariableName() ,
outFile ) ;

} catch (IOException ex) {
Expand Down Expand Up @@ -284,7 +282,7 @@ public boolean processOnlyGraphWithoutVariables ( String outputFile ) {
Writer.checkFile( outFile ) ;
Writer.writeTextFile(outPut, outFile) ;

MessageErrors.printMessageInfoGeneratedVariable( "Undefined Variable" ,
Messages.printMessageInfoGeneratedVariable( "Undefined Variable" ,
outFile ) ;

} catch (IOException ex) {
Expand Down Expand Up @@ -326,7 +324,7 @@ private void checkMatchers( String variableName , String outLine ) {

for ( String patt : patts ) {
if ( patt.contains("?") )
MessageErrors.printErrorMatcher( variableName , patt ) ;
Messages.printErrorMatcher( variableName , patt ) ;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @author ryahiaoui
*/
public class MessageErrors {
public class Messages {

public static void printMessageErrorContext(String id_pattern) {
System.err.println("") ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.regex.Matcher;
import org.inra.yedgen.processor.entities.Node;
import org.inra.yedgen.graph.managers.GraphExtractor;
import org.inra.yedgen.processor.errors.MessageErrors;
import org.inra.yedgen.processor.errors.Messages;
import org.inra.yedgen.processor.factories.FactoryNode;

/**
Expand Down Expand Up @@ -62,7 +62,7 @@ public List<Node> genereatePatternContext( Integer hash, String id_pattern ) {
}
else if ( PATTERNS_CONTEXT.get(hash) == null ) {

MessageErrors.printMessageErrorContext(id_pattern) ;
Messages.printMessageErrorContext(id_pattern) ;
return nodes ;
}
else {
Expand All @@ -71,7 +71,7 @@ else if ( PATTERNS_CONTEXT.get(hash) == null ) {


if( pattern == null ) {
MessageErrors.printMessageErrorContext(id_pattern) ;
Messages.printMessageErrorContext(id_pattern) ;
return nodes ;
}

Expand Down Expand Up @@ -107,7 +107,7 @@ else if ( PATTERNS_CONTEXT.get(hash) == null ) {
String queryForSubject = managerQuery.getQuery( hash, numQuery ) ;

if( queryForSubject == null ) {
MessageErrors.printErrorNumQueryNotFound( numQuery );
Messages.printErrorNumQueryNotFound( numQuery );
}

String uriSubject = URI_PATTERN.replace(MATCHER_ENTITY , cleanName(entityName) ) ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.ArrayList;
import java.util.regex.Pattern;
import org.inra.yedgen.processor.entities.Node;
import org.inra.yedgen.processor.errors.MessageErrors;
import org.inra.yedgen.processor.errors.Messages;
import org.inra.yedgen.processor.factories.FactoryNode;

/**
Expand Down Expand Up @@ -71,15 +71,15 @@ public List<Node> genereatePatternParallel( Integer hashNode, String id_pattern
hash = findParallelPatternByID ( id_pattern ) ;

if( hash == null ) {
MessageErrors.printMessageErrorParallel( id_pattern ) ;
Messages.printMessageErrorParallel( id_pattern ) ;
return nodes ;
}

pattern = PATTERNS_PARALLEL.get(hash).get( id_pattern ) ;
}

if( pattern == null ) {
MessageErrors.printMessageErrorParallel(id_pattern) ;
Messages.printMessageErrorParallel(id_pattern) ;
return nodes ;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.inra.yedgen.processor.entities.Node;
import org.inra.yedgen.processor.entities.PatternParallel;
import org.inra.yedgen.processor.entities.Variable;
import org.inra.yedgen.processor.errors.MessageErrors;
import org.inra.yedgen.processor.errors.Messages;

/**
*
Expand Down Expand Up @@ -172,7 +172,7 @@ private Variable transformToVariable ( Integer hash ,
patternContextId != null
&& patternContext == null )

MessageErrors.printMessageErrorContext( patternContextId , variableName ) ;
Messages.printMessageErrorContext( patternContextId , variableName ) ;

return new Variable( hash ,
id ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.inra.yedgen.properties.CsvProperties;
import static org.inra.yedgen.processor.errors.MessageErrors.* ;
import static org.inra.yedgen.processor.errors.Messages.* ;
/**
*
* @author ryahiaoui
Expand Down Expand Up @@ -77,7 +77,7 @@ public String generatePatternVariable ( String csvLine ) {
.trim() ;
String[] nums = params.split("_") ;

List<String> tmp = new ArrayList<>();
List<String> tmp = new ArrayList<>() ;

for( int i = 1 ; i < nums.length ; i ++ ) {

Expand Down Expand Up @@ -110,12 +110,12 @@ public String generatePatternContext ( String csvLine ) {

int variablesColumnNum = Integer.parseInt( matcher.split(" ")[0].split("_COLUMN_")[1]) ;

String nums = matcher.split("Q_")[1] ;
int startQueryNum = Integer.parseInt(nums.split("_")[0]) ;
int middleQueryNum = Integer.parseInt(nums.split("_")[1]) ;
int endQueryNum = Integer.parseInt(nums.split("_")[2]) ;
String nums = matcher.split("Q_")[1] ;
int startQueryNum = Integer.parseInt(nums.split("_")[0]) ;
int middleQueryNum = Integer.parseInt(nums.split("_")[1]) ;
int endQueryNum = Integer.parseInt(nums.split("_")[2]) ;

int loop = startQueryNum ;
int loop = startQueryNum ;

if(csvLine.split(SEPARATOR)[variablesColumnNum].trim().length() == 0 ) return null ;

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/inra/yedgen/properties/CsvProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import org.inra.yedgen.processor.io.Writer;
import org.inra.yedgen.processor.errors.MessageErrors;
import org.inra.yedgen.processor.errors.Messages;
import org.apache.commons.configuration.Configuration;
import org.inra.yedgen.processor.scripts.ScriptsEngine;
import org.apache.commons.configuration.ConfigurationException;
Expand Down Expand Up @@ -59,19 +59,19 @@ public CsvProperties( String prFile, String jsFile ) {
try {
if ( Writer.existFile( jsFile ) ) {
this.scriptsEngine = new ScriptsEngine ( jsFile ) ;
MessageErrors.printLoadingFile( typeJs , jsFile ) ;
Messages.printLoadingFile( typeJs , jsFile ) ;
}
else if ( jsFile != null ) {
MessageErrors.printErrorLoadingFile( typeJs , jsFile) ;
Messages.printErrorLoadingFile( typeJs , jsFile) ;
}

if ( Writer.existFile( prFile ) ) {

this.config = new PropertiesConfiguration( prFile ) ;
MessageErrors.printLoadingFile( typeProperties , prFile ) ;
Messages.printLoadingFile( typeProperties , prFile ) ;
}
else if ( prFile != null ) {
MessageErrors.printErrorLoadingFile( typeProperties , prFile ) ;
Messages.printErrorLoadingFile( typeProperties , prFile ) ;
}

} catch (ConfigurationException ex) {
Expand Down

0 comments on commit a988c80

Please sign in to comment.