Search in sources :

Example 61 with PluginInterface

use of org.pentaho.di.core.plugins.PluginInterface in project pentaho-kettle by pentaho.

the class ExtensionPointMap method reInitialize.

/**
 * Reinitialize the extension point plugins map
 */
public void reInitialize() {
    lock.writeLock().lock();
    try {
        extensionPointPluginMap = HashBasedTable.create();
        final PluginRegistry registry = PluginRegistry.getInstance();
        List<PluginInterface> extensionPointPlugins = registry.getPlugins(ExtensionPointPluginType.class);
        for (PluginInterface extensionPointPlugin : extensionPointPlugins) {
            addExtensionPoint(extensionPointPlugin);
        }
    } finally {
        lock.writeLock().unlock();
    }
}
Also used : PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) PluginInterface(org.pentaho.di.core.plugins.PluginInterface)

Example 62 with PluginInterface

use of org.pentaho.di.core.plugins.PluginInterface in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryCreationHelper method loadPluginsIds.

private ObjectId[] loadPluginsIds(List<PluginInterface> plugins, boolean create) throws KettleException {
    ObjectId[] ids = new ObjectId[plugins.size()];
    if (create) {
        return ids;
    }
    Map<String, LongObjectId> stepTypeCodeToIdMap = repository.stepDelegate.getStepTypeCodeToIdMap();
    int index = 0;
    for (PluginInterface sp : plugins) {
        ids[index++] = stepTypeCodeToIdMap.get(sp.getIds()[0]);
    }
    return ids;
}
Also used : LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) LongObjectId(org.pentaho.di.repository.LongObjectId)

Example 63 with PluginInterface

use of org.pentaho.di.core.plugins.PluginInterface in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryCreationHelper method updateStepTypes.

/**
 * Update the list in R_STEP_TYPE using the StepLoader StepPlugin entries
 *
 * @throws KettleException
 *           if the update didn't go as planned.
 */
public List<String> updateStepTypes(List<String> statements, boolean dryrun, boolean create) throws KettleException {
    synchronized (repository) {
        // We should only do an update if something has changed...
        // 
        List<PluginInterface> plugins = pluginRegistry.getPlugins(StepPluginType.class);
        ObjectId[] ids = loadPluginsIds(plugins, create);
        for (int i = 0, idsLength = ids.length; i < idsLength; i++) {
            ObjectId id = ids[i];
            if (id == null) {
                if (!create) {
                    id = repository.connectionDelegate.getNextStepTypeID();
                } else {
                    id = new LongObjectId(i + 1);
                }
                PluginInterface sp = plugins.get(i);
                RowMetaAndData table = new RowMetaAndData();
                table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_STEP_TYPE_ID_STEP_TYPE), id);
                table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_STEP_TYPE_CODE), sp.getIds()[0]);
                table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_STEP_TYPE_DESCRIPTION), sp.getName());
                table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_STEP_TYPE_HELPTEXT), sp.getDescription());
                if (dryrun) {
                    String sql = database.getSQLOutput(null, KettleDatabaseRepository.TABLE_R_STEP_TYPE, table.getRowMeta(), table.getData(), null);
                    statements.add(sql);
                } else {
                    database.prepareInsert(table.getRowMeta(), null, KettleDatabaseRepository.TABLE_R_STEP_TYPE);
                    database.setValuesInsert(table);
                    database.insertRow();
                    database.closeInsert();
                }
            }
        }
    }
    return statements;
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) LongObjectId(org.pentaho.di.repository.LongObjectId) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 64 with PluginInterface

use of org.pentaho.di.core.plugins.PluginInterface in project pentaho-kettle by pentaho.

the class ImportRules method loadXML.

