本文整理匯總了Java中org.elasticsearch.common.inject.Module類的典型用法代碼示例。如果您正苦於以下問題:Java Module類的具體用法?Java Module怎麽用?Java Module使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Module類屬於org.elasticsearch.common.inject包,在下文中一共展示了Module類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loadModuleReferences
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
private List<CrateComponentLoader.OnModuleReference> loadModuleReferences(Plugin plugin) {
List<CrateComponentLoader.OnModuleReference> list = Lists.newArrayList();
for (Method method : plugin.getClass().getDeclaredMethods()) {
if (!method.getName().equals("onModule")) {
continue;
}
if (method.getParameterTypes().length == 0 || method.getParameterTypes().length > 1) {
logger.warn("Plugin: {} implementing onModule with no parameters or more than one parameter", plugin.name());
continue;
}
Class moduleClass = method.getParameterTypes()[0];
if (!Module.class.isAssignableFrom(moduleClass)) {
logger.warn("Plugin: {} implementing onModule by the type is not of Module type {}", plugin.name(), moduleClass);
continue;
}
method.setAccessible(true);
//noinspection unchecked
list.add(new CrateComponentLoader.OnModuleReference(moduleClass, method));
}
return list;
}
示例2: processModule
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
public void processModule(Module module) {
for (Plugin plugin : plugins) {
// see if there are onModule references
List<CrateComponentLoader.OnModuleReference> references = onModuleReferences.get(plugin);
if (references != null) {
for (CrateComponentLoader.OnModuleReference reference : references) {
if (reference.moduleClass.isAssignableFrom(module.getClass())) {
try {
reference.onModuleMethod.invoke(plugin, module);
} catch (Exception e) {
logger.warn("Plugin {}, failed to invoke custom onModule method", e, plugin.name());
}
}
}
}
}
}
示例3: processModule
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
public void processModule(Module module) {
for (Plugin plugin : plugins) {
// see if there are onModule references
List<OnModuleReference> references = onModuleReferences.get(plugin);
if (references != null) {
for (OnModuleReference reference : references) {
if (reference.moduleClass.isAssignableFrom(module.getClass())) {
try {
reference.onModuleMethod.invoke(plugin, module);
} catch (Exception e) {
logger.warn("plugin {}, failed to invoke custom onModule method", e, plugin.name());
}
}
}
}
}
}
示例4: findOnModuleReferences
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
@SuppressWarnings("unchecked")
private List<OnModuleReference> findOnModuleReferences(Plugin plugin) {
List<OnModuleReference> list = new ArrayList<>();
for (Method method : plugin.getClass().getDeclaredMethods()) {
if (!method.getName().equals("onModule")) {
continue;
}
if (method.getParameterTypes().length == 0 || method.getParameterTypes().length > 1) {
logger.warn("plugin {} implementing onModule with no parameters or more than one parameter", plugin.name());
continue;
}
Class moduleClass = method.getParameterTypes()[0];
if (!Module.class.isAssignableFrom(moduleClass)) {
logger.warn("plugin {} implementing onModule by the type is not of Module type {}", plugin.name(), moduleClass);
continue;
}
method.setAccessible(true);
list.add(new OnModuleReference(moduleClass, method));
}
return list;
}
示例5: getElements
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
/**
* Records the elements executed by {@code modules}.
*/
public static List<Element> getElements(Stage stage, Iterable<? extends Module> modules) {
RecordingBinder binder = new RecordingBinder(stage);
for (Module module : modules) {
binder.install(module);
}
return Collections.unmodifiableList(binder.elements);
}
示例6: getModule
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
/**
* Returns the module composed of {@code elements}.
*/
public static Module getModule(final Iterable<? extends Element> elements) {
return new Module() {
@Override
public void configure(Binder binder) {
for (Element element : elements) {
element.applyTo(binder);
}
}
};
}
示例7: forObject
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
/**
* Returns a module which creates bindings for provider methods from the given object.
* This is useful notably for <a href="http://code.google.com/p/google-gin/">GIN</a>
*/
public static Module forObject(Object object) {
// avoid infinite recursion, since installing a module always installs itself
if (object instanceof ProviderMethodsModule) {
return Modules.EMPTY_MODULE;
}
return new ProviderMethodsModule(object);
}
示例8: combine
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
/**
* Returns a new module that installs all of {@code modules}.
*/
public static Module combine(Iterable<? extends Module> modules) {
final Set<? extends Module> modulesSet = newHashSet(modules);
return new Module() {
@Override
public void configure(Binder binder) {
binder = binder.skipSources(getClass());
for (Module module : modulesSet) {
binder.install(module);
}
}
};
}
示例9: createGuiceModules
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
public Collection<Module> createGuiceModules() {
List<Module> modules = new ArrayList<>();
for (Tuple<PluginInfo, Plugin> plugin : plugins) {
modules.addAll(plugin.v2().createGuiceModules());
}
return modules;
}
示例10: nodeModules
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
@Override
public Collection<Module> nodeModules() {
Collection<Module> modules = Lists.newArrayList();
if (!settings.getAsBoolean("node.client", false)) {
modules.add(new BlobModule());
modules.add(new BlobIndicesModule());
}
return modules;
}
示例11: nodeModules
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
public Collection<Module> nodeModules() {
List<Module> modules = Lists.newArrayList();
for (Plugin plugin : plugins) {
modules.addAll(plugin.nodeModules());
// deprecated methods support
Collection<Class<? extends Module>> modulesClasses = Lists.newArrayList();
modulesClasses.addAll(plugin.modules());
modulesClasses.addAll(plugin.modules(settings));
for (Class<? extends Module> moduleClass : modulesClasses) {
modules.add(createModule(moduleClass, settings));
}
}
return modules;
}
示例12: indexModules
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
public Collection<Module> indexModules(Settings indexSettings) {
List<Module> modules = Lists.newArrayList();
for (Plugin plugin : plugins) {
modules.addAll(plugin.indexModules(indexSettings));
// deprecated methods support
for (Class<? extends Module> moduleClass : plugin.indexModules()) {
modules.add(createModule(moduleClass, settings));
}
}
return modules;
}
示例13: shardModules
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
public Collection<Module> shardModules(Settings indexSettings) {
List<Module> modules = Lists.newArrayList();
for (Plugin plugin : plugins) {
modules.addAll(plugin.shardModules(indexSettings));
// deprecated methods support
for (Class<? extends Module> moduleClass : plugin.shardModules()) {
modules.add(createModule(moduleClass, settings));
}
}
return modules;
}
示例14: nodeModules
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
@Override
public Collection<Module> nodeModules() {
Collection<Module> modules = newArrayList();
modules.add(new SQLModule());
modules.add(new CircuitBreakerModule());
modules.add(new TransportExecutorModule());
modules.add(new JobModule());
modules.add(new CollectOperationModule());
modules.add(new FileCollectModule());
modules.add(new MergeOperationModule());
modules.add(new MetaDataModule());
modules.add(new MetaDataSysModule());
modules.add(new MetaDataDocModule());
modules.add(new MetaDataBlobModule());
modules.add(new MetaDataInformationModule());
modules.add(new OperatorModule());
modules.add(new PredicateModule());
modules.add(new MonitorModule(settings));
modules.add(new SysClusterExpressionModule());
modules.add(new SysNodeExpressionModule());
modules.add(new AggregationImplModule());
modules.add(new ScalarFunctionModule());
modules.add(new TableFunctionModule());
modules.add(new BulkModule());
modules.add(new SysChecksModule());
modules.add(new RepositorySettingsModule());
return modules;
}
示例15: indexModules
import org.elasticsearch.common.inject.Module; //導入依賴的package包/類
@Override
public Collection<Module> indexModules(Settings indexSettings) {
Collection<Module> modules = newArrayList();
if (!settings.getAsBoolean("node.client", false)) {
modules.add(new CrateIndexModule());
}
return modules;
}