Search in sources :

Example 11 with SerializationContextRegistry

use of org.infinispan.marshall.protostream.impl.SerializationContextRegistry 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)

Example 12 with SerializationContextRegistry

use of org.infinispan.marshall.protostream.impl.SerializationContextRegistry in project infinispan by infinispan.

the class LifecycleCallbacks method cacheManagerStarting.

@Override
public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration gc) {
    SerializationContextRegistry ctxRegistry = gcr.getComponent(SerializationContextRegistry.class);
    ctxRegistry.addContextInitializer(MarshallerType.PERSISTENCE, new org.infinispan.server.logging.events.PersistenceContextInitializerImpl());
    ctxRegistry.addContextInitializer(MarshallerType.PERSISTENCE, new org.infinispan.server.state.PersistenceContextInitializerImpl());
    EmbeddedCacheManager cacheManager = gcr.getComponent(EmbeddedCacheManager.class);
    InternalCacheRegistry internalCacheRegistry = gcr.getComponent(InternalCacheRegistry.class);
    internalCacheRegistry.registerInternalCache(ServerEventLogger.EVENT_LOG_CACHE, getTaskHistoryCacheConfiguration(cacheManager).build(), EnumSet.of(InternalCacheRegistry.Flag.PERSISTENT, InternalCacheRegistry.Flag.QUERYABLE));
    // Install the new logger component
    oldEventLogger = gcr.getComponent(EventLogManager.class).replaceEventLogger(new ServerEventLogger(cacheManager, gcr.getTimeService()));
}
Also used : SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) InternalCacheRegistry(org.infinispan.registry.InternalCacheRegistry) ServerEventLogger(org.infinispan.server.logging.events.ServerEventLogger) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 13 with SerializationContextRegistry

use of org.infinispan.marshall.protostream.impl.SerializationContextRegistry in project infinispan by infinispan.

the class SpringEmbeddedModule method cacheManagerStarting.

@Override
public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration globalConfiguration) {
    ClassAllowList serializationAllowList = gcr.getCacheManager().getClassAllowList();
    serializationAllowList.addClasses(NullValue.class);
    serializationAllowList.addRegexps("java.util\\..*", "org.springframework\\..*");
    JavaSerializationMarshaller serializationMarshaller = new JavaSerializationMarshaller(serializationAllowList);
    SerializationContextRegistry ctxRegistry = gcr.getComponent(SerializationContextRegistry.class);
    addSessionContextInitializerAndMarshaller(ctxRegistry, serializationMarshaller);
}
Also used : SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) ClassAllowList(org.infinispan.commons.configuration.ClassAllowList) JavaSerializationMarshaller(org.infinispan.commons.marshall.JavaSerializationMarshaller)

Example 14 with SerializationContextRegistry

use of org.infinispan.marshall.protostream.impl.SerializationContextRegistry in project infinispan by infinispan.

the class LifecycleManager method cacheManagerStarting.

@Override
public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration globalCfg) {
    gcr.registerComponent(new QueryCache(), QueryCache.class);
    Map<Integer, AdvancedExternalizer<?>> externalizerMap = globalCfg.serialization().advancedExternalizers();
    externalizerMap.put(ExternalizerIds.ICKLE_FILTER_AND_CONVERTER, new IckleFilterAndConverter.IckleFilterAndConverterExternalizer());
    externalizerMap.put(ExternalizerIds.ICKLE_FILTER_RESULT, new IckleFilterAndConverter.FilterResultExternalizer());
    externalizerMap.put(ExternalizerIds.ICKLE_CACHE_EVENT_FILTER_CONVERTER, new IckleCacheEventFilterConverter.Externalizer());
    externalizerMap.put(ExternalizerIds.ICKLE_CONTINUOUS_QUERY_CACHE_EVENT_FILTER_CONVERTER, new IckleContinuousQueryCacheEventFilterConverter.Externalizer());
    externalizerMap.put(ExternalizerIds.ICKLE_CONTINUOUS_QUERY_RESULT, new ContinuousQueryResult.Externalizer());
    externalizerMap.put(ExternalizerIds.ICKLE_DELETE_FUNCTION, new EmbeddedQuery.DeleteFunctionExternalizer());
    SerializationContextRegistry ctxRegistry = gcr.getComponent(SerializationContextRegistry.class);
    ctxRegistry.addContextInitializer(PERSISTENCE, new PersistenceContextInitializerImpl());
}
Also used : ContinuousQueryResult(org.infinispan.query.core.impl.continuous.ContinuousQueryResult) IckleContinuousQueryCacheEventFilterConverter(org.infinispan.query.core.impl.continuous.IckleContinuousQueryCacheEventFilterConverter) SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) PersistenceContextInitializerImpl(org.infinispan.query.core.stats.impl.PersistenceContextInitializerImpl) IckleFilterAndConverter(org.infinispan.query.core.impl.eventfilter.IckleFilterAndConverter) AdvancedExternalizer(org.infinispan.commons.marshall.AdvancedExternalizer) IckleCacheEventFilterConverter(org.infinispan.query.core.impl.eventfilter.IckleCacheEventFilterConverter)

