001/* 002 * GWTEventService 003 * Copyright (c) 2011 and beyond, strawbill UG (haftungsbeschr?nkt) 004 * 005 * This is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU Lesser General Public License as 007 * published by the Free Software Foundation; either version 3 of 008 * the License, or (at your option) any later version. 009 * Other licensing for GWTEventService may also be possible on request. 010 * Please view the license.txt of the project for more information. 011 * 012 * This software is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * You should have received a copy of the GNU Lesser General Public 018 * License along with this software; if not, write to the Free 019 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 020 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 021 */ 022package de.novanic.eventservice.config; 023 024/** 025 * Constants for the configuration options. 026 * 027 * @author sstrohschein 028 * <br>Date: 06.03.2009 029 * <br>Time: 00:13:13 030 */ 031public enum ConfigParameter 032{ 033 /** 034 * Max waiting time - Listening shouldn't hold longer than max waiting time. 035 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_MAX_WAITING_TIME} 036 */ 037 MAX_WAITING_TIME_TAG("time.waiting.max", false), 038 039 /** 040 * Min waiting time - Listening should hold at least for min waiting time. 041 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_MIN_WAITING_TIME} 042 */ 043 MIN_WAITING_TIME_TAG("time.waiting.min", false), 044 045 /** 046 * Timeout time - Max time for a listen cycle. If the timeout time is exceeded, the client will be deregistered. 047 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_TIME_OUT} 048 */ 049 TIMEOUT_TIME_TAG("time.timeout", false), 050 051 /** 052 * Reconnect attempts count - Number of reconnect attempts to execute 053 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_RECONNECT_ATTEMPTS} 054 */ 055 RECONNECT_ATTEMPT_COUNT_TAG("reconnect.attempt.count", false), 056 057 /** 058 * Connection id generator - Generates unique ids to identify the clients. 059 * <br>Default value: {@link de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_CONNECTION_ID_GENERATOR_CLASS_NAME} 060 */ 061 CONNECTION_ID_GENERATOR("connection.id.generator", false), 062 063 /** 064 * Connection strategy (client side part / connector) - Connection strategies are used to define the communication between the client and the server side 065 * <br>Default value: {@link de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_CONNECTION_STRATEGY_CLIENT_CONNECTOR} 066 */ 067 CONNECTION_STRATEGY_CLIENT_CONNECTOR("connection.strategy.client.connector", false), 068 069 /** 070 * Connection strategy (server side part / connector) - Connection strategies are used to define the communication between the client and the server side 071 * <br>Default value: {@link de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_CONNECTION_STRATEGY_SERVER_CONNECTOR} 072 */ 073 CONNECTION_STRATEGY_SERVER_CONNECTOR("connection.strategy.server.connector", false), 074 075 /** 076 * Connection strategy encoding - Encoding / charset for the connection strategy 077 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_CONNECTION_STRATEGY_ENCODING} 078 */ 079 CONNECTION_STRATEGY_ENCODING("connection.strategy.encoding", false), 080 081 /** 082 * Maximum amount of events which should be transferred to the client at once. 083 * The maximum amount of events prevents the listening logic from endless seeking of events (for example when more events are concurrently added than the listen thread can process). 084 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_MAX_EVENTS} 085 */ 086 MAX_EVENTS("events.max", false), 087 088 // --- Full-qualified declarations --- 089 090 /** 091 * Max waiting time - Listening shouldn't hold longer than max waiting time. 092 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_MAX_WAITING_TIME} 093 */ 094 FQ_MAX_WAITING_TIME_TAG("time.waiting.max", true), 095 096 /** 097 * Min waiting time - Listening should hold at least for min waiting time. 098 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_MIN_WAITING_TIME} 099 */ 100 FQ_MIN_WAITING_TIME_TAG("time.waiting.min", true), 101 102 /** 103 * Timeout time - Max time for a listen cycle. If the timeout time is exceeded, the client will be deregistered. 104 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_TIME_OUT} 105 */ 106 FQ_TIMEOUT_TIME_TAG("time.timeout", true), 107 108 /** 109 * Reconnect attempts count - Number of reconnect attempts to execute 110 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_RECONNECT_ATTEMPTS} 111 */ 112 FQ_RECONNECT_ATTEMPT_COUNT_TAG("reconnect.attempt.count", true), 113 114 /** 115 * Connection id generator - Generates unique ids to identify the clients. 116 * <br>Default value: {@link de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_CONNECTION_ID_GENERATOR_CLASS_NAME} 117 */ 118 FQ_CONNECTION_ID_GENERATOR("connection.id.generator", true), 119 120 /** 121 * Connection strategy (client side part / connector) - Connection strategies are used to define the communication between the client and the server side 122 * <br>Default value: {@link de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_CONNECTION_STRATEGY_CLIENT_CONNECTOR} 123 */ 124 FQ_CONNECTION_STRATEGY_CLIENT_CONNECTOR("connection.strategy.client.connector", true), 125 126 /** 127 * Connection strategy (server side part / connector) - Connection strategies are used to define the communication between the client and the server side 128 * <br>Default value: {@link de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_CONNECTION_STRATEGY_SERVER_CONNECTOR} 129 */ 130 FQ_CONNECTION_STRATEGY_SERVER_CONNECTOR("connection.strategy.server.connector", true), 131 132 /** 133 * Connection strategy encoding - Encoding / charset for the connection strategy 134 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_CONNECTION_STRATEGY_ENCODING} 135 */ 136 FQ_CONNECTION_STRATEGY_ENCODING("connection.strategy.encoding", true), 137 138 /** 139 * Maximum amount of events which should be transferred to the client at once. 140 * The maximum amount of events prevents the listening logic from endless seeking of events (for example when more events are concurrently added than the listen thread can process). 141 * <br>Default value: {@value de.novanic.eventservice.config.loader.DefaultConfigurationLoader#DEFAULT_MAX_EVENTS} 142 */ 143 FQ_MAX_EVENTS("events.max", true); 144 145 // --- Constants --- 146 147 /** 148 * Full qualified prefix 149 */ 150 public static final String FULLY_QUALIFIED_TAG_PREFIX = "eventservice."; 151 152 private String myDeclaration; 153 154 /** 155 * Creates a new {@link de.novanic.eventservice.config.ConfigParameter} with a declaration. 156 * When the flag isFQ / isFullQualified is set, the full-qualified prefix is attached to the declaration. 157 * @param aDeclaration declaration of the configuration parameter (name of the configuration entry) 158 * @param isFQ When the flag isFQ / isFullQualified is set, the full-qualified prefix is attached to the declaration. 159 */ 160 private ConfigParameter(String aDeclaration, boolean isFQ) { 161 if(isFQ) { 162 myDeclaration = FULLY_QUALIFIED_TAG_PREFIX + aDeclaration; 163 } else { 164 myDeclaration = aDeclaration; 165 } 166 } 167 168 /** 169 * Returns the declaration (name of the configuration entry) of the {@link de.novanic.eventservice.config.ConfigParameter}. 170 * @return declaration (name of the configuration entry) of the {@link de.novanic.eventservice.config.ConfigParameter} 171 */ 172 public String declaration() { 173 return myDeclaration; 174 } 175}