use of org.apache.hop.core.plugins.IPlugin in project hop by apache.
the class DatabaseMeta method findIDatabase.
/**
* Search for the right type of IDatabase object and return it.
*
* @param databaseTypeDesc the type of IDatabase to look for (id or description)
* @return The requested IDatabase
* @throws HopDatabaseException when the type could not be found or referenced.
*/
private static final IDatabase findIDatabase(String databaseTypeDesc) throws HopDatabaseException {
PluginRegistry registry = PluginRegistry.getInstance();
IPlugin plugin = registry.getPlugin(DatabasePluginType.class, databaseTypeDesc);
if (plugin == null) {
plugin = registry.findPluginWithName(DatabasePluginType.class, databaseTypeDesc);
}
if (plugin == null) {
throw new HopDatabaseException("database type with plugin id [" + databaseTypeDesc + "] couldn't be found!");
}
return getIDatabaseMap().get(plugin.getIds()[0]);
}
use of org.apache.hop.core.plugins.IPlugin in project hop by apache.
the class DatabaseMetaObjectFactory method createObject.
@Override
public Object createObject(String id, Object parentObject) throws HopException {
PluginRegistry registry = PluginRegistry.getInstance();
IPlugin plugin = registry.findPluginWithId(DatabasePluginType.class, id);
IDatabase iDatabase = (IDatabase) registry.loadClass(plugin);
return iDatabase;
}
use of org.apache.hop.core.plugins.IPlugin in project hop by apache.
the class HopSearch method main.
public static void main(String[] args) {
HopSearch hopSearch = new HopSearch();
try {
HopEnvironment.init();
// Also register the search plugin type (usually only done for the GUI)
// We don't want to load these in HopEnvironmnent.init() because for now it would
// only be useful in Hop GUI and Hop Search. There is no need to slow down
// Hop Run or Hop Server with this.
//
PluginRegistry registry = PluginRegistry.getInstance();
SearchableAnalyserPluginType searchableAnalyserPluginType = SearchableAnalyserPluginType.getInstance();
registry.addPluginType(searchableAnalyserPluginType);
searchableAnalyserPluginType.searchPlugins();
CommandLine cmd = new CommandLine(hopSearch);
List<IPlugin> configPlugins = registry.getPlugins(ConfigPluginType.class);
for (IPlugin configPlugin : configPlugins) {
// Load only the plugins of the "search" category
if (ConfigPlugin.CATEGORY_SEARCH.equals(configPlugin.getCategory())) {
IConfigOptions configOptions = registry.loadClass(configPlugin, IConfigOptions.class);
cmd.addMixin(configPlugin.getIds()[0], configOptions);
}
}
hopSearch.setCmd(cmd);
CommandLine.ParseResult parseResult = cmd.parseArgs(args);
if (CommandLine.printHelpIfRequested(parseResult)) {
System.exit(1);
} else {
hopSearch.run();
System.exit(0);
}
} catch (ParameterException e) {
System.err.println(e.getMessage());
hopSearch.cmd.usage(System.err);
System.exit(9);
} catch (ExecutionException e) {
System.err.println("Error found during execution!");
System.err.println(Const.getStackTracker(e));
System.exit(1);
} catch (Exception e) {
System.err.println("General error found, something went horribly wrong!");
System.err.println(Const.getStackTracker(e));
System.exit(2);
}
}
use of org.apache.hop.core.plugins.IPlugin in project hop by apache.
the class HopImport method main.
public static void main(String[] args) {
HopImport hopImport = new HopImport();
try {
// Create the command line options...
//
CommandLine cmd = new CommandLine(hopImport);
// Initialize the Hop environment: load plugins and more
//
HopEnvironment.init();
// Picks up the system settings in the variables
//
hopImport.buildVariableSpace();
// Now add run configuration plugins...
//
List<IPlugin> configPlugins = PluginRegistry.getInstance().getPlugins(ConfigPluginType.class);
for (IPlugin configPlugin : configPlugins) {
// Load only the plugins of the "import" category
if (ConfigPlugin.CATEGORY_IMPORT.equals(configPlugin.getCategory())) {
IConfigOptions configOptions = PluginRegistry.getInstance().loadClass(configPlugin, IConfigOptions.class);
cmd.addMixin(configPlugin.getIds()[0], configOptions);
}
}
hopImport.setCmd(cmd);
// This will calculate the option values and put them in HopRun or the plugin classes
//
CommandLine.ParseResult parseResult = cmd.parseArgs(args);
if (CommandLine.printHelpIfRequested(parseResult)) {
System.exit(1);
} else {
// now run!
//
hopImport.run();
if (hopImport != null && hopImport.isFinishedWithoutError()) {
System.exit(0);
} else {
System.exit(1);
}
}
} catch (ParameterException e) {
System.err.println(e.getMessage());
hopImport.cmd.usage(System.err);
System.exit(9);
} catch (ExecutionException e) {
System.err.println("Error found during execution!");
System.err.println(Const.getStackTracker(e));
System.exit(1);
} catch (Exception e) {
System.err.println("General error found, something went horribly wrong!");
System.err.println(Const.getStackTracker(e));
System.exit(2);
}
}
use of org.apache.hop.core.plugins.IPlugin in project hop by apache.
the class HopImport method printPluginTypes.
private void printPluginTypes() {
System.err.println("Here are the available import plugins:");
for (IPlugin importPlugin : PluginRegistry.getInstance().getPlugins(ImportPluginType.class)) {
System.err.println(" - " + importPlugin.getIds()[0]);
System.err.println(" Name: " + importPlugin.getName());
System.err.println(" Description: " + importPlugin.getDescription());
System.err.println(" Documentation URL: " + importPlugin.getDocumentationUrl());
}
}
Aggregations