Loading de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/Analyzer.java +8 −6 Original line number Diff line number Diff line Loading @@ -20,11 +20,12 @@ import de.ugoe.cs.swe.validation.TTCN3StatisticsProvider; public class Analyzer implements Callable<TTCN3Output> { private final Resource resource; private final LoggingInterface logger; public static boolean printUnresolvedObjects = false; private RuntimeConfiguration runtime; public Analyzer(Resource resource, LoggingInterface logger) { public Analyzer(Resource resource, LoggingInterface logger, RuntimeConfiguration runtime) { this.resource = resource; this.logger = logger; this.runtime = runtime; } private TTCN3Output analyze() { Loading @@ -46,8 +47,9 @@ public class Analyzer implements Callable<TTCN3Output> { } } // TODO: make this configurable for debug purposes if (printUnresolvedObjects) { // pull up? // TODO: make this configurable for debug purposes -> also export to usage analyser? if (runtime.isLogUnresolved()) { for (Diagnostic d : this.resource.getErrors()) { TTCN3StatisticsProvider.getInstance().incrementCountUniversal(); logger.logInformation(this.resource.getURI(), d.getLine(), d.getLine(), MessageClass.UNIVERSAL, Loading de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/RuntimeConfiguration.java 0 → 100644 +32 −0 Original line number Diff line number Diff line package de.ugoe.cs.swe.T3Q; public class RuntimeConfiguration { private boolean logUnresolved = false; private boolean singleCore = false; private boolean batchResolve = false; public boolean isLogUnresolved() { return logUnresolved; } public void setLogUnresolved(boolean logUnresolved) { this.logUnresolved = logUnresolved; } public boolean isSingleCore() { return singleCore; } public void setSingleCore(boolean singleCore) { this.singleCore = singleCore; } public boolean isBatchResolve() { return batchResolve; } public void setBatchResolve(boolean batchResolve) { this.batchResolve = batchResolve; } } de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/T3Q.java +11 −27 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.GnuParser; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Option; import org.apache.commons.cli.ParseException; Loading @@ -37,6 +37,7 @@ public class T3Q { // set during automated server builds -> no longer displayed or used.. private static String buildStamp = "---BUILD_STAMP---"; public static QualityCheckProfile activeProfile = null; private RuntimeConfiguration runtime; private String configurationFilename; private String selectedProfileName = null; private static LogLevel logLevel = LogLevel.INFORMATION; Loading @@ -45,9 +46,7 @@ public class T3Q { private boolean generateNewConfiguration = false; private boolean generateLocalDependencies = false; private final Stopwatch stopwatch = Stopwatch.createUnstarted(); private boolean singleCore = false; private boolean analyzeUsage = false; private boolean batchResolve = false; // private boolean formattingEnabled = false; Loading Loading @@ -110,14 +109,11 @@ public class T3Q { LoggingInterface logger = new LoggingInterface(activeProfile.getLoggingConfiguration()); logger.setMaximumLogLevel(logLevel); TTCN3ResourceProvider resourceProvider = new TTCN3ResourceProvider(inputPaths, logger, activeProfile); TTCN3ResourceProvider resourceProvider = new TTCN3ResourceProvider(inputPaths, logger, activeProfile, runtime); TTCN3GlobalScopeProvider.LIVE = false; if (isSingleCore()) { if (runtime.isSingleCore()) { resourceProvider.setCores(1); } if (isBatchResolve()) { resourceProvider.setBatchResolve(true); } resourceProvider.loadResources(); //TODO: check if it has to be exclusive if (!this.isGenerateLocalDependencies() && !this.isAnalyzeUsage() ) { Loading Loading @@ -183,7 +179,7 @@ public class T3Q { } private CommandLine parseCommandLineArguments(String[] args) { CommandLineParser parser = new GnuParser(); CommandLineParser parser = new DefaultParser(); T3QOptionsHandler optionsHandler = new T3QOptionsHandler(); CommandLine commandLine = null; try { Loading Loading @@ -211,10 +207,13 @@ public class T3Q { this.setSelectedProfileName(commandLine.getOptionValue("profile")); } if (commandLine.hasOption("single-core")) { this.setSingleCore(true); runtime.setSingleCore(true); } if (commandLine.hasOption("log-unresolved")) { runtime.setLogUnresolved(true); } if (commandLine.hasOption("batch-resolve")) { this.setBatchResolve(true); runtime.setBatchResolve(true); } if (commandLine.hasOption("analyze-usage")) { this.setAnalyzeUsage(true); Loading Loading @@ -299,7 +298,7 @@ public class T3Q { if (!l.toString().equals("FIXME") && !l.toString().equals("DEBUG")) possibleValues += l.toString() + ", "; FileParser.printParsingErrors = true; Analyzer.printUnresolvedObjects = true; runtime.setLogUnresolved(true); } if (!selected) { System.out.println("\nERROR: No valid log level provided! Possible values are (in ascending inclusive order): " Loading Loading @@ -446,14 +445,6 @@ public class T3Q { this.generateLocalDependencies = generateLocalDependencies; } public boolean isSingleCore() { return singleCore; } public void setSingleCore(boolean singleCore) { this.singleCore = singleCore; } public boolean isAnalyzeUsage() { return analyzeUsage; } Loading @@ -462,11 +453,4 @@ public class T3Q { this.analyzeUsage = analyzeUsage; } public boolean isBatchResolve() { return batchResolve; } public void setBatchResolve(boolean batchResolve) { this.batchResolve = batchResolve; } } de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/TTCN3ResourceProvider.java +12 −18 Original line number Diff line number Diff line Loading @@ -52,8 +52,8 @@ public class TTCN3ResourceProvider { private ArrayList<String> paths; private LoggingInterface logger; private QualityCheckProfile activeProfile; private RuntimeConfiguration runtime; private int cores = Runtime.getRuntime().availableProcessors(); private boolean batchResolve = false; @Inject private IQualifiedNameProvider qualifiedNameProvider; Loading @@ -61,11 +61,16 @@ public class TTCN3ResourceProvider { private final Stopwatch stopwatch = Stopwatch.createUnstarted(); public TTCN3ResourceProvider(final ArrayList<String> paths, LoggingInterface logger, QualityCheckProfile activeProfile) { LoggingInterface logger, QualityCheckProfile activeProfile, RuntimeConfiguration runtime) { super(); this.paths = paths; this.logger = logger; this.activeProfile = activeProfile; this.runtime = runtime; if (runtime.isSingleCore()) { this.cores = 1; } } public void loadResources() { Loading @@ -76,6 +81,7 @@ public class TTCN3ResourceProvider { stopwatch.start(); ExecutorService pool = Executors.newFixedThreadPool(getCores()); ArrayList<FileParser> parser = new ArrayList<FileParser>(); Loading Loading @@ -130,7 +136,7 @@ public class TTCN3ResourceProvider { stopwatch.reset(); if (isBatchResolve()) { if (runtime.isBatchResolve()) { stopwatch.start(); Loading Loading @@ -190,7 +196,7 @@ public class TTCN3ResourceProvider { Resource resource = TTCN3GlobalScopeProvider.RESOURCES.get(i); matcher = pattern.matcher(resource.getURI().toFileString()); if(!matcher.matches()) { analyzer.add(new Analyzer(TTCN3GlobalScopeProvider.RESOURCES.get(i), logger)); analyzer.add(new Analyzer(TTCN3GlobalScopeProvider.RESOURCES.get(i), logger, runtime)); } } try { Loading Loading @@ -475,19 +481,7 @@ public class TTCN3ResourceProvider { } } public int getCores() { private int getCores() { return cores; } public void setCores(int cores) { this.cores = cores; } public boolean isBatchResolve() { return batchResolve; } public void setBatchResolve(boolean batchResolve) { this.batchResolve = batchResolve; } } Loading
de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/Analyzer.java +8 −6 Original line number Diff line number Diff line Loading @@ -20,11 +20,12 @@ import de.ugoe.cs.swe.validation.TTCN3StatisticsProvider; public class Analyzer implements Callable<TTCN3Output> { private final Resource resource; private final LoggingInterface logger; public static boolean printUnresolvedObjects = false; private RuntimeConfiguration runtime; public Analyzer(Resource resource, LoggingInterface logger) { public Analyzer(Resource resource, LoggingInterface logger, RuntimeConfiguration runtime) { this.resource = resource; this.logger = logger; this.runtime = runtime; } private TTCN3Output analyze() { Loading @@ -46,8 +47,9 @@ public class Analyzer implements Callable<TTCN3Output> { } } // TODO: make this configurable for debug purposes if (printUnresolvedObjects) { // pull up? // TODO: make this configurable for debug purposes -> also export to usage analyser? if (runtime.isLogUnresolved()) { for (Diagnostic d : this.resource.getErrors()) { TTCN3StatisticsProvider.getInstance().incrementCountUniversal(); logger.logInformation(this.resource.getURI(), d.getLine(), d.getLine(), MessageClass.UNIVERSAL, Loading
de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/RuntimeConfiguration.java 0 → 100644 +32 −0 Original line number Diff line number Diff line package de.ugoe.cs.swe.T3Q; public class RuntimeConfiguration { private boolean logUnresolved = false; private boolean singleCore = false; private boolean batchResolve = false; public boolean isLogUnresolved() { return logUnresolved; } public void setLogUnresolved(boolean logUnresolved) { this.logUnresolved = logUnresolved; } public boolean isSingleCore() { return singleCore; } public void setSingleCore(boolean singleCore) { this.singleCore = singleCore; } public boolean isBatchResolve() { return batchResolve; } public void setBatchResolve(boolean batchResolve) { this.batchResolve = batchResolve; } }
de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/T3Q.java +11 −27 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.GnuParser; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Option; import org.apache.commons.cli.ParseException; Loading @@ -37,6 +37,7 @@ public class T3Q { // set during automated server builds -> no longer displayed or used.. private static String buildStamp = "---BUILD_STAMP---"; public static QualityCheckProfile activeProfile = null; private RuntimeConfiguration runtime; private String configurationFilename; private String selectedProfileName = null; private static LogLevel logLevel = LogLevel.INFORMATION; Loading @@ -45,9 +46,7 @@ public class T3Q { private boolean generateNewConfiguration = false; private boolean generateLocalDependencies = false; private final Stopwatch stopwatch = Stopwatch.createUnstarted(); private boolean singleCore = false; private boolean analyzeUsage = false; private boolean batchResolve = false; // private boolean formattingEnabled = false; Loading Loading @@ -110,14 +109,11 @@ public class T3Q { LoggingInterface logger = new LoggingInterface(activeProfile.getLoggingConfiguration()); logger.setMaximumLogLevel(logLevel); TTCN3ResourceProvider resourceProvider = new TTCN3ResourceProvider(inputPaths, logger, activeProfile); TTCN3ResourceProvider resourceProvider = new TTCN3ResourceProvider(inputPaths, logger, activeProfile, runtime); TTCN3GlobalScopeProvider.LIVE = false; if (isSingleCore()) { if (runtime.isSingleCore()) { resourceProvider.setCores(1); } if (isBatchResolve()) { resourceProvider.setBatchResolve(true); } resourceProvider.loadResources(); //TODO: check if it has to be exclusive if (!this.isGenerateLocalDependencies() && !this.isAnalyzeUsage() ) { Loading Loading @@ -183,7 +179,7 @@ public class T3Q { } private CommandLine parseCommandLineArguments(String[] args) { CommandLineParser parser = new GnuParser(); CommandLineParser parser = new DefaultParser(); T3QOptionsHandler optionsHandler = new T3QOptionsHandler(); CommandLine commandLine = null; try { Loading Loading @@ -211,10 +207,13 @@ public class T3Q { this.setSelectedProfileName(commandLine.getOptionValue("profile")); } if (commandLine.hasOption("single-core")) { this.setSingleCore(true); runtime.setSingleCore(true); } if (commandLine.hasOption("log-unresolved")) { runtime.setLogUnresolved(true); } if (commandLine.hasOption("batch-resolve")) { this.setBatchResolve(true); runtime.setBatchResolve(true); } if (commandLine.hasOption("analyze-usage")) { this.setAnalyzeUsage(true); Loading Loading @@ -299,7 +298,7 @@ public class T3Q { if (!l.toString().equals("FIXME") && !l.toString().equals("DEBUG")) possibleValues += l.toString() + ", "; FileParser.printParsingErrors = true; Analyzer.printUnresolvedObjects = true; runtime.setLogUnresolved(true); } if (!selected) { System.out.println("\nERROR: No valid log level provided! Possible values are (in ascending inclusive order): " Loading Loading @@ -446,14 +445,6 @@ public class T3Q { this.generateLocalDependencies = generateLocalDependencies; } public boolean isSingleCore() { return singleCore; } public void setSingleCore(boolean singleCore) { this.singleCore = singleCore; } public boolean isAnalyzeUsage() { return analyzeUsage; } Loading @@ -462,11 +453,4 @@ public class T3Q { this.analyzeUsage = analyzeUsage; } public boolean isBatchResolve() { return batchResolve; } public void setBatchResolve(boolean batchResolve) { this.batchResolve = batchResolve; } }
de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/TTCN3ResourceProvider.java +12 −18 Original line number Diff line number Diff line Loading @@ -52,8 +52,8 @@ public class TTCN3ResourceProvider { private ArrayList<String> paths; private LoggingInterface logger; private QualityCheckProfile activeProfile; private RuntimeConfiguration runtime; private int cores = Runtime.getRuntime().availableProcessors(); private boolean batchResolve = false; @Inject private IQualifiedNameProvider qualifiedNameProvider; Loading @@ -61,11 +61,16 @@ public class TTCN3ResourceProvider { private final Stopwatch stopwatch = Stopwatch.createUnstarted(); public TTCN3ResourceProvider(final ArrayList<String> paths, LoggingInterface logger, QualityCheckProfile activeProfile) { LoggingInterface logger, QualityCheckProfile activeProfile, RuntimeConfiguration runtime) { super(); this.paths = paths; this.logger = logger; this.activeProfile = activeProfile; this.runtime = runtime; if (runtime.isSingleCore()) { this.cores = 1; } } public void loadResources() { Loading @@ -76,6 +81,7 @@ public class TTCN3ResourceProvider { stopwatch.start(); ExecutorService pool = Executors.newFixedThreadPool(getCores()); ArrayList<FileParser> parser = new ArrayList<FileParser>(); Loading Loading @@ -130,7 +136,7 @@ public class TTCN3ResourceProvider { stopwatch.reset(); if (isBatchResolve()) { if (runtime.isBatchResolve()) { stopwatch.start(); Loading Loading @@ -190,7 +196,7 @@ public class TTCN3ResourceProvider { Resource resource = TTCN3GlobalScopeProvider.RESOURCES.get(i); matcher = pattern.matcher(resource.getURI().toFileString()); if(!matcher.matches()) { analyzer.add(new Analyzer(TTCN3GlobalScopeProvider.RESOURCES.get(i), logger)); analyzer.add(new Analyzer(TTCN3GlobalScopeProvider.RESOURCES.get(i), logger, runtime)); } } try { Loading Loading @@ -475,19 +481,7 @@ public class TTCN3ResourceProvider { } } public int getCores() { private int getCores() { return cores; } public void setCores(int cores) { this.cores = cores; } public boolean isBatchResolve() { return batchResolve; } public void setBatchResolve(boolean batchResolve) { this.batchResolve = batchResolve; } }