Search in sources :

Example 1 with CacheEntryEvaluator

use of com.adaptris.core.services.cache.CacheEntryEvaluator in project interlok by adaptris.

the class BasicCacheExampleGenerator method configureRetrieveService.

private static <T extends RetrieveFromCacheService> T configureRetrieveService(T service) {
    CacheEntryEvaluator eval1 = new CacheEntryEvaluator();
    CacheEntryEvaluator eval2 = new CacheEntryEvaluator();
    CacheEntryEvaluator eval3 = new CacheEntryEvaluator();
    eval1.setKeyTranslator(new MetadataCacheValueTranslator("A_MetadataKey_Whose_Value_Is_The_Cache_key"));
    eval1.setValueTranslator(new MetadataCacheValueTranslator("A_MetadataKey_Which_Will_Contain_What_We_Find_in_The_Cache"));
    eval2.setKeyTranslator(new MetadataCacheValueTranslator("MetadataKey_Whose_Value_Is_The_Cache_Key_And_This_Key_Contains_A_Payload"));
    eval2.setValueTranslator(new StringPayloadCacheTranslator());
    eval3.setKeyTranslator(new MetadataCacheValueTranslator("JMSCorrelationID"));
    eval3.setValueTranslator(new JmsReplyToCacheValueTranslator());
    service.setCacheEntryEvaluators(new ArrayList(Arrays.asList(new CacheEntryEvaluator[] { eval1, eval2, eval3 })));
    return service;
}
Also used : ObjectMetadataCacheValueTranslator(com.adaptris.core.services.cache.translators.ObjectMetadataCacheValueTranslator) MetadataCacheValueTranslator(com.adaptris.core.services.cache.translators.MetadataCacheValueTranslator) JmsReplyToCacheValueTranslator(com.adaptris.core.services.cache.translators.JmsReplyToCacheValueTranslator) ArrayList(java.util.ArrayList) CacheEntryEvaluator(com.adaptris.core.services.cache.CacheEntryEvaluator) StringPayloadCacheTranslator(com.adaptris.core.services.cache.translators.StringPayloadCacheTranslator)

Example 2 with CacheEntryEvaluator

use of com.adaptris.core.services.cache.CacheEntryEvaluator in project interlok by adaptris.

the class BasicCacheExampleGenerator method configureCheckCache.

private static <T extends CheckCacheService> T configureCheckCache(T cacheService) {
    CacheEntryEvaluator eval1 = new CacheEntryEvaluator();
    CacheEntryEvaluator eval2 = new CacheEntryEvaluator();
    eval1.setKeyTranslator(new MetadataCacheValueTranslator("A_MetadataKey_Whose_Value_Makes_The_Cache_Key"));
    eval2.setKeyTranslator(new MetadataCacheValueTranslator("Another_MetadataKey_Whose_Value_Makes_The_Cache_Key"));
    cacheService.setCacheEntryEvaluators(new ArrayList(Arrays.asList(new CacheEntryEvaluator[] { eval1, eval2 })));
    cacheService.setKeysFoundServiceId("AllKeysFoundInCache");
    cacheService.setKeysNotFoundServiceId("Not_All_Keys_In_Cache");
    cacheService.setUniqueId("checkCache");
    return cacheService;
}
Also used : ObjectMetadataCacheValueTranslator(com.adaptris.core.services.cache.translators.ObjectMetadataCacheValueTranslator) MetadataCacheValueTranslator(com.adaptris.core.services.cache.translators.MetadataCacheValueTranslator) ArrayList(java.util.ArrayList) CacheEntryEvaluator(com.adaptris.core.services.cache.CacheEntryEvaluator)

Example 3 with CacheEntryEvaluator

use of com.adaptris.core.services.cache.CacheEntryEvaluator in project interlok by adaptris.

the class BasicCacheExampleGenerator method createAddToCacheService.

public static AddToCacheService createAddToCacheService() {
    AddToCacheService service = new AddToCacheService();
    CacheEntryEvaluator eval1 = new CacheEntryEvaluator();
    CacheEntryEvaluator eval2 = new CacheEntryEvaluator();
    CacheEntryEvaluator eval3 = new CacheEntryEvaluator();
    CacheEntryEvaluator eval4 = new CacheEntryEvaluator();
    CacheEntryEvaluator eval5 = new CacheEntryEvaluator();
    eval1.setKeyTranslator(new MetadataCacheValueTranslator("A_MetadataKey_Whose_Value_Makes_The_Cache_Key"));
    eval1.setValueTranslator(new MetadataCacheValueTranslator("Another_MetadataKey_Whose_Value_Makes_The_Cache_CacheValue"));
    eval2.setKeyTranslator(new MetadataCacheValueTranslator("A_MetadataKey_Whose_Value_Makes_The_Cache_Key"));
    eval2.setValueTranslator(new StringPayloadCacheTranslator());
    eval3.setKeyTranslator(new MetadataCacheValueTranslator("A_MetadataKey_Whose_Value_Makes_The_Cache_Key"));
    eval3.setValueTranslator(new XpathCacheValueTranslator("/some/xpath/value"));
    eval4.setKeyTranslator(new MetadataCacheValueTranslator("JMSCorrelationID"));
    eval4.setValueTranslator(new JmsReplyToCacheValueTranslator());
    eval5.setKeyTranslator(new MetadataCacheValueTranslator("A_MetadataKey_Whose_Value_Makes_The_Cache_Key"));
    eval5.setValueTranslator(new ObjectMetadataCacheValueTranslator(JmsConstants.OBJ_JMS_REPLY_TO_KEY));
    service.setCacheEntryEvaluators(new ArrayList(Arrays.asList(new CacheEntryEvaluator[] { eval1, eval2, eval3, eval4, eval5 })));
    return service;
}
Also used : ObjectMetadataCacheValueTranslator(com.adaptris.core.services.cache.translators.ObjectMetadataCacheValueTranslator) MetadataCacheValueTranslator(com.adaptris.core.services.cache.translators.MetadataCacheValueTranslator) XpathCacheValueTranslator(com.adaptris.core.services.cache.translators.XpathCacheValueTranslator) JmsReplyToCacheValueTranslator(com.adaptris.core.services.cache.translators.JmsReplyToCacheValueTranslator) ArrayList(java.util.ArrayList) CacheEntryEvaluator(com.adaptris.core.services.cache.CacheEntryEvaluator) StringPayloadCacheTranslator(com.adaptris.core.services.cache.translators.StringPayloadCacheTranslator) AddToCacheService(com.adaptris.core.services.cache.AddToCacheService) ObjectMetadataCacheValueTranslator(com.adaptris.core.services.cache.translators.ObjectMetadataCacheValueTranslator)

Aggregations

CacheEntryEvaluator (com.adaptris.core.services.cache.CacheEntryEvaluator)3 MetadataCacheValueTranslator (com.adaptris.core.services.cache.translators.MetadataCacheValueTranslator)3 ObjectMetadataCacheValueTranslator (com.adaptris.core.services.cache.translators.ObjectMetadataCacheValueTranslator)3 ArrayList (java.util.ArrayList)3 JmsReplyToCacheValueTranslator (com.adaptris.core.services.cache.translators.JmsReplyToCacheValueTranslator)2 StringPayloadCacheTranslator (com.adaptris.core.services.cache.translators.StringPayloadCacheTranslator)2 AddToCacheService (com.adaptris.core.services.cache.AddToCacheService)1 XpathCacheValueTranslator (com.adaptris.core.services.cache.translators.XpathCacheValueTranslator)1