Public Member Functions | |
| void | createDataPointfromXML (Element datapoint) |
| void | createDataPointFromDatagram (FND_Datagram dgram) |
| FND_DataPointContext | getContext () |
| void | setContext (FND_DataPointContext context) |
Static Public Member Functions | |
| FND_DataPointFactory | getInstance () |
Package Functions | |
| FND_DataPointFactory () | |
|
|
00057 {
00058
00059 }
|
|
|
This method adds the datapoint to the List if it was not seen before. //TODO: remove this DoS Vector BE CAREFUL: This is a denial of service attack vector and should be restricted in later versions
00154 {
00155
00156 logger.info(
00157 "unknown datapoint "
00158 + new String(dgram.getDataPointID())
00159 + " ... creating datapoint object on the fly");
00160 switch (dgram.getDatapointType()) {
00161
00162 case FND_DataPoint.TRANSFERPOINT :
00163 this.context.datapoints.put(
00164 this.context.URL_PREFIX + new String(dgram.getDataPointID()).trim(),
00165 null);
00166 logger.info(
00167 "added "
00168 + this.context.URL_PREFIX
00169 + new String(dgram.getDataPointID()));
00170 break;
00171
00172 case FND_DataPoint.MESSAGEPOINT :
00173 this.context.datapoints.put(
00174 this.context.URL_PREFIX + new String(dgram.getDataPointID()).trim(),
00175 new FND_MessagePointImpl(
00176 new String(dgram.getDataPointID())));
00177 logger.info(
00178 "added "
00179 + this.context.URL_PREFIX
00180 + new String(dgram.getDataPointID()));
00181 break;
00182
00183 case FND_DataPoint.SWITCHPOINT :
00184 this.context.datapoints.put(
00185 this.context.URL_PREFIX + new String(dgram.getDataPointID()).trim(),
00186 new FND_SwitchPointImpl(
00187 new String(dgram.getDataPointID())));
00188 logger.info(
00189 "added "
00190 + this.context.URL_PREFIX
00191 + new String(dgram.getDataPointID()));
00192 break;
00193
00194 case FND_DataPoint.MEASUREPOINT :
00195 this.context.datapoints.put(
00196 this.context.URL_PREFIX + new String(dgram.getDataPointID()).trim(),
00197 null);
00198 logger.info(
00199 "added "
00200 + this.context.URL_PREFIX
00201 + new String(dgram.getDataPointID()));
00202 break;
00203
00204 case FND_DataPoint.SETPOINT :
00205 this.context.datapoints.put(
00206 this.context.URL_PREFIX + new String(dgram.getDataPointID()).trim(),
00207 null);
00208 logger.info(
00209 "added "
00210 + this.context.URL_PREFIX
00211 + new String(dgram.getDataPointID()));
00212 break;
00213
00214 case FND_DataPoint.COUNTPOINT :
00215 this.context.datapoints.put(
00216 this.context.URL_PREFIX + new String(dgram.getDataPointID()).trim(),
00217 null);
00218 logger.info(
00219 "added "
00220 + this.context.URL_PREFIX
00221 + new String(dgram.getDataPointID()));
00222 break;
00223
00224 case FND_DataPoint.COLLECTADDRESSPOINT :
00225 this.context.datapoints.put(
00226 this.context.URL_PREFIX + new String(dgram.getDataPointID()).trim(),
00227 null);
00228 logger.info(
00229 "added "
00230 + this.context.URL_PREFIX
00231 + new String(dgram.getDataPointID()));
00232 break;
00233 }
00234
00235 }
|
|
|
create a datapoint from a given config.xml fragment
00067 {
00068
00069 String dp_id = datapoint.getAttribute("id").getValue();
00070 if (dp_id.length() > 16)
00071 logger.warn(
00072 "The datapoint id "
00073 + dp_id
00074 + "is more than 16 characters. This violates the FND spec and won't work with FND Datagrams");
00075
00076 String dp_type_string = datapoint.getAttribute("type").getValue();
00077 byte dp_type = 99;
00078 if (dp_type_string == "MESSAGEPOINT")
00079 dp_type = FND_DataPoint.MESSAGEPOINT;
00080 if (dp_type_string == "SETPOINT")
00081 dp_type = FND_DataPoint.SETPOINT;
00082 if (dp_type_string == "MEASUREPOINT")
00083 dp_type = FND_DataPoint.MEASUREPOINT;
00084 if (dp_type_string == "SWITCHPOINT")
00085 dp_type = FND_DataPoint.SWITCHPOINT;
00086 if (dp_type_string == "COUNTPOINT")
00087 dp_type = FND_DataPoint.COUNTPOINT;
00088 if (dp_type_string == "TRANSFERPOINT")
00089 dp_type = FND_DataPoint.TRANSFERPOINT;
00090 if (dp_type_string == "COLLECTADDRESSPOINT")
00091 dp_type = FND_DataPoint.COLLECTADDRESSPOINT;
00092
00093 // TODO: load the detail settings and put it into the datapoint
00094 // attributes dimensions etc.
00095
00096 switch (dp_type) {
00097
00098 case FND_DataPoint.MESSAGEPOINT :
00099 this.context.datapoints.put(
00100 this.context.URL_PREFIX + dp_id,
00101 new FND_MessagePointImpl(dp_id));
00102 break;
00103
00104 case FND_DataPoint.SETPOINT :
00105 this.context.datapoints.put(this.context.URL_PREFIX + dp_id, new FND_SetPointImpl(dp_id));
00106 break;
00107
00108 case FND_DataPoint.MEASUREPOINT :
00109 this.context.datapoints.put(
00110 this.context.URL_PREFIX + dp_id,
00111 new FND_MeasurePointImpl(dp_id));
00112 break;
00113
00114 case FND_DataPoint.SWITCHPOINT :
00115 this.context.datapoints.put(
00116 this.context.URL_PREFIX + dp_id,
00117 new FND_SwitchPointImpl(dp_id));
00118 break;
00119
00120 case FND_DataPoint.COUNTPOINT :
00121 this.context.datapoints.put(
00122 this.context.URL_PREFIX + dp_id,
00123 new FND_CountPointImpl(dp_id));
00124 break;
00125
00126 case FND_DataPoint.TRANSFERPOINT :
00127 this.context.datapoints.put(
00128 this.context.URL_PREFIX + dp_id,
00129 new FND_TransferPointImpl(dp_id));
00130 break;
00131
00132 case FND_DataPoint.COLLECTADDRESSPOINT :
00133 this.context.datapoints.put(
00134 this.context.URL_PREFIX + dp_id,
00135 new FND_CollectAddressPointImpl(dp_id));
00136 break;
00137
00138 // 99 is the nothing-else-fits case !
00139 case 99 :
00140 break;
00141
00142 }
00143 logger.info("Datapoint " + dp_id + " loaded from config");
00144
00145 }
|
|
|
00045 {
00046 if (null == _instance) {
00047 _instance = new FND_DataPointFactory();
00048 }
00049 return _instance;
00050 }
|
1.3.3