Commit 87aa7242a8d7ba0d17ba2bf551d08e00df07a837
1 parent
a4b4a73e
Exists in
AFDemo_Ex1
Flow1
Showing
2 changed files
with
30 additions
and
25 deletions
Show diff stats
AF-Demo/src/af/interfaces/AFState.java
AF-Demo/src/af/state/StateIdle.java
... | ... | @@ -4,6 +4,7 @@ import java.util.ArrayList; |
4 | 4 | |
5 | 5 | import af.instatnce.E01Instance; |
6 | 6 | import af.instatnce.EC02Instance; |
7 | +import af.instatnce.EQXRawInstance; | |
7 | 8 | import af.interfaces.AFEvent; |
8 | 9 | import af.interfaces.AFState; |
9 | 10 | import af.interfaces.EQXMsg; |
... | ... | @@ -16,7 +17,7 @@ import ec02.af.utils.AlarmCategory; |
16 | 17 | import ec02.af.utils.AlarmSeverity; |
17 | 18 | import ec02.af.utils.AlarmType; |
18 | 19 | |
19 | -public class StateIdle implements IAFState { | |
20 | +public class StateIdle implements IAFState { | |
20 | 21 | private String eqxState = null; |
21 | 22 | private EC02Builder ec02Builder = new EC02Builder(); |
22 | 23 | private ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>(); |
... | ... | @@ -24,33 +25,36 @@ public class StateIdle implements IAFState { |
24 | 25 | @Override |
25 | 26 | public String doAction(AbstractAF abstractAF, Object instance, ArrayList<EquinoxRawData> eqxRawDataList) { |
26 | 27 | EC02Instance ec02Ins = (EC02Instance) instance; |
27 | - | |
28 | - for(EquinoxRawData eqxRawData : eqxRawDataList){ | |
28 | + | |
29 | + for (EquinoxRawData eqxRawData : eqxRawDataList) { | |
29 | 30 | this.ec02Builder.setEquinoxRawData(eqxRawData, abstractAF, ec02Ins); |
30 | 31 | ec02Ins.getAFInstance().setInvoke(eqxRawData.getInvoke()); |
31 | 32 | ec02Ins.getAFInstance().setOrig(eqxRawData.getRawDataAttribute(EQXMsg.ORIG)); |
32 | 33 | |
33 | - if(eqxRawData.getRawEventType().equals(AFEvent.Incoming_HTTP_Request)){ | |
34 | - E01Instance e01Ins = new E01Instance(); | |
35 | - ArrayList<String> keys = new ArrayList<String>(); | |
36 | - keys.add(eqxRawData.getRawDataMessage()); | |
37 | - keys.add("def"); | |
38 | - keys.add("def"); | |
39 | - keys.add("def"); | |
40 | - keys.add("def"); | |
41 | - e01Ins.setCmd("search"); | |
42 | - e01Ins.setObjType("TESTDATA"); | |
43 | - e01Ins.setKey(keys); | |
44 | -// e01Ins.setId("01"); | |
45 | - ec02Ins.setE01Ins(e01Ins); | |
46 | - this.ec02Builder.getE01Request(); | |
47 | - String [] parameter = {""}; | |
48 | - abstractAF.getUtils().writeLog("mylog1", "hello word!!!"); | |
49 | - abstractAF.getUtils().incrementStats("my_stat"); | |
50 | - abstractAF.getUtils().incrementStats("raise_by_stat"); | |
51 | - abstractAF.getUtils().raiseAlarm("my_alarm", parameter, AlarmSeverity.WARNING, AlarmCategory.APPLICATION, AlarmType.Normal); | |
52 | - this.eqxState = AFState.W_E01Res; | |
53 | - } | |
34 | + EQXRawInstance eqxRaw = new EQXRawInstance(); | |
35 | + eqxRaw.setMessage("A Res."); | |
36 | + eqxRaw.setTo(ec02Ins.getAFInstance().getOrig()); | |
37 | + eqxRaw.setCtype(EQXMsg.TEXTPLAIN); | |
38 | + this.eqxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)); | |
39 | + this.eqxState = AFState.END; | |
40 | + | |
41 | + /* | |
42 | + * if (eqxRawData.getRawEventType().equals(AFEvent. | |
43 | + * Incoming_HTTP_Request)) { E01Instance e01Ins = new E01Instance(); | |
44 | + * ArrayList<String> keys = new ArrayList<String>(); | |
45 | + * keys.add(eqxRawData.getRawDataMessage()); keys.add("def"); | |
46 | + * keys.add("def"); keys.add("def"); keys.add("def"); | |
47 | + * e01Ins.setCmd("search"); e01Ins.setObjType("TESTDATA"); | |
48 | + * e01Ins.setKey(keys); // e01Ins.setId("01"); | |
49 | + * ec02Ins.setE01Ins(e01Ins); this.ec02Builder.getE01Request(); | |
50 | + * String[] parameter = { "" }; | |
51 | + * abstractAF.getUtils().writeLog("mylog1", "hello word!!!"); | |
52 | + * abstractAF.getUtils().incrementStats("my_stat"); | |
53 | + * abstractAF.getUtils().incrementStats("raise_by_stat"); | |
54 | + * abstractAF.getUtils().raiseAlarm("my_alarm", parameter, | |
55 | + * AlarmSeverity.WARNING, AlarmCategory.APPLICATION, | |
56 | + * AlarmType.Normal); this.eqxState = AFState.W_E01Res; } | |
57 | + */ | |
54 | 58 | } |
55 | 59 | ec02Ins.setEqxRawDataList(this.eqxRawDataList); |
56 | 60 | return this.eqxState; | ... | ... |