Пример #1
0
        //public ILog log;
        public MySession()
        {
            _mdwsConfig = new MdwsConfiguration();
            _defaultVisitMethod = _mdwsConfig.AllConfigs[MdwsConfigConstants.MDWS_CONFIG_SECTION][MdwsConfigConstants.DEFAULT_VISIT_METHOD];
            _defaultPermissionString = _mdwsConfig.AllConfigs[MdwsConfigConstants.MDWS_CONFIG_SECTION][MdwsConfigConstants.DEFAULT_CONTEXT];

            try
            {
                _siteTable = new mdo.SiteTable(_mdwsConfig.ResourcesPath + "xml\\" + _mdwsConfig.FacadeConfiguration.SitesFileName);
            }
            catch (Exception) { /* SiteTable is going to be null - how do we let the user know?? */ }
        }
Пример #2
0
        /// <summary>
        /// Every client application requesting a MDWS session (invokes a function with EnableSession = True attribute) passes
        /// through this point. Fetches facade configuration settings and sets up session for subsequent calls
        /// </summary>
        /// <param name="facadeName">The facade name being invoked (e.g. EmrSvc)</param>
        /// <exception cref="System.Configuration.ConfigurationErrorsException" />
        public MySession(string facadeName)
        {
            this._facadeName = facadeName;
            _mdwsConfig = new MdwsConfiguration(facadeName);
            _defaultVisitMethod = _mdwsConfig.AllConfigs[MdwsConfigConstants.MDWS_CONFIG_SECTION][MdwsConfigConstants.DEFAULT_VISIT_METHOD];
            _defaultPermissionString = _mdwsConfig.AllConfigs[MdwsConfigConstants.MDWS_CONFIG_SECTION][MdwsConfigConstants.DEFAULT_CONTEXT];
            _excludeSite200 = String.Equals("true", _mdwsConfig.AllConfigs[MdwsConfigConstants.MDWS_CONFIG_SECTION][MdwsConfigConstants.EXCLUDE_SITE_200],
                StringComparison.CurrentCultureIgnoreCase);

            try
            {
                _siteTable = new mdo.SiteTable(_mdwsConfig.ResourcesPath + "xml\\" + _mdwsConfig.FacadeConfiguration.SitesFileName);
                watchSitesFile(_mdwsConfig.ResourcesPath + "xml\\");
            }
            catch (Exception) { /* SiteTable is going to be null - how do we let the user know?? */ }
        }
Пример #3
0
 /// <summary>
 /// Allow a client application to specifiy their sites file by name
 /// </summary>
 /// <param name="sitesFileName">The name of the sites file</param>
 /// <returns>SiteArray of parsed sites file</returns>
 public SiteArray setSites(string sitesFileName)
 {
     SiteArray result = new SiteArray();
     try
     {
         _siteTable = new mdo.SiteTable(_mdwsConfig.ResourcesPath + "xml\\" + sitesFileName);
         _mdwsConfig.FacadeConfiguration.SitesFileName = sitesFileName;
         watchSitesFile(_mdwsConfig.ResourcesPath + "xml\\");
         result = new SiteArray(_siteTable.Sites);
     }
     catch (Exception)
     {
         result.fault = new FaultTO("A sites file with that name does not exist on the server!");
     }
     return result;
 }
Пример #4
0
 void watcher_Changed(object sender, FileSystemEventArgs e)
 {
     _siteTable = new SiteTable(_mdwsConfig.ResourcesPath + "xml\\" + _mdwsConfig.FacadeConfiguration.SitesFileName);
 }
Пример #5
0
        public static Site[] parseSiteList(SiteTable siteTable, String siteList)
        {
            if (siteList == null || siteList == "")
            {
                throw new ArgumentException("Invalid sitelist: no sites specified");
            }
            ArrayList lst = new ArrayList();
            if (siteList == "*")
            {
                IEnumerator e = siteTable.Sites.Values.GetEnumerator();
                while (e.MoveNext())
                {
                    lst.Add((Site)e.Current);
                }
                return (Site[])lst.ToArray(typeof(Site));
            }

            siteList = siteList.ToUpper();
            String[] items = StringUtils.split(siteList, StringUtils.COMMA);
            Hashtable siteIds = new Hashtable();
            for (int i = 0; i < items.Length; i++)
            {
                items[i] = items[i].Trim();
                if (items[i] == "*")
                {
                    throw new ArgumentException("Invalid sitelist: * must be only arg");
                }
                else if (items[i][0] == 'V')
                {
                    Region visn = siteTable.getRegion(items[i].Substring(1));
                    if (visn == null)
                    {
                        throw new ArgumentException("Invalid sitelist: invalid VISN: " + visn);
                    }
                    ArrayList sites = visn.Sites;
                    for (int j = 0; j < sites.Count; j++)
                    {
                        lst.Add((Site)sites[j]);
                    }
                }
                else
                {
                    Site site = siteTable.getSite(items[i]);
                    if (site == null)
                    {
                        throw new ArgumentException("Invalid sitelist: nonexistent sitecode: " + items[i]);
                    }
                    if (siteIds.ContainsKey(items[i]))   // duplicate sitecode - skip it
                    {
                        throw new ArgumentException("Invalid sitelist: duplicate sitecode: " + items[i]);
                    }
                    lst.Add(siteTable.getSite(items[i]));
                    siteIds.Add(items[i], "");
                }
            }
            return (Site[])lst.ToArray(typeof(Site));
        }