Search in sources :

Example 1 with SitesConfigurationBuilder

use of org.infinispan.configuration.cache.SitesConfigurationBuilder in project wildfly by wildfly.

the class BackupsBuilder method configure.

@Override
public Builder<SitesConfiguration> configure(OperationContext context, ModelNode model) throws OperationFailedException {
    this.backups.clear();
    if (model.hasDefined(BackupResourceDefinition.WILDCARD_PATH.getKey())) {
        SitesConfigurationBuilder builder = new ConfigurationBuilder().sites();
        for (Property property : model.get(BackupResourceDefinition.WILDCARD_PATH.getKey()).asPropertyList()) {
            String siteName = property.getName();
            ModelNode backup = property.getValue();
            BackupConfigurationBuilder backupBuilder = builder.addBackup();
            backupBuilder.site(siteName).enabled(ENABLED.resolveModelAttribute(context, backup).asBoolean()).backupFailurePolicy(ModelNodes.asEnum(FAILURE_POLICY.resolveModelAttribute(context, backup), BackupFailurePolicy.class)).replicationTimeout(TIMEOUT.resolveModelAttribute(context, backup).asLong()).strategy(ModelNodes.asEnum(STRATEGY.resolveModelAttribute(context, backup), BackupStrategy.class)).takeOffline().afterFailures(AFTER_FAILURES.resolveModelAttribute(context, backup).asInt()).minTimeToWait(MIN_WAIT.resolveModelAttribute(context, backup).asLong());
            this.backups.put(siteName, backupBuilder.create());
        }
    }
    return this;
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) SitesConfigurationBuilder(org.infinispan.configuration.cache.SitesConfigurationBuilder) BackupConfigurationBuilder(org.infinispan.configuration.cache.BackupConfigurationBuilder) SitesConfigurationBuilder(org.infinispan.configuration.cache.SitesConfigurationBuilder) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property) BackupConfigurationBuilder(org.infinispan.configuration.cache.BackupConfigurationBuilder)

Example 2 with SitesConfigurationBuilder

use of org.infinispan.configuration.cache.SitesConfigurationBuilder in project wildfly by wildfly.

the class BackupsBuilder method getValue.

@Override
public SitesConfiguration getValue() {
    SitesConfigurationBuilder builder = new ConfigurationBuilder().sites();
    builder.backupFor().read(this.backupFor.getValue());
    builder.disableBackups(this.backups.isEmpty());
    for (Map.Entry<String, BackupConfiguration> backup : this.backups.entrySet()) {
        builder.addBackup().read(backup.getValue());
        builder.addInUseBackupSite(backup.getKey());
    }
    return builder.create();
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) SitesConfigurationBuilder(org.infinispan.configuration.cache.SitesConfigurationBuilder) BackupConfigurationBuilder(org.infinispan.configuration.cache.BackupConfigurationBuilder) SitesConfigurationBuilder(org.infinispan.configuration.cache.SitesConfigurationBuilder) BackupConfiguration(org.infinispan.configuration.cache.BackupConfiguration) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with SitesConfigurationBuilder

use of org.infinispan.configuration.cache.SitesConfigurationBuilder in project wildfly by wildfly.

the class SharedStateCacheBuilder method accept.

@Override
public void accept(ConfigurationBuilder builder) {
    super.accept(builder);
    builder.clustering().partitionHandling().read(this.partitionHandling.getValue());
    builder.clustering().stateTransfer().read(this.stateTransfer.getValue());
    SitesConfigurationBuilder sitesBuilder = builder.sites();
    sitesBuilder.read(this.backups.getValue());
    sitesBuilder.backupFor().read(this.backupFor.getValue());
}
Also used : SitesConfigurationBuilder(org.infinispan.configuration.cache.SitesConfigurationBuilder)

Example 4 with SitesConfigurationBuilder

use of org.infinispan.configuration.cache.SitesConfigurationBuilder in project wildfly by wildfly.

the class BackupsServiceConfigurator method get.

@Override
public SitesConfiguration get() {
    SitesConfigurationBuilder builder = new ConfigurationBuilder().sites();
    builder.disableBackups(this.backups.isEmpty());
    for (Map.Entry<String, BackupConfiguration> backup : this.backups.entrySet()) {
        builder.addBackup().read(backup.getValue());
        builder.addInUseBackupSite(backup.getKey());
    }
    return builder.create();
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) SitesConfigurationBuilder(org.infinispan.configuration.cache.SitesConfigurationBuilder) BackupConfigurationBuilder(org.infinispan.configuration.cache.BackupConfigurationBuilder) SitesConfigurationBuilder(org.infinispan.configuration.cache.SitesConfigurationBuilder) BackupConfiguration(org.infinispan.configuration.cache.BackupConfiguration) HashMap(java.util.HashMap) Map(java.util.Map)

Example 5 with SitesConfigurationBuilder

use of org.infinispan.configuration.cache.SitesConfigurationBuilder in project wildfly by wildfly.

the class BackupsServiceConfigurator method configure.

@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
    this.backups.clear();
    if (model.hasDefined(BackupResourceDefinition.WILDCARD_PATH.getKey())) {
        SitesConfigurationBuilder builder = new ConfigurationBuilder().sites();
        for (Property property : model.get(BackupResourceDefinition.WILDCARD_PATH.getKey()).asPropertyList()) {
            String siteName = property.getName();
            ModelNode backup = property.getValue();
            BackupConfigurationBuilder backupBuilder = builder.addBackup();
            backupBuilder.site(siteName).enabled(ENABLED.resolveModelAttribute(context, backup).asBoolean()).backupFailurePolicy(BackupFailurePolicy.valueOf(FAILURE_POLICY.resolveModelAttribute(context, backup).asString())).replicationTimeout(TIMEOUT.resolveModelAttribute(context, backup).asLong()).strategy(BackupStrategy.valueOf(STRATEGY.resolveModelAttribute(context, backup).asString())).takeOffline().afterFailures(AFTER_FAILURES.resolveModelAttribute(context, backup).asInt()).minTimeToWait(MIN_WAIT.resolveModelAttribute(context, backup).asLong());
            this.backups.put(siteName, backupBuilder.create());
        }
    }
    return this;
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) SitesConfigurationBuilder(org.infinispan.configuration.cache.SitesConfigurationBuilder) BackupConfigurationBuilder(org.infinispan.configuration.cache.BackupConfigurationBuilder) SitesConfigurationBuilder(org.infinispan.configuration.cache.SitesConfigurationBuilder) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property) BackupConfigurationBuilder(org.infinispan.configuration.cache.BackupConfigurationBuilder)

Aggregations

SitesConfigurationBuilder (org.infinispan.configuration.cache.SitesConfigurationBuilder)6 BackupConfigurationBuilder (org.infinispan.configuration.cache.BackupConfigurationBuilder)4 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)4 HashMap (java.util.HashMap)2 Map (java.util.Map)2 BackupConfiguration (org.infinispan.configuration.cache.BackupConfiguration)2 ModelNode (org.jboss.dmr.ModelNode)2 Property (org.jboss.dmr.Property)2