@Override public final void onActivated( final Options opts ) throws BadCommandLineException { for( Plugin plugin : plugins ) { plugin.onActivated( opts ); } }
private String getPluginUsageString(Options opts) { StringBuilder buf = new StringBuilder(); buf.append("\nAvailable plugin options:\n"); for (Plugin pl : opts.getAllPlugins()) { buf.append(pl.getUsage()); buf.append('\n'); } return buf.toString(); }
@Override public final boolean isCustomizationTagName( final String nsUri, final String localName ) { final List<Plugin> l = pluginMap.get( nsUri ); if( l == null ) { return false; } for( Plugin plugin : l ) { if( plugin.isCustomizationTagName( nsUri, localName ) ) { return true; } } return false; }
if( ('-'+plugin.getOptionName()).equals(args[i]) ) { activePlugins.add(plugin); plugin.onActivated(this); pluginURIs.addAll(plugin.getCustomizationURIs()); int r = plugin.parseArgument(this,args,i); if(r!=0) return r; int r = plugin.parseArgument(this,args,i); if(r!=0) return r; } catch (IOException e) {
if(p.getCustomizationURIs().contains(uri)) { owner = p; break; error( Messages.ERR_PLUGIN_NOT_ENABLED.format(owner.getOptionName(),uri)); else {
ma.postProcessModel(this,ehf); ma.run(o,opt,ehf); } catch (SAXException e) {
@Override public final void postProcessModel( final Model model, final ErrorHandler errorHandler ) { for( Plugin plugin : plugins ) { plugin.postProcessModel( model, errorHandler ); } }
/** * Sets the {@link FieldRendererFactory}. * <p> * <p> * This method is for plugins to call to set a custom {@link FieldRendererFactory}. * * @param frf The {@link FieldRendererFactory} to be installed. Must not be null. * @param owner Identifies the plugin that owns this {@link FieldRendererFactory}. * When two {@link Plugin}s try to call this method, this allows XJC * to report it as a user-friendly error message. * @throws BadCommandLineException If a conflit happens, this exception carries a user-friendly error * message, indicating a conflict. */ public void setFieldRendererFactory(FieldRendererFactory frf, Plugin owner) throws BadCommandLineException { // since this method is for plugins, make it bit more fool-proof than usual if (frf == null) throw new IllegalArgumentException(); if (fieldRendererFactoryOwner != null) { throw new BadCommandLineException( Messages.format(Messages.FIELD_RENDERER_CONFLICT, fieldRendererFactoryOwner.getOptionName(), owner.getOptionName())); } this.fieldRendererFactoryOwner = owner; this.fieldRendererFactory = frf; }
protected final void registerPlugin( final Plugin plugin ) { if( plugins.add( plugin ) ) { for( String namespace : plugin.getCustomizationURIs() ) { namespaces.add( namespace ); List<Plugin> l = pluginMap.get( namespace ); if( l == null ) { l = new ArrayList<Plugin>(); pluginMap.put( namespace, l ); } l.add( plugin ); } } }
@Override public final boolean run( final Outline model, final Options opt, final ErrorHandler errorHandler ) throws SAXException { boolean ret = false; for( Plugin plugin : plugins ) { ret |= plugin.run( model, opt, errorHandler ); } return ret; } }
@Override public final int parseArgument( final Options opt, final String[] args, final int i ) throws BadCommandLineException, IOException { //@TODO what is the return value? int c = 0; for( Plugin plugin : plugins ) { c += plugin.parseArgument( opt, args, i ); } return c; }
if( ('-'+plugin.getOptionName()).equals(args[i]) ) { activePlugins.add(plugin); plugin.onActivated(this); pluginURIs.addAll(plugin.getCustomizationURIs()); int r = plugin.parseArgument(this,args,i); if(r!=0) return r; int r = plugin.parseArgument(this,args,i); if(r!=0) return r; } catch (IOException e) {
if(p.getCustomizationURIs().contains(uri)) { owner = p; break; error( Messages.ERR_PLUGIN_NOT_ENABLED.format(owner.getOptionName(),uri)); else {
@Override public void postProcessModel(Model model, ErrorHandler errorHandler){ super.postProcessModel(model, errorHandler);
/** * Sets the {@link NameConverter}. * <p> * <p> * This method is for plugins to call to set a custom {@link NameConverter}. * * @param nc The {@link NameConverter} to be installed. Must not be null. * @param owner Identifies the plugin that owns this {@link NameConverter}. * When two {@link Plugin}s try to call this method, this allows XJC * to report it as a user-friendly error message. * @throws BadCommandLineException If a conflit happens, this exception carries a user-friendly error * message, indicating a conflict. */ public void setNameConverter(NameConverter nc, Plugin owner) throws BadCommandLineException { // since this method is for plugins, make it bit more fool-proof than usual if (nc == null) throw new IllegalArgumentException(); if (nameConverter != null) { throw new BadCommandLineException( Messages.format(Messages.NAME_CONVERTER_CONFLICT, nameConverterOwner.getOptionName(), owner.getOptionName())); } this.nameConverterOwner = owner; this.nameConverter = nc; }
/** * @param handler * This error handler will receive detected errors. */ public AbstractExtensionBindingChecker( String schemaLanguage, Options options, ErrorHandler handler ) { this.schemaLanguage = schemaLanguage; this.allowExtensions = options.compatibilityMode!=Options.STRICT; this.options = options; setErrorHandler(handler); for (Plugin plugin : options.getAllPlugins()) recognizableExtensions.addAll(plugin.getCustomizationURIs()); recognizableExtensions.add(Const.XJC_EXTENSION_URI); }
ma.run(o,opt,ehf); } catch (SAXException e) {
@Override public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, IOException { if (!args[i].equals("-Xrest-api")) { return super.parseArgument(opt, args, i); } final String rxVersion = "\\w+(\\.\\d+)*"; final int j = i + 1; if (j < args.length && args[j].matches(rxVersion)) { version = args[j]; return 2; } return 1; }
if (('-' + plugin.getOptionName()).equals(args[i])) { activePlugins.add(plugin); plugin.onActivated(this); pluginURIs.addAll(plugin.getCustomizationURIs()); int r = plugin.parseArgument(this, args, i); if (r != 0) return r; int r = plugin.parseArgument(this, args, i); if (r != 0) return r; } catch (IOException e) {
@Override public void onActivated(Options opts) throws BadCommandLineException { super.onActivated(opts); }