当前位置: 首页>>代码示例>>Java>>正文


Java KettleVFS类代码示例

本文整理汇总了Java中org.pentaho.di.core.vfs.KettleVFS的典型用法代码示例。如果您正苦于以下问题:Java KettleVFS类的具体用法?Java KettleVFS怎么用?Java KettleVFS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KettleVFS类属于org.pentaho.di.core.vfs包,在下文中一共展示了KettleVFS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exportResources

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
/**
 * Since the exported transformation that runs this will reside in a ZIP file, we can't reference files relatively.
 * So what this does is turn the name of files into absolute paths OR it simply includes the resource in the ZIP file.
 * For now, we'll simply turn it into an absolute path and pray that the file is on a shared drive or something like that.

 * TODO: create options to configure this behavior 
 */
public String exportResources(VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository) throws KettleException {
	try {
		// The object that we're modifying here is a copy of the original!
		// So let's change the filename from relative to absolute by grabbing the file object...
		// In case the name of the file comes from previous steps, forget about this!
		//
		if (!filefield) {
            for (int i=0;i<fileName.length;i++) {
              FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(fileName[i]), space);
                 fileName[i] = resourceNamingInterface.nameResource(fileObject, space, Const.isEmpty(fileMask[i]));
            }
		}
		return null;
	} catch (Exception e) {
		throw new KettleException(e); //$NON-NLS-1$
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:25,代码来源:GetFilesRowsCountMeta.java

示例2: exportResources

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
/**
 * Since the exported transformation that runs this will reside in a ZIP file, we can't reference files relatively.
 * So what this does is turn the name of files into absolute paths OR it simply includes the resource in the ZIP file.
 * For now, we'll simply turn it into an absolute path and pray that the file is on a shared drive or something like that.

 * TODO: create options to configure this behavior 
 */
public String exportResources(VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository) throws KettleException {
	try {
		// The object that we're modifying here is a copy of the original!
		// So let's change the filename from relative to absolute by grabbing the file object...
		//
		if (!filefield) {
            for (int i=0;i<fileName.length;i++) {
              FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(fileName[i]), space);
              fileName[i] = resourceNamingInterface.nameResource(fileObject, space, Const.isEmpty(fileMask[i]));
            }
		}
		return null;
	} catch (Exception e) {
		throw new KettleException(e); //$NON-NLS-1$
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:24,代码来源:LDIFInputMeta.java

示例3: exportResources

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
/**
 * Since the exported transformation that runs this will reside in a ZIP file, we can't reference files relatively.
 * So what this does is turn the name of the base path into an absolute path.
 */
public String exportResources(VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository) throws KettleException {
	try {
		// The object that we're modifying here is a copy of the original!
		// So let's change the filename from relative to absolute by grabbing the file object...
		// In case the name of the file comes from previous steps, forget about this!
		// 
		if (!fileNameInField) {
			
			if (!Const.isEmpty(fileName)) {
				FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(fileName), space);
				fileName = resourceNamingInterface.nameResource(fileObject, space, true);
			}
		}
		
		return null;
	} catch (Exception e) {
		throw new KettleException(e); //$NON-NLS-1$
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:24,代码来源:TextFileOutputMeta.java

示例4: addFileToResultFilenames

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
private void addFileToResultFilenames(String fileaddentry,LogWriter log,Result result,Job parentJob)
	{	
		try
		{
			ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject(fileaddentry), parentJob.getJobname(), toString());
			result.getResultFiles().put(resultFile.getFile().toString(), resultFile);
	    
			if(log.isDebug())
			{
				log.logDebug(toString()," ------ ");
				log.logDebug(toString(),Messages.getString("JobMoveFiles.Log.FileAddedToResultFilesName",fileaddentry));
			}
			
		}catch (Exception e)
		{
			log.logError(Messages.getString("JobMoveFiles.Error.AddingToFilenameResult"),fileaddentry + ""+e.getMessage());
		}

}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:20,代码来源:JobEntryMoveFiles.java

示例5: FileExists

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
/**
 * Check existence of a local file
 * 
 * @param filename
 * @return true, if file exists
 */
public boolean FileExists(String filename) {
    
	FileObject file=null;
    try {
    	file=KettleVFS.getFileObject(filename);
    	if(!file.exists()) return false;
    	else
    	{
    		if(file.getType() == FileType.FILE) return true;
    		else return false;
    	}
    } catch (Exception e) {
        return false;
    }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:22,代码来源:JobEntrySSH2GET.java

示例6: createFileAppender

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的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"
 * @param append
 * @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,boolean append) 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,append);
        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);
	}
   }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:34,代码来源:LogWriter.java

