private void removeCompositeKeyFromParentCache(Element element) { goCache.removeAssociations((String) element.getKey(), element); }
public void putTicketInCache(final CasAuthenticationToken token) { final Element element = new Element(token.getCredentials().toString(), token); if (logger.isDebugEnabled()) { logger.debug("Cache put: " + element.getKey()); } cache.put(element); }
public void putUserInCache(UserDetails user) { Element element = new Element(user.getUsername(), user); if (logger.isDebugEnabled()) { logger.debug("Cache put: " + element.getKey()); } cache.put(element); }
public void putUserInCache(UserDetails user) { Element element = new Element(user.getUsername(), user); if (logger.isDebugEnabled()) { logger.debug("Cache put: " + element.getKey()); } cache.put(element); }
@Override public void notifyElementEvicted(Ehcache arg0, Element arg1) { removeCache(arg0.getName(), arg1.getKey()); }
@Override public void notifyElementExpired(Ehcache arg0, Element arg1) { removeCache(arg0.getName(), arg1.getKey()); }
@Override public void notifyElementRemoved(Ehcache arg0, Element arg1) throws CacheException { removeCache(arg0.getName(), arg1.getKey()); }
@Override public void notifyElementRemoved(Ehcache arg0, Element arg1) throws CacheException { removeCache(arg0.getName(), arg1.getKey()); }
@Override public void notifyElementEvicted(Ehcache arg0, Element arg1) { removeCache(arg0.getName(), arg1.getKey()); }
@Override public void notifyElementUpdated(Ehcache arg0, Element arg1) throws CacheException { removeCache(arg0.getName(), arg1.getKey()); }
@Override public void notifyElementUpdated(Ehcache arg0, Element arg1) throws CacheException { removeCache(arg0.getName(), arg1.getKey()); }
@Override public void notifyElementExpired(Ehcache arg0, Element arg1) { removeCache(arg0.getName(), arg1.getKey()); }
public void notifyElementEvicted(Ehcache arg0, Element arg1) { removeCache(arg0.getName(), arg1.getKey()); }
public void notifyElementRemoved(Ehcache arg0, Element arg1) throws CacheException { removeCache(arg0.getName(), arg1.getKey()); }
public void notifyElementUpdated(Ehcache arg0, Element arg1) throws CacheException { removeCache(arg0.getName(), arg1.getKey()); }
public void notifyElementExpired(Ehcache arg0, Element arg1) { removeCache(arg0.getName(), arg1.getKey()); }
@Test public void putInCache() throws Exception { myCache.putInCache(acl); verify(cache, times(2)).put(element.capture()); assertThat(element.getValue().getKey()).isEqualTo(acl.getId()); assertThat(element.getValue().getObjectValue()).isEqualTo(acl); assertThat(element.getAllValues().get(0).getKey()).isEqualTo( acl.getObjectIdentity()); assertThat(element.getAllValues().get(0).getObjectValue()).isEqualTo(acl); }
@Test public void putInCacheAclWithParent() throws Exception { Authentication auth = new TestingAuthenticationToken("user", "password", "ROLE_GENERAL"); auth.setAuthenticated(true); SecurityContextHolder.getContext().setAuthentication(auth); ObjectIdentity identityParent = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(2)); AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl( new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority( "ROLE_AUDITING"), new SimpleGrantedAuthority("ROLE_GENERAL")); MutableAcl parentAcl = new AclImpl(identityParent, Long.valueOf(2), aclAuthorizationStrategy, new ConsoleAuditLogger()); acl.setParent(parentAcl); myCache.putInCache(acl); verify(cache, times(4)).put(element.capture()); List<Element> allValues = element.getAllValues(); assertThat(allValues.get(0).getKey()).isEqualTo(parentAcl.getObjectIdentity()); assertThat(allValues.get(0).getObjectValue()).isEqualTo(parentAcl); assertThat(allValues.get(1).getKey()).isEqualTo(parentAcl.getId()); assertThat(allValues.get(1).getObjectValue()).isEqualTo(parentAcl); assertThat(allValues.get(2).getKey()).isEqualTo(acl.getObjectIdentity()); assertThat(allValues.get(2).getObjectValue()).isEqualTo(acl); assertThat(allValues.get(3).getKey()).isEqualTo(acl.getId()); assertThat(allValues.get(3).getObjectValue()).isEqualTo(acl); }
/** * {@inheritDoc} */ public void write(final Element element) { readLock.lock(); try { getQueue(element.getKey()).write(element); } finally { readLock.unlock(); } }
private boolean replaceEventual(Element old, Element element, ElementValueComparator comparator) { String pKey = generatePortableKeyFor(element.getKey()); ElementData oldValue = valueModeHandler.createElementData(old); ElementData value = valueModeHandler.createElementData(element); return backend.replace(pKey, oldValue, value, new ElementValueComparatorToolkitWrapper(old.getObjectKey(), comparator)); }