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


Java VariableSpace.environmentSubstitute方法代码示例

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


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

示例1: getStage

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
/**
 * Gets the Snowflake stage name based on the configured metadata
 * @param space The variable space
 * @return The Snowflake stage name to use
 */
public String getStage( VariableSpace space ) {
  if ( locationType.equals( LOCATION_TYPE_CODES[LOCATION_TYPE_USER] ) ) {
    return "@~/" + space.environmentSubstitute( targetTable );
  } else if ( locationType.equals( LOCATION_TYPE_CODES[LOCATION_TYPE_TABLE] ) ) {
    if ( !Const.isEmpty( space.environmentSubstitute( targetSchema ) ) ) {
      return "@" + space.environmentSubstitute( targetSchema ) + ".%" + space.environmentSubstitute( targetTable );
    } else {
      return "@%" + space.environmentSubstitute( targetTable );
    }
  } else if ( locationType.equals( LOCATION_TYPE_CODES[LOCATION_TYPE_INTERNAL_STAGE] ) ) {
    if ( !Const.isEmpty( space.environmentSubstitute( targetSchema ) ) ) {
      return "@" + space.environmentSubstitute( targetSchema ) + "." + space.environmentSubstitute( stageName );
    } else {
      return "@" + space.environmentSubstitute( stageName );
    }
  }
  return null;
}
 
开发者ID:inquidia,项目名称:PentahoSnowflakePlugin,代码行数:24,代码来源:SnowflakeBulkLoaderMeta.java

示例2: getFields

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
@Override
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore)
        throws KettleStepException {
    CassandraConnection connection;
    String nodes = space.environmentSubstitute(this.cassandraNodes);
    String port = space.environmentSubstitute(this.cassandraPort);
    String keyspace = space.environmentSubstitute(this.keyspace);
    String cql = space.environmentSubstitute(this.cqlStatement);

    if ((Const.isEmpty(nodes)) || (Const.isEmpty(port)) || (Const.isEmpty(keyspace)) || (Const.isEmpty(cql))) {
        return;
    }

    String user = space.environmentSubstitute(this.username);
    String pass = space.environmentSubstitute(this.password);
    String trustfile = space.environmentSubstitute(this.trustStoreFilePath);
    String trustpass = space.environmentSubstitute(this.trustStorePass);


    logDebug("meta: opening connection");
    try {
        connection = Utils.connect(nodes, port, user, pass, keyspace, this.SslEnabled, trustfile, trustpass, this.compression);
    } catch (CassandraConnectionException e) {
        throw new KettleStepException("Failed to create connection", e);
    }

    Session session = connection.getSession();

    logDebug("meta: parsing cql '" + cql + "'");
    ResultSet rs = session.execute(cql);
    createOutputRowMeta(row, rs);

    connection.release();
}
 
开发者ID:bcolas,项目名称:pentaho-cassandra-plugin,代码行数:35,代码来源:CassandraInputMeta.java

示例3: getProp

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
/**
* 获取参数 <br/>
* @author jingma
* @param vs 
* @param key 参数名称
* @return 值
*/
public static String getProp(VariableSpace vs, String key){
    String value = vs.environmentSubstitute("${"+key+"}");
    if(value.startsWith("${")){
        return "";
    }else{
        return value;
    }
}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:16,代码来源:KettleUtils.java

示例4: getRestUrl

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public String getRestUrl(VariableSpace space) {

    /*
     * Construct the following URL:
     * 
     * http://tenant.namespace.server:port/rest
     */
    StringBuilder url = new StringBuilder();

    if (useSSL) {
      url.append("https://");
    } else {
      url.append("http://");
    }

    url.append(space.environmentSubstitute(tenant)).append('.');
    url.append(space.environmentSubstitute(namespace)).append('.');
    url.append(space.environmentSubstitute(server));

    String realPort = space.environmentSubstitute(port);
    if (StringUtils.isNotEmpty(realPort)) {
      url.append(':').append(realPort);
    }

    url.append("/rest");

    return url.toString();
  }
 
开发者ID:mattcasters,项目名称:pdi-hcp-plugin,代码行数:29,代码来源:HCPConnection.java

示例5: buildFilename

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
/**
 * Builds a filename for a temporary file  The filename is in tableName_date_time_stepnr_partnr_splitnr.gz format
 *
 * @param space       The variables currently set
 * @param stepNumber  The step number.  Used when multiple copies of the step are started.
 * @param partNumber  The partition number.  Used when the transformation is executed clustered, the number of the
 *                    partition.
 * @param splitNumber The split number.  Used when the file is split into multiple chunks.
 * @return The filename to use
 */
