Search in sources :

Example 1 with ChannelLogTable

use of org.pentaho.di.core.logging.ChannelLogTable in project pentaho-kettle by pentaho.

the class SpoonExportXmlTest method savingTransToXmlNotChangesLogTables.

@Test
public void savingTransToXmlNotChangesLogTables() {
    TransMeta transMeta = new TransMeta();
    initTables(transMeta);
    TransLogTable originTransLogTable = transMeta.getTransLogTable();
    StepLogTable originStepLogTable = transMeta.getStepLogTable();
    PerformanceLogTable originPerformanceLogTable = transMeta.getPerformanceLogTable();
    ChannelLogTable originChannelLogTable = transMeta.getChannelLogTable();
    MetricsLogTable originMetricsLogTable = transMeta.getMetricsLogTable();
    when(spoon.getActiveTransformation()).thenReturn(transMeta);
    when(spoon.saveXMLFile(any(TransMeta.class), anyBoolean())).thenReturn(true);
    when(spoon.saveXMLFile(anyBoolean())).thenCallRealMethod();
    spoon.saveXMLFile(true);
    tablesCommonValuesEqual(originTransLogTable, transMeta.getTransLogTable());
    assertEquals(originTransLogTable.getLogInterval(), transMeta.getTransLogTable().getLogInterval());
    assertEquals(originTransLogTable.getLogSizeLimit(), transMeta.getTransLogTable().getLogSizeLimit());
    tablesCommonValuesEqual(originStepLogTable, transMeta.getStepLogTable());
    tablesCommonValuesEqual(originPerformanceLogTable, transMeta.getPerformanceLogTable());
    assertEquals(originPerformanceLogTable.getLogInterval(), transMeta.getPerformanceLogTable().getLogInterval());
    tablesCommonValuesEqual(originChannelLogTable, transMeta.getChannelLogTable());
    tablesCommonValuesEqual(originMetricsLogTable, transMeta.getMetricsLogTable());
}
Also used : PerformanceLogTable(org.pentaho.di.core.logging.PerformanceLogTable) MetricsLogTable(org.pentaho.di.core.logging.MetricsLogTable) ChannelLogTable(org.pentaho.di.core.logging.ChannelLogTable) StepLogTable(org.pentaho.di.core.logging.StepLogTable) TransMeta(org.pentaho.di.trans.TransMeta) TransLogTable(org.pentaho.di.core.logging.TransLogTable) Test(org.junit.Test)

Example 2 with ChannelLogTable

use of org.pentaho.di.core.logging.ChannelLogTable in project pentaho-kettle by pentaho.

the class SpoonExportXmlTest method savingJobToXmlNotChangesLogTables.

