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();
}
}
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;
}
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;
}
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);
}
}
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;
}
Aggregations