本文整理汇总了Java中org.pentaho.di.core.exception.KettleFileException类的典型用法代码示例。如果您正苦于以下问题:Java KettleFileException类的具体用法?Java KettleFileException怎么用?Java KettleFileException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KettleFileException类属于org.pentaho.di.core.exception包,在下文中一共展示了KettleFileException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addToBuffer
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
private void addToBuffer(Object[] row) throws KettleFileException
{
data.bufferList.add(row);
if (data.bufferList.size()>5000)
{
if (data.rowsOnFile==0)
{
try
{
data.tempFile = File.createTempFile(meta.getPrefix(), ".tmp", new File(environmentSubstitute(meta.getDirectory()))); //$NON-NLS-1$
data.fos=new FileOutputStream(data.tempFile);
data.dos=new DataOutputStream(data.fos);
data.firstRead = true;
}
catch(IOException e)
{
throw new KettleFileException(Messages.getString("GroupBy.Exception.UnableToCreateTemporaryFile"), e); //$NON-NLS-1$
}
}
// OK, save the oldest rows to disk!
Object[] oldest = (Object[]) data.bufferList.get(0);
data.inputRowMeta.writeData(data.dos, oldest);
data.bufferList.remove(0);
data.rowsOnFile++;
}
}
示例2: getRowOfData
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
private Object[] getRowOfData(RowMetaInterface rowMeta) throws KettleFileException
{
Object[] rowData = null;
while (!baseStep.isStopped() && rowData==null) {
try {
rowData = rowMeta.readData(inputStream);
}
catch(SocketTimeoutException e)
{
rowData = null; // try again.
}
}
return rowData;
}
示例3: writeData
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
/**
* Write ONLY the specified data to the outputStream
* @throws KettleFileException in case things go awry
*/
public void writeData(DataOutputStream outputStream, Object[] data) throws KettleFileException
{
// Write all values in the row
for (int i=0;i<size();i++) getValueMeta(i).writeData(outputStream, data[i]);
// If there are 0 values in the row, we write a marker flag to be able to detect an EOF on the other end (sockets etc)
//
if (size()==0) {
try {
outputStream.writeBoolean(true);
} catch (IOException e) {
throw new KettleFileException("Error writing marker flag", e);
}
}
}
示例4: writeMeta
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
/**
* Write ONLY the specified metadata to the outputStream
* @throws KettleFileException in case things go awry
*/
public void writeMeta(DataOutputStream outputStream) throws KettleFileException
{
// First handle the number of fields in a row
try
{
outputStream.writeInt(size());
}
catch (IOException e)
{
throw new KettleFileException("Unable to write nr of metadata values", e);
}
// Write all values in the row
for (int i=0;i<size();i++) getValueMeta(i).writeMeta(outputStream);
}
示例5: createFileAppender
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
/**
* Create a file appender
* @param filename The (VFS) filename (URL) to write to.
* @param exact is this an exact filename of a filename to be stored in "java.io.tmp"
* @return A new file appender
* @throws KettleFileException In case there is a problem opening the file.
*/
public static final Log4jFileAppender createFileAppender(String filename, boolean exact) throws KettleFileException
{
try
{
FileObject file;
if (!exact)
{
file = KettleVFS.createTempFile(filename, ".log", System.getProperty("java.io.tmpdir"));
}
else
{
file = KettleVFS.getFileObject(filename);
}
Log4jFileAppender appender = new Log4jFileAppender(file);
appender.setLayout(new Log4jKettleLayout(true));
appender.setName(LogWriter.createFileAppenderName(filename, exact));
return appender;
}
catch(IOException e)
{
throw new KettleFileException("Unable to add Kettle file appender to Log4J", e);
}
}
示例6: DBCacheEntry
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
/**
* Read the data for this Cache entry from a data input stream
* @param dis The DataInputStream to read this entry from.
* @throws KettleFileException if the cache can't be read from disk when it should be able to.
* If the cache file doesn't exists, no exception is thrown
*/
public DBCacheEntry(DataInputStream dis) throws KettleFileException
{
try
{
dbname = dis.readUTF();
sql = dis.readUTF();
}
catch(EOFException eof)
{
throw new KettleEOFException("End of file reached", eof);
}
catch(Exception e)
{
throw new KettleFileException("Unable to read cache entry from data input stream", e);
}
}
示例7: addToBuffer
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
private void addToBuffer(Object[] row) throws KettleFileException
{
data.bufferList.add(row);
if (data.bufferList.size()>5000)
{
if (data.rowsOnFile==0)
{
try
{
data.tempFile = File.createTempFile(meta.getPrefix(), ".tmp", new File(environmentSubstitute(meta.getDirectory()))); //$NON-NLS-1$
data.fos=new FileOutputStream(data.tempFile);
data.dos=new DataOutputStream(data.fos);
data.firstRead = true;
}
catch(IOException e)
{
throw new KettleFileException(BaseMessages.getString(PKG, "GroupBy.Exception.UnableToCreateTemporaryFile"), e); //$NON-NLS-1$
}
}
// OK, save the oldest rows to disk!
Object[] oldest = (Object[]) data.bufferList.get(0);
data.inputRowMeta.writeData(data.dos, oldest);
data.bufferList.remove(0);
data.rowsOnFile++;
}
}
示例8: getFields
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
public void getFields(RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
// Add the fields from a ResultFile
try
{
ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject("foo.bar", space), "parentOrigin", "origin");
RowMetaAndData add = resultFile.getRow();
// Set the origin on the fields...
for (int i=0;i<add.size();i++) add.getValueMeta(i).setOrigin(name);
r.addRowMeta(add.getRowMeta());
}
catch(KettleFileException e)
{
throw new KettleStepException(e);
}
}
示例9: init
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
public boolean init(StepMetaInterface smi, StepDataInterface sdi)
{
meta=(CubeOutputMeta)smi;
data=(CubeOutputData)sdi;
if (super.init(smi, sdi))
{
if(!meta.isDoNotOpenNewFileInit())
{
try
{
prepareFile();
data.oneFileOpened=true;
return true;
}
catch(KettleFileException ioe)
{
logError(BaseMessages.getString(PKG, "CubeOutput.Log.ErrorOpeningCubeOutputFile")+ioe.toString()); //$NON-NLS-1$
}
}else return true;
}
return false;
}
示例10: prepareFile
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
private void prepareFile() throws KettleFileException
{
try {
String filename=environmentSubstitute(meta.getFilename());
if(meta.isAddToResultFiles())
{
// Add this to the result file names...
ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject(filename, getTransMeta()), getTransMeta().getName(), getStepname());
resultFile.setComment("This file was created with a cube file output step");
addResultFile(resultFile);
}
data.fos=KettleVFS.getOutputStream(filename, getTransMeta(), false);
data.zip=new GZIPOutputStream(data.fos);
data.dos=new DataOutputStream(data.zip);
}
catch(Exception e) {
throw new KettleFileException(e);
}
}
示例11: getTextFileContent
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
public static String getTextFileContent(String vfsFilename, VariableSpace space, String charSetName) throws KettleFileException
{
try {
InputStream inputStream = null;
if(space == null) {
inputStream = getInputStream(vfsFilename);
} else {
inputStream = getInputStream(vfsFilename, space);
}
InputStreamReader reader = new InputStreamReader(inputStream, charSetName);
int c;
StringBuffer stringBuffer = new StringBuffer();
while ( (c=reader.read())!=-1) stringBuffer.append((char)c);
reader.close();
inputStream.close();
return stringBuffer.toString();
} catch(IOException e) {
throw new KettleFileException(e);
}
}
示例12: createTempFile
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
public static FileObject createTempFile(String prefix, String suffix, String directory, VariableSpace space) throws KettleFileException
{
try {
FileObject fileObject;
do
{
// Build temporary file name using UUID to ensure uniqueness. Old mechanism would fail using Sort Rows (for example)
// when there multiple nodes with multiple JVMs on each node. In this case, the temp file names would end up being
// duplicated which would cause the sort to fail.
String filename = new StringBuffer(50).append(directory).append('/').append(prefix).append('_').append(UUIDUtil.getUUIDAsString()).append(suffix).toString();
fileObject = getFileObject(filename, space);
}
while (fileObject.exists());
return fileObject;
} catch(IOException e) {
throw new KettleFileException(e);
}
}
示例13: getTextFileContent
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
public static String getTextFileContent( String vfsFilename, VariableSpace space, String charSetName ) throws KettleFileException {
try {
InputStream inputStream = null;
if ( space == null ) {
inputStream = getInputStream( vfsFilename );
} else {
inputStream = getInputStream( vfsFilename, space );
}
InputStreamReader reader = new InputStreamReader( inputStream, charSetName );
int c;
StringBuilder aBuffer = new StringBuilder();
while ( ( c = reader.read() ) != -1 ) {
aBuffer.append( (char) c );
}
reader.close();
inputStream.close();
return aBuffer.toString();
} catch ( IOException e ) {
throw new KettleFileException( e );
}
}
示例14: createTempFile
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
public static FileObject createTempFile( String prefix, String suffix, String directory, VariableSpace space ) throws KettleFileException {
try {
FileObject fileObject;
do {
// Build temporary file name using UUID to ensure uniqueness. Old mechanism would fail using Sort Rows (for
// example)
// when there multiple nodes with multiple JVMs on each node. In this case, the temp file names would end up
// being
// duplicated which would cause the sort to fail.
String filename =
new StringBuilder( 50 ).append( directory ).append( '/' ).append( prefix ).append( '_' ).append(
UUIDUtil.getUUIDAsString() ).append( suffix ).toString();
fileObject = getFileObject( filename, space );
} while ( fileObject.exists() );
return fileObject;
} catch ( IOException e ) {
throw new KettleFileException( e );
}
}
示例15: loadFromSimpleVFS
import org.pentaho.di.core.exception.KettleFileException; //导入依赖的package包/类
/**
* Internal image loading from Kettle's VFS.
*/
private static SwtUniversalImage loadFromSimpleVFS( Display display, String location ) {
try {
InputStream s = KettleVFS.getInputStream( location );
if ( s == null ) {
return null;
}
try {
return loadImage( display, s, location );
} finally {
IOUtils.closeQuietly( s );
}
} catch ( KettleFileException e ) {
// do nothing. try to load next
}
return null;
}