本文整理汇总了Java中com.tangosol.util.BinaryEntry类的典型用法代码示例。如果您正苦于以下问题:Java BinaryEntry类的具体用法?Java BinaryEntry怎么用?Java BinaryEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BinaryEntry类属于com.tangosol.util包,在下文中一共展示了BinaryEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDocument
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@Override
public XDMDocument createDocument(Entry<Long, XDMDocument> entry, String uri, String xml) {
logger.trace("createDocument.enter; entry: {}", entry);
BinaryEntry docEntry = (BinaryEntry) entry;
if (docEntry.isPresent()) {
throw new IllegalStateException("Document Entry with id " + entry.getKey() + " already exists");
}
Long id = entry.getKey();
List<XDMElement> data = null; //parseDocument(xml, id);
XDMElement root = null; //getDocumentRoot(data);
if (root != null) {
int docType = 0; //mDictionary.translateDocumentType(root.getPath());
BackingMapManagerContext ctx = docEntry.getContext();
for (Iterator<XDMElement> itr = data.iterator(); itr.hasNext();) {
createElement(ctx, itr.next(), docType);
}
String user = "system"; // get user from context!
XDMDocument doc = new XDMDocument(id, uri, docType, user); // + version, createdAt, encoding
docEntry.setValue(doc, false);
mDictionary.normalizeDocumentType(docType);
logger.trace("createDocument.exit; returning: {}", doc);
return doc;
} else {
logger.warn("createDocument.exit; the document is not valid as it has no root element, returning null");
return null;
}
}
示例2: deleteDocument
import com.tangosol.util.BinaryEntry; //导入依赖的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);
}
示例3: onInserting
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@SuppressWarnings("UnusedDeclaration") // Called by Coherence
@OnInserting
public void onInserting(BinaryEntry entry) {
final ServiceId serviceId = getServiceId(entry);
final CoherenceClusterServicesController servicesManager = getServiceManager(entry);
servicesManager.registerService(serviceType, serviceId, serviceData);
}
示例4: onInserted
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@SuppressWarnings("UnusedDeclaration") // Called by Coherence
@OnInserted
public void onInserted(BinaryEntry entry) {
final ServiceId serviceId = getServiceId(entry);
final CoherenceClusterServicesController servicesManager = getServiceManager(entry);
servicesManager.startService(serviceType, serviceId);
}
示例5: onRemoving
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@SuppressWarnings("UnusedDeclaration") // Called by Coherence
@OnRemoving
public void onRemoving(BinaryEntry entry) {
final ServiceId serviceId = getServiceId(entry);
final CoherenceClusterServicesController servicesManager = getServiceManager(entry);
servicesManager.stopService(serviceType, serviceId);
}
示例6: onRemoved
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@SuppressWarnings("UnusedDeclaration") // Called by Coherence
@OnRemoved
public void onRemoved(BinaryEntry entry) {
final ServiceId serviceId = getServiceId(entry);
final CoherenceClusterServicesController servicesManager = getServiceManager(entry);
servicesManager.unregisterService(serviceType, serviceId);
}
示例7: getServiceId
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
private static ServiceId getServiceId(BinaryEntry entry) {
Object key = entry.getKey();
if (!(key instanceof ServiceId)) {
throw new ClusterServiceException("Invalid key. Key must be instance of ServiceId. Actual key: " + key);
}
return (ServiceId)key;
}
示例8: shouldThrowIfUnknownTimeLineRequests
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@Test(expectedExceptions = IllegalStateException.class)
public void shouldThrowIfUnknownTimeLineRequests() throws Exception {
// Given:
givenExtractorsSetUpToUseTestBinary();
BinaryEntry entry = createTestEntry("businessKey", 1, 11234L);
// When:
index.getTimeLine(entry.getBinaryKey());
}
示例9: shouldThrowIfUnknownTimestampWhenDeletingEntry
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@Test(expectedExceptions = IllegalStateException.class)
public void shouldThrowIfUnknownTimestampWhenDeletingEntry() throws Exception {
// Given:
givenExtractorsSetUpToUseTestBinary();
givenTimeLineExistsFor("businessKey");
BinaryEntry entry = createdDeletedTestEntry(createTestEntry("businessKey", 1, 11234L));
// When:
index.delete(entry);
}
示例10: shouldThrowIfUnknownBusinessKeyWhenDeletingEntry
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@Test(expectedExceptions = IllegalStateException.class)
public void shouldThrowIfUnknownBusinessKeyWhenDeletingEntry() throws Exception {
// Given:
givenExtractorsSetUpToUseTestBinary();
BinaryEntry entry = createdDeletedTestEntry(createTestEntry("businessKey", 1, 11234L));
// When:
index.delete(entry);
}
示例11: shouldThrowIfItCantExtractBusinessKeyWhenRetrievingTimeLine
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@Test(expectedExceptions = IllegalArgumentException.class)
public void shouldThrowIfItCantExtractBusinessKeyWhenRetrievingTimeLine() throws Exception {
// Given:
BinaryEntry entry = createTestEntry(null, 1, 11234L);
// When:
index.getTimeLine(entry.getBinaryKey());
}
示例12: shouldCreateNewTimeLineOnFirstOccurrenceOfBusinessKey
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@Test
public void shouldCreateNewTimeLineOnFirstOccurrenceOfBusinessKey() throws Exception {
// Given:
givenExtractorsSetUpToUseTestBinary();
BinaryEntry entry = createTestEntry("businessKey", 1, 11234L);
// When:
index.insert(entry);
// Then:
TimeLine timeLine = index.getTimeLine(entry.getBinaryKey());
assertThat(timeLine, is(notNullValue()));
assertThat(timeLine.keySet(), contains((Object) entry.getBinaryKey()));
assertThat(timeLine.get(11234L), is((Object)entry.getBinaryKey()));
}
示例13: insert
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void insert(Entry entry) {
BinaryEntry be = (BinaryEntry) entry;
String key = be.getBinaryKey().toString();
String value = (String) InvocableMapHelper.extractFromEntry(extractor, entry);
bloomFilter.add(getBloomValue(key, value));
}
示例14: createElement
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
private Object createElement(BackingMapManagerContext ctx, XDMElement xdm, int docType) {
//XDMDataKey xdk = mFactory.newXDMDataKey(xdm.getElementId(), 0L); //xdm.getDocumentId());
XDMDataKey xdk = mFactory.newXDMDataKey(0L, 0); //xdm.getDocumentId());
Object xdk1 = ctx.getKeyToInternalConverter().convert(xdk);
BackingMapContext xdmCtx = ctx.getBackingMapContext(CN_XDM_ELEMENT);
BinaryEntry xdmEntry = (BinaryEntry) xdmCtx.getBackingMapEntry(xdk1);
if (xdmEntry == null) {
throw new IllegalStateException("XDM entry is null; means we're on the wrong partition! key: " + xdk);
}
if (xdmEntry.isPresent()) {
throw new IllegalStateException("XDM Entry with id " + xdmEntry.getKey() + " already exists");
}
//xdm.setPathId(mDictionary.translatePath(docType, xdm.getPath(), XDMNodeKind.fromPath(xdm.getPath())));
xdmEntry.setValue(xdm, false);
/*
if (xdm.getPath() != null) {
PathDocumentKey pdk = new PathDocumentKey(xdm.getPath(), xdm.getDocumentId());
Object pdk1 = ctx.getKeyToInternalConverter().convert(pdk);
BackingMapContext pdCtx = ctx.getBackingMapContext(CN_XDM_PATH_INDEX);
BinaryEntry pdEntry = (BinaryEntry) pdCtx.getBackingMapEntry(pdk1);
if (pdEntry == null) {
throw new IllegalStateException("Path entry is null; means we're on the wrong partition! key: " + pdk);
}
XDMIndex<Boolean> idx;
if (pdEntry.isPresent()) {
idx = (XDMIndex<Boolean>) pdEntry.getValue();
idx.addIndex(xdm.getDocumentId(), xdm.getDataId());
} else {
idx = new XDMIndex<Boolean>(xdm.getPath(), true, xdm.getDocumentId(), xdm.getDataId());
}
pdEntry.setValue(idx, false);
}
*/
//logger.trace("create.exit; store entry: {}", xdmEntry);
return xdmEntry.getKey(); //xdm.getId();
}
示例15: keySet
import com.tangosol.util.BinaryEntry; //导入依赖的package包/类
public <T> Set<T> keySet(BinaryEntry entry, String cacheName, Filter filter) {
return keySet(entry, cacheName, filter, false, null);
}