diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/ClientAdapter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/ClientAdapter.java index cdaa2e7537..e636f5a9bb 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/ClientAdapter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/ClientAdapter.java @@ -19,8 +19,7 @@ package org.keycloak.models.cache.infinispan; import org.keycloak.models.*; import org.keycloak.models.cache.CacheRealmProvider; -import org.keycloak.models.cache.RealmCache; -import org.keycloak.models.cache.entities.CachedClient; +import org.keycloak.models.cache.infinispan.entities.CachedClient; import java.util.*; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/ClientTemplateAdapter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/ClientTemplateAdapter.java index ce4095e9e2..b54738ad9f 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/ClientTemplateAdapter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/ClientTemplateAdapter.java @@ -24,8 +24,7 @@ import org.keycloak.models.RealmModel; import org.keycloak.models.RoleContainerModel; import org.keycloak.models.RoleModel; import org.keycloak.models.cache.CacheRealmProvider; -import org.keycloak.models.cache.RealmCache; -import org.keycloak.models.cache.entities.CachedClientTemplate; +import org.keycloak.models.cache.infinispan.entities.CachedClientTemplate; import java.util.HashMap; import java.util.HashSet; @@ -39,14 +38,12 @@ import java.util.Set; public class ClientTemplateAdapter implements ClientTemplateModel { protected CacheRealmProvider cacheSession; protected RealmModel cachedRealm; - protected RealmCache cache; protected ClientTemplateModel updated; protected CachedClientTemplate cached; - public ClientTemplateAdapter(RealmModel cachedRealm, CachedClientTemplate cached, CacheRealmProvider cacheSession, RealmCache cache) { + public ClientTemplateAdapter(RealmModel cachedRealm, CachedClientTemplate cached, CacheRealmProvider cacheSession) { this.cachedRealm = cachedRealm; - this.cache = cache; this.cacheSession = cacheSession; this.cached = cached; } diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/DefaultCacheUserProvider.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/DefaultCacheUserProvider.java index 3726edbaec..e8f74bc9b8 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/DefaultCacheUserProvider.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/DefaultCacheUserProvider.java @@ -19,8 +19,7 @@ package org.keycloak.models.cache.infinispan; import org.keycloak.models.*; import org.keycloak.models.cache.CacheUserProvider; -import org.keycloak.models.cache.UserCache; -import org.keycloak.models.cache.entities.CachedUser; +import org.keycloak.models.cache.infinispan.entities.CachedUser; import java.util.*; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/GroupAdapter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/GroupAdapter.java index af704ecd7d..1810a34990 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/GroupAdapter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/GroupAdapter.java @@ -24,7 +24,7 @@ import org.keycloak.models.RealmModel; import org.keycloak.models.RoleContainerModel; import org.keycloak.models.RoleModel; import org.keycloak.models.cache.CacheRealmProvider; -import org.keycloak.models.cache.entities.CachedGroup; +import org.keycloak.models.cache.infinispan.entities.CachedGroup; import java.util.HashSet; import java.util.List; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanCacheRealmProviderFactory.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanCacheRealmProviderFactory.java index 39bc4938e4..fb9946b28e 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanCacheRealmProviderFactory.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanCacheRealmProviderFactory.java @@ -18,15 +18,6 @@ package org.keycloak.models.cache.infinispan; import org.infinispan.Cache; -import org.infinispan.notifications.Listener; -import org.infinispan.notifications.cachelistener.annotation.CacheEntriesEvicted; -import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated; -import org.infinispan.notifications.cachelistener.annotation.CacheEntryInvalidated; -import org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved; -import org.infinispan.notifications.cachelistener.event.CacheEntriesEvictedEvent; -import org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent; -import org.infinispan.notifications.cachelistener.event.CacheEntryInvalidatedEvent; -import org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent; import org.jboss.logging.Logger; import org.keycloak.Config; import org.keycloak.connections.infinispan.InfinispanConnectionProvider; @@ -34,12 +25,7 @@ import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSessionFactory; import org.keycloak.models.cache.CacheRealmProvider; import org.keycloak.models.cache.CacheRealmProviderFactory; -import org.keycloak.models.cache.entities.CachedClient; -import org.keycloak.models.cache.entities.CachedRealm; -import org.keycloak.models.cache.infinispan.stream.StreamCacheRealmProvider; -import org.keycloak.models.cache.infinispan.stream.StreamRealmCache; - -import java.util.concurrent.ConcurrentHashMap; +import org.keycloak.models.cache.infinispan.entities.Revisioned; /** * @author Bill Burke @@ -61,7 +47,7 @@ public class InfinispanCacheRealmProviderFactory implements CacheRealmProviderFa if (realmCache == null) { synchronized (this) { if (realmCache == null) { - Cache cache = session.getProvider(InfinispanConnectionProvider.class).getCache(InfinispanConnectionProvider.REALM_CACHE_NAME); + Cache cache = session.getProvider(InfinispanConnectionProvider.class).getCache(InfinispanConnectionProvider.REALM_CACHE_NAME); Cache revisions = session.getProvider(InfinispanConnectionProvider.class).getCache(InfinispanConnectionProvider.VERSION_CACHE_NAME); realmCache = new StreamRealmCache(cache, revisions); } diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanCacheUserProviderFactory.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanCacheUserProviderFactory.java index b473d60e9f..e8657ff579 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanCacheUserProviderFactory.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanCacheUserProviderFactory.java @@ -28,7 +28,7 @@ import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSessionFactory; import org.keycloak.models.cache.CacheUserProvider; import org.keycloak.models.cache.CacheUserProviderFactory; -import org.keycloak.models.cache.entities.CachedUser; +import org.keycloak.models.cache.infinispan.entities.CachedUser; import java.util.concurrent.ConcurrentHashMap; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanUserCache.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanUserCache.java index de83e6ac71..bb7196e779 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanUserCache.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/InfinispanUserCache.java @@ -19,8 +19,7 @@ package org.keycloak.models.cache.infinispan; import org.infinispan.Cache; import org.jboss.logging.Logger; -import org.keycloak.models.cache.UserCache; -import org.keycloak.models.cache.entities.CachedUser; +import org.keycloak.models.cache.infinispan.entities.CachedUser; /** * @author Stian Thorgersen diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmAdapter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmAdapter.java index 39564ef434..bc39f320d0 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmAdapter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmAdapter.java @@ -21,8 +21,7 @@ import org.keycloak.Config; import org.keycloak.common.enums.SslRequired; import org.keycloak.models.*; import org.keycloak.models.cache.CacheRealmProvider; -import org.keycloak.models.cache.RealmCache; -import org.keycloak.models.cache.entities.CachedRealm; +import org.keycloak.models.cache.infinispan.entities.CachedRealm; import org.keycloak.models.utils.KeycloakModelUtils; import java.security.Key; diff --git a/server-spi/src/main/java/org/keycloak/models/cache/RealmCache.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmCache.java similarity index 82% rename from server-spi/src/main/java/org/keycloak/models/cache/RealmCache.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmCache.java index 2b7b339daf..d683bb015b 100755 --- a/server-spi/src/main/java/org/keycloak/models/cache/RealmCache.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmCache.java @@ -15,13 +15,13 @@ * limitations under the License. */ -package org.keycloak.models.cache; +package org.keycloak.models.cache.infinispan; -import org.keycloak.models.cache.entities.CachedClient; -import org.keycloak.models.cache.entities.CachedClientTemplate; -import org.keycloak.models.cache.entities.CachedGroup; -import org.keycloak.models.cache.entities.CachedRealm; -import org.keycloak.models.cache.entities.CachedRole; +import org.keycloak.models.cache.infinispan.entities.CachedClient; +import org.keycloak.models.cache.infinispan.entities.CachedClientTemplate; +import org.keycloak.models.cache.infinispan.entities.CachedGroup; +import org.keycloak.models.cache.infinispan.entities.CachedRealm; +import org.keycloak.models.cache.infinispan.entities.CachedRole; /** * @author Bill Burke diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RoleAdapter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RoleAdapter.java index c7ebc44cfb..0b0c3a6cfe 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RoleAdapter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RoleAdapter.java @@ -21,10 +21,9 @@ import org.keycloak.models.RealmModel; import org.keycloak.models.RoleContainerModel; import org.keycloak.models.RoleModel; import org.keycloak.models.cache.CacheRealmProvider; -import org.keycloak.models.cache.RealmCache; -import org.keycloak.models.cache.entities.CachedClientRole; -import org.keycloak.models.cache.entities.CachedRealmRole; -import org.keycloak.models.cache.entities.CachedRole; +import org.keycloak.models.cache.infinispan.entities.CachedClientRole; +import org.keycloak.models.cache.infinispan.entities.CachedRealmRole; +import org.keycloak.models.cache.infinispan.entities.CachedRole; import org.keycloak.models.utils.KeycloakModelUtils; import java.util.HashSet; @@ -38,13 +37,11 @@ public class RoleAdapter implements RoleModel { protected RoleModel updated; protected CachedRole cached; - protected RealmCache cache; protected CacheRealmProvider cacheSession; protected RealmModel realm; - public RoleAdapter(CachedRole cached, RealmCache cache, CacheRealmProvider session, RealmModel realm) { + public RoleAdapter(CachedRole cached, CacheRealmProvider session, RealmModel realm) { this.cached = cached; - this.cache = cache; this.cacheSession = session; this.realm = realm; } diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/StreamCacheRealmProvider.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/StreamCacheRealmProvider.java similarity index 90% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/StreamCacheRealmProvider.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/StreamCacheRealmProvider.java index d68f50c125..d21599c196 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/StreamCacheRealmProvider.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/StreamCacheRealmProvider.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.keycloak.models.cache.infinispan.stream; +package org.keycloak.models.cache.infinispan; import org.jboss.logging.Logger; import org.keycloak.migration.MigrationModel; @@ -28,19 +28,16 @@ import org.keycloak.models.RealmModel; import org.keycloak.models.RealmProvider; import org.keycloak.models.RoleModel; import org.keycloak.models.cache.CacheRealmProvider; -import org.keycloak.models.cache.entities.CachedRole; -import org.keycloak.models.cache.infinispan.ClientAdapter; -import org.keycloak.models.cache.infinispan.ClientTemplateAdapter; -import org.keycloak.models.cache.infinispan.GroupAdapter; -import org.keycloak.models.cache.infinispan.RealmAdapter; -import org.keycloak.models.cache.infinispan.RoleAdapter; -import org.keycloak.models.cache.infinispan.stream.entities.Revisioned; -import org.keycloak.models.cache.infinispan.stream.entities.RevisionedCachedClient; -import org.keycloak.models.cache.infinispan.stream.entities.RevisionedCachedClientRole; -import org.keycloak.models.cache.infinispan.stream.entities.RevisionedCachedClientTemplate; -import org.keycloak.models.cache.infinispan.stream.entities.RevisionedCachedGroup; -import org.keycloak.models.cache.infinispan.stream.entities.RevisionedCachedRealm; -import org.keycloak.models.cache.infinispan.stream.entities.RevisionedCachedRealmRole; +import org.keycloak.models.cache.infinispan.entities.CachedClient; +import org.keycloak.models.cache.infinispan.entities.CachedClientRole; +import org.keycloak.models.cache.infinispan.entities.CachedClientTemplate; +import org.keycloak.models.cache.infinispan.entities.CachedGroup; +import org.keycloak.models.cache.infinispan.entities.CachedRealm; +import org.keycloak.models.cache.infinispan.entities.CachedRealmRole; +import org.keycloak.models.cache.infinispan.entities.CachedRole; +import org.keycloak.models.cache.infinispan.entities.ClientListQuery; +import org.keycloak.models.cache.infinispan.entities.RealmListQuery; +import org.keycloak.models.cache.infinispan.entities.Revisioned; import java.util.Collections; import java.util.HashMap; @@ -249,7 +246,7 @@ public class StreamCacheRealmProvider implements CacheRealmProvider { @Override public RealmModel getRealm(String id) { - RevisionedCachedRealm cached = cache.get(id, RevisionedCachedRealm.class); + CachedRealm cached = cache.get(id, CachedRealm.class); if (cached != null) { logger.tracev("by id cache hit: {0}", cached.getName()); } @@ -258,7 +255,7 @@ public class StreamCacheRealmProvider implements CacheRealmProvider { RealmModel model = getDelegate().getRealm(id); if (model == null) return null; if (invalidations.contains(id)) return model; - cached = new RevisionedCachedRealm(loaded, null, this, model); + cached = new CachedRealm(loaded, model); cache.addRevisioned(cached); } else if (invalidations.contains(id)) { return getDelegate().getRealm(id); @@ -415,25 +412,25 @@ public class StreamCacheRealmProvider implements CacheRealmProvider { if (model == null) return null; if (invalidations.contains(id)) return model; if (model.getContainer() instanceof ClientModel) { - cached = new RevisionedCachedClientRole(loaded, ((ClientModel) model.getContainer()).getId(), model, realm); + cached = new CachedClientRole(loaded, ((ClientModel) model.getContainer()).getId(), model, realm); } else { - cached = new RevisionedCachedRealmRole(loaded, model, realm); + cached = new CachedRealmRole(loaded, model, realm); } - cache.addRevisioned((Revisioned)cached); + cache.addRevisioned(cached); } else if (invalidations.contains(id)) { return getDelegate().getRoleById(id, realm); } else if (managedRoles.containsKey(id)) { return managedRoles.get(id); } - RoleAdapter adapter = new RoleAdapter(cached, null, this, realm); + RoleAdapter adapter = new RoleAdapter(cached,this, realm); managedRoles.put(id, adapter); return adapter; } @Override public GroupModel getGroupById(String id, RealmModel realm) { - RevisionedCachedGroup cached = cache.get(id, RevisionedCachedGroup.class); + CachedGroup cached = cache.get(id, CachedGroup.class); if (cached != null && !cached.getRealm().equals(realm.getId())) { cached = null; } @@ -443,7 +440,7 @@ public class StreamCacheRealmProvider implements CacheRealmProvider { GroupModel model = getDelegate().getGroupById(id, realm); if (model == null) return null; if (invalidations.contains(id)) return model; - cached = new RevisionedCachedGroup(loaded, realm, model); + cached = new CachedGroup(loaded, realm, model); cache.addRevisioned(cached); } else if (invalidations.contains(id)) { @@ -458,7 +455,7 @@ public class StreamCacheRealmProvider implements CacheRealmProvider { @Override public ClientModel getClientById(String id, RealmModel realm) { - RevisionedCachedClient cached = cache.get(id, RevisionedCachedClient.class); + CachedClient cached = cache.get(id, CachedClient.class); if (cached != null && !cached.getRealm().equals(realm.getId())) { cached = null; } @@ -471,7 +468,7 @@ public class StreamCacheRealmProvider implements CacheRealmProvider { ClientModel model = getDelegate().getClientById(id, realm); if (model == null) return null; if (invalidations.contains(id)) return model; - cached = new RevisionedCachedClient(loaded, null, getDelegate(), realm, model); + cached = new CachedClient(loaded, realm, model); logger.tracev("adding client by id cache miss: {0}", cached.getClientId()); cache.addRevisioned(cached); } else if (invalidations.contains(id)) { @@ -516,7 +513,7 @@ public class StreamCacheRealmProvider implements CacheRealmProvider { @Override public ClientTemplateModel getClientTemplateById(String id, RealmModel realm) { - RevisionedCachedClientTemplate cached = cache.get(id, RevisionedCachedClientTemplate.class); + CachedClientTemplate cached = cache.get(id, CachedClientTemplate.class); if (cached != null && !cached.getRealm().equals(realm.getId())) { cached = null; } @@ -526,14 +523,14 @@ public class StreamCacheRealmProvider implements CacheRealmProvider { ClientTemplateModel model = getDelegate().getClientTemplateById(id, realm); if (model == null) return null; if (invalidations.contains(id)) return model; - cached = new RevisionedCachedClientTemplate(loaded, null, getDelegate(), realm, model); + cached = new CachedClientTemplate(loaded, realm, model); cache.addRevisioned(cached); } else if (invalidations.contains(id)) { return getDelegate().getClientTemplateById(id, realm); } else if (managedClientTemplates.containsKey(id)) { return managedClientTemplates.get(id); } - ClientTemplateModel adapter = new ClientTemplateAdapter(realm, cached, this, null); + ClientTemplateModel adapter = new ClientTemplateAdapter(realm, cached, this); managedClientTemplates.put(id, adapter); return adapter; } diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/StreamRealmCache.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/StreamRealmCache.java similarity index 75% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/StreamRealmCache.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/StreamRealmCache.java index 9dd821bdff..da292a1d56 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/StreamRealmCache.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/StreamRealmCache.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.keycloak.models.cache.infinispan.stream; +package org.keycloak.models.cache.infinispan; import org.infinispan.Cache; import org.infinispan.notifications.Listener; @@ -24,12 +24,19 @@ import org.infinispan.notifications.cachelistener.annotation.CacheEntryInvalidat import org.infinispan.notifications.cachelistener.event.CacheEntriesEvictedEvent; import org.infinispan.notifications.cachelistener.event.CacheEntryInvalidatedEvent; import org.jboss.logging.Logger; -import org.keycloak.models.cache.entities.CachedClient; -import org.keycloak.models.cache.entities.CachedClientTemplate; -import org.keycloak.models.cache.entities.CachedGroup; -import org.keycloak.models.cache.entities.CachedRealm; -import org.keycloak.models.cache.entities.CachedRole; -import org.keycloak.models.cache.infinispan.stream.entities.Revisioned; +import org.keycloak.models.cache.infinispan.entities.CachedClient; +import org.keycloak.models.cache.infinispan.entities.CachedClientTemplate; +import org.keycloak.models.cache.infinispan.entities.CachedGroup; +import org.keycloak.models.cache.infinispan.entities.CachedRealm; +import org.keycloak.models.cache.infinispan.entities.CachedRole; +import org.keycloak.models.cache.infinispan.entities.Revisioned; +import org.keycloak.models.cache.infinispan.stream.ClientQueryPredicate; +import org.keycloak.models.cache.infinispan.stream.ClientTemplateQueryPredicate; +import org.keycloak.models.cache.infinispan.stream.GroupQueryPredicate; +import org.keycloak.models.cache.infinispan.stream.HasRolePredicate; +import org.keycloak.models.cache.infinispan.stream.InClientPredicate; +import org.keycloak.models.cache.infinispan.stream.InRealmPredicate; +import org.keycloak.models.cache.infinispan.stream.RealmQueryPredicate; import java.util.HashSet; import java.util.Iterator; @@ -46,15 +53,15 @@ public class StreamRealmCache { protected static final Logger logger = Logger.getLogger(StreamRealmCache.class); protected final Cache revisions; - protected final Cache cache; + protected final Cache cache; - public StreamRealmCache(Cache cache, Cache revisions) { + public StreamRealmCache(Cache cache, Cache revisions) { this.cache = cache; this.cache.addListener(this); this.revisions = revisions; } - public Cache getCache() { + public Cache getCache() { return cache; } @@ -144,11 +151,11 @@ public class StreamRealmCache { } public void realmInvalidation(String id, Set invalidations) { - Predicate> predicate = getRealmInvalidationPredicate(id); + Predicate> predicate = getRealmInvalidationPredicate(id); addInvalidations(predicate, invalidations); } - public Predicate> getRealmInvalidationPredicate(String id) { + public Predicate> getRealmInvalidationPredicate(String id) { return RealmQueryPredicate.create().realm(id); } @@ -156,7 +163,7 @@ public class StreamRealmCache { addInvalidations(getClientInvalidationPredicate(id), invalidations); } - public Predicate> getClientInvalidationPredicate(String id) { + public Predicate> getClientInvalidationPredicate(String id) { return ClientQueryPredicate.create().client(id); } @@ -165,7 +172,7 @@ public class StreamRealmCache { } - public Predicate> getRoleInvalidationPredicate(String id) { + public Predicate> getRoleInvalidationPredicate(String id) { return HasRolePredicate.create().role(id); } @@ -174,7 +181,7 @@ public class StreamRealmCache { } - public Predicate> getGroupInvalidationPredicate(String id) { + public Predicate> getGroupInvalidationPredicate(String id) { return GroupQueryPredicate.create().group(id); } @@ -183,17 +190,17 @@ public class StreamRealmCache { } - public Predicate> getClientTemplateInvalidationPredicate(String id) { + public Predicate> getClientTemplateInvalidationPredicate(String id) { return ClientTemplateQueryPredicate.create().template(id); } public void realmRemoval(String id, Set invalidations) { - Predicate> predicate = getRealmRemovalPredicate(id); + Predicate> predicate = getRealmRemovalPredicate(id); addInvalidations(predicate, invalidations); } - public Predicate> getRealmRemovalPredicate(String id) { - Predicate> predicate = null; + public Predicate> getRealmRemovalPredicate(String id) { + Predicate> predicate = null; predicate = RealmQueryPredicate.create().realm(id) .or(InRealmPredicate.create().realm(id)); return predicate; @@ -203,18 +210,18 @@ public class StreamRealmCache { addInvalidations(getClientAddedPredicate(realmId), invalidations); } - public Predicate> getClientAddedPredicate(String realmId) { + public Predicate> getClientAddedPredicate(String realmId) { return ClientQueryPredicate.create().inRealm(realmId); } public void clientRemoval(String realmId, String id, Set invalidations) { - Predicate> predicate = null; + Predicate> predicate = null; predicate = getClientRemovalPredicate(realmId, id); addInvalidations(predicate, invalidations); } - public Predicate> getClientRemovalPredicate(String realmId, String id) { - Predicate> predicate; + public Predicate> getClientRemovalPredicate(String realmId, String id) { + Predicate> predicate; predicate = ClientQueryPredicate.create().inRealm(realmId) .or(ClientQueryPredicate.create().client(id)) .or(InClientPredicate.create().client(id)); @@ -226,18 +233,18 @@ public class StreamRealmCache { } - public Predicate> getRoleRemovalPredicate(String id) { + public Predicate> getRoleRemovalPredicate(String id) { return getRoleInvalidationPredicate(id); } - public void addInvalidations(Predicate> predicate, Set invalidations) { - Iterator> it = getEntryIterator(predicate); + public void addInvalidations(Predicate> predicate, Set invalidations) { + Iterator> it = getEntryIterator(predicate); while (it.hasNext()) { invalidations.add(it.next().getKey()); } } - private Iterator> getEntryIterator(Predicate> predicate) { + private Iterator> getEntryIterator(Predicate> predicate) { return cache .entrySet() .stream() @@ -249,7 +256,7 @@ public class StreamRealmCache { if (event.isPre()) { Object object = event.getValue(); if (object != null) { - Predicate> predicate = getInvalidationPredicate(object); + Predicate> predicate = getInvalidationPredicate(object); if (predicate != null) runEvictions(predicate); } } @@ -258,18 +265,18 @@ public class StreamRealmCache { @CacheEntriesEvicted public void cacheEvicted(CacheEntriesEvictedEvent event) { for (Object object : event.getEntries().values()) { - Predicate> predicate = getEvictionPredicate(object); + Predicate> predicate = getEvictionPredicate(object); if (predicate != null) runEvictions(predicate); } } - public void runEvictions(Predicate> current) { + public void runEvictions(Predicate> current) { Set evictions = new HashSet<>(); addInvalidations(current, evictions); for (String key : evictions) cache.evict(key); } - protected Predicate> getEvictionPredicate(Object object) { + protected Predicate> getEvictionPredicate(Object object) { if (object instanceof CachedRealm) { CachedRealm cached = (CachedRealm)object; return getRealmInvalidationPredicate(cached.getId()); @@ -288,13 +295,13 @@ public class StreamRealmCache { } return null; } - protected Predicate> getInvalidationPredicate(Object object) { + protected Predicate> getInvalidationPredicate(Object object) { if (object instanceof CachedRealm) { CachedRealm cached = (CachedRealm)object; return getRealmRemovalPredicate(cached.getId()); } else if (object instanceof CachedClient) { CachedClient cached = (CachedClient)object; - Predicate> predicate = getClientRemovalPredicate(cached.getRealm(), cached.getId()); + Predicate> predicate = getClientRemovalPredicate(cached.getRealm(), cached.getId()); for (String roleId : cached.getRoles().values()) { predicate.or(getRoleRemovalPredicate(roleId)); } diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/UpdateCounter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UpdateCounter.java similarity index 87% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/UpdateCounter.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UpdateCounter.java index ea086415c9..0c83dc8286 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/UpdateCounter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UpdateCounter.java @@ -1,4 +1,4 @@ -package org.keycloak.models.cache.infinispan.stream; +package org.keycloak.models.cache.infinispan; import java.util.concurrent.atomic.AtomicLong; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java index b8945bd55d..6421ca2fb5 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java @@ -19,7 +19,7 @@ package org.keycloak.models.cache.infinispan; import org.keycloak.models.*; import org.keycloak.models.cache.CacheUserProvider; -import org.keycloak.models.cache.entities.CachedUser; +import org.keycloak.models.cache.infinispan.entities.CachedUser; import org.keycloak.models.utils.KeycloakModelUtils; import java.util.*; diff --git a/server-spi/src/main/java/org/keycloak/models/cache/UserCache.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserCache.java similarity index 91% rename from server-spi/src/main/java/org/keycloak/models/cache/UserCache.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserCache.java index f64c722091..2df2da63e5 100755 --- a/server-spi/src/main/java/org/keycloak/models/cache/UserCache.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserCache.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.keycloak.models.cache; +package org.keycloak.models.cache.infinispan; -import org.keycloak.models.cache.entities.CachedUser; +import org.keycloak.models.cache.infinispan.entities.CachedUser; /** * @author Bill Burke diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/AbstractRevisioned.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/AbstractRevisioned.java similarity index 77% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/AbstractRevisioned.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/AbstractRevisioned.java index dfea429fe9..89166202c5 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/AbstractRevisioned.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/AbstractRevisioned.java @@ -1,10 +1,12 @@ -package org.keycloak.models.cache.infinispan.stream.entities; +package org.keycloak.models.cache.infinispan.entities; + +import java.io.Serializable; /** * @author Bill Burke * @version $Revision: 1 $ */ -public class AbstractRevisioned implements Revisioned { +public class AbstractRevisioned implements Revisioned, Serializable { private String id; private Long revision; diff --git a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedClient.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedClient.java similarity index 92% rename from server-spi/src/main/java/org/keycloak/models/cache/entities/CachedClient.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedClient.java index 727cabcd66..c528c8c0d2 100755 --- a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedClient.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedClient.java @@ -15,14 +15,14 @@ * limitations under the License. */ -package org.keycloak.models.cache.entities; +package org.keycloak.models.cache.infinispan.entities; import org.keycloak.models.ClientModel; import org.keycloak.models.ProtocolMapperModel; import org.keycloak.models.RealmModel; import org.keycloak.models.RealmProvider; import org.keycloak.models.RoleModel; -import org.keycloak.models.cache.RealmCache; +import org.keycloak.models.cache.infinispan.RealmCache; import java.io.Serializable; import java.util.HashMap; @@ -37,9 +37,7 @@ import java.util.TreeMap; * @author Bill Burke * @version $Revision: 1 $ */ -public class CachedClient implements Serializable { - - protected String id; +public class CachedClient extends AbstractRevisioned implements InRealm { protected String clientId; protected String name; protected String description; @@ -77,8 +75,8 @@ public class CachedClient implements Serializable { protected boolean useTemplateConfig; protected boolean useTemplateMappers; - public CachedClient(RealmCache cache, RealmProvider delegate, RealmModel realm, ClientModel model) { - id = model.getId(); + public CachedClient(Long revision, RealmModel realm, ClientModel model) { + super(revision, model.getId()); clientAuthenticatorType = model.getClientAuthenticatorType(); secret = model.getSecret(); registrationToken = model.getRegistrationToken(); @@ -112,10 +110,10 @@ public class CachedClient implements Serializable { implicitFlowEnabled = model.isImplicitFlowEnabled(); directAccessGrantsEnabled = model.isDirectAccessGrantsEnabled(); serviceAccountsEnabled = model.isServiceAccountsEnabled(); - cacheRoles(cache, realm, model); + cacheRoles(model); nodeReRegistrationTimeout = model.getNodeReRegistrationTimeout(); - registeredNodes = new TreeMap(model.getRegisteredNodes()); + registeredNodes = new TreeMap<>(model.getRegisteredNodes()); if (model.getClientTemplate() != null) { clientTemplate = model.getClientTemplate().getId(); } @@ -124,17 +122,12 @@ public class CachedClient implements Serializable { useTemplateScope = model.useTemplateScope(); } - protected void cacheRoles(RealmCache cache, RealmModel realm, ClientModel model) { + protected void cacheRoles(ClientModel model) { for (RoleModel role : model.getRoles()) { roles.put(role.getName(), role.getId()); - cache.addRole(new CachedClientRole(id, role, realm)); } } - public String getId() { - return id; - } - public String getClientId() { return clientId; } diff --git a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedClientRole.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedClientRole.java similarity index 79% rename from server-spi/src/main/java/org/keycloak/models/cache/entities/CachedClientRole.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedClientRole.java index 3cbfa304e0..1b35672c49 100755 --- a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedClientRole.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedClientRole.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.keycloak.models.cache.entities; +package org.keycloak.models.cache.infinispan.entities; import org.keycloak.models.RealmModel; import org.keycloak.models.RoleModel; @@ -24,12 +24,12 @@ import org.keycloak.models.RoleModel; * @author Bill Burke * @version $Revision: 1 $ */ -public class CachedClientRole extends CachedRole { +public class CachedClientRole extends CachedRole implements InClient { private final String clientId; - public CachedClientRole(String clientId, RoleModel model, RealmModel realm) { - super(model, realm); + public CachedClientRole(Long revision, String clientId, RoleModel model, RealmModel realm) { + super(revision, model, realm); this.clientId = clientId; } diff --git a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedClientTemplate.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedClientTemplate.java similarity index 88% rename from server-spi/src/main/java/org/keycloak/models/cache/entities/CachedClientTemplate.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedClientTemplate.java index 755dee14e7..e0f7e8805d 100755 --- a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedClientTemplate.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedClientTemplate.java @@ -15,14 +15,14 @@ * limitations under the License. */ -package org.keycloak.models.cache.entities; +package org.keycloak.models.cache.infinispan.entities; import org.keycloak.models.ClientTemplateModel; import org.keycloak.models.ProtocolMapperModel; import org.keycloak.models.RealmModel; import org.keycloak.models.RealmProvider; import org.keycloak.models.RoleModel; -import org.keycloak.models.cache.RealmCache; +import org.keycloak.models.cache.infinispan.RealmCache; import java.io.Serializable; import java.util.HashMap; @@ -34,9 +34,8 @@ import java.util.Set; * @author Bill Burke * @version $Revision: 1 $ */ -public class CachedClientTemplate implements Serializable { +public class CachedClientTemplate extends AbstractRevisioned implements InRealm { - private String id; private String name; private String description; private String realm; @@ -50,12 +49,12 @@ public class CachedClientTemplate implements Serializable { private boolean implicitFlowEnabled; private boolean directAccessGrantsEnabled; private boolean serviceAccountsEnabled; - private Set scope = new HashSet(); + private Set scope = new HashSet<>(); private Set protocolMappers = new HashSet(); - private Map attributes = new HashMap(); + private Map attributes = new HashMap<>(); - public CachedClientTemplate(RealmCache cache, RealmProvider delegate, RealmModel realm, ClientTemplateModel model) { - id = model.getId(); + public CachedClientTemplate(Long revision, RealmModel realm, ClientTemplateModel model) { + super(revision, model.getId()); name = model.getName(); description = model.getDescription(); this.realm = realm.getId(); @@ -77,10 +76,6 @@ public class CachedClientTemplate implements Serializable { directAccessGrantsEnabled = model.isDirectAccessGrantsEnabled(); serviceAccountsEnabled = model.isServiceAccountsEnabled(); } - public String getId() { - return id; - } - public String getName() { return name; diff --git a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedGroup.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedGroup.java similarity index 89% rename from server-spi/src/main/java/org/keycloak/models/cache/entities/CachedGroup.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedGroup.java index b898fa13d2..b29125a88c 100755 --- a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedGroup.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedGroup.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.keycloak.models.cache.entities; +package org.keycloak.models.cache.infinispan.entities; import org.keycloak.common.util.MultivaluedHashMap; import org.keycloak.models.GroupModel; @@ -30,8 +30,7 @@ import java.util.Set; * @author Bill Burke * @version $Revision: 1 $ */ -public class CachedGroup implements Serializable { - private String id; +public class CachedGroup extends AbstractRevisioned implements InRealm { private String realm; private String name; private String parentId; @@ -39,8 +38,8 @@ public class CachedGroup implements Serializable { private Set roleMappings = new HashSet<>(); private Set subGroups = new HashSet<>(); - public CachedGroup(RealmModel realm, GroupModel group) { - this.id = group.getId(); + public CachedGroup(Long revision, RealmModel realm, GroupModel group) { + super(revision, group.getId()); this.realm = realm.getId(); this.name = group.getName(); this.parentId = group.getParentId(); @@ -57,10 +56,6 @@ public class CachedGroup implements Serializable { } } - public String getId() { - return id; - } - public String getRealm() { return realm; } diff --git a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedRealm.java similarity index 94% rename from server-spi/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedRealm.java index a037d0549b..d5e02a227e 100755 --- a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedRealm.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.keycloak.models.cache.entities; +package org.keycloak.models.cache.infinispan.entities; import org.keycloak.common.enums.SslRequired; import org.keycloak.models.AuthenticationExecutionModel; @@ -35,7 +35,7 @@ import org.keycloak.models.RequiredCredentialModel; import org.keycloak.models.RoleModel; import org.keycloak.models.UserFederationMapperModel; import org.keycloak.models.UserFederationProviderModel; -import org.keycloak.models.cache.RealmCache; +import org.keycloak.models.cache.infinispan.RealmCache; import org.keycloak.common.util.MultivaluedHashMap; import java.io.Serializable; @@ -56,9 +56,8 @@ import java.util.Set; * @author Bill Burke * @version $Revision: 1 $ */ -public class CachedRealm implements Serializable { +public class CachedRealm extends AbstractRevisioned { - protected String id; protected String name; protected String displayName; protected String displayNameHtml; @@ -155,11 +154,8 @@ public class CachedRealm implements Serializable { protected MultivaluedHashMap identityProviderMappers = new MultivaluedHashMap<>(); protected Set identityProviderMapperSet; - public CachedRealm() { - } - - public CachedRealm(RealmCache cache, RealmProvider delegate, RealmModel model) { - id = model.getId(); + public CachedRealm(Long revision, RealmModel model) { + super(revision, model.getId()); name = model.getName(); displayName = model.getDisplayName(); displayNameHtml = model.getDisplayNameHtml(); @@ -244,11 +240,11 @@ public class CachedRealm implements Serializable { ClientModel masterAdminClient = model.getMasterAdminClient(); this.masterAdminClient = (masterAdminClient != null) ? masterAdminClient.getId() : null; - cacheRealmRoles(cache, model); + cacheRealmRoles(model); - cacheClients(cache, delegate, model); + cacheClients(model); - cacheClientTemplates(cache, delegate, model); + cacheClientTemplates(model); internationalizationEnabled = model.isInternationalizationEnabled(); supportedLocales = model.getSupportedLocales(); @@ -286,35 +282,25 @@ public class CachedRealm implements Serializable { } - protected void cacheClientTemplates(RealmCache cache, RealmProvider delegate, RealmModel model) { + protected void cacheClientTemplates(RealmModel model) { for (ClientTemplateModel template : model.getClientTemplates()) { clientTemplates.add(template.getId()); - CachedClientTemplate cachedClient = new CachedClientTemplate(cache, delegate, model, template); - cache.addClientTemplate(cachedClient); } } - protected void cacheClients(RealmCache cache, RealmProvider delegate, RealmModel model) { + protected void cacheClients(RealmModel model) { for (ClientModel client : model.getClients()) { clients.add(client.getId()); - CachedClient cachedClient = new CachedClient(cache, delegate, model, client); - cache.addClient(cachedClient); } } - protected void cacheRealmRoles(RealmCache cache, RealmModel model) { + protected void cacheRealmRoles(RealmModel model) { for (RoleModel role : model.getRoles()) { realmRoles.put(role.getName(), role.getId()); - CachedRole cachedRole = new CachedRealmRole(role, model); - cache.addRole(cachedRole); } } - public String getId() { - return id; - } - public String getMasterAdminClient() { return masterAdminClient; } diff --git a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedRealmRole.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedRealmRole.java similarity index 84% rename from server-spi/src/main/java/org/keycloak/models/cache/entities/CachedRealmRole.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedRealmRole.java index fa3d578fa4..ac36e1100b 100755 --- a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedRealmRole.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedRealmRole.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.keycloak.models.cache.entities; +package org.keycloak.models.cache.infinispan.entities; import org.keycloak.models.RealmModel; import org.keycloak.models.RoleModel; @@ -27,8 +27,8 @@ import org.keycloak.models.RoleModel; public class CachedRealmRole extends CachedRole { - public CachedRealmRole(RoleModel model, RealmModel realm) { - super(model, realm); + public CachedRealmRole(Long revision, RoleModel model, RealmModel realm) { + super(revision, model, realm); } diff --git a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedRole.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedRole.java similarity index 88% rename from server-spi/src/main/java/org/keycloak/models/cache/entities/CachedRole.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedRole.java index 8ffc4ffe5a..44a5dc2ba7 100755 --- a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedRole.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedRole.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.keycloak.models.cache.entities; +package org.keycloak.models.cache.infinispan.entities; import org.keycloak.models.RealmModel; import org.keycloak.models.RoleModel; @@ -28,9 +28,8 @@ import java.util.Set; * @author Bill Burke * @version $Revision: 1 $ */ -public class CachedRole implements Serializable { +public class CachedRole extends AbstractRevisioned implements InRealm { - final protected String id; final protected String name; final protected String realm; final protected String description; @@ -38,10 +37,10 @@ public class CachedRole implements Serializable { final protected boolean composite; final protected Set composites = new HashSet(); - public CachedRole(RoleModel model, RealmModel realm) { + public CachedRole(Long revision, RoleModel model, RealmModel realm) { + super(revision, model.getId()); composite = model.isComposite(); description = model.getDescription(); - id = model.getId(); name = model.getName(); scopeParamRequired = model.isScopeParamRequired(); this.realm = realm.getId(); @@ -53,10 +52,6 @@ public class CachedRole implements Serializable { } - public String getId() { - return id; - } - public String getName() { return name; } diff --git a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedUser.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedUser.java similarity index 98% rename from server-spi/src/main/java/org/keycloak/models/cache/entities/CachedUser.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedUser.java index 501d3cc8bb..c1bf4cd56a 100755 --- a/server-spi/src/main/java/org/keycloak/models/cache/entities/CachedUser.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/CachedUser.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.keycloak.models.cache.entities; +package org.keycloak.models.cache.infinispan.entities; import org.keycloak.models.GroupModel; import org.keycloak.models.RealmModel; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientListQuery.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/ClientListQuery.java similarity index 90% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientListQuery.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/ClientListQuery.java index 1a7d5e2d05..4fc650d6c2 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientListQuery.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/ClientListQuery.java @@ -1,7 +1,6 @@ -package org.keycloak.models.cache.infinispan.stream; +package org.keycloak.models.cache.infinispan.entities; import org.keycloak.models.RealmModel; -import org.keycloak.models.cache.infinispan.stream.entities.AbstractRevisioned; import java.util.HashSet; import java.util.Set; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientQuery.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/ClientQuery.java similarity index 58% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientQuery.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/ClientQuery.java index 399ec693ed..e58b9211cc 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientQuery.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/ClientQuery.java @@ -1,8 +1,7 @@ -package org.keycloak.models.cache.infinispan.stream; +package org.keycloak.models.cache.infinispan.entities; -import org.keycloak.models.cache.infinispan.stream.entities.InRealm; +import org.keycloak.models.cache.infinispan.entities.InRealm; -import java.util.List; import java.util.Set; /** diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientTemplateQuery.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/ClientTemplateQuery.java similarity index 63% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientTemplateQuery.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/ClientTemplateQuery.java index e63cb67de4..e07f7ab1eb 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientTemplateQuery.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/ClientTemplateQuery.java @@ -1,6 +1,6 @@ -package org.keycloak.models.cache.infinispan.stream; +package org.keycloak.models.cache.infinispan.entities; -import org.keycloak.models.cache.infinispan.stream.entities.InRealm; +import org.keycloak.models.cache.infinispan.entities.InRealm; import java.util.Set; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/GroupQuery.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/GroupQuery.java similarity index 62% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/GroupQuery.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/GroupQuery.java index b3d86c0c93..905d271399 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/GroupQuery.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/GroupQuery.java @@ -1,6 +1,6 @@ -package org.keycloak.models.cache.infinispan.stream; +package org.keycloak.models.cache.infinispan.entities; -import org.keycloak.models.cache.infinispan.stream.entities.InRealm; +import org.keycloak.models.cache.infinispan.entities.InRealm; import java.util.Set; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/InClient.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/InClient.java similarity index 73% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/InClient.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/InClient.java index 3951c7f5c2..464dbaf98d 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/InClient.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/InClient.java @@ -1,4 +1,4 @@ -package org.keycloak.models.cache.infinispan.stream.entities; +package org.keycloak.models.cache.infinispan.entities; /** * @author Bill Burke diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/InRealm.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/InRealm.java similarity index 73% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/InRealm.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/InRealm.java index 6b550911aa..8a880ecac4 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/InRealm.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/InRealm.java @@ -1,4 +1,4 @@ -package org.keycloak.models.cache.infinispan.stream.entities; +package org.keycloak.models.cache.infinispan.entities; /** * @author Bill Burke diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RealmListQuery.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/RealmListQuery.java similarity index 82% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RealmListQuery.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/RealmListQuery.java index 22a615caf2..446fe58f36 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RealmListQuery.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/RealmListQuery.java @@ -1,6 +1,4 @@ -package org.keycloak.models.cache.infinispan.stream; - -import org.keycloak.models.cache.infinispan.stream.entities.AbstractRevisioned; +package org.keycloak.models.cache.infinispan.entities; import java.util.HashSet; import java.util.Set; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RealmQuery.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/RealmQuery.java similarity index 60% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RealmQuery.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/RealmQuery.java index 210978fb15..612e95b60d 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RealmQuery.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/RealmQuery.java @@ -1,6 +1,4 @@ -package org.keycloak.models.cache.infinispan.stream; - -import org.keycloak.models.cache.infinispan.stream.entities.InRealm; +package org.keycloak.models.cache.infinispan.entities; import java.util.Set; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/Revisioned.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/Revisioned.java similarity index 77% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/Revisioned.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/Revisioned.java index c0b136f78e..639f4de642 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/Revisioned.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/Revisioned.java @@ -1,4 +1,4 @@ -package org.keycloak.models.cache.infinispan.stream.entities; +package org.keycloak.models.cache.infinispan.entities; /** * @author Bill Burke diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RoleQuery.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/RoleQuery.java similarity index 62% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RoleQuery.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/RoleQuery.java index 0fcb78a98b..6635831850 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RoleQuery.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/entities/RoleQuery.java @@ -1,6 +1,6 @@ -package org.keycloak.models.cache.infinispan.stream; +package org.keycloak.models.cache.infinispan.entities; -import org.keycloak.models.cache.infinispan.stream.entities.InRealm; +import org.keycloak.models.cache.infinispan.entities.InRealm; import java.util.Set; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientQueryPredicate.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientQueryPredicate.java index 1e0c555519..bf4ade8156 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientQueryPredicate.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientQueryPredicate.java @@ -1,6 +1,8 @@ package org.keycloak.models.cache.infinispan.stream; import org.jboss.logging.Logger; +import org.keycloak.models.cache.infinispan.entities.ClientQuery; +import org.keycloak.models.cache.infinispan.entities.Revisioned; import java.io.Serializable; import java.util.Map; @@ -10,7 +12,7 @@ import java.util.function.Predicate; * @author Bill Burke * @version $Revision: 1 $ */ -public class ClientQueryPredicate implements Predicate>, Serializable { +public class ClientQueryPredicate implements Predicate>, Serializable { protected static final Logger logger = Logger.getLogger(ClientQueryPredicate.class); private String client; private String inRealm; @@ -34,7 +36,7 @@ public class ClientQueryPredicate implements Predicate @Override - public boolean test(Map.Entry entry) { + public boolean test(Map.Entry entry) { Object value = entry.getValue(); if (value == null) return false; if (!(value instanceof ClientQuery)) return false; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientTemplateQueryPredicate.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientTemplateQueryPredicate.java index ebf4b6ce63..fba0c02ff6 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientTemplateQueryPredicate.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/ClientTemplateQueryPredicate.java @@ -1,5 +1,8 @@ package org.keycloak.models.cache.infinispan.stream; +import org.keycloak.models.cache.infinispan.entities.ClientTemplateQuery; +import org.keycloak.models.cache.infinispan.entities.Revisioned; + import java.io.Serializable; import java.util.Map; import java.util.function.Predicate; @@ -8,7 +11,7 @@ import java.util.function.Predicate; * @author Bill Burke * @version $Revision: 1 $ */ -public class ClientTemplateQueryPredicate implements Predicate>, Serializable { +public class ClientTemplateQueryPredicate implements Predicate>, Serializable { private String template; public static ClientTemplateQueryPredicate create() { @@ -25,7 +28,7 @@ public class ClientTemplateQueryPredicate implements Predicate entry) { + public boolean test(Map.Entry entry) { Object value = entry.getValue(); if (value == null) return false; if (!(value instanceof ClientTemplateQuery)) return false; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/GroupQueryPredicate.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/GroupQueryPredicate.java index 6e4a662969..855930e0d3 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/GroupQueryPredicate.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/GroupQueryPredicate.java @@ -1,5 +1,8 @@ package org.keycloak.models.cache.infinispan.stream; +import org.keycloak.models.cache.infinispan.entities.GroupQuery; +import org.keycloak.models.cache.infinispan.entities.Revisioned; + import java.io.Serializable; import java.util.Map; import java.util.function.Predicate; @@ -8,7 +11,7 @@ import java.util.function.Predicate; * @author Bill Burke * @version $Revision: 1 $ */ -public class GroupQueryPredicate implements Predicate>, Serializable { +public class GroupQueryPredicate implements Predicate>, Serializable { private String group; public static GroupQueryPredicate create() { @@ -25,7 +28,7 @@ public class GroupQueryPredicate implements Predicate> @Override - public boolean test(Map.Entry entry) { + public boolean test(Map.Entry entry) { Object value = entry.getValue(); if (value == null) return false; if (!(value instanceof GroupQuery)) return false; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/HasRolePredicate.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/HasRolePredicate.java index 5946726ae7..c4a56638b5 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/HasRolePredicate.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/HasRolePredicate.java @@ -1,7 +1,8 @@ package org.keycloak.models.cache.infinispan.stream; -import org.keycloak.models.cache.entities.CachedGroup; -import org.keycloak.models.cache.entities.CachedRole; +import org.keycloak.models.cache.infinispan.entities.CachedGroup; +import org.keycloak.models.cache.infinispan.entities.CachedRole; +import org.keycloak.models.cache.infinispan.entities.Revisioned; import java.io.Serializable; import java.util.Map; @@ -11,7 +12,7 @@ import java.util.function.Predicate; * @author Bill Burke * @version $Revision: 1 $ */ -public class HasRolePredicate implements Predicate>, Serializable { +public class HasRolePredicate implements Predicate>, Serializable { private String role; public static HasRolePredicate create() { @@ -24,7 +25,7 @@ public class HasRolePredicate implements Predicate>, S } @Override - public boolean test(Map.Entry entry) { + public boolean test(Map.Entry entry) { Object value = entry.getValue(); if (value == null) return false; if (value instanceof CachedRole) { diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/InClientPredicate.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/InClientPredicate.java index ee5343f841..a582f34f27 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/InClientPredicate.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/InClientPredicate.java @@ -1,7 +1,7 @@ package org.keycloak.models.cache.infinispan.stream; -import org.keycloak.models.cache.infinispan.stream.entities.InClient; -import org.keycloak.models.cache.infinispan.stream.entities.InRealm; +import org.keycloak.models.cache.infinispan.entities.InClient; +import org.keycloak.models.cache.infinispan.entities.Revisioned; import java.io.Serializable; import java.util.Map; @@ -11,7 +11,7 @@ import java.util.function.Predicate; * @author Bill Burke * @version $Revision: 1 $ */ -public class InClientPredicate implements Predicate>, Serializable { +public class InClientPredicate implements Predicate>, Serializable { private String clientId; public static InClientPredicate create() { @@ -24,7 +24,7 @@ public class InClientPredicate implements Predicate>, } @Override - public boolean test(Map.Entry entry) { + public boolean test(Map.Entry entry) { Object value = entry.getValue(); if (value == null) return false; if (!(value instanceof InClient)) return false; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/InRealmPredicate.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/InRealmPredicate.java index 265e4d2655..d24a9bd142 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/InRealmPredicate.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/InRealmPredicate.java @@ -1,6 +1,7 @@ package org.keycloak.models.cache.infinispan.stream; -import org.keycloak.models.cache.infinispan.stream.entities.InRealm; +import org.keycloak.models.cache.infinispan.entities.InRealm; +import org.keycloak.models.cache.infinispan.entities.Revisioned; import java.io.Serializable; import java.util.Map; @@ -10,7 +11,7 @@ import java.util.function.Predicate; * @author Bill Burke * @version $Revision: 1 $ */ -public class InRealmPredicate implements Predicate>, Serializable { +public class InRealmPredicate implements Predicate>, Serializable { private String realm; public static InRealmPredicate create() { @@ -23,7 +24,7 @@ public class InRealmPredicate implements Predicate>, S } @Override - public boolean test(Map.Entry entry) { + public boolean test(Map.Entry entry) { Object value = entry.getValue(); if (value == null) return false; if (!(value instanceof InRealm)) return false; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RealmQueryPredicate.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RealmQueryPredicate.java index 179c7da043..dbb64f5b79 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RealmQueryPredicate.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RealmQueryPredicate.java @@ -1,5 +1,8 @@ package org.keycloak.models.cache.infinispan.stream; +import org.keycloak.models.cache.infinispan.entities.RealmQuery; +import org.keycloak.models.cache.infinispan.entities.Revisioned; + import java.io.Serializable; import java.util.Map; import java.util.function.Predicate; @@ -8,7 +11,7 @@ import java.util.function.Predicate; * @author Bill Burke * @version $Revision: 1 $ */ -public class RealmQueryPredicate implements Predicate>, Serializable { +public class RealmQueryPredicate implements Predicate>, Serializable { private String realm; public static RealmQueryPredicate create() { @@ -25,7 +28,7 @@ public class RealmQueryPredicate implements Predicate> @Override - public boolean test(Map.Entry entry) { + public boolean test(Map.Entry entry) { Object value = entry.getValue(); if (value == null) return false; if (!(value instanceof RealmQuery)) return false; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RoleQueryPredicate.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RoleQueryPredicate.java index 3320963d30..5e37d59e60 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RoleQueryPredicate.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/RoleQueryPredicate.java @@ -1,5 +1,8 @@ package org.keycloak.models.cache.infinispan.stream; +import org.keycloak.models.cache.infinispan.entities.Revisioned; +import org.keycloak.models.cache.infinispan.entities.RoleQuery; + import java.io.Serializable; import java.util.Map; import java.util.function.Predicate; @@ -8,7 +11,7 @@ import java.util.function.Predicate; * @author Bill Burke * @version $Revision: 1 $ */ -public class RoleQueryPredicate implements Predicate>, Serializable { +public class RoleQueryPredicate implements Predicate>, Serializable { private String role; public static RoleQueryPredicate create() { @@ -25,7 +28,7 @@ public class RoleQueryPredicate implements Predicate>, @Override - public boolean test(Map.Entry entry) { + public boolean test(Map.Entry entry) { Object value = entry.getValue(); if (value == null) return false; if (!(value instanceof RoleQuery)) return false; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedClient.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedClient.java deleted file mode 100755 index f2ee892809..0000000000 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedClient.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.keycloak.models.cache.infinispan.stream.entities; - -import org.keycloak.models.ClientModel; -import org.keycloak.models.RealmModel; -import org.keycloak.models.RealmProvider; -import org.keycloak.models.RoleModel; -import org.keycloak.models.cache.RealmCache; -import org.keycloak.models.cache.entities.CachedClient; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RevisionedCachedClient extends CachedClient implements Revisioned, InRealm { - - public RevisionedCachedClient(Long revision, RealmCache cache, RealmProvider delegate, RealmModel realm, ClientModel model) { - super(cache, delegate, realm, model); - this.revision = revision; - } - - private Long revision; - - @Override - public Long getRevision() { - return revision; - } - - @Override - public void setRevision(Long revision) { - this.revision = revision; - } - - @Override - protected void cacheRoles(RealmCache cache, RealmModel realm, ClientModel model) { - for (RoleModel role : model.getRoles()) { - roles.put(role.getName(), role.getId()); - } - } -} diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedClientRole.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedClientRole.java deleted file mode 100755 index bad2ffec37..0000000000 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedClientRole.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.keycloak.models.cache.infinispan.stream.entities; - -import org.keycloak.models.RealmModel; -import org.keycloak.models.RoleModel; -import org.keycloak.models.cache.entities.CachedClientRole; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RevisionedCachedClientRole extends CachedClientRole implements Revisioned, InClient { - - public RevisionedCachedClientRole(Long revision, String idClient, RoleModel model, RealmModel realm) { - super(idClient, model, realm); - this.revision = revision; - } - - private Long revision; - - @Override - public Long getRevision() { - return revision; - } - - @Override - public void setRevision(Long revision) { - this.revision = revision; - } - - -} diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedClientTemplate.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedClientTemplate.java deleted file mode 100755 index ad3ac44e1d..0000000000 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedClientTemplate.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.keycloak.models.cache.infinispan.stream.entities; - -import org.keycloak.models.ClientTemplateModel; -import org.keycloak.models.RealmModel; -import org.keycloak.models.RealmProvider; -import org.keycloak.models.cache.RealmCache; -import org.keycloak.models.cache.entities.CachedClientTemplate; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RevisionedCachedClientTemplate extends CachedClientTemplate implements Revisioned, InRealm { - - public RevisionedCachedClientTemplate(Long revision, RealmCache cache, RealmProvider delegate, RealmModel realm, ClientTemplateModel model) { - super(cache, delegate, realm, model); - this.revision = revision; - } - - private Long revision; - - @Override - public Long getRevision() { - return revision; - } - - @Override - public void setRevision(Long revision) { - this.revision = revision; - } - - -} diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedGroup.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedGroup.java deleted file mode 100755 index 98ba32f20e..0000000000 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedGroup.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.keycloak.models.cache.infinispan.stream.entities; - -import org.keycloak.models.GroupModel; -import org.keycloak.models.RealmModel; -import org.keycloak.models.cache.entities.CachedGroup; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RevisionedCachedGroup extends CachedGroup implements Revisioned, InRealm { - public RevisionedCachedGroup(Long revision, RealmModel realm, GroupModel group) { - super(realm, group); - this.revision = revision; - } - - private Long revision; - - @Override - public Long getRevision() { - return revision; - } - - @Override - public void setRevision(Long revision) { - this.revision = revision; - } - - -} diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedRealm.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedRealm.java deleted file mode 100755 index c1f91ac1f5..0000000000 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedRealm.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.keycloak.models.cache.infinispan.stream.entities; - -import org.keycloak.models.ClientModel; -import org.keycloak.models.ClientTemplateModel; -import org.keycloak.models.RealmModel; -import org.keycloak.models.RealmProvider; -import org.keycloak.models.RoleModel; -import org.keycloak.models.cache.RealmCache; -import org.keycloak.models.cache.entities.CachedRealm; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RevisionedCachedRealm extends CachedRealm implements Revisioned { - - public RevisionedCachedRealm(Long revision, RealmCache cache, RealmProvider delegate, RealmModel model) { - super(cache, delegate, model); - this.revision = revision; - } - - private Long revision; - - @Override - public Long getRevision() { - return revision; - } - - @Override - public void setRevision(Long revision) { - this.revision = revision; - } - - @Override - protected void cacheClientTemplates(RealmCache cache, RealmProvider delegate, RealmModel model) { - for (ClientTemplateModel template : model.getClientTemplates()) { - clientTemplates.add(template.getId()); - } - } - - @Override - protected void cacheClients(RealmCache cache, RealmProvider delegate, RealmModel model) { - for (ClientModel client : model.getClients()) { - clients.add(client.getId()); - } - } - - @Override - protected void cacheRealmRoles(RealmCache cache, RealmModel model) { - for (RoleModel role : model.getRoles()) { - realmRoles.put(role.getName(), role.getId()); - } - } -} diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedRealmRole.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedRealmRole.java deleted file mode 100755 index 6685a3ea74..0000000000 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedRealmRole.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.keycloak.models.cache.infinispan.stream.entities; - -import org.keycloak.models.RealmModel; -import org.keycloak.models.RoleModel; -import org.keycloak.models.cache.entities.CachedRealmRole; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RevisionedCachedRealmRole extends CachedRealmRole implements Revisioned, InRealm { - - public RevisionedCachedRealmRole(Long revision, RoleModel model, RealmModel realm) { - super(model, realm); - this.revision = revision; - } - - private Long revision; - - @Override - public Long getRevision() { - return revision; - } - - @Override - public void setRevision(Long revision) { - this.revision = revision; - } - -} diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedUser.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedUser.java deleted file mode 100755 index e6135e9bd7..0000000000 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/stream/entities/RevisionedCachedUser.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.keycloak.models.cache.infinispan.stream.entities; - -import org.keycloak.models.RealmModel; -import org.keycloak.models.UserModel; -import org.keycloak.models.cache.entities.CachedUser; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RevisionedCachedUser extends CachedUser implements Revisioned, InRealm { - public RevisionedCachedUser(Long revision, RealmModel realm, UserModel user) { - super(realm, user); - this.revision = revision; - } - - private Long revision; - - @Override - public Long getRevision() { - return revision; - } - - @Override - public void setRevision(Long revision) { - this.revision = revision; - } - -}