/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package gov.hhs.fha.nhinc.subscription.dte; import gov.hhs.fha.nhinc.common.subscription.CommunityType; import gov.hhs.fha.nhinc.properties.PropertyAccessException; import gov.hhs.fha.nhinc.properties.PropertyAccessor; import gov.hhs.fha.nhinc.subscription.*; /** * * @author rayj */ public class Configuration { private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Configuration.class); public static CommunityType getMyCommunity() { CommunityType myCommunity = new CommunityType(); myCommunity.setId(getMyCommunityId()); myCommunity.setName(getMyCommunityName()); return myCommunity; } public static String getMyCommunityId() { return getSetting("gateway", "localHomeCommunityId"); } public static String getMyCommunityName() { return getSetting("gateway", "localHomeCommunityDescription"); } public static String getlocalNotificationConsumerEndpointAddress() { log.info("### Retriving NotificationConsumerEndpointAddress"); return getSetting("gateway", "NotificationConsumerEndpointAddress"); } private static String getSetting(String propertyFile, String propertyName) { String setting = ""; try { log.info("looking up " + propertyFile + "." + propertyName); setting = PropertyAccessor.getProperty(propertyFile, propertyName); log.info(propertyFile + "." + propertyName + "=" + setting); } catch (PropertyAccessException ex) { log.error("Exception while reading property " + propertyFile + "." + propertyName + " from property file [" + ex.getMessage() + "]"); } return setting; } }