Java源码示例:org.pentaho.di.core.annotations.Step

示例1
public static PluginInterface getStepPluginForClass( Class<? extends StepMetaInterface> metaClass ) {
  Step stepAnnotation = metaClass.getAnnotation( Step.class );

  return new Plugin(
    new String[] { stepAnnotation.id() },
    StepPluginType.class,
    metaClass,
    stepAnnotation.categoryDescription(),
    stepAnnotation.name(),
    stepAnnotation.description(),
    stepAnnotation.image(),
    stepAnnotation.isSeparateClassLoaderNeeded(),
    false,
    new HashMap<>(),
    new ArrayList<>(),
    stepAnnotation.documentationUrl(),
    null
  );
}
 
示例2
@Test
public void testStepAnnotations() {

    // PDI Plugin Annotation-based Classloader checks
    Step stepAnnotation = KafkaConsumerMeta.class.getAnnotation(Step.class);
    assertNotNull(stepAnnotation);
    assertFalse(Utils.isEmpty(stepAnnotation.id()));
    assertFalse(Utils.isEmpty(stepAnnotation.name()));
    assertFalse(Utils.isEmpty(stepAnnotation.description()));
    assertFalse(Utils.isEmpty(stepAnnotation.image()));
    assertFalse(Utils.isEmpty(stepAnnotation.categoryDescription()));
    assertFalse(Utils.isEmpty(stepAnnotation.i18nPackageName()));
    assertFalse(Utils.isEmpty(stepAnnotation.documentationUrl()));
    assertFalse(Utils.isEmpty(stepAnnotation.casesUrl()));
    assertEquals(KafkaConsumerMeta.class.getPackage().getName(), stepAnnotation.i18nPackageName());
    hasi18nValue(stepAnnotation.i18nPackageName(), stepAnnotation.name());
    hasi18nValue(stepAnnotation.i18nPackageName(), stepAnnotation.description());
    hasi18nValue(stepAnnotation.i18nPackageName(), stepAnnotation.documentationUrl());
    hasi18nValue(stepAnnotation.i18nPackageName(), stepAnnotation.casesUrl());
}
 
示例3
public void addClassesFromPluginsToStage( String pluginsToStage ) throws KettleException {
  // Find the plugins in the jar files in the plugin folders to stage...
  //
  if ( StringUtils.isNotEmpty( pluginsToStage ) ) {
    String[] pluginFolders = pluginsToStage.split( "," );
    for ( String pluginFolder : pluginFolders ) {
      List<String> stepClasses = findAnnotatedClasses( pluginFolder, Step.class.getName() );
      stepPluginClasses.addAll( stepClasses );
      List<String> xpClasses = findAnnotatedClasses( pluginFolder, ExtensionPoint.class.getName() );
      xpPluginClasses.addAll( xpClasses );
    }
  }
}
 
示例4
@BeforeClass
public static void setupClass() throws Exception {

  StepPluginType.getInstance().handlePluginAnnotation(
    MQTTProducerMeta.class,
    MQTTProducerMeta.class.getAnnotation( Step.class ),
    Collections.emptyList(), false, null );
  KettleEnvironment.init();
}
 
