本文整理汇总了Java中org.pentaho.di.core.plugins.PluginRegistry.loadClass方法的典型用法代码示例。如果您正苦于以下问题:Java PluginRegistry.loadClass方法的具体用法?Java PluginRegistry.loadClass怎么用?Java PluginRegistry.loadClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.plugins.PluginRegistry
的用法示例。
在下文中一共展示了PluginRegistry.loadClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openRepository
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
private Repository openRepository(String repositoryName, String user, String pass) throws KettleException {
if (Const.isEmpty(repositoryName)) return null;
RepositoriesMeta repositoriesMeta = new RepositoriesMeta();
repositoriesMeta.readData();
RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName );
PluginRegistry registry = PluginRegistry.getInstance();
Repository repository = registry.loadClass(
RepositoryPluginType.class,
repositoryMeta,
Repository.class
);
repository.init(repositoryMeta);
repository.connect(user, pass);
return repository;
}
示例2: loadXML
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
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);
}
}
示例3: createPartitioner
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public void createPartitioner( String method ) throws KettlePluginException {
methodType = getMethodType(method);
switch ( methodType ) {
case PARTITIONING_METHOD_SPECIAL: {
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.findPluginWithId(PartitionerPluginType.class, method);
partitioner = (Partitioner) registry.loadClass(plugin);
partitioner.setId(plugin.getIds()[0]);
break;
}
case PARTITIONING_METHOD_NONE:
default: partitioner = null;
}
if( partitioner != null )
{
partitioner.setMeta(this);
}
}
示例4: openRepository
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
private Repository openRepository( String repositoryName, String user, String pass ) throws KettleException {
if ( Utils.isEmpty( repositoryName ) ) {
return null;
}
RepositoriesMeta repositoriesMeta = new RepositoriesMeta();
repositoriesMeta.readData();
RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName );
if ( repositoryMeta == null ) {
throw new KettleException( "Unable to find repository: " + repositoryName );
}
PluginRegistry registry = PluginRegistry.getInstance();
Repository repository = registry.loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class );
repository.init( repositoryMeta );
repository.connect( user, pass );
return repository;
}
示例5: getRelevantExtenders
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public List<SpoonUiExtenderPluginInterface> getRelevantExtenders( Class<?> clazz, String uiEvent ) {
PluginRegistry instance = PluginRegistry.getInstance();
List<PluginInterface> pluginInterfaces = instance.getPlugins( SpoonUiExtenderPluginType.class );
List<SpoonUiExtenderPluginInterface> relevantPluginInterfaces = new ArrayList<SpoonUiExtenderPluginInterface>( );
if ( pluginInterfaces != null ) {
for ( PluginInterface pluginInterface : pluginInterfaces ) {
try {
Object loadClass = instance.loadClass( pluginInterface );
SpoonUiExtenderPluginInterface spoonUiExtenderPluginInterface = (SpoonUiExtenderPluginInterface) loadClass;
Set<String> events = spoonUiExtenderPluginInterface.respondsTo().get( clazz );
if ( events != null && events.contains( uiEvent ) ) {
relevantPluginInterfaces.add( spoonUiExtenderPluginInterface );
}
} catch ( KettlePluginException e ) {
e.printStackTrace();
}
}
}
return relevantPluginInterfaces;
}
示例6: openRepository
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
private void openRepository(String repositoryId) throws KettleXMLException {
try {
RepositoriesMeta repositoriesMeta = new RepositoriesMeta();
repositoriesMeta.readData();
repositoryMeta = repositoriesMeta.findRepository( repositoryId );
PluginRegistry registry = PluginRegistry.getInstance();
repository = registry.loadClass(
RepositoryPluginType.class,
repositoryMeta,
Repository.class
);
repository.init(repositoryMeta);
repository.connect(repositoryUsername, repositoryPassword);
} catch(Exception e) {
throw new KettleXMLException(e);
}
}
示例7: createPartitioner
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public void createPartitioner( String method ) throws KettlePluginException {
methodType = getMethodType( method );
switch ( methodType ) {
case PARTITIONING_METHOD_SPECIAL: {
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.findPluginWithId( PartitionerPluginType.class, method );
partitioner = (Partitioner) registry.loadClass( plugin );
partitioner.setId( plugin.getIds()[0] );
break;
}
case PARTITIONING_METHOD_NONE:
default:
partitioner = null;
}
if ( partitioner != null ) {
partitioner.setMeta( this );
}
}
示例8: JobEntryCopy
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public JobEntryCopy(Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers, Repository rep) throws KettleXMLException
{
try
{
String stype = XMLHandler.getTagValue(entrynode, "type");
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface jobPlugin = registry.findPluginWithId(JobEntryPluginType.class, stype);
if (jobPlugin == null)
throw new KettleStepLoaderException("No valid step/plugin specified (jobPlugin=null) for " + stype);
// Get an empty JobEntry of the appropriate class...
entry = (JobEntryInterface) registry.loadClass(jobPlugin, JobEntryInterface.class);
if (entry != null)
{
// System.out.println("New JobEntryInterface built of type:
// "+entry.getTypeDesc());
entry.setPluginId(jobPlugin.getIds()[0]);
entry.loadXML(entrynode, databases, slaveServers, rep);
// Handle GUI information: nr & location?
setNr(Const.toInt(XMLHandler.getTagValue(entrynode, "nr"), 0));
setLaunchingInParallel("Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "parallel")));
setDrawn("Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "draw")));
int x = Const.toInt(XMLHandler.getTagValue(entrynode, "xloc"), 0);
int y = Const.toInt(XMLHandler.getTagValue(entrynode, "yloc"), 0);
setLocation(x, y);
}
} catch (Throwable e)
{
String message = "Unable to read Job Entry copy info from XML node : " + e.toString();
throw new KettleXMLException(message, e);
}
}
示例9: getDatabaseInterfacesMap
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public static final Map<String, DatabaseInterface> getDatabaseInterfacesMap()
{
if (allDatabaseInterfaces!=null) {
return allDatabaseInterfaces;
}
// If multiple threads call this method at the same time, there may be extra work done until
// the allDatabaseInterfaces is finally set. Before we were not using a local map to populate,
// and parallel threads were getting an incomplete list, causing null pointers.
PluginRegistry registry = PluginRegistry.getInstance();
List<PluginInterface> plugins = registry.getPlugins(DatabasePluginType.class);
HashMap<String, DatabaseInterface> tmpAllDatabaseInterfaces = new HashMap<String, DatabaseInterface>();
for (PluginInterface plugin : plugins) {
try {
DatabaseInterface databaseInterface = (DatabaseInterface)registry.loadClass(plugin);
databaseInterface.setPluginId(plugin.getIds()[0]);
databaseInterface.setPluginName(plugin.getName());
tmpAllDatabaseInterfaces.put(plugin.getIds()[0], databaseInterface);
} catch (KettlePluginException cnfe) {
System.out.println("Could not create connection entry for "+plugin.getName()+". "+cnfe.getCause().getClass().getName());
LogChannel.GENERAL.logError("Could not create connection entry for "+plugin.getName()+". "+cnfe.getCause().getClass().getName());
if(logger.isDebugEnabled()) {
logger.debug("Debug-Error loading plugin: " + plugin, cnfe); //$NON-NLS-1$
}
} catch(Exception e) {
logger.error("Error loading plugin: " + plugin, e); //$NON-NLS-1$
}
}
allDatabaseInterfaces = tmpAllDatabaseInterfaces;
return allDatabaseInterfaces;
}
示例10: init
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public static void init( String encoderPluginId ) throws KettleException {
if ( Utils.isEmpty( encoderPluginId ) ) {
throw new KettleException( "Unable to initialize the two way password encoder: No encoder plugin type specified." );
}
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.findPluginWithId( TwoWayPasswordEncoderPluginType.class, encoderPluginId );
if ( plugin == null ) {
throw new KettleException( "Unable to find plugin with ID '" + encoderPluginId + "'" );
}
encoder = (TwoWayPasswordEncoderInterface) registry.loadClass( plugin );
// Load encoder specific options...
//
encoder.init();
}
示例11: testRule
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public void testRule() throws Exception {
JobMeta jobMeta = new JobMeta();
jobMeta.setDescription("This job is used for testing an import rule");
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.findPluginWithId(ImportRulePluginType.class, "JobHasDescription");
assertNotNull("The 'job has description' rule could not be found in the plugin registry!", plugin);
JobHasDescriptionImportRule rule = (JobHasDescriptionImportRule) registry.loadClass(plugin);
assertNotNull("The 'job has description rule' class could not be loaded by the plugin registry!", plugin);
rule.setMinLength(20);
rule.setEnabled(true);
List<ImportValidationFeedback> feedback = rule.verifyRule(jobMeta);
assertTrue("We didn't get any feedback from the 'job has description rule'", !feedback.isEmpty());
assertTrue("An approval ruling was expected", feedback.get(0).getResultType()==ImportValidationResultType.APPROVAL);
rule.setMinLength(2000);
rule.setEnabled(true);
feedback = rule.verifyRule(jobMeta);
assertTrue("We didn't get any feedback from the 'job has description rule'", !feedback.isEmpty());
assertTrue("An error ruling was expected", feedback.get(0).getResultType()==ImportValidationResultType.ERROR);
rule.setEnabled(false);
feedback = rule.verifyRule(jobMeta);
assertTrue("We didn't expect any feedback from the 'job has description rule' while disabled", feedback.isEmpty());
}
示例12: testRule
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public void testRule() throws Exception {
// Create a transformation to test.
//
TransMeta transMeta = new TransMeta();
NotePadMeta note = new NotePadMeta("A note documenting the transformation", 50, 50, 200, 50);
transMeta.addNote(note);
// Load the plugin to test from the registry.
//
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.findPluginWithId(ImportRulePluginType.class, "TransformationHasANote");
assertNotNull("The 'transformation has a note' rule could not be found in the plugin registry!", plugin);
TransformationHasANoteImportRule rule = (TransformationHasANoteImportRule) registry.loadClass(plugin);
assertNotNull("The 'transformation has a note' class could not be loaded by the plugin registry!", plugin);
rule.setEnabled(true);
List<ImportValidationFeedback> feedback = rule.verifyRule(transMeta);
assertTrue("We didn't get any feedback from the 'transformation has a note' rule", !feedback.isEmpty());
assertTrue("An approval ruling was expected", feedback.get(0).getResultType()==ImportValidationResultType.APPROVAL);
transMeta.removeNote(0);
feedback = rule.verifyRule(transMeta);
assertTrue("We didn't get any feedback from the 'transformation has a note' rule", !feedback.isEmpty());
assertTrue("An error ruling was expected", feedback.get(0).getResultType()==ImportValidationResultType.ERROR);
rule.setEnabled(false);
feedback = rule.verifyRule(transMeta);
assertTrue("We didn't expect any feedback from the 'transformation has a note' rule while disabled", feedback.isEmpty());
}
示例13: openRepository
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
private void openRepository( String repositoryId ) throws KettleException {
try {
RepositoriesMeta repositoriesMeta = new RepositoriesMeta();
repositoriesMeta.readData();
repositoryMeta = repositoriesMeta.findRepository( repositoryId );
if ( repositoryMeta == null ) {
throw new KettleException( "Unable to find repository: " + repositoryId );
}
PluginRegistry registry = PluginRegistry.getInstance();
repository = registry.loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class );
repository.init( repositoryMeta );
repository.connect( repositoryUsername, repositoryPassword );
// Add the repository MetaStore to the delegation as well.
// Set this one as active with the highest priority
//
if ( repository.getMetaStore() != null ) {
metaStore.addMetaStore( 0, repository.getMetaStore() );
metaStore.setActiveMetaStoreName( repository.getMetaStore().getName() );
}
LogChannel.GENERAL.logBasic( "Connected to repository '" + repository.getName() + "'" );
} catch ( Exception e ) {
throw new KettleException( "Unable to open repository connection", e );
}
}
示例14: testRule
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public void testRule() throws Exception {
// Create a job to test.
//
JobMeta jobMeta = new JobMeta();
NotePadMeta note = new NotePadMeta("A note documenting the transformation", 50, 50, 200, 50);
jobMeta.addNote(note);
// Load the plugin to test from the registry.
//
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.findPluginWithId(ImportRulePluginType.class, "JobHasANote");
assertNotNull("The 'job has a note' rule could not be found in the plugin registry!", plugin);
JobHasANoteImportRule rule = (JobHasANoteImportRule) registry.loadClass(plugin);
assertNotNull("The 'job has a note' rule class could not be loaded by the plugin registry!", plugin);
rule.setEnabled(true);
List<ImportValidationFeedback> feedback = rule.verifyRule(jobMeta);
assertTrue("We didn't get any feedback from the 'job has a note'", !feedback.isEmpty());
assertTrue("An approval ruling was expected", feedback.get(0).getResultType()==ImportValidationResultType.APPROVAL);
jobMeta.removeNote(0);
feedback = rule.verifyRule(jobMeta);
assertTrue("We didn't get any feedback from the 'job has a note' rule", !feedback.isEmpty());
assertTrue("An error ruling was expected", feedback.get(0).getResultType()==ImportValidationResultType.ERROR);
rule.setEnabled(false);
feedback = rule.verifyRule(jobMeta);
assertTrue("We didn't expect any feedback from the 'job has no note' rule while disabled", feedback.isEmpty());
}
示例15: JobEntryCopy
import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public JobEntryCopy( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers, Repository rep,
IMetaStore metaStore ) throws KettleXMLException {
try {
String stype = XMLHandler.getTagValue( entrynode, "type" );
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface jobPlugin = registry.findPluginWithId( JobEntryPluginType.class, stype );
if ( jobPlugin == null ) {
String name = XMLHandler.getTagValue( entrynode, "name" );
entry = new MissingEntry( name, stype );
} else {
entry = registry.loadClass( jobPlugin, JobEntryInterface.class );
}
// Get an empty JobEntry of the appropriate class...
if ( entry != null ) {
// System.out.println("New JobEntryInterface built of type:
// "+entry.getTypeDesc());
if ( jobPlugin != null ) {
entry.setPluginId( jobPlugin.getIds()[0] );
}
entry.setMetaStore( metaStore ); // inject metastore
entry.loadXML( entrynode, databases, slaveServers, rep, metaStore );
compatibleLoadXml( entrynode, databases, slaveServers, rep );
// Handle GUI information: nr & location?
setNr( Const.toInt( XMLHandler.getTagValue( entrynode, "nr" ), 0 ) );
setLaunchingInParallel( "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "parallel" ) ) );
setDrawn( "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "draw" ) ) );
int x = Const.toInt( XMLHandler.getTagValue( entrynode, "xloc" ), 0 );
int y = Const.toInt( XMLHandler.getTagValue( entrynode, "yloc" ), 0 );
setLocation( x, y );
attributesMap = AttributesUtil.loadAttributes( XMLHandler.getSubNode( entrynode, AttributesUtil.XML_TAG ) );
}
} catch ( Throwable e ) {
String message = "Unable to read Job Entry copy info from XML node : " + e.toString();
throw new KettleXMLException( message, e );
}
}