@Override public List<String> run() { final Path confPath = new Environment(settings, configPath).configFile().toAbsolutePath(); if(Files.isDirectory(confPath, LinkOption.NOFOLLOW_LINKS)) { try (Stream<Path> s = Files.walk(confPath)) { return s .distinct() .map(p->sha256(p)) .collect(Collectors.toList()); } catch (Exception e) { log.error(e); return null; } } return Collections.emptyList(); } });
@Override public List<Path> run() { final Path confPath = new Environment(settings, configPath).configFile().toAbsolutePath(); if(Files.isDirectory(confPath, LinkOption.NOFOLLOW_LINKS)) { try (Stream<Path> s = Files.walk(confPath)) { return s .distinct() .filter(p->checkFilePermissions(p)) .collect(Collectors.toList()); } catch (Exception e) { log.error(e); return null; } } return Collections.emptyList(); } });
public static String resolve(String originalPath, String propName, Settings settings, Path configPath, boolean mustBeValid) { log.debug("Path is is {}", originalPath); String path = originalPath; final Environment env = new Environment(settings, configPath); if(env != null && originalPath != null && originalPath.length() > 0) { path = env.configFile().resolve(originalPath).toAbsolutePath().toString(); log.debug("Resolved {} to {} against {}", originalPath, path, env.configFile().toAbsolutePath().toString()); } if(mustBeValid) { checkPath(path, propName); } if("".equals(path)) { path = null; } return path; }
Environment environment = new Environment(output.build(), configPath); finalizeSettings(output, terminal); environment = new Environment(output.build(), configPath); return new Environment(output.build(), configPath);
public static Environment newEnvironment(Settings settings) { return new Environment(settings, null); } }
protected Function<Settings, Node> nodeBuilder(Path configPath) { return settings -> new Node(new Environment(settings, configPath)) { @Override protected void registerDerivedNodeNameWithLogger(String nodeName) { // don't register the node name because we've done it in the main node } }; }
TribeClientNode(Settings settings) { super(new Environment(settings), Version.CURRENT, Collections.<Class<? extends Plugin>>emptyList()); } }
/** Constructs an internal node used as a client into a cluster fronted by this tribe node. */ protected Node newTribeClientNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) { return new Node(new Environment(settings), classpathPlugins); }
this.environment = new Environment(this.settings, environment.configFile()); Environment.assertEquivalent(environment, this.environment);
@Override protected Environment createEnv(final Terminal terminal, final Map<String, String> settings) throws UserException { Settings.Builder builder = Settings.builder().put("path.home", home); settings.forEach((k,v) -> builder.put(k, v)); final Settings realSettings = builder.build(); return new Environment(realSettings, home.resolve("config")); } @Override
@Override public List<String> run() { final Path confPath = new Environment(settings, configPath).configFile().toAbsolutePath(); if(Files.isDirectory(confPath, LinkOption.NOFOLLOW_LINKS)) { try (Stream<Path> s = Files.walk(confPath)) { return s .distinct() .map(p->sha256(p)) .collect(Collectors.toList()); } catch (Exception e) { log.error(e); return null; } } return Collections.emptyList(); } });
@Override public List<Path> run() { final Path confPath = new Environment(settings, configPath).configFile().toAbsolutePath(); if(Files.isDirectory(confPath, LinkOption.NOFOLLOW_LINKS)) { try (Stream<Path> s = Files.walk(confPath)) { return s .distinct() .filter(p->checkFilePermissions(p)) .collect(Collectors.toList()); } catch (Exception e) { log.error(e); return null; } } return Collections.emptyList(); } });
public static String resolve(String originalPath, String propName, Settings settings, Path configPath, boolean mustBeValid) { log.debug("Path is is {}", originalPath); String path = originalPath; final Environment env = new Environment(settings, configPath); if(env != null && originalPath != null && originalPath.length() > 0) { path = env.configFile().resolve(originalPath).toAbsolutePath().toString(); log.debug("Resolved {} to {} against {}", originalPath, path, env.configFile().toAbsolutePath().toString()); } if(mustBeValid) { checkPath(path, propName); } if("".equals(path)) { path = null; } return path; }
public static ESTestCase.TestAnalysis createTestAnalysisFromSettings( final Settings settings, final Path configPath, final AnalysisPlugin... plugins) throws IOException { final Settings actualSettings; if (settings.get(IndexMetaData.SETTING_VERSION_CREATED) == null) { actualSettings = Settings.builder().put(settings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); } else { actualSettings = settings; } final IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("test", actualSettings); final AnalysisRegistry analysisRegistry = new AnalysisModule(new Environment(actualSettings, configPath), Arrays.asList(plugins)).getAnalysisRegistry(); return new ESTestCase.TestAnalysis(analysisRegistry.build(indexSettings), analysisRegistry.buildTokenFilterFactories(indexSettings), analysisRegistry.buildTokenizerFactories(indexSettings), analysisRegistry.buildCharFilterFactories(indexSettings)); }
public ViewService(Settings settings) { this(settings, new Environment(), ImmutableSet.<ViewEngineService>builder() .add(new MvelViewEngineService(settings)) .add(new BinaryViewEngineService(settings)) .build()); }
public ViewService(Settings settings) { this(settings, new Environment(), ImmutableSet.<ViewEngineService>builder() .add(new MvelViewEngineService(settings)) .add(new BinaryViewEngineService(settings)) .build()); }
@Inject public JiebaTokenFilterFactory(Index index, IndexSettingsService indexSettings, @Assisted String name, @Assisted Settings settings) { super(index, indexSettings.getSettings(), name, settings); type = settings.get("seg_mode", "index"); Environment env = new Environment(indexSettings.getSettings()); WordDictionary.getInstance().init(env.pluginsFile().resolve("jieba/dic")); }
private static AnalysisService newAnalysisService(Settings indexSettings) { Injector parentInjector = new ModulesBuilder().add(new SettingsModule(indexSettings), new EnvironmentModule(new Environment(indexSettings))).createInjector(); Index index = new Index("test"); Injector injector = new ModulesBuilder().add( new IndexSettingsModule(index, indexSettings), new IndexNameModule(index), new AnalysisModule(indexSettings, parentInjector.getInstance(IndicesAnalysisService.class))).createChildInjector(parentInjector); return injector.getInstance(AnalysisService.class); }
public AnalysisService provideWith(Index index, Settings settings) { Settings indexSettings = settingsBuilder().put(settings) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build(); Injector parentInjector = new ModulesBuilder().add( new SettingsModule(settings), new EnvironmentModule(new Environment(settings))).createInjector(); Injector injector = new ModulesBuilder().add( new IndexSettingsModule(index, indexSettings), new IndexNameModule(index), new AnalysisModule(settings, parentInjector.getInstance(IndicesAnalysisService.class)) .addProcessor(new UkrainianLemmatizerBinderProcessor())) .createChildInjector(parentInjector); return injector.getInstance(AnalysisService.class); } }
@Inject protected Carrot2RestAction(Settings settings, Client client, RestController restController) { super(settings, client); environment=new Environment(settings); restController.registerHandler(RestRequest.Method.POST, "/{index}/{type}/_carrot2", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/{type}/_carrot2/{algorithm}", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/_carrot2", this); restController.registerHandler(RestRequest.Method.GET, "/{index}/_carrot2", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/_carrot2/{algorithm}", this); restController.registerHandler(RestRequest.Method.POST, "/_carrot2/{algorithm}", this); restController.registerHandler(RestRequest.Method.POST, "/_carrot2", this); restController.registerHandler(RestRequest.Method.GET, "/_carrot2", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/{type}/_search_clustering", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/{type}/_search_clustering/{algorithm}", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/_search_clustering", this); restController.registerHandler(RestRequest.Method.POST, "/{index}/_search_clustering/{algorithm}", this); restController.registerHandler(RestRequest.Method.POST, "/_search_clustering/{algorithm}", this); restController.registerHandler(RestRequest.Method.POST, "/_search_clustering", this); }