/** * Get whether the configured {@link StorageService}'s * {@link org.opensaml.storage.StorageCapabilities#getValueSize()} method meets the * value set via {@link #setStorageServiceThreshold(long)}. * * @return true iff the threshold is met */ public boolean storageServiceMeetsThreshold() { ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this); return storageService.getCapabilities().getValueSize() >= storageServiceThreshold; }
/** * Convert a service identifier into a suitable key for the underlying storage service. * * @param serviceId the service identifier * * @return an appropriately sized storage key */ @Nonnull @NotEmpty private String getSPSessionStorageKey(@Nonnull @NotEmpty final String serviceId) { if (serviceId.length() > sessionManager.getStorageService().getCapabilities().getKeySize()) { return DigestUtils.sha256Hex(serviceId); } else { return serviceId; } }
/** * Set the backing store for the cache. * * @param storageService backing store to use */ public void setStorage(@Nonnull final StorageService storageService) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); storage = Constraint.isNotNull(storageService, "StorageService cannot be null"); final StorageCapabilities caps = storage.getCapabilities(); if (caps instanceof StorageCapabilitiesEx) { Constraint.isTrue(((StorageCapabilitiesEx) caps).isServerSide(), "StorageService cannot be client-side"); } }
/** * Set the {@link StorageService} back-end to use. * * @param storage the back-end to use */ public void setStorageService(@Nonnull final StorageService storage) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); storageService = Constraint.isNotNull(storage, "StorageService cannot be null"); final StorageCapabilities caps = storageService.getCapabilities(); if (caps instanceof StorageCapabilitiesEx) { Constraint.isTrue(((StorageCapabilitiesEx) caps).isServerSide(), "StorageService cannot be client-side"); if (!((StorageCapabilitiesEx) caps).isClustered()) { log.info("Use of non-clustered storage service will result in per-node lockout behavior"); } } }
/** {@inheritDoc} */ @Override protected void doInitialize() throws ComponentInitializationException { super.doInitialize(); if (artifactStore == null) { throw new ComponentInitializationException("StorageService cannot be null"); } // We can't shorten the artifacts as lookup keys at the moment because // the key is used to recreate the original artifact value. artifactStoreKeySize = getStorageService().getCapabilities().getKeySize(); }
lookupBySPSession(@Nonnull final SPSessionCriterion criterion) throws ResolverException { final int contextSize = storageService.getCapabilities().getContextSize(); final int keySize = storageService.getCapabilities().getKeySize();
StorageCapabilities caps = storage.getCapabilities(); if (context.length() > caps.getContextSize()) { log.error("context {} too long for StorageService (limit {})", context, caps.getContextSize());
final int contextSize = storageService.getCapabilities().getContextSize(); final int keySize = storageService.getCapabilities().getKeySize();
if (getStorageService().getCapabilities().getValueSize() >= flowDescriptor.getExpandedStorageThreshold()) { maxStoredRecords = flowDescriptor.getExpandedNumberOfStoredRecords();
final int contextSize = storageService.getCapabilities().getContextSize(); final int keySize = storageService.getCapabilities().getKeySize();
if (sessionId.length() > storageService.getCapabilities().getContextSize()) { throw new SessionException("Session IDs are too large for StorageService, check configuration");