Skip to content

Commit

Permalink
Release RapidMiner 7.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Boeck committed May 2, 2017
1 parent 9f1dd1a commit 8abf59f
Show file tree
Hide file tree
Showing 286 changed files with 13,278 additions and 7,367 deletions.
15 changes: 11 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ dependencies {
compile 'com.rapidminer.studio:rapidminer-studio-osx-adapter:1.0.1'

// RapidMiner license framework for license management
compile 'com.rapidminer.license:rapidminer-license-api:3.1.0'
compile 'com.rapidminer.license:rapidminer-license-commons:3.2.0'
compile 'com.rapidminer.license:rapidminer-license-api:3.2.0'
compile 'com.rapidminer.license:rapidminer-license-commons:3.2.1'

// RapidMiner API
compile 'com.rapidminer:rapidminer-api:0.2.1'
Expand All @@ -33,7 +33,7 @@ dependencies {
compile 'com.rapidminer.external:alphanumeric-sorting:1.0.1'

// VLDocking as docking framework (https://code.google.com/p/vldocking/)
compile 'com.rapidminer.external:vldocking:1.1.1'
compile 'com.rapidminer.external:vldocking:1.2.0'

// Freehep for vector graphic export (http://java.freehep.org/)
compile('org.freehep:freehep-graphicsio-ps:2.3') {
Expand Down Expand Up @@ -77,7 +77,7 @@ dependencies {
compile 'javax.mail:mail:1.4.7'

// Groovy for 'Execute Script' operator (http://groovy.codehaus.org/)
compile 'org.codehaus.groovy:groovy-all:2.3.3'
compile 'org.codehaus.groovy:groovy-all:2.4.10'

// SwingX for various Swing components (https://swingx.java.net/)
compile 'org.swinglabs.swingx:swingx-all:1.6.5'
Expand Down Expand Up @@ -132,6 +132,13 @@ dependencies {
// Using this version manually to override the JRE fixes the problem. Otherwise all our operator documentation would not work at all
compile 'xalan:xalan:2.7.2'
compile 'xalan:serializer:2.7.2'

// H2 Database used for CTA
compile 'com.h2database:h2:1.4.194'

// up until 7.4.1 this was a transitive dependency coming from license-commons (jackson version 2.4.0)
compile 'com.fasterxml.jackson.core:jackson-core:2.8.8'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.8'
}

task wrapper(type: Wrapper) { gradleVersion = '2.14.1' }
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=7.4.0
version=7.5.0
group=com.rapidminer.studio
92 changes: 32 additions & 60 deletions src/main/java/com/rapidminer/MacroHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
*/
package com.rapidminer;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
Expand All @@ -45,20 +46,21 @@
*/
public class MacroHandler extends Observable {

private static final String PROCESS_NAME = "process_name";
private static final String PROCESS_FILE = "process_file";
private static final String PROCESS_PATH = "process_path";
public static final String PROCESS_NAME = "process_name";
public static final String PROCESS_FILE = "process_file";
public static final String PROCESS_PATH = "process_path";
public static final String PROCESS_START = "process_start";

/**
* Remaining problem is that predefined macros that are overridden by custom macros are
* evaluated first. The result is the predefined value.
*/
private static final String[] ALL_PREDEFINED_MACROS = { "process_name", "process_file", "process_path", "a",
private static final String[] ALL_PREDEFINED_MACROS = { PROCESS_NAME, PROCESS_FILE, PROCESS_PATH, PROCESS_START, "a",
"execution_count", "b", "c", "n", "operator_name", "t", "p[]", "v[]" };

/** all predefined macros that do not depend on an operator except for v[] */
private static final Set<String> PREDEFINED_OPERATOR_INDEPENDENT_MACROS = new HashSet<>(
Arrays.asList(new String[] { PROCESS_NAME, PROCESS_FILE, PROCESS_PATH, Operator.STRING_EXPANSION_MACRO_TIME }));
private static final Set<String> PREDEFINED_OPERATOR_INDEPENDENT_MACROS = new HashSet<>(Arrays.asList(
new String[] { PROCESS_NAME, PROCESS_FILE, PROCESS_PATH, PROCESS_START, Operator.STRING_EXPANSION_MACRO_TIME }));

/** all predefined macros that depend on an operator except for p[] */
private static final Set<String> PREDEFINED_OPERATOR_DEPENDENT_MACROS = new HashSet<>(
Expand All @@ -67,8 +69,8 @@ public class MacroHandler extends Observable {
Operator.STRING_EXPANSION_MACRO_OPERATORCLASS, Operator.STRING_EXPANSION_MACRO_NUMBER_APPLIED_TIMES,
Operator.STRING_EXPANSION_MACRO_NUMBER_APPLIED_TIMES_PLUS_ONE }));

private static final String[] ALL_USER_FRIENDLY_PREDEFINED_MACROS = { "process_name", "process_file", "process_path",
Operator.STRING_EXPANSION_MACRO_NUMBER_APPLIED_TIMES_USER_FRIENDLY,
private static final String[] ALL_USER_FRIENDLY_PREDEFINED_MACROS = { PROCESS_NAME, PROCESS_FILE, PROCESS_PATH,
PROCESS_START, Operator.STRING_EXPANSION_MACRO_NUMBER_APPLIED_TIMES_USER_FRIENDLY,
Operator.STRING_EXPANSION_MACRO_OPERATORNAME_USER_FRIENDLY };

private static final OperatorVersion THROW_ERROR_ON_UNDEFINED_MACRO = new OperatorVersion(6, 0, 3);
Expand All @@ -93,6 +95,21 @@ public class MacroHandler extends Observable {
.add(Operator.STRING_EXPANSION_MACRO_OPERATORVALUE + Operator.STRING_EXPANSION_MACRO_PARAMETER_START);
}

// ThreadLocal because DateFormat is NOT threadsafe and creating a new DateFormat is
// EXTREMELY expensive
/**
* Used for formatting the %{process_start} and current time %{t} macro
*/
private static final ThreadLocal<DateFormat> DATE_FORMAT = new ThreadLocal<DateFormat>() {

@Override
protected DateFormat initialValue() {
// clone because getDateInstance uses an internal pool which can return the same
// instance for multiple threads
return new SimpleDateFormat("yyyy_MM_dd-a_KK_mm_ss");
}
};

/**
* This HashSet contains the keys of macros which will be replaced while string expansion. Each
* macro item might have an arbitrary length.
Expand Down Expand Up @@ -211,10 +228,11 @@ public String getMacro(String macro) {
return process.getProcessLocation() != null ? process.getProcessLocation().getShortName() : null;
case PROCESS_PATH:
return process.getProcessLocation() != null ? process.getProcessLocation().toString() : null;
case PROCESS_START:
return macroMap.containsKey(macro) ? macroMap.get(macro)
: DATE_FORMAT.get().format(new Date(process.getRootOperator().getStartTime()));
case Operator.STRING_EXPANSION_MACRO_TIME:
StringBuffer buffer = new StringBuffer();
resolveTimeMacro(buffer);
return buffer.toString();
return DATE_FORMAT.get().format(new Date());
default:
return null;
}
Expand Down Expand Up @@ -374,7 +392,7 @@ public String resolvePredefinedMacros(String str, Operator operator) throws Unde
}
result.append(operator.getApplyCount() + number);
} else if (Operator.STRING_EXPANSION_MACRO_TIME.equals(command)) {
resolveTimeMacro(result);
result.append(DATE_FORMAT.get().format(new Date()));
} else if (command.startsWith(
Operator.STRING_EXPANSION_MACRO_OPERATORVALUE + Operator.STRING_EXPANSION_MACRO_PARAMETER_START)) {
int openNumberIndex = command.indexOf(Operator.STRING_EXPANSION_MACRO_PARAMETER_START);
Expand Down Expand Up @@ -430,52 +448,6 @@ public String resolvePredefinedMacros(String str, Operator operator) throws Unde
return result.toString();
}

/**
* Resolves the macro t by writing the current date and time in the result buffer.
*/
private void resolveTimeMacro(StringBuffer result) {
// Please note that Date and DateFormat cannot be used since Windows does not
// support the resulting file names
// TODO: Well, it can and should be used. Just use a custom SimpleDateFormat
Calendar calendar = new GregorianCalendar();
// year
result.append(calendar.get(Calendar.YEAR) + "_");
// month
String month = calendar.get(Calendar.MONTH) + 1 + "";
if (month.length() < 2) {
month = "0" + month;
}
result.append(month + "_");
// day
String day = calendar.get(Calendar.DAY_OF_MONTH) + "";
if (day.length() < 2) {
day = "0" + day;
}
result.append(day + "-");
// am - pm
int amPm = calendar.get(Calendar.AM_PM);
String amPmString = amPm == Calendar.AM ? "AM" : "PM";
result.append(amPmString + "_");
// hour
String hour = calendar.get(Calendar.HOUR) + "";
if (hour.length() < 2) {
hour = "0" + hour;
}
result.append(hour + "_");
// minute
String minute = calendar.get(Calendar.MINUTE) + "";
if (minute.length() < 2) {
minute = "0" + minute;
}
result.append(minute + "_");
// second
String second = calendar.get(Calendar.SECOND) + "";
if (second.length() < 2) {
second = "0" + second;
}
result.append(second);
}

/**
* <p>
* Resolves following predefined macros:
Expand Down

0 comments on commit 8abf59f

Please sign in to comment.