本文整理汇总了Java中org.apache.ignite.configuration.CacheConfiguration.setSqlSchema方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.setSqlSchema方法的具体用法?Java CacheConfiguration.setSqlSchema怎么用?Java CacheConfiguration.setSqlSchema使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.CacheConfiguration
的用法示例。
在下文中一共展示了CacheConfiguration.setSqlSchema方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param name Cache name.
* @param clsK Key class.
* @param clsV Value class.
* @return Cache configuration.
*/
@SuppressWarnings("unchecked")
private CacheConfiguration cacheConfiguration(@NotNull String name, String sqlSchema, Class<?> clsK,
Class<?> clsV) {
CacheConfiguration cc = defaultCacheConfiguration();
cc.setName(name);
cc.setCacheMode(CacheMode.PARTITIONED);
cc.setAtomicityMode(CacheAtomicityMode.ATOMIC);
cc.setNearConfiguration(null);
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setRebalanceMode(SYNC);
cc.setSqlSchema(sqlSchema);
cc.setSqlFunctionClasses(GridQueryParsingTest.class);
cc.setIndexedTypes(clsK, clsV);
if (!QueryUtils.isSqlType(clsK))
cc.setKeyConfiguration(new CacheKeyConfiguration(clsK));
return cc;
}
示例2: createEntityCacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
private CacheConfiguration<?,?> createEntityCacheConfiguration(EntityKeyMetadata entityKeyMetadata, SchemaDefinitionContext context) {
CacheConfiguration<?,?> cacheConfiguration = new CacheConfiguration<>();
cacheConfiguration.setStoreKeepBinary( true );
cacheConfiguration.setSqlSchema( QueryUtils.DFLT_SCHEMA );
cacheConfiguration.setBackups( 1 );
cacheConfiguration.setName( StringHelper.stringBeforePoint( entityKeyMetadata.getTable() ) );
cacheConfiguration.setAtomicityMode( CacheAtomicityMode.TRANSACTIONAL );
QueryEntity queryEntity = new QueryEntity();
queryEntity.setTableName( entityKeyMetadata.getTable() );
queryEntity.setKeyType( getEntityIdClassName( entityKeyMetadata.getTable(), context ).getSimpleName() );
queryEntity.setValueType( StringHelper.stringAfterPoint( entityKeyMetadata.getTable() ) );
addTableInfo( queryEntity, context, entityKeyMetadata.getTable() );
for ( AssociationKeyMetadata associationKeyMetadata : context.getAllAssociationKeyMetadata() ) {
if ( associationKeyMetadata.getAssociationKind() != AssociationKind.EMBEDDED_COLLECTION
&& associationKeyMetadata.getTable().equals( entityKeyMetadata.getTable() )
&& !IgniteAssociationSnapshot.isThirdTableAssociation( associationKeyMetadata ) ) {
appendIndex( queryEntity, associationKeyMetadata, context );
}
}
log.debugf( "queryEntity: %s", queryEntity );
cacheConfiguration.setQueryEntities( Arrays.asList( queryEntity ) );
return cacheConfiguration;
}
示例3: doTestSchemaName
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param schema Schema name.
*/
public void doTestSchemaName(String schema) {
CacheConfiguration ccfg = cacheConfig("persPartAff", true, Integer.class, Person2.class);
ccfg.setSqlSchema(schema);
IgniteCache<Integer, Person2> ppAf = ignite(0).createCache(ccfg);
try {
ppAf.put(1, new Person2(10, "Petya"));
ppAf.put(2, new Person2(10, "Kolya"));
List<List<?>> res = ppAf.query(new SqlFieldsQuery("select name from " +
schema + ".Person2 order by _key")).getAll();
assertEquals("Petya", res.get(0).get(0));
assertEquals("Kolya", res.get(1).get(0));
}
finally {
ppAf.destroy();
}
}
示例4: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi spi = ((TcpDiscoverySpi)cfg.getDiscoverySpi());
spi.setIpFinder(IP_FINDER);
CacheConfiguration<Integer, A> ccfga = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfga.setName("a");
ccfga.setSqlSchema("A");
ccfga.setAtomicityMode(CacheAtomicityMode.ATOMIC);
ccfga.setBackups(1);
ccfga.setCacheMode(CacheMode.PARTITIONED);
ccfga.setIndexedTypes(Integer.class, A.class);
CacheConfiguration<Integer, B> ccfgb = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfgb.setName("b");
ccfgb.setSqlSchema("B");
ccfgb.setAtomicityMode(CacheAtomicityMode.ATOMIC);
ccfgb.setBackups(1);
ccfgb.setCacheMode(CacheMode.PARTITIONED);
ccfgb.setIndexedTypes(Integer.class, B.class);
CacheConfiguration<Integer, C> ccfgc = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfgc.setName("c");
ccfgc.setSqlSchema("C");
ccfgc.setAtomicityMode(CacheAtomicityMode.ATOMIC);
ccfgc.setBackups(1);
ccfgc.setCacheMode(CacheMode.PARTITIONED);
ccfgc.setIndexedTypes(Integer.class, C.class);
cfg.setCacheConfiguration(ccfga, ccfgb, ccfgc);
return cfg;
}
示例5: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setClientMode(F.eq(NODE_CLI, igniteInstanceName));
CacheConfiguration<Integer, PartValue> ccfg1 = new CacheConfiguration<>(CACHE_PARTITIONED);
ccfg1.setCacheMode(PARTITIONED);
ccfg1.setAtomicityMode(TRANSACTIONAL);
ccfg1.setWriteSynchronizationMode(FULL_SYNC);
ccfg1.setIndexedTypes(Integer.class, PartValue.class);
ccfg1.setSqlSchema(QueryUtils.DFLT_SCHEMA);
CacheConfiguration<Integer, RepValue> ccfg2 = new CacheConfiguration<>(CACHE_REPLICATED);
ccfg2.setAffinity(new RendezvousAffinityFunction(false, REP_CNT));
ccfg2.setCacheMode(REPLICATED);
ccfg2.setAtomicityMode(TRANSACTIONAL);
ccfg2.setWriteSynchronizationMode(FULL_SYNC);
ccfg2.setIndexedTypes(Integer.class, RepValue.class);
ccfg2.setSqlSchema(QueryUtils.DFLT_SCHEMA);
cfg.setCacheConfiguration(ccfg1, ccfg2);
return cfg;
}
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:IgniteCacheReplicatedFieldsQueryJoinNoPrimaryPartitionsSelfTest.java
示例6: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param name Cache name.
* @param schema Schema name.
* @return Cache configuration.
* @throws Exception In case of error.
*/
@SuppressWarnings("unchecked")
private CacheConfiguration cacheConfiguration(@NotNull String name, @NotNull String schema) throws Exception {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setIndexedTypes(Integer.class, Integer.class);
cfg.setName(name);
cfg.setSqlSchema(schema);
return cfg;
}