Commit 4374cfbe3444062fa5e3d5d262823f431e37313d
1 parent
064d2ecd
Exists in
AFDemo_Ex3
AFDemo_Ex03
Showing
4 changed files
with
51 additions
and
39 deletions
Show diff stats
AF-Demo/src/af/interfaces/AFState.java
AF-Demo/src/af/message/EC02Builder.java
| ... | ... | @@ -39,10 +39,10 @@ public class EC02Builder { |
| 39 | 39 | return eqxRawDataList; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public EquinoxRawData getHTTPResponse(EQXRawInstance eqxRaw){ | |
| 42 | + public EquinoxRawData getHTTPResponse(EQXRawInstance eqxRaw,String invoke){ | |
| 43 | 43 | eqxRaw.setType(EQXMsg.RESPONSE); |
| 44 | 44 | this.msgBuilder = new EC02MSGBuilder(eqxRaw); |
| 45 | - this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke()); | |
| 45 | + this.msgBuilder.setInvoke(invoke); | |
| 46 | 46 | return this.msgBuilder.getHttpMessage(); |
| 47 | 47 | } |
| 48 | 48 | ... | ... |
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; |
| ... | ... | @@ -30,27 +31,30 @@ public class StateIdle implements IAFState { |
| 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 | + /* | |
| 35 | + * if(eqxRawData.getRawEventType().equals(AFEvent. | |
| 36 | + * Incoming_HTTP_Request)){ E01Instance e01Ins = new E01Instance(); | |
| 37 | + * ArrayList<String> keys = new ArrayList<String>(); | |
| 38 | + * keys.add(eqxRawData.getRawDataMessage()); keys.add("def"); | |
| 39 | + * keys.add("def"); keys.add("def"); keys.add("def"); | |
| 40 | + * e01Ins.setCmd("search"); e01Ins.setObjType("TESTDATA"); | |
| 41 | + * e01Ins.setKey(keys); // e01Ins.setId("01"); | |
| 42 | + * ec02Ins.setE01Ins(e01Ins); this.ec02Builder.getE01Request(); | |
| 43 | + * String [] parameter = {""}; | |
| 44 | + * abstractAF.getUtils().writeLog("mylog1", "hello word!!!"); | |
| 45 | + * abstractAF.getUtils().incrementStats("my_stat"); | |
| 46 | + * abstractAF.getUtils().incrementStats("raise_by_stat"); | |
| 47 | + * abstractAF.getUtils().raiseAlarm("my_alarm", parameter, | |
| 48 | + * AlarmSeverity.WARNING, AlarmCategory.APPLICATION, | |
| 49 | + * AlarmType.Normal); this.eqxState = AFState.W_E01Res; } | |
| 50 | + */ | |
| 51 | + | |
| 52 | + EQXRawInstance eqxRaw = new EQXRawInstance(); | |
| 53 | + eqxRaw.setMessage("A Res."); | |
| 54 | + eqxRaw.setTo(ec02Ins.getAFInstance().getOrig()); | |
| 55 | + eqxRaw.setCtype(EQXMsg.TEXTPLAIN); | |
| 56 | + this.eqxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw,eqxRawData.getInvoke())); | |
| 57 | + this.eqxState = AFState.W_ARes; | |
| 54 | 58 | } |
| 55 | 59 | ec02Ins.setEqxRawDataList(this.eqxRawDataList); |
| 56 | 60 | return this.eqxState; | ... | ... |
AF-Demo/src/af/state/StateWaitA.java
| ... | ... | @@ -25,22 +25,29 @@ public class StateWaitA implements IAFState { |
| 25 | 25 | |
| 26 | 26 | for(EquinoxRawData eqxRawData : eqxRawDataList) { |
| 27 | 27 | this.ec02Builder.setEquinoxRawData(eqxRawData, abstractAF, ec02Ins); |
| 28 | - if(eqxRawData.getRawEventType().equals(AFEvent.Incoming_A_Response)){ | |
| 29 | - StringExtract str = new StringExtract(); | |
| 30 | - HashMap<String, String> map = str.getAll(str.setMessage(eqxRawData.getRawDataMessage().trim())); | |
| 31 | - String message = map.get("MSG[0].value"); | |
| 32 | - if (message.trim().equals("SUCCESS")) { | |
| 33 | - EQXRawInstance eqxRaw = new EQXRawInstance(); | |
| 34 | - eqxRaw.setMessage(message.trim()); | |
| 35 | - eqxRaw.setTo(ec02Ins.getAFInstance().getOrig()); | |
| 36 | - eqxRaw.setCtype(EQXMsg.TEXTPLAIN); | |
| 37 | - this.eqxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)); | |
| 38 | - this.eqxState = AFState.IDLE; | |
| 39 | - } | |
| 40 | - else { | |
| 41 | - | |
| 42 | - } | |
| 43 | - } | |
| 28 | + /* | |
| 29 | + * if(eqxRawData.getRawEventType().equals(AFEvent. | |
| 30 | + * Incoming_A_Response)){ StringExtract str = new StringExtract(); | |
| 31 | + * HashMap<String, String> map = | |
| 32 | + * str.getAll(str.setMessage(eqxRawData.getRawDataMessage().trim())) | |
| 33 | + * ; String message = map.get("MSG[0].value"); if | |
| 34 | + * (message.trim().equals("SUCCESS")) { EQXRawInstance eqxRaw = new | |
| 35 | + * EQXRawInstance(); eqxRaw.setMessage(message.trim()); | |
| 36 | + * eqxRaw.setTo(ec02Ins.getAFInstance().getOrig()); | |
| 37 | + * eqxRaw.setCtype(EQXMsg.TEXTPLAIN); | |
| 38 | + * this.eqxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)) | |
| 39 | + * ; this.eqxState = AFState.IDLE; } else { | |
| 40 | + * | |
| 41 | + * } } | |
| 42 | + */ | |
| 43 | + | |
| 44 | + EQXRawInstance eqxRaw = new EQXRawInstance(); | |
| 45 | + eqxRaw.setMessage("B Res."); | |
| 46 | + eqxRaw.setTo(eqxRawData.getOrig()); | |
| 47 | + eqxRaw.setCtype(EQXMsg.TEXTPLAIN); | |
| 48 | + this.eqxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw,eqxRawData.getInvoke())); | |
| 49 | + this.eqxState = AFState.END; | |
| 50 | + | |
| 44 | 51 | } |
| 45 | 52 | ec02Ins.setEqxRawDataList(this.eqxRawDataList); |
| 46 | 53 | return this.eqxState; | ... | ... |