Example #1
0
  protected DispatcherState addSources(Collection<IdNamePair> sources) {
    for (IdNamePair source : sources) {
      _sources.put(source.getId(), source);
    }

    return this;
  }
Example #2
0
  protected boolean doCheckStartSource(
      DispatcherState curState, Long eventSrcId, SchemaId schemaId) {
    boolean success = true;

    if (eventSrcId >= 0) {
      IdNamePair source = curState.getSources().get(eventSrcId);
      if (null == source) {
        _log.error("Unable to find source: srcid=" + eventSrcId);
        success = false;
      } else {
        VersionedSchema verSchema =
            curState.getSchemaSet().getLatestVersionByName(source.getName());
        VersionedSchema exactSchema =
            _schemaIdCheck ? curState.getSchemaSet().getById(schemaId) : null;
        if (null == verSchema) {
          _log.error(
              "Unable to find schema: srcid=" + source.getId() + " name=" + source.getName());
          success = false;
        } else if (_schemaIdCheck && null == exactSchema) {
          _log.error(
              "Unable to find schema: srcid="
                  + source.getId()
                  + " name="
                  + source.getName()
                  + " schemaId="
                  + schemaId);
          success = false;
        } else if (verSchema.getSchema() != curState.getCurrentSourceSchema()) {
          curState.switchToStartStreamSource(source, verSchema.getSchema());
          success = doStartStreamSource(curState);
        }
      }
    }

    return success;
  }