本文整理汇总了Java中org.pentaho.di.core.variables.VariableSpace.setVariable方法的典型用法代码示例。如果您正苦于以下问题:Java VariableSpace.setVariable方法的具体用法?Java VariableSpace.setVariable怎么用?Java VariableSpace.setVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.variables.VariableSpace
的用法示例。
在下文中一共展示了VariableSpace.setVariable方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetUrl
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
@Test
public void testGetUrl() {
VariableSpace space = new Variables();
space.setVariable("SERVER", "hcpdemo.com");
space.setVariable("PORT", "8000");
space.setVariable("NAMESPACE", "hcp-demo");
space.setVariable("TENANT", "pentaho");
HCPConnection connection = new HCPConnection();
connection.setServer("${SERVER}");
connection.setPort("${PORT}");
connection.setNamespace("${NAMESPACE}");
connection.setTenant("${TENANT}");
String restUrl = connection.getRestUrl(space);
assertEquals("http://pentaho.hcp-demo.hcpdemo.com:8000/rest", restUrl);
}
示例2: setInternalKettleVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
/**
* This method sets various internal kettle variables that can be used by
* the transformation.
*/
public void setInternalKettleVariables(VariableSpace var) {
setInternalFilenameKettleVariables(var);
setInternalNameKettleVariable(var);
// The name of the directory in the repository
var.setVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, directory != null ? directory.getPath() : ""); //$NON-NLS-1$
// Undefine the transformation specific variables:
// transformations can't run jobs, so if you use these they are 99.99%
// wrong.
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY, null);
}
示例3: setInternalFilenameKettleVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
private void setInternalFilenameKettleVariables(VariableSpace var) {
if (filename != null) // we have a filename that's defined.
{
try {
FileObject fileObject = KettleVFS.getFileObject(filename, var);
FileName fileName = fileObject.getName();
// The filename of the job
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, fileName.getBaseName());
// The directory of the job
FileName fileDir = fileName.getParent();
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, fileDir.getURI());
} catch (Exception e) {
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "");
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, "");
}
} else {
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, ""); //$NON-NLS-1$
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, ""); //$NON-NLS-1$
}
}
示例4: setInternalKettleVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
/**
* This method sets various internal kettle variables that can be used by
* the transformation.
*/
public void setInternalKettleVariables(VariableSpace var) {
if (filename != null) // we have a filename that's defined.
{
try {
FileObject fileObject = KettleVFS.getFileObject(filename);
FileName fileName = fileObject.getName();
// The filename of the transformation
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, fileName.getBaseName());
// The directory of the transformation
FileName fileDir = fileName.getParent();
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, fileDir.getURI());
} catch (IOException e) {
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "");
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, "");
}
} else {
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, ""); //$NON-NLS-1$
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, ""); //$NON-NLS-1$
}
// The name of the job
var.setVariable(Const.INTERNAL_VARIABLE_JOB_NAME, Const.NVL(name, "")); //$NON-NLS-1$
// The name of the directory in the repository
var.setVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, directory != null ? directory.getPath() : ""); //$NON-NLS-1$
// Undefine the transformation specific variables:
// transformations can't run jobs, so if you use these they are 99.99%
// wrong.
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY, null);
}
示例5: setParametersAsVariablesInUI
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void setParametersAsVariablesInUI(NamedParams namedParameters, VariableSpace space) {
for (String param : namedParameters.listParameters()) {
try {
space.setVariable(param, Const.NVL(namedParameters.getParameterValue(param), Const.NVL(namedParameters.getParameterDefault(param), Const.NVL(space.getVariable(param), ""))));
}
catch(Exception e) {
// ignore this
}
}
}
示例6: setInternalKettleVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void setInternalKettleVariables(VariableSpace var)
{
setInternalFilenameKettleVariables(var);
setInternalNameKettleVariable(var);
// The name of the directory in the repository
//
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY, directory!=null?directory.getPath():"");
// Here we don't remove the job specific parameters, as they may come in handy.
//
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "Parent Job File Directory"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, "Parent Job Filename"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_NAME)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_NAME, "Parent Job Name"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, "Parent Job Repository Directory"); //$NON-NLS-1$
}
}
示例7: setInternalFilenameKettleVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
private void setInternalFilenameKettleVariables(VariableSpace var) {
// If we have a filename that's defined, set variables. If not, clear them.
//
if (!Const.isEmpty(filename))
{
try {
FileObject fileObject = KettleVFS.getFileObject(filename, var);
FileName fileName = fileObject.getName();
// The filename of the transformation
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, fileName.getBaseName());
// The directory of the transformation
FileName fileDir = fileName.getParent();
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, fileDir.getURI());
} catch (KettleFileException e) {
log.logError("Unexpected error setting internal filename variables!", e);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, "");
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, "");
}
} else {
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, "");
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, "");
}
}
示例8: setParametersAsVariablesInUI
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void setParametersAsVariablesInUI(NamedParams namedParameters, VariableSpace space) {
for (String param : namedParameters.listParameters()) {
try {
space.setVariable(param, Const.NVL(namedParameters.getParameterValue(param), Const.NVL(namedParameters
.getParameterDefault(param), Const.NVL(space.getVariable(param), ""))));
} catch (Exception e) {
// ignore this
}
}
}
示例9: setInternalKettleVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void setInternalKettleVariables(VariableSpace var)
{
if (jobMeta != null && jobMeta.getFilename() !=null) // we have a finename that's defined.
{
try
{
FileObject fileObject = KettleVFS.getFileObject(jobMeta.getFilename());
FileName fileName = fileObject.getName();
// The filename of the transformation
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, fileName.getBaseName());
// The directory of the transformation
FileName fileDir = fileName.getParent();
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, fileDir.getURI());
}
catch(IOException e)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "");
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, "");
}
}
else
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, ""); //$NON-NLS-1$
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, ""); //$NON-NLS-1$
}
// The name of the job
var.setVariable(Const.INTERNAL_VARIABLE_JOB_NAME, Const.NVL(jobMeta.getName(), "")); //$NON-NLS-1$
// The name of the directory in the repository
var.setVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, jobMeta.getDirectory() != null ? jobMeta.getDirectory().getPath() : ""); //$NON-NLS-1$
// Undefine the transformation specific variables
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY, null);
}
示例10: setInternalKettleVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void setInternalKettleVariables(VariableSpace var)
{
if (!Const.isEmpty(filename)) // we have a finename that's defined.
{
try
{
FileObject fileObject = KettleVFS.getFileObject(filename);
FileName fileName = fileObject.getName();
// The filename of the transformation
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, fileName.getBaseName());
// The directory of the transformation
FileName fileDir = fileName.getParent();
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, fileDir.getURI());
}
catch(IOException e)
{
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, "");
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, "");
}
}
else
{
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, "");
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, "");
}
// The name of the transformation
//
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_NAME, Const.NVL(name, ""));
// The name of the directory in the repository
//
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY, directory!=null?directory.getPath():"");
// Here we don't remove the job specific parameters, as they may come in handy.
//
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "Parent Job File Directory"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, "Parent Job Filename"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_NAME)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_NAME, "Parent Job Name"); //$NON-NLS-1$
}
if (var.getVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY)==null)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, "Parent Job Repository Directory"); //$NON-NLS-1$
}
}
示例11: setInternalKettleVariables
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
public void setInternalKettleVariables(VariableSpace var)
{
if (jobMeta != null && jobMeta.getFilename() !=null) // we have a finename that's defined.
{
try
{
FileObject fileObject = KettleVFS.getFileObject(jobMeta.getFilename(), this);
FileName fileName = fileObject.getName();
// The filename of the transformation
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, fileName.getBaseName());
// The directory of the transformation
FileName fileDir = fileName.getParent();
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, fileDir.getURI());
}
catch(Exception e)
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "");
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, "");
}
}
else
{
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, ""); //$NON-NLS-1$
var.setVariable(Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, ""); //$NON-NLS-1$
}
// The name of the job
var.setVariable(Const.INTERNAL_VARIABLE_JOB_NAME, Const.NVL(jobMeta.getName(), "")); //$NON-NLS-1$
// The name of the directory in the repository
var.setVariable(Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, jobMeta.getRepositoryDirectory() != null ? jobMeta.getRepositoryDirectory().getPath() : ""); //$NON-NLS-1$
// Undefine the transformation specific variables
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_NAME, null);
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY, null);
}
示例12: setInternalNameKettleVariable
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
private void setInternalNameKettleVariable(VariableSpace var) {
// The name of the job
var.setVariable(Const.INTERNAL_VARIABLE_JOB_NAME, Const.NVL(name, "")); //$NON-NLS-1$
}
示例13: setInternalNameKettleVariable
import org.pentaho.di.core.variables.VariableSpace; //导入方法依赖的package包/类
private void setInternalNameKettleVariable(VariableSpace var) {
// The name of the transformation
//
var.setVariable(Const.INTERNAL_VARIABLE_TRANSFORMATION_NAME, Const.NVL(name, ""));
}