当前位置: 首页>>代码示例>>Java>>正文


Java PluginRegistry.getPlugin方法代码示例

本文整理汇总了Java中org.pentaho.di.core.plugins.PluginRegistry.getPlugin方法的典型用法代码示例。如果您正苦于以下问题:Java PluginRegistry.getPlugin方法的具体用法?Java PluginRegistry.getPlugin怎么用?Java PluginRegistry.getPlugin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.core.plugins.PluginRegistry的用法示例。


在下文中一共展示了PluginRegistry.getPlugin方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJobEntryDialog

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public JobEntryDialogInterface getJobEntryDialog(JobEntryInterface jobEntryInterface, JobMeta jobMeta)
{
	PluginRegistry registry = PluginRegistry.getInstance();
	String dialogClassName = jobEntryInterface.getDialogClassName();
	try
	{
		Class<?> dialogClass;
		Class<?>[] paramClasses = new Class[] { spoon.getShell().getClass(), JobEntryInterface.class,
				Repository.class, JobMeta.class };
		Object[] paramArgs = new Object[] { spoon.getShell(), jobEntryInterface, spoon.getRepository(), jobMeta };
		Constructor<?> dialogConstructor;
		
		PluginInterface plugin = registry.getPlugin(JobEntryPluginType.class, jobEntryInterface);
		dialogClass = PluginRegistry.getInstance().getClass(plugin, dialogClassName);
		dialogConstructor = dialogClass.getConstructor(paramClasses);
		return (JobEntryDialogInterface) dialogConstructor.newInstance(paramArgs);
	} catch (Throwable t)
	{
		t.printStackTrace();
		spoon.getLog().logError(spoon.toString(), "Could not create dialog for " + dialogClassName, t);
	}
	return null;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:24,代码来源:SpoonJobDelegate.java

示例2: getVersionBrowserDialog

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public static final RepositoryRevisionBrowserDialogInterface getVersionBrowserDialog(Shell shell, Repository repository, final RepositoryElementInterface element) throws Exception {
	
	String className = repository.getRepositoryMeta().getRevisionBrowserDialogClassName();
	PluginRegistry registry = PluginRegistry.getInstance();
	PluginInterface plugin = registry.getPlugin(RepositoryPluginType.class, repository.getRepositoryMeta().getId());
	Class<? extends RepositoryRevisionBrowserDialogInterface> dialogClass = registry.getClass(plugin, className);
	Constructor<?> constructor = dialogClass.getConstructor(Shell.class, Integer.TYPE, Repository.class, RepositoryElementInterface.class);
	return (RepositoryRevisionBrowserDialogInterface) constructor.newInstance(new Object[] { shell, Integer.valueOf(SWT.NONE), repository, element, });
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:10,代码来源:RepositoryExplorerDialog.java

示例3: findDatabaseInterface

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
/**
 * Search for the right type of DatabaseInterface object and return it.
 * 
 * @param databaseType the type of DatabaseInterface to look for (id or description)
 * @return The requested DatabaseInterface
 * 
 * @throws KettleDatabaseException when the type could not be found or referenced.
 */
private static final DatabaseInterface findDatabaseInterface(String databaseTypeDesc) throws KettleDatabaseException
{
	PluginRegistry registry = PluginRegistry.getInstance();
	PluginInterface plugin = registry.getPlugin(DatabasePluginType.class, databaseTypeDesc);
	if (plugin==null) {
		plugin = registry.findPluginWithName(DatabasePluginType.class, databaseTypeDesc); 
	}
	
	if (plugin==null) {
		throw new KettleDatabaseException("database type with plugin id ["+databaseTypeDesc+"] couldn't be found!");
	}
	
	return getDatabaseInterfacesMap().get(plugin.getIds()[0]);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:23,代码来源:DatabaseMeta.java

示例4: getDatabaseFactory

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public DatabaseFactoryInterface getDatabaseFactory() throws Exception
{
	PluginRegistry registry = PluginRegistry.getInstance();
	PluginInterface plugin = registry.getPlugin(DatabasePluginType.class, databaseInterface.getPluginId());
	if (plugin==null) {
		throw new KettleDatabaseException("database type with plugin id ["+databaseInterface.getPluginId()+"] couldn't be found!");
	}
	
	ClassLoader loader = registry.getClassLoader(plugin);
	
	Class<?> clazz = Class.forName(databaseInterface.getDatabaseFactoryName(),true,loader);
	return (DatabaseFactoryInterface)clazz.newInstance();
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:14,代码来源:DatabaseMeta.java

示例5: getVersionBrowserDialog

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public static final RepositoryRevisionBrowserDialogInterface getVersionBrowserDialog( Shell shell,
  Repository repository, final RepositoryElementInterface element ) throws Exception {

  String className = repository.getRepositoryMeta().getRevisionBrowserDialogClassName();
  PluginRegistry registry = PluginRegistry.getInstance();
  PluginInterface plugin =
    registry.getPlugin( RepositoryPluginType.class, repository.getRepositoryMeta().getId() );
  Class<? extends RepositoryRevisionBrowserDialogInterface> dialogClass = registry.getClass( plugin, className );
  Constructor<?> constructor =
    dialogClass.getConstructor( Shell.class, Integer.TYPE, Repository.class, RepositoryElementInterface.class );
  return (RepositoryRevisionBrowserDialogInterface) constructor.newInstance( new Object[] {
    shell, Integer.valueOf( SWT.NONE ), repository, element, } );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:14,代码来源:RepositoryExplorerDialog.java

示例6: getStepDialog

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public StepDialogInterface getStepDialog( StepMetaInterface stepMeta, TransMeta transMeta, String stepName ) throws KettleException {
  Class<?>[] paramClasses = new Class<?>[] { Shell.class, Object.class, TransMeta.class, String.class };
  Object[] paramArgs = new Object[] { spoon.getShell(), stepMeta, transMeta, stepName };

  PluginRegistry registry = PluginRegistry.getInstance();
  PluginInterface plugin = registry.getPlugin( StepPluginType.class, stepMeta );
  String dialogClassName = plugin.getClassMap().get( StepDialogInterface.class );
  if ( dialogClassName == null ) {
    // try the deprecated way
    log.logDebug( "Use of StepMetaInterface#getDialogClassName is deprecated, use StepDialog annotation instead." );
    dialogClassName = stepMeta.getDialogClassName();
  }

  try {
    Class<StepDialogInterface> dialogClass = registry.getClass( plugin, dialogClassName );
    Constructor<StepDialogInterface> dialogConstructor = dialogClass.getConstructor( paramClasses );
    return dialogConstructor.newInstance( paramArgs );
  } catch ( Exception e ) {
    // try the old way for compatibility
    try {
      Class<?>[] sig = new Class<?>[] { Shell.class, StepMetaInterface.class, TransMeta.class, String.class };
      Method method = stepMeta.getClass().getDeclaredMethod( "getDialog", sig );
      if ( method != null ) {
        log.logDebug( "Use of StepMetaInterface#getDialog is deprecated, use StepDialog annotation instead." );
        return (StepDialogInterface) method.invoke( stepMeta, paramArgs );
      }
    } catch ( Throwable ignored ) { }

    String errorTitle = BaseMessages.getString( PKG, "Spoon.Dialog.ErrorCreatingStepDialog.Title" );
    String errorMsg = BaseMessages.getString( PKG, "Spoon.Dialog.ErrorCreatingStepDialog.Message", dialogClassName );
    new ErrorDialog( spoon.getShell(), errorTitle, errorMsg, e );
    throw new KettleException( e );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:35,代码来源:SpoonStepsDelegate.java

示例7: getJobEntryDialog

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public JobEntryDialogInterface getJobEntryDialog( JobEntryInterface jobEntryInterface, JobMeta jobMeta ) {
  PluginRegistry registry = PluginRegistry.getInstance();
  String dialogClassName = jobEntryInterface.getDialogClassName();
  try {
    Class<?> dialogClass;
    Class<?>[] paramClasses =
      new Class<?>[] { spoon.getShell().getClass(), JobEntryInterface.class, Repository.class, JobMeta.class };
    Object[] paramArgs = new Object[] { spoon.getShell(), jobEntryInterface, spoon.getRepository(), jobMeta };
    Constructor<?> dialogConstructor;

    try {
      PluginInterface plugin = registry.getPlugin( JobEntryPluginType.class, jobEntryInterface );
      dialogClass = PluginRegistry.getInstance().getClass( plugin, dialogClassName );
    } catch ( Exception e ) {
      dialogClass = Class.forName( dialogClassName, true, jobEntryInterface.getClass().getClassLoader() );
    }
    dialogConstructor = dialogClass.getConstructor( paramClasses );
    JobEntryDialogInterface entryDialogInterface =
      (JobEntryDialogInterface) dialogConstructor.newInstance( paramArgs );
    entryDialogInterface.setMetaStore( spoon.getMetaStore() );
    return entryDialogInterface;
  } catch ( Throwable t ) {
    t.printStackTrace();
    spoon.getLog().logError( spoon.toString(), "Could not create dialog for " + dialogClassName, t );
    return null;
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:28,代码来源:SpoonJobDelegate.java

示例8: findDatabaseInterface

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
/**
 * Search for the right type of DatabaseInterface object and return it.
 *
 * @param databaseTypeDesc
 *          the type of DatabaseInterface to look for (id or description)
 * @return The requested DatabaseInterface
 *
 * @throws KettleDatabaseException
 *           when the type could not be found or referenced.
 */
private static final DatabaseInterface findDatabaseInterface( String databaseTypeDesc ) throws KettleDatabaseException {
  PluginRegistry registry = PluginRegistry.getInstance();
  PluginInterface plugin = registry.getPlugin( DatabasePluginType.class, databaseTypeDesc );
  if ( plugin == null ) {
    plugin = registry.findPluginWithName( DatabasePluginType.class, databaseTypeDesc );
  }

  if ( plugin == null ) {
    throw new KettleDatabaseException( "database type with plugin id ["
      + databaseTypeDesc + "] couldn't be found!" );
  }

  return getDatabaseInterfacesMap().get( plugin.getIds()[0] );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:DatabaseMeta.java

示例9: getDatabaseFactory

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public DatabaseFactoryInterface getDatabaseFactory() throws Exception {
  PluginRegistry registry = PluginRegistry.getInstance();
  PluginInterface plugin = registry.getPlugin( DatabasePluginType.class, databaseInterface.getPluginId() );
  if ( plugin == null ) {
    throw new KettleDatabaseException( "database type with plugin id ["
      + databaseInterface.getPluginId() + "] couldn't be found!" );
  }

  ClassLoader loader = registry.getClassLoader( plugin );

  Class<?> clazz = Class.forName( databaseInterface.getDatabaseFactoryName(), true, loader );
  return (DatabaseFactoryInterface) clazz.newInstance();
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:14,代码来源:DatabaseMeta.java


注:本文中的org.pentaho.di.core.plugins.PluginRegistry.getPlugin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。