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


Java KettleVFS.getFilename方法代码示例

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


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

示例1: createCommandLine

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
/**
 * Create the command line for a tbuild process depending on the meta information supplied.
 * 
 * @return The string to execute.
 * 
 * @throws KettleException
 *             Upon any exception
 */
public String createCommandLine() throws KettleException {
    if (StringUtils.isBlank(this.meta.getTbuildPath())) {
        throw new KettleException("tbuild path not set");
    }
    final StringBuilder builder = new StringBuilder();
    try {
        final FileObject fileObject = KettleVFS.getFileObject(environmentSubstitute(this.meta.getTbuildPath()));
        final String tbuildExec = KettleVFS.getFilename(fileObject);
        builder.append(tbuildExec + " ");
        //  Add command line args as appropriate for generated or existing script
        builder.append("-f " + this.tempScriptFile + " ");
        if (this.meta.getGenerateScript()){   
        	// no other args here
        }else{
        	String varfile = this.meta.getVariableFile();
        	if (varfile != null && !varfile.equals("")){
        		builder.append("-v " + varfile + " ");
        	}
        }
        builder.append(this.meta.getJobName());
    } catch (Exception e) {
        throw new KettleException("Error retrieving tbuild application string", e);
    }
    // Add log error log, if set.
    return builder.toString();
}
 
开发者ID:jbleuel,项目名称:pdi-teradata-tpt-plugin,代码行数:35,代码来源:TeraDataBulkLoader.java

示例2: OpenFile

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
private boolean OpenFile() throws Exception
{
	data.oneFileOpened=true;
       String realFilename = environmentSubstitute(meta.getFilename());
       if(log.isBasic())
       	logBasic(Messages.getString("AccessOutput.log.WritingToFile", realFilename));
       FileObject fileObject = KettleVFS.getFileObject(realFilename);
       File file = new File(KettleVFS.getFilename(fileObject));
       
       // First open or create the access file
       if (!file.exists())
       {
           if (meta.isFileCreated())
           {
               data.db = Database.create(file);
           }
           else
           {
               logError(Messages.getString("AccessOutput.InitError.FileDoesNotExist", realFilename));
               return false;
           }
       }
       else
       {
           data.db = Database.open(file);
       }
       
       // Add the filename to the result object...
       //
       if(meta.isAddToResultFiles())
       {
		ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, fileObject, getTransMeta().getName(), toString());
		resultFile.setComment("This file was created with an access output step");
		addResultFile(resultFile);
       }
       
       return true;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:39,代码来源:AccessOutput.java

示例3: getFileStrings

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
public String[] getFileStrings()
{
    String[] fileStrings = new String[files.size()];
    for (int i=0;i<fileStrings.length;i++)
    {
        fileStrings[i] = KettleVFS.getFilename(files.get(i));
    }
    return fileStrings;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:10,代码来源:FileInputList.java

示例4: init

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
  meta = (GitInfoStepMeta) smi;
  data = (GitInfoStepData) sdi;

  if (super.init(smi, sdi)) {
    if (meta.getUsername() != null && meta.getPassword() != null) {
      data.cp = new UsernamePasswordCredentialsProvider(
          environmentSubstitute(meta.getUsername()),
          environmentSubstitute(meta.getPassword()));
    }
    if (meta.getGitRepoUrl() != null) {
      data.gitRepoUrl = environmentSubstitute(meta.getGitRepoUrl());
    }
    if (meta.getGitRepoFolderPath() != null) {
      try {
        data.gitRepoFolderPath = new File(
            KettleVFS.getFilename(KettleVFS
                .getFileObject(environmentSubstitute(meta
                    .getGitRepoFolderPath()))));
      } catch (KettleFileException e) {
        logError(e.getMessage(), e);
      }
    }
    if (meta.getGitCommand() != null) {
      data.gitCommand = meta.getGitCommand();
    }
    return true;
  }
  return false;
}
 
开发者ID:ivylabs,项目名称:ivy-pdi-git-steps,代码行数:35,代码来源:GitInfoStep.java

