本文整理汇总了Java中org.pentaho.di.repository.RepositoryDirectoryInterface.findDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryDirectoryInterface.findDirectory方法的具体用法?Java RepositoryDirectoryInterface.findDirectory怎么用?Java RepositoryDirectoryInterface.findDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.repository.RepositoryDirectoryInterface
的用法示例。
在下文中一共展示了RepositoryDirectoryInterface.findDirectory方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lookupTransObjectId
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入方法依赖的package包/类
/**
* Try to look up the transObjectId for transformation which are referenced by path
* @param repository The repository to use.
* @throws KettleException
*/
public void lookupTransObjectId( Repository repository ) throws KettleException {
if ( repository == null )
return;
if ( Const.isEmpty( transFilename ) && transObjectId == null && !Const.isEmpty( transRepositoryPath ) ) {
// see if there is a path specified to a repository name
//
String path = "/";
String name = transRepositoryPath;
int lastSlashIndex = name.lastIndexOf( '/' );
if ( lastSlashIndex >= 0 ) {
path = transRepositoryPath.substring( 0, lastSlashIndex + 1 );
name = transRepositoryPath.substring( lastSlashIndex + 1 );
}
RepositoryDirectoryInterface tree = repository.loadRepositoryDirectoryTree();
RepositoryDirectoryInterface rd = tree.findDirectory( path );
if ( rd == null )
rd = tree; // root
ObjectId transformationID = repository.getTransformationID( name, rd );
transObjectId = transformationID == null ? null : transformationID.getId();
}
}
示例2: getDirectoryNames
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入方法依赖的package包/类
public String[] getDirectoryNames(ObjectId id_directory) throws KettleException {
RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
RepositoryDirectoryInterface directory = tree.findDirectory(id_directory);
String[] names = new String[directory.getNrSubdirectories()];
for (int i=0;i<names.length;i++) {
names[i] = directory.getSubdirectory(i).getName();
}
return names;
}
示例3: getJobNames
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入方法依赖的package包/类
public String[] getJobNames(ObjectId id_directory, boolean includeDeleted) throws KettleException {
try {
List<String> list = new ArrayList<String>();
RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
RepositoryDirectoryInterface directory = tree.findDirectory(id_directory);
String folderName = calcDirectoryName(directory);
FileObject folder = KettleVFS.getFileObject(folderName);
for (FileObject child : folder.getChildren()) {
if (child.getType().equals(FileType.FILE)) {
if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
String name = child.getName().getBaseName();
if (name.endsWith(EXT_JOB)) {
String jobName = name.substring(0, name.length()-4);
list.add( jobName );
}
}
}
}
return list.toArray(new String[list.size()]);
}
catch(Exception e) {
throw new KettleException("Unable to get list of transformations names in folder with id : "+id_directory, e);
}
}
示例4: getSubDirectoryIDs
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入方法依赖的package包/类
public ObjectId[] getSubDirectoryIDs(ObjectId id_directory) throws KettleException {
RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
RepositoryDirectoryInterface directory = tree.findDirectory(id_directory);
ObjectId[] objectIds = new ObjectId[directory.getNrSubdirectories()];
for (int i=0;i<objectIds.length;i++) {
objectIds[i] = directory.getSubdirectory(i).getObjectId();
}
return objectIds;
}
示例5: getTransformationNames
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入方法依赖的package包/类
public String[] getTransformationNames(ObjectId id_directory, boolean includeDeleted) throws KettleException {
try {
List<String> list = new ArrayList<String>();
RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
RepositoryDirectoryInterface directory = tree.findDirectory(id_directory);
String folderName = calcDirectoryName(directory);
FileObject folder = KettleVFS.getFileObject(folderName);
for (FileObject child : folder.getChildren()) {
if (child.getType().equals(FileType.FILE)) {
if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
String name = child.getName().getBaseName();
if (name.endsWith(EXT_TRANSFORMATION)) {
String transName = name.substring(0, name.length()-4);
list.add( transName );
}
}
}
}
return list.toArray(new String[list.size()]);
}
catch(Exception e) {
throw new KettleException("Unable to get list of transformations names in folder with id : "+id_directory, e);
}
}
示例6: getTransformationObjects
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入方法依赖的package包/类
public List<RepositoryElementMetaInterface> getTransformationObjects(ObjectId idDirectory, boolean includeDeleted) throws KettleException {
try {
List<RepositoryElementMetaInterface> list = new ArrayList<RepositoryElementMetaInterface>();
RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
RepositoryDirectoryInterface directory = tree.findDirectory(idDirectory);
String folderName = calcDirectoryName(directory);
FileObject folder = KettleVFS.getFileObject(folderName);
for (FileObject child : folder.getChildren()) {
if (child.getType().equals(FileType.FILE)) {
if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
String name = child.getName().getBaseName();
if (name.endsWith(EXT_TRANSFORMATION)) {
String transName = name.substring(0, name.length()-4);
ObjectId id = new StringObjectId(calcObjectId(directory, transName, EXT_TRANSFORMATION));
Date date = new Date(child.getContent().getLastModifiedTime());
list.add( new RepositoryObject(id, transName, directory, "-", date, RepositoryObjectType.TRANSFORMATION, "", false) );
}
}
}
}
return list;
}
catch(Exception e) {
throw new KettleException("Unable to get list of transformations in folder with id : "+idDirectory, e);
}
}
示例7: getJobObjects
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入方法依赖的package包/类
public List<RepositoryElementMetaInterface> getJobObjects(ObjectId id_directory, boolean includeDeleted) throws KettleException {
try {
List<RepositoryElementMetaInterface> list = new ArrayList<RepositoryElementMetaInterface>();
RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
RepositoryDirectoryInterface directory = tree.findDirectory(id_directory);
String folderName = calcDirectoryName(directory);
FileObject folder = KettleVFS.getFileObject(folderName);
for (FileObject child : folder.getChildren()) {
if (child.getType().equals(FileType.FILE)) {
if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
String name = child.getName().getBaseName();
if (name.endsWith(EXT_JOB)) {
String jobName = name.substring(0, name.length()-4);
ObjectId id = new StringObjectId(calcObjectId(directory, jobName, EXT_JOB));
Date date = new Date(child.getContent().getLastModifiedTime());
list.add( new RepositoryObject(id, jobName, directory, "-", date, RepositoryObjectType.JOB, "", false) );
}
}
}
}
return list;
}
catch(Exception e) {
throw new KettleException("Unable to get list of jobs in folder with id : "+id_directory, e);
}
}
示例8: renameRepositoryDirectory
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入方法依赖的package包/类
public ObjectId renameRepositoryDirectory(ObjectId id, RepositoryDirectoryInterface newParentDir, String newName) throws KettleException {
if(newParentDir != null || newName != null) {
try {
// In case of a root object, the ID is the same as the relative filename...
RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
RepositoryDirectoryInterface dir = tree.findDirectory(id);
if(dir == null) {
throw new KettleException("Could not find folder [" + id + "]");
}
// If newName is null, keep the current name
newName = (newName != null) ? newName : dir.getName();
FileObject folder = KettleVFS.getFileObject(dir.getPath());
String newFolderName = null;
if(newParentDir != null) {
FileObject newParentFolder = KettleVFS.getFileObject(newParentDir.getPath());
newFolderName = newParentFolder.toString() + "/" + newName;
} else {
newFolderName = folder.getParent().toString() + "/" + newName;
}
FileObject newFolder = KettleVFS.getFileObject(newFolderName);
folder.moveTo(newFolder);
return new StringObjectId(dir.getObjectId());
}
catch (Exception e) {
throw new KettleException("Unable to rename directory folder to ["+id+"]");
}
}
return(id);
}
示例9: getRepositoryObjects
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入方法依赖的package包/类
private List<RepositoryElementMetaInterface> getRepositoryObjects() throws KettleException {
try {
// The repository is available in the parent transformation metadata
//
Repository repository = getTransMeta().getRepository();
// Get the repository directory tree.
//
RepositoryDirectoryInterface tree = repository.loadRepositoryDirectoryTree();
// Now populate the list...
//
List<RepositoryElementMetaInterface> list = new ArrayList<RepositoryElementMetaInterface>();
// Loop over the directories and add the discovered objects to the list...
//
for (int i=0;i<meta.getDirectory().length;i++) {
RepositoryDirectoryInterface dir = tree.findDirectory(meta.getDirectory()[i]);
if (dir!=null) {
List<RepositoryElementMetaInterface> objects = getRepositoryObjects(repository, dir, meta.getIncludeSubFolders()[i], meta.getNameMask()[i], meta.getExcludeNameMask()[i]);
list.addAll( objects );
}
}
return list;
} catch(Exception e) {
throw new KettleException("Unable to get the list of repository objects from the repository", e);
}
}