All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.persistence.jdbc.configuration.ManagedConnectionFactoryConfigurationBuilder Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.persistence.jdbc.configuration;

import org.infinispan.commons.CacheConfigurationException;
import org.infinispan.configuration.global.GlobalConfiguration;

/**
 * ManagedConnectionFactoryConfigurationBuilder.
 *
 * @author Tristan Tarrant
 * @since 5.2
 */
public class ManagedConnectionFactoryConfigurationBuilder> extends AbstractJdbcStoreConfigurationChildBuilder
      implements ConnectionFactoryConfigurationBuilder {

   public ManagedConnectionFactoryConfigurationBuilder(AbstractJdbcStoreConfigurationBuilder builder) {
      super(builder);
   }

   private String jndiUrl;

   public void jndiUrl(String jndiUrl) {
      this.jndiUrl = jndiUrl;
   }

   @Override
   public void validate() {
      if (jndiUrl == null) {
         throw new CacheConfigurationException("The jndiUrl has not been specified");
      }
   }

   @Override
   public void validate(GlobalConfiguration globalConfig) {
   }

   @Override
   public ManagedConnectionFactoryConfiguration create() {
      return new ManagedConnectionFactoryConfiguration(jndiUrl);
   }

   @Override
   public ManagedConnectionFactoryConfigurationBuilder read(ManagedConnectionFactoryConfiguration template) {
      this.jndiUrl = template.jndiUrl();
      return this;
   }

}