source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Gateway/SubscriptionDteEjb/src/java/gov/hhs/fha/nhinc/subscription/dte/Configuration.java@ 507

Last change on this file since 507 was 507, checked in by George Lilly, 15 years ago

NHIN gateway and adaptor for use on linux with VistA EHR and RPMS

File size: 1.8 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package gov.hhs.fha.nhinc.subscription.dte;
6
7import gov.hhs.fha.nhinc.common.subscription.CommunityType;
8import gov.hhs.fha.nhinc.properties.PropertyAccessException;
9import gov.hhs.fha.nhinc.properties.PropertyAccessor;
10import gov.hhs.fha.nhinc.subscription.*;
11
12/**
13 *
14 * @author rayj
15 */
16public class Configuration {
17
18 private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Configuration.class);
19
20 public static CommunityType getMyCommunity() {
21 CommunityType myCommunity = new CommunityType();
22 myCommunity.setId(getMyCommunityId());
23 myCommunity.setName(getMyCommunityName());
24 return myCommunity;
25 }
26
27 public static String getMyCommunityId() {
28 return getSetting("gateway", "localHomeCommunityId");
29 }
30
31 public static String getMyCommunityName() {
32 return getSetting("gateway", "localHomeCommunityDescription");
33 }
34
35 public static String getlocalNotificationConsumerEndpointAddress() {
36 log.info("### Retriving NotificationConsumerEndpointAddress");
37 return getSetting("gateway", "NotificationConsumerEndpointAddress");
38 }
39
40 private static String getSetting(String propertyFile, String propertyName) {
41 String setting = "";
42 try {
43 log.info("looking up " + propertyFile + "." + propertyName);
44 setting = PropertyAccessor.getProperty(propertyFile, propertyName);
45 log.info(propertyFile + "." + propertyName + "=" + setting);
46 } catch (PropertyAccessException ex) {
47 log.error("Exception while reading property " + propertyFile + "." + propertyName + " from property file [" + ex.getMessage() + "]");
48 }
49 return setting;
50 }
51}
Note: See TracBrowser for help on using the repository browser.