Skip to content

Commit 46fbe63

Browse files
author
mcasters
committed
PDI-2135 : Get rid of Messages classes
git-svn-id: svn://source.pentaho.org/svnkettleroot/Kettle/trunk@10588 5fb7f6ec-07c1-534a-b4ca-9155e429e800
1 parent 2ab2610 commit 46fbe63

File tree

317 files changed

+8679
-14481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

317 files changed

+8679
-14481
lines changed

src-core/org/pentaho/di/compatibility/Messages.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

src-core/org/pentaho/di/compatibility/Row.java

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,26 @@
1111

1212
package org.pentaho.di.compatibility;
1313

14-
import java.io.ByteArrayInputStream;
15-
import java.io.ByteArrayOutputStream;
16-
import java.io.DataInputStream;
17-
import java.io.DataOutputStream;
18-
import java.io.EOFException;
19-
import java.io.IOException;
20-
import java.io.Serializable;
21-
import java.util.ArrayList;
22-
import java.util.Collections;
23-
import java.util.Comparator;
24-
import java.util.Date;
25-
import java.util.List;
26-
27-
import org.pentaho.di.core.Const;
28-
import org.pentaho.di.core.exception.KettleEOFException;
29-
import org.pentaho.di.core.exception.KettleFileException;
30-
import org.pentaho.di.core.xml.XMLHandler;
31-
import org.pentaho.di.core.xml.XMLInterface;
32-
import org.w3c.dom.Node;
14+
import java.io.ByteArrayInputStream;
15+
import java.io.ByteArrayOutputStream;
16+
import java.io.DataInputStream;
17+
import java.io.DataOutputStream;
18+
import java.io.EOFException;
19+
import java.io.IOException;
20+
import java.io.Serializable;
21+
import java.util.ArrayList;
22+
import java.util.Collections;
23+
import java.util.Comparator;
24+
import java.util.Date;
25+
import java.util.List;
26+
27+
import org.pentaho.di.core.Const;
28+
import org.pentaho.di.core.exception.KettleEOFException;
29+
import org.pentaho.di.core.exception.KettleFileException;
30+
import org.pentaho.di.core.xml.XMLHandler;
31+
import org.pentaho.di.core.xml.XMLInterface;
32+
import org.pentaho.di.i18n.BaseMessages;
33+
import org.w3c.dom.Node;
3334

3435

3536

@@ -46,7 +47,9 @@
4647
*
4748
*/
4849
public class Row implements XMLInterface, Comparable<Row>, Serializable
49-
{
50+
{
51+
private static Class<?> PKG = Row.class; // for i18n purposes, needed by Translator2!! $NON-NLS-1$
52+
5053
public static final String XML_TAG = "row"; //$NON-NLS-1$
5154

5255
private final List<Value> list = new ArrayList<Value>();
@@ -465,7 +468,7 @@ public void write(DataOutputStream dos) throws KettleFileException
465468
}
466469
catch(Exception e)
467470
{
468-
throw new KettleFileException(Messages.getString("Row.ErrorWritingRow"), e); //$NON-NLS-1$
471+
throw new KettleFileException(BaseMessages.getString(PKG, "Row.ErrorWritingRow"), e); //$NON-NLS-1$
469472
}
470473
}
471474

@@ -496,11 +499,11 @@ public Row(DataInputStream dis) throws KettleFileException
496499
}
497500
catch(EOFException e)
498501
{
499-
throw new KettleEOFException(Messages.getString("Row.EndOfFileReached"), e); //$NON-NLS-1$
502+
throw new KettleEOFException(BaseMessages.getString(PKG, "Row.EndOfFileReached"), e); //$NON-NLS-1$
500503
}
501504
catch(Exception e)
502505
{
503-
throw new KettleFileException(Messages.getString("Row.ErrorReadingRowData"), e); //$NON-NLS-1$
506+
throw new KettleFileException(BaseMessages.getString(PKG, "Row.ErrorReadingRowData"), e); //$NON-NLS-1$
504507
}
505508
}
506509

@@ -536,11 +539,11 @@ public Row(DataInputStream dis, int size, Row meta) throws KettleFileException
536539
}
537540
catch(KettleEOFException e)
538541
{
539-
throw new KettleEOFException(Messages.getString("Row.EndOfFileReadingRow"), e); //$NON-NLS-1$
542+
throw new KettleEOFException(BaseMessages.getString(PKG, "Row.EndOfFileReadingRow"), e); //$NON-NLS-1$
540543
}
541544
catch(Exception e)
542545
{
543-
throw new KettleFileException(Messages.getString("Row.RowError"),e); //$NON-NLS-1$
546+
throw new KettleFileException(BaseMessages.getString(PKG, "Row.RowError"),e); //$NON-NLS-1$
544547
}
545548
}
546549