Example 15 with SerializationContextRegistry

use of org.infinispan.marshall.protostream.impl.SerializationContextRegistry in project infinispan by infinispan.

the class LifecycleManager method cacheManagerStarting.

@Override
public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration globalCfg) {
    Map<Integer, AdvancedExternalizer<?>> externalizerMap = globalCfg.serialization().advancedExternalizers();
    externalizerMap.put(ExternalizerIds.ICKLE_PROTOBUF_CACHE_EVENT_FILTER_CONVERTER, new IckleProtobufCacheEventFilterConverter.Externalizer());
    externalizerMap.put(ExternalizerIds.ICKLE_PROTOBUF_FILTER_AND_CONVERTER, new IckleProtobufFilterAndConverter.Externalizer());
    externalizerMap.put(ExternalizerIds.ICKLE_CONTINUOUS_QUERY_CACHE_EVENT_FILTER_CONVERTER, new IckleContinuousQueryProtobufCacheEventFilterConverter.Externalizer());
    externalizerMap.put(ExternalizerIds.ICKLE_BINARY_PROTOBUF_FILTER_AND_CONVERTER, new IckleBinaryProtobufFilterAndConverter.Externalizer());
    externalizerMap.put(ExternalizerIds.ICKLE_CONTINUOUS_QUERY_RESULT, new ContinuousQueryResultExternalizer());
    externalizerMap.put(ExternalizerIds.ICKLE_FILTER_RESULT, new FilterResultExternalizer());
    BasicComponentRegistry bcr = gcr.getComponent(BasicComponentRegistry.class);
    SerializationContextRegistry ctxRegistry = gcr.getComponent(SerializationContextRegistry.class);
    ctxRegistry.addContextInitializer(SerializationContextRegistry.MarshallerType.PERSISTENCE, new PersistenceContextInitializerImpl());
    ctxRegistry.addContextInitializer(SerializationContextRegistry.MarshallerType.GLOBAL, MarshallerRegistration.INSTANCE);
    initProtobufMetadataManager(bcr);
    EmbeddedCacheManager cacheManager = gcr.getComponent(EmbeddedCacheManager.class);
    cacheManager.getClassAllowList().addClasses(QueryRequest.class, QueryRequestExternalizer.class);
}
Also used : IckleContinuousQueryProtobufCacheEventFilterConverter(org.infinispan.query.remote.impl.filter.IckleContinuousQueryProtobufCacheEventFilterConverter) IckleProtobufFilterAndConverter(org.infinispan.query.remote.impl.filter.IckleProtobufFilterAndConverter) IckleBinaryProtobufFilterAndConverter(org.infinispan.query.remote.impl.filter.IckleBinaryProtobufFilterAndConverter) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager) FilterResultExternalizer(org.infinispan.query.remote.impl.filter.FilterResultExternalizer) BasicComponentRegistry(org.infinispan.factories.impl.BasicComponentRegistry) SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) PersistenceContextInitializerImpl(org.infinispan.query.remote.impl.persistence.PersistenceContextInitializerImpl) IckleProtobufCacheEventFilterConverter(org.infinispan.query.remote.impl.filter.IckleProtobufCacheEventFilterConverter) AdvancedExternalizer(org.infinispan.commons.marshall.AdvancedExternalizer) ContinuousQueryResultExternalizer(org.infinispan.query.remote.impl.filter.ContinuousQueryResultExternalizer)

Aggregations

SerializationContextRegistry (org.infinispan.marshall.protostream.impl.SerializationContextRegistry)15 AdvancedExternalizer (org.infinispan.commons.marshall.AdvancedExternalizer)6 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)5 BasicComponentRegistry (org.infinispan.factories.impl.BasicComponentRegistry)3 InternalCacheRegistry (org.infinispan.registry.InternalCacheRegistry)3 ClassAllowList (org.infinispan.commons.configuration.ClassAllowList)2 ProtostreamTranscoder (org.infinispan.encoding.ProtostreamTranscoder)2 BeforeClass (org.testng.annotations.BeforeClass)2 Transcoder (org.infinispan.commons.dataconversion.Transcoder)1 JavaSerializationMarshaller (org.infinispan.commons.marshall.JavaSerializationMarshaller)1 SingletonExternalizer (org.infinispan.commons.marshall.SingletonExternalizer)1 SuppliedExternalizer (org.infinispan.commons.marshall.SuppliedExternalizer)1 CounterManagerConfiguration (org.infinispan.counter.configuration.CounterManagerConfiguration)1 PersistenceContextInitializerImpl (org.infinispan.counter.impl.persistence.PersistenceContextInitializerImpl)1 TwoStepTranscoder (org.infinispan.encoding.impl.TwoStepTranscoder)1 GetAndPut (org.infinispan.jcache.embedded.functions.GetAndPut)1 GetAndReplace (org.infinispan.jcache.embedded.functions.GetAndReplace)1 Invoke (org.infinispan.jcache.embedded.functions.Invoke)1 MutableEntrySnapshot (org.infinispan.jcache.embedded.functions.MutableEntrySnapshot)1 Put (org.infinispan.jcache.embedded.functions.Put)1