use of org.pentaho.di.core.plugins.PluginInterface in project pentaho-kettle by pentaho.
the class AuthenticationPersistenceManager method getAuthenticationManager.
public static AuthenticationManager getAuthenticationManager() {
AuthenticationManager manager = new AuthenticationManager();
manager.registerAuthenticationProvider(new NoAuthenticationAuthenticationProvider());
for (PluginInterface plugin : PluginRegistry.getInstance().getPlugins(AuthenticationConsumerPluginType.class)) {
try {
Object pluginMain = PluginRegistry.getInstance().loadClass(plugin);
if (pluginMain instanceof AuthenticationConsumerType) {
Class<? extends AuthenticationConsumer<?, ?>> consumerClass = ((AuthenticationConsumerType) pluginMain).getConsumerClass();
manager.registerConsumerClass(consumerClass);
} else {
throw new KettlePluginException(BaseMessages.getString(PKG, "AuthenticationPersistenceManager.NotConsumerType", pluginMain, AuthenticationConsumerType.class));
}
} catch (KettlePluginException e) {
log.logError(e.getMessage(), e);
} catch (AuthenticationFactoryException e) {
log.logError(e.getMessage(), e);
}
}
return manager;
}
use of org.pentaho.di.core.plugins.PluginInterface in project pentaho-kettle by pentaho.
the class CompressionProviderFactory method getCompressionProviderByName.
@Override
public CompressionProvider getCompressionProviderByName(String name) {
if (name == null) {
return null;
}
CompressionProvider foundProvider = null;
List<PluginInterface> providers = getPlugins();
if (providers != null) {
for (PluginInterface plugin : providers) {
try {
CompressionProvider provider = PluginRegistry.getInstance().loadClass(plugin, CompressionProvider.class);
if (provider != null && name.equals(provider.getName())) {
foundProvider = provider;
}
} catch (Exception e) {
// Do nothing here, if we can't load the provider, don't add it to the list
}
}
}
return foundProvider;
}
use of org.pentaho.di.core.plugins.PluginInterface in project pentaho-kettle by pentaho.
the class RepositoryConnectController method getPlugins.
@SuppressWarnings("unchecked")
public String getPlugins() {
List<PluginInterface> plugins = pluginRegistry.getPlugins(RepositoryPluginType.class);
JSONArray list = new JSONArray();
for (PluginInterface pluginInterface : plugins) {
if (!pluginInterface.getIds()[0].equals("PentahoEnterpriseRepository")) {
JSONObject repoJSON = new JSONObject();
repoJSON.put("id", pluginInterface.getIds()[0]);
repoJSON.put("name", pluginInterface.getName());
repoJSON.put("description", pluginInterface.getDescription());
list.add(repoJSON);
}
}
return list.toString();
}
use of org.pentaho.di.core.plugins.PluginInterface in project pentaho-kettle by pentaho.
the class MQTTProducerDialog method getImage.
private Image getImage() {
PluginInterface plugin = PluginRegistry.getInstance().getPlugin(StepPluginType.class, stepMeta.getStepMetaInterface());
String id = plugin.getIds()[0];
if (id != null) {
return GUIResource.getInstance().getImagesSteps().get(id).getAsBitmapForSize(shell.getDisplay(), ConstUI.ICON_SIZE, ConstUI.ICON_SIZE);
}
return null;
}
use of org.pentaho.di.core.plugins.PluginInterface in project pentaho-kettle by pentaho.
the class MySQLBulkLoader method execute.
public boolean execute(MySQLBulkLoaderMeta meta) throws KettleException {
Runtime rt = Runtime.getRuntime();
try {
// 1) Create the FIFO file using the "mkfifo" command...
// Make sure to log all the possible output, also from STDERR
//
data.fifoFilename = environmentSubstitute(meta.getFifoFileName());
File fifoFile = new File(data.fifoFilename);
if (!fifoFile.exists()) {
// MKFIFO!
//
String mkFifoCmd = "mkfifo " + data.fifoFilename;
//
logBasic(BaseMessages.getString(PKG, "MySQLBulkLoader.Message.CREATINGFIFO", data.dbDescription, mkFifoCmd));
Process mkFifoProcess = rt.exec(mkFifoCmd);
StreamLogger errorLogger = new StreamLogger(log, mkFifoProcess.getErrorStream(), "mkFifoError");
StreamLogger outputLogger = new StreamLogger(log, mkFifoProcess.getInputStream(), "mkFifoOuptut");
new Thread(errorLogger).start();
new Thread(outputLogger).start();
int result = mkFifoProcess.waitFor();
if (result != 0) {
throw new Exception(BaseMessages.getString(PKG, "MySQLBulkLoader.Message.ERRORFIFORC", result, mkFifoCmd));
}
String chmodCmd = "chmod 666 " + data.fifoFilename;
logBasic(BaseMessages.getString(PKG, "MySQLBulkLoader.Message.SETTINGPERMISSIONSFIFO", data.dbDescription, chmodCmd));
Process chmodProcess = rt.exec(chmodCmd);
errorLogger = new StreamLogger(log, chmodProcess.getErrorStream(), "chmodError");
outputLogger = new StreamLogger(log, chmodProcess.getInputStream(), "chmodOuptut");
new Thread(errorLogger).start();
new Thread(outputLogger).start();
result = chmodProcess.waitFor();
if (result != 0) {
throw new Exception(BaseMessages.getString(PKG, "MySQLBulkLoader.Message.ERRORFIFORC", result, chmodCmd));
}
}
// 2) Make a connection to MySQL for sending SQL commands
// (Also, we need a clear cache for getting up-to-date target metadata)
DBCache.getInstance().clear(meta.getDatabaseMeta().getName());
if (meta.getDatabaseMeta() == null) {
logError(BaseMessages.getString(PKG, "MySQLBulkLoader.Init.ConnectionMissing", getStepname()));
return false;
}
data.db = new Database(this, meta.getDatabaseMeta());
data.db.shareVariablesWith(this);
PluginInterface dbPlugin = PluginRegistry.getInstance().getPlugin(DatabasePluginType.class, meta.getDatabaseMeta().getDatabaseInterface());
data.dbDescription = (dbPlugin != null) ? dbPlugin.getDescription() : BaseMessages.getString(PKG, "MySQLBulkLoader.UnknownDB");
// Connect to the database
if (getTransMeta().isUsingUniqueConnections()) {
synchronized (getTrans()) {
data.db.connect(getTrans().getTransactionId(), getPartitionID());
}
} else {
data.db.connect(getPartitionID());
}
logBasic(BaseMessages.getString(PKG, "MySQLBulkLoader.Message.CONNECTED", data.dbDescription));
// 3) Now we are ready to run the load command...
//
executeLoadCommand();
} catch (Exception ex) {
throw new KettleException(ex);
}
return true;
}
Aggregations