use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class BinaryContext method configure.
/**
* @param marsh Binary marshaller.
* @param cfg Configuration.
* @throws BinaryObjectException In case of error.
*/
public void configure(BinaryMarshaller marsh, IgniteConfiguration cfg) throws BinaryObjectException {
if (marsh == null)
return;
this.marsh = marsh;
marshCtx = marsh.getContext();
BinaryConfiguration binaryCfg = cfg.getBinaryConfiguration();
if (binaryCfg == null)
binaryCfg = new BinaryConfiguration();
assert marshCtx != null;
optmMarsh.setContext(marshCtx);
configure(binaryCfg.getNameMapper(), binaryCfg.getIdMapper(), binaryCfg.getSerializer(), binaryCfg.getTypeConfigurations());
compactFooter = binaryCfg.isCompactFooter();
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class GridBinaryAffinityKeySelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration();
typeCfg.setTypeName(TestObject.class.getName());
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setTypeConfigurations(Collections.singleton(typeCfg));
cfg.setBinaryConfiguration(bCfg);
CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(TestObject.class.getName(), "affKey");
CacheKeyConfiguration keyCfg2 = new CacheKeyConfiguration("TestObject2", "affKey");
cfg.setCacheKeyConfiguration(keyCfg, keyCfg2);
cfg.setMarshaller(new BinaryMarshaller());
if (!igniteInstanceName.equals(getTestIgniteInstanceName(GRID_CNT))) {
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(PARTITIONED);
cfg.setCacheConfiguration(cacheCfg);
}
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
return cfg;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class GridBinaryWildcardsSelfTest method binaryMarshaller.
/**
*
*/
protected BinaryMarshaller binaryMarshaller(BinaryNameMapper nameMapper, BinaryIdMapper mapper, BinarySerializer serializer, Collection<BinaryTypeConfiguration> cfgs) throws IgniteCheckedException {
IgniteConfiguration iCfg = new IgniteConfiguration();
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setNameMapper(nameMapper);
bCfg.setIdMapper(mapper);
bCfg.setSerializer(serializer);
bCfg.setTypeConfigurations(cfgs);
iCfg.setBinaryConfiguration(bCfg);
BinaryContext ctx = new BinaryContext(BinaryNoopMetadataHandler.instance(), iCfg, new NullLogger());
BinaryMarshaller marsh = new BinaryMarshaller();
marsh.setContext(new MarshallerContextTestImpl(null));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
return marsh;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class BinaryObjectBuilderDefaultMappersSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
BinaryTypeConfiguration customTypeCfg = new BinaryTypeConfiguration();
customTypeCfg.setTypeName(CustomIdMapper.class.getName());
customTypeCfg.setIdMapper(new BinaryIdMapper() {
@Override
public int typeId(String clsName) {
return ~BinaryContext.defaultIdMapper().typeId(clsName);
}
@Override
public int fieldId(int typeId, String fieldName) {
return typeId + ~BinaryContext.defaultIdMapper().fieldId(typeId, fieldName);
}
});
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setCompactFooter(compactFooter());
bCfg.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(Key.class.getName()), new BinaryTypeConfiguration(Value.class.getName()), new BinaryTypeConfiguration("org.gridgain.grid.internal.util.binary.mutabletest.*"), customTypeCfg));
bCfg.setIdMapper(new BinaryBasicIdMapper(false));
bCfg.setNameMapper(new BinaryBasicNameMapper(false));
cfg.setBinaryConfiguration(bCfg);
cfg.setMarshaller(new BinaryMarshaller());
this.cfg = cfg;
return cfg;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(REPLICATED);
CacheConfiguration cacheCfg2 = new CacheConfiguration("partitioned");
cacheCfg2.setCacheMode(PARTITIONED);
cfg.setCacheConfiguration(cacheCfg, cacheCfg2);
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setCompactFooter(compactFooter());
bCfg.setClassNames(Arrays.asList("org.apache.ignite.internal.binary.mutabletest.*"));
cfg.setMarshaller(new BinaryMarshaller());
return cfg;
}
Aggregations