use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class IgniteServiceProxyTimeoutInitializedTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(final String igniteInstanceName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
final ServiceConfiguration scfg = new ServiceConfiguration();
if (igniteInstanceName.endsWith("0")) {
scfg.setName("testService");
scfg.setService(srvc);
scfg.setMaxPerNodeCount(1);
scfg.setTotalCount(1);
scfg.setNodeFilter(new NodeFilter());
final Map<String, String> attrs = new HashMap<>();
attrs.put("clusterGroup", "0");
cfg.setUserAttributes(attrs);
cfg.setServiceConfiguration(scfg);
}
cfg.setMarshaller(null);
final BinaryConfiguration binCfg = new BinaryConfiguration();
// Despite defaults explicitly set to lower case.
binCfg.setIdMapper(new BinaryBasicIdMapper(true));
cfg.setBinaryConfiguration(binCfg);
return cfg;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class BinarySerializationQuerySelfTest method beforeTest.
/** {@inheritDoc} */
@Override
protected void beforeTest() throws Exception {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setLocalHost("127.0.0.1");
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(discoSpi);
cfg.setMarshaller(new BinaryMarshaller());
if (useReflectiveSerializer()) {
BinaryTypeConfiguration binTypCfg1 = new BinaryTypeConfiguration(EntityPlain.class.getName());
BinaryTypeConfiguration binTypCfg2 = new BinaryTypeConfiguration(EntitySerializable.class.getName());
BinaryTypeConfiguration binTypCfg3 = new BinaryTypeConfiguration(EntityExternalizable.class.getName());
BinaryTypeConfiguration binTypCfg4 = new BinaryTypeConfiguration(EntityBinarylizable.class.getName());
BinaryTypeConfiguration binTypCfg5 = new BinaryTypeConfiguration(EntityWriteReadObject.class.getName());
binTypCfg1.setSerializer(new BinaryReflectiveSerializer());
binTypCfg2.setSerializer(new BinaryReflectiveSerializer());
binTypCfg3.setSerializer(new BinaryReflectiveSerializer());
binTypCfg4.setSerializer(new BinaryReflectiveSerializer());
binTypCfg5.setSerializer(new BinaryReflectiveSerializer());
List<BinaryTypeConfiguration> binTypCfgs = new ArrayList<>();
binTypCfgs.add(binTypCfg1);
binTypCfgs.add(binTypCfg2);
binTypCfgs.add(binTypCfg3);
binTypCfgs.add(binTypCfg4);
binTypCfgs.add(binTypCfg5);
BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setTypeConfigurations(binTypCfgs);
cfg.setBinaryConfiguration(binCfg);
}
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(CacheMode.PARTITIONED);
cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
List<QueryEntity> queryEntities = new ArrayList<>();
queryEntities.add(entityForClass(EntityPlain.class));
queryEntities.add(entityForClass(EntitySerializable.class));
queryEntities.add(entityForClass(EntityExternalizable.class));
queryEntities.add(entityForClass(EntityBinarylizable.class));
queryEntities.add(entityForClass(EntityWriteReadObject.class));
cacheCfg.setQueryEntities(queryEntities);
cfg.setCacheConfiguration(cacheCfg);
ignite = Ignition.start(cfg);
cache = ignite.cache(DEFAULT_CACHE_NAME);
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class IgniteCacheAbstractInsertSqlQuerySelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration() {
{
setTypeName(Key.class.getName());
}
}, new BinaryTypeConfiguration() {
{
setTypeName(Key2.class.getName());
}
}));
cfg.setBinaryConfiguration(binCfg);
cfg.setPeerClassLoadingEnabled(false);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
return cfg;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class PlatformDotNetConfigurationClosure method setBinaryConfiguration.
/**
* Sets binary config.
*
* @param igniteCfg Ignite config.
* @param dotNetCfg Dotnet config.
*/
private void setBinaryConfiguration(IgniteConfiguration igniteCfg, PlatformDotNetConfigurationEx dotNetCfg) {
// Check marshaller.
Marshaller marsh = igniteCfg.getMarshaller();
if (marsh == null) {
igniteCfg.setMarshaller(new BinaryMarshaller());
dotNetCfg.warnings(Collections.singleton("Marshaller is automatically set to " + BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller type)."));
} else if (!(marsh instanceof BinaryMarshaller))
throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName() + " can be used when running Apache Ignite.NET): " + marsh.getClass().getName());
BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration();
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class PlatformCppConfigurationClosure method apply0.
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
@Override
protected void apply0(IgniteConfiguration igniteCfg) {
// 3. Validate and copy Interop configuration setting environment pointer along the way.
PlatformConfiguration interopCfg = igniteCfg.getPlatformConfiguration();
if (interopCfg != null && !(interopCfg instanceof PlatformCppConfiguration))
throw new IgniteException("Illegal interop configuration (must be of type " + PlatformCppConfiguration.class.getName() + "): " + interopCfg.getClass().getName());
PlatformCppConfiguration cppCfg = interopCfg != null ? (PlatformCppConfiguration) interopCfg : null;
if (cppCfg == null)
cppCfg = new PlatformCppConfiguration();
PlatformMemoryManagerImpl memMgr = new PlatformMemoryManagerImpl(gate, 1024);
PlatformCppConfigurationEx cppCfg0 = new PlatformCppConfigurationEx(cppCfg, gate, memMgr);
igniteCfg.setPlatformConfiguration(cppCfg0);
// Check marshaller
Marshaller marsh = igniteCfg.getMarshaller();
if (marsh == null) {
igniteCfg.setMarshaller(new BinaryMarshaller());
cppCfg0.warnings(Collections.singleton("Marshaller is automatically set to " + BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller type)."));
} else if (!(marsh instanceof BinaryMarshaller))
throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName() + " can be used when running Apache Ignite C++): " + marsh.getClass().getName());
BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration();
if (bCfg == null) {
bCfg = new BinaryConfiguration();
bCfg.setCompactFooter(false);
bCfg.setNameMapper(new BinaryBasicNameMapper(true));
bCfg.setIdMapper(new BinaryBasicIdMapper(true));
igniteCfg.setBinaryConfiguration(bCfg);
cppCfg0.warnings(Collections.singleton("Binary configuration is automatically initiated, " + "note that binary name mapper is set to " + bCfg.getNameMapper() + " and binary ID mapper is set to " + bCfg.getIdMapper() + " (other nodes must have the same binary name and ID mapper types)."));
} else {
BinaryNameMapper nameMapper = bCfg.getNameMapper();
if (nameMapper == null) {
bCfg.setNameMapper(new BinaryBasicNameMapper(true));
cppCfg0.warnings(Collections.singleton("Binary name mapper is automatically set to " + bCfg.getNameMapper() + " (other nodes must have the same binary name mapper type)."));
}
BinaryIdMapper idMapper = bCfg.getIdMapper();
if (idMapper == null) {
bCfg.setIdMapper(new BinaryBasicIdMapper(true));
cppCfg0.warnings(Collections.singleton("Binary ID mapper is automatically set to " + bCfg.getIdMapper() + " (other nodes must have the same binary ID mapper type)."));
}
}
if (bCfg.isCompactFooter())
throw new IgniteException("Unsupported " + BinaryMarshaller.class.getName() + " \"compactFooter\" flag: must be false when running Apache Ignite C++.");
// Set Ignite home so that marshaller context works.
String ggHome = igniteCfg.getIgniteHome();
if (ggHome != null)
U.setIgniteHome(ggHome);
}
Aggregations