Search in sources :

Example 1 with RingbufferStoreFactory

use of com.hazelcast.ringbuffer.RingbufferStoreFactory in project hazelcast by hazelcast.

the class RingbufferStoreConfigHolder method asRingbufferStoreConfig.

public RingbufferStoreConfig asRingbufferStoreConfig(SerializationService serializationService) {
    RingbufferStoreConfig config = new RingbufferStoreConfig();
    if (!StringUtil.isNullOrEmptyAfterTrim(className)) {
        config.setClassName(className);
    }
    config.setEnabled(enabled);
    if (!StringUtil.isNullOrEmptyAfterTrim(factoryClassName)) {
        config.setFactoryClassName(factoryClassName);
    }
    config.setProperties(PropertiesUtil.fromMap(properties));
    RingbufferStore storeImplementation = serializationService.toObject(implementation);
    if (storeImplementation != null) {
        config.setStoreImplementation(storeImplementation);
    }
    RingbufferStoreFactory storeFactoryImplementation = serializationService.toObject(factoryImplementation);
    if (storeFactoryImplementation != null) {
        config.setFactoryImplementation(storeFactoryImplementation);
    }
    return config;
}
Also used : RingbufferStore(com.hazelcast.ringbuffer.RingbufferStore) RingbufferStoreFactory(com.hazelcast.ringbuffer.RingbufferStoreFactory) RingbufferStoreConfig(com.hazelcast.config.RingbufferStoreConfig)

Example 2 with RingbufferStoreFactory

use of com.hazelcast.ringbuffer.RingbufferStoreFactory in project hazelcast by hazelcast.

the class RingbufferStoreWrapper method getRingbufferStoreFactory.

private static RingbufferStore getRingbufferStoreFactory(ObjectNamespace namespace, RingbufferStoreConfig storeConfig, ClassLoader classLoader) {
    if (storeConfig == null) {
        return null;
    }
    final RingbufferStoreFactory implementation = storeConfig.getFactoryImplementation();
    final String className = storeConfig.getFactoryClassName();
    final RingbufferStoreFactory factory = getOrInstantiate(implementation, classLoader, className);
    return factory == null ? null : factory.newRingbufferStore(namespace.getObjectName(), storeConfig.getProperties());
}
Also used : RingbufferStoreFactory(com.hazelcast.ringbuffer.RingbufferStoreFactory)

Example 3 with RingbufferStoreFactory

use of com.hazelcast.ringbuffer.RingbufferStoreFactory in project hazelcast by hazelcast.

the class RingbufferStoreConfigTest method setFactoryImplementation.

@Test
public void setFactoryImplementation() {
    RingbufferStoreFactory factory = new RingbufferStoreFactory() {

        @Override
        public RingbufferStore newRingbufferStore(String name, Properties properties) {
            return null;
        }
    };
    config.setFactoryImplementation(factory);
    assertEquals(factory, config.getFactoryImplementation());
}
Also used : RingbufferStoreFactory(com.hazelcast.ringbuffer.RingbufferStoreFactory) Properties(java.util.Properties) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

RingbufferStoreFactory (com.hazelcast.ringbuffer.RingbufferStoreFactory)3 RingbufferStoreConfig (com.hazelcast.config.RingbufferStoreConfig)1 RingbufferStore (com.hazelcast.ringbuffer.RingbufferStore)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Properties (java.util.Properties)1 Test (org.junit.Test)1