protected static void doProxyCacheClose() { for (int i = 0; i < proxyCaches.length; i++) { proxyCaches[i].close(); } }
private void preOp(boolean setTL) { if (this.proxyCache.isClosed()) { throw proxyCache.getCacheClosedException("Cache is closed for this user."); } if (setTL) { UserAttributes.userAttributes.set(this.proxyCache.getUserAttributes()); } }
public RegionService createAuthenticatedCacheView(Properties properties) { if (!this.multiuserSecureModeEnabled) { throw new UnsupportedOperationException( "Operation not supported when multiuser-authentication is false."); } if (properties == null || properties.isEmpty()) { throw new IllegalArgumentException("Security properties cannot be empty."); } Properties props = new Properties(); for (Entry<Object, Object> entry : properties.entrySet()) { props.setProperty((String) entry.getKey(), (String) entry.getValue()); } if (cache == null && dsys != null) { cache = dsys.getCache(); if (cache == null) { throw new IllegalStateException( "Cache must be created before creating pool"); } } ProxyCache proxy = new ProxyCache(props, cache, this); synchronized (this.proxyCacheList) { this.proxyCacheList.add(proxy); } return proxy; }
if (regionService != null && regionService instanceof ProxyCache) { ProxyCache proxyCache = (ProxyCache) regionService; UserAttributes.userAttributes.set(proxyCache.getUserAttributes());
private static Region getRegion(final int multiUserIndex, final int expectedResult) { Region region = null; try { if (multiUserAuthMode) { region = proxyCaches[multiUserIndex].getRegion(REGION_NAME); regionRef = region; } else { region = getCache().getRegion(REGION_NAME); } assertNotNull(region); } catch (Exception ex) { if (expectedResult == OTHER_EXCEPTION) { getLogWriter().info("Got expected exception during getRegion: " + ex); } else { fail("Got unexpected exception during getRegion", ex); } } return region; }
public void setUserAttributes(UserAttributes userAttributes) { preOp(); this.userAttributes = userAttributes; }
@Override public String cancelInProgress() { String reason = cache.getCancelCriterion().cancelInProgress(); if (reason != null) { return reason; } if (isClosed()) { return "Authenticated cache view is closed for this user."; } return null; }
try { if (multiUserAuthMode) { region = proxyCaches[multiUserIndex].getRegion(REGION_NAME); } else { region = getCache().getRegion(REGION_NAME); query = proxyCaches[multiUserIndex].getQueryService().newQuery(queryString); } else { region.getCache().getQueryService().newQuery(queryString);
private void postOp() { this.proxyCache.setUserAttributes(UserAttributes.userAttributes.get()); UserAttributes.userAttributes.set(null); }
try { Long userId = proxyCache.getUserAttributes().getServerToId().remove(endpoint.getLocation()); if (userId != null) { ++size;
try { if (multiUserAuthMode) { region = proxyCaches[multiUserIndex].getRegion(REGION_NAME); } else { region = getCache().getRegion(REGION_NAME);
public UserAttributes getUserAttributes() { preOp(); return this.userAttributes; }
private void preOp() { if (this.proxyCache.isClosed()) { throw proxyCache.getCacheClosedException("Cache is closed for this user."); } UserAttributes.userAttributes.set(this.proxyCache.getUserAttributes()); }
@Override public Execution onServers(RegionService regionService, String... groups) { if (regionService == null) { throw new FunctionException(String.format("%s passed is null", "RegionService instance ")); } if (regionService instanceof GemFireCacheImpl) { InternalClientCache internalCache = (InternalClientCache) regionService; if (!internalCache.isClient()) { throw new FunctionException("The cache was not a client cache"); } else if (internalCache.getDefaultPool() != null) { return onServers(internalCache.getDefaultPool(), groups); } else { throw new FunctionException("The client cache does not have a default pool"); } } else { ProxyCache proxyCache = (ProxyCache) regionService; return new ServerFunctionExecutor(proxyCache.getUserAttributes().getPool(), true, proxyCache, groups); } }
@Override public void close() { close(false); }
public Properties getProperties() { preOp(); return this.userAttributes.getCredentials(); }
private Object executeOnServer(Object[] parameters) { long startTime = CachePerfStats.getStatTime(); Object result = null; try { if (this.proxyCache != null) { if (this.proxyCache.isClosed()) { throw proxyCache.getCacheClosedException("Cache is closed for this user."); } UserAttributes.userAttributes.set(this.proxyCache.getUserAttributes()); } result = this.serverProxy.query(this.queryString, parameters); } finally { UserAttributes.userAttributes.set(null); long endTime = CachePerfStats.getStatTime(); updateStatistics(endTime - startTime); } return result; }
@Override public Execution onServer(RegionService regionService, String... groups) { if (regionService == null) { throw new FunctionException(String.format("%s passed is null", "RegionService instance ")); } if (regionService instanceof GemFireCacheImpl) { InternalClientCache internalCache = (InternalClientCache) regionService; if (!internalCache.isClient()) { throw new FunctionException("The cache was not a client cache"); } else if (internalCache.getDefaultPool() != null) { return onServer(internalCache.getDefaultPool(), groups); } else { throw new FunctionException("The client cache does not have a default pool"); } } else { ProxyCache proxyCache = (ProxyCache) regionService; return new ServerFunctionExecutor(proxyCache.getUserAttributes().getPool(), false, proxyCache, groups); } }
try { if (multiUserAuthMode) { region = proxyCaches[multiUserIndex].getRegion(REGION_NAME); } else { region = getCache().getRegion(REGION_NAME);