Пример #1
0
  public SenseiServerBuilder(File confDir, Map<String, Object> properties) throws Exception {
    if (properties != null) {
      _senseiConfFile = null;
      _senseiConf = new MapConfiguration(properties);
      ((MapConfiguration) _senseiConf).setDelimiterParsingDisabled(true);
    } else {
      _senseiConfFile = new File(confDir, SENSEI_PROPERTIES);
      if (!_senseiConfFile.exists()) {
        throw new ConfigurationException(
            "configuration file: " + _senseiConfFile.getAbsolutePath() + " does not exist.");
      }
      _senseiConf = new PropertiesConfiguration();
      ((PropertiesConfiguration) _senseiConf).setDelimiterParsingDisabled(true);
      ((PropertiesConfiguration) _senseiConf).load(_senseiConfFile);
    }

    pluginRegistry = SenseiPluginRegistry.build(_senseiConf);
    pluginRegistry.start();

    processRelevanceFunctionPlugins(pluginRegistry);
    processRelevanceExternalObjectPlugins(pluginRegistry);

    _gateway = pluginRegistry.getBeanByFullPrefix(SENSEI_GATEWAY, SenseiGateway.class);
    _schemaDoc = loadSchema(confDir);
    _senseiSchema = SenseiSchema.build(_schemaDoc);
  }
Пример #2
0
  public SenseiServerBuilder(Resource confDir, Map<String, Object> properties) throws Exception {
    _senseiConfFile = null;

    _senseiConf = new MapConfiguration(properties);
    ((MapConfiguration) _senseiConf).setDelimiterParsingDisabled(true);

    pluginRegistry = SenseiPluginRegistry.build(_senseiConf);
    pluginRegistry.start();

    processRelevanceFunctionPlugins(pluginRegistry);

    _gateway = pluginRegistry.getBeanByFullPrefix(SENSEI_GATEWAY, SenseiGateway.class);

    _schemaDoc = loadSchema(confDir);
    _senseiSchema = SenseiSchema.build(_schemaDoc);
  }