/** {@inheritDoc} */ @Override public synchronized void setCleanupInterval(final long interval) { // Don't allow a cleanup task. super.setCleanupInterval(0); }
/** {@inheritDoc} */ @Override public long incrementVersion() { return super.incrementVersion(); }
/** Constructor. */ public AbstractMapBackedStorageService() { setContextSize(Integer.MAX_VALUE); setKeySize(Integer.MAX_VALUE); setValueSize(Integer.MAX_VALUE); }
/** {@inheritDoc} */ @Override @Nullable public Object read(@Nonnull final Object value) throws IOException { final StorageRecord record = read(AnnotationSupport.getContext(value), AnnotationSupport.getKey(value)); if (record != null) { AnnotationSupport.setValue(value, record.getValue()); AnnotationSupport.setExpiration(value, record.getExpiration()); return value; } return null; }
/** {@inheritDoc} */ @Override public boolean create(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key, @Nonnull final Object value, @Nonnull final StorageSerializer serializer, @Nullable @Positive final Long expiration) throws IOException { return create(context, key, serializer.serialize(value), expiration); }
/** {@inheritDoc} */ // Checkstyle: ParameterNumber OFF @Override @Nullable public Long updateWithVersion(@Positive final long version, @Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key, @Nonnull final Object value, @Nonnull final StorageSerializer serializer, @Nullable @Positive final Long expiration) throws IOException, VersionMismatchException { return updateWithVersion(version, context, key, serializer.serialize(value), expiration); }
/** * Set the record value, using a custom serialization process. * * @param instance the new record value * @param serializer a custom serialization process to apply * @throws IOException if serialization fails */ protected void setValue(@Nonnull final Type instance, @Nonnull final StorageSerializer<Type> serializer) throws IOException { value = serializer.serialize(instance); }
/** {@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(); }
/** * 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; }
/** * 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"); } }
public class HostPageUtils { private static final native String getSerializedUser() /*-{ return $wnd.serialized_user; }-*/; public static User getUser() { final String serializedUser = getSerializedUser(); StorageSerializer storageSerializer = GWT.create(StorageSerializer.class); try { return storageSerializer.deserialize(User.class, serializedUser); } catch (Exception e) { throw new RuntimeException(); } } }
/** {@inheritDoc} */ @Column(name="version", nullable = false) @Override public long getVersion() { return super.getVersion(); }
/** {@inheritDoc} */ @Override protected void doDestroy() { contextMap = null; lock = null; super.doDestroy(); }
/** {@inheritDoc} */ @Override public boolean deleteWithVersion(long version, String context, String key) throws IOException, VersionMismatchException { return deleteImpl(version, context, key); }
/** * Resets the version of this storage record to 1. */ public void resetVersion() { super.setVersion(1); }
/** {@inheritDoc} */ @Override public void setExpiration(@Nullable Long exp) { super.setExpiration(exp); }
/** * Sets the record version. * @param version Record version; must be positive. */ @Override protected void setVersion(@Positive final long version) { super.setVersion(version); } }
/** {@inheritDoc} */ @Override protected void doDestroy() { if (entityManagerFactory.isOpen()) { entityManagerFactory.close(); } super.doDestroy(); }
/** {@inheritDoc} */ @Override protected void doInitialize() throws ComponentInitializationException { super.doInitialize(); if (httpServletRequest == null) { throw new ComponentInitializationException("HttpServletRequest must be set"); } else if (dataSealer == null || cookieManager == null) { throw new ComponentInitializationException("DataSealer and CookieManager must be set"); } }
/** {@inheritDoc} */ @Override public synchronized void setCleanupInterval(final long interval) { // Don't allow a cleanup task. super.setCleanupInterval(0); }