List of usage examples for java.util Vector Vector
public Vector()
From source file:eu.xipi.bro4xipi.resourceadvisor.ResourceAdvisor.java
/** * Will create a new resource advisor. It will start calculating offered plans based on requested services in the RequestedFederationScenario * @param Broker b {@link Broker }/* ww w . j a va 2 s . c o m*/ * @param RequestedFederationScenario sourceFedScenario selected from XiPi portlet * @param BrokerJpaController brokerJpaController */ public ResourceAdvisor(Broker b, RequestedFederationScenario sourceFedScenario, BrokerJpaController brokerJpaController) { this.broker = b; this.sourceFedScenario = sourceFedScenario; this.brokerJpaController = brokerJpaController; offeredPlans = new Vector<OfferedPlan>(); }
From source file:edu.ku.brc.af.ui.weblink.WebLinkMgr.java
/** * Protected Constructor */ protected WebLinkMgr() { webLinkDefs = new Vector<WebLinkDef>(); }
From source file:IDlook.java
private void loadAccounts() { Vector v = new Vector(); try {/*from www .j av a 2 s .c o m*/ rs = statement.executeQuery("SELECT * FROM thumbnail"); while (rs.next()) { v.addElement(rs.getString("acc_id")); } } catch (SQLException e) { displaySQLErrors(e); } accountNumberList.setListData(v); }
From source file:com.jones_systems.Tieout.java
/** * Creates a new Tieout object/* www . j av a 2s . com*/ * * @param tieoutFile the file containing the XML for the tests * */ public Tieout(File tieoutFile) { connections = new Hashtable<String, TieoutConnection>(); varsets = new Hashtable<String, TieoutVariableSet>(); tests = new Vector<TieoutTest>(); Document doc = null; SAXBuilder sb = new SAXBuilder(); try { doc = sb.build(tieoutFile); } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Element root = doc.getRootElement(); Element connections1 = root.getChild("connections"); @SuppressWarnings("unchecked") List<Element> connections2 = connections1.getChildren(); // Load all of the connections // each Element e will be a <connection> thing for (Element e : connections2) { connections.put(e.getAttributeValue("id"), TieoutConnection.create(e)); } Element readvarsets = root.getChild("variables"); @SuppressWarnings("unchecked") List<Element> readvarsets2 = readvarsets.getChildren(); for (Element e : readvarsets2) { String varsetkey = e.getAttributeValue("id"); @SuppressWarnings("unchecked") List<Element> variables = e.getChildren(); TieoutVariableSet tvs = new TieoutVariableSet(); for (Element var : variables) { tvs.add(var.getAttributeValue("name"), var.getAttributeValue("value")); } varsets.put(varsetkey, tvs); } Element readTests = root.getChild("tests"); @SuppressWarnings("unchecked") List<Element> readTests2 = readTests.getChildren(); // load in the tests for (Element e : readTests2) { TieoutTest newtest = new TieoutTest(e.getAttributeValue("id")); String[] varsetsToAdd = e.getChildText("varsets").split(","); // may need to split based on comma // cycle through the varsets and add to the new test as needed for (String s : varsetsToAdd) { if (varsets.containsKey(s)) { newtest.addVarset(s, varsets.get(s)); } else { // warning -- that variable set does not exist } } @SuppressWarnings("unchecked") List<Element> queries = e.getChildren("query"); // read in the queries and add them to the test // also give them their respective connection to use for executing for (Element query : queries) { TieoutConnection connection = connections.get(query.getAttributeValue("connection")); newtest.addQuery(connection, query.getValue()); } tests.add(newtest); } }
From source file:org.codemucker.testserver.TestServerTest.java
@SuppressWarnings("serial") @Test//from w ww . j a v a 2 s. co m public void ensure_custom_servlets_are_invoked() throws Exception { final Collection<CapturedRequest> capturedRequests = new Vector<CapturedRequest>(); server.addServlet("/my/test/path", new TestServlet() { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { capturedRequests.add(new CapturedRequest(req)); resp.setStatus(HttpServletResponse.SC_OK); } }); server.start(); final long paramX = System.currentTimeMillis(); final String url = "http://" + server.getHost() + ":" + server.getHttpPort() + "/my/test/path?x=" + paramX; //check we can hit the servlet, that it's run only once, and that we get the params passed to it final HttpClient client = HttpClientBuilder.create().build(); final HttpGet get = new HttpGet(url); final HttpResponse resp = client.execute(get); assertEquals(HttpServletResponse.SC_OK, resp.getStatusLine().getStatusCode()); assertEquals(1, capturedRequests.size()); final CapturedRequest req = capturedRequests.iterator().next(); assertEquals(paramX + "", req.getParameters().get("x").iterator().next()); }
From source file:com.instantme.model.PhotoEntryModel.java
public boolean fromJSONObject(JSONObject jobj, IAnimation anim) { boolean result = false; setAnimation(anim);// w w w.j av a 2s . c o m try { Vector _data = new Vector(); JSONArray feeds = jobj.getJSONArray("data"); int numElements = feeds.length(); if (feeds != null) { for (int n = 0; n < numElements; n++) { //updateProgress( "Reading photo " + String.valueOf(n+1) + "/" + String.valueOf(numElements) + " ..." ); JSONObject entry = feeds.getJSONObject(n); PhotoEntry pe = new PhotoEntry(); pe.fromJSONObject(entry, anim); _data.addElement(pe); } } data = _data; String url = jobj.getJSONObject("pagination").getString("next_url"); cursor.push(url); //System.out.println("Stack [" + cursor.size() + "] = " + url); result = true; } catch (JSONException ex) { ex.printStackTrace(); } return result; }
From source file:fr.sanofi.fcl4transmart.controllers.listeners.clinicalData.SetUnitsListener.java
@Override public void handleEvent(Event event) { Vector<String> columns = this.setUnitsUI.getColumns(); Vector<String> units = this.setUnitsUI.getUnits(); if (columns.size() == 1) { if (columns.get(0).compareTo("") == 0 && columns.get(0).compareTo("") == 0) { columns = new Vector<String>(); units = new Vector<String>(); }/*from www.j a va2 s .co m*/ } for (int i = 0; i < columns.size(); i++) { if (columns.get(i).compareTo("") == 0 || units.get(i).compareTo("") == 0) { this.setUnitsUI.displayMessage("Some values are not set"); return; } String columnFileName = columns.get(i).split(" - ", 2)[0]; String unitFileName = units.get(i).split(" - ", 2)[0]; if (columnFileName.compareTo(unitFileName) != 0) { this.setUnitsUI.displayMessage("Columns for value and unit have to been from the same file"); } } if (((ClinicalData) this.dataType).getCMF() == null) { this.setUnitsUI.displayMessage("Error: no column mapping file"); return; } if (!this.checkValues(columns, units)) return; File file = new File(this.dataType.getPath().toString() + File.separator + this.dataType.getStudy().toString() + ".columns.tmp"); try { FileWriter fw = new FileWriter(file); BufferedWriter out = new BufferedWriter(fw); out.write( "Filename\tCategory Code\tColumn Number\tData Label\tData Label Source\tControlled Vocab Code\n"); try { BufferedReader br = new BufferedReader(new FileReader(((ClinicalData) this.dataType).getCMF())); String line = br.readLine(); while ((line = br.readLine()) != null) { if (line.split("\t", -1)[3].compareTo("UNITS") != 0) { out.write(line + "\n"); } } br.close(); } catch (Exception e) { this.setUnitsUI.displayMessage("Error: " + e.getLocalizedMessage()); e.printStackTrace(); out.close(); } for (int i = 0; i < columns.size(); i++) { String fileName = columns.get(i).split(" - ", 2)[0]; int columnColumnNumber = -1; for (File rawFile : ((ClinicalData) this.dataType).getRawFiles()) { if (rawFile.getName().compareTo(fileName) == 0) { columnColumnNumber = FileHandler.getHeaderNumber(rawFile, columns.get(i).split(" - ", 2)[1]); } } int unitColumnNumber = -1; for (File rawFile : ((ClinicalData) this.dataType).getRawFiles()) { if (rawFile.getName().compareTo(fileName) == 0) { unitColumnNumber = FileHandler.getHeaderNumber(rawFile, units.get(i).split(" - ", 2)[1]); } } if (columnColumnNumber != -1 && unitColumnNumber != -1) { out.write(fileName + "\t\t" + String.valueOf(unitColumnNumber) + "\tUNITS\t" + String.valueOf(columnColumnNumber) + "\t\t\n"); } } out.close(); String fileName = ((ClinicalData) this.dataType).getCMF().getName(); FileUtils.deleteQuietly(((ClinicalData) this.dataType).getCMF()); try { File fileDest = new File(this.dataType.getPath() + File.separator + fileName); FileUtils.moveFile(file, fileDest); ((ClinicalData) this.dataType).setCMF(fileDest); } catch (Exception ioe) { this.setUnitsUI.displayMessage("File error: " + ioe.getLocalizedMessage()); return; } } catch (Exception e) { this.setUnitsUI.displayMessage("Error: " + e.getLocalizedMessage()); e.printStackTrace(); } this.setUnitsUI.displayMessage("Column mapping file updated"); WorkPart.updateSteps(); WorkPart.updateFiles(); }
From source file:com.benasmussen.tools.testeditor.IdExtractor.java
public Vector<Vector> parse() throws Exception { Tidy tidy = new Tidy(); tidy.setXmlOut(true);/* w w w . j av a 2 s . c om*/ tidy.setPrintBodyOnly(true); Vector<Vector> data = null; try { is = new FileInputStream(file); // jtidy parse to odm org.w3c.dom.Document parseDOM = tidy.parseDOM(is, null); // w3c to dom4j DOMReader domReader = new DOMReader(); Document document = domReader.read(parseDOM); if (logger.isDebugEnabled()) { logger.debug("XML: " + document.asXML()); } data = new Vector<Vector>(); // select all elements with attribute @id List<DefaultElement> elements = document.selectNodes("//*[@id]"); for (DefaultElement element : elements) { Vector<String> row = new Vector<String>(); row.addElement(element.attributeValue("id")); row.addElement(element.getTextTrim()); data.addElement(row); } } catch (Exception e) { throw e; } finally { IOUtils.closeQuietly(is); } return data; }
From source file:at.meikel.dmrl.webapp.rest.PlayerService.java
@RequestMapping(value = { "/playersByTeam/{teamName}" }, method = RequestMethod.GET) @ResponseBody/*from ww w. j av a2s.c o m*/ public List<Player> getPlayersByTeam(@PathVariable String teamName) { List<Player> result = null; if (server != null) { result = server.getRankingList().find(teamName); } if (result == null) { result = new Vector<Player>(); } Collections.sort(result, new Comparator<Player>() { @Override public int compare(Player p1, Player p2) { if (p1 == null) { return p2 == null ? 0 : 1; } else { if (p2 == null) { return -1; } else { return (int) Math.signum(p1.getRanglistenwert() - p2.getRanglistenwert()); } } } }); return result; }
From source file:com.wxxr.nirvana.json.StrutsMockHttpServletRequest.java
public Enumeration getAttributeNames() { Vector v = new Vector(); v.addAll(attributes.keySet()); return v.elements(); }