Menu

#40 Allow plugins from other packages to be autoscanned and don't force xml schema

2.1.0rc2-RELEASE
open
nobody
None
1
2013-01-23
2013-01-18
christian
No

Wow, I really love the auto-scan feature and the annontations for the plugin parameters! please add a configuration parameter to allow plugins to be optionally scanned from a list of packages. Please add also an additional parameter to disable xml schema validation - org.webharvest.definition.XmlParser : 77
//factory.setSchema(SchemaComponentFactory.getSchemaFactory().getSchema());

Discussion

  • Piotr Dyraga

    Piotr Dyraga - 2013-01-21

    Hi Christian,

    Thanks for your interest in webharvest. You can already pick up some particular package to be autoscanned for plugins. Please take a look at the ConfigurableResolver interface and AnnotatedPluginsPostProcessor class.

    DefinitionResolver implements ConfigurableResolver interface. What you have to do, is to inject it to some of your components and then:

        @Inject
        private ConfigurableResolver resolver;
    
        private void doPluginsScan() {
            resolver.addPostProcessor(
                    new AnnotatedPluginsPostProcessor("your.package.name"));
            resolver.refresh();
        }
    

    The entire power of this solution is in fact, that you can add as many AnnotatedPluginsPostProcessor as you want, and what's more, implement your own, custom post processors. Just take a look at the ResolverPostProcessor interface.

    That's it!

    About XML schema validation, I have to consult other guys. Anyway, IMHO it is nice feature - writing XSD schema is not so time-consuming and you gain the full validation of your configuration.

     
  • Piotr Dyraga

    Piotr Dyraga - 2013-01-21
    • milestone: 2.1.0rc1-RELEASE --> 2.1.0rc2-RELEASE
     
  • christian

    christian - 2013-01-23

    Hi,

    thanks for your detailed answer! I will have a look on that soon.

    @About XML schema validation: with issue 39 I have made a patch with a simple boolean parameter for the use of schema validation (defaulting to TRUE). I think this does not hurt anyone. XML-schema would be cool if it is generated out of the plugin-class-annontations and "autoscanned" too. Otherwise there is the draw down that the user have to provide all used schema via command line arguments (very annoying). If you consult the patch of #39, there is a change which will read the settings file for the gui and the command line use in the same way. Which means when user adds a schema via GUI it is no longer necessary that you provide the very same schema via command line too. The command line is consulting the same settings file like the gui does plus the additional option to override the settings via command line arguments.

     
  • christian

    christian - 2013-01-23

    oh yes, thats pretty cool. I am not sure if I have really realized whats the magic using guice and injection. I have now added 2 more lines of code in CommandLine.class using a settings parameter - works like a charm.

     

Log in to post a comment.