org.infinispan.client.hotrod.marshall.ProtoStreamMarshaller Java Examples

The following examples show how to use org.infinispan.client.hotrod.marshall.ProtoStreamMarshaller. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeviceManagementCacheProvider.java    From enmasse with Apache License 2.0 6 votes vote down vote up
private String generateSchema() throws IOException {
    final SerializationContext serCtx = ProtoStreamMarshaller.getSerializationContext(this.remoteCacheManager);

    final String generatedSchema = new ProtoSchemaBuilder()

            .addClass(CredentialKey.class)
            .addClass(DeviceKey.class)
            .addClass(DeviceInformation.class)
            .addClass(DeviceCredential.class)

            .packageName(DeviceInformation.class.getPackageName())
            .fileName(GENERATED_PROTOBUF_FILE_NAME)
            .build(serCtx);

    return generatedSchema;
}
 
Example #2
Source File: InfinispanClientProducer.java    From quarkus with Apache License 2.0 5 votes vote down vote up
/**
 * This method is designed to be called during static initialization time. This is so we have access to the
 * classes, and thus we can use reflection to find and instantiate any instances we may need
 *
 * @param properties properties file read from hot rod
 * @throws ClassNotFoundException if a class is not actually found that should be present
 */
public static void replaceProperties(Properties properties) throws ClassNotFoundException {
    // If you are changing this method, you will most likely have to change builderFromProperties as well
    String marshallerClassName = (String) properties.get(ConfigurationProperties.MARSHALLER);
    if (marshallerClassName != null) {
        Class<?> marshallerClass = Class.forName(marshallerClassName);
        properties.put(ConfigurationProperties.MARSHALLER, Util.getInstance(marshallerClass));
    } else {
        // Default to proto stream marshaller if one is not provided
        properties.put(ConfigurationProperties.MARSHALLER, new ProtoStreamMarshaller());
    }
}
 
Example #3
Source File: DeviceConnectionCacheProvider.java    From enmasse with Apache License 2.0 5 votes vote down vote up
private String generateSchema() throws Exception {
    final SerializationContext serCtx = ProtoStreamMarshaller.getSerializationContext(this.remoteCacheManager);

    return new ProtoSchemaBuilder()

            .addClass(DeviceConnectionKey.class)
            .packageName(DeviceConnectionKey.class.getPackageName())
            .fileName(GENERATED_PROTOBUF_FILE_NAME)
            .build(serCtx);

}
 
Example #4
Source File: InfinispanClientProducer.java    From quarkus with Apache License 2.0 4 votes vote down vote up
/**
 * The mirror side of {@link #replaceProperties(Properties)} so that we can take out any objects that were
 * instantiated during static init time and inject them properly
 *
 * @param properties the properties that was static constructed
 * @return the configuration builder based on the provided properties
 */
private ConfigurationBuilder builderFromProperties(Properties properties) {
    // If you are changing this method, you will most likely have to change replaceProperties as well
    ConfigurationBuilder builder = new ConfigurationBuilder();
    Object marshallerInstance = properties.remove(ConfigurationProperties.MARSHALLER);
    if (marshallerInstance != null) {
        if (marshallerInstance instanceof ProtoStreamMarshaller) {
            handleProtoStreamMarshaller((ProtoStreamMarshaller) marshallerInstance, properties, beanManager);
        }
        builder.marshaller((Marshaller) marshallerInstance);
    }
    InfinispanClientRuntimeConfig infinispanClientRuntimeConfig = this.infinispanClientRuntimeConfig.get();

    infinispanClientRuntimeConfig.serverList
            .ifPresent(v -> properties.put(ConfigurationProperties.SERVER_LIST, v));

    infinispanClientRuntimeConfig.clientIntelligence
            .ifPresent(v -> properties.put(ConfigurationProperties.CLIENT_INTELLIGENCE, v));

    infinispanClientRuntimeConfig.useAuth
            .ifPresent(v -> properties.put(ConfigurationProperties.USE_AUTH, v));
    infinispanClientRuntimeConfig.authUsername
            .ifPresent(v -> properties.put(ConfigurationProperties.AUTH_USERNAME, v));
    infinispanClientRuntimeConfig.authPassword
            .ifPresent(v -> properties.put(ConfigurationProperties.AUTH_PASSWORD, v));
    infinispanClientRuntimeConfig.authRealm
            .ifPresent(v -> properties.put(ConfigurationProperties.AUTH_REALM, v));
    infinispanClientRuntimeConfig.authServerName
            .ifPresent(v -> properties.put(ConfigurationProperties.AUTH_SERVER_NAME, v));
    infinispanClientRuntimeConfig.authClientSubject
            .ifPresent(v -> properties.put(ConfigurationProperties.AUTH_CLIENT_SUBJECT, v));
    infinispanClientRuntimeConfig.authCallbackHandler
            .ifPresent(v -> properties.put(ConfigurationProperties.AUTH_CALLBACK_HANDLER, v));

    infinispanClientRuntimeConfig.saslMechanism
            .ifPresent(v -> properties.put(ConfigurationProperties.SASL_MECHANISM, v));

    builder.withProperties(properties);

    return builder;
}
 
Example #5
Source File: DeviceManagementCacheProvider.java    From enmasse with Apache License 2.0 4 votes vote down vote up
@Override
protected void customizeServerConfiguration(ServerConfigurationBuilder configuration) {
    configuration.marshaller(ProtoStreamMarshaller.class);
}
 
Example #6
Source File: DeviceConnectionCacheProvider.java    From enmasse with Apache License 2.0 4 votes vote down vote up
@Override
protected void customizeServerConfiguration(ServerConfigurationBuilder configuration) {
    configuration.marshaller(ProtoStreamMarshaller.class);
}