Java Code Examples for org.apache.ignite.configuration.BinaryConfiguration#setNameMapper()

The following examples show how to use org.apache.ignite.configuration.BinaryConfiguration#setNameMapper() . 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: IgniteTestConfigurationBuilder.java    From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 6 votes vote down vote up
private IgniteConfiguration createConfig() {
	IgniteConfiguration config = new IgniteConfiguration();
	config.setIgniteInstanceName( "OgmTestGrid" );
	config.setClientMode( false );
	BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
	binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) );
	binaryConfiguration.setCompactFooter( false ); // it is necessary only for embedded collections (@ElementCollection)
	config.setBinaryConfiguration( binaryConfiguration );
	TransactionConfiguration transactionConfiguration = new TransactionConfiguration();
	// I'm going to use PESSIMISTIC here because some people had problem with it and it would be nice if tests
	// can highlight the issue. Ideally, we would want to test the different concurrency and isolation level.
	transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.PESSIMISTIC );
	transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED );
	config.setTransactionConfiguration( transactionConfiguration );

	return config;
}
 
Example 2
Source File: IgniteModuleMemberRegistrationIT.java    From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 6 votes vote down vote up
private IgniteConfiguration createConfig() {
	IgniteConfiguration config = new IgniteConfiguration();
	config.setIgniteInstanceName( "OgmTestGrid" );
	config.setClientMode( false );
	BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
	binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) );
	binaryConfiguration.setCompactFooter( false ); // it is necessary only for embedded collections (@ElementCollection)
	config.setBinaryConfiguration( binaryConfiguration );
	TransactionConfiguration transactionConfiguration = new TransactionConfiguration();
	// I'm going to use PESSIMISTIC here because some people had problem with it and it would be nice if tests
	// can highlight the issue. Ideally, we would want to test the different concurrency and isolation level.
	transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.PESSIMISTIC );
	transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED );
	config.setTransactionConfiguration( transactionConfiguration );

	return config;
}
 
Example 3
Source File: GridCacheBinaryStoreBinariesSimpleNameMappersSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    BinaryConfiguration bCfg = cfg.getBinaryConfiguration();

    bCfg.setNameMapper(new BinaryBasicNameMapper());
    bCfg.setIdMapper(new BinaryBasicIdMapper(true));

    return cfg;
}
 
Example 4
Source File: BinaryObjectBuilderSimpleNameLowerCaseMappersSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    BinaryConfiguration bCfg = cfg.getBinaryConfiguration();

    bCfg.setIdMapper(new BinaryBasicIdMapper(true));
    bCfg.setNameMapper(new BinaryBasicNameMapper(true));

    return cfg;
}
 
Example 5
Source File: GridBinaryWildcardsSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
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;
}
 
Example 6
Source File: GridSimpleLowerCaseBinaryMappersBinaryMetaDataSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    BinaryConfiguration bCfg = cfg.getBinaryConfiguration();

    bCfg.setNameMapper(new BinaryBasicNameMapper());
    bCfg.setIdMapper(new BinaryBasicIdMapper(true));

    return cfg;
}
 
Example 7
Source File: BinaryMarshallerSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @return Binary marshaller.
 */
protected BinaryMarshaller binaryMarshaller(
    BinaryNameMapper nameMapper,
    BinaryIdMapper mapper,
    BinarySerializer serializer,
    Collection<BinaryTypeConfiguration> cfgs,
    Collection<String> excludedClasses
) throws IgniteCheckedException {
    IgniteConfiguration iCfg = new IgniteConfiguration();

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setNameMapper(nameMapper);
    bCfg.setIdMapper(mapper);
    bCfg.setSerializer(serializer);
    bCfg.setCompactFooter(compactFooter());

    bCfg.setTypeConfigurations(cfgs);

    iCfg.setBinaryConfiguration(bCfg);
    iCfg.setClientMode(false);
    iCfg.setDiscoverySpi(new TcpDiscoverySpi() {
        @Override public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException {
            //No-op.
        }
    });
    iCfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi());

    BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());

    BinaryMarshaller marsh = new BinaryMarshaller();

    MarshallerContextTestImpl marshCtx = new MarshallerContextTestImpl(null, excludedClasses);

    GridTestKernalContext kernCtx = new GridTestKernalContext(log, iCfg);

    kernCtx.add(new GridSystemViewManager(kernCtx));
    kernCtx.add(new GridDiscoveryManager(kernCtx));

    marshCtx.onMarshallerProcessorStarted(kernCtx, null);

    marsh.setContext(marshCtx);

    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);

    return marsh;
}
 
Example 8
Source File: GridDefaultBinaryMappersBinaryMetaDataSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setNameMapper(new BinaryBasicNameMapper(false));
    bCfg.setIdMapper(new BinaryBasicIdMapper(false));

    bCfg.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName()));

    cfg.setBinaryConfiguration(bCfg);

    cfg.setMarshaller(new BinaryMarshaller());

    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    cfg.setCacheConfiguration(ccfg);

    GridDefaultBinaryMappersBinaryMetaDataSelfTest.cfg = cfg;

    return cfg;
}
 
Example 9
Source File: GridCacheBinaryStoreAbstractSelfTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setNameMapper(new BinaryBasicNameMapper(false));
    bCfg.setIdMapper(new BinaryBasicIdMapper(false));

    bCfg.setClassNames(Arrays.asList(Key.class.getName(), Value.class.getName()));

    cfg.setBinaryConfiguration(bCfg);

    cfg.setMarshaller(new BinaryMarshaller());

    CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    cacheCfg.setCacheStoreFactory(singletonFactory(STORE));
    cacheCfg.setStoreKeepBinary(keepBinaryInStore());
    cacheCfg.setReadThrough(true);
    cacheCfg.setWriteThrough(true);
    cacheCfg.setLoadPreviousValue(true);

    cfg.setCacheConfiguration(cacheCfg);

    GridCacheBinaryStoreAbstractSelfTest.cfg = cfg;

    return cfg;
}