public IndexedHashtable connect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource) { permission.IsPrimary = true; QueryTemplate qt = new ConnectQuery(this); if (validationDataSource == null) { validationDataSource = new DataSource(); } qt.QueryMethod("AbstractConnection", "authorizedConnect", new object[] { credentials, permission, validationDataSource }); IndexedHashtable t = buildResults(); // KLUGE: This is here to make the number of connections come out right. // Note that the first element in the table will be a connection, but // the rest either User or Exception. if (HasBaseConnection && myResults.Count < myCxns.Count) { IndexedHashtable t2 = new IndexedHashtable(myCxns.Count); t2.Add(BaseConnection.DataSource.SiteId.Id, BaseConnection); for (int i = 0; i < t.Count; i++) { t2.Add(t.GetKey(i), t.GetValue(i)); } t = t2; } return(t); }
public IndexedHashtable connect() { int lth = cxnTbl.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTbl.GetValue(i), "connect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTbl.GetKey(i); threads[i].Join(); //Need to report result whether it's a connection or an exception. if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); Connection cxn = (Connection)cxnTbl.GetValue(i); cxn.ErrorMessage = ((Exception)queries[i].Result).Message; cxn.IsConnected = false; } else { result.Add(key, ((Connection)cxnTbl.GetValue(key)).DataSource); } } return(result); }
public IndexedHashtable disconnect() { int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTable.GetValue(i), "disconnect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTable.GetKey(i); threads[i].Join(); if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, "OK"); } } cxnTable.Clear(); return(result); }
public static IndexedHashtable execute2(IndexedHashtable cxnTable, string daoName, string methodName, Object[] args) { if (cxnTable == null || cxnTable.Count == 0) { throw new Exception("No connections!"); } int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { continue; } Connection cxn = (Connection)cxnTable.GetValue(i); if (!cxn.IsConnected) { continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); if (dao == null) { continue; } queries[i] = new QueryThread(dao, methodName, args); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(cxnTable.Count); for (int i = 0; i < threads.Length; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { result.Add((string)cxnTable.GetKey(i), (Exception)cxnTable.GetValue(i)); continue; } Connection cxn = (Connection)cxnTable.GetValue(i); if (!cxn.IsConnected) { result.Add((string)cxnTable.GetKey(i), new Exception("Source is not connected")); continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); if (dao == null) { result.Add((string)cxnTable.GetKey(i), new Exception("Invalid dao: " + daoName)); continue; } threads[i].Join(); result.Add((String)cxnTable.GetKey(i), queries[i].Result); } return(result); }
public void addConnections(DataSource[] sources) { for (int i = 0; i < sources.Length; i++) { if (cxnTable.ContainsKey(sources[i].SiteId.Key)) { continue; } int protocol = DaoFactory.getConstant(sources[i].Protocol); DaoFactory daoFactory = DaoFactory.getDaoFactory(protocol); cxnTable.Add(sources[i].SiteId.Key, daoFactory.getConnection(sources[i])); } }
public void addConnection(Connection cxn) { if (cxnTbl == null) { cxnTbl = new IndexedHashtable(); this.modality = cxn.DataSource.Modality; } checkModality(cxn); if (!cxnTbl.ContainsKey(cxn.DataSource.SiteId.Id)) { cxnTbl.Add(cxn.SiteId.Key, cxn); } }
public TaggedFaultArray(IndexedHashtable ihs) { if (ihs == null || ihs.Count == 0) { return; } IList <TaggedFault> temp = new List <TaggedFault>(); for (int i = 0; i < ihs.Count; i++) { if (MdwsUtils.isException(ihs.GetValue(i))) { temp.Add(new TaggedFault((string)ihs.GetKey(i), (Exception)ihs.GetValue(i))); } } if (temp.Count > 0) { // we want to remove the exceptions from the hashtable because, in container objects, the constructors // for each of the property objects handle exception info. we need to keep the tag though so results collections are consistent foreach (TaggedFault tf in temp) { ihs.Remove(tf.tag); ihs.Add(tf.tag, null); } faults = new TaggedFault[temp.Count]; temp.CopyTo(faults, 0); } }
private IndexedHashtable mergeNotesAndDischargeSummaries(IndexedHashtable tNotes, IndexedHashtable tSummaries) { if (tNotes == null) { return(tSummaries); } if (tSummaries == null) { return(tNotes); } IndexedHashtable result = new IndexedHashtable(tNotes.Count + tSummaries.Count); for (int i = 0; i < tNotes.Count; i++) { Note[] notes = (Note[])tNotes.GetValue(i); int notesLength = (notes == null ? 0 : notes.Length); string key = (string)tNotes.GetKey(i); Note[] summaries = (Note[])tSummaries.GetValue(key); int summariesLength = (summaries == null ? 0 : summaries.Length); ArrayList lst = new ArrayList(notesLength + summariesLength); for (int j = 0; j < notesLength; j++) { lst.Add(notes[j]); } for (int j = 0; j < summariesLength; j++) { lst.Add(summaries[j]); } result.Add(key, (Note[])lst.ToArray(typeof(Note))); } return(result); }
public TaggedTextArray getNoteTitles(string sitecode, string target, string direction) { TaggedTextArray result = new TaggedTextArray(); string msg = MdwsUtils.isAuthorizedConnection(_mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } if (sitecode == null) { sitecode = _mySession.ConnectionSet.BaseSiteId; } if (direction == "") { direction = "1"; } try { AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode); Dictionary <string, ArrayList> x = _api.getNoteTitles(cxn, target, direction); IndexedHashtable t = new IndexedHashtable(); t.Add(sitecode, x); result = new TaggedTextArray(t); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
internal IndexedHashtable toChemHemSpecimens(string[] response, ref string fromDate, ref string toDate) { IndexedHashtable result = new IndexedHashtable(response.Length); for (int i = 0; i < response.Length; i++) { string[] flds = StringUtils.split(response[i], StringUtils.CARET); LabSpecimen specimen = new LabSpecimen(); specimen.Id = flds[0]; specimen.ReportDate = VistaTimestamp.toUtcString(flds[2]); specimen.CollectionDate = VistaTimestamp.toUtcString(flds[1]); if (i == 0) { fromDate = specimen.CollectionDate; } if (i == response.Length - 1) { toDate = specimen.CollectionDate; } specimen.Name = flds[3]; specimen.AccessionNumber = flds[4]; if (flds.Length > 6) { specimen.Site = flds[5]; } if (flds.Length > 7) { specimen.Facility = new SiteId(flds[7], flds[6]); } string key = flds[1] + '^' + flds[4]; result.Add(key, specimen); } return(result); }
public IndexedHashtable connect() { int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTable.GetValue(i), "connect", new Object[0]); //queries[i].execute(); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTable.GetKey(i); threads[i].Join(); //Need to report result whether it's a connection or an exception. if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, ((Connection)cxnTable.GetValue(key)).DataSource); } } //Now for all the results that failed to connect, we remove them from the connection table. for (int i = 0; i < lth; i++) { if (queries[i].isExceptionResult()) { string key = (string)cxnTable.GetKey(i); cxnTable.Remove(key); cxnTable.Add(key, queries[i].Result); } } return(result); }
public IndexedHashtable disconnectRemoteSites() { if (cxnTbl.Count < 2) { throw new Exception("No remote connections"); } // Only disconnect from the ones that are connected IndexedHashtable myCxns = getConnections(); int lth = myCxns.Count - 1; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int threadIdx = 0, cxnIdx = 1; threadIdx < lth; threadIdx++, cxnIdx++) { queries[threadIdx] = new QueryThread(myCxns.GetValue(cxnIdx), "disconnect", new Object[0]); threads[threadIdx] = new Thread(new ThreadStart(queries[threadIdx].execute)); threads[threadIdx].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int threadIdx = 0, cxnIdx = 1; threadIdx < lth; threadIdx++, cxnIdx++) { string key = (string)myCxns.GetKey(cxnIdx); threads[threadIdx].Join(); if (queries[threadIdx].isExceptionResult()) { result.Add(key, queries[threadIdx].Result); } else { result.Add(key, "OK"); } } // Now remove all but the logon connection from the table Connection loginCxn = LoginConnection; cxnTbl = new IndexedHashtable(); cxnTbl.Add(loginCxn.SiteId.Key, loginCxn); return(result); }
internal IndexedHashtable buildResults() { IndexedHashtable result = new IndexedHashtable(); if (myResults != null) { for (int i = 0; i < myResults.Count; i++) { result.Add(myResults.GetKey(i), myResults.GetValue(i)); } } if (myExceptions != null) { for (int i = 0; i < myExceptions.Count; i++) { result.Add(myExceptions.GetKey(i), myExceptions.GetValue(i)); } } return(result); }
public IndexedHashtable disconnect() { if (cxnTbl.Count == 0) { throw new Exception("No connections"); } // Only disconnect from the ones that are connected IndexedHashtable myCxns = getConnections(); int lth = myCxns.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(myCxns.GetValue(i), "disconnect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)myCxns.GetKey(i); threads[i].Join(); if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, "OK"); } } // We only disconnected from connected connections, but we want to clear // the entire table cxnTbl = new IndexedHashtable(); return(result); }
public IndexedHashtable execute(String daoName, String methodName, Object[] args) { int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); queries[i] = new QueryThread(dao, methodName, args); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(cxnTable.Count); for (int i = 0; i < threads.Length; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { result.Add((string)cxnTable.GetKey(i), (Exception)cxnTable.GetValue(i)); continue; } try { threads[i].Join(); result.Add((String)cxnTable.GetKey(i), queries[i].Result); } catch (Exception) { //throw new MdoException(e); } } return(result); }
internal IndexedHashtable removeDups(IndexedHashtable t) { IndexedHashtable result = new IndexedHashtable(); for (int i = 0; i < t.Count; i++) { string source = (string)t.GetKey(i); if (t.GetValue(i) == null) { result.Add(source, null); continue; } if (t.GetValue(i).GetType().Name.EndsWith("Exception")) { gov.va.medora.mdo.exceptions.MdoException e = new gov.va.medora.mdo.exceptions.MdoException( gov.va.medora.mdo.exceptions.MdoExceptionCode.DATA_INVALID, (Exception)t.GetValue(i)); result.Add(source, e); continue; } List <Person> persons = (List <Person>)t.GetValue(i); List <DemographicsRecord> rex = new List <DemographicsRecord>(persons.Count); Hashtable ht = new Hashtable(persons.Count); foreach (Person p in persons) { PersonTO pto = new PersonTO(p); DemographicsRecord rec = new DemographicsRecord(pto, source); long hashcode = new TOReflection.TOEqualizer(rec).HashCode; if (!ht.ContainsKey(hashcode)) { ht.Add(hashcode, rec); rex.Add(rec); } } result.Add(source, rex); } return(result); }
IndexedHashtable getConnections() { IndexedHashtable result = new IndexedHashtable(); for (int i = 0; i < cxnTbl.Count; i++) { Connection cxn = (Connection)cxnTbl.GetValue(i); if (cxn.IsConnected) { result.Add(cxn.SiteId.Key, cxn); } } if (result.Count == 0) { return(null); } return(result); }
public ZipcodeTO[] getCitiesInState(string stateAbbr) { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); ZipcodeTO[] result = new ZipcodeTO[1]; result[0] = new ZipcodeTO(); if (String.IsNullOrEmpty(stateAbbr)) { result[0].fault = new FaultTO("Missing state abbreviation"); } else if (stateAbbr.Length != 2) { result[0].fault = new FaultTO("Invalid state abbreviation", "Please supply a valid 2 letter abbreviation"); } if (result[0].fault != null) { return(result); } try { Zipcode[] zips = dao.getCitiesInState(stateAbbr); IndexedHashtable t = new IndexedHashtable(); for (int i = 0; i < zips.Length; i++) { if (!t.ContainsKey(zips[i].City)) { t.Add(zips[i].City, zips[i]); } } result = new ZipcodeTO[t.Count]; for (int i = 0; i < t.Count; i++) { result[i] = new ZipcodeTO((Zipcode)t.GetValue(i)); } } catch (Exception exc) { result[0].fault = new FaultTO(exc); } return(result); }
public IndexedHashtable connect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource) { permission.IsPrimary = true; QueryTemplate qt = new ConnectQuery(this); if (validationDataSource == null) { validationDataSource = new DataSource(); } qt.QueryMethod("AbstractConnection", "authorizedConnect", new object[] { credentials, permission, validationDataSource }); IndexedHashtable t = buildResults(); // KLUGE: This is here to make the number of connections come out right. // Note that the first element in the table will be a connection, but // the rest either User or Exception. if (HasBaseConnection && myResults.Count < myCxns.Count) { IndexedHashtable t2 = new IndexedHashtable(myCxns.Count); t2.Add(BaseConnection.DataSource.SiteId.Id, BaseConnection); for (int i = 0; i < t.Count; i++) { t2.Add(t.GetKey(i), t.GetValue(i)); } t = t2; } return t; }
public IndexedHashtable disconnectRemoteSites() { if (cxnTbl.Count < 2) { throw new Exception("No remote connections"); } // Only disconnect from the ones that are connected IndexedHashtable myCxns = getConnections(); int lth = myCxns.Count - 1; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int threadIdx = 0, cxnIdx = 1; threadIdx < lth; threadIdx++, cxnIdx++) { queries[threadIdx] = new QueryThread(myCxns.GetValue(cxnIdx), "disconnect", new Object[0]); threads[threadIdx] = new Thread(new ThreadStart(queries[threadIdx].execute)); threads[threadIdx].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int threadIdx = 0, cxnIdx = 1; threadIdx < lth; threadIdx++, cxnIdx++) { string key = (string)myCxns.GetKey(cxnIdx); threads[threadIdx].Join(); if (queries[threadIdx].isExceptionResult()) { result.Add(key, queries[threadIdx].Result); } else { result.Add(key, "OK"); } } // Now remove all but the logon connection from the table Connection loginCxn = LoginConnection; cxnTbl = new IndexedHashtable(); cxnTbl.Add(loginCxn.SiteId.Key, loginCxn); return result; }
IndexedHashtable getConnections() { IndexedHashtable result = new IndexedHashtable(); for (int i = 0; i < cxnTbl.Count; i++) { Connection cxn = (Connection)cxnTbl.GetValue(i); if (cxn.IsConnected) { result.Add(cxn.SiteId.Key, cxn); } } if (result.Count == 0) { return null; } return result; }
internal IndexedHashtable toUniqueCheckinIds(string[] response) { if (response == null || response.Length == 0) { return null; } IndexedHashtable t = new IndexedHashtable(response.Length); for (int i = 0; i < response.Length; i++) { if (String.IsNullOrEmpty(response[i])) { continue; // per http://trac.medora.va.gov/web/ticket/2713 - found a blank record in a test site. can't do anything with stay since can't locate checkin id } if (t.ContainsKey(response[i])) { continue; } t.Add(response[i], null); } return t; }
public IndexedHashtable connect() { int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTable.GetValue(i), "connect", new Object[0]); //queries[i].execute(); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTable.GetKey(i); threads[i].Join(); //Need to report result whether it's a connection or an exception. if (queries[i].isExceptionResult()) { result.Add(key,queries[i].Result); } else { result.Add(key,((Connection)cxnTable.GetValue(key)).DataSource); } } //Now for all the results that failed to connect, we remove them from the connection table. for (int i = 0; i < lth; i++) { if (queries[i].isExceptionResult()) { string key = (string)cxnTable.GetKey(i); cxnTable.Remove(key); cxnTable.Add(key, queries[i].Result); } } return result; }
public IndexedHashtable disconnectRemoteSites() { int lth = cxnTable.Count - 1; if (lth <= 0) { return null; } QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTable.GetValue(i+1), "disconnect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTable.GetKey(i + 1); threads[i].Join(); if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, "OK"); } } for (int i = 0; i < result.Count; i++) { cxnTable.Remove(result.GetKey(i)); } return result; }
internal IndexedHashtable toChemHemSpecimens(string[] response, ref string fromDate, ref string toDate) { IndexedHashtable result = new IndexedHashtable(response.Length); for (int i = 0; i < response.Length; i++) { string[] flds = StringUtils.split(response[i], StringUtils.CARET); LabSpecimen specimen = new LabSpecimen(); specimen.Id = flds[0]; specimen.ReportDate = VistaTimestamp.toUtcString(flds[2]); specimen.CollectionDate = VistaTimestamp.toUtcString(flds[1]); if (i == 0) { fromDate = specimen.CollectionDate; } if (i == response.Length-1) { toDate = specimen.CollectionDate; } specimen.Name = flds[3]; specimen.AccessionNumber = flds[4]; if (flds.Length > 6) { specimen.Site = flds[5]; } if (flds.Length > 7) { specimen.Facility = new SiteId(flds[7], flds[6]); } string key = flds[1] + '^' + flds[4]; result.Add(key, specimen); } return result; }
public IndexedHashtable execute(String daoName, String methodName, Object[] args) { int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); queries[i] = new QueryThread(dao, methodName, args); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(cxnTable.Count); for (int i=0; i<threads.Length; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { result.Add((string)cxnTable.GetKey(i),(Exception)cxnTable.GetValue(i)); continue; } try { threads[i].Join(); result.Add((String)cxnTable.GetKey(i), queries[i].Result); } catch (Exception) { //throw new MdoException(e); } } return result; }
public static IndexedHashtable execute2(IndexedHashtable cxnTable, string daoName, string methodName, Object[] args) { if (cxnTable == null || cxnTable.Count == 0) { throw new Exception("No connections!"); } int lth = cxnTable.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { continue; } Connection cxn = (Connection)cxnTable.GetValue(i); if (!cxn.IsConnected) { continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); if (dao == null) { continue; } queries[i] = new QueryThread(dao, methodName, args); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(cxnTable.Count); for (int i = 0; i < threads.Length; i++) { if (cxnTable.GetValue(i).GetType().IsAssignableFrom(typeof(Exception))) { result.Add((string)cxnTable.GetKey(i), (Exception)cxnTable.GetValue(i)); continue; } Connection cxn = (Connection)cxnTable.GetValue(i); if (!cxn.IsConnected) { result.Add((string)cxnTable.GetKey(i), new Exception("Source is not connected")); continue; } Object dao = ((Connection)cxnTable.GetValue(i)).getDao(daoName); if (dao == null) { result.Add((string)cxnTable.GetKey(i), new Exception("Invalid dao: " + daoName)); continue; } threads[i].Join(); result.Add((String)cxnTable.GetKey(i), queries[i].Result); } return result; }
public IndexedHashtable disconnect() { if (cxnTbl.Count == 0) { throw new Exception("No connections"); } // Only disconnect from the ones that are connected IndexedHashtable myCxns = getConnections(); int lth = myCxns.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(myCxns.GetValue(i), "disconnect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)myCxns.GetKey(i); threads[i].Join(); if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); } else { result.Add(key, "OK"); } } // We only disconnected from connected connections, but we want to clear // the entire table cxnTbl = new IndexedHashtable(); return result; }
internal IndexedHashtable buildResults() { IndexedHashtable result = new IndexedHashtable(); if (myResults != null) { for (int i = 0; i < myResults.Count; i++) { result.Add(myResults.GetKey(i), myResults.GetValue(i)); } } if (myExceptions != null) { for (int i = 0; i < myExceptions.Count; i++) { result.Add(myExceptions.GetKey(i), myExceptions.GetValue(i)); } } return result; }
internal IndexedHashtable toOrderHashtable(string response) { if (StringUtils.isEmpty(response)) { return null; } string[] lines = StringUtils.split(response, StringUtils.CRLF); IndexedHashtable t = new IndexedHashtable(lines.Length - 1); for (int i = 1; i < lines.Length; i++) { if (StringUtils.isEmpty(lines[i])) { continue; } string[] flds = StringUtils.split(lines[i], StringUtils.CARET); Order order = new Order(); order.Id = flds[0]; order.Timestamp = VistaTimestamp.toDateTime(flds[2]); t.Add(order.Id, order); } return t; }
public IndexedHashtable connect() { int lth = cxnTbl.Count; QueryThread[] queries = new QueryThread[lth]; Thread[] threads = new Thread[lth]; for (int i = 0; i < lth; i++) { queries[i] = new QueryThread(cxnTbl.GetValue(i), "connect", new Object[0]); threads[i] = new Thread(new ThreadStart(queries[i].execute)); threads[i].Start(); } IndexedHashtable result = new IndexedHashtable(lth); for (int i = 0; i < lth; i++) { string key = (string)cxnTbl.GetKey(i); threads[i].Join(); //Need to report result whether it's a connection or an exception. if (queries[i].isExceptionResult()) { result.Add(key, queries[i].Result); Connection cxn = (Connection)cxnTbl.GetValue(i); cxn.ErrorMessage = ((Exception)queries[i].Result).Message; cxn.IsConnected = false; } else { result.Add(key, ((Connection)cxnTbl.GetValue(key)).DataSource); } } return result; }