@Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration)
      throws Exception {
    ConfigSource redisSource =
        new NonVersionedRedisConfigSource(getRedisConnector().getJedisPool(), getRedisPrefix());
    ConfigSource source = redisSource;

    ConfigSource userSource = initUser(repo, configuration);
    Map<String, ConfigSource> map = new HashMap<String, ConfigSource>();
    if (userSource != null) {
      String scheme =
          repo.getInfo(getUserConfigMaster())
              .getAttribute(ComponentInfoAttributes.UNIQUE_ID_SCHEME);
      map.put(scheme, userSource);
      source =
          new EHCachingConfigSource(
              new DelegatingConfigSource(source, map), CacheManager.getInstance());
    }

    ComponentInfo info = new ComponentInfo(ConfigSource.class, getClassifier());
    info.addAttribute(ComponentInfoAttributes.LEVEL, userSource == null ? 1 : 2);
    info.addAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemoteConfigSource.class);
    repo.registerComponent(info, source);
    if (isPublishRest()) {
      repo.getRestComponents().publish(info, new DataConfigSourceResource(source));
    }

    info = new ComponentInfo(NonVersionedRedisConfigSource.class, getClassifier());
    info.addAttribute(ComponentInfoAttributes.LEVEL, 1);
    repo.registerComponent(info, redisSource);
  }
  // -------------------------------------------------------------------------
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) {
    ComponentInfo info = new ComponentInfo(CurrencyMatrixSource.class, getClassifier());
    info.addAttribute(ComponentInfoAttributes.LEVEL, 1);
    info.addAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemoteCurrencyMatrixSource.class);

    CurrencyMatrixSource source = new ConfigDBCurrencyMatrixSource(getConfigSource());

    repo.registerComponent(info, source);
    if (isPublishRest()) {
      repo.getRestComponents().publish(info, new DataCurrencyMatrixSourceResource(source));
    }
  }
  protected MarketDataProviderFactory initMarketDataProviderFactory(
      final ComponentRepository repo) {
    InMemoryNamedMarketDataSpecificationRepository specRepository =
        new InMemoryNamedMarketDataSpecificationRepository();

    final ComponentInfo specRepositoryInfo =
        new ComponentInfo(NamedMarketDataSpecificationRepository.class, getClassifier());
    repo.registerComponent(specRepositoryInfo, specRepository);

    final ComponentInfo liveSourcesInfo =
        new ComponentInfo(NamedMarketDataSpecificationRepository.class, "live");
    repo.registerComponent(liveSourcesInfo, specRepository);

    return null;
  }
 protected ConfigSource initUser(
     ComponentRepository repo, LinkedHashMap<String, String> configuration) {
   if (getUserConfigMaster() == null) {
     return null;
   }
   ConfigSource source = new MasterConfigSource(getUserConfigMaster());
   if (getUserClassifier() != null) {
     ComponentInfo info = new ComponentInfo(ConfigSource.class, getUserClassifier());
     info.addAttribute(ComponentInfoAttributes.LEVEL, 1);
     info.addAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemoteConfigSource.class);
     repo.registerComponent(info, source);
     if (isPublishRest()) {
       repo.getRestComponents().publish(info, new DataConfigSourceResource(source));
     }
   }
   return source;
 }
Exemplo n.º 5
0
 // -------------------------------------------------------------------------
 @Override
 public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) {
   ToolContext context = createToolContext();
   Map<String, MetaProperty<?>> mapTarget =
       new HashMap<String, MetaProperty<?>>(context.metaBean().metaPropertyMap());
   mapTarget.keySet().retainAll(this.metaBean().metaPropertyMap().keySet());
   for (MetaProperty<?> mp : mapTarget.values()) {
     mp.set(context, property(mp.name()).get());
   }
   context.setContextManager(repo);
   repo.registerInfrastructure(ToolContext.class, getClassifier(), context);
 }
  // -------------------------------------------------------------------------
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) {
    ComponentInfo info = new ComponentInfo(MarketDataSnapshotMaster.class, getClassifier());

    // create
    DbMarketDataSnapshotMaster master = new DbMarketDataSnapshotMaster(getDbConnector());
    if (getUniqueIdScheme() != null) {
      master.setUniqueIdScheme(getUniqueIdScheme());
    }
    if (getMaxRetries() != null) {
      master.setMaxRetries(getMaxRetries());
    }
    if (getJmsChangeManagerTopic() != null) {
      JmsChangeManager cm = new JmsChangeManager(getJmsConnector(), getJmsChangeManagerTopic());
      master.setChangeManager(cm);
      repo.registerLifecycle(cm);
      if (getJmsConnector().getClientBrokerUri() != null) {
        info.addAttribute(
            ComponentInfoAttributes.JMS_BROKER_URI,
            getJmsConnector().getClientBrokerUri().toString());
      }
      info.addAttribute(
          ComponentInfoAttributes.JMS_CHANGE_MANAGER_TOPIC, getJmsChangeManagerTopic());
    }

    // register
    info.addAttribute(ComponentInfoAttributes.LEVEL, 1);
    info.addAttribute(
        ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemoteMarketDataSnapshotMaster.class);
    info.addAttribute(ComponentInfoAttributes.UNIQUE_ID_SCHEME, master.getUniqueIdScheme());
    repo.registerComponent(info, master);

    // publish
    if (isPublishRest()) {
      repo.getRestComponents().publish(info, new DataMarketDataSnapshotMasterResource(master));
    }
  }