本文整理汇总了Java中org.pentaho.di.repository.RepositoryDirectoryInterface类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryDirectoryInterface类的具体用法?Java RepositoryDirectoryInterface怎么用?Java RepositoryDirectoryInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryDirectoryInterface类属于org.pentaho.di.repository包,在下文中一共展示了RepositoryDirectoryInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDirectory
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
/**
* 获取资源库所有目录信息
*
* @param rdi
* @param list
*/
private List<?> getDirectory(RepositoryDirectoryInterface rdi,
List<KettleTree> list) {
try {
RepositoryDirectoryInterface tree = repo
.loadRepositoryDirectoryTree().findDirectory(
rdi.getObjectId());
for (int i = 0; i < rdi.getNrSubdirectories(); i++) {
RepositoryDirectory subTree = tree.getSubdirectory(i);
KettleTree d = new KettleTree();
d.setId(subTree.getObjectId().toString());
d.setpId(rdi.getObjectId().toString());
d.setName(subTree.getName());
d.setDir(subTree.getPath());
d.setaId(subTree.getObjectId().toString());
d.setClick("false");
d.setOpen("false");
d.setIsParent("true");
d.setType("dir");
list.add(d);
}
} catch (Exception e) {
}
return list;
}
示例2: getOrMakeDirectory
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
/**
* 获取或创建目录 <br/>
* @author jingma
* @param parentDirectory 父级目录
* @param directoryName 要创建的目录
* @return
* @throws KettleException
* @since JDK 1.6
*/
public static RepositoryDirectoryInterface getOrMakeDirectory(String parentDirectory,String directoryName) throws KettleException {
RepositoryDirectoryInterface parent = repository.findDirectory(parentDirectory);
if(StringUtil.isBlank(parentDirectory)){
parent = repository.findDirectory("/");
}
if(StringUtil.isNotBlank(directoryName)){
RepositoryDirectoryInterface dir = repository.findDirectory(parentDirectory+"/"+directoryName);
if(dir==null){
return repository.createRepositoryDirectory(parent, directoryName);
}else{
return dir;
}
}else{
return parent;
}
}
示例3: makeDirs
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
/**
* <br/>
* @author jingma
* @param directoryName
* @return
* @throws KettleException
*/
public static RepositoryDirectoryInterface makeDirs(String directoryName) throws KettleException {
if(StringUtil.isNotBlank(directoryName)){
String parentDirectory = "";
String[] dirArr = directoryName.replace("\\", "/").split("/");
for(String dirStr:dirArr){
try {
if(StringUtil.isNotBlank(dirStr)){
RepositoryDirectoryInterface p = getOrMakeDirectory(parentDirectory, dirStr);
parentDirectory = p.getPath();
}
} catch (Exception e) {
log.error("创建目录失败:"+directoryName+","+parentDirectory+","+dirStr, e);
}
}
return getOrMakeDirectory(parentDirectory,null);
}else{
return null;
}
}
示例4: 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();
}
}
示例5: displaydirectoryList
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
private void displaydirectoryList() {
try {
if (repository==null) {
throw new KettleException(BaseMessages.getString(PKG, "GetRepositoryNames.Exception.NotConnectedToRepository"));
}
SelectDirectoryDialog sdd = new SelectDirectoryDialog(shell, SWT.NONE, repository);
RepositoryDirectoryInterface rd = sdd.open();
if (rd != null) {
wDirectory.setText(rd.getPath());
}
} catch (Exception e) {
new ErrorDialog(shell,
BaseMessages.getString(PKG, "System.Dialog.Error.Title"),
BaseMessages.getString(PKG, "GetRepositoryNames.ErrorGettingFolderds.DialogMessage"), e
);
}
}
示例6: getJobsWithIDList
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
public String[] getJobsWithIDList(List<Object[]> list, RowMetaInterface rowMeta) throws KettleException
{
String[] jobList = new String[list.size()];
for (int i=0;i<list.size();i++)
{
long id_job = rowMeta.getInteger( list.get(i), quote(KettleDatabaseRepository.FIELD_JOB_ID_JOB), -1L);
if (id_job > 0)
{
RowMetaAndData jobRow = getJob(new LongObjectId(id_job));
if (jobRow!=null)
{
String jobName = jobRow.getString(KettleDatabaseRepository.FIELD_JOB_NAME, "<name not found>");
long id_directory = jobRow.getInteger(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY, -1L);
RepositoryDirectoryInterface dir = repository.loadRepositoryDirectoryTree().findDirectory(new LongObjectId(id_directory)); // always reload the directory tree!
jobList[i]=dir.getPathObjectCombination(jobName);
}
}
}
return jobList;
}
示例7: getTransformationsWithIDList
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
public String[] getTransformationsWithIDList(List<Object[]> list, RowMetaInterface rowMeta) throws KettleException
{
String[] transList = new String[list.size()];
for (int i=0;i<list.size();i++)
{
long id_transformation = rowMeta.getInteger( list.get(i), quote(KettleDatabaseRepository.FIELD_TRANSFORMATION_ID_TRANSFORMATION), -1L);
if (id_transformation > 0)
{
RowMetaAndData transRow = getTransformation(new LongObjectId(id_transformation));
if (transRow!=null)
{
String transName = transRow.getString(KettleDatabaseRepository.FIELD_TRANSFORMATION_NAME, "<name not found>");
long id_directory = transRow.getInteger(KettleDatabaseRepository.FIELD_TRANSFORMATION_ID_DIRECTORY, -1L);
RepositoryDirectoryInterface dir = repository.loadRepositoryDirectoryTree().findDirectory(new LongObjectId(id_directory));
transList[i]=dir.getPathObjectCombination(transName);
}
}
}
return transList;
}
示例8: insertDirectory
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
private synchronized ObjectId insertDirectory(ObjectId id_directory_parent, RepositoryDirectoryInterface dir)
throws KettleException {
ObjectId id = repository.connectionDelegate.getNextDirectoryID();
String tablename = KettleDatabaseRepository.TABLE_R_DIRECTORY;
RowMetaAndData table = new RowMetaAndData();
table.addValue(
new ValueMeta(KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY, ValueMetaInterface.TYPE_INTEGER), id);
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY_PARENT,
ValueMetaInterface.TYPE_INTEGER), id_directory_parent);
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_DIRECTORY_DIRECTORY_NAME,
ValueMetaInterface.TYPE_STRING), dir.getName());
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), tablename);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:21,代码来源:KettleDatabaseRepositoryDirectoryDelegate.java
示例9: saveRepositoryDirectory
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
public void saveRepositoryDirectory(RepositoryDirectoryInterface dir) throws KettleException {
try {
ObjectId id_directory_parent = null;
if (dir.getParent() != null) {
id_directory_parent = dir.getParent().getObjectId();
}
dir.setObjectId(insertDirectory(id_directory_parent, dir));
log.logDetailed("New id of directory = " + dir.getObjectId());
repository.commit();
} catch (Exception e) {
throw new KettleException("Unable to save directory [" + dir + "] in the repository", e);
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:17,代码来源:KettleDatabaseRepositoryDirectoryDelegate.java
示例10: delRepositoryDirectory
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
public void delRepositoryDirectory(RepositoryDirectoryInterface dir, boolean deleteNonEmptyFolder) throws KettleException {
try {
if (!deleteNonEmptyFolder) {
String trans[] = repository.getTransformationNames(dir.getObjectId(), false); // TODO : include or exclude deleted objects?
String jobs[] = repository.getJobNames(dir.getObjectId(), false); // TODO : include or exclude deleted objects?
ObjectId[] subDirectories = repository.getSubDirectoryIDs(dir.getObjectId());
if (trans.length == 0 && jobs.length == 0 && subDirectories.length == 0) {
repository.directoryDelegate.deleteDirectory(dir.getObjectId());
repository.commit();
} else {
throw new KettleException("This directory is not empty!");
}
} else {
repository.directoryDelegate.deleteDirectory(dir);
repository.commit();
}
} catch (Exception e) {
throw new KettleException("Unexpected error deleting repository directory:", e);
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:21,代码来源:KettleDatabaseRepositoryDirectoryDelegate.java
示例11: refresh
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
/**
* Synchronize this folder with the back-end
*
*
*/
public void refresh() {
try {
kidElementCache = null;
kidDirectoryCache = null;
if(this == getRootDirectory()) {
RepositoryDirectoryInterface localRoot = rep.findDirectory(rd.getObjectId());
rd = localRoot;
//Rebuild caches
fireCollectionChanged();
} else {
getRootDirectory().refresh();
}
} catch (Exception e) {
// TODO: Better error handling
e.printStackTrace();
}
}
示例12: calcDirectoryName
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
private String calcDirectoryName(RepositoryDirectoryInterface dir) {
StringBuilder directory = new StringBuilder();
String baseDir = repositoryMeta.getBaseDirectory();
baseDir = Const.replace(baseDir, "\\", "/");
directory.append(baseDir);
if (!baseDir.endsWith("/")) {
directory.append("/");
}
if (dir!=null) {
String path = calcRelativeElementDirectory(dir);
if (path.startsWith("/")) {
directory.append(path.substring(1));
} else {
directory.append(path);
}
if (!path.endsWith("/")) {
directory.append("/");
}
}
return directory.toString();
}
示例13: loadTransformation
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
private void loadTransformation() throws KettleException {
switch (specificationMethod) {
case FILENAME:
loadFileTrans(wFilename.getText());
break;
case REPOSITORY_BY_NAME:
String realDirectory = transMeta.environmentSubstitute(wDirectory.getText());
String realTransname = transMeta.environmentSubstitute(wTransname.getText());
if (Const.isEmpty(realDirectory) || Const.isEmpty(realTransname)) {
throw new KettleException(BaseMessages.getString(PKG, "MetaInjectDialog.Exception.NoValidMappingDetailsFound"));
}
RepositoryDirectoryInterface repdir = repository.findDirectory(realDirectory);
if (repdir == null) {
throw new KettleException(BaseMessages.getString(PKG, "MetaInjectDialog.Exception.UnableToFindRepositoryDirectory)"));
}
loadRepositoryTrans(realTransname, repdir);
break;
case REPOSITORY_BY_REFERENCE:
injectTransMeta = repository.loadTransformation(referenceObjectId, null); // load the last version
injectTransMeta.clearChanged();
break;
}
}
示例14: createRepositoryDirectory
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
public RepositoryDirectoryInterface createRepositoryDirectory(RepositoryDirectoryInterface parentDirectory, String directoryPath) throws KettleException {
String folder = calcDirectoryName(parentDirectory);
String newFolder = folder;
if (folder.endsWith("/")) newFolder+=directoryPath; else newFolder+="/"+directoryPath;
FileObject parent = KettleVFS.getFileObject(newFolder);
try {
parent.createFolder();
} catch (FileSystemException e) {
throw new KettleException("Unable to create folder "+newFolder, e);
}
// Incremental change of the directory structure...
//
RepositoryDirectory newDir = new RepositoryDirectory(parentDirectory, directoryPath);
parentDirectory.addSubdirectory(newDir);
newDir.setObjectId(new StringObjectId(newDir.toString()));
return newDir;
}
示例15: saveRepositoryDirectory
import org.pentaho.di.repository.RepositoryDirectoryInterface; //导入依赖的package包/类
public void saveRepositoryDirectory(RepositoryDirectoryInterface dir) throws KettleException {
try
{
String filename = calcDirectoryName(dir);
ObjectId objectId = new StringObjectId(calcRelativeElementDirectory(dir));
FileObject fileObject = KettleVFS.getFileObject(filename);
fileObject.createFolder(); // also create parents
dir.setObjectId(objectId);
log.logDetailed("New id of directory = "+dir.getObjectId());
}
catch(Exception e)
{
throw new KettleException("Unable to save directory ["+dir+"] in the repository", e);
}
}