1 package org.ultramonkey.l7.model;
3 //import java.util.logging.Logger;
4 import org.apache.log4j.Logger;
7 * <p>class SyncCategoryId</p>
8 * <p>Copyright(c) NTT COMWARE 2008</p>
11 public class SyncCategoryIdSet {
12 protected static Logger debugLogger = Logger.getLogger(LogCategorySet.SYNC_SYNC);
14 static public final int SYNC_OK = 1;
16 static public final int SYNC_NG = 2;
18 static public final int L7VSD_LOG_ID = 3;
20 static public final int ADM_LOG_ID = 4;
22 static public final int SNMP_LOG_ID = 5;
24 static public final int REPLICATION_INFO_ID = 6;
26 static public final int SNMP_INFO_ID = 7;
28 static public final int ADM_INFO_ID = 8;
30 static public final int MONITOR_ID = 9;
32 static public final int SERVICE_ID = 10;
34 static public final int USERDATA_ID = 11;
36 static public final int LOG_ALL_ID = 12;
39 * <p> change category name to category ID</p>
41 * @param inStr category name
45 public static int toCategoryId(String inStr) throws MessageView {
47 // debug log(in method)
48 if (debugLogger.isDebugEnabled()) {
49 StringBuffer buf = new StringBuffer();
51 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView in ");
52 buf.append("inStr= " + inStr);
53 debugLogger.debug("11195 " + buf.toString());
56 if (inStr.equals("SYNC_OK")) {
57 // debug log(out method)
58 if (debugLogger.isDebugEnabled()) {
59 StringBuffer buf = new StringBuffer();
61 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
62 buf.append("return= SYNC_OK");
63 debugLogger.debug("11196 " + buf.toString());
67 if (inStr.equals("SYNC_NG")) {
68 // debug log(out method)
69 if (debugLogger.isDebugEnabled()) {
70 StringBuffer buf = new StringBuffer();
72 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
73 buf.append("return= SYNC_NG");
74 debugLogger.debug("11197 " + buf.toString());
78 if (inStr.equals("l7vsd_log")) {
79 // debug log (out method)
80 if (debugLogger.isDebugEnabled()) {
81 StringBuffer buf = new StringBuffer();
83 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
84 buf.append("return= L7VSD_LOG_ID");
85 debugLogger.debug("11198 " + buf.toString());
89 if (inStr.equals("adm_log")) {
90 // debug log (out method)
91 if (debugLogger.isDebugEnabled()) {
92 StringBuffer buf = new StringBuffer();
94 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
95 buf.append("return= ADM_LOG_ID");
96 debugLogger.debug("11199 " + buf.toString());
100 if (inStr.equals("snmp_log")) {
101 // debug log (out method)
102 if (debugLogger.isDebugEnabled()) {
103 StringBuffer buf = new StringBuffer();
105 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
106 buf.append("return= SNMP_LOG_ID");
107 debugLogger.debug("11200 " + buf.toString());
111 if (inStr.equals("replication_info")) {
112 // debug log (out method)
113 if (debugLogger.isDebugEnabled()) {
114 StringBuffer buf = new StringBuffer();
116 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
117 buf.append("return= REPLICATION_INFO_ID");
118 debugLogger.debug("11201 " + buf.toString());
120 return REPLICATION_INFO_ID;
122 if (inStr.equals("snmp_info")) {
123 // debug log (out method)
124 if (debugLogger.isDebugEnabled()) {
125 StringBuffer buf = new StringBuffer();
127 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
128 buf.append("return= SNMP_INFO_ID");
129 debugLogger.debug("11202 " + buf.toString());
133 if (inStr.equals("adm_info")) {
134 // debug log (out method)
135 if (debugLogger.isDebugEnabled()) {
136 StringBuffer buf = new StringBuffer();
138 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
139 buf.append("return= ADM_INFO_ID");
140 debugLogger.debug("11203 " + buf.toString());
144 if (inStr.equals("monitor")) {
145 // debug log (out method)
146 if (debugLogger.isDebugEnabled()) {
147 StringBuffer buf = new StringBuffer();
149 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
150 buf.append("return= MONITOR_ID");
151 debugLogger.debug("11204 " + buf.toString());
155 if (inStr.equals("service")) {
156 // debug log (out method)
157 if (debugLogger.isDebugEnabled()) {
158 StringBuffer buf = new StringBuffer();
160 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
161 buf.append("return= SERVICE_ID");
162 debugLogger.debug("11205 " + buf.toString());
166 if (inStr.equals("userdata")) {
167 // debug log (out method)
168 if (debugLogger.isDebugEnabled()) {
169 StringBuffer buf = new StringBuffer();
171 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
172 buf.append("return= USERDATA_ID");
173 debugLogger.debug("11206 " + buf.toString());
177 if (inStr.equals("log_all")) {
178 // debug log (out method)
179 if (debugLogger.isDebugEnabled()) {
180 StringBuffer buf = new StringBuffer();
182 .append("SyncCategoryIdSet::toCategoryId(String inStr) throws MessageView out ");
183 buf.append("return= LOG_ALL_ID");
184 debugLogger.debug("11207 " + buf.toString());
188 throw new MessageView(40001, LogCategorySet.SYNC_SYNC,
189 Message.SYNC_INVALID_ARGUMENT + " toCategoryId : " + inStr);
194 * <p> change category ID to category name</p>
196 * @param categoryId category ID
197 * @return category name
198 * @throws MessageView
200 public static String toCategoryName(int categoryId) throws MessageView {
201 // debug log(in method)
202 if (debugLogger.isDebugEnabled()) {
203 StringBuffer buf = new StringBuffer();
205 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView in ");
206 buf.append("categoryId= " + categoryId);
207 debugLogger.debug("11208 " + buf.toString());
210 switch (categoryId) {
212 // debug log(out method)
213 if (debugLogger.isDebugEnabled()) {
214 StringBuffer buf = new StringBuffer();
216 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
217 buf.append("return= l7vsd_log");
218 debugLogger.debug("11209 " + buf.toString());
223 // debug log(out method)
224 if (debugLogger.isDebugEnabled()) {
225 StringBuffer buf = new StringBuffer();
227 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
228 buf.append("return= adm_log");
229 debugLogger.debug("11210 " + buf.toString());
234 // debug log(out method)
235 if (debugLogger.isDebugEnabled()) {
236 StringBuffer buf = new StringBuffer();
238 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
239 buf.append("return= snmp_log");
240 debugLogger.debug("11211 " + buf.toString());
245 case REPLICATION_INFO_ID:
246 // debug log(out method)
247 if (debugLogger.isDebugEnabled()) {
248 StringBuffer buf = new StringBuffer();
250 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
251 buf.append("return= replication_info");
252 debugLogger.debug("11212 " + buf.toString());
254 return "replication_info";
257 // debug log(out method)
258 if (debugLogger.isDebugEnabled()) {
259 StringBuffer buf = new StringBuffer();
261 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
262 buf.append("return= snmp_info");
263 debugLogger.debug("11213 " + buf.toString());
268 // debug log(out method)
269 if (debugLogger.isDebugEnabled()) {
270 StringBuffer buf = new StringBuffer();
272 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
273 buf.append("return= adm_info");
274 debugLogger.debug("11214 " + buf.toString());
279 // debug log(out method)
280 if (debugLogger.isDebugEnabled()) {
281 StringBuffer buf = new StringBuffer();
283 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
284 buf.append("return= monitor");
285 debugLogger.debug("11215 " + buf.toString());
290 // debug log(out method)
291 if (debugLogger.isDebugEnabled()) {
292 StringBuffer buf = new StringBuffer();
294 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
295 buf.append("return= service");
296 debugLogger.debug("11216 " + buf.toString());
301 // debug log(out method)
302 if (debugLogger.isDebugEnabled()) {
303 StringBuffer buf = new StringBuffer();
305 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
306 buf.append("return= userdata");
307 debugLogger.debug("11217 " + buf.toString());
312 // debug log(out method)
313 if (debugLogger.isDebugEnabled()) {
314 StringBuffer buf = new StringBuffer();
316 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
317 buf.append("return= log_all");
318 debugLogger.debug("11218 " + buf.toString());
323 // debug log(out method)
324 if (debugLogger.isDebugEnabled()) {
325 StringBuffer buf = new StringBuffer();
327 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
328 buf.append("return= sync_ok");
329 debugLogger.debug("11219 " + buf.toString());
334 // debug log(out method)
335 if (debugLogger.isDebugEnabled()) {
336 StringBuffer buf = new StringBuffer();
338 .append("SyncCategoryIdSet::toCategoryName(int categoryId) throws MessageView out ");
339 buf.append("return= sync_ng");
340 debugLogger.debug("11220 " + buf.toString());
345 throw new MessageView(40002, LogCategorySet.SYNC_SYNC,
346 Message.SYNC_INVALID_ARGUMENT + " toCategoryName : "