Package com.linkedin.databus.core.util

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


    @Override
    public StaticConfig build()
      throws InvalidConfigException
    {
      if ( size <= 0)
        throw new InvalidConfigException("Range size (" + size + ") must be greater than 0");
   
      StaticConfig sConf = null;
     
      try
      {
        sConf = new StaticConfig(size, IDConfig.fromString(partitions));
      } catch (Exception ex) {
        throw new InvalidConfigException(ex);
      }
     
     
      return sConf;
    }
View Full Code Here


        // Disabling SCN index works only with the BLOCK_ON_WRITE policy. If Scn index is disabled,
        // make sure we have the right policy.
        if (!connConfig.getEventBuffer().isEnableScnIndex() &&
          connConfig.getEventBuffer().getQueuePolicy() != DbusEventBuffer.QueuePolicy.BLOCK_ON_WRITE)
        {
          throw new InvalidConfigException("If SCN index is disabled, queue policy must be BLOCK_ON_WRITE");
        }
        CheckpointPersistenceProvider cpPersistenceProvder = getCheckpointPersistenceProvider();
        if (null != cpPersistenceProvder && getClientStaticConfig().getCheckpointPersistence().isClearBeforeUse())
        {
          cpPersistenceProvder.removeCheckpoint(sourcesStrList);
View Full Code Here

      {
        allocPolicy = AllocationPolicy.valueOf(_allocationPolicy);
      }
      catch (Exception e)
      {
        throw new InvalidConfigException("Invalid Config Value for allocationPolicy: " + _allocationPolicy);
      }

      File mmapDirectory = new File(_mmapDirectory);
      if (allocPolicy.equals(AllocationPolicy.MMAPPED_MEMORY) && !mmapDirectory.exists())
      {
        if (!mmapDirectory.mkdirs())
        {
          throw new InvalidConfigException("Invalid Config Value: Cannot create mmapDirectory: " + _mmapDirectory);
        }

        if (mmapDirectory.exists() && !mmapDirectory.canWrite())
        {
          throw new InvalidConfigException("Invalid Config Value: Cannot write to mmapDirectory: " + _mmapDirectory);
        }
      }

      QueuePolicy queuePolicy = null;
      try
      {
        queuePolicy = QueuePolicy.valueOf(_queuePolicy);
      }
      catch (IllegalArgumentException e)
      {
        throw new InvalidConfigException("Invalid queueing policy:" + _queuePolicy);
      }

      AssertLevel assertLevel = null;
      try
      {
        assertLevel = AssertLevel.valueOf(_assertLevel);
      }
      catch (IllegalArgumentException e)
      {
        throw new InvalidConfigException("Invalid assert level:" + _assertLevel);
      }

      //the biggest event we can process is the one that we can fit in the smallest ByteBuffer in the main event buffer,
      // i.e. the last ByteBuffer
      //int maxMaxEventSize = _maxSize % _maxIndividualBufferSize == 0 ? _maxIndividualBufferSize
View Full Code Here

      PartitionType pType = PartitionType.valueOf(type);

      KeyFilterConfig config = null;
      if ( (null == range.getPartitions()) && (pType == PartitionType.RANGE))
      {
        throw new InvalidConfigException("PartitionType is set to range but range configuration is not given.");       
      }

      if ( (null == mod.getBuckets()) && (pType == PartitionType.MOD))
      {
        throw new InvalidConfigException("PartitionType is set to mod but mod configuration is not given.");

      }

      if (pType == PartitionType.RANGE)
        config = new KeyRangeFilterConfig(range.build());
View Full Code Here

    @Override
    public BootstrapClientRuntimeConfig build() throws InvalidConfigException
    {
      if (null == _managedInstance)
      {
        throw new InvalidConfigException("No managed databus client");
      }

      List<ServerInfo> bootstrapServices = parseServerInfosMap(_services);
      if (null != _servicesList && _servicesList.length() > 0) bootstrapServices = RuntimeConfigBuilder.parseServerInfoList(_servicesList, bootstrapServices);
View Full Code Here

    @Override
    public CheckpointPersistenceRuntimeConfig build() throws InvalidConfigException
    {
      if (null == _managedInstance)
      {
        throw new InvalidConfigException("No associated client for runtime config");
      }
      if (_fileSystem.getManagedInstance()!= null) {
        return new CheckpointPersistenceRuntimeConfig(_fileSystem.build());
      } else if (_shared.getManagedInstance()!=null) {
        return new CheckpointPersistenceRuntimeConfig(_shared.build());
View Full Code Here

      super();
      this.numBuckets = numBuckets;
      this.idConfig = idConfig;
     
      if ( numBuckets <= 0)
        throw new InvalidConfigException("Mod Numbuckets (" + numBuckets + ") must be greater than 0");
     
      List<IDConfigEntry> idConfigs = idConfig.getIdConfigs();
     
      for (IDConfigEntry entry : idConfigs)
      {
        if ( (entry.getIdMax() < 0 ) || (entry.getIdMin() < 0)
            || (entry.getIdMin() > entry.getIdMax())
            || (entry.getIdMin() > numBuckets)
            || (entry.getIdMax() > numBuckets))
        {
          throw new InvalidConfigException("Mod idConfig Entry (" + entry + ") is invalid for bucket size (" + numBuckets + ")");
        }
      }
    }
View Full Code Here

      {
        batchingLevel = StaticConfig.BatchingLevel.valueOf(_batchingLevel);
      }
      catch (Exception e)
      {
        throw new InvalidConfigException("invalid batchingLevel:" + _batchingLevel);
      }

      if (_streamBatchSize <= 0) throw new InvalidConfigException("invalid streamBatchSize:" +
                                                                  _streamBatchSize);
      if (_bootstrapBatchSize <= 0) throw new InvalidConfigException("invalid bootstrapBatchSize:" +
                                                                     _bootstrapBatchSize);

      StaticConfig newConfig = new StaticConfig(batchingLevel, _streamBatchSize, _bootstrapBatchSize);
      LOG.info(BatchingDatabusCombinedConsumer.class.getSimpleName() + ".Config:" + newConfig);
View Full Code Here

      // Make sure the URI from the configuration file identifies an Oracle JDBC source.
      String uri = physicalSourceConfig.getUri();
      if(!uri.startsWith("jdbc:oracle"))
      {
        throw new InvalidConfigException("Invalid source URI (" +
            physicalSourceConfig.getUri() + "). Only jdbc:oracle: URIs are supported.");
      }

      OracleEventProducerFactory factory = new BootstrapSeederOracleEventProducerFactory(_sStaticConfig.getController().getPKeyNameMap());
View Full Code Here

      // Make sure the URI from the configuration file identifies an Oracle JDBC source.
      String uri = physicalSourceConfig.getUri();
      if(!uri.startsWith("jdbc:oracle"))
      {
        throw new InvalidConfigException("Invalid source URI (" +
            physicalSourceConfig.getUri() + "). Only jdbc:oracle: URIs are supported.");
      }

      String sourceTypeStr = physicalSourceConfig.getReplBitSetter().getSourceType();
        if (SourceType.TOKEN.toString().equalsIgnoreCase(sourceTypeStr))
          throw new InvalidConfigException("Token Source-type for Replication bit setter config cannot be set for trigger-based Databus relay !!");

      // Create the OracleDataSource used to get DB connection(s)
      try
      {
        Class oracleDataSourceClass = OracleJarUtils.loadClass("oracle.jdbc.pool.OracleDataSource");
        Object ods = oracleDataSourceClass.newInstance();
        Method setURLMethod = oracleDataSourceClass.getMethod("setURL", String.class);
        setURLMethod.invoke(ods, uri);
        _sDataStore = (DataSource) ods;
      } catch (Exception e)
      {
        String errMsg = "Error creating a data source object ";
        LOG.error(errMsg, e);
        throw e;
      }

      //TODO: Need a better way than relaying on RelayFactory for generating MonitoredSourceInfo
      OracleEventProducerFactory factory = new BootstrapSeederOracleEventProducerFactory(_sStaticConfig.getController().getPKeyNameMap());

      // Parse each one of the logical sources
      _sources = new ArrayList<OracleTriggerMonitoredSourceInfo>();
      FileSystemSchemaRegistryService schemaRegistryService =
            FileSystemSchemaRegistryService.build(_sStaticConfig.getSchemaRegistry().getFileSystem());

      Set<String> seenUris = new HashSet<String>();
      for(LogicalSourceConfig sourceConfig : physicalSourceConfig.getSources())
      {
        String srcUri  = sourceConfig.getUri();
        if ( seenUris.contains(srcUri))
        {
          String msg = "Uri (" + srcUri + ") is used for more than one sources. Currently Bootstrap Seeder cannot support seeding sources with the same URI together. Please have them run seperately !!";
          LOG.fatal(msg);
          throw new InvalidConfigException(msg);
        }
        seenUris.add(srcUri);
        OracleTriggerMonitoredSourceInfo source =
            factory.buildOracleMonitoredSourceInfo(sourceConfig.build(), physicalSourceConfig.build(), schemaRegistryService);
        _sources.add(source);
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.