当前位置: 首页>>代码示例>>Java>>正文


Java PofExtractor类代码示例

本文整理汇总了Java中com.tangosol.util.extractor.PofExtractor的典型用法代码示例。如果您正苦于以下问题:Java PofExtractor类的具体用法?Java PofExtractor怎么用?Java PofExtractor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PofExtractor类属于com.tangosol.util.extractor包,在下文中一共展示了PofExtractor类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: provideExtractorForValue

import com.tangosol.util.extractor.PofExtractor; //导入依赖的package包/类
private <T> ValueExtractor provideExtractorForValue(Class<T> clazz, int target, List<String> chainOfProperties) {
    Class<?> propertyClass = clazz;
    List<Integer> indices = Lists.newArrayList();

    for (String property : chainOfProperties) {
        Field field;
        try {
            field = clazz.getDeclaredField(property);
        } catch (NoSuchFieldException e) {
            throw new InvalidQueryException(e);
        }

        PortableProperty portablePropertyAnnotation = field.getAnnotation(PortableProperty.class);
        if (portablePropertyAnnotation == null) {
            throw new InvalidQueryException("");
        }

        // TODO add support for customs codecs some day ;)
        int index = portablePropertyAnnotation.value();
        indices.add(index);
        propertyClass = field.getDeclaringClass();
    }

    return new PofExtractor<>(propertyClass, new SimplePofPath(Ints.toArray(indices)), target);
}
 
开发者ID:michalwojciechowski,项目名称:coherence-sql,代码行数:26,代码来源:PofExtractorFactory.java

示例2: buildElement

import com.tangosol.util.extractor.PofExtractor; //导入依赖的package包/类
private String buildElement(BackingMapContext bmc, String path, long docId, int docType) {

    	Set<Integer> parts = mDictionary.getPathElements(docType, path);
   		Filter f = new AndFilter(
   			new EqualsFilter(new PofExtractor(Long.TYPE, 2), docId),
			new InFilter(new PofExtractor(Integer.TYPE, 4), parts));
   		
        Set<Map.Entry> xdEntries = QueryHelper.INSTANCE.query(bmc, f, true, false, null);
       	return null; //buildXml(xdEntries);
    }
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:11,代码来源:DocumentManagementServer.java

示例3: deleteDocument