示例5
private void buildFatJar( Event event ) {
  try {
    VariableSpace space = Variables.getADefaultVariableSpace();

    BeamJobConfig jobConfig = new BeamJobConfig();
    getInfo( jobConfig );

    FileDialog dialog = new FileDialog( shell, SWT.SAVE );
    dialog.setText( "Select the location of the Kettle+Beam+Plugins fat jar" );
    dialog.setFilterNames( new String[] { "Jar files (*.jar)", "All Files (*.*)" } );
    dialog.setFilterExtensions( new String[] { "*.jar", "*.*" } ); // Windows
    if ( StringUtils.isNotEmpty( jobConfig.getFatJar() ) ) {
      dialog.setFileName( space.environmentSubstitute( jobConfig.getFatJar() ) );
    }
    String filename = dialog.open();
    if ( StringUtils.isEmpty( filename ) ) {
      return;
    }

    List<String> files = BeamConst.findLibraryFilesToStage( null, jobConfig.getPluginsToStage(), true, true );
    files.removeIf( s -> s.contains( "commons-logging" ) || s.startsWith( "log4j" ) || s.contains( "xml-apis" ) );

    // Find the plugin classes for the specified plugins...
    //
    String stepPluginClasses = findPluginClasses( Step.class.getName() );
    if (StringUtils.isNotEmpty(jobConfig.getStepPluginClasses())) {
      if (StringUtils.isEmpty( stepPluginClasses )) {
        stepPluginClasses="";
      } else {
        stepPluginClasses+=",";
      }
      stepPluginClasses+=jobConfig.getStepPluginClasses();
    }
    String xpPluginClasses = findPluginClasses( ExtensionPoint.class.getName() );
    if (StringUtils.isNotEmpty(jobConfig.getXpPluginClasses())) {
      if (StringUtils.isEmpty( xpPluginClasses )) {
        xpPluginClasses="";
      } else {
        xpPluginClasses+=",";
      }
      xpPluginClasses+=jobConfig.getStepPluginClasses();
    }


    FatJarBuilder fatJarBuilder = new FatJarBuilder( filename, files );
    fatJarBuilder.setExtraStepPluginClasses( stepPluginClasses );
    fatJarBuilder.setExtraXpPluginClasses( xpPluginClasses );
    Cursor waitCursor = new Cursor( shell.getDisplay(), SWT.CURSOR_WAIT );
    Cursor regularCursor = shell.getCursor();

    try {
      shell.setCursor( waitCursor );
      fatJarBuilder.buildTargetJar();
    } finally {
      shell.setCursor( regularCursor );
      waitCursor.dispose();
    }

    // All went well, insert the filename...
    //
    wFatJar.setText( filename );

  } catch ( Exception e ) {
    new ErrorDialog( shell, "Error", "Error building fat jar: " + e.getMessage(), e );
  }
}
 
示例6
private void findStepClasses( Event event ) {
  String stepPluginClasses = findPluginClasses( Step.class.getName() );
  if ( stepPluginClasses != null ) {
    wStepPluginClasses.setText( stepPluginClasses );
  }
}
 
示例7
protected StepPluginType() {
  super( Step.class, "STEP", "Step" );
  populateFolders( "steps" );
}
 
示例8
@Override
protected String extractCategory( Annotation annotation ) {
  return ( (Step) annotation ).categoryDescription();
}
 
示例9
@Override
protected String extractDesc( Annotation annotation ) {
  return ( (Step) annotation ).description();
}
 
示例10
@Override
protected String extractID( Annotation annotation ) {
  return ( (Step) annotation ).id();
}
 
示例11
@Override
protected String extractName( Annotation annotation ) {
  return ( (Step) annotation ).name();
}
 
示例12
@Override
protected String extractImageFile( Annotation annotation ) {
  return ( (Step) annotation ).image();
}
 
示例13
@Override
protected boolean extractSeparateClassLoader( Annotation annotation ) {
  return ( (Step) annotation ).isSeparateClassLoaderNeeded();
}
 
示例14
@Override
protected String extractI18nPackageName( Annotation annotation ) {
  return ( (Step) annotation ).i18nPackageName();
}
 
示例15
@Override
protected String extractDocumentationUrl( Annotation annotation ) {
  return Const.getDocUrl( ( (Step) annotation ).documentationUrl() );
}
 
示例16
@Override
protected String extractCasesUrl( Annotation annotation ) {
  return ( (Step) annotation ).casesUrl();
}
 
示例17
@Override
protected String extractForumUrl( Annotation annotation ) {
  return ( (Step) annotation ).forumUrl();
}
 
示例18
@Override
protected String extractClassLoaderGroup( Annotation annotation ) {
  return ( (Step) annotation ).classLoaderGroup();
}
 
示例19
@Override
protected String extractSuggestion( Annotation annotation ) {
  return ( (Step) annotation ).suggestion();
}