1 package com.quikj.server.framework; 2 3 import org.w3c.dom.*; 5 6 public class AceConfigLogParams 7 { 8 public static final String EL_LOG_PARAM = "log-parms"; 9 10 public static final String ATT_LOG_GROUP = "group"; 11 public static final String ATT_LOG_TX_HOST = "tx-host"; 12 public static final String ATT_LOG_TX_PORT = "tx-port"; 13 public static final String ATT_LOG_RX_HOST = "rx-host"; 14 public static final String ATT_LOG_RX_PORT = "rx-port"; 15 public static final String ATT_PROCESS_NAME = "name"; 16 public static final String ATT_PROCESS_INSTANCE = "instance"; 17 18 public AceConfigLogParams(Node node) 19 throws AceException 20 { 21 String [] attributes = 22 { 23 ATT_LOG_GROUP, 24 ATT_PROCESS_NAME, 25 ATT_PROCESS_INSTANCE, 26 ATT_LOG_TX_HOST, 27 ATT_LOG_TX_PORT, 28 ATT_LOG_RX_HOST, 29 ATT_LOG_RX_PORT 30 }; 31 32 String [] values = AceXMLHelper.getXMLAttributes(node, attributes); 33 34 if (values[0] == null) 35 { 36 throw new AceException("The log group is not specified"); 37 } 38 39 try 40 { 41 logGroup = Integer.parseInt(values[0]); 42 } 43 catch (NumberFormatException ex1) 44 { 45 throw new AceException("The log group must be an integer number : " 46 + values[0]); 47 } 48 49 if (values[1] == null) 50 { 51 throw new AceException("The process name is not specified"); 52 } 53 54 processName = values[1]; 55 56 if (values[2] == null) 57 { 58 throw new AceException("The process instance is not specified"); 59 } 60 61 try 62 { 63 processInstance = Integer.parseInt(values[2]); 64 } 65 catch (NumberFormatException ex2) 66 { 67 throw new AceException("The process instance must be an integer number : " 68 + values[2]); 69 } 70 71 if (values[3] == null) 72 { 73 throw new AceException("The tx host is not specified"); 74 } 75 76 txHost = values[3]; 77 78 79 if (values[4] == null) 80 { 81 throw new AceException("The tx port is not specified"); 82 } 83 84 try 85 { 86 txPort = Integer.parseInt(values[4]); 87 } 88 catch (NumberFormatException ex3) 89 { 90 throw new AceException("The tx port must be an integer number : " 91 + values[4]); 92 } 93 94 if (values[5] == null) 95 { 96 throw new AceException("The rx host is not specified"); 97 } 98 99 rxHost = values[5]; 100 101 102 if (values[6] == null) 103 { 104 throw new AceException("The rx port is not specified"); 105 } 106 107 try 108 { 109 rxPort = Integer.parseInt(values[6]); 110 } 111 catch (NumberFormatException ex4) 112 { 113 throw new AceException("The rx port must be an integer number : " 114 + values[6]); 115 } 116 117 } 118 119 public int getLogGroup() 120 { 121 return logGroup; 122 } 123 124 public String getProcessName() 125 { 126 return processName; 127 } 128 129 public int getProcessInstance() 130 { 131 return processInstance; 132 } 133 134 public String getTxHost() 135 { 136 return txHost; 137 } 138 139 public int getTxPort() 140 { 141 return txPort; 142 } 143 144 public String getRxHost() 145 { 146 return rxHost; 147 } 148 149 public int getRxPort() 150 { 151 return rxPort; 152 } 153 154 private int logGroup; 155 private String processName; 156 private int processInstance; 157 private String txHost; 158 private int txPort; 159 private String rxHost; 160 private int rxPort; 161 } 162 163 164 165 166 167 168 169 170 171 | Popular Tags |