Produced by Araxis Merge on 5/25/2018 9:21:42 AM Central 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 | C:\AraxisMergeCompare\Pri_un\ZIP\DSM-cif\Direct Implementation\java\dns\src\main\java\org\nhindirect\dns\config | WSDNSServerConfig.java | Tue May 22 13:40:36 2018 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\ZIP\DSM-cif\Direct Implementation\java\dns\src\main\java\org\nhindirect\dns\config | WSDNSServerConfig.java | Wed May 23 17:13:45 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 272 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| 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 | /* | |
| 2 | Copyright (c) 2010, Direct Pr oject | |
| 3 | All right s reserved . | |
| 4 | ||
| 5 | Authors: | |
| 6 | Greg M eyer gm2552@cer ner.com | |
| 7 | ||
| 8 | Redistribu tion and u se in sour ce and bin ary forms, with or w ithout mod ification, are permi tted provi ded that t he followi ng conditi ons are me t: | |
| 9 | ||
| 10 | Redistribu tions of s ource code must reta in the abo ve copyrig ht notice, this list of condit ions and t he followi ng disclai mer. | |
| 11 | Redistribu tions in b inary form must repr oduce the above copy right noti ce, this l ist of con ditions an d the foll owing disc laimer in the docume ntation an d/or other materials provided with the d istributio n. | |
| 12 | Neither th e name of The Direct Project ( directproj ect.org) n or the nam es of its contributo rs may be used to en dorse or p romote pro ducts deri ved from t his softwa re without specific prior writ ten permis sion. | |
| 13 | THIS SOFTW ARE IS PRO VIDED BY T HE COPYRIG HT HOLDERS AND CONTR IBUTORS "A S IS" AND ANY EXPRES S OR IMPLI ED WARRANT IES, INCLU DING, BUT NOT LIMITE D TO, THE IMPLIED WA RRANTIES O F MERCHANT ABILITY AN D FITNESS FOR A PART ICULAR PUR POSE ARE D ISCLAIMED. IN NO EVE NT SHALL T HE COPYRIG HT HOLDER OR CONTRIB UTORS BE L IABLE FOR ANY DIRECT , INDIRECT , INCIDENT AL, SPECIA L, EXEMPLA RY, OR CON SEQUENTIAL DAMAGES ( INCLUDING, BUT NOT L IMITED TO, PROCUREME NT OF SUBS TITUTE GOO DS OR SERV ICES; LOSS OF USE, D ATA, OR PR OFITS; OR BUSINESS I NTERRUPTIO N) HOWEVER CAUSED AN D ON ANY T HEORY OF L IABILITY, WHETHER IN CONTRACT, STRICT LI ABILITY, O R TORT (IN CLUDING NE GLIGENCE O R OTHERWIS E) ARISING IN ANY WA Y OUT OF T HE USE OF THIS SOFTW ARE, EVEN IF ADVISED OF THE PO SSIBILITY OF SUCH DA MAGE. | |
| 14 | */ | |
| 15 | ||
| 16 | package or g.nhindire ct.dns.con fig; | |
| 17 | ||
| 18 | import jav a.net.URL; | |
| 19 | ||
| 20 | import org .apache.co mmons.logg ing.Log; | |
| 21 | import org .apache.co mmons.logg ing.LogFac tory; | |
| 22 | import org .nhind.con fig.Config urationSer viceProxy; | |
| 23 | import org .nhind.con fig.Settin g; | |
| 24 | import org .nhindirec t.dns.DNSS erverSetti ngs; | |
| 25 | import org .nhindirec t.dns.DNSS tore; | |
| 26 | import org .nhindirec t.dns.modu le.DNSServ erModule; | |
| 27 | import org .nhindirec t.dns.prov ider.Basic DNSServerS ettingsPro vider; | |
| 28 | import org .nhindirec t.dns.prov ider.Confi gServiceDN SStoreProv ider; | |
| 29 | ||
| 30 | import com .google.in ject.Guice ; | |
| 31 | import com .google.in ject.Injec tor; | |
| 32 | import com .google.in ject.Provi der; | |
| 33 | ||
| 34 | /** | |
| 35 | * Loads D NS server configurat ion settin gs from th e configur ation serv ice to cre ate the in jector. | |
| 36 | * @author Greg Meye r | |
| 37 | * | |
| 38 | * @since 1.0 | |
| 39 | */ | |
| 40 | public cla ss WSDNSSe rverConfig implement s DNSServe rConfig | |
| 41 | { | |
| 42 | pr ivate stat ic final L og LOGGER = LogFacto ry.getFact ory().getI nstance(WS DNSServerC onfig.clas s); | |
| 43 | ||
| 44 | pr ivate stat ic final S tring DNS_ SERVER_BIN DING = "DN SServerBin dings"; | |
| 45 | pr ivate stat ic final S tring DNS_ SERVER_POR T = "DNSSe rverPort"; | |
| 46 | ||
| 47 | pr ivate Prov ider<DNSSt ore> store Provider; | |
| 48 | pr ivate Prov ider<DNSSe rverSettin gs> settin gs; | |
| 49 | ||
| 50 | ||
| 51 | pr ivate fina l Configur ationServi ceProxy cf Service; | |
| 52 | pr ivate fina l URL conf igServiceL ocation; | |
| 53 | ||
| 54 | /* * | |
| 55 | * Construct and confi guration c omponent w ith the lo cation of the config uration fi le and an optional p rovider fo r creating | |
| 56 | * instances of the DN SServer. | |
| 57 | * @param co nfigFile T he full pa th of the XML config uration fi le. | |
| 58 | * @param st oreProvide r An optio n provider used for creating i nstances o f the {@li nk DNSStor e}. If th e provider is | |
| 59 | * null, a d efault pro vider is u sed. | |
| 60 | * / | |
| 61 | pu blic WSDNS ServerConf ig(URL con figService Location, Provider<D NSStore> s toreProvid er, Provid er<DNSServ erSettings > settings ) | |
| 62 | { | |
| 63 | this .storeProv ider = sto reProvider ; | |
| 64 | this .configSer viceLocati on = confi gServiceLo cation; | |
| 65 | this .settings = settings ; | |
| 66 | ||
| 67 | cfSe rvice = ne w Configur ationServi ceProxy(co nfigServic eLocation. toExternal Form()); | |
| 68 | } | |
| 69 | ||
| 70 | /* * | |
| 71 | * {@inherit Doc} | |
| 72 | * / | |
| 73 | @O verride | |
| 74 | pu blic Injec tor getSer verInjecto r() | |
| 75 | { | |
| 76 | LOGG ER.info("L ooking up DNS server configura tion info from locat ion " + co nfigServic eLocation. toExternal Form()); | |
| 77 | ||
| 78 | Prov ider<DNSSe rverSettin gs> settin gsProv = g etServerSe ttings(); | |
| 79 | ||
| 80 | if ( storeProvi der == nul l) | |
| 81 | storeP rovider = new Config ServiceDNS StoreProvi der(config ServiceLoc ation); | |
| 82 | ||
| 83 | DNSS erverModul e module = DNSServer Module.cre ate(storeP rovider, s ettingsPro v); | |
| 84 | ||
| 85 | retu rn Guice.c reateInjec tor(module ); | |
| 86 | } | |
| 87 | ||
| 88 | /* | |
| 89 | * Just use the basic settings p rovider fo r now. Wi ll only al low settin g the port and IP bi ndings. | |
| 90 | * / | |
| 91 | pr ivate Prov ider<DNSSe rverSettin gs> getSer verSetting s() | |
| 92 | { | |
| 93 | Stri ng ipBindi ngs = ""; | |
| 94 | int port = PORT ; | |
| 95 | ||
| 96 | try | |
| 97 | { | |
| 98 | Settin g[] settin gs = cfSer vice.getSe ttingsByNa mes(new St ring[] {DN S_SERVER_B INDING, DN S_SERVER_P ORT}); | |
| 99 | ||
| 100 | if (se ttings != null && se ttings.len gth > 0) | |
| 101 | { | |
| 102 | for (Set ting setti ng : setti ngs) | |
| 103 | { | |
| 104 | if (settin g.getName( ).equalsIg noreCase(D NS_SERVER_ BINDING)) | |
| 105 | { | |
| 106 | ip Bindings = setting.g etValue(); | |
| 107 | } | |
| 108 | else if (s etting.get Name().equ alsIgnoreC ase(DNS_SE RVER_PORT) ) | |
| 109 | { | |
| 110 | St ring sPort = setting .getValue( ); | |
| 111 | tr y | |
| 112 | { | |
| 113 | port = Integer .parseInt( sPort); | |
| 114 | } | |
| 115 | ca tch (Excep tion e) | |
| 116 | { | |
| 117 | LOGG ER.warn("C ould not p arse port setting " + port + " from conf iguration service"); | |
| 118 | } | |
| 119 | } | |
| 120 | } | |
| 121 | } | |
| 122 | } | |
| 123 | catc h (Excepti on e) | |
| 124 | { | |
| 125 | LOGGER .warn("Cou ld not get DNS setti ng from we b service. "); | |
| 126 | } | |
| 127 | ||
| 128 | if ( (ipBinding s == null || ipBindi ngs.length () == 0) & & port == 0 && setti ngs != nul l) | |
| 129 | { | |
| 130 | LOGGER .info("Usi ng DNS ser ver settin gs from in jected pro vider."); | |
| 131 | return settings; | |
| 132 | } | |
| 133 | ||
| 134 | LOGG ER.info("U sing DNS s erver sett ings from configurat ion servic e."); | |
| 135 | retu rn new Bas icDNSServe rSettingsP rovider(ip Bindings, port); | |
| 136 | } | |
| 137 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.