@Test
public void savingJobToXmlNotChangesLogTables() {
    JobMeta jobMeta = new JobMeta();
    initTables(jobMeta);
    JobLogTable originJobLogTable = jobMeta.getJobLogTable();
    JobEntryLogTable originJobEntryLogTable = jobMeta.getJobEntryLogTable();
    ChannelLogTable originChannelLogTable = jobMeta.getChannelLogTable();
    when(spoon.getActiveTransformation()).thenReturn(null);
    when(spoon.getActiveJob()).thenReturn(jobMeta);
    when(spoon.saveXMLFile(any(JobMeta.class), anyBoolean())).thenReturn(true);
    when(spoon.saveXMLFile(anyBoolean())).thenCallRealMethod();
    spoon.saveXMLFile(true);
    tablesCommonValuesEqual(originJobLogTable, jobMeta.getJobLogTable());
    assertEquals(originJobLogTable.getLogInterval(), jobMeta.getJobLogTable().getLogInterval());
    assertEquals(originJobLogTable.getLogSizeLimit(), jobMeta.getJobLogTable().getLogSizeLimit());
    tablesCommonValuesEqual(originJobEntryLogTable, jobMeta.getJobEntryLogTable());
    tablesCommonValuesEqual(originChannelLogTable, jobMeta.getChannelLogTable());
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobLogTable(org.pentaho.di.core.logging.JobLogTable) ChannelLogTable(org.pentaho.di.core.logging.ChannelLogTable) JobEntryLogTable(org.pentaho.di.core.logging.JobEntryLogTable) Test(org.junit.Test)

Example 3 with ChannelLogTable

use of org.pentaho.di.core.logging.ChannelLogTable in project pentaho-kettle by pentaho.

the class XmlExportHelper method swapTables.

/**
 * @param jobMeta
 *            contains log tables to be refactored before export
 */
public static void swapTables(JobMeta jobMeta) {
    JobLogTable jobLogTable = jobMeta.getJobLogTable();
    if (jobLogTable != null) {
        JobLogTable cloneJobLogTable = (JobLogTable) jobLogTable.clone();
        cloneJobLogTable.setAllGlobalParametersToNull();
        jobMeta.setJobLogTable(cloneJobLogTable);
    }
    JobEntryLogTable jobEntryLogTable = jobMeta.getJobEntryLogTable();
    if (jobEntryLogTable != null) {
        JobEntryLogTable cloneEntryLogTable = (JobEntryLogTable) jobEntryLogTable.clone();
        cloneEntryLogTable.setAllGlobalParametersToNull();
        jobMeta.setJobEntryLogTable(cloneEntryLogTable);
    }
    ChannelLogTable channelLogTable = jobMeta.getChannelLogTable();
    if (channelLogTable != null) {
        ChannelLogTable cloneChannelLogTable = (ChannelLogTable) channelLogTable.clone();
        cloneChannelLogTable.setAllGlobalParametersToNull();
        jobMeta.setChannelLogTable(cloneChannelLogTable);
    }
    List<LogTableInterface> extraLogTables = jobMeta.getExtraLogTables();
    if (extraLogTables != null) {
        List<LogTableInterface> cloneExtraLogTables = new ArrayList<>();
        for (LogTableInterface logTable : extraLogTables) {
            if (logTable instanceof BaseLogTable) {
                if (logTable instanceof Cloneable) {
                    BaseLogTable cloneExtraLogTable = (BaseLogTable) logTable.clone();
                    cloneExtraLogTable.setAllGlobalParametersToNull();
                    cloneExtraLogTables.add((LogTableInterface) cloneExtraLogTable);
                }
            }
        }
        jobMeta.setExtraLogTables(cloneExtraLogTables);
    }
}
Also used : LogTableInterface(org.pentaho.di.core.logging.LogTableInterface) JobLogTable(org.pentaho.di.core.logging.JobLogTable) BaseLogTable(org.pentaho.di.core.logging.BaseLogTable) ChannelLogTable(org.pentaho.di.core.logging.ChannelLogTable) ArrayList(java.util.ArrayList) JobEntryLogTable(org.pentaho.di.core.logging.JobEntryLogTable)

Example 4 with ChannelLogTable

use of org.pentaho.di.core.logging.ChannelLogTable in project pentaho-kettle by pentaho.

the class JobDialog method showLogTypeOptions.

private void showLogTypeOptions(int index) {
    if (index != previousLogTableIndex) {
        getLogInfo(previousLogTableIndex);
        // 
        for (Control control : wLogOptionsComposite.getChildren()) {
            control.dispose();
        }
        previousLogTableIndex = index;
        LogTableInterface logTable = logTables.get(index);
        LogTableUserInterface logTableUserInterface = logTableUserInterfaces.get(index);
        if (logTableUserInterface != null) {
            logTableUserInterface.showLogTableOptions(wLogOptionsComposite, logTable);
        } else {
            if (logTable instanceof JobLogTable) {
                showJobLogTableOptions((JobLogTable) logTable);
            } else if (logTable instanceof ChannelLogTable) {
                showChannelLogTableOptions((ChannelLogTable) logTable);
            }
            if (logTable instanceof JobEntryLogTable) {
                showJobEntryLogTableOptions((JobEntryLogTable) logTable);
            }
        }
        wLogOptionsComposite.layout(true, true);
        wLogComp.layout(true, true);
    }
}
Also used : LogTableInterface(org.pentaho.di.core.logging.LogTableInterface) Control(org.eclipse.swt.widgets.Control) JobLogTable(org.pentaho.di.core.logging.JobLogTable) ChannelLogTable(org.pentaho.di.core.logging.ChannelLogTable) JobEntryLogTable(org.pentaho.di.core.logging.JobEntryLogTable)

Example 5 with ChannelLogTable

use of org.pentaho.di.core.logging.ChannelLogTable in project pentaho-kettle by pentaho.

the class Job method writeLogChannelInformation.

/**
 * Write log channel information.
 *
 * @throws KettleException
 *           the kettle exception
 */
protected void writeLogChannelInformation() throws KettleException {
    Database db = null;
    ChannelLogTable channelLogTable = jobMeta.getChannelLogTable();
    // PDI-7070: If parent job has the same channel logging info, don't duplicate log entries
    Job j = getParentJob();
    if (j != null) {
        if (channelLogTable.equals(j.getJobMeta().getChannelLogTable())) {
            return;
        }
    }
    try {
        db = new Database(this, channelLogTable.getDatabaseMeta());
        db.shareVariablesWith(this);
        db.connect();
        db.setCommit(logCommitSize);
        List<LoggingHierarchy> loggingHierarchyList = getLoggingHierarchy();
        for (LoggingHierarchy loggingHierarchy : loggingHierarchyList) {
            db.writeLogRecord(channelLogTable, LogStatus.START, loggingHierarchy, null);
        }
        // Also time-out the log records in here...
        // 
        db.cleanupLogRecords(channelLogTable);
    } catch (Exception e) {
        throw new KettleException(BaseMessages.getString(PKG, "Trans.Exception.UnableToWriteLogChannelInformationToLogTable"), e);
    } finally {
        if (!db.isAutoCommit()) {
            db.commit(true);
        }
        db.disconnect();
    }
}
Also used : LoggingHierarchy(org.pentaho.di.core.logging.LoggingHierarchy) KettleException(org.pentaho.di.core.exception.KettleException) ChannelLogTable(org.pentaho.di.core.logging.ChannelLogTable) Database(org.pentaho.di.core.database.Database) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob) DuplicateParamException(org.pentaho.di.core.parameters.DuplicateParamException) UnknownParamException(org.pentaho.di.core.parameters.UnknownParamException) KettleJobException(org.pentaho.di.core.exception.KettleJobException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleException(org.pentaho.di.core.exception.KettleException) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException)

Aggregations

ChannelLogTable (org.pentaho.di.core.logging.ChannelLogTable)17 JobEntryLogTable (org.pentaho.di.core.logging.JobEntryLogTable)8 JobLogTable (org.pentaho.di.core.logging.JobLogTable)8 PerformanceLogTable (org.pentaho.di.core.logging.PerformanceLogTable)6 StepLogTable (org.pentaho.di.core.logging.StepLogTable)6 TransLogTable (org.pentaho.di.core.logging.TransLogTable)6 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)4 KettleException (org.pentaho.di.core.exception.KettleException)4 KettleValueException (org.pentaho.di.core.exception.KettleValueException)4 LogTableInterface (org.pentaho.di.core.logging.LogTableInterface)4 MetricsLogTable (org.pentaho.di.core.logging.MetricsLogTable)4 DuplicateParamException (org.pentaho.di.core.parameters.DuplicateParamException)4 UnknownParamException (org.pentaho.di.core.parameters.UnknownParamException)4 Test (org.junit.Test)3 Database (org.pentaho.di.core.database.Database)3 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Timer (java.util.Timer)2 TimerTask (java.util.TimerTask)2 KettleFileException (org.pentaho.di.core.exception.KettleFileException)2