本文整理汇总了Java中org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta类的典型用法代码示例。如果您正苦于以下问题:Java TextFileInputMeta类的具体用法?Java TextFileInputMeta怎么用?Java TextFileInputMeta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextFileInputMeta类属于org.pentaho.di.trans.steps.textfileinput包,在下文中一共展示了TextFileInputMeta类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showFiles
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
private void showFiles()
{
TextFileInputMeta tfii = new TextFileInputMeta();
getInfo(tfii);
String files[] = tfii.getFilePaths(transMeta);
if (files!=null && files.length>0)
{
EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, "Files read", "Files read:");
esd.setViewOnly();
esd.open();
}
else
{
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR );
mb.setMessage(Messages.getString("TextFileInputDialog.NoFilesFound.DialogMessage"));
mb.setText(Messages.getString("System.Dialog.Error.Title"));
mb.open();
}
}
示例2: showFiles
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
private void showFiles()
{
TextFileInputMeta tfii = new TextFileInputMeta();
getInfo(tfii);
String files[] = tfii.getFilePaths(transMeta);
if (files!=null && files.length>0)
{
EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, "Files read", "Files read:");
esd.setViewOnly();
esd.open();
}
else
{
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR );
mb.setMessage(BaseMessages.getString(PKG, "TextFileInputDialog.NoFilesFound.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
mb.open();
}
}
示例3: readFieldNamesFromFile
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
String[] readFieldNamesFromFile( String fileName, CsvInputMeta csvInputMeta ) throws KettleException {
String delimiter = environmentSubstitute( csvInputMeta.getDelimiter() );
String enclosure = environmentSubstitute( csvInputMeta.getEnclosure() );
String realEncoding = environmentSubstitute( csvInputMeta.getEncoding() );
try ( FileObject fileObject = KettleVFS.getFileObject( fileName, getTransMeta() );
BOMInputStream inputStream =
new BOMInputStream( KettleVFS.getInputStream( fileObject ), ByteOrderMark.UTF_8, ByteOrderMark.UTF_16LE,
ByteOrderMark.UTF_16BE ) ) {
InputStreamReader reader = null;
if ( Utils.isEmpty( realEncoding ) ) {
reader = new InputStreamReader( inputStream );
} else {
reader = new InputStreamReader( inputStream, realEncoding );
}
EncodingType encodingType = EncodingType.guessEncodingType( reader.getEncoding() );
String line =
TextFileInput.getLine( log, reader, encodingType, TextFileInputMeta.FILE_FORMAT_UNIX, new StringBuilder(
1000 ) );
String[] fieldNames =
CsvInput.guessStringsFromLine( log, line, delimiter, enclosure, csvInputMeta.getEscapeCharacter() );
if ( !Utils.isEmpty( csvInputMeta.getEnclosure() ) ) {
removeEnclosure( fieldNames, csvInputMeta.getEnclosure() );
}
trimFieldNames( fieldNames );
return fieldNames;
} catch ( IOException e ) {
throw new KettleFileException( BaseMessages.getString( PKG, "CsvInput.Exception.CreateFieldMappingError" ), e );
}
}
示例4: showFiles
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
private void showFiles() {
TextFileInputMeta tfii = new TextFileInputMeta();
getInfo( tfii );
String[] files = tfii.getFilePaths( transMeta );
if ( files != null && files.length > 0 ) {
EnterSelectionDialog esd = new EnterSelectionDialog( shell, files, "Files read", "Files read:" );
esd.setViewOnly();
esd.open();
} else {
MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
mb.setMessage( BaseMessages.getString( PKG, "TextFileInputDialog.NoFilesFound.DialogMessage" ) );
mb.setText( BaseMessages.getString( PKG, "System.Dialog.Error.Title" ) );
mb.open();
}
}
示例5: getFileFormatTypeNr
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
public int getFileFormatTypeNr() {
return TextFileInputMeta.FILE_FORMAT_MIXED;
}
示例6: getFileFormatTypeNr
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
public int getFileFormatTypeNr() {
return TextFileInputMeta.FILE_FORMAT_MIXED; // TODO: check this
}
示例7: TextFileInputDialog
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
public TextFileInputDialog(Shell parent, Object in, TransMeta transMeta, String sname)
{
super(parent, (BaseStepMeta)in, transMeta, sname);
input=(TextFileInputMeta)in;
firstClickOnDateLocale=true;
}
示例8: preview
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
private void preview()
{
// Create the XML input step
TextFileInputMeta oneMeta = new TextFileInputMeta();
getInfo(oneMeta);
if (oneMeta.isAcceptingFilenames())
{
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
mb.setMessage(Messages.getString("TextFileInputDialog.Dialog.SpecifyASampleFile.Message")); // Nothing found that matches your criteria
mb.setText(Messages.getString("TextFileInputDialog.Dialog.SpecifyASampleFile.Title")); // Sorry!
mb.open();
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), Messages.getString("TextFileInputDialog.PreviewSize.DialogTitle"), Messages.getString("TextFileInputDialog.PreviewSize.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize>0)
{
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize } );
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled())
{
if (trans.getResult()!=null && trans.getResult().getNrErrors()>0)
{
EnterTextDialog etd = new EnterTextDialog(shell, Messages.getString("System.Dialog.PreviewError.Title"),
Messages.getString("System.Dialog.PreviewError.Message"), loggingText, true );
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd =new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
示例9: preview
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
private void preview()
{
// Create the XML input step
TextFileInputMeta oneMeta = new TextFileInputMeta();
getInfo(oneMeta);
if (oneMeta.isAcceptingFilenames())
{
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
mb.setMessage(BaseMessages.getString(PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Message")); // Nothing found that matches your criteria
mb.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Title")); // Sorry!
mb.open();
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "TextFileInputDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "TextFileInputDialog.PreviewSize.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize>0)
{
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize } );
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled())
{
if (trans.getResult()!=null && trans.getResult().getNrErrors()>0)
{
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"),
BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true );
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd =new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
示例10: getFileFormatTypeNr
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
@Override
public int getFileFormatTypeNr() {
return TextFileInputMeta.FILE_FORMAT_MIXED; // TODO: check this
}
示例11: TextFileInputDialog
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
public TextFileInputDialog( Shell parent, Object in, TransMeta transMeta, String sname ) {
super( parent, (BaseStepMeta) in, transMeta, sname );
input = (TextFileInputMeta) in;
firstClickOnDateLocale = true;
}
示例12: preview
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
private void preview() {
// Create the XML input step
TextFileInputMeta oneMeta = new TextFileInputMeta();
getInfo( oneMeta );
if ( oneMeta.isAcceptingFilenames() ) {
MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION );
mb.setMessage( BaseMessages.getString( PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Message" ) );
mb.setText( BaseMessages.getString( PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Title" ) );
mb.open();
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation( transMeta, oneMeta,
wStepname.getText() );
EnterNumberDialog numberDialog =
new EnterNumberDialog( shell, props.getDefaultPreviewSize(), BaseMessages.getString( PKG,
"TextFileInputDialog.PreviewSize.DialogTitle" ), BaseMessages.getString( PKG,
"TextFileInputDialog.PreviewSize.DialogMessage" ) );
int previewSize = numberDialog.open();
if ( previewSize > 0 ) {
TransPreviewProgressDialog progressDialog =
new TransPreviewProgressDialog( shell, previewMeta, new String[] { wStepname.getText() },
new int[] { previewSize } );
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if ( !progressDialog.isCancelled() ) {
if ( trans.getResult() != null && trans.getResult().getNrErrors() > 0 ) {
EnterTextDialog etd =
new EnterTextDialog( shell, BaseMessages.getString( PKG, "System.Dialog.PreviewError.Title" ),
BaseMessages.getString( PKG, "System.Dialog.PreviewError.Message" ), loggingText, true );
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd =
new PreviewRowsDialog( shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog
.getPreviewRowsMeta( wStepname.getText() ), progressDialog.getPreviewRows( wStepname.getText() ),
loggingText );
prd.open();
}
}
示例13: getFixed
import org.pentaho.di.trans.steps.textfileinput.TextFileInputMeta; //导入依赖的package包/类
private void getFixed() {
TextFileInputMeta info = new TextFileInputMeta();
getInfo( info );
Shell sh = new Shell( shell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN );
try {
List<String> rows = getFirst( 50, false );
fields = getFields( info, rows );
final TextFileImportWizardPage1 page1 = new TextFileImportWizardPage1( "1", props, rows, fields );
page1.createControl( sh );
final TextFileImportWizardPage2 page2 = new TextFileImportWizardPage2( "2", props, rows, fields );
page2.createControl( sh );
Wizard wizard = new Wizard() {
public boolean performFinish() {
wFields.clearAll( false );
for ( TextFileInputFieldInterface field1 : fields ) {
TextFileInputField field = (TextFileInputField) field1;
if ( !field.isIgnored() && field.getLength() > 0 ) {
TableItem item = new TableItem( wFields.table, SWT.NONE );
item.setText( 1, field.getName() );
item.setText( 2, "" + field.getTypeDesc() );
item.setText( 3, "" + field.getFormat() );
item.setText( 4, "" + field.getPosition() );
item.setText( 5, field.getLength() < 0 ? "" : "" + field.getLength() );
item.setText( 6, field.getPrecision() < 0 ? "" : "" + field.getPrecision() );
item.setText( 7, "" + field.getCurrencySymbol() );
item.setText( 8, "" + field.getDecimalSymbol() );
item.setText( 9, "" + field.getGroupSymbol() );
item.setText( 10, "" + field.getNullString() );
item.setText( 11, "" + field.getIfNullValue() );
item.setText( 12, "" + field.getTrimTypeDesc() );
item.setText( 13, field.isRepeated() ? BaseMessages.getString( PKG, "System.Combo.Yes" ) : BaseMessages
.getString( PKG, "System.Combo.No" ) );
}
}
int size = wFields.table.getItemCount();
if ( size == 0 ) {
new TableItem( wFields.table, SWT.NONE );
}
wFields.removeEmptyRows();
wFields.setRowNums();
wFields.optWidth( true );
input.setChanged();
return true;
}
};
wizard.addPage( page1 );
wizard.addPage( page2 );
WizardDialog wd = new WizardDialog( shell, wizard );
WizardDialog.setDefaultImage( GUIResource.getInstance().getImageWizard() );
wd.setMinimumPageSize( 700, 375 );
wd.updateSize();
wd.open();
} catch ( Exception e ) {
new ErrorDialog( shell, BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogTitle" ),
BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogMessage" ), e );
}
}