示例7: getFiles

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
private List<FileObject> getFiles(String localfolder) throws IOException
  {
List<FileObject> myFileList = new ArrayList<FileObject>();

// Get all the files in the local directory...

FileObject localFiles = KettleVFS.getFileObject(localfolder);
FileObject[] children = localFiles.getChildren();
if (children!=null) 
{
	for (int i=0; i<children.length; i++) 
	{
           // Get filename of file or directory
		if (children[i].getType().equals(FileType.FILE)) 
		{
			myFileList.add(children[i]);
			
		}
       } // end for
}

return myFileList;
  }
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:24,代码来源:JobEntrySSH2PUT.java

示例8: exportResources

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
/**
 * Since the exported transformation that runs this will reside in a ZIP file, we can't reference files relatively.
 * So what this does is turn the name of files into absolute paths OR it simply includes the resource in the ZIP file.
 * For now, we'll simply turn it into an absolute path and pray that the file is on a shared drive or something like that.

 * TODO: create options to configure this behavior 
 */
public String exportResources(VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository) throws KettleException {
	try {
		// The object that we're modifying here is a copy of the original!
		// So let's change the filename from relative to absolute by grabbing the file object...
		// In case the name of the file comes from previous steps, forget about this!
		// 
		if (!filefield) {
             
             // Replace the filename ONLY (folder or filename)
             // 
             for (int i=0;i<fileName.length;i++) {
               FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(fileName[i]), space);
               fileName[i] = resourceNamingInterface.nameResource(fileObject, space, Const.isEmpty(fileMask[i]));
             }
           }
		return null;
	} catch (Exception e) {
		throw new KettleException(e); //$NON-NLS-1$
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:28,代码来源:GetFileNamesMeta.java

示例9: createRepositoryDirectory

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
public RepositoryDirectoryInterface createRepositoryDirectory(RepositoryDirectoryInterface parentDirectory, String directoryPath) throws KettleException {
	String folder = calcDirectoryName(parentDirectory);
	String newFolder = folder;
	if (folder.endsWith("/")) newFolder+=directoryPath; else newFolder+="/"+directoryPath;
	
	FileObject parent = KettleVFS.getFileObject(newFolder);
	try {
		parent.createFolder();
	} catch (FileSystemException e) {
		throw new KettleException("Unable to create folder "+newFolder, e);
	}
	
	// Incremental change of the directory structure...
	//
	RepositoryDirectory newDir = new RepositoryDirectory(parentDirectory, directoryPath);
	parentDirectory.addSubdirectory(newDir);
	newDir.setObjectId(new StringObjectId(newDir.toString()));
	
	return newDir;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:21,代码来源:KettleFileRepository.java

示例10: exportResources

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
/**
 * Since the exported transformation that runs this will reside in a ZIP file, we can't reference files relatively.
 * So what this does is turn the name of files into absolute paths OR it simply includes the resource in the ZIP file.
 * For now, we'll simply turn it into an absolute path and pray that the file is on a shared drive or something like that.

 * TODO: create options to configure this behavior 
 */
public String exportResources(VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository) throws KettleException {
	try {
		// The object that we're modifying here is a copy of the original!
		// So let's change the filename from relative to absolute by grabbing the file object...
		//
		// From : ${Internal.Transformation.Filename.Directory}/../foo/bar.data
		// To   : /home/matt/test/files/foo/bar.data
		//
		FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(filename), space);
			
		// If the file doesn't exist, forget about this effort too!
		//
		if (fileObject.exists()) {
			// Convert to an absolute path...
			// 
			filename = resourceNamingInterface.nameResource(fileObject, space, true);
			
			return filename;
		}
		return null;
	} catch (Exception e) {
		throw new KettleException(e); //$NON-NLS-1$
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:32,代码来源:CubeInputMeta.java

示例11: exportResources

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
/**
 * Since the exported transformation that runs this will reside in a ZIP file, we can't reference files relatively.
 * So what this does is turn the name of files into absolute paths OR it simply includes the resource in the ZIP file.
 * For now, we'll simply turn it into an absolute path and pray that the file is on a shared drive or something like that.

 * TODO: create options to configure this behavior 
 */
public String exportResources(VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository) throws KettleException {
	try {
		// The object that we're modifying here is a copy of the original!
		// So let's change the filename from relative to absolute by grabbing the file object...
		// 
		// From : ${Internal.Transformation.Filename.Directory}/../foo/bar.txt
		// To   : /home/matt/test/files/foo/bar.txt
		//
		FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(filename), space);
		
           // If the file doesn't exist, forget about this effort too!
           //
           if (fileObject.exists()) {
               // Convert to an absolute path...
               // 
               filename = resourceNamingInterface.nameResource(fileObject, space, true);
               
               return filename;
           }
		return null;
	} catch (Exception e) {
		throw new KettleException(e); //$NON-NLS-1$
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:32,代码来源:FixedInputMeta.java

示例12: LogChannelFileWriter

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
/**
 * Create a new log channel file writer
 * @param logChannelId The log channel (+children) to write to the log file 
 * @param logFile The logging file to write to
 * @param appending set to true if you want to append to an existing file
 * @param pollingInterval The polling interval in milliseconds.
 * 
 * @throws KettleException in case the specified log file can't be created.
 */
public LogChannelFileWriter(String logChannelId, FileObject logFile, boolean appending, int pollingInterval) throws KettleException {
  this.logChannelId = logChannelId;
  this.logFile = logFile;
  this.appending = appending;
  this.pollingInterval = pollingInterval;
  
  active = new AtomicBoolean(false);
  lastBufferLineNr = CentralLogStore.getLastBufferLineNr();
  
  try {
    logFileOutputStream = KettleVFS.getOutputStream(logFile, appending);
  } catch(IOException e) {
    throw new KettleException("There was an error while trying to open file '"+logFile+"' for writing", e);
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:25,代码来源:LogChannelFileWriter.java

示例13: addSource

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
private boolean addSource(String source) throws KettleException{
	if(meta.isFileSource()){
           try{ 
               FileObject fileObject = KettleVFS.getFileObject(source);
               data.files.addFile(fileObject);
               if (data.files.nrOfFiles()==0){
                   logError(Messages.getString("OGRFileOutput.Log.Error.NoFilesSpecified")); 
                   return false;
               }
           }catch(IOException e){
               logError(Messages.getString("OGRFileOutput.Log.Error.UnableToCreateFileObject", source));
               return false;
           }
       }else                    	
       	data.cnxStrings.add(source);
	return true;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:18,代码来源:OGRFileOutput.java

示例14: exportResources

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
/**
 * Since the exported transformation that runs this will reside in a ZIP file, we can't reference files relatively.
 * So what this does is turn the name of files into absolute paths OR it simply includes the resource in the ZIP file.
 * For now, we'll simply turn it into an absolute path and pray that the file is on a shared drive or something like that.

 * TODO: create options to configure this behavior 
 */
public String exportResources(VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository) throws KettleException {
	try {
		// The object that we're modifying here is a copy of the original!
		// So let's change the filename from relative to absolute by grabbing the file object...
		//
		// From : ${Internal.Transformation.Filename.Directory}/../foo/bar.data
		// To   : /home/matt/test/files/foo/bar.data
		//
		FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(fileName));
			
		// If the file doesn't exist, forget about this effort too!
		//
		if (fileObject.exists()) {
			// Convert to an absolute path...
			// 
			fileName = resourceNamingInterface.nameResource(fileObject.getName().getBaseName(), fileObject.getParent().getName().getPath(), space.toString(), FileNamingType.DATA_FILE);
			
			return fileName;
		}
		return null;
	} catch (Exception e) {
		throw new KettleException(e); //$NON-NLS-1$
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:32,代码来源:SQLFileOutputMeta.java

示例15: exportResources

import org.pentaho.di.core.vfs.KettleVFS; //导入依赖的package包/类
/**
 * Since the exported transformation that runs this will reside in a ZIP file, we can't reference files relatively.
 * So what this does is turn the name of files into absolute paths OR it simply includes the resource in the ZIP file.
 * For now, we'll simply turn it into an absolute path and pray that the file is on a shared drive or something like that.

 * TODO: create options to configure this behavior 
 */
public String exportResources(VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository) throws KettleException {
	try {
		// The object that we're modifying here is a copy of the original!
		// So let's change the filename from relative to absolute by grabbing the file object...
		//
		// From : ${Internal.Transformation.Filename.Directory}/../foo/bar.data
		// To   : /home/matt/test/files/foo/bar.data
		//
		FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(fileName));
			
		// If the file doesn't exist, forget about this effort too!
		//
		if (fileObject.exists()) {
			// Convert to an absolute path...
			// 
			fileName = resourceNamingInterface.nameResource(fileObject.getName().getBaseName(), fileObject.getParent().getName().getPath(), space.toString(), FileNamingType.DATA_FILE);
			return fileName;
		}
		return null;
	} catch (Exception e) {
		throw new KettleException(e); //$NON-NLS-1$
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:31,代码来源:PropertyOutputMeta.java


注:本文中的org.pentaho.di.core.vfs.KettleVFS类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。