public String buildFilename( VariableSpace space, int stepNumber, String partNumber,
                             int splitNumber ) {
  SimpleDateFormat daf = new SimpleDateFormat();

  // Replace possible environment variables...
  String realWorkDirectory = space.environmentSubstitute( workDirectory );

  //Files are always gzipped
  String extension = ".gz";

  StringBuilder returnValue = new StringBuilder( realWorkDirectory );
  if ( !realWorkDirectory.endsWith( "/" ) && !realWorkDirectory.endsWith( "\\" ) ) {
    returnValue.append( Const.FILE_SEPARATOR );
  }

  returnValue.append( targetTable ).append( "_" );

  if ( fileDate == null ) {

    Date now = new Date();

    daf.applyPattern( "yyyyMMdd_HHmmss" );
    fileDate = daf.format( now );
  }
  returnValue.append( fileDate ).append( "_" );

  returnValue.append( stepNumber ).append( "_" );
  returnValue.append( partNumber ).append( "_" );
  returnValue.append( splitNumber );
  returnValue.append( extension );

  return returnValue.toString();
}
 
开发者ID:inquidia,项目名称:PentahoSnowflakePlugin,代码行数:44,代码来源:SnowflakeBulkLoaderMeta.java

示例6: getRequiredFields

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
/**
 * Gets a list of fields in the database table
 * @param space The variable space
 * @return The metadata about the fields in the table.
 * @throws KettleException
 */
public RowMetaInterface getRequiredFields( VariableSpace space ) throws KettleException {
  String realTableName = space.environmentSubstitute( targetTable );
  String realSchemaName = space.environmentSubstitute( targetSchema );

  if ( databaseMeta != null ) {
    Database db = new Database( loggingObject, databaseMeta );
    try {
      db.connect();

      if ( !Const.isEmpty( realTableName ) ) {
        String schemaTable = databaseMeta.getQuotedSchemaTableCombination( realSchemaName, realTableName );

        // Check if this table exists...
        if ( db.checkTableExists( schemaTable ) ) {
          return db.getTableFields( schemaTable );
        } else {
          throw new KettleException( BaseMessages.getString( PKG, "SnowflakeBulkLoaderMeta.Exception.TableNotFound" ) );
        }
      } else {
        throw new KettleException( BaseMessages.getString( PKG, "SnowflakeBulkLoaderMeta.Exception.TableNotSpecified" ) );
      }
    } catch ( Exception e ) {
      throw new KettleException(
        BaseMessages.getString( PKG, "SnowflakeBulkLoaderMeta.Exception.ErrorGettingFields" ), e );
    } finally {
      db.disconnect();
    }
  } else {
    throw new KettleException( BaseMessages.getString( PKG, "SnowflakeBulkLoaderMeta.Exception.ConnectionNotDefined" ) );
  }

}
 
开发者ID:inquidia,项目名称:PentahoSnowflakePlugin,代码行数:39,代码来源:SnowflakeBulkLoaderMeta.java

示例7: getFields

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void getFields(RowMetaInterface inputRowMeta, String name,
    RowMetaInterface[] info, StepMeta nextStep, VariableSpace space,
    Repository repository, IMetaStore metaStore) throws KettleStepException {
  // Output field (String)
  ValueMetaInterface v = new ValueMetaDom(
      space.environmentSubstitute(getResultfieldname()),
      ValueMetaDom.TYPE_DOM);
  v.setOrigin(name);
  inputRowMeta.addValueMeta(v);
}
 
开发者ID:griddynamics,项目名称:xml-dom-kettle-etl-plugin,代码行数:11,代码来源:DOMXsltMeta.java

示例8: getFields

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void getFields(RowMetaInterface r, String name, RowMetaInterface info[], StepMeta nextStep, VariableSpace space) throws KettleStepException {
   if(StringUtils.isNotBlank(this.getIdOutField()) ){ 
     ValueMetaInterface valueMeta = new ValueMeta(space.environmentSubstitute(this.getIdOutField()), ValueMetaInterface.TYPE_STRING);
     valueMeta.setOrigin(name);
     //add if doesn't exist
     if(!r.exists(valueMeta)){
       r.addValueMeta(valueMeta);  
     }
   }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:ElasticSearchBulkMeta.java

示例9: getFields

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep,
                       VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
  // change the case insensitive flag too

  if ( outputType.equalsIgnoreCase( "field" ) ) {
    ValueMetaInterface v = new ValueMeta( space.environmentSubstitute( outputFieldName ), ValueMetaInterface.TYPE_STRING );
    v.setOrigin( name );
    row.addValueMeta( v );
  }
}
 
开发者ID:cdeptula,项目名称:TokenReplacementPlugin,代码行数:11,代码来源:TokenReplacementMeta.java