public void loadXML(Node rulesNode) throws KettleException {
    List<Node> ruleNodes = XMLHandler.getNodes(rulesNode, BaseImportRule.XML_TAG);
    for (Node ruleNode : ruleNodes) {
        String id = XMLHandler.getTagValue(ruleNode, "id");
        PluginRegistry registry = PluginRegistry.getInstance();
        PluginInterface plugin = registry.findPluginWithId(ImportRulePluginType.class, id);
        if (plugin == null) {
            throw new KettleException("The import rule of type '" + id + "' could not be found in the plugin registry.");
        }
        ImportRuleInterface rule = (ImportRuleInterface) registry.loadClass(plugin);
        rule.loadXML(ruleNode);
        getRules().add(rule);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ImportRuleInterface(org.pentaho.di.imp.rule.ImportRuleInterface) Node(org.w3c.dom.Node) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) PluginInterface(org.pentaho.di.core.plugins.PluginInterface)

Example 65 with PluginInterface

use of org.pentaho.di.core.plugins.PluginInterface in project pentaho-kettle by pentaho.

the class JobMeta method clear.

/**
 * Clears or reinitializes many of the JobMeta properties.
 */
@Override
public void clear() {
    jobcopies = new ArrayList<JobEntryCopy>();
    jobhops = new ArrayList<JobHopMeta>();
    jobLogTable = JobLogTable.getDefault(this, this);
    jobEntryLogTable = JobEntryLogTable.getDefault(this, this);
    extraLogTables = new ArrayList<LogTableInterface>();
    List<PluginInterface> plugins = PluginRegistry.getInstance().getPlugins(LogTablePluginType.class);
    for (PluginInterface plugin : plugins) {
        try {
            LogTablePluginInterface logTablePluginInterface = (LogTablePluginInterface) PluginRegistry.getInstance().loadClass(plugin);
            if (logTablePluginInterface.getType() == TableType.JOB) {
                logTablePluginInterface.setContext(this, this);
                extraLogTables.add(logTablePluginInterface);
            }
        } catch (Exception e) {
            LogChannel.GENERAL.logError("Error loading log table plugin with ID " + plugin.getIds()[0], e);
        }
    }
    arguments = null;
    super.clear();
    loopCache = new HashMap<String, Boolean>();
    addDefaults();
    jobStatus = -1;
    jobVersion = null;
    // setInternalKettleVariables(); Don't clear the internal variables for
    // ad-hoc jobs, it's ruins the previews
    // etc.
    log = LogChannel.GENERAL;
}
Also used : LogTablePluginInterface(org.pentaho.di.core.logging.LogTablePluginInterface) LogTablePluginInterface(org.pentaho.di.core.logging.LogTablePluginInterface) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) UnknownParamException(org.pentaho.di.core.parameters.UnknownParamException) LookupReferencesException(org.pentaho.di.core.exception.LookupReferencesException) FileSystemException(org.apache.commons.vfs2.FileSystemException) KettleException(org.pentaho.di.core.exception.KettleException) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) IdNotFoundException(org.pentaho.di.core.exception.IdNotFoundException) LogTableInterface(org.pentaho.di.core.logging.LogTableInterface) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy)

Aggregations

PluginInterface (org.pentaho.di.core.plugins.PluginInterface)99 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)45 KettleException (org.pentaho.di.core.exception.KettleException)24 ArrayList (java.util.ArrayList)17 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)14 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)12 TransMeta (org.pentaho.di.trans.TransMeta)11 StepMeta (org.pentaho.di.trans.step.StepMeta)11 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)10 Test (org.junit.Test)9 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)9 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)8 Point (org.pentaho.di.core.gui.Point)8 JobMeta (org.pentaho.di.job.JobMeta)8 KettlePluginException (org.pentaho.di.core.exception.KettlePluginException)7 TransHopMeta (org.pentaho.di.trans.TransHopMeta)7 TreeItem (org.eclipse.swt.widgets.TreeItem)6 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)6 LongObjectId (org.pentaho.di.repository.LongObjectId)6 ObjectId (org.pentaho.di.repository.ObjectId)6