Produced by Araxis Merge on 6/9/2017 3:51:23 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Jun 9 19:51:23 2017 UTC | ||
| 2 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-svc-notification\src\archive\java\gov\va\nvap\notification\jmsutilities | VapJMSListener.java | Fri Apr 21 20:03:30 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 144 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package go v.va.nvap. notificati on.jmsutil ities; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.n otificatio n.interfac es.VapList ener; | |||||
| 4 | ||||||
| 5 | import jav a.io.ByteA rrayInputS tream; | |||||
| 6 | import jav a.io.IOExc eption; | |||||
| 7 | import jav a.io.Objec tInputStre am; | |||||
| 8 | import jav a.io.Seria lizable; | |||||
| 9 | import jav a.util.Has hSet; | |||||
| 10 | import jav a.util.Obs ervable; | |||||
| 11 | import jav a.util.Obs erver; | |||||
| 12 | import jav a.util.Set ; | |||||
| 13 | import jav a.util.Str ingTokeniz er; | |||||
| 14 | ||||||
| 15 | import jav ax.jms.JMS Exception; | |||||
| 16 | import jav ax.jms.Map Message; | |||||
| 17 | ||||||
| 18 | import org .apache.co mmons.logg ing.Log; | |||||
| 19 | import org .apache.co mmons.logg ing.LogFac tory; | |||||
| 20 | import org .springfra mework.bea ns.factory .annotatio n.Required ; | |||||
| 21 | import org .springfra mework.jms .core.JmsT emplate; | |||||
| 22 | ||||||
| 23 | public abs tract clas s VapJMSLi stener imp lements Ob server, Va pListener { | |||||
| 24 | ||||||
| 25 | pr otected Jm sTemplate jmsTemplat e; | |||||
| 26 | pr otected Se t<String> subIdentif iers = new HashSet<S tring>(); | |||||
| 27 | St ring ident ifierKey = "identifi ers"; // i nject with spring if | |||||
| 28 | St ring objec tKey = "ob ject";// i nject with spring if desired | |||||
| 29 | St ring xmlKe y = "xml"; // inject with sprin g if desir ed | |||||
| 30 | St ring trigg er = "trig ger";// in ject with spring if desired | |||||
| 31 | pr ivate VapT riggerEven t triggerE vent; | |||||
| 32 | ||||||
| 33 | pr ivate stat ic final L og LOG = L ogFactory. getLog(Vap JMSListene r.class); | |||||
| 34 | ||||||
| 35 | @O verride | |||||
| 36 | pu blic void update(Obs ervable md b, Object jmsMessage ) { | |||||
| 37 | if ( jmsMessage instanceo f MapMessa ge) { | |||||
| 38 | MapMes sage m = ( MapMessage ) jmsMessa ge; | |||||
| 39 | Set<Se rializable > clone = new HashSe t<Serializ able>(subI dentifiers ); | |||||
| 40 | try { | |||||
| 41 | clone.re tainAll(CS VToSet(m.g etString(i dentifierK ey))); | |||||
| 42 | } catc h (JMSExce ption e) { | |||||
| 43 | throw ne w RuntimeE xception(e );// motiv ate a retr y | |||||
| 44 | } | |||||
| 45 | if (!c lone.isEmp ty()) { | |||||
| 46 | try { | |||||
| 47 | if(m.prope rtyExists( trigger)) { | |||||
| 48 | tr y { | |||||
| 49 | trig gerEvent = VapTrigge rEvent.val ueOf(m.get StringProp erty(trigg er)); | |||||
| 50 | } catch (Ill egalArgume ntExceptio n e) { | |||||
| 51 | LOG. error("A v ap develop er put a s tring that does not map to " + VapTrigge rEvent.cla ss +" -- t he propert y key is " + trigger , e); | |||||
| 52 | } | |||||
| 53 | } | |||||
| 54 | } catch (JMSExcept ion e) { | |||||
| 55 | LOG.warn(" The motiva ting VapTr iggerEvent could not be pulled . Reason = " + e.ge tErrorCode ()); | |||||
| 56 | } | |||||
| 57 | this.onM essage(m); | |||||
| 58 | } | |||||
| 59 | } | |||||
| 60 | } | |||||
| 61 | ||||||
| 62 | pu blic void setIdentif ierKey(Str ing identi fierKey) { | |||||
| 63 | this .identifie rKey = ide ntifierKey ; | |||||
| 64 | } | |||||
| 65 | ||||||
| 66 | pu blic void setObjectK ey(String objectKey) { | |||||
| 67 | this .objectKey = objectK ey; | |||||
| 68 | } | |||||
| 69 | ||||||
| 70 | pu blic void setTrigger (String tr igger) { | |||||
| 71 | this .trigger = trigger; | |||||
| 72 | } | |||||
| 73 | ||||||
| 74 | pu blic void setXmlKey( String xml Key) { | |||||
| 75 | this .xmlKey = xmlKey; | |||||
| 76 | } | |||||
| 77 | ||||||
| 78 | @R equired | |||||
| 79 | pu blic void setJmsTemp late(final JmsTempla te jmsTemp late) { | |||||
| 80 | this .jmsTempla te = jmsTe mplate; | |||||
| 81 | } | |||||
| 82 | ||||||
| 83 | pr otected Va pTriggerEv ent getTri gger() { | |||||
| 84 | retu rn trigger Event; | |||||
| 85 | } | |||||
| 86 | ||||||
| 87 | pr otected Se rializable getObject Message(Ma pMessage m ) { | |||||
| 88 | Seri alizable r Val = null ; | |||||
| 89 | try { | |||||
| 90 | if (m. itemExists (objectKey )) { | |||||
| 91 | byte[] b = m.getBy tes(object Key); | |||||
| 92 | ByteArra yInputStre am bis = n ew ByteArr ayInputStr eam(b); | |||||
| 93 | ObjectIn putStream in = new O bjectInput Stream(bis ); | |||||
| 94 | rVal = ( Serializab le) in.rea dObject(); | |||||
| 95 | bis.clos e(); | |||||
| 96 | in.close (); | |||||
| 97 | } | |||||
| 98 | } ca tch (IOExc eption e) { | |||||
| 99 | LOG.wa rn( | |||||
| 100 | "An error occurred t rying to d eserialize an object . Message might be replayed." , | |||||
| 101 | e); | |||||
| 102 | throw new Runtim eException (e);// mot ivate a re try | |||||
| 103 | } ca tch (JMSEx ception e) { | |||||
| 104 | LOG.wa rn( | |||||
| 105 | "A JMS exc eption occ ured while trying to pull data from the object mes sage. Err or code = " | |||||
| 106 | + e. getErrorCo de() + ". Message mi ght be rep layed.", e ); | |||||
| 107 | throw new Runtim eException (e);// mot ivate a re try | |||||
| 108 | } ca tch (Class NotFoundEx ception e) { | |||||
| 109 | LOG.er ror( | |||||
| 110 | "There is a configur ation erro r in VAP. Is this Va pJMSListen er is list ening to t he right d estination ?", e); | |||||
| 111 | e.prin tStackTrac e(); | |||||
| 112 | } | |||||
| 113 | retu rn rVal; | |||||
| 114 | } | |||||
| 115 | ||||||
| 116 | pu blic void setSubMess ageIdentif iers(Set<S tring> ide ntifier) { | |||||
| 117 | this .subIdenti fiers = id entifier; | |||||
| 118 | } | |||||
| 119 | ||||||
| 120 | pr otected St ring getXM LMessage(M apMessage m) { | |||||
| 121 | Stri ng rVal = null; | |||||
| 122 | try { | |||||
| 123 | if (m. itemExists (xmlKey)) { | |||||
| 124 | rVal = m .getString (xmlKey); | |||||
| 125 | } | |||||
| 126 | } ca tch (JMSEx ception e) { | |||||
| 127 | LOG.wa rn( | |||||
| 128 | "A JMS exc eption occ ured while trying to pull data from the xml/text m essage. E rror code = " | |||||
| 129 | + e. getErrorCo de() + ". Message mi ght be rep layed.", | |||||
| 130 | e); | |||||
| 131 | throw new Runtim eException (e);// mot ivate a re try | |||||
| 132 | } | |||||
| 133 | retu rn rVal; | |||||
| 134 | } | |||||
| 135 | ||||||
| 136 | st atic Set<S tring> CSV ToSet(Stri ng csv) { | |||||
| 137 | Stri ngTokenize r t = new StringToke nizer(csv, ","); | |||||
| 138 | Set< String> s = new Hash Set<String >(); | |||||
| 139 | whil e (t.hasMo reElements ()) { | |||||
| 140 | s.add( t.nextToke n()); | |||||
| 141 | } | |||||
| 142 | retu rn s; | |||||
| 143 | } | |||||
| 144 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.