001/* 002 * HA-JDBC: High-Availability JDBC 003 * Copyright (C) 2012 Paul Ferraro 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Lesser General Public License as published by 007 * the Free Software Foundation, either version 3 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018package net.sf.hajdbc; 019 020import java.io.Serializable; 021import java.util.Map; 022import java.util.concurrent.ConcurrentMap; 023import java.util.concurrent.ThreadFactory; 024 025import net.sf.hajdbc.balancer.BalancerFactory; 026import net.sf.hajdbc.cache.DatabaseMetaDataCacheFactory; 027import net.sf.hajdbc.codec.DecoderFactory; 028import net.sf.hajdbc.dialect.DialectFactory; 029import net.sf.hajdbc.distributed.CommandDispatcherFactory; 030import net.sf.hajdbc.durability.DurabilityFactory; 031import net.sf.hajdbc.io.InputSinkProvider; 032import net.sf.hajdbc.lock.LockManagerFactory; 033import net.sf.hajdbc.management.MBeanRegistrar; 034import net.sf.hajdbc.state.StateManagerFactory; 035import net.sf.hajdbc.tx.TransactionIdentifierFactory; 036import net.sf.hajdbc.util.concurrent.cron.CronExpression; 037 038/** 039 * @author Paul Ferraro 040 */ 041public interface DatabaseClusterConfiguration<Z, D extends Database<Z>> extends Serializable 042{ 043 CommandDispatcherFactory getDispatcherFactory(); 044 045 /** 046 * Returns the databases of this cluster indexed by identifier 047 * @return a map of databases 048 * @throws IllegalArgumentException if no database exists with the specified identifier 049 */ 050 ConcurrentMap<String, D> getDatabaseMap(); 051 052 Map<String, SynchronizationStrategy> getSynchronizationStrategyMap(); 053 054 String getDefaultSynchronizationStrategy(); 055 056 /** 057 * Returns the Balancer implementation used by this database cluster. 058 * @return an implementation of <code>Balancer</code> 059 */ 060 BalancerFactory getBalancerFactory(); 061 062 TransactionMode getTransactionMode(); 063 064 ExecutorServiceProvider getExecutorProvider(); 065 066 /** 067 * Returns a dialect capable of returning database vendor specific values. 068 * @return an implementation of <code>Dialect</code> 069 */ 070 DialectFactory getDialectFactory(); 071 072 /** 073 * Returns a StateManager for persisting database cluster state. 074 * @return a StateManager implementation 075 */ 076 StateManagerFactory getStateManagerFactory(); 077 078 /** 079 * Returns a DatabaseMetaData cache. 080 * @return a <code>DatabaseMetaDataCache</code> implementation 081 */ 082 DatabaseMetaDataCacheFactory getDatabaseMetaDataCacheFactory(); 083 084 DurabilityFactory getDurabilityFactory(); 085 086 LockManagerFactory getLockManagerFactory(); 087 088 /** 089 * Indicates whether or not sequence detection is enabled for this cluster. 090 * @return true, if sequence detection is enabled, false otherwise. 091 */ 092 boolean isSequenceDetectionEnabled(); 093 094 /** 095 * Indicates whether or not identity column detection is enabled for this cluster. 096 * @return true, if identity column detection is enabled, false otherwise. 097 */ 098 boolean isIdentityColumnDetectionEnabled(); 099 100 /** 101 * Indicates whether or not non-deterministic CURRENT_DATE SQL functions will be evaluated to deterministic static values. 102 * @return true, if temporal SQL replacement is enabled, false otherwise. 103 */ 104 boolean isCurrentDateEvaluationEnabled(); 105 106 /** 107 * Indicates whether or not non-deterministic CURRENT_TIME functions will be evaluated to deterministic static values. 108 * @return true, if temporal SQL replacement is enabled, false otherwise. 109 */ 110 boolean isCurrentTimeEvaluationEnabled(); 111 112 /** 113 * Indicates whether or not non-deterministic CURRENT_TIMESTAMP functions will be evaluated to deterministic static values. 114 * @return true, if temporal SQL replacement is enabled, false otherwise. 115 */ 116 boolean isCurrentTimestampEvaluationEnabled(); 117 118 /** 119 * Indicates whether or not non-deterministic RAND() functions will be replaced by evaluated to static values. 120 * @return true, if temporal SQL replacement is enabled, false otherwise. 121 */ 122 boolean isRandEvaluationEnabled(); 123 124 CronExpression getFailureDetectionExpression(); 125 126 CronExpression getAutoActivationExpression(); 127 128 ThreadFactory getThreadFactory(); 129 130 DecoderFactory getDecoderFactory(); 131 132 MBeanRegistrar<Z, D> getMBeanRegistrar(); 133 134 TransactionIdentifierFactory<? extends Object> getTransactionIdentifierFactory(); 135 136 boolean isEmptyClusterAllowed(); 137 138 DatabaseFactory<Z, D> getDatabaseFactory(); 139 140 InputSinkProvider getInputSinkProvider(); 141}