Search in sources :

Example 1 with ZonedDateTimeTranscoder

use of org.apereo.cas.ticket.registry.support.kryo.serial.ZonedDateTimeTranscoder in project cas by apereo.

the class KryoTranscoder method initialize.

/**
     * Initialize and register classes with kryo.
     */
@PostConstruct
public void initialize() {
    // Register types we know about and do not require external configuration
    this.kryo.register(EncodedTicket.class);
    this.kryo.register(ArrayList.class);
    this.kryo.register(BasicCredentialMetaData.class);
    this.kryo.register(Class.class, new DefaultSerializers.ClassSerializer());
    this.kryo.register(ZonedDateTime.class, new ZonedDateTimeTranscoder());
    this.kryo.register(HardTimeoutExpirationPolicy.class);
    this.kryo.register(HashMap.class);
    this.kryo.register(LinkedHashMap.class);
    this.kryo.register(HashSet.class);
    this.kryo.register(DefaultHandlerResult.class);
    this.kryo.register(DefaultAuthentication.class);
    this.kryo.register(MultiTimeUseOrTimeoutExpirationPolicy.class);
    this.kryo.register(NeverExpiresExpirationPolicy.class);
    this.kryo.register(RememberMeDelegatingExpirationPolicy.class);
    this.kryo.register(ServiceTicketImpl.class);
    this.kryo.register(SimpleWebApplicationServiceImpl.class, new SimpleWebApplicationServiceSerializer());
    this.kryo.register(ThrottledUseAndTimeoutExpirationPolicy.class);
    this.kryo.register(TicketGrantingTicketExpirationPolicy.class);
    this.kryo.register(TicketGrantingTicketImpl.class);
    this.kryo.register(TimeoutExpirationPolicy.class);
    this.kryo.register(UsernamePasswordCredential.class);
    this.kryo.register(SimplePrincipal.class);
    this.kryo.register(URL.class, new URLSerializer());
    this.kryo.register(URI.class, new URISerializer());
    this.kryo.register(Pattern.class, new RegexSerializer());
    this.kryo.register(UUID.class, new UUIDSerializer());
    this.kryo.register(EnumMap.class, new EnumMapSerializer());
    this.kryo.register(EnumSet.class, new EnumSetSerializer());
    // we add these ones for tests only
    this.kryo.register(RegexRegisteredService.class, new RegisteredServiceSerializer());
    // from the kryo-serializers library (https://github.com/magro/kryo-serializers)
    UnmodifiableCollectionsSerializer.registerSerializers(this.kryo);
    ImmutableListSerializer.registerSerializers(this.kryo);
    ImmutableSetSerializer.registerSerializers(this.kryo);
    ImmutableMapSerializer.registerSerializers(this.kryo);
    ImmutableMultimapSerializer.registerSerializers(this.kryo);
    this.kryo.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer());
    this.kryo.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer());
    this.kryo.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer());
    // Register other types
    if (this.serializerMap != null) {
        this.serializerMap.forEach(this.kryo::register);
    }
    // don't reinit the registered classes after every write or read
    this.kryo.setAutoReset(false);
    // don't replace objects by references
    this.kryo.setReferences(false);
    // Catchall for any classes not explicitly registered
    this.kryo.setRegistrationRequired(false);
}
Also used : DefaultSerializers(com.esotericsoftware.kryo.serializers.DefaultSerializers) RegisteredServiceSerializer(org.apereo.cas.ticket.registry.support.kryo.serial.RegisteredServiceSerializer) CollectionsEmptyMapSerializer(de.javakaffee.kryoserializers.CollectionsEmptyMapSerializer) EnumMapSerializer(de.javakaffee.kryoserializers.EnumMapSerializer) RegexSerializer(de.javakaffee.kryoserializers.RegexSerializer) SimpleWebApplicationServiceSerializer(org.apereo.cas.ticket.registry.support.kryo.serial.SimpleWebApplicationServiceSerializer) URISerializer(de.javakaffee.kryoserializers.URISerializer) UUIDSerializer(de.javakaffee.kryoserializers.UUIDSerializer) CollectionsEmptyListSerializer(de.javakaffee.kryoserializers.CollectionsEmptyListSerializer) CollectionsEmptySetSerializer(de.javakaffee.kryoserializers.CollectionsEmptySetSerializer) ZonedDateTimeTranscoder(org.apereo.cas.ticket.registry.support.kryo.serial.ZonedDateTimeTranscoder) URLSerializer(org.apereo.cas.ticket.registry.support.kryo.serial.URLSerializer) EnumSetSerializer(de.javakaffee.kryoserializers.EnumSetSerializer) PostConstruct(javax.annotation.PostConstruct)

Aggregations

DefaultSerializers (com.esotericsoftware.kryo.serializers.DefaultSerializers)1 CollectionsEmptyListSerializer (de.javakaffee.kryoserializers.CollectionsEmptyListSerializer)1 CollectionsEmptyMapSerializer (de.javakaffee.kryoserializers.CollectionsEmptyMapSerializer)1 CollectionsEmptySetSerializer (de.javakaffee.kryoserializers.CollectionsEmptySetSerializer)1 EnumMapSerializer (de.javakaffee.kryoserializers.EnumMapSerializer)1 EnumSetSerializer (de.javakaffee.kryoserializers.EnumSetSerializer)1 RegexSerializer (de.javakaffee.kryoserializers.RegexSerializer)1 URISerializer (de.javakaffee.kryoserializers.URISerializer)1 UUIDSerializer (de.javakaffee.kryoserializers.UUIDSerializer)1 PostConstruct (javax.annotation.PostConstruct)1 RegisteredServiceSerializer (org.apereo.cas.ticket.registry.support.kryo.serial.RegisteredServiceSerializer)1 SimpleWebApplicationServiceSerializer (org.apereo.cas.ticket.registry.support.kryo.serial.SimpleWebApplicationServiceSerializer)1 URLSerializer (org.apereo.cas.ticket.registry.support.kryo.serial.URLSerializer)1 ZonedDateTimeTranscoder (org.apereo.cas.ticket.registry.support.kryo.serial.ZonedDateTimeTranscoder)1