本文整理汇总了Java中org.pentaho.di.core.plugins.PluginRegistry类的典型用法代码示例。如果您正苦于以下问题:Java PluginRegistry类的具体用法?Java PluginRegistry怎么用?Java PluginRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PluginRegistry类属于org.pentaho.di.core.plugins包,在下文中一共展示了PluginRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isBigDataPluginInstalled
import org.pentaho.di.core.plugins.PluginRegistry; //导入依赖的package包/类
public boolean isBigDataPluginInstalled() throws KettleException
{
if( PluginRegistry.getInstance().findPluginWithId( JobEntryPluginType.class, "HadoopTransJobExecutorPlugin" ) != null )
{
try {
PluginRegistry.getInstance().loadClass(
PluginRegistry.getInstance().findPluginWithId( JobEntryPluginType.class, "HadoopTransJobExecutorPlugin" ) );
} catch (KettlePluginException ex)
{
throw new KettleException( ex.getMessage(), ex );
}
return true;
}
return false;
}
示例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(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();
}
示例3: 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();
}
示例4: 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;
}
示例5: 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);
}
}
示例6: 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;
}
示例7: getMethodType
import org.pentaho.di.core.plugins.PluginRegistry; //导入依赖的package包/类
public static final int getMethodType(String description)
{
for (int i=0;i<methodDescriptions.length;i++)
{
if (methodDescriptions[i].equalsIgnoreCase(description)){
return i;
}
}
for (int i=0;i<methodCodes.length;i++)
{
if (methodCodes[i].equalsIgnoreCase(description)) return i;
}
PluginInterface plugin = PluginRegistry.getInstance().findPluginWithId(PartitionerPluginType.class, description );
if( plugin != null ) {
return PARTITIONING_METHOD_SPECIAL;
}
return PARTITIONING_METHOD_NONE;
}
示例8: 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);
}
}
示例9: StepMeta
import org.pentaho.di.core.plugins.PluginRegistry; //导入依赖的package包/类
/**
* @param stepname The name of the new step
* @param stepMetaInterface The step metadata interface to use (TextFileInputMeta, etc)
*/
public StepMeta(String stepname, StepMetaInterface stepMetaInterface)
{
if (stepMetaInterface!=null)
{
this.stepid = PluginRegistry.getInstance().getPluginId(StepPluginType.class, stepMetaInterface);
}
this.stepname = stepname;
setStepMetaInterface( stepMetaInterface );
selected = false;
distributes = true;
copies = 1;
location = new Point(0,0);
drawstep = false;
description = null;
stepPartitioningMeta = new StepPartitioningMeta();
// targetStepPartitioningMeta = new StepPartitioningMeta();
clusterSchema = null; // non selected by default.
remoteInputSteps = new ArrayList<RemoteStep>();
remoteOutputSteps = new ArrayList<RemoteStep>();
}
示例10: editRepository
import org.pentaho.di.core.plugins.PluginRegistry; //导入依赖的package包/类
public void editRepository() {
try {
PluginInterface plugin = null;
RepositoryMeta ri = input.searchRepository(model.getSelectedRepository().getName());
if (ri != null) {
plugin = PluginRegistry.getInstance().getPlugin(RepositoryPluginType.class, ri.getId());
if (plugin == null) {
throw new KettleException(BaseMessages.getString(PKG, "RepositoryLogin.ErrorFindingPlugin", ri.getId())); //$NON-NLS-1$
}
}
RepositoryDialogInterface dd = getRepositoryDialog(plugin, ri, input, this.shell);
if (dd.open(MODE.EDIT) != null) {
fillRepositories();
int idx = input.indexOfRepository(ri);
model.setSelectedRepository(input.getRepository(idx));
writeData();
}
} catch (Exception e) {
log.logDetailed(BaseMessages.getString(PKG, "RepositoryLogin.ErrorEditingRepository", e.getLocalizedMessage()));//$NON-NLS-1$
new ErrorDialog(shell, BaseMessages.getString(PKG, "Dialog.Error"), BaseMessages.getString(PKG, "RepositoryLogin.ErrorEditingRepository", e.getLocalizedMessage()), e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
示例11: 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;
}
示例12: loadStepImages
import org.pentaho.di.core.plugins.PluginRegistry; //导入依赖的package包/类
private Map<String, BufferedImage> loadStepImages() throws KettleException {
Map<String, BufferedImage> map = new HashMap<String, BufferedImage>();
for (PluginInterface plugin: PluginRegistry.getInstance().getPlugins(StepPluginType.class)) {
try {
BufferedImage image = getImageIcon(plugin);
for (String id : plugin.getIds()) {
map.put(id, image);
}
} catch(Exception e) {
log.logError("Unable to load step icon image for plugin: "+plugin.getName()+" (id="+plugin.getIds()[0], e);
try {
getImageIcon(plugin);
} catch(Exception ex) {
//
}
}
}
return map;
}
示例13: 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 );
dmi = new DeleteMeta();
dd = new DeleteData();
PluginRegistry plugReg = PluginRegistry.getInstance();
String deletePid = plugReg.getPluginId( StepPluginType.class, dmi );
stepMeta = new StepMeta( deletePid, "delete", dmi );
Trans trans = new Trans( transMeta );
transMeta.addStep( stepMeta );
del = new Delete( stepMeta, dd, 1, transMeta, trans );
del.copyVariablesFrom( transMeta );
}
示例14: editRepository
import org.pentaho.di.core.plugins.PluginRegistry; //导入依赖的package包/类
public void editRepository() {
try {
PluginInterface plugin = null;
RepositoryMeta ri = input.searchRepository( model.getSelectedRepository().getName() );
if ( ri != null ) {
plugin = PluginRegistry.getInstance().getPlugin( RepositoryPluginType.class, ri.getId() );
if ( plugin == null ) {
throw new KettleException( BaseMessages
.getString( PKG, "RepositoryLogin.ErrorFindingPlugin", ri.getId() ) );
}
}
RepositoryDialogInterface dd = getRepositoryDialog( plugin, ri, input, this.shell );
if ( dd.open( MODE.EDIT ) != null ) {
fillRepositories();
int idx = input.indexOfRepository( ri );
model.setSelectedRepository( input.getRepository( idx ) );
writeData();
}
} catch ( Exception e ) {
log.logDetailed( BaseMessages.getString( PKG, "RepositoryLogin.ErrorEditingRepository", e
.getLocalizedMessage() ) );
new ErrorDialog( shell, BaseMessages.getString( PKG, "Dialog.Error" ), BaseMessages.getString(
PKG, "RepositoryLogin.ErrorEditingRepository", e.getLocalizedMessage() ), e );
}
}
示例15: setUpLoadSave
import org.pentaho.di.core.plugins.PluginRegistry; //导入依赖的package包/类
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init( true );
List<String> attributes =
Arrays.asList( "databaseMeta", "sQL", "rowLimit", "executeEachInputRow", "variableReplacementActive", "lazyConversionActive" );
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
loadSaveTester =
new LoadSaveTester( testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap );
}