@@ -951,7 +954,7 @@ public static final byte[] extractData(Row row)
951954
}
952955
catch(Exception e)
953956
{
954-
throw new RuntimeException(Messages.getString("Row.ErrorSerializing")+row, e); //$NON-NLS-1$
957+
throw new RuntimeException(BaseMessages.getString(PKG, "Row.ErrorSerializing")+row, e); //$NON-NLS-1$
955958
}
956959
}
957960

@@ -965,7 +968,7 @@ public static final Row getRow(byte[] data, Row metadata)
965968
}
966969
catch(Exception e)
967970
{
968-
throw new RuntimeException(Messages.getString("Row.ErrorDeserializing"), e); //$NON-NLS-1$
971+
throw new RuntimeException(BaseMessages.getString(PKG, "Row.ErrorDeserializing"), e); //$NON-NLS-1$
969972
}
970973
}
971974

src-core/org/pentaho/di/core/CheckResult.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* the license for the specific language governing your rights and limitations.*/
1111

1212
package org.pentaho.di.core;
13+
14+
import org.pentaho.di.i18n.BaseMessages;
1315

1416

1517
/**
@@ -20,8 +22,17 @@
2022
*
2123
*/
2224
public class CheckResult implements CheckResultInterface
23-
{
24-
25+
{
26+
private static Class<?> PKG = Const.class; // for i18n purposes, needed by Translator2!! $NON-NLS-1$
27+
28+
public static final String typeDesc[] = {
29+
"", //$NON-NLS-1$
30+
BaseMessages.getString(PKG, "CheckResult.OK"), //$NON-NLS-1$
31+
BaseMessages.getString(PKG, "CheckResult.Remark"), //$NON-NLS-1$
32+
BaseMessages.getString(PKG, "CheckResult.Warning"), //$NON-NLS-1$
33+
BaseMessages.getString(PKG, "CheckResult.Error") //$NON-NLS-1$
34+
};
35+
2536
private int type;
2637

2738
private String text;
@@ -58,7 +69,7 @@ public int getType()
5869

5970
public String getTypeDesc()
6071
{
61-
return CheckResultInterface.typeDesc[type];
72+
return typeDesc[type];
6273
}
6374

6475
public String getText()
@@ -74,7 +85,7 @@ public CheckResultSourceInterface getSourceInfo()
7485
public String toString()
7586
{
7687
StringBuffer sb = new StringBuffer();
77-
sb.append(CheckResultInterface.typeDesc[type]).append(": ").append(text); //$NON-NLS-1$
88+
sb.append(typeDesc[type]).append(": ").append(text); //$NON-NLS-1$
7889

7990
if (sourceMeta != null)
8091
sb.append(" (").append(sourceMeta.getName()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$

src-core/org/pentaho/di/core/CheckResultInterface.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313
package org.pentaho.di.core;
1414

15+
1516
public interface CheckResultInterface {
1617

1718
public static final int TYPE_RESULT_NONE = 0;
@@ -24,14 +25,6 @@ public interface CheckResultInterface {
2425

2526
public static final int TYPE_RESULT_ERROR = 4;
2627

27-
public static final String typeDesc[] = {
28-
"", //$NON-NLS-1$
29-
Messages.getString("CheckResult.OK"), //$NON-NLS-1$
30-
Messages.getString("CheckResult.Remark"), //$NON-NLS-1$
31-
Messages.getString("CheckResult.Warning"), //$NON-NLS-1$
32-
Messages.getString("CheckResult.Error") //$NON-NLS-1$
33-
};
34-
3528
/**
3629
* @return The type of the Check Result (0-4)
3730
*/

src-core/org/pentaho/di/core/Const.java

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838

3939
import org.pentaho.di.core.exception.KettleException;
4040
import org.pentaho.di.core.row.ValueMetaInterface;
41+
import org.pentaho.di.i18n.BaseMessages;
4142
import org.pentaho.di.laf.BasePropertyHandler;
43+
import org.pentaho.di.trans.steps.csvinput.CsvInputMeta;
4244

4345
/**
4446
* This class is used to define a number of default values for various settings throughout Kettle.
@@ -49,7 +51,9 @@
4951
*
5052
*/
5153
public class Const
52-
{
54+
{
55+
private static Class<?> PKG = Const.class; // for i18n purposes, needed by Translator2!! $NON-NLS-1$
56+
5357
/**
5458
* Version number
5559
*/
@@ -1724,10 +1728,10 @@ public static String[] getTips()
17241728
{
17251729
if (tips == null)
17261730
{
1727-
int tipsOfDayCount = toInt(Messages.getString("Const.TipOfDay.Count"), 0);
1731+
int tipsOfDayCount = toInt(BaseMessages.getString(PKG, "Const.TipOfDay.Count"), 0);
17281732
tips = new String[tipsOfDayCount];
17291733
for (int i = 1; i <= tipsOfDayCount; i++)
1730-
tips[i - 1] = Messages.getString("Const.TipOfDay" + Integer.toString(i));
1734+
tips[i - 1] = BaseMessages.getString(PKG, "Const.TipOfDay" + Integer.toString(i));
17311735
}
17321736

17331737
return tips;
@@ -1742,10 +1746,10 @@ public static String[] getDateFormats()
17421746
{
17431747
if (dateFormats == null)
17441748
{
1745-
int dateFormatsCount = toInt(Messages.getString("Const.DateFormat.Count"), 0);
1749+
int dateFormatsCount = toInt(BaseMessages.getString(PKG, "Const.DateFormat.Count"), 0);
17461750
dateFormats = new String[dateFormatsCount];
17471751
for (int i = 1; i <= dateFormatsCount; i++)
1748-
dateFormats[i - 1] = Messages.getString("Const.DateFormat" + Integer.toString(i));
1752+
dateFormats[i - 1] = BaseMessages.getString(PKG, "Const.DateFormat" + Integer.toString(i));
17491753
}
17501754
return dateFormats;
17511755
}
@@ -1759,11 +1763,11 @@ public static String[] getNumberFormats()
17591763
{
17601764
if (numberFormats == null)
17611765
{
1762-
int numberFormatsCount = toInt(Messages.getString("Const.NumberFormat.Count"), 0);
1766+
int numberFormatsCount = toInt(BaseMessages.getString(PKG, "Const.NumberFormat.Count"), 0);
17631767
numberFormats = new String[numberFormatsCount + 1];
17641768
numberFormats[0] = DEFAULT_NUMBER_FORMAT;
17651769
for (int i = 1; i <= numberFormatsCount; i++)
1766-
numberFormats[i] = Messages.getString("Const.NumberFormat" + Integer.toString(i));
1770+
numberFormats[i] = BaseMessages.getString(PKG, "Const.NumberFormat" + Integer.toString(i));
17671771
}
17681772
return numberFormats;
17691773
}
@@ -1773,11 +1777,11 @@ public static String[] getTransformationAndJobFilterNames()
17731777
if (STRING_TRANS_AND_JOB_FILTER_NAMES == null)
17741778
{
17751779
STRING_TRANS_AND_JOB_FILTER_NAMES = new String[] {
1776-
Messages.getString("Const.FileFilter.TransformationJob"),
1777-
Messages.getString("Const.FileFilter.Transformations"),
1778-
Messages.getString("Const.FileFilter.Jobs"),
1779-
Messages.getString("Const.FileFilter.XML"),
1780-
Messages.getString("Const.FileFilter.All")
1780+
BaseMessages.getString(PKG, "Const.FileFilter.TransformationJob"),
1781+
BaseMessages.getString(PKG, "Const.FileFilter.Transformations"),
1782+
BaseMessages.getString(PKG, "Const.FileFilter.Jobs"),
1783+
BaseMessages.getString(PKG, "Const.FileFilter.XML"),
1784+
BaseMessages.getString(PKG, "Const.FileFilter.All")
17811785
};
17821786
}
17831787
return STRING_TRANS_AND_JOB_FILTER_NAMES;
@@ -1788,9 +1792,9 @@ public static String[] getTransformationFilterNames()
17881792
if (STRING_TRANS_FILTER_NAMES == null)
17891793
{
17901794
STRING_TRANS_FILTER_NAMES = new String[] {
1791-
Messages.getString("Const.FileFilter.Transformations"),
1792-
Messages.getString("Const.FileFilter.XML"),
1793-
Messages.getString("Const.FileFilter.All")
1795+
BaseMessages.getString(PKG, "Const.FileFilter.Transformations"),
1796+
BaseMessages.getString(PKG, "Const.FileFilter.XML"),
1797+
BaseMessages.getString(PKG, "Const.FileFilter.All")
17941798
};
17951799
}
17961800
return STRING_TRANS_FILTER_NAMES;
@@ -1801,9 +1805,9 @@ public static String[] getJobFilterNames()
18011805
if (STRING_JOB_FILTER_NAMES == null)
18021806
{
18031807
STRING_JOB_FILTER_NAMES = new String[] {
1804-
Messages.getString("Const.FileFilter.Jobs"),
1805-
Messages.getString("Const.FileFilter.XML"),
1806-
Messages.getString("Const.FileFilter.All")
1808+
BaseMessages.getString(PKG, "Const.FileFilter.Jobs"),
1809+
BaseMessages.getString(PKG, "Const.FileFilter.XML"),
1810+
BaseMessages.getString(PKG, "Const.FileFilter.All")
18071811
};
18081812
}
18091813
return STRING_JOB_FILTER_NAMES;
@@ -2110,5 +2114,16 @@ public static int getOccurenceString (String string, String searchFor)
21102114
}
21112115
}
21122116
return counter;
2117+
}
2118+
2119+
/**
2120+
* Determines the package name of a class, specifically for i18n purposes.
2121+
* This method is scanned for by Translator2 : DO NOT RENAME OR REFACTOR.
2122+
*
2123+
* @param class1
2124+
* @return
2125+
*/
2126+
public static String getPackageName(Class<CsvInputMeta> clazz) {
2127+
return clazz.getPackage().getName();
21132128
}
21142129
}

0 commit comments

Comments
 (0)