示例10: validate

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public boolean validate(CheckResultSourceInterface source, String propertyName, List<CheckResultInterface> remarks,
    ValidatorContext context)
{

  String filename = ValidatorUtils.getValueAsString(source, propertyName);
  VariableSpace variableSpace = getVariableSpace(source, propertyName, remarks, context);
  boolean failIfExists = getFailIfExists(source, propertyName, remarks, context);

  if (null == variableSpace)
  {
    return false;
  }

  String realFileName = variableSpace.environmentSubstitute(filename);
  FileObject fileObject = null;
  try
  {
    fileObject = KettleVFS.getFileObject(realFileName, variableSpace);

    if (fileObject.exists() && failIfExists)
    {
      JobEntryValidatorUtils.addFailureRemark(source, propertyName, VALIDATOR_NAME, remarks, JobEntryValidatorUtils
          .getLevelOnFail(context, VALIDATOR_NAME));
      return false;
    }
    try
    {
      fileObject.close(); // Just being paranoid
    } catch (IOException ignored)
    {
    }
  } catch (Exception e)
  {
    JobEntryValidatorUtils.addExceptionRemark(source, propertyName, VALIDATOR_NAME, remarks, e);
    return false;
  }
  return true;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:39,代码来源:FileDoesNotExistValidator.java

示例11: getRequiredFields

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public RowMetaInterface getRequiredFields(VariableSpace space)
    throws KettleException {
  String realTableName = space.environmentSubstitute(tableName);
  String realSchemaName = space.environmentSubstitute(schemaName);

  if (databaseMeta != null) {
    Database db = new Database(loggingObject, databaseMeta);
    try {
      db.connect();

      if (!Const.isEmpty(realTableName)) {
        String schemaTable = databaseMeta.getQuotedSchemaTableCombination(
            realSchemaName, realTableName);

        // Check if this table exists...
        if (db.checkTableExists(schemaTable)) {
          return db.getTableFields(schemaTable);
        } else {
          throw new KettleException(BaseMessages.getString(PKG,
              "LucidDBStreamingLoaderMeta.Exception.TableNotFound"));
        }
      } else {
        throw new KettleException(BaseMessages.getString(PKG,
            "LucidDBStreamingLoaderMeta.Exception.TableNotSpecified"));
      }
    } catch (Exception e) {
      throw new KettleException(BaseMessages.getString(PKG,
          "LucidDBStreamingLoaderMeta.Exception.ErrorGettingFields"), e);
    } finally {
      db.disconnect();
    }
  } else {
    throw new KettleException(BaseMessages.getString(PKG,
        "LucidDBStreamingLoaderMeta.Exception.ConnectionNotDefined"));
  }

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

示例12: validate

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public boolean validate(CheckResultSourceInterface source, String propertyName, List<CheckResultInterface> remarks,
    ValidatorContext context)
{

  String filename = ValidatorUtils.getValueAsString(source, propertyName);
  VariableSpace variableSpace = getVariableSpace(source, propertyName, remarks, context);
  boolean failIfDoesNotExist = getFailIfDoesNotExist(source, propertyName, remarks, context);

  if (null == variableSpace)
  {
    return false;
  }

  String realFileName = variableSpace.environmentSubstitute(filename);
  FileObject fileObject = null;
  try
  {
    fileObject = KettleVFS.getFileObject(realFileName);
    if (fileObject == null || (fileObject != null && !fileObject.exists() && failIfDoesNotExist))
    {
      JobEntryValidatorUtils.addFailureRemark(source, propertyName, VALIDATOR_NAME, remarks, JobEntryValidatorUtils
          .getLevelOnFail(context, VALIDATOR_NAME));
      return false;
    }
    try
    {
      fileObject.close(); // Just being paranoid
    } catch (IOException ignored)
    {
    }
  } catch (Exception e)
  {
    JobEntryValidatorUtils.addExceptionRemark(source, propertyName, VALIDATOR_NAME, remarks, e);
    return false;
  }
  return true;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:38,代码来源:FileExistsValidator.java

示例13: getFields

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface info[], StepMeta nextStep, VariableSpace space) throws KettleStepException
{    	
       // Output field (String)
	 if (!Const.isEmpty(resultfieldname))
     {
		 ValueMetaInterface v = new ValueMeta(space.environmentSubstitute(resultfieldname), ValueMeta.TYPE_BOOLEAN);
		 v.setOrigin(name);
		 inputRowMeta.addValueMeta(v);
     }
   }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:ColumnExistsMeta.java

示例14: getFields

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void getFields(RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException 
   {
   	// Just add the returning key field...
	if (returningGeneratedKeys && generatedKeyField!=null && generatedKeyField.length()>0)
	{
		ValueMetaInterface key = new ValueMeta(space.environmentSubstitute(generatedKeyField), ValueMetaInterface.TYPE_INTEGER);
		key.setOrigin(origin);
		row.addValueMeta(key);
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:TableOutputMeta.java

示例15: getFields

import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface info[], StepMeta nextStep, VariableSpace space) throws KettleStepException
{   
       if (!Const.isEmpty(linenumfield))
       {
       	
		ValueMetaInterface v = new ValueMeta(space.environmentSubstitute(linenumfield), ValueMeta.TYPE_INTEGER);
		v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
		v.setOrigin(name);
		inputRowMeta.addValueMeta(v);
       }
 }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:12,代码来源:SampleRowsMeta.java


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