[slf4j-dev] svn commit: r1003 - in slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator: . internal line
ceki at slf4j.org
ceki at slf4j.org
Tue Apr 29 16:59:05 CEST 2008
Author: ceki
Date: Tue Apr 29 16:59:05 2008
New Revision: 1003
Modified:
slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/Constant.java
slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/RuleSetFactory.java
slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/internal/MigratorFrame.java
slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/line/JCLRuleSet.java
Log:
- added minimal support for JUL to SLF4J migration
Modified: slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/Constant.java
==============================================================================
--- slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/Constant.java (original)
+++ slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/Constant.java Tue Apr 29 16:59:05 2008
@@ -4,7 +4,8 @@
public final static int JCL_TO_SLF4J = 0;
public final static int LOG4J_TO_SLF4J = 1;
- public final static int NOP_TO_SLF4J = 2;
+ public final static int JUL_TO_SLF4J = 2;
+ public final static int NOP_TO_SLF4J = 3;
public final static int NB_FILES_MAX = 1;
Modified: slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/RuleSetFactory.java
==============================================================================
--- slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/RuleSetFactory.java (original)
+++ slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/RuleSetFactory.java Tue Apr 29 16:59:05 2008
@@ -2,6 +2,7 @@
import org.slf4j.migrator.line.EmptyRuleSet;
import org.slf4j.migrator.line.JCLRuleSet;
+import org.slf4j.migrator.line.JULRuleSet;
import org.slf4j.migrator.line.Log4jRuleSet;
import org.slf4j.migrator.line.RuleSet;
@@ -26,6 +27,8 @@
return new JCLRuleSet();
case Constant.LOG4J_TO_SLF4J:
return new Log4jRuleSet();
+ case Constant.JUL_TO_SLF4J:
+ return new JULRuleSet();
case Constant.NOP_TO_SLF4J:
return new EmptyRuleSet();
default:
Modified: slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/internal/MigratorFrame.java
==============================================================================
--- slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/internal/MigratorFrame.java (original)
+++ slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/internal/MigratorFrame.java Tue Apr 29 16:59:05 2008
@@ -76,6 +76,7 @@
private JRadioButton radioLog4j;
private JRadioButton radioJCL;
+ private JRadioButton radioJUL;
private ButtonGroup buttonGroup;
private JTextField folderTextField;
@@ -116,6 +117,7 @@
createMigrationLabel();
createRadioJCL();
createRadioLog4j();
+ createRadioJUL();
createButtonGroup();
createFolderLabel();
createFolderTextField();
@@ -148,7 +150,10 @@
-BASIC_PADDING / 2);
slh.placeBelow(radioJCL, radioLog4j, 0, 0);
- slh.placeBelow(migrationLabel, folderLabel, 0, BASIC_PADDING * 5);
+ slh.placeBelow(radioLog4j, radioJUL, 0, 0);
+
+
+ slh.placeBelow(migrationLabel, folderLabel, 0, BASIC_PADDING * 6);
slh.placeToTheRight(folderLabel, folderTextField);
slh.placeToTheRight(folderTextField, browseButton, BASIC_PADDING,
-BASIC_PADDING / 2);
@@ -169,7 +174,8 @@
getContentPane().add(migrationLabel);
getContentPane().add(radioJCL);
getContentPane().add(radioLog4j);
-
+ getContentPane().add(radioJUL);
+
getContentPane().add(folderLabel);
getContentPane().add(folderTextField);
getContentPane().add(browseButton);
@@ -188,6 +194,7 @@
buttonGroup = new ButtonGroup();
buttonGroup.add(radioJCL);
buttonGroup.add(radioLog4j);
+ buttonGroup.add(radioJUL);
}
private void createMigrationLabel() {
@@ -209,6 +216,12 @@
.setToolTipText("Select this button if you wish to migrate a Java project using log4j to use SLF4J.");
}
+ private void createRadioJUL() {
+ radioJUL = new JRadioButton();
+ radioJUL.setText("from JUL to SLF4J ");
+ radioJUL
+ .setToolTipText("Select this button if you wish to migrate a Java project using java.utl.logging (JUL) to use SLF4J.");
+ }
private void createFolderLabel() {
folderLabel = new JLabel();
folderLabel.setText("Project Directory");
@@ -302,6 +315,8 @@
conversionType = Constant.JCL_TO_SLF4J;
} else if (radioLog4j.isSelected()) {
conversionType = Constant.LOG4J_TO_SLF4J;
+ } else if (radioJUL.isSelected()) {
+ conversionType = Constant.JUL_TO_SLF4J;
} else {
// we cannot possibly reach here
throw new IllegalStateException("One of JCL or log4j project must have been previously chosen.");
@@ -328,9 +343,9 @@
List<String> doSanityAnalysis() {
List<String> errorList = new ArrayList<String>();
- if (!radioJCL.isSelected() && !radioLog4j.isSelected()) {
+ if (!radioJCL.isSelected() && !radioLog4j.isSelected() && !radioJUL.isSelected()) {
errorList
- .add("Please select the migration type (JCL to SLF4J or log4j to SLF4J)");
+ .add("Please select the migration type: JCL, log4j, or JUL to SLF4J.");
}
String folder = folderTextField.getText();
Modified: slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/line/JCLRuleSet.java
==============================================================================
--- slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/line/JCLRuleSet.java (original)
+++ slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/line/JCLRuleSet.java Tue Apr 29 16:59:05 2008
@@ -8,7 +8,7 @@
/**
* This class represents JCL to SLF4J conversion rules
*
- * @author jean-noelcharpin
+ * @author Jean-Noel Charpin
*
*/
public class JCLRuleSet implements RuleSet {
More information about the slf4j-dev
mailing list