package attributeExtractor; import com.wm.data.IData; import com.wm.data.IDataUtil; import java.util.Properties; import net.sf.ehcache.Element; import net.sf.ehcache.search.attribute.AttributeExtractor; import net.sf.ehcache.search.attribute.AttributeExtractorException; public class AttributeExtractorEntity implements AttributeExtractor { private static final long serialVersionUID = 1L; private Properties p; public AttributeExtractorEntity(Properties p) { this.p = p; } public Object attributeFor(Element element, String attributeName) throws AttributeExtractorException { return IDataUtil.get(((IData)element.getObjectValue()).getCursor(), attributeName); } }
Sunday, November 25, 2018
AttributeExtractorEntity
extracor -Search API output to IDATA
package TawnTerracottaCaching.v01.services;
// -----( IS Java Code Template v1.2
// -----( CREATED: 2018-03-07 09:36:51 AST
// -----( ON-HOST: TerracottaProd.TAWN.COM
import com.wm.data.*;
import com.wm.util.Values;
import com.wm.app.b2b.server.Service;
import com.wm.app.b2b.server.ServiceException;
// --- <> ---
import java.io.*;
import java.lang.Object;
import com.wm.app.b2b.client.cache.config.*;
// --- <> ---
public final class util
{
// ---( internal utility methods )---
final static util _instance = new util();
static util _newInstance() { return new util(); }
static util _cast(Object o) { return (util)o; }
// ---( server methods )---
public static final void searchResultToIdata (IData pipeline)
throws ServiceException
{
// --- <> ---
// @sigtype java 3.5
// [i] object:1:required result
// [o] record:1:required R1
Object[] object = (Object[]) IDataUtil.get(pipeline.getCursor(), "result");
IData[] Result = new IData[object.length];
for (int i = 0; i < object.length; i++) {
com.wm.app.b2b.client.cache.config.SearchResult res = (com.wm.app.b2b.client.cache.config.SearchResult) object[i];
Result [i] = ( IData ) res.getValue();
}
pipeline.getCursor().insertBefore("Result", Result);
// --- <> ---
}
}
// -----( IS Java Code Template v1.2
// -----( CREATED: 2018-03-07 09:36:51 AST
// -----( ON-HOST: TerracottaProd.TAWN.COM
import com.wm.data.*;
import com.wm.util.Values;
import com.wm.app.b2b.server.Service;
import com.wm.app.b2b.server.ServiceException;
// --- <
import java.io.*;
import java.lang.Object;
import com.wm.app.b2b.client.cache.config.*;
// --- <
public final class util
{
// ---( internal utility methods )---
final static util _instance = new util();
static util _newInstance() { return new util(); }
static util _cast(Object o) { return (util)o; }
// ---( server methods )---
public static final void searchResultToIdata (IData pipeline)
throws ServiceException
{
// --- <
// @sigtype java 3.5
// [i] object:1:required result
// [o] record:1:required R1
Object[] object = (Object[]) IDataUtil.get(pipeline.getCursor(), "result");
IData[] Result = new IData[object.length];
for (int i = 0; i < object.length; i++) {
com.wm.app.b2b.client.cache.config.SearchResult res = (com.wm.app.b2b.client.cache.config.SearchResult) object[i];
Result [i] = ( IData ) res.getValue();
}
pipeline.getCursor().insertBefore("Result", Result);
// --- <
}
}
Terracotta config
name="TawnApplicationLookup">
path=".\cacheStore\TawnApplicationLookup"/>
maxEntriesLocalHeap="0"/>
name="lowestPrice"
eternal="true"
maxEntriesLocalHeap="10"
maxEntriesInCache="300"
overflowToOffHeap="false"
cacheLoaderTimeoutMillis="30000">
strategy="distributed"/>
consistency="STRONG">
name="lowestPrice"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="product"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="coverCode"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="productDteilas"
eternal="true"
maxEntriesLocalHeap="20"
maxEntriesInCache="300"
overflowToOffHeap="false"
cacheLoaderTimeoutMillis="30000">
strategy="distributed"/>
consistency="STRONG">
keys="false"
values="false">
name="productNameArabic"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="productCode"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="descId"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="enDescription"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="productNameEnglish"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="arDescription"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="BankDetails"
eternal="true"
maxEntriesLocalHeap="100"
maxEntriesInCache="30000000"
overflowToOffHeap="false"
cacheLoaderTimeoutMillis="30000">
strategy="distributed"/>
consistency="STRONG">
timeoutMillis="30000000"/>
name="bankCode"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="bankDescEn"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="bankDescAr"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="fetchFromDB"
eternal="true"
maxEntriesLocalHeap="10"
maxEntriesInCache="30"
overflowToOffHeap="false"
cacheLoaderTimeoutMillis="30000">
strategy="distributed"/>
consistency="STRONG">
timeoutMillis="1000"/>
name="felixDesc"
eternal="true"
maxEntriesLocalHeap="10"
maxEntriesInCache="30000000"
overflowToOffHeap="false"
cacheLoaderTimeoutMillis="30000">
strategy="distributed"/>
consistency="STRONG">
timeoutMillis="3000000"/>
name="descID"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="descKey"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="langVersion"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="description"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="langID"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="edgeMakeDesc"
eternal="true"
maxEntriesLocalHeap="10"
maxEntriesInCache="30000000"
overflowToOffHeap="false"
cacheLoaderTimeoutMillis="30000">
strategy="distributed"/>
consistency="STRONG">
name="makeID"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="engMakeDesc"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="arbMakeDesc"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="currencyLookup"
eternal="true"
maxEntriesLocalHeap="100"
maxEntriesInCache="30000000"
overflowToOffHeap="false"
cacheLoaderTimeoutMillis="30000">
strategy="distributed"/>
consistency="STRONG">
timeoutMillis="3000000"/>
name="description"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="currencyId"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="langId"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="currencyCode"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="edgeModelDesc"
eternal="true"
maxEntriesLocalHeap="10"
maxEntriesInCache="30000000"
overflowToOffHeap="false"
cacheLoaderTimeoutMillis="30000">
strategy="distributed"/>
consistency="STRONG">
name="makeID"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="modelID"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="eModel"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="aModel"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="providerList"
eternal="true"
maxEntriesLocalHeap="100"
maxEntriesInCache="30000000"
overflowToOffHeap="false"
cacheLoaderTimeoutMillis="30000">
strategy="distributed"/>
consistency="STRONG">
timeoutMillis="3000000"/>
name="eName"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="providerID"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="aName"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="subType"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="type"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="locationCode"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="ebusLables"
eternal="true"
maxEntriesLocalHeap="10"
maxEntriesInCache="30000000"
overflowToOffHeap="false"
cacheLoaderTimeoutMillis="30000">
strategy="distributed"/>
consistency="STRONG">
name="arbDesc"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="engDesc"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
name="lableCode"
class="attributeExtractor.AttributeExtractorEntity"
properties=""/>
url="10.24.60.65:9510"
rejoin="true"/>
Subscribe to:
Posts (Atom)