1 24 25 package org.objectweb.cjdbc.common.monitor; 26 27 import org.objectweb.cjdbc.common.i18n.Translate; 28 29 36 public final class DataCollectionNames 37 { 38 44 public static String get(int dataType) 45 { 46 switch (dataType) 47 { 48 51 case DataCollection.CONTROLLER_TOTAL_MEMORY : 52 return Translate.get("monitoring.controller.total.memory"); 53 case DataCollection.CONTROLLER_USED_MEMORY : 54 return Translate.get("monitoring.controller.used.memory"); 55 case DataCollection.CONTROLLER_WORKER_PENDING_QUEUE : 56 return Translate.get("monitoring.controller.pending.queue"); 57 case DataCollection.CONTROLLER_THREADS_NUMBER : 58 return Translate.get("monitoring.controller.threads.number"); 59 case DataCollection.CONTROLLER_IDLE_WORKER_THREADS : 60 return Translate.get("monitoring.controller.idle.worker.threads"); 61 64 case DataCollection.BACKEND_ACTIVE_TRANSACTION : 65 return Translate.get("monitoring.backend.active.transactions"); 66 case DataCollection.BACKEND_PENDING_REQUESTS : 67 return Translate.get("monitoring.backend.pending.requests"); 68 case DataCollection.BACKEND_TOTAL_ACTIVE_CONNECTIONS : 69 return Translate.get("monitoring.backend.active.connections"); 70 case DataCollection.BACKEND_TOTAL_REQUEST : 71 return Translate.get("monitoring.backend.total.requests"); 72 case DataCollection.BACKEND_TOTAL_READ_REQUEST : 73 return Translate.get("monitoring.backend.total.read.requests"); 74 case DataCollection.BACKEND_TOTAL_WRITE_REQUEST : 75 return Translate.get("monitoring.backend.total.write.requests"); 76 case DataCollection.BACKEND_TOTAL_TRANSACTIONS : 77 return Translate.get("monitoring.backend.total.transactions"); 78 81 case DataCollection.DATABASES_ACTIVE_THREADS : 82 return Translate.get("monitoring.virtualdatabase.active.threads"); 83 case DataCollection.DATABASES_PENDING_CONNECTIONS : 84 return Translate.get("monitoring.virtualdatabase.pending.connections"); 85 case DataCollection.DATABASES_NUMBER_OF_THREADS : 86 return Translate.get("monitoring.virtualdatabase.threads.count"); 87 90 case DataCollection.CACHE_STATS_COUNT_HITS : 91 return Translate.get("monitoring.cache.count.hits"); 92 case DataCollection.CACHE_STATS_COUNT_INSERT : 93 return Translate.get("monitoring.cache.count.insert"); 94 case DataCollection.CACHE_STATS_COUNT_SELECT : 95 return Translate.get("monitoring.cache.count.select"); 96 case DataCollection.CACHE_STATS_HITS_PERCENTAGE : 97 return Translate.get("monitoring.cache.hits.ratio"); 98 case DataCollection.CACHE_STATS_NUMBER_ENTRIES : 99 return Translate.get("monitoring.cache.number.entries"); 100 103 case DataCollection.SCHEDULER_NUMBER_READ : 104 return Translate.get("monitoring.scheduler.number.read"); 105 case DataCollection.SCHEDULER_NUMBER_REQUESTS : 106 return Translate.get("monitoring.scheduler.number.requests"); 107 case DataCollection.SCHEDULER_NUMBER_WRITES : 108 return Translate.get("monitoring.scheduler.number.writes"); 109 case DataCollection.SCHEDULER_PENDING_TRANSACTIONS : 110 return Translate.get("monitoring.scheduler.pending.transactions"); 111 case DataCollection.SCHEDULER_PENDING_WRITES : 112 return Translate.get("monitoring.scheduler.pending.writes"); 113 116 case DataCollection.CLIENT_TIME_ACTIVE : 117 return Translate.get("monitoring.client.time.active"); 118 119 122 default : 123 return ""; 124 } 125 } 126 127 133 public static int getTypeFromCommand(String command) 134 { 135 command = command.replace('_', ' '); 136 139 if (command.equalsIgnoreCase(Translate 140 .get("monitoring.controller.total.memory"))) 141 return DataCollection.CONTROLLER_TOTAL_MEMORY; 142 else if (command.equalsIgnoreCase(Translate 143 .get("monitoring.controller.used.memory"))) 144 return DataCollection.CONTROLLER_USED_MEMORY; 145 else if (command.equalsIgnoreCase(Translate 146 .get("monitoring.controller.pending.queue"))) 147 return DataCollection.CONTROLLER_WORKER_PENDING_QUEUE; 148 else if (command.equalsIgnoreCase(Translate 149 .get("monitoring.controller.threads.number"))) 150 return DataCollection.CONTROLLER_THREADS_NUMBER; 151 else if (command.equalsIgnoreCase(Translate 152 .get("monitoring.controller.idle.worker.threads"))) 153 return DataCollection.CONTROLLER_IDLE_WORKER_THREADS; 154 155 158 else if (command.equalsIgnoreCase(Translate 159 .get("monitoring.backend.active.transactions"))) 160 return DataCollection.BACKEND_ACTIVE_TRANSACTION; 161 else if (command.equalsIgnoreCase(Translate 162 .get("monitoring.backend.pending.requests"))) 163 return DataCollection.BACKEND_PENDING_REQUESTS; 164 else if (command.equalsIgnoreCase(Translate 165 .get("monitoring.backend.active.connections"))) 166 return DataCollection.BACKEND_TOTAL_ACTIVE_CONNECTIONS; 167 else if (command.equalsIgnoreCase(Translate 168 .get("monitoring.backend.total.read.requests"))) 169 return DataCollection.BACKEND_TOTAL_READ_REQUEST; 170 else if (command.equalsIgnoreCase(Translate 171 .get("monitoring.backend.total.write.requests"))) 172 return DataCollection.BACKEND_TOTAL_WRITE_REQUEST; 173 else if (command.equalsIgnoreCase(Translate 174 .get("monitoring.backend.total.requests"))) 175 return DataCollection.BACKEND_TOTAL_REQUEST; 176 else if (command.equalsIgnoreCase(Translate 177 .get("monitoring.backend.total.transactions"))) 178 return DataCollection.BACKEND_TOTAL_TRANSACTIONS; 179 180 183 else if (command.equalsIgnoreCase(Translate 184 .get("monitoring.virtualdatabase.active.threads"))) 185 return DataCollection.DATABASES_ACTIVE_THREADS; 186 else if (command.equalsIgnoreCase(Translate 187 .get("monitoring.virtualdatabase.pending.connections"))) 188 return DataCollection.DATABASES_PENDING_CONNECTIONS; 189 else if (command.equalsIgnoreCase(Translate 190 .get("monitoring.virtualdatabase.threads.count"))) 191 return DataCollection.DATABASES_NUMBER_OF_THREADS; 192 193 196 else if (command.equalsIgnoreCase(Translate 197 .get("monitoring.cache.count.hits"))) 198 return DataCollection.CACHE_STATS_COUNT_HITS; 199 else if (command.equalsIgnoreCase(Translate 200 .get("monitoring.cache.count.insert"))) 201 return DataCollection.CACHE_STATS_COUNT_INSERT; 202 else if (command.equalsIgnoreCase(Translate 203 .get("monitoring.cache.count.select"))) 204 return DataCollection.CACHE_STATS_COUNT_SELECT; 205 else if (command.equalsIgnoreCase(Translate 206 .get("monitoring.cache.hits.ratio"))) 207 return DataCollection.CACHE_STATS_HITS_PERCENTAGE; 208 else if (command.equalsIgnoreCase(Translate 209 .get("monitoring.cache.number.entries"))) 210 return DataCollection.CACHE_STATS_NUMBER_ENTRIES; 211 212 215 else if (command.equalsIgnoreCase(Translate 216 .get("monitoring.scheduler.number.read"))) 217 return DataCollection.SCHEDULER_NUMBER_READ; 218 else if (command.equalsIgnoreCase(Translate 219 .get("monitoring.scheduler.number.requests"))) 220 return DataCollection.SCHEDULER_NUMBER_REQUESTS; 221 else if (command.equalsIgnoreCase(Translate 222 .get("monitoring.scheduler.number.writes"))) 223 return DataCollection.SCHEDULER_NUMBER_WRITES; 224 else if (command.equalsIgnoreCase(Translate 225 .get("monitoring.scheduler.pending.transactions"))) 226 return DataCollection.SCHEDULER_PENDING_TRANSACTIONS; 227 else if (command.equalsIgnoreCase(Translate 228 .get("monitoring.scheduler.pending.writes"))) 229 return DataCollection.SCHEDULER_PENDING_WRITES; 230 231 234 else if (command.equalsIgnoreCase(Translate 235 .get("monitoring.client.time.active"))) 236 return DataCollection.CLIENT_TIME_ACTIVE; 237 238 else 239 return 0; 240 } 241 } 242 | Popular Tags |