List of usage examples for java.util Vector size
public synchronized int size()
From source file:edu.caltechUcla.sselCassel.projects.jMarkets.server.control.UpdateServ.java
/** Retrieves the next update in the queue of the given client. Returns a NO_UPDATE_RESPONSE if there * are no updates in the given client's queue. The Response that is returned is removed permanently * from the queue *//*from w w w . j a va 2 s. c o m*/ protected Response dequeueUpdate(int dbId) { Integer clientInt = new Integer(dbId); if (!updateQueues.containsKey(clientInt)) { log.warn("Cannot dequeue update for client " + dbId + " -- this client is not in any session!"); return new Response(Response.INVALID_SESSION_RESPONSE); } Vector queue = (Vector) updateQueues.get(clientInt); if (queue.size() < 1) return new Response(Response.NO_UPDATE_RESPONSE); else { Response res = (Response) queue.remove(0); return (Response) res; } }
From source file:com.sittinglittleduck.DirBuster.workGenerators.BruteForceWorkGenerator.java
public void run() { boolean recursive = true; // checks if the server surports heads requests if (manager.getAuto()) { try {/*from w ww .j av a 2s.com*/ URL headurl = new URL(firstPart); HeadMethod httphead = new HeadMethod(headurl.toString()); // set the custom HTTP headers Vector HTTPheaders = manager.getHTTPHeaders(); for (int a = 0; a < HTTPheaders.size(); a++) { HTTPHeader httpHeader = (HTTPHeader) HTTPheaders.elementAt(a); httphead.setRequestHeader(httpHeader.getHeader(), httpHeader.getValue()); } int responceCode = httpclient.executeMethod(httphead); // if the responce code is method not implemented or fails if (responceCode == 501 || responceCode == 400) { // switch the mode to just GET requests manager.setAuto(false); } } catch (MalformedURLException e) { // TODO deal with error } catch (IOException e) { // TODO deal with error } } while ((!dirQueue.isEmpty() || !workQueue.isEmpty()) && recursive) { recursive = manager.isRecursive(); // deal with the dirs try { // get item from queue DirToCheck tempDirToCheck = dirQueue.take(); // get dir name currentDir = tempDirToCheck.getName(); // get any extention that need to be checked extToCheck = tempDirToCheck.getExts(); } catch (InterruptedException e) { e.printStackTrace(); } started = currentDir; if (manager.getDoDirs()) { doingDirs = true; String baseCase = null; // store for the basecase object set to null; BaseCase baseCaseObj = null; URL failurl = null; try { // get fail responce code for a dir test baseCaseObj = GenBaseCase.genBaseCase(manager, firstPart + currentDir, true, null); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // baseCaseObj = new BaseCase(null, failcode, true, failurl, baseCase); // call function to generate the brute force if (failcode != 200) { makeList(minLen, maxLen, null, baseCaseObj); } else { makeList(minLen, maxLen, baseCase, baseCaseObj); } } // end of doing the dirs // brute force files names if (manager.getDoFiles()) { doingDirs = false; String baseCase = null; BaseCase baseCaseObj = null; URL failurl = null; for (int b = 0; b < extToCheck.size(); b++) { ExtToCheck tempExt = (ExtToCheck) extToCheck.elementAt(b); if (tempExt.toCheck()) { fileExtention = ""; if (tempExt.getName().equals(ExtToCheck.BLANK_EXT)) { fileExtention = ""; } else { fileExtention = "." + tempExt.getName(); } try { // deal with the files baseCaseObj = GenBaseCase.genBaseCase(manager, firstPart + currentDir, false, fileExtention); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // call function to generate the brute force if (failcode != 200) { makeList(minLen, maxLen, null, baseCaseObj); } else { makeList(minLen, maxLen, baseCase, baseCaseObj); } } } } finished = started; } manager.youAreFinished(); }
From source file:edu.caltechUcla.sselCassel.projects.jMarkets.server.control.UpdateServ.java
/** Process a Vector of TradeUpdate objects. Send out both the invalid updates and * the valid offer book updates. Return an array of Responses, one corresponding * to each tradeUpdate object */ public Response[] sendTradeUpdates(int periodNum, Vector tradeUpdates) { Response[] responses = new Response[tradeUpdates.size()]; for (int i = 0; i < tradeUpdates.size(); i++) { TradeUpdate tupdate = (TradeUpdate) tradeUpdates.get(i); int type = tupdate.getType(); int client = tupdate.getClient(); if (type == TradeUpdate.INVALID_OFFER_UPDATE) { String msg = tupdate.getErrorMsg(); String code = tupdate.getCode(); responses[i] = sendInvalidOfferUpdate(client, periodNum, msg, code); } else {/*w w w . j a v a 2s . c om*/ responses[i] = sendOfferBookUpdate(client, tupdate); } } return responses; }
From source file:eu.europa.ec.markt.dss.validation102853.report.SimpleReportBuilder.java
private void addSignedBy(final XmlNode signatureNode, final XmlDom signCert) { String signedBy = "?"; if (signCert != null) { final String dn = signCert.getValue("./SubjectDistinguishedName[@Format='RFC2253']/text()"); final X509Principal principal = new X509Principal(dn); final Vector<?> values = principal.getValues(new ASN1ObjectIdentifier("2.5.4.3")); if (values != null && values.size() > 0) { final String string = (String) values.get(0); if (DSSUtils.isNotBlank(string)) { signedBy = DSSUtils.replaceStrStr(string, "&", "&"); }//www . j ava 2 s.co m if (DSSUtils.isEmpty(signedBy)) { signedBy = DSSUtils.replaceStrStr(dn, "&", "&"); } } } signatureNode.addChild(NodeName.SIGNED_BY, signedBy); }
From source file:export.notes.view.to.excel.ExcelWriter.java
@SuppressWarnings("unchecked") public void createTableHeader(View view) throws NotesException { Vector<ViewColumn> columns = view.getColumns(); // offset column int offset = 0; for (int x = 0; x < columns.size(); x++) { ViewColumn column = columns.get(x); if (column.isConstant()) { offset++;//from w w w.j a v a 2 s. c o m } else if (column.isFormula()) { // A column value (ViewEntry.getColumnValues()) is not // returned if it is determined by a constant. Check it. String formula = column.getFormula(); if (formula == null) { offset++; } else { // empty string formula = formula.replaceAll("\"", "").trim(); // some whitespaces if (StringUtils.isBlank(formula)) { offset++; } } } // hidden and icons columns not will be use if (!column.isHidden() && !column.isIcon() && !column.isConstant()) { String s = columns.get(x).getTitle(); if (s == null || "".equals(s)) { //$NON-NLS-1$ s = " "; //$NON-NLS-1$ } int position = x - offset; headers.put(position, column); ViewNavigator nav = view.createViewNav(); ViewEntry entry = nav.getFirst(); while (!entry.isDocument()) { entry = nav.getNext(); } createCellStyle(position, column, entry); } } // column indexes int idy = 0; // Generate column headings Cell c = null; if (sheet == null) { SimpleDateFormat sf = new SimpleDateFormat("dd.MM.yyyy HH:mm"); //$NON-NLS-1$ sheet = createSheet(Messages.ExportAction_10 + " " + sf.format(new Date())); } Row row = sheet.createRow(0); Font fontBold = workbook.createFont(); fontBold.setBoldweight(Font.BOLDWEIGHT_BOLD); CellStyle cellStyle = workbook.createCellStyle(); cellStyle.setFont(fontBold); for (Entry<Integer, ViewColumn> entry : headers.entrySet()) { ViewColumn column = entry.getValue(); c = row.createCell(idy++); c.setCellValue(column.getTitle()); c.setCellStyle(cellStyle); } sheet.createFreezePane(0, 1, 0, 1); }
From source file:gsn.http.A3DWebServiceImpl.java
public String[] getSensorInfo(String sensor) { VSensorConfig sensorConfig = Mappings.getVSensorConfig(sensor); Vector<String> sensorInfo = new Vector<String>(); for (DataField df : sensorConfig.getOutputStructure()) sensorInfo.add(df.getName() + ":" + df.getType()); String v_sensor_info[] = new String[sensorInfo.size()]; for (int i = 0; i < sensorInfo.size(); i++) v_sensor_info[i] = sensorInfo.get(i); return v_sensor_info; }
From source file:dao.DirBlobSearchQuery.java
/** * This method lists all the results for the search text from directories * @param conn the connection/*from w w w . j a v a2 s . c om*/ * @param collabrumId the collabrumid * @return HashSet the set that has the list of moderators for these collabrums. * @throws BaseDaoException - when error occurs **/ public HashSet run(Connection conn, String sString) throws BaseDaoException { if ((RegexStrUtil.isNull(sString) || conn == null)) { return null; } /* StringBuffer sb = new StringBuffer("select blobtype, dirblob.directoryid, entrydate, dirblob.entryid, btitle from dirblob left join dirblobtags on dirblob.entryid=dirblobtags.entryid where "); */ StringBuffer sb = new StringBuffer( "select distinct d1.btitle, d1.mimetype, d1.entryid, d1.directoryid from dirblob d1, dirblobtags d2 where "); ArrayList columns = new ArrayList(); columns.add("d1.btitle"); columns.add("d2.usertags"); sb.append(sqlSearch.getConstraint(columns, sString)); sb.append(" and d1.entryid=d2.entryid and d1.directoryid=d2.directoryid"); try { PreparedStatement stmt = conn.prepareStatement(sb.toString()); ResultSet rs = stmt.executeQuery(); Vector columnNames = null; Photo photo = null; HashSet pendingSet = new HashSet(); if (rs != null) { columnNames = dbutils.getColumnNames(rs); } while (rs.next()) { photo = (Photo) eop.newObject(DbConstants.PHOTO); for (int j = 0; j < columnNames.size(); j++) { if (((String) (columnNames.elementAt(j))).equalsIgnoreCase(DbConstants.ENTRY_DATE)) { try { photo.setValue(DbConstants.ENTRY_DATE, GlobalConst.dncalendar.getDisplayDate(rs.getTimestamp(DbConstants.ENTRY_DATE))); } catch (ParseException e) { throw new BaseDaoException("could not parse the date for entrydate in dirblob " + rs.getTimestamp(DbConstants.ENTRY_DATE), e); } } else { photo.setValue((String) columnNames.elementAt(j), (String) rs.getString((String) columnNames.elementAt(j))); } } pendingSet.add(photo); } return pendingSet; } catch (Exception e) { throw new BaseDaoException("Error occured while executing search dirblob run query " + sb.toString(), e); } }
From source file:eu.europa.esig.dss.validation.report.SimpleReportBuilder.java
private void addSignedBy(final XmlNode signatureNode, final XmlDom signCert) { String signedBy = "?"; if (signCert != null) { final String dn = signCert.getValue("./SubjectDistinguishedName[@Format='RFC2253']/text()"); final X509Principal principal = new X509Principal(dn); final Vector<?> values = principal.getValues(new ASN1ObjectIdentifier("2.5.4.3")); if ((values != null) && (values.size() > 0)) { final String string = (String) values.get(0); if (StringUtils.isNotBlank(string)) { signedBy = DSSUtils.replaceStrStr(string, "&", "&"); }// w w w . j a v a2s .c o m if (StringUtils.isEmpty(signedBy)) { signedBy = DSSUtils.replaceStrStr(dn, "&", "&"); } } } signatureNode.addChild(NodeName.SIGNED_BY, signedBy); }
From source file:edu.umn.natsrl.evaluation.ContourPlotter.java
private boolean createContourPlot() { if (chart != null) { return true; }//from w ww. j a v a 2 s. c o m if (this.cv == null || this.ncv == 0 || this.colors == null) { return false; } String date = null; Vector<EvaluationResult> results = (Vector<EvaluationResult>) this.eval.getResult().clone(); if (results.size() > 2) { date = " [average of " + (results.size() - 1) + " days]"; } else { date = " [" + results.get(0).getName() + "]"; } final String title = section.getName() + date; final String xAxisLabel = ""; final String yAxisLabel = ""; final String zAxisLabel = ""; this.xAxis = new NumberAxis(xAxisLabel); this.yAxis = new NumberAxis(yAxisLabel); this.zColorBar = new ColorBar(zAxisLabel); if (this.xAxis instanceof NumberAxis) { ((NumberAxis) this.xAxis).setAutoRangeIncludesZero(false); } this.yAxis.setAutoRangeIncludesZero(false); this.yAxis.setStreetName(this.streetNames); ((NumberAxis) this.xAxis).setTime(this.plotTimes); ((NumberAxis) this.zColorBar.getAxis()).setColor(cv, unit); ((NumberAxis) this.xAxis).setLowerMargin(0.0); ((NumberAxis) this.xAxis).setUpperMargin(0.0); this.yAxis.setLowerMargin(0.0); this.yAxis.setUpperMargin(0.0); this.xAxis.setRange(0, numX - 1); this.yAxis.setRange(0, numY - 1); this.zColorBar.getAxis().setTickMarksVisible(true); final ContourDataset data = createDataset(); // for(Number n : data.getZValues()) { // System.out.println("Data=" + n); // } final ContourPlot plot = new ContourPlot(data, this.xAxis, this.yAxis, this.zColorBar, ncv); plot.SetContourValue(cv, ncv, colors, numX, numY); plot.setDataAreaRatio(ratio); chart = new JFreeChart(title, null, plot, false); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.white)); return true; }
From source file:it.intecs.pisa.toolbox.util.URLReader.java
protected static String[] getSSESchemaDirectoryListingFromPortal(String baseUrl) { String[] listing;// w ww . j a va2s . c o m String[] fileListing; String[] directoryListing; String[] subDirectoryListing; Vector<String> subFolderFullListing; Enumeration<String> en; int i = 0; String url; subFolderFullListing = new Vector<String>(); ToolboxConfiguration toolboxConfiguration; toolboxConfiguration = ToolboxConfiguration.getInstance(); url = "http://" + toolboxConfiguration.getConfigurationValue(ToolboxConfiguration.SSE_PORTAL) + "/schemas/" + baseUrl; fileListing = getFileToDW(url); directoryListing = getDirectoryToDW(url); for (String subDir : directoryListing) { subDirectoryListing = getSSESchemaDirectoryListingFromPortal(subDir); for (String sub : subDirectoryListing) { System.out.println("ADDING " + sub); subFolderFullListing.add(sub); } } listing = new String[fileListing.length + subFolderFullListing.size()]; en = subFolderFullListing.elements(); for (String file : fileListing) { listing[i] = file; i++; } while (en.hasMoreElements()) { listing[i] = en.nextElement(); i++; } return listing; }