import com.tangosol.util.extractor.PofExtractor; //导入依赖的package包/类
@Override
public void deleteDocument(Entry<Long, XDMDocument> entry) {
	logger.trace("deleteDocument.enter; entry: {}", entry);
	BinaryEntry docEntry = (BinaryEntry) entry;
	if (!docEntry.isPresent()) {
		throw new IllegalStateException("Document Entry with id " + entry.getKey() + " not found");
	}

	Long id = entry.getKey();
	BackingMapManagerContext ctx = docEntry.getContext();
	BackingMapContext xdmCtx = ctx.getBackingMapContext(CN_XDM_ELEMENT);

  		Filter f = new EqualsFilter(new PofExtractor(Long.class, 2), id);
       Set<Map.Entry> xdEntries = QueryHelper.INSTANCE.query(xdmCtx, f, true, false, null);
	logger.trace("deleteDocument; removing {} entries for docId: {}", xdEntries.size(), id);
       for (Map.Entry xdEntry : xdEntries) {
       	//((BinaryEntry) xdEntry).remove(false);
       	Object xdKey = ((BinaryEntry) xdEntry).getBinaryKey();
   		//logger.trace("process; removing entry for key: {}", xdKey);
       	xdmCtx.getBackingMap().remove(xdKey);
       	//xdEntry.setValue(null);
   		//logger.trace("process; removing {} entries for docId: {}", xdEntry.size(), id);
       }

       docEntry.remove(false);
	logger.trace("deleteDocument.exit; removed: {}", true);
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:28,代码来源:DocumentManagementServer.java

示例4: getDocumentId

import com.tangosol.util.extractor.PofExtractor; //导入依赖的package包/类
@Override
public Long getDocumentId(String uri) {
	Filter f = new EqualsFilter(new PofExtractor(String.class, 1), uri);
	Set<Long> docKeys = new HashSet<Long>(xddCache.keySet(f));
	if (docKeys.size() == 0) {
		return null;
	}
	// todo: check if too many docs ??
	return docKeys.iterator().next();
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:11,代码来源:DocumentManagementClient.java

示例5: queryPathKeys

import com.tangosol.util.extractor.PofExtractor; //导入依赖的package包/类
protected Set<Long> queryPathKeys(Set<Long> found, PathExpression pex, Object value) {

		int pathId = -1;
		if (pex.isRegex()) {
			Set<Integer> pathIds = mDictionary.translatePathFromRegex(pex.getDocType(), pex.getRegex());
			logger.trace("queryPathKeys; regex: {}; pathIds: {}", pex.getRegex(), pathIds);
			if (pathIds.size() > 0) {
				pathId = pathIds.iterator().next();
			}
		} else {
			String path = pex.getFullPath();
			logger.trace("queryPathKeys; path: {}; comparison: {}", path, pex.getCompType());
			pathId = mDictionary.translatePath(pex.getDocType(), path, XDMNodeKind.fromPath(path)).getPathId();
		}
		//String val = value.toString();
		Filter valueFilter = getValueFilter(pex, value);
		if (valueFilter == null) {
			throw new IllegalArgumentException("Can't construct filter for expression: " + pex);
		}

		Filter f = new AndFilter(
				new EqualsFilter(new PofExtractor(Integer.class, 4), pathId), valueFilter);
		Set<XDMDataKey> keys = xdmCache.keySet(f);
		logger.trace("queryPathKeys; path: {}, value: {}; got keys: {}; cache size: {}", 
				pathId, value, keys.size(), xdmCache.size()); 
		
		if (keys.size() > 0) {
			Set<Long> docIds = new HashSet<Long>();
			for (XDMDataKey key: keys) {
				docIds.add(key.getDocumentId());
			}
			found.retainAll(docIds);
		} else {
			found.clear();
		}
		return found;
	}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:38,代码来源:DocumentManagementClient.java

示例6: extractFromObject

import com.tangosol.util.extractor.PofExtractor; //导入依赖的package包/类
public static Object extractFromObject(ValueExtractor extractor, Object object, Serializer serialiser) {
    if (extractor instanceof PofExtractor) {
        PofNavigator navigator = ((PofExtractor) extractor).getNavigator();
        PofValue pofValue = PofValueParser.parse((Binary) object, (PofContext) serialiser);
        return navigator.navigate(pofValue).getValue();
    }

    if (object instanceof Binary) {
        Object deserialised = ExternalizableHelper.fromBinary((Binary)object, serialiser);
        return extractor.extract(deserialised);
    }

    return extractor.extract(object);
}
 
开发者ID:datalorax,项目名称:datagrids,代码行数:15,代码来源:InvocableMapHelper.java

示例7: shouldThrowIfNoIndexMatchingExtractor

import com.tangosol.util.extractor.PofExtractor; //导入依赖的package包/类
@Test
public void shouldThrowIfNoIndexMatchingExtractor() {
    // Given:
    NamedCache cache = givenSomeDataInCache("pof-distributed-cache-test", 7);
    PofExtractor unknownExtractor = new PofExtractor(null, 101);

    try {
        // When:
        cache.aggregate(AlwaysFilter.INSTANCE, new IndexContentExtractor(unknownExtractor));
    } catch (PortableException e){
        assertThat(e.getCause(), instanceOf(PortableException.class));
        assertThat(((PortableException)e.getCause()).getName(), containsString(IllegalStateException.class.getCanonicalName()));
    }
}
 
开发者ID:datalorax,项目名称:datagrids,代码行数:15,代码来源:IndexContentExtractorFunctionalTest.java


注:本文中的com.tangosol.util.extractor.PofExtractor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。