@SuppressWarnings("unchecked") @Override public void init(NamedList args) { Object d = args.remove(DEST_PARAM); if (null == d) { throw new SolrException(SERVER_ERROR, "Init param '" + DEST_PARAM + "' must be specified"); } else if (!(d instanceof CharSequence)) { throw new SolrException( SERVER_ERROR, "Init param '" + DEST_PARAM + "' must be a string (ie: 'str')"); } dest = d.toString(); List<Object> sources = args.getAll(SOURCE_PARAM); if (0 == sources.size()) { throw new SolrException(SERVER_ERROR, "Init param '" + SOURCE_PARAM + "' must be specified"); } if (1 == sources.size() && sources.get(0) instanceof NamedList) { // nested set of selector options NamedList selectorConfig = (NamedList) args.remove(SOURCE_PARAM); srcInclusions = parseSelectorParams(selectorConfig); List<Object> excList = selectorConfig.getAll("exclude"); for (Object excObj : excList) { if (null == excObj) { throw new SolrException( SERVER_ERROR, "Init param '" + SOURCE_PARAM + "' child 'exclude' can not be null"); } if (!(excObj instanceof NamedList)) { throw new SolrException( SERVER_ERROR, "Init param '" + SOURCE_PARAM + "' child 'exclude' must be <lst/>"); } NamedList exc = (NamedList) excObj; srcExclusions.add(parseSelectorParams(exc)); if (0 < exc.size()) { throw new SolrException( SERVER_ERROR, "Init param '" + SOURCE_PARAM + "' has unexpected 'exclude' sub-param(s): '" + selectorConfig.getName(0) + "'"); } // call once per instance selectorConfig.remove("exclude"); } if (0 < selectorConfig.size()) { throw new SolrException( SERVER_ERROR, "Init param '" + SOURCE_PARAM + "' contains unexpected child param(s): '" + selectorConfig.getName(0) + "'"); } } else { // source better be one or more strings srcInclusions.fieldName = new HashSet<String>(FieldMutatingUpdateProcessorFactory.oneOrMany(args, "source")); } if (0 < args.size()) { throw new SolrException(SERVER_ERROR, "Unexpected init param(s): '" + args.getName(0) + "'"); } super.init(args); }