Package com.linkedin.databus.core.util

Examples of com.linkedin.databus.core.util.InvalidConfigException


        File f = new File(file);
       
        if (! (f.isDirectory()) || (!f.canRead()))
        {
          LOG.error("File (" + f + ") does not exist or cannot be read !!");
          throw new InvalidConfigException("File (" + f + ") does not exist or cannot be read !!");
        }
      }
           
      return new StaticConfig(avroSeedInputDirMap, seedWindowSCNMap, pKeyNameMap, commitInterval);
    }
View Full Code Here


    @Override
    public RuntimeConfig build() throws InvalidConfigException
    {
      if (null == _managedInstance)
      {
        throw new InvalidConfigException("Managed logging listener not set");
      }

      Level logLevel = null;
      try
      {
        logLevel = Level.toLevel(getLogLevel());
      }
      catch (Exception e)
      {
        throw new InvalidConfigException("Invalid log level:", e);
      }

      Verbosity verbosity = null;
      try
      {
        verbosity = Verbosity.valueOf(getVerbosity());
      }
      catch (Exception e)
      {
        throw new InvalidConfigException("Invalid verbosiry:", e);
      }

      return _managedInstance.new RuntimeConfig(isEnabled(), verbosity, logLevel, isValidityCheckEnabled());
    }
View Full Code Here

    try
    {
      _binlogFilePrefix =  processUri(new URI(physicalSourceStaticConfig.getUri()), _or);
    } catch (URISyntaxException u)
    {
      throw new InvalidConfigException(u);
    }

    _schemaRegistryService = schemaRegistryService;
    _relayInboundStatsCollector = relayInboundStatsCollector;
View Full Code Here

   */
  public static String processUri(URI uri, OpenReplicator or) throws InvalidConfigException
  {
    String userInfo = uri.getUserInfo();
    if (null == userInfo)
      throw new InvalidConfigException("missing user info in: " + uri);
    int slashPos = userInfo.indexOf('/');
    if (slashPos < 0 )
      slashPos = userInfo.length();
    else if (0 == slashPos)
      throw new InvalidConfigException("missing user name in user info: " + userInfo);

    String userName = userInfo.substring(0, slashPos);
    String userPass = slashPos < userInfo.length() - 1 ? userInfo.substring(slashPos + 1) : null;

    String hostName = uri.getHost();

    int port = uri.getPort();
    if (port < 0) port = DEFAULT_MYSQL_PORT;

    String path = uri.getPath();
    if (null == path)
      throw new InvalidConfigException("missing path: " + uri);
    Matcher m = PATH_PATTERN.matcher(path);
    if (!m.matches())
      throw new InvalidConfigException("invalid path:" + path);

    String[] gp = m.group().split("/");
    if (gp.length != 3)
      throw new InvalidConfigException("Invalid format " + Arrays.toString(gp));
    String serverIdStr = gp[1];

    int serverId = -1;
    try
    {
      serverId = Integer.parseInt(serverIdStr);
    }
    catch (NumberFormatException e)
    {
      throw new InvalidConfigException("incorrect mysql serverid:" + serverId);
    }

    // Assign them to incoming variables
    if (null != or)
    {
View Full Code Here

      try
      {
        factory = buildEventFactory(sourceConfig, physicalSourceConfig, schemaRegistryService);
      } catch (Exception ex) {
        LOG.error("Got exception while building monitored sources for config :" + sourceConfig, ex);
        throw new InvalidConfigException(ex);
      }

      eventFactories.add(factory);
    }

    EventProducer producer = null;
    try
    {
      producer =  new OpenReplicatorEventProducer(eventFactories,
                                           eventBuffer,
                                           checkpointWriter,
                                           physicalSourceConfig,
                                           statsCollector,
                                           null,
                                           null,
                                           schemaRegistryService,
                                           JMX_DOMAIN);
    } catch (DatabusException e) {
      LOG.error("Got databus exception when instantiating Open Replicator event producer for source : " + physicalSourceConfig.getName(), e);
      throw new InvalidConfigException(e);
    }
    return producer;
  }
View Full Code Here

  {
    String schema = null;
    try {
        schema = schemaRegistryService.fetchLatestSchemaBySourceName(sourceConfig.getName());
    } catch (NoSuchSchemaException e) {
          throw new InvalidConfigException("Unable to load the schema for source (" + sourceConfig.getName() + ").");
    }

    if(schema == null)
    {
      throw new InvalidConfigException("Unable to load the schema for source (" + sourceConfig.getName() + ").");
    }

    LOG.info("Loading schema for source id " + sourceConfig.getId() + ": " + schema);

View Full Code Here

        return new ConstantPartitionFunction(constantPartitionNumber);
      }
      catch(Exception ex)
      {
        // Could be a NumberFormatException, IndexOutOfBoundsException or other exception when trying to parse the partition number.
        throw new InvalidConfigException("Invalid partition configuration (" + partitionFunction + "). " +
                "Could not parse the constant partition number.");
      }
    }
    else
    {
      throw new InvalidConfigException("Invalid partition configuration (" + partitionFunction + ").");
    }
  }
View Full Code Here

      case AVRO_BIN: _consumer = new AvroBinaryDtailPrinter(_client, consConfBuilder.build(),
                                                           cli.getOut()); break;
      case NOOP: _consumer = new NoopDtailPrinter(_client, consConfBuilder.build(), cli.getOut()); break;
      case EVENT_INFO: _consumer = new EventInfoDtailPrinter(_client, consConfBuilder.build(),
                                                             cli.getOut()); break;
      default: throw new InvalidConfigException("unsupported output format: " + cli.getOutputFormat());
      }
    }

    DbusKeyCompositeFilterConfig filterConfig = null;
View Full Code Here

  public void checkForNulls()
      throws InvalidConfigException
      {
    if(_name == null || _name.length() == 0)
    {
      throw new InvalidConfigException("Name cannot be null or empty.");
    }

    if(_id < 0)
      throw new  InvalidConfigException("Physical source id cannot be empty.");

    if(_uri == null || _name.length() == 0)
    {
      throw new InvalidConfigException("URI cannot be null or empty.");
    }

    if(_sources == null || _sources.size() == 0)
    {
      throw new InvalidConfigException("Sources cannot be null or empty.");
    }

    for(LogicalSourceConfig source : _sources)
    {
      source.checkForNulls();
View Full Code Here

  {
    checkForNulls();
    //check config options for chained relays
    if (_largestEventSizeInBytes >= _largestWindowSizeInBytes)
    {
      throw new InvalidConfigException("Invalid relay config: largestEventSizeInBytes has to be lesser than largestWindowSizeInBytes:"
          + " largestEventSizeInBytes=" + _largestEventSizeInBytes + " largestWindowSizeInBytes=" + _largestWindowSizeInBytes);
    }

    LogicalSourceStaticConfig[] sourcesStaticConfigs = new LogicalSourceStaticConfig[_sources.size()];
    for (int i = 0 ; i < _sources.size(); ++i)
View Full Code Here

TOP

Related Classes of com.linkedin.databus.core.util.InvalidConfigException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.