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


Java PluginRegistry.getInstance方法代码示例

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


在下文中一共展示了PluginRegistry.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:18,代码来源:ExecuteTransServlet.java

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

示例5: generatePreviewTransformation

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public static final TransMeta generatePreviewTransformation(VariableSpace parent, StepMetaInterface oneMeta, String oneStepname)
{
    PluginRegistry registry = PluginRegistry.getInstance();

    TransMeta previewMeta = new TransMeta(parent);
    // The following operation resets the internal variables!
    //
    previewMeta.setName(parent==null ? "Preview transformation" : parent.toString());
    
    // At it to the first step.
    StepMeta one = new StepMeta(registry.getPluginId(StepPluginType.class, oneMeta), oneStepname, oneMeta);
    one.setLocation(50,50);
    one.setDraw(true);
    previewMeta.addStep(one);
    
    DummyTransMeta twoMeta = new DummyTransMeta();
    StepMeta two = new StepMeta(registry.getPluginId(StepPluginType.class, twoMeta), "dummy", twoMeta); //$NON-NLS-1$
    two.setLocation(250,50);
    two.setDraw(true);
    previewMeta.addStep(two);
    
    TransHopMeta hop = new TransHopMeta(one, two);
    previewMeta.addTransHop(hop);
    
    return previewMeta;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:27,代码来源:TransPreviewFactory.java

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

示例8: createTransformationMeta

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
/**
 * Creates a transformation with a row generator step and 
 * hopped to a GPLoadStep with the passed name.
 * 
 * @param gpLoadStepname The name of the GPLoad step.
 * 
 * @throws KettleException
 */
public TransMeta createTransformationMeta(String gpLoadStepname)
      throws Exception {

   // Create a new transformation...
   TransMeta transMeta = new TransMeta();
   transMeta.setName("row generatortest");

   // Add a database connection to the trans meta
   transMeta.addDatabase(new DatabaseMeta(GREENPLUM_DATABASE_CONNECTION));

   // get a reference to the plugin registry
   PluginRegistry registry = PluginRegistry.getInstance();
   if (registry == null) {
      throw new Exception("Plugin registry is null.  Make sure that the Kettle environment was initialized.");
   }

   // create the GPLoad step
   GPLoadMeta gpLoadMeta = new GPLoadMeta();
   String dummyPid = registry.getPluginId(StepPluginType.class, gpLoadMeta);
   StepMeta gpLoadStepMeta = new StepMeta(dummyPid, gpLoadStepname, (StepMetaInterface) gpLoadMeta);
   transMeta.addStep(gpLoadStepMeta);

   return transMeta;
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:33,代码来源:GPLoadTests.java

示例9: 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

示例10: setUp

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
@Before
public void setUp() {
  TransMeta transMeta = new TransMeta();
  transMeta.setName( "delete1" );

  Map<String, String> vars = new HashMap<String, String>();
  vars.put( "max.sz", "10" );
  transMeta.injectVariables( vars );

  umi = new InsertUpdateMeta();
  ud = new InsertUpdateData();

  PluginRegistry plugReg = PluginRegistry.getInstance();
  String deletePid = plugReg.getPluginId( StepPluginType.class, umi );

  stepMeta = new StepMeta( deletePid, "delete", umi );
  Trans trans = new Trans( transMeta );
  transMeta.addStep( stepMeta );
  upd = new InsertUpdate( stepMeta, ud, 1, transMeta, trans );
  upd.copyVariablesFrom( transMeta );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:22,代码来源:InsertUpdateMetaTest.java

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

示例12: KettleDatabaseRepositoryCreationHelper

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public KettleDatabaseRepositoryCreationHelper(KettleDatabaseRepository repository) {
	this.repository = repository;
	this.databaseMeta = this.repository.getDatabaseMeta();
	this.database = this.repository.getDatabase();

	this.log = repository.getLog();
	this.pluginRegistry = PluginRegistry.getInstance();
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:9,代码来源:KettleDatabaseRepositoryCreationHelper.java

示例13: getMethod

import org.pentaho.di.core.plugins.PluginRegistry; //导入方法依赖的package包/类
public static final String getMethod(String name)
{
	if (Const.isEmpty(name)) return methodCodes[PARTITIONING_METHOD_NONE];
	
    for (int i=0;i<methodDescriptions.length;i++)
    {
        if (methodDescriptions[i].equalsIgnoreCase(name)){
        	return methodCodes[i];
        }
    }
    
    for (int i=0;i<methodCodes.length;i++)
    {
        if (methodCodes[i].equalsIgnoreCase(name)) return methodCodes[i];
    }
    
    PluginRegistry registry = PluginRegistry.getInstance();
    PluginInterface plugin = registry.findPluginWithName(PartitionerPluginType.class, name);
    if( plugin != null ) {
    	return name;
    }
    plugin = registry.findPluginWithId(PartitionerPluginType.class, name);
    if( plugin != null ) {
    	return name;
    }

    
    return methodCodes[PARTITIONING_METHOD_NONE];
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:30,代码来源:StepPartitioningMeta.java

示例14: 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

示例15: 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


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