io.atomix.primitive.config.PrimitiveConfig Java Examples
The following examples show how to use
io.atomix.primitive.config.PrimitiveConfig.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultConfigService.java From atomix with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("unchecked") public <C extends PrimitiveConfig<C>> C getConfig(String primitiveName, PrimitiveType primitiveType) { C config = (C) configs.get(primitiveName); if (config != null) { return config; } if (primitiveType == null) { return null; } config = (C) defaultConfigs.get(primitiveType.name()); if (config != null) { return config; } return (C) primitiveType.newConfig(); }
Example #2
Source File: VertxRestService.java From atomix with Apache License 2.0 | 6 votes |
protected ObjectMapper createObjectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.setPropertyNamingStrategy(new ConfigPropertyNamingStrategy()); mapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS); mapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES); mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true); mapper.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true); SimpleModule module = new SimpleModule("PolymorphicTypes"); module.addDeserializer(PartitionGroupConfig.class, new PartitionGroupDeserializer(atomix.getRegistry())); module.addDeserializer(PrimitiveProtocolConfig.class, new PrimitiveProtocolDeserializer(atomix.getRegistry())); module.addDeserializer(PrimitiveConfig.class, new PrimitiveConfigDeserializer(atomix.getRegistry())); mapper.registerModule(module); return mapper; }
Example #3
Source File: CorePrimitivesService.java From atomix with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public <C extends PrimitiveConfig<C>, P extends SyncPrimitive> CompletableFuture<P> getPrimitiveAsync( String name, PrimitiveType<?, C, P> primitiveType, C primitiveConfig) { return cache.getPrimitive(name, () -> { C config = primitiveConfig; if (config == null) { config = configService.getConfig(name, primitiveType); } return primitiveType.newBuilder(name, config, managementService).buildAsync(); }); }
Example #4
Source File: Atomix.java From atomix with Apache License 2.0 | 5 votes |
@Override public <B extends PrimitiveBuilder<B, C, P>, C extends PrimitiveConfig<C>, P extends SyncPrimitive> B primitiveBuilder( String name, PrimitiveType<B, C, P> primitiveType) { checkRunning(); return primitives.primitiveBuilder(name, primitiveType); }
Example #5
Source File: Atomix.java From atomix with Apache License 2.0 | 5 votes |
/** * Returns a new Atomix configuration from the given resources. * * @param classLoader the class loader * @param files the files to load * @param registry the Atomix registry from which to map types * @return a new Atomix configuration from the given resource */ private static AtomixConfig config(ClassLoader classLoader, List<File> files, AtomixRegistry registry) { ConfigMapper mapper = new PolymorphicConfigMapper( classLoader, registry, new PolymorphicTypeMapper("type", PartitionGroupConfig.class, PartitionGroup.Type.class), new PolymorphicTypeMapper("type", PrimitiveConfig.class, PrimitiveType.class), new PolymorphicTypeMapper(null, PrimitiveConfig.class, PrimitiveType.class), new PolymorphicTypeMapper("type", PrimitiveProtocolConfig.class, PrimitiveProtocol.Type.class), new PolymorphicTypeMapper("type", ProfileConfig.class, Profile.Type.class), new PolymorphicTypeMapper("type", NodeDiscoveryConfig.class, NodeDiscoveryProvider.Type.class), new PolymorphicTypeMapper("type", GroupMembershipProtocolConfig.class, GroupMembershipProtocol.Type.class)); return mapper.loadFiles(AtomixConfig.class, files, Lists.newArrayList(RESOURCES)); }
Example #6
Source File: RaftTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { throw new UnsupportedOperationException(); }
Example #7
Source File: RaftServiceManagerTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { return null; }
Example #8
Source File: RaftTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveBuilder newBuilder(String primitiveName, PrimitiveConfig config, PrimitiveManagementService managementService) { throw new UnsupportedOperationException(); }
Example #9
Source File: ClusterPrimitiveType.java From submarine with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { throw new UnsupportedOperationException(); }
Example #10
Source File: RaftServiceManagerTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveBuilder newBuilder(String primitiveName, PrimitiveConfig config, PrimitiveManagementService managementService) { return null; }
Example #11
Source File: DistributedLogTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { throw new UnsupportedOperationException(); }
Example #12
Source File: DistributedLogTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveBuilder newBuilder(String primitiveName, PrimitiveConfig config, PrimitiveManagementService managementService) { throw new UnsupportedOperationException(); }
Example #13
Source File: PrimitiveConfigDeserializer.java From atomix with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") public PrimitiveConfigDeserializer(AtomixRegistry registry) { super(PrimitiveConfig.class, type -> registry.getType(PrimitiveType.class, type).newConfig().getClass()); }
Example #14
Source File: RaftPerformanceTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { throw new UnsupportedOperationException(); }
Example #15
Source File: RaftPerformanceTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveBuilder newBuilder(String primitiveName, PrimitiveConfig config, PrimitiveManagementService managementService) { throw new UnsupportedOperationException(); }
Example #16
Source File: RaftFuzzTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { throw new UnsupportedOperationException(); }
Example #17
Source File: RaftFuzzTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveBuilder newBuilder(String primitiveName, PrimitiveConfig config, PrimitiveManagementService managementService) { throw new UnsupportedOperationException(); }
Example #18
Source File: Atomix.java From atomix with Apache License 2.0 | 4 votes |
@Override public <C extends PrimitiveConfig<C>, P extends SyncPrimitive> CompletableFuture<P> getPrimitiveAsync( String name, PrimitiveType<?, C, P> primitiveType, C primitiveConfig) { checkRunning(); return primitives.getPrimitiveAsync(name, primitiveType, primitiveConfig); }
Example #19
Source File: CorePrimitivesService.java From atomix with Apache License 2.0 | 4 votes |
@Override public <B extends PrimitiveBuilder<B, C, P>, C extends PrimitiveConfig<C>, P extends SyncPrimitive> B primitiveBuilder( String name, PrimitiveType<B, C, P> primitiveType) { return primitiveType.newBuilder(name, configService.getConfig(name, primitiveType), managementService); }
Example #20
Source File: TestPrimitiveType.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { throw new UnsupportedOperationException(); }
Example #21
Source File: ClusterPrimitiveType.java From submarine with Apache License 2.0 | 4 votes |
@Override public PrimitiveBuilder newBuilder(String primitiveName, PrimitiveConfig config, PrimitiveManagementService managementService) { throw new UnsupportedOperationException(); }
Example #22
Source File: ClusterPrimitiveType.java From zeppelin with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { throw new UnsupportedOperationException(); }
Example #23
Source File: ClusterPrimitiveType.java From zeppelin with Apache License 2.0 | 4 votes |
@Override public PrimitiveBuilder newBuilder(String primitiveName, PrimitiveConfig config, PrimitiveManagementService managementService) { throw new UnsupportedOperationException(); }
Example #24
Source File: SessionIdGeneratorType.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { throw new UnsupportedOperationException(); }
Example #25
Source File: SessionIdGeneratorType.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveBuilder newBuilder(String name, PrimitiveConfig config, PrimitiveManagementService managementService) { throw new UnsupportedOperationException(); }
Example #26
Source File: PrimaryElectorType.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { throw new UnsupportedOperationException(); }
Example #27
Source File: DefaultConfigService.java From atomix with Apache License 2.0 | 4 votes |
public DefaultConfigService(Collection<PrimitiveConfig> defaultConfigs, Collection<PrimitiveConfig> configs) { defaultConfigs.forEach(config -> this.defaultConfigs.put(((PrimitiveType) config.getType()).name(), config)); configs.forEach(config -> this.configs.put(config.getName(), config)); }
Example #28
Source File: TestPrimitiveType.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveBuilder newBuilder(String primitiveName, PrimitiveConfig config, PrimitiveManagementService managementService) { throw new UnsupportedOperationException(); }
Example #29
Source File: PrimaryBackupTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveBuilder newBuilder(String primitiveName, PrimitiveConfig config, PrimitiveManagementService managementService) { throw new UnsupportedOperationException(); }
Example #30
Source File: PrimaryBackupTest.java From atomix with Apache License 2.0 | 4 votes |
@Override public PrimitiveConfig newConfig() { throw new UnsupportedOperationException(); }