示例5: init

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
  meta = (GitOperationsStepMeta) smi;
  data = (GitOperationsStepData) sdi;

  if (super.init(smi, sdi)) {
    if (meta.getUsername() != null && meta.getPassword() != null) {
      data.cp = new UsernamePasswordCredentialsProvider(
          environmentSubstitute(meta.getUsername()),
          environmentSubstitute(meta.getPassword()));
    }
    if (meta.getGitRepoUrl() != null) {
      data.gitRepoUrl = environmentSubstitute(meta.getGitRepoUrl());
    }
    if (meta.getGitRepoFolderPath() != null) {
      try {
        data.gitRepoFolderPath = new File(
            KettleVFS.getFilename(KettleVFS
                .getFileObject(environmentSubstitute(meta
                    .getGitRepoFolderPath()))));
      } catch (KettleFileException e) {
        logError(e.getMessage(), e);
      }
    }
    if (meta.getGitCommands().size() > 0) {
      data.gitCommands = meta.getGitCommands();
    }
    return true;
  }
  return false;
}
 
开发者ID:ivylabs,项目名称:ivy-pdi-git-steps,代码行数:35,代码来源:GitOperationsStep.java

示例6: checkFilesLocked

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
private void checkFilesLocked(FileObject[] files) throws KettleException {
 
 for(int i=0; i<files.length && !oneFileLocked; i++) {
  FileObject file = files[i];
  String filename = KettleVFS.getFilename(file);
  LockFile locked = new LockFile(filename);
  if(locked.isLocked()) {
	  oneFileLocked= true;
	  logError( BaseMessages.getString(PKG, "JobCheckFilesLocked.Log.FileLocked",filename));
  }else {
	  if(isDetailed()) logDetailed( BaseMessages.getString(PKG, "JobCheckFilesLocked.Log.FileNotLocked",filename));  
  }
 }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:15,代码来源:JobEntryCheckFilesLocked.java

示例7: createTemporaryShellFile

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
private FileObject createTemporaryShellFile(FileObject tempFile, String fileContent) throws Exception
{
	// Create a unique new temporary filename in the working directory, put the script in there
	// Set the permissions to execute and then run it...
	//
	if (tempFile != null && fileContent != null) { 
		try {
			tempFile.createFile();
			OutputStream outputStream = tempFile.getContent().getOutputStream();
			outputStream.write(fileContent.getBytes());
			outputStream.close();
			if (!Const.getOS().startsWith("Windows")) {
				String tempFilename =  KettleVFS.getFilename(tempFile);
				// Now we have to make this file executable...
				// On Unix-like systems this is done using the command "/bin/chmod +x filename"
				//
				ProcessBuilder procBuilder = new ProcessBuilder("chmod", "+x", tempFilename);
				Process proc = procBuilder.start();
				// Eat/log stderr/stdout all messages in a different thread...
				StreamLogger errorLogger = new StreamLogger(log, proc.getErrorStream(), toString() + " (stderr)");
				StreamLogger outputLogger = new StreamLogger(log, proc.getInputStream(), toString() + " (stdout)");
				new Thread(errorLogger).start();
				new Thread(outputLogger).start();
				proc.waitFor();
			}

		}
		catch(Exception e) {
			throw new Exception("Unable to create temporary file to execute script", e);
		}
	}
	return tempFile;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:34,代码来源:JobEntryShell.java

示例8: detectPluginFolderPath

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
private static String detectPluginFolderPath() {
    try {
        final PluginInterface spoonPlugin = PluginRegistry.getInstance().findPluginWithId(JobEntryPluginType.class,
                "DataCleanerJobEntry");
        return KettleVFS.getFilename(KettleVFS.getFileObject(spoonPlugin.getPluginDirectory().toString()));
    } catch (Exception e) {
        throw new RuntimeException(
                "Unable to determine location of the spoon profile plugin. It is needed to know where DataCleaner is installed.");
    }
}
 
开发者ID:datacleaner,项目名称:pdi-datacleaner,代码行数:11,代码来源:DataCleanerSpoonConfiguration.java

示例9: readFileOrString

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
private void readFileOrString() throws Exception {
	if (data.file != null) {
		data.filename = KettleVFS.getFilename(data.file);
		// Add additional fields?
		if (meta.getShortFileNameField() != null
				&& meta.getShortFileNameField().length() > 0) {
			data.shortFilename = data.file.getName().getBaseName();
		}
		if (meta.getPathField() != null && meta.getPathField().length() > 0) {
			data.path = KettleVFS.getFilename(data.file.getParent());
		}
		if (meta.isHiddenField() != null
				&& meta.isHiddenField().length() > 0) {
			data.hidden = data.file.isHidden();
		}
		if (meta.getExtensionField() != null
				&& meta.getExtensionField().length() > 0) {
			data.extension = data.file.getName().getExtension();
		}
		if (meta.getLastModificationDateField() != null
				&& meta.getLastModificationDateField().length() > 0) {
			data.lastModificationDateTime = new Date(data.file.getContent()
					.getLastModifiedTime());
		}
		if (meta.getUriField() != null && meta.getUriField().length() > 0) {
			data.uriName = data.file.getName().getURI();
		}
		if (meta.getRootUriField() != null
				&& meta.getRootUriField().length() > 0) {
			data.rootUriName = data.file.getName().getRootURI();
		}
		// Check if file is empty
		long fileSize = data.file.getContent().getSize();

		if (meta.getSizeField() != null && meta.getSizeField().length() > 0) {
			data.size = fileSize;
		}
		// Move file pointer ahead!
		data.filenr++;

		if (log.isDetailed()) {
			logDetailed(BaseMessages.getString(PKG,
					"FastJsonInput.Log.OpeningFile", data.file.toString()));
		}

		addFileToResultFilesname(data.file);
	}

	parseJson();

}
 
开发者ID:etdube,项目名称:pdi-fastjsoninput-plugin,代码行数:52,代码来源:FastJsonInput.java

示例10: createCommandLine

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
/**
 * Create the command line for a psql process depending on the meta
 * information supplied.
 * 
 * @param meta The meta data to create the command line from
 * @param password Use the real password or not
 * 
 * @return The string to execute.
 * 
 * @throws KettleException Upon any exception
 */
public String createCommandLine(PGBulkLoaderMeta meta, boolean password) throws KettleException
{
   StringBuffer sb = new StringBuffer(300);
   
   if ( meta.getPsqlpath() != null )
   {
	   try
	   {
           FileObject fileObject = KettleVFS.getFileObject(environmentSubstitute(meta.getPsqlpath()));
 	      	   String psqlexec = KettleVFS.getFilename(fileObject);
	       sb.append(psqlexec);
 	       }
       catch ( IOException ex )
       {
           throw new KettleException("Error retrieving sqlldr string", ex);
       }		       
   }
   else
   {
	   throw new KettleException("No psql application specified");
   }

      DatabaseMeta dm = meta.getDatabaseMeta();
      if ( dm != null )
      {

	   // Note: Passwords are not supported directly, try configuring your connection for trusted access using pg_hba.conf
          //

          // The username
          // 
   	   // String user = Const.NVL(dm.getUsername(), "");
          // sb.append(" -U ").append(environmentSubstitute(user));

          // Hostname and portname
          //
          String hostname  = Const.NVL(dm.getHostname(), "");
          String portnum  = Const.NVL(dm.getDatabasePortNumberString(), "");
          sb.append(" -h ");
          sb.append(hostname);
          sb.append(" -p ");
          sb.append(portnum);
          
          // Database Name
          // 
          String dns  = Const.NVL(dm.getDatabaseName(), "");
          sb.append(" -d ");
          String overrideName = meta.getDbNameOverride();
          if ( Const.isEmpty(Const.rtrim(overrideName)) )
          {
              sb.append(environmentSubstitute(dns));
          }
          else
          {
       	   // if the database name override is filled in, do that one.
       	   sb.append(environmentSubstitute(overrideName));
          }
      }
   else
   {
	   throw new KettleException("No connection specified");
   }

   return sb.toString(); 
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:77,代码来源:PGBulkLoader.java

示例11: init

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
public boolean init(StepMetaInterface smi, StepDataInterface sdi)
{
	meta = (ExcelInputMeta) smi;
	data = (ExcelInputData) sdi;

	if (super.init(smi, sdi))
	{
		initErrorHandling();
		initReplayFactory();
		data.files = meta.getFileList(this);
		if (data.files.nrOfFiles() == 0 && data.files.nrOfMissingFiles() == 0 && !meta.isAcceptingFilenames())
		{
			
			logError(Messages.getString("ExcelInput.Error.NoFileSpecified"));
			return false;
		}

		if (meta.getEmptyFields().size() > 0)
		{
			// Determine the maximum filename length...
			data.maxfilelength = -1;

			for (FileObject file : data.files.getFiles())
			{
				String name = KettleVFS.getFilename(file);
				if (name.length() > data.maxfilelength) data.maxfilelength = name.length();
			}

			// Determine the maximum sheet name length...
			data.maxsheetlength = -1;
			if (!meta.readAllSheets())
			{
				data.sheetNames = new String[meta.getSheetName().length];
				data.startColumn = new int[meta.getSheetName().length];
				data.startRow    = new int[meta.getSheetName().length];
				for (int i = 0; i < meta.getSheetName().length; i++)
				{
					data.sheetNames[i] = meta.getSheetName()[i];
					data.startColumn[i] = meta.getStartColumn()[i];
					data.startRow[i] = meta.getStartRow()[i];
					
					if (meta.getSheetName()[i].length() > data.maxsheetlength) 
					{
						data.maxsheetlength = meta.getSheetName()[i].length();
					}
				}
			}
			else
			{
				// Allocated at open file time: we want ALL sheets.
				if (meta.getStartRow().length==1)
				{
					data.defaultStartRow = meta.getStartRow()[0];
				}
				else
				{
					data.defaultStartRow = 0;
				}
				if (meta.getStartColumn().length==1)
				{
					data.defaultStartColumn = meta.getStartColumn()[0];
				}
				else
				{
					data.defaultStartColumn = 0;
				}
			}

			return true;
		}
		else
		{
			logError(Messages.getString("ExcelInput.Error.NotInputFieldsDefined"));
			
		}

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

示例12: loadFile

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
public void loadFile(FileObject file) throws Exception {
	this.file= file;
	this.filename= KettleVFS.getFilename(file);
	loadFile(filename);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:6,代码来源:YamlReader.java

示例13: getRowData

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
private Object[] getRowData()  throws KettleException {
	 // Build an empty row based on the meta-data		  
	 Object[] outputRowData=null;

	 try {	
			// Create new row...
			outputRowData = data.yaml.getRow(data.rowMeta);
			if(outputRowData==null) return null;

			if(data.readrow!=null) {
				outputRowData=RowDataUtil.addRowData(data.readrow, data.totalPreviousFields, outputRowData);
			}else {
				outputRowData=RowDataUtil.resizeArray(outputRowData, data.totalOutStreamFields);
			}

			int rowIndex = data.totalOutFields;

			// See if we need to add the filename to the row...
			if ( meta.includeFilename() && !Const.isEmpty(meta.getFilenameField()) ) {
				outputRowData[rowIndex++] = KettleVFS.getFilename(data.file);
			}
			 // See if we need to add the row number to the row...  
	        if (meta.includeRowNumber() && !Const.isEmpty(meta.getRowNumberField())) {
	            outputRowData[rowIndex++] = new Long(data.rownr);
	        }

	 } catch (Exception e)  {
		 boolean sendToErrorRow=false;
		 String errorMessage=null;

		 if (getStepMeta().isDoingErrorHandling())  {
             sendToErrorRow = true;
             errorMessage = e.toString();
        } else {
			logError(BaseMessages.getString(PKG, "YamlInput.ErrorInStepRunning",e.toString())); //$NON-NLS-1$
			setErrors(1);
			stopAll();
			logError(Const.getStackTracker(e));
			setOutputDone();  // signal end to receiver(s)
		}
		if (sendToErrorRow) {
			 // Simply add this row to the error row
			putError(getInputRowMeta(), outputRowData, 1, errorMessage, null, "YamlInput001");
        }
	 }
	 
	 return outputRowData;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:49,代码来源:YamlInput.java

示例14: readFileOrString

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
private void readFileOrString() throws Exception {
	if(data.file!=null) {
		data.filename =  KettleVFS.getFilename(data.file);
		// Add additional fields?
		if (meta.getShortFileNameField()!=null && meta.getShortFileNameField().length()>0) {
			data.shortFilename  =  data.file.getName().getBaseName();
		}
		if (meta.getPathField()!=null && meta.getPathField().length()>0) {
			data.path = KettleVFS.getFilename(data.file.getParent());
		}
		if (meta.isHiddenField()!=null && meta.isHiddenField().length()>0)  {
			data.hidden =  data.file.isHidden();
		}
		if (meta.getExtensionField()!=null && meta.getExtensionField().length()>0) {
			data.extension =  data.file.getName().getExtension();
		}
		if (meta.getLastModificationDateField()!=null && meta.getLastModificationDateField().length()>0) {
			data.lastModificationDateTime =  new Date(data.file.getContent().getLastModifiedTime());
		}
		if (meta.getUriField()!=null && meta.getUriField().length()>0) {
			data.uriName = data.file.getName().getURI();
		}
		if (meta.getRootUriField()!=null && meta.getRootUriField().length()>0) {
			data.rootUriName = data.file.getName().getRootURI();
		}
		// Check if file is empty
		long fileSize= data.file.getContent().getSize();	

		if (meta.getSizeField()!=null && meta.getSizeField().length()>0) {
			data.size = fileSize;
		}
		// Move file pointer ahead!
		data.filenr++;

		if (log.isDetailed()) logDetailed(BaseMessages.getString(PKG, "JsonInput.Log.OpeningFile", data.file.toString()));

		addFileToResultFilesname(data.file);
	}

	parseJson();

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:43,代码来源:JsonInput.java

示例15: init

import org.pentaho.di.core.vfs.KettleVFS; //导入方法依赖的package包/类
public boolean init(StepMetaInterface smi, StepDataInterface sdi)
{
	meta = (ExcelInputMeta) smi;
	data = (ExcelInputData) sdi;

	if (super.init(smi, sdi))
	{
		initErrorHandling();
		initReplayFactory();
		data.files = meta.getFileList(this);
		if (data.files.nrOfFiles() == 0 && data.files.nrOfMissingFiles() > 0 && !meta.isAcceptingFilenames())
		{
			
			logError(BaseMessages.getString(PKG, "ExcelInput.Error.NoFileSpecified"));
			return false;
		}

		if (meta.getEmptyFields().size() > 0)
		{
			// Determine the maximum filename length...
			data.maxfilelength = -1;

			for (FileObject file : data.files.getFiles())
			{
				String name = KettleVFS.getFilename(file);
				if (name.length() > data.maxfilelength) data.maxfilelength = name.length();
			}

			// Determine the maximum sheet name length...
			data.maxsheetlength = -1;
			if (!meta.readAllSheets())
			{
				data.sheetNames = new String[meta.getSheetName().length];
				data.startColumn = new int[meta.getSheetName().length];
				data.startRow    = new int[meta.getSheetName().length];
				for (int i = 0; i < meta.getSheetName().length; i++)
				{
					data.sheetNames[i] = meta.getSheetName()[i];
					data.startColumn[i] = meta.getStartColumn()[i];
					data.startRow[i] = meta.getStartRow()[i];
					
					if (meta.getSheetName()[i].length() > data.maxsheetlength) 
					{
						data.maxsheetlength = meta.getSheetName()[i].length();
					}
				}
			}
			else
			{
				// Allocated at open file time: we want ALL sheets.
				if (meta.getStartRow().length==1)
				{
					data.defaultStartRow = meta.getStartRow()[0];
				}
				else
				{
					data.defaultStartRow = 0;
				}
				if (meta.getStartColumn().length==1)
				{
					data.defaultStartColumn = meta.getStartColumn()[0];
				}
				else
				{
					data.defaultStartColumn = 0;
				}
			}

			return true;
		}
		else
		{
			logError(BaseMessages.getString(PKG, "ExcelInput.Error.NotInputFieldsDefined"));
			
		}

	}
	return false;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:80,代码来源:ExcelInput.java


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