Search in sources :

Example 1 with TwoStepTranscoder

use of org.infinispan.encoding.impl.TwoStepTranscoder in project infinispan by infinispan.

the class LifecycleCallbacks method cacheManagerStarting.

@Override
public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration globalConfiguration) {
    SerializationContextRegistry ctxRegistry = gcr.getComponent(SerializationContextRegistry.class);
    ctxRegistry.addContextInitializer(SerializationContextRegistry.MarshallerType.PERSISTENCE, new PersistenceContextInitializerImpl());
    ClassAllowList classAllowList = gcr.getComponent(EmbeddedCacheManager.class).getClassAllowList();
    ClassLoader classLoader = globalConfiguration.classLoader();
    EncoderRegistry encoderRegistry = gcr.getComponent(EncoderRegistry.class);
    JsonTranscoder jsonTranscoder = new JsonTranscoder(classLoader, classAllowList);
    encoderRegistry.registerTranscoder(jsonTranscoder);
    registerXmlTranscoder(encoderRegistry, classLoader, classAllowList);
    // Allow transcoding between JBoss Marshalling and JSON
    if (encoderRegistry.isConversionSupported(MediaType.APPLICATION_OBJECT, MediaType.APPLICATION_JBOSS_MARSHALLING)) {
        Transcoder jbossMarshallingTranscoder = encoderRegistry.getTranscoder(MediaType.APPLICATION_OBJECT, MediaType.APPLICATION_JBOSS_MARSHALLING);
        encoderRegistry.registerTranscoder(new TwoStepTranscoder(jbossMarshallingTranscoder, jsonTranscoder));
    }
}
Also used : SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) TwoStepTranscoder(org.infinispan.encoding.impl.TwoStepTranscoder) ClassAllowList(org.infinispan.commons.configuration.ClassAllowList) EncoderRegistry(org.infinispan.marshall.core.EncoderRegistry) Transcoder(org.infinispan.commons.dataconversion.Transcoder) TwoStepTranscoder(org.infinispan.encoding.impl.TwoStepTranscoder) JsonTranscoder(org.infinispan.server.core.dataconversion.JsonTranscoder) XMLTranscoder(org.infinispan.server.core.dataconversion.XMLTranscoder) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager) JsonTranscoder(org.infinispan.server.core.dataconversion.JsonTranscoder)

Aggregations

ClassAllowList (org.infinispan.commons.configuration.ClassAllowList)1 Transcoder (org.infinispan.commons.dataconversion.Transcoder)1 TwoStepTranscoder (org.infinispan.encoding.impl.TwoStepTranscoder)1 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)1 EncoderRegistry (org.infinispan.marshall.core.EncoderRegistry)1 SerializationContextRegistry (org.infinispan.marshall.protostream.impl.SerializationContextRegistry)1 JsonTranscoder (org.infinispan.server.core.dataconversion.JsonTranscoder)1 XMLTranscoder (org.infinispan.server.core.dataconversion.XMLTranscoder)1