List of usage examples for java.util Vector addElement
public synchronized void addElement(E obj)
From source file:com.commander4j.db.JDBDespatch.java
public Vector<JDBDespatch> getDespatchData(PreparedStatement criteria) { ResultSet rs;/*from w ww . ja v a 2 s .c om*/ Vector<JDBDespatch> result = new Vector<JDBDespatch>(); if (Common.hostList.getHost(getHostID()).toString().equals(null)) { result.addElement(new JDBDespatch(getHostID(), getSessionID(), "despatch_no", null, "location_id_from", "location_id_to", "status", 0, "trailer", "haulier", "load_no", "user_id", "journey_ref")); } else { try { rs = criteria.executeQuery(); while (rs.next()) { result.addElement(new JDBDespatch(getHostID(), getSessionID(), rs.getString("despatch_no"), rs.getTimestamp("despatch_date"), rs.getString("location_id_from"), rs.getString("location_id_to"), rs.getString("status"), rs.getInt("total_pallets"), rs.getString("trailer"), rs.getString("haulier"), rs.getString("load_no"), rs.getString("user_id"), rs.getString("journey_ref"))); } rs.close(); } catch (Exception e) { setErrorMessage(e.getMessage()); } } return result; }
From source file:com.netscape.cms.publish.publishers.FileBasedPublisher.java
/** * Returns the current instance parameters. *///from ww w . j a v a 2 s. c o m public Vector<String> getInstanceParams() { Vector<String> v = new Vector<String>(); String dir = ""; String ext = ""; try { dir = mConfig.getString(PROP_DIR); } catch (EBaseException e) { } try { ext = mConfig.getString(PROP_EXT); } catch (EBaseException e) { } try { mTimeStamp = mConfig.getString(PROP_GMT); } catch (EBaseException e) { } try { mZipLevel = mConfig.getInteger(PROP_LEV, 9); } catch (EBaseException e) { } try { maxFullCRLs = mConfig.getInteger(PROP_MAX_FULL_CRLS, 0); } catch (EBaseException e) { } try { maxAge = mConfig.getInteger(PROP_MAX_AGE, 0); } catch (EBaseException e) { } try { if (mTimeStamp == null || (!mTimeStamp.equals("GMT"))) mTimeStamp = "LocalTime"; v.addElement(PROP_DIR + "=" + dir); v.addElement(PROP_DER + "=" + mConfig.getBoolean(PROP_DER, true)); v.addElement(PROP_B64 + "=" + mConfig.getBoolean(PROP_B64, false)); v.addElement(PROP_GMT + "=" + mTimeStamp); v.addElement(PROP_LNK + "=" + mConfig.getBoolean(PROP_LNK, false)); v.addElement(PROP_EXT + "=" + ext); v.addElement(PROP_ZIP + "=" + mConfig.getBoolean(PROP_ZIP, false)); v.addElement(PROP_LEV + "=" + mZipLevel); v.addElement(PROP_MAX_FULL_CRLS + "=" + maxFullCRLs); v.addElement(PROP_MAX_AGE + "=" + maxAge); } catch (Exception e) { } return v; }
From source file:mypackage.State_Stream.java
private void makeEntryAsRead(final int row_number) { // L?MoH??^?[ if (!Network.isCoverageSufficient()) { // ANeBreBCWP?[^?[?? _screen.deleteActivityIndicator(); UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { Dialog.alert(/*from w w w. ja va 2 s .c o m*/ "A communication error has occurred. Please make sure your device is connected to Internet."); } }); return; } //if() new Thread() { public void run() { try { // ANeBreBCWP?[^?[\ //_screen.showActivityIndicator(); // unread?Abvf?[g Entry _entry = (Entry) entries.elementAt(row_number); _entry.makeAsRead(); // \?X?V _screen.refreshRichList(); // savedGg?[ID String entryId = _entry.getId(); // APInGg?[ID? Vector entryIds = new Vector(); entryIds.addElement(entryId); // Feedly API@?B _feedlyapi.markOneOrMultipleArticlesAsRead(entryIds); } catch (final Exception e) { // sunread??B Entry _entry = (Entry) entries.elementAt(row_number); _entry.makeAsUnread(); // \?B _screen.refreshRichList(); // G?[?MO updateStatus("makeEntryAsRead() " + e.toString()); // s_CA?O\ UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { Dialog.alert("An unexpected error occurred while making entry as Read"); } }); } finally { // ANeBreBCWP?[^?[?? //_screen.deleteActivityIndicator(); } } //run() }.start(); //Thread() }
From source file:org.apache.naming.modules.fs.FileDirContext.java
/** * List the resources which are members of a collection. * /*from w ww . j av a 2s.c o m*/ * @param file Collection * @return Vector containg NamingEntry objects */ protected Vector list(File file) { Vector entries = new Vector(); if (!file.isDirectory()) return entries; String[] names = file.list(); Arrays.sort(names); // Sort alphabetically if (names == null) return entries; NamingEntry entry = null; for (int i = 0; i < names.length; i++) { File currentFile = new File(file, names[i]); Object object = null; if (currentFile.isDirectory()) { FileDirContext tempContext = new FileDirContext(env); tempContext.setDocBase(file.getPath()); object = tempContext; } else { //object = new FileResource(currentFile); object = currentFile; } entry = new NamingEntry(names[i], object, null, NamingEntry.ENTRY); entries.addElement(entry); } return entries; }
From source file:org.apache.flex.forks.velocity.runtime.configuration.Configuration.java
/** * Get a Vector of strings associated with the given configuration * key./*from www . j a va2 s . c om*/ * * @param key The configuration key. * @param defaultValue The default value. * @return The associated Vector. * @exception ClassCastException is thrown if the key maps to an * object that is not a Vector. */ public Vector getVector(String key, Vector defaultValue) { Object value = get(key); if (value instanceof Vector) { return (Vector) value; } else if (value instanceof String) { Vector v = new Vector(1); v.addElement((String) value); put(key, v); return v; } else if (value == null) { if (defaults != null) { return defaults.getVector(key, defaultValue); } else { return ((defaultValue == null) ? new Vector() : defaultValue); } } else { throw new ClassCastException('\'' + key + "' doesn't map to a Vector object"); } }
From source file:org.eredlab.g4.ccl.net.nntp.NNTPClient.java
/*** * List all new articles added to the NNTP server since a particular * date subject to the conditions of the specified query. If no new * new news is found, a zero length array will be returned. If the * command fails, null will be returned. You must add at least one * newsgroup to the query, else the command will fail. Each String * in the returned array is a unique message identifier including the * enclosing < and >.//w ww. ja v a2 s .c om * <p> * @param query The query restricting how to search for new news. You * must add at least one newsgroup to the query. * @return An array of String instances containing the unique message * identifiers for each new article added to the NNTP server. If no * new news is found, a zero length array will be returned. If the * command fails, null will be returned. * @exception NNTPConnectionClosedException * If the NNTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send NNTP reply code 400. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. ***/ public String[] listNewNews(NewGroupsOrNewsQuery query) throws IOException { int size; String line; Vector list; String[] result; BufferedReader reader; if (!NNTPReply.isPositiveCompletion(newnews(query.getNewsgroups(), query.getDate(), query.getTime(), query.isGMT(), query.getDistributions()))) return null; list = new Vector(); reader = new BufferedReader(new DotTerminatedMessageReader(_reader_)); while ((line = reader.readLine()) != null) list.addElement(line); size = list.size(); if (size < 1) return new String[0]; result = new String[size]; list.copyInto(result); return result; }
From source file:mypackage.State_Stream.java
private void toggleUnreadAndRead(final int index) { // L?MoH??^?[ if (!Network.isCoverageSufficient()) { // ANeBreBCWP?[^?[?? _screen.deleteActivityIndicator(); UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { Dialog.alert(/*from w ww. j a v a 2 s . c o m*/ "A communication error has occurred. Please make sure your device is connected to Internet."); } }); return; } //if() new Thread() { public void run() { boolean desired_unread_status = false; boolean current_unread_status = false; try { // ANeBreBCWP?[^?[\ _screen.showActivityIndicator(); // Gg?[unreadlI? if (isUnreadEntry(index)) { desired_unread_status = false; current_unread_status = true; } else { desired_unread_status = true; current_unread_status = false; } // unread?Abvf?[g Entry _entry = (Entry) entries.elementAt(index); if (desired_unread_status) { _entry.makeAsUnread(); } else { _entry.makeAsRead(); } // \?X?V _screen.refreshRichList(); // savedGg?[ID String entryId = _entry.getId(); // APInGg?[ID? Vector entryIds = new Vector(); entryIds.addElement(entryId); // Feedly API@?B if (current_unread_status) { _feedlyapi.markOneOrMultipleArticlesAsRead(entryIds); } else { _feedlyapi.keepOneOrMultipleArticlesAsUnread(entryIds); } } catch (final Exception e) { // sunread??B Entry _entry = (Entry) entries.elementAt(index); if (desired_unread_status) { _entry.makeAsUnread(); } else { _entry.makeAsRead(); } // \?B _screen.refreshRichList(); // G?[?MO updateStatus("toggleUnreadAndRead()" + e.toString()); // s_CA?O\ UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { Dialog.alert("An unexpected error occurred while making entry as Unread/Read"); } }); } finally { // ANeBreBCWP?[^?[?? _screen.deleteActivityIndicator(); } } //run() }.start(); //Thread() }
From source file:org.apache.cocoon.components.source.impl.WebDAVSource.java
/** * Returns a enumeration of the properties * * @return Enumeration of SourceProperty * * @throws SourceException If an exception occurs. *//* w w w .j a v a 2 s . c o m*/ public SourceProperty[] getSourceProperties() throws SourceException { initResource(WebdavResource.NOACTION, DepthSupport.DEPTH_0); Vector sourceproperties = new Vector(); Enumeration props = null; org.apache.webdav.lib.Property prop = null; try { Enumeration responses = this.resource.propfindMethod(0); while (responses.hasMoreElements()) { ResponseEntity response = (ResponseEntity) responses.nextElement(); props = response.getProperties(); while (props.hasMoreElements()) { prop = (Property) props.nextElement(); SourceProperty srcProperty = new SourceProperty(prop.getElement()); sourceproperties.addElement(srcProperty); } } } catch (Exception e) { throw new SourceException("Error getting properties", e); } SourceProperty[] sourcepropertiesArray = new SourceProperty[sourceproperties.size()]; for (int i = 0; i < sourceproperties.size(); i++) { sourcepropertiesArray[i] = (SourceProperty) sourceproperties.elementAt(i); } return sourcepropertiesArray; }
From source file:org.apache.flex.forks.velocity.runtime.configuration.Configuration.java
/** * Sets a string property w/o checking for commas - used * internally when a property has been broken up into * strings that could contain escaped commas to prevent * the inadvertant vectorization.//from w w w . java2s . c o m * * Thanks to Leon Messerschmidt for this one. * */ private void addStringProperty(String key, String token) { Object o = this.get(key); /* * $$$ GMJ * FIXME : post 1.0 release, we need to not assume * that a scalar is a String - it can be an Object * so we should make a little vector-like class * say, Foo that wraps (not extends Vector), * so we can do things like * if ( !( o instanceof Foo) ) * so we know it's our 'vector' container * * This applies throughout */ /* * do the usual thing - if we have a value and * it's scalar, make a vector, otherwise add * to the vector */ if (o instanceof String) { Vector v = new Vector(2); v.addElement(o); v.addElement(token); put(key, v); } else if (o instanceof Vector) { ((Vector) o).addElement(token); } else { if (!containsKey(key)) { keysAsListed.add(key); } put(key, token); } }
From source file:org.eredlab.g4.ccl.net.nntp.NNTPClient.java
private NewsgroupInfo[] __readNewsgroupListing() throws IOException { int size;/*w w w . j a v a 2 s . c o m*/ String line; Vector list; BufferedReader reader; NewsgroupInfo tmp, info[]; reader = new BufferedReader(new DotTerminatedMessageReader(_reader_)); // Start of with a big vector because we may be reading a very large // amount of groups. list = new Vector(2048); while ((line = reader.readLine()) != null) { tmp = __parseNewsgroupListEntry(line); if (tmp != null) list.addElement(tmp); else throw new MalformedServerReplyException(line); } if ((size = list.size()) < 1) return new NewsgroupInfo[0]; info = new NewsgroupInfo[size]; list.copyInto(info); return info; }