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


Java PluginRegistry.getPlugins方法代码示例

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


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

示例1: doGet

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.setContentType("application/json");
    final PluginRegistry registry = PluginRegistry.getInstance();
    final List<PluginInterface> basesteps = registry.getPlugins(StepPluginType.class);
    final List<String> basecat = registry.getCategories(StepPluginType.class);

    List<Map<String, Object>> categoryList = new ArrayList<Map<String, Object>>();
    Map<String, Map<String, Object>> categoryMap = new HashMap<String, Map<String, Object>>();
    for (String category : basecat) {
        getCategoryMap(category, categoryList, categoryMap);
    }
    for (PluginInterface pluginInterface : basesteps) {
        Map<String, Object> thisCategory = getCategoryMap(pluginInterface.getCategory(), categoryList, categoryMap);
        List<Map<String, String>> stepList = (List<Map<String, String>>) thisCategory.get("steps");
        Map<String, String> step = new HashMap<String, String>();
        step.put("name", pluginInterface.getIds()[0]);
        step.put("label", pluginInterface.getName());
        step.put("image", KThinStepImageServlet.CONTEXT_PATH.substring(1) + "/?name=" + pluginInterface.getIds()[0]);
        stepList.add(step);
    }
    resp.getWriter().print(JSON.toString(categoryList));
    resp.getWriter().flush();
}
 
开发者ID:brosander,项目名称:kettle-plugins,代码行数:25,代码来源:KThinStepListServlet.java

示例2: doGet

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.setContentType("application/json");
    final PluginRegistry registry = PluginRegistry.getInstance();
    final List<PluginInterface> basesteps = registry.getPlugins(JobEntryPluginType.class);
    final List<String> basecat = registry.getCategories(JobEntryPluginType.class);

    List<Map<String, Object>> categoryList = new ArrayList<Map<String, Object>>();
    Map<String, Map<String, Object>> categoryMap = new HashMap<String, Map<String, Object>>();
    for (String category : basecat) {
        getCategoryMap(category, categoryList, categoryMap);
    }
    addEntry(categoryList, categoryMap, "General", JobMeta.STRING_SPECIAL_START, "Start");
    addEntry(categoryList, categoryMap, "General", JobMeta.STRING_SPECIAL_DUMMY, "Dummy");
    for (PluginInterface pluginInterface : basesteps) {
        // Because these are called out differently in kettle
        if ("SPECIAL".equals(pluginInterface.getIds()[0])) {
            continue;
        }
        addEntry(categoryList, categoryMap, pluginInterface.getCategory(), pluginInterface.getIds()[0], pluginInterface.getName()) ;
    }

    resp.getWriter().print(JSON.toString(categoryList));
    resp.getWriter().flush();
}
 
开发者ID:brosander,项目名称:kettle-plugins,代码行数:26,代码来源:KThinJobEntryListServlet.java

示例3: 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;
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:26,代码来源:SpoonUiExtenderPluginType.java

