本文整理汇总了Java中org.pentaho.di.resource.ResourceDefinition类的典型用法代码示例。如果您正苦于以下问题:Java ResourceDefinition类的具体用法?Java ResourceDefinition怎么用?Java ResourceDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceDefinition类属于org.pentaho.di.resource包,在下文中一共展示了ResourceDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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));
// If the file doesn't exist, forget about this effort too!
//
if (fileObject.exists()) {
// Convert to an absolute path...
//
filename = fileObject.getName().getPath();
return filename;
}
return null;
} catch (Exception e) {
throw new KettleException(e); //$NON-NLS-1$
}
}
示例2: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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$
}
}
示例3: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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$
}
}
示例4: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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...
//
if (!Const.isEmpty(fileName)) {
FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(fileName));
fileName = resourceNamingInterface.nameResource(fileObject.getName().getBaseName(), fileObject.getParent().getName().getPath(), space.toString(), FileNamingType.DATA_FILE);
}
return null;
} catch (Exception e) {
throw new KettleException(e); //$NON-NLS-1$
}
}
示例5: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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!
//
// From : ${Internal.Transformation.Filename.Directory}/../foo/bar.xsd
// To : /home/matt/test/files/foo/bar.xsd
//
if (!Const.isEmpty(xsdFilename)) {
FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(xsdFilename));
xsdFilename = resourceNamingInterface.nameResource(fileObject.getName().getBaseName(), fileObject.getParent().getName().getPath(), space.toString(), FileNamingType.DATA_FILE);
return xsdFilename;
}
return null;
} catch (Exception e) {
throw new KettleException(e); //$NON-NLS-1$
}
}
示例6: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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));
fileName = resourceNamingInterface.nameResource(fileObject.getName().getBaseName(), fileObject.getParent().getName().getPath(), space.toString(), FileNamingType.DATA_FILE);
}
}
return null;
} catch (Exception e) {
throw new KettleException(e); //$NON-NLS-1$
}
}
示例7: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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...
//
if (!Const.isEmpty(filename)) {
FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(filename));
filename = resourceNamingInterface.nameResource(fileObject.getName().getBaseName(), fileObject.getParent().getName().getPath(), space.toString(), FileNamingType.DATA_FILE);
}
return null;
} catch (Exception e) {
throw new KettleException(e); //$NON-NLS-1$
}
}
示例8: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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$
}
}
示例9: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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 (!isFoldernameDynamic) {
for (int i=0;i<folderName.length;i++) {
FileObject fileObject = KettleVFS.getFileObject(space.environmentSubstitute(folderName[i]), space);
folderName[i] = resourceNamingInterface.nameResource(fileObject, space, true);
}
}
return null;
} catch (Exception e) {
throw new KettleException(e); //$NON-NLS-1$
}
}
示例10: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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$
}
}
示例11: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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$
}
}
示例12: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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$
}
}
示例13: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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...
//
// 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$
}
}
示例14: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的package包/类
@Override
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 (!fileinfield) {
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$
}
}
示例15: exportResources
import org.pentaho.di.resource.ResourceDefinition; //导入依赖的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...
//
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$
}
}