Search in sources :

Example 21 with RepositoryObject

use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.

the class TransExecutorMeta method getXML.

public String getXML() {
    StringBuilder retval = new StringBuilder(300);
    retval.append("    ").append(XMLHandler.addTagValue("specification_method", specificationMethod == null ? null : specificationMethod.getCode()));
    retval.append("    ").append(XMLHandler.addTagValue("trans_object_id", transObjectId == null ? null : transObjectId.toString()));
    // 
    if (repository != null && transObjectId != null) {
        try {
            RepositoryObject objectInformation = repository.getObjectInformation(transObjectId, RepositoryObjectType.TRANSFORMATION);
            if (objectInformation != null) {
                transName = objectInformation.getName();
                directoryPath = objectInformation.getRepositoryDirectory().getPath();
            }
        } catch (KettleException e) {
        // Ignore object reference problems. It simply means that the reference is no longer valid.
        }
    }
    retval.append("    ").append(XMLHandler.addTagValue("trans_name", transName));
    retval.append("    ").append(XMLHandler.addTagValue("filename", fileName));
    retval.append("    ").append(XMLHandler.addTagValue("directory_path", directoryPath));
    retval.append("    ").append(XMLHandler.addTagValue("group_size", groupSize));
    retval.append("    ").append(XMLHandler.addTagValue("group_field", groupField));
    retval.append("    ").append(XMLHandler.addTagValue("group_time", groupTime));
    // Add the mapping parameters too
    // 
    retval.append("      ").append(parameters.getXML()).append(Const.CR);
    // The output side...
    // 
    retval.append("    ").append(XMLHandler.addTagValue(F_EXECUTION_RESULT_TARGET_STEP, executionResultTargetStepMeta == null ? null : executionResultTargetStepMeta.getName()));
    retval.append("    ").append(XMLHandler.addTagValue("execution_time_field", executionTimeField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_result_field", executionResultField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_errors_field", executionNrErrorsField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_read_field", executionLinesReadField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_written_field", executionLinesWrittenField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_input_field", executionLinesInputField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_output_field", executionLinesOutputField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_rejected_field", executionLinesRejectedField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_updated_field", executionLinesUpdatedField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_deleted_field", executionLinesDeletedField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_files_retrieved_field", executionFilesRetrievedField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_exit_status_field", executionExitStatusField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_log_text_field", executionLogTextField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_log_channelid_field", executionLogChannelIdField));
    retval.append("    ").append(XMLHandler.addTagValue("result_rows_target_step", outputRowsSourceStepMeta == null ? null : outputRowsSourceStepMeta.getName()));
    for (int i = 0; i < outputRowsField.length; i++) {
        retval.append("      ").append(XMLHandler.openTag("result_rows_field"));
        retval.append(XMLHandler.addTagValue("name", outputRowsField[i], false));
        retval.append(XMLHandler.addTagValue("type", ValueMetaFactory.getValueMetaName(outputRowsType[i]), false));
        retval.append(XMLHandler.addTagValue("length", outputRowsLength[i], false));
        retval.append(XMLHandler.addTagValue("precision", outputRowsPrecision[i], false));
        retval.append(XMLHandler.closeTag("result_rows_field")).append(Const.CR);
    }
    retval.append("    ").append(XMLHandler.addTagValue(F_RESULT_FILE_TARGET_STEP, resultFilesTargetStepMeta == null ? null : resultFilesTargetStepMeta.getName()));
    retval.append("    ").append(XMLHandler.addTagValue("result_files_file_name_field", resultFilesFileNameField));
    retval.append("    ").append(XMLHandler.addTagValue(F_EXECUTOR_OUTPUT_STEP, executorsOutputStepMeta == null ? null : executorsOutputStepMeta.getName()));
    return retval.toString();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) RepositoryObject(org.pentaho.di.repository.RepositoryObject)

Example 22 with RepositoryObject

use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.

the class SingleThreaderMeta method getXML.

public String getXML() {
    StringBuilder retval = new StringBuilder(300);
    retval.append("    ").append(XMLHandler.addTagValue("specification_method", specificationMethod == null ? null : specificationMethod.getCode()));
    retval.append("    ").append(XMLHandler.addTagValue("trans_object_id", transObjectId == null ? null : transObjectId.toString()));
    // 
    if (repository != null && transObjectId != null) {
        try {
            RepositoryObject objectInformation = repository.getObjectInformation(transObjectId, RepositoryObjectType.TRANSFORMATION);
            if (objectInformation != null) {
                transName = objectInformation.getName();
                directoryPath = objectInformation.getRepositoryDirectory().getPath();
            }
        } catch (KettleException e) {
        // Ignore object reference problems. It simply means that the reference is no longer valid.
        }
    }
    retval.append("    ").append(XMLHandler.addTagValue("trans_name", transName));
    retval.append("    ").append(XMLHandler.addTagValue("filename", fileName));
    retval.append("    ").append(XMLHandler.addTagValue("directory_path", directoryPath));
    retval.append("    ").append(XMLHandler.addTagValue("batch_size", batchSize));
    retval.append("    ").append(XMLHandler.addTagValue("batch_time", batchTime));
    retval.append("    ").append(XMLHandler.addTagValue("inject_step", injectStep));
    retval.append("    ").append(XMLHandler.addTagValue("retrieve_step", retrieveStep));
    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("value", parameterValues[i]));
            retval.append("            ").append(XMLHandler.closeTag("parameter"));
        }
        retval.append("      ").append(XMLHandler.closeTag("parameters"));
    }
    return retval.toString();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) RepositoryObject(org.pentaho.di.repository.RepositoryObject)