示例4: init

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected synchronized void init() {
	super.createLogChannel();
	properties = new Properties();
       pluginHistory = new ArrayList<ObjectUsageCount>();

       setDefault();
       loadProps();
       addDefaultEntries();
       
       loadPluginHistory();

	loadScreens();
       loadLastUsedFiles();
       loadOpenTabFiles();

       PluginRegistry registry = PluginRegistry.getInstance();
       List<PluginInterface> plugins = registry.getPlugins(LifecyclePluginType.class);
       List<GUIOption<Object>> leditables = new ArrayList<GUIOption<Object>>();
       for (PluginInterface plugin : plugins) {
       	try {
       		leditables.add( registry.loadClass(plugin, GUIOption.class) );
       	} catch(Exception e) {
       		LogChannel.GENERAL.logError("Unexpected error loading class for plugin "+plugin.getName(), e);
       	}
       }
       
       editables = Collections.unmodifiableList(leditables);

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:31,代码来源:PropsUI.java

示例5: LifecycleSupport

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public LifecycleSupport()
{
	lifeListeners = new HashSet<LifecycleListener>();
       PluginRegistry registry = PluginRegistry.getInstance();
       List<PluginInterface> plugins = registry.getPlugins(LifecyclePluginType.class);
       for (PluginInterface plugin : plugins) {
       	try {
       		lifeListeners.add( registry.loadClass(plugin, LifecycleListener.class) );
       	} catch(KettleException e) {
       		LogChannel.GENERAL.logError("Unexpected error loading class for plugin "+plugin.getName(), e);
       	}
       }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:14,代码来源:LifecycleSupport.java

示例6: 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;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:34,代码来源:DatabaseMeta.java

示例7: loadPlugins

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
/**
 * Instantiate the main plugin class types for the plugin type provided from
 * the set of registered plugins via {@link PluginRegistry}.
 *
 * @param pluginType Type of plugin whose main class types should be instanticated
 * @return Set of plugin main class instances (a.k.a. plugins)
 */
static <T> Set<T> loadPlugins(Class<? extends PluginTypeInterface> pluginType, Class<T> mainPluginClass) {
  Set<T> pluginInstances = new HashSet<T>();
  PluginRegistry registry = PluginRegistry.getInstance();
  List<PluginInterface> plugins = registry.getPlugins(pluginType);
  for (PluginInterface plugin : plugins) {
    try {
      pluginInstances.add(registry.loadClass(plugin, mainPluginClass));
    } catch (Throwable e) {
      LogChannel.GENERAL.logError("Unexpected error loading class for plugin " + plugin.getName(), e);
    }
  }
  return pluginInstances;
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:21,代码来源:LifecycleSupport.java

示例8: loadPlugins

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
/**
 * Instantiate the main plugin class types for the plugin type provided from
 * the set of registered plugins via {@link PluginRegistry}.
 *
 * @param pluginType Type of plugin whose main class types should be instanticated
 * @return Set of plugin main class instances (a.k.a. plugins)
 */
static <T> Set<T> loadPlugins(Class<? extends PluginTypeInterface> pluginType, Class<T> mainPluginClass) {
  Set<T> pluginInstances = new HashSet<T>();
  PluginRegistry registry = PluginRegistry.getInstance();
  List<PluginInterface> plugins = registry.getPlugins(pluginType);
  for (PluginInterface plugin : plugins) {
    try {
      pluginInstances.add(registry.loadClass(plugin, mainPluginClass));
    } catch(Throwable e) {
      LogChannel.GENERAL.logError("Unexpected error loading class for plugin "+plugin.getName(), e);
    }
  }
  return pluginInstances;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:21,代码来源:LifecycleSupport.java

示例9: loadValueMetaPlugins

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
private void loadValueMetaPlugins() {
  // Need to load the ValueMeta plugins
  PluginRegistry registry = PluginRegistry.getInstance();
  assertNotNull( "Registry singleton was not found!", registry );

  // Register a new plugin type...
  //
  PluginRegistry.addPluginType( ValueMetaPluginType.getInstance() );

  // Plugin Registry should initialize without exception
  Exception initException = null;
  try {
    PluginRegistry.init();
  } catch ( Exception e ) {
    initException = e;
  }
  assertNull( initException );

  // There will always be a PluginRegistryPluginType, so see if we enough plugin types here.
  //
  List<Class<? extends PluginTypeInterface>> pluginTypes = registry.getPluginTypes();
  assertTrue( "At least two plugin types expected in the registry", pluginTypes.size() > 1 );

  // ... and have at least 1 ValueMetaPlugin
  List<PluginInterface> valueMetaPlugins = registry.getPlugins( ValueMetaPluginType.class );
  assertTrue( "Size of plugins list expected to be >1", valueMetaPlugins.size() > 1 );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:28,代码来源:StringEvaluatorIT.java

示例10: SpoonPluginManager

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
private SpoonPluginManager() {
  PluginRegistry pluginRegistry = getPluginRegistry();
  pluginRegistry.addPluginListener( SpoonPluginType.class, this );

  List<PluginInterface> plugins = pluginRegistry.getPlugins( SpoonPluginType.class );
  for ( PluginInterface plug : plugins ) {
    pluginAdded( plug );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:10,代码来源:SpoonPluginManager.java

示例11: reInitialize

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
/**
 * 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();
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:ExtensionPointMap.java

示例12: init

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
@SuppressWarnings( "unchecked" )
protected synchronized void init() {
  super.createLogChannel();
  properties = new Properties();
  pluginHistory = new ArrayList<ObjectUsageCount>();

  setDefault();
  loadProps();
  addDefaultEntries();

  loadPluginHistory();

  loadScreens();
  loadLastUsedFiles();
  loadLastUsedRepoFiles();
  loadOpenTabFiles();
  resetRecentSearches();

  PluginRegistry registry = PluginRegistry.getInstance();
  List<PluginInterface> plugins = registry.getPlugins( LifecyclePluginType.class );
  List<GUIOption<Object>> leditables = new ArrayList<GUIOption<Object>>();
  for ( PluginInterface plugin : plugins ) {
    if ( !plugin.getClassMap().keySet().contains( GUIOption.class ) ) {
      continue;
    }

    try {
      GUIOption<Object> loaded = registry.loadClass( plugin, GUIOption.class );
      if ( loaded != null ) {
        leditables.add( loaded );
      }
    } catch ( ClassCastException cce ) {
      // Not all Lifecycle plugins implement GUIOption, keep calm and carry on
      LogChannel.GENERAL.logDebug( "Plugin " + plugin.getIds()[0]
          + " does not implement GUIOption, it will not be editable" );
    } catch ( Exception e ) {
      LogChannel.GENERAL.logError( "Unexpected error loading class for plugin " + plugin.getName(), e );
    }
  }

  editables = Collections.unmodifiableList( leditables );

}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:44,代码来源:PropsUI.java

示例13: loadStepImages

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
/**
 * Load all step images from files.
 */
private void loadStepImages() {
  // imagesSteps.clear();
  // imagesStepsSmall.clear();

  //
  // STEP IMAGES TO LOAD
  //
  PluginRegistry registry = PluginRegistry.getInstance();

  List<PluginInterface> steps = registry.getPlugins( StepPluginType.class );
  for ( PluginInterface step : steps ) {
    if ( imagesSteps.get( step.getIds()[ 0 ] ) != null ) {
      continue;
    }

    SwtUniversalImage image = null;
    Image small_image = null;

    String filename = step.getImageFile();
    try {
      ClassLoader classLoader = registry.getClassLoader( step );
      image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename );
    } catch ( Throwable t ) {
      log.logError( "Error occurred loading image [" + filename + "] for plugin " + step, t );
    } finally {
      if ( image == null ) {
        log.logError( "Unable to load image file [" + filename + "] for plugin " + step );
        image = SwtSvgImageUtil.getMissingImage( display );
      }
    }

    // Calculate the smaller version of the image @ 16x16...
    // Perhaps we should make this configurable?
    //
    small_image = image.getAsBitmapForSize( display, ConstUI.MEDIUM_ICON_SIZE, ConstUI.MEDIUM_ICON_SIZE );

    imagesSteps.put( step.getIds()[ 0 ], image );
    imagesStepsSmall.put( step.getIds()[ 0 ], small_image );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:44,代码来源:GUIResource.java

示例14: loadJobEntryImages

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
/**
 * Load all step images from files.
 */
private void loadJobEntryImages() {
  imagesJobentries = new Hashtable<String, SwtUniversalImage>();
  imagesJobentriesSmall = new Hashtable<String, Image>();

  // //
  // // JOB ENTRY IMAGES TO LOAD
  // //
  PluginRegistry registry = PluginRegistry.getInstance();

  List<PluginInterface> plugins = registry.getPlugins( JobEntryPluginType.class );
  for ( int i = 0; i < plugins.size(); i++ ) {
    PluginInterface plugin = plugins.get( i );

    if ( "SPECIAL".equals( plugin.getIds()[ 0 ] ) ) {
      continue;
    }

    SwtUniversalImage image = null;
    Image small_image = null;

    String filename = plugin.getImageFile();
    try {
      ClassLoader classLoader = registry.getClassLoader( plugin );
      image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename );
    } catch ( Throwable t ) {
      log.logError( "Error occurred loading image [" + filename + "] for plugin " + plugin.getIds()[ 0 ], t );
    } finally {
      if ( image == null ) {
        log.logError( "Unable to load image [" + filename + "] for plugin " + plugin.getIds()[ 0 ] );
        image = SwtSvgImageUtil.getMissingImage( display );
      }
    }
    // Calculate the smaller version of the image @ 16x16...
    // Perhaps we should make this configurable?
    //
    if ( image != null ) {
      small_image = image.getAsBitmapForSize( display, ConstUI.MEDIUM_ICON_SIZE, ConstUI.MEDIUM_ICON_SIZE );
    }

    imagesJobentries.put( plugin.getIds()[ 0 ], image );
    imagesJobentriesSmall.put( plugin.getIds()[ 0 ], small_image );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:47,代码来源:GUIResource.java


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