use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class JobExecutorDialog method selectRepositoryJob.
private void selectRepositoryJob() {
RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject("*.kjb", log);
try {
if (repositoryObject != null) {
loadRepositoryJob(repositoryObject.getName(), repositoryObject.getRepositoryDirectory());
String path = DialogUtils.getPath(transMeta.getRepositoryDirectory().getPath(), executorJobMeta.getRepositoryDirectory().getPath());
String fullPath = (path.equals("/") ? "/" : path + "/") + executorJobMeta.getName();
wPath.setText(fullPath);
specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME;
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogTitle"), BaseMessages.getString(PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogMessage"), ke);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class JobExecutorDialog method getByReferenceData.
private void getByReferenceData(ObjectId jobObjectId) {
try {
RepositoryObject jobInf = repository.getObjectInformation(jobObjectId, RepositoryObjectType.JOB);
String path = DialogUtils.getPath(transMeta.getRepositoryDirectory().getPath(), jobInf.getRepositoryDirectory().getPath());
String fullPath = Const.NVL(path, "") + "/" + Const.NVL(jobInf.getName(), "");
wPath.setText(fullPath);
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "JobEntryJobDialog.Exception.UnableToReferenceObjectId.Title"), BaseMessages.getString(PKG, "JobEntryJobDialog.Exception.UnableToReferenceObjectId.Message"), e);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class JobEntryJob method getXML.
@Override
public String getXML() {
StringBuilder retval = new StringBuilder(400);
retval.append(super.getXML());
// specificationMethod
//
retval.append(" ").append(XMLHandler.addTagValue("specification_method", specificationMethod == null ? null : specificationMethod.getCode()));
retval.append(" ").append(XMLHandler.addTagValue("job_object_id", jobObjectId == null ? null : jobObjectId.toString()));
//
if (rep != null && jobObjectId != null) {
try {
RepositoryObject objectInformation = rep.getObjectInformation(jobObjectId, RepositoryObjectType.JOB);
if (objectInformation != null) {
jobname = objectInformation.getName();
directory = objectInformation.getRepositoryDirectory().getPath();
}
} catch (KettleException e) {
// Ignore object reference problems. It simply means that the reference is no longer valid.
}
}
if (parentJobMeta != null) {
parentJobMeta.getNamedClusterEmbedManager().registerUrl(filename);
}
retval.append(" ").append(XMLHandler.addTagValue("filename", filename));
retval.append(" ").append(XMLHandler.addTagValue("jobname", jobname));
if (directory != null) {
retval.append(" ").append(XMLHandler.addTagValue("directory", directory));
} else if (directoryPath != null) {
retval.append(" ").append(XMLHandler.addTagValue("directory", directoryPath));
}
retval.append(" ").append(XMLHandler.addTagValue("arg_from_previous", argFromPrevious));
retval.append(" ").append(XMLHandler.addTagValue("params_from_previous", paramsFromPrevious));
retval.append(" ").append(XMLHandler.addTagValue("exec_per_row", execPerRow));
retval.append(" ").append(XMLHandler.addTagValue("set_logfile", setLogfile));
retval.append(" ").append(XMLHandler.addTagValue("logfile", logfile));
retval.append(" ").append(XMLHandler.addTagValue("logext", logext));
retval.append(" ").append(XMLHandler.addTagValue("add_date", addDate));
retval.append(" ").append(XMLHandler.addTagValue("add_time", addTime));
retval.append(" ").append(XMLHandler.addTagValue("loglevel", logFileLevel != null ? logFileLevel.getCode() : DEFAULT_LOG_LEVEL.getCode()));
retval.append(" ").append(XMLHandler.addTagValue("slave_server_name", remoteSlaveServerName));
retval.append(" ").append(XMLHandler.addTagValue("wait_until_finished", waitingToFinish));
retval.append(" ").append(XMLHandler.addTagValue("follow_abort_remote", followingAbortRemotely));
retval.append(" ").append(XMLHandler.addTagValue("expand_remote_job", expandingRemoteJob));
retval.append(" ").append(XMLHandler.addTagValue("create_parent_folder", createParentFolder));
retval.append(" ").append(XMLHandler.addTagValue("pass_export", passingExport));
retval.append(" ").append(XMLHandler.addTagValue("run_configuration", runConfiguration));
if (arguments != null) {
for (int i = 0; i < arguments.length; i++) {
// This is a very very bad way of making an XML file, don't use it (or
// copy it). Sven Boden
retval.append(" ").append(XMLHandler.addTagValue("argument" + i, arguments[i]));
}
}
if (parameters != null) {
retval.append(" ").append(XMLHandler.openTag("parameters"));
retval.append(" ").append(XMLHandler.addTagValue("pass_all_parameters", passingAllParameters));
for (int i = 0; i < parameters.length; i++) {
// This is a better way of making the XML file than the arguments.
retval.append(" ").append(XMLHandler.openTag("parameter"));
retval.append(" ").append(XMLHandler.addTagValue("name", parameters[i]));
retval.append(" ").append(XMLHandler.addTagValue("stream_name", parameterFieldNames[i]));
retval.append(" ").append(XMLHandler.addTagValue("value", parameterValues[i]));
retval.append(" ").append(XMLHandler.closeTag("parameter"));
}
retval.append(" ").append(XMLHandler.closeTag("parameters"));
}
retval.append(" ").append(XMLHandler.addTagValue("set_append_logfile", setAppendLogfile));
return retval.toString();
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class KettleFileRepository method getTransformationObjects.
@Override
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);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class KettleFileRepository method getJobObjects.
@Override
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);
}
}
Aggregations