Example 23 with RepositoryObject

use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.

the class MappingMeta method getXML.

public String getXML() {
    StringBuilder retval = new StringBuilder(300);
    retval.append("    ").append(XMLHandler.addTagValue("specification_method", specificationMethod == null ? null : specificationMethod.getCode()));
    retval.append("    ").append(XMLHandler.addTagValue("trans_object_id", transObjectId == null ? null : transObjectId.toString()));
    // 
    if (repository != null && transObjectId != null) {
        try {
            RepositoryObject objectInformation = repository.getObjectInformation(transObjectId, RepositoryObjectType.TRANSFORMATION);
            if (objectInformation != null) {
                transName = objectInformation.getName();
                directoryPath = objectInformation.getRepositoryDirectory().getPath();
            }
        } catch (KettleException e) {
        // Ignore object reference problems. It simply means that the reference is no longer valid.
        }
    }
    retval.append("    ").append(XMLHandler.addTagValue("trans_name", transName));
    retval.append("    ").append(XMLHandler.addTagValue("filename", fileName));
    retval.append("    ").append(XMLHandler.addTagValue("directory_path", directoryPath));
    retval.append("    ").append(XMLHandler.openTag("mappings")).append(Const.CR);
    retval.append("      ").append(XMLHandler.openTag("input")).append(Const.CR);
    for (int i = 0; i < inputMappings.size(); i++) {
        retval.append(inputMappings.get(i).getXML());
    }
    retval.append("      ").append(XMLHandler.closeTag("input")).append(Const.CR);
    retval.append("      ").append(XMLHandler.openTag("output")).append(Const.CR);
    for (int i = 0; i < outputMappings.size(); i++) {
        retval.append(outputMappings.get(i).getXML());
    }
    retval.append("      ").append(XMLHandler.closeTag("output")).append(Const.CR);
    // Add the mapping parameters too
    // 
    retval.append("      ").append(mappingParameters.getXML()).append(Const.CR);
    retval.append("    ").append(XMLHandler.closeTag("mappings")).append(Const.CR);
    retval.append("    ").append(XMLHandler.addTagValue("allow_multiple_input", allowingMultipleInputs));
    retval.append("    ").append(XMLHandler.addTagValue("allow_multiple_output", allowingMultipleOutputs));
    return retval.toString();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) RepositoryObject(org.pentaho.di.repository.RepositoryObject)

Example 24 with RepositoryObject

use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.

the class JobExecutorMeta method getXML.

@Override
public String getXML() {
    StringBuilder retval = new StringBuilder(300);
    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 (repository != null && jobObjectId != null) {
        try {
            RepositoryObject objectInformation = repository.getObjectInformation(jobObjectId, RepositoryObjectType.TRANSFORMATION);
            if (objectInformation != null) {
                jobName = objectInformation.getName();
                directoryPath = objectInformation.getRepositoryDirectory().getPath();
            }
        } catch (KettleException e) {
        // Ignore object reference problems. It simply means that the reference is no longer valid.
        }
    }
    retval.append("    ").append(XMLHandler.addTagValue("job_name", jobName));
    retval.append("    ").append(XMLHandler.addTagValue("filename", fileName));
    retval.append("    ").append(XMLHandler.addTagValue("directory_path", directoryPath));
    retval.append("    ").append(XMLHandler.addTagValue("group_size", groupSize));
    retval.append("    ").append(XMLHandler.addTagValue("group_field", groupField));
    retval.append("    ").append(XMLHandler.addTagValue("group_time", groupTime));
    // Add the mapping parameters too
    // 
    retval.append(parameters.getXML());
    // The output side...
    // 
    retval.append("    ").append(XMLHandler.addTagValue("execution_result_target_step", executionResultTargetStepMeta == null ? null : executionResultTargetStepMeta.getName()));
    retval.append("    ").append(XMLHandler.addTagValue("execution_time_field", executionTimeField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_result_field", executionResultField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_errors_field", executionNrErrorsField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_read_field", executionLinesReadField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_written_field", executionLinesWrittenField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_input_field", executionLinesInputField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_output_field", executionLinesOutputField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_rejected_field", executionLinesRejectedField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_updated_field", executionLinesUpdatedField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_lines_deleted_field", executionLinesDeletedField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_files_retrieved_field", executionFilesRetrievedField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_exit_status_field", executionExitStatusField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_log_text_field", executionLogTextField));
    retval.append("    ").append(XMLHandler.addTagValue("execution_log_channelid_field", executionLogChannelIdField));
    retval.append("    ").append(XMLHandler.addTagValue("result_rows_target_step", resultRowsTargetStepMeta == null ? null : resultRowsTargetStepMeta.getName()));
    for (int i = 0; i < resultRowsField.length; i++) {
        retval.append("    ").append(XMLHandler.openTag("result_rows_field")).append(Const.CR);
        retval.append("      ").append(XMLHandler.addTagValue("name", resultRowsField[i]));
        retval.append("      ").append(XMLHandler.addTagValue("type", ValueMetaFactory.getValueMetaName(resultRowsType[i])));
        retval.append("      ").append(XMLHandler.addTagValue("length", resultRowsLength[i]));
        retval.append("      ").append(XMLHandler.addTagValue("precision", resultRowsPrecision[i]));
        retval.append("    ").append(XMLHandler.closeTag("result_rows_field")).append(Const.CR);
    }
    retval.append("    ").append(XMLHandler.addTagValue("result_files_target_step", resultFilesTargetStepMeta == null ? null : resultFilesTargetStepMeta.getName()));
    retval.append("    ").append(XMLHandler.addTagValue("result_files_file_name_field", resultFilesFileNameField));
    return retval.toString();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) RepositoryObject(org.pentaho.di.repository.RepositoryObject)

Example 25 with RepositoryObject

use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.

the class JobEntryTrans method getXML.

@Override
public String getXML() {
    StringBuilder retval = new StringBuilder(300);
    retval.append(super.getXML());
    // specificationMethod
    // 
    retval.append("      ").append(XMLHandler.addTagValue("specification_method", specificationMethod == null ? null : specificationMethod.getCode()));
    retval.append("      ").append(XMLHandler.addTagValue("trans_object_id", transObjectId == null ? null : transObjectId.toString()));
    // 
    if (rep != null && transObjectId != null) {
        try {
            RepositoryObject objectInformation = rep.getObjectInformation(transObjectId, RepositoryObjectType.TRANSFORMATION);
            if (objectInformation != null) {
                transname = objectInformation.getName();
                directory = objectInformation.getRepositoryDirectory().getPath();
            }
        } catch (KettleException e) {
        // Ignore object reference problems. It simply means that the reference is no longer valid.
        }
    }
    retval.append("      ").append(XMLHandler.addTagValue("filename", filename));
    retval.append("      ").append(XMLHandler.addTagValue("transname", transname));
    if (parentJobMeta != null) {
        parentJobMeta.getNamedClusterEmbedManager().registerUrl(filename);
    }
    if (directory != null) {
        retval.append("      ").append(XMLHandler.addTagValue("directory", directory));
    } else if (directoryPath != null) {
        // don't loose this info (backup/recovery)
        // 
        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("clear_rows", clearResultRows));
    retval.append("      ").append(XMLHandler.addTagValue("clear_files", clearResultFiles));
    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() : null));
    retval.append("      ").append(XMLHandler.addTagValue("cluster", clustering));
    retval.append("      ").append(XMLHandler.addTagValue("slave_server_name", remoteSlaveServerName));
    retval.append("      ").append(XMLHandler.addTagValue("set_append_logfile", setAppendLogfile));
    retval.append("      ").append(XMLHandler.addTagValue("wait_until_finished", waitingToFinish));
    retval.append("      ").append(XMLHandler.addTagValue("follow_abort_remote", followingAbortRemotely));
    retval.append("      ").append(XMLHandler.addTagValue("create_parent_folder", createParentFolder));
    retval.append("      ").append(XMLHandler.addTagValue("logging_remote_work", loggingRemoteWork));
    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")).append(Const.CR);
        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")).append(Const.CR);
            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")).append(Const.CR);
        }
        retval.append("      ").append(XMLHandler.closeTag("parameters")).append(Const.CR);
    }
    return retval.toString();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) RepositoryObject(org.pentaho.di.repository.RepositoryObject) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Aggregations

RepositoryObject (org.pentaho.di.repository.RepositoryObject)46 KettleException (org.pentaho.di.core.exception.KettleException)31 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)15 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)11 StringObjectId (org.pentaho.di.repository.StringObjectId)9 ObjectId (org.pentaho.di.repository.ObjectId)7 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 Test (org.junit.Test)6 KettleFileException (org.pentaho.di.core.exception.KettleFileException)5 RepositoryElementMetaInterface (org.pentaho.di.repository.RepositoryElementMetaInterface)5 IOException (java.io.IOException)4 FileSystemException (org.apache.commons.vfs2.FileSystemException)4 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)4 FileDialogOperation (org.pentaho.di.ui.core.FileDialogOperation)4 FileObject (org.apache.commons.vfs2.FileObject)3 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)3 RepositoryObjectInterface (org.pentaho.di.repository.RepositoryObjectInterface)3 Serializable (java.io.Serializable)2 List (java.util.List)2