public IdentityObjectAttribute getAttribute(IdentityStoreInvocationContext invocationContext, IdentityObject identity, String name) throws IdentityException { Map<String, IdentityObjectAttribute> results = cacheSupport.getIdentityObjectAttributes(getCacheNS(invocationContext), identity); if (results != null && results.containsKey(name)) { return results.get(name); } IdentityObjectAttribute result = attributeStore.getAttribute(invocationContext, identity, name); // Put fresh attributes in cache if (result != null) { cacheSupport.invalidateIdentityObjectAttriubtes(getCacheNS(invocationContext), identity); cacheSupport.putIdentityObjectAttributes(getCacheNS(invocationContext), identity, attributeStore.getAttributes(invocationContext, identity)); } return result; }
void invalidateCache() { if (getCache() != null) { getCache().invalidate(getNamespace()); } }
public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType) throws IdentityException { int count = cacheSupport.getIdentityObjectCount(getCacheNS(invocationCtx), identityType.getName()); if (count != -1) { return count; } count = identityStore.getIdentityObjectsCount(invocationCtx, identityType); cacheSupport.putIdentityObjectCount(getCacheNS(invocationCtx), identityType.getName(), count); return count; }
public Map<String, IdentityObjectAttribute> getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity) throws IdentityException { Map<String, IdentityObjectAttribute> results = cacheSupport.getIdentityObjectAttributes(getCacheNS(invocationContext), identity); if (results != null) { return results; } results = attributeStore.getAttributes(invocationContext, identity); cacheSupport.putIdentityObjectAttributes(getCacheNS(invocationContext), identity, results); return results; }
public void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, IdentityObjectAttribute[] attributes) throws IdentityException { attributeStore.updateAttributes(invocationCtx, identity, attributes); cacheSupport.invalidateIdentityObjectAttriubtes(getCacheNS(invocationCtx), identity); cacheSupport.putIdentityObjectAttributes(getCacheNS(invocationCtx), identity, attributeStore.getAttributes(invocationCtx, identity)); }
public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String id) throws IdentityException { IdentityObjectSearchImpl search = new IdentityObjectSearchImpl(); search.setId(id); Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearch(getCacheNS(invocationContext), search); if (results != null && results.size() == 1) { return results.iterator().next(); } IdentityObject io = identityStore.findIdentityObject(invocationContext, id); if (io != null) { Set<IdentityObject> temp = new HashSet<IdentityObject>(); temp.add(io); cacheSupport.putIdentityObjectSearch(getCacheNS(invocationContext), search, temp); } return io; }
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException { IdentityObjectRelationshipNameSearchImpl search = new IdentityObjectRelationshipNameSearchImpl(); search.setIdentityObjectSearchCriteria(criteria); Set<String> results = cacheSupport.getIdentityObjectRelationshipNameSearch(getCacheNS(ctx), search); if (results != null) { return results; } results = identityStore.getRelationshipNames(ctx, criteria); cacheSupport.putIdentityObjectRelationshipNameSearch(getCacheNS(ctx), search, results); return results; }
public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType) throws IdentityException { IdentityObjectRelationshipSearchImpl search = new IdentityObjectRelationshipSearchImpl(); if (fromIdentity != null) { search.setFromIOName(fromIdentity.getName()); search.setFromIOType(fromIdentity.getIdentityType().getName()); } if (toIdentity != null) { search.setToIOName(toIdentity.getName()); search.setToIOType(toIdentity.getIdentityType().getName()); } if (relationshipType != null) { search.setRelationshipType(relationshipType.getName()); } Set<IdentityObjectRelationship> results = cacheSupport.getIdentityObjectRelationshipSearch(getCacheNS(invocationCxt), search); if (results != null) { return results; } results = identityStore.resolveRelationships(invocationCxt, fromIdentity, toIdentity, relationshipType); cacheSupport.putIdentityObjectRelationshipSearch(getCacheNS(invocationCxt), search, results); return results; }
cacheSupport.initialize(cacheProps, configurationContext); cacheSupport.initialize(cacheProps, configurationContext);
new LDAPSearch(entryCtxs, filter, filterArgs, returningAttributes, searchScope, requestControls); Object results = getCache().getObject(getNamespace(), search.hashCode()); new LDAPSearch(entryCtxs, filter, filterArgs, returningAttributes, searchScope, requestControls); getCache().putObject(getNamespace(), search.hashCode(), finalResults);
protected String getCacheNS(IdentityStoreInvocationContext ctx) { if (cacheScope != null && cacheScope.equals("realm")) { return cacheSupport.getNamespace(attributeStore.getId(), ctx.getRealmId()); } if (cacheScope != null && cacheScope.equals("session")) { return cacheSupport.getNamespace(attributeStore.getId(), ctx.getRealmId(), ctx.getSessionId()); } return cacheSupport.getNamespace(attributeStore.getId()); }
getIdentityObjectAttributes(getNamespace(), identity); getCache().putIdentityObjectAttributes(getNamespace(), identity, attrsMap);
public void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, String[] attributeNames) throws IdentityException { attributeStore.removeAttributes(invocationCtx, identity, attributeNames); cacheSupport.invalidateIdentityObjectAttriubtes(getCacheNS(invocationCtx), identity); cacheSupport.putIdentityObjectAttributes(getCacheNS(invocationCtx), identity, attributeStore.getAttributes(invocationCtx, identity)); }
public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String name, IdentityObjectType identityObjectType) throws IdentityException { IdentityObjectSearchImpl search = new IdentityObjectSearchImpl(); search.setName(name); if (identityObjectType != null) { search.setType(identityObjectType.getName()); } Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearch(getCacheNS(invocationContext), search); if (results != null && results.size() == 1) { return results.iterator().next(); } IdentityObject io = identityStore.findIdentityObject(invocationContext, name, identityObjectType); if (io != null) { Set<IdentityObject> temp = new HashSet<IdentityObject>(); temp.add(io); cacheSupport.putIdentityObjectSearch(getCacheNS(invocationContext), search, temp); } return io; }
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException { IdentityObjectRelationshipNameSearchImpl search = new IdentityObjectRelationshipNameSearchImpl(); if (identity != null) { search.setIoName(identity.getName()); search.setIoType(identity.getIdentityType().getName()); } search.setIdentityObjectSearchCriteria(criteria); Set<String> results = cacheSupport.getIdentityObjectRelationshipNameSearch(getCacheNS(ctx), search); if (results != null) { return results; } results = identityStore.getRelationshipNames(ctx, identity, criteria); cacheSupport.putIdentityObjectRelationshipNameSearch(getCacheNS(ctx), search, results); return results; }
search.setIdentityObjectSearchCriteria(criteria); Set<IdentityObjectRelationship> results = cacheSupport.getIdentityObjectRelationshipSearch(getCacheNS(invocationCtx), search); identity, relationshipType, parent, named, name, criteria); cacheSupport.putIdentityObjectRelationshipSearch(getCacheNS(invocationCtx), search, results);
provider.initialize(cacheProps, configurationContext);
public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, IdentityObjectAttribute[] attributes) throws IdentityException { attributeStore.addAttributes(invocationCtx, identity, attributes); cacheSupport.invalidateIdentityObjectAttriubtes(getCacheNS(invocationCtx), identity); cacheSupport.putIdentityObjectAttributes(getCacheNS(invocationCtx), identity, attributeStore.getAttributes(invocationCtx, identity)); }
@Managed @ManagedDescription("Invalidate cache namespace") @Impact(ImpactType.WRITE) public void invalidate(@ManagedDescription("Cache namespace") @ManagedName("namespace") String namespace) { for (APICacheProvider cacheProvider : apiCacheProviders) { cacheProvider.invalidate(namespace); } for (IntegrationCache cacheProvider : integrationCache) { cacheProvider.invalidate(namespace); } for (IdentityStoreCacheProvider cacheProvider : storeCacheProviders) { cacheProvider.invalidate(namespace); } }
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, IdentityObjectRelationshipType relationshipType, Collection<IdentityObjectType> excludes, boolean parent, IdentityObjectSearchCriteria criteria) throws IdentityException { IdentityObjectSearchImpl search = new IdentityObjectSearchImpl(); search.setIdentityObjectSearchCriteria(criteria); search.setParent(parent); if (relationshipType != null) { search.setRelationshipType(relationshipType.getName()); } if (identity != null) { search.setName(identity.getName()); search.setType(identity.getIdentityType().getName()); } Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearch(getCacheNS(invocationCtx), search); if (results != null) { //TODO return results; } results = identityStore.findIdentityObject(invocationCtx, identity, relationshipType, parent, criteria); cacheSupport.putIdentityObjectSearch(getCacheNS(invocationCtx), search, results); return results; }