public Pipe(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { super(builder, config, parent, child, context); this.id = getConfigs().getString(config, "id"); List<String> importCommandSpecs = getConfigs().getStringList(config, "importCommands", Arrays.asList("com.**", "org.**", "net.**")); context.importCommandBuilders(importCommandSpecs); getConfigs().getConfigList(config, "commands", null); List<Command> childCommands = buildCommandChain(config, "commands", child, false); if (childCommands.size() > 0) { this.realChild = childCommands.get(0); } else { this.realChild = child; } validateArguments(); }
public Pipe(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { super(builder, config, parent, child, context); this.id = getConfigs().getString(config, "id"); List<String> importCommandSpecs = getConfigs().getStringList(config, "importCommands", Arrays.asList("com.**", "org.**", "net.**")); context.importCommandBuilders(importCommandSpecs); getConfigs().getConfigList(config, "commands", null); List<Command> childCommands = buildCommandChain(config, "commands", child, false); if (childCommands.size() > 0) { this.realChild = childCommands.get(0); } else { this.realChild = child; } validateArguments(); }
@Test public void testImportSpecs() { List<String> importSpecs = Arrays.asList("org.kitesdk.**", "org.apache.solr.**", "net.*", getClass().getName()); for (Class clazz : new MorphlineContext().getTopLevelClasses(importSpecs, CommandBuilder.class)) { //System.out.println("found " + clazz); } MorphlineContext ctx = new MorphlineContext.Builder().build(); ctx.importCommandBuilders(importSpecs); ctx.importCommandBuilders(importSpecs); }
@Test public void testImportSpecsWithOnlyFQCNs() { List<String> importSpecs = Arrays.asList(getClass().getName()); for (Class clazz : new MorphlineContext().getTopLevelClasses(importSpecs, CommandBuilder.class)) { //System.out.println("found " + clazz); } MorphlineContext ctx = new MorphlineContext.Builder().build(); ctx.importCommandBuilders(importSpecs); ctx.importCommandBuilders(importSpecs); }