List of usage examples for java.util Vector addElement
public synchronized void addElement(E obj)
From source file:orca.shirako.container.RemoteRegistryCache.java
public static void registerNDLToRegistry(IAuthorityProxy proxy, String fullModel, String abstractModel) { String registryUrl = Globals.getAdminConfiguration().getConfiguration() .getProperty(OrcaContainer.PropertyRegistryUrl); String registryMethod = Globals.getAdminConfiguration().getConfiguration() .getProperty(OrcaContainer.PropertyRegistryMethod); if (registryUrl == null || registryMethod == null) { Globals.Log.info("No external registry specified for registering NDL."); return;/*from w w w . j ava 2 s .com*/ } //Globals.Log.debug("registryUrl = " + registryUrl + " ; registryMethod = " + registryMethod); try { String act_guid = proxy.getGuid().toString(); String act_abstract_rdf = abstractModel; //Globals.Log.debug(abstractModel); String act_full_rdf = fullModel; //Globals.Log.debug(fullModel); Globals.Log.info("Registering ndls with external registry at " + registryUrl + " using " + registryMethod + " for actor " + act_guid); Vector<String> params = new Vector<String>(); // This order of insert is very important, because the xml-rpc // server expects the strings in this order params.addElement(act_guid); params.addElement(act_abstract_rdf); params.addElement(act_full_rdf); try { //Globals.Log.debug("Inserting into registry - ActorGUID: " + act_guid + " | AbstractRDF: " + act_abstract_rdf + " | FullRDF: " + act_full_rdf); Globals.Log.debug( "Inserting Abstract and Full NDL into registry for actor with ActorGUID: " + act_guid); // set current identity for SSL connection to registry mkm.setCurrentGuid(act_guid); XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL(registryUrl + "/")); XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); HttpClient h = new HttpClient(connMgr); // set this transport factory for host-specific SSLContexts to work XmlRpcCommonsTransportFactory f = new XmlRpcCommonsTransportFactory(client); f.setHttpClient(h); client.setTransportFactory(f); String stat = (String) client.execute(registryMethod, params); Globals.Log.info("Registry returned: " + stat); } catch (Exception ex) { Globals.Log.error("Could not connect to the registry server", ex); } } catch (Exception e) { Globals.Log.error("An error occurred whle attempting to register Ndls with external registry", e); } }
From source file:SelectionHandler.java
private void removeFromSource(String item) { ListModel model = source.getModel(); Vector listData = new Vector(); for (int i = 0; i < model.getSize(); i++) { listData.addElement(model.getElementAt(i)); }//from w w w.j a v a 2s.co m listData.removeElement(item); source.setListData(listData); }
From source file:SelectionHandler.java
private void addToDestination(String item) { ListModel model = destination.getModel(); Vector listData = new Vector(); for (int i = 0; i < model.getSize(); i++) { listData.addElement(model.getElementAt(i)); }/*from ww w. j a va2 s. c o m*/ listData.addElement(item); destination.setListData(listData); }
From source file:Main.java
public Main() { Vector dummyMacData = new Vector(10, 10); dummyMacData.addElement(new Data(new Integer(100), "A", "1", "C", "E")); dummyMacData.addElement(new Data(new Integer(105), "R", "2", "S", "E")); m_simpleTableModel = new SimpleTableModel(dummyMacData); m_simpleTable = new JTable(m_simpleTableModel); JScrollPane scrollPane = new JScrollPane(m_simpleTable); getContentPane().add(scrollPane);/*w w w . j av a2 s. c o m*/ }
From source file:org.adl.samplerte.server.LMSPackageHandler.java
/**************************************************************************** **//from w w w . j a v a 2s.c o m ** Method: locateMetadata() ** Input: String zipFileName -- The name of the zip file to be used ** Output: Vector -- A vector of the names of xml files. ** ** Description: This method takes in the name of a zip file and locates ** all files with an .xml extension an adds their names to a ** vector. ** *****************************************************************************/ public static Vector locateMetadata(String zipFileName) { if (_Debug) { System.out.println("***********************"); System.out.println("in locateMetadata() "); System.out.println("***********************\n"); } // An array of names of xml files to be returned to ColdFusion Vector metaDataVector = new Vector(); String suffix = ".xml"; try { // The zip file being searched. ZipInputStream in = new ZipInputStream(new FileInputStream(zipFileName)); // An entry in the zip file ZipEntry entry; if (_Debug) { System.out.println("Other meta-data located:"); } while ((in.available() != 0)) { entry = in.getNextEntry(); if (in.available() != 0) { if ((entry.getName()).endsWith(suffix)) { if (_Debug) { System.out.println(entry.getName()); } metaDataVector.addElement(entry.getName()); } } } in.close(); } catch (IOException e) { if (_Debug) { System.out.println("IO Exception Caught: " + e); } } return metaDataVector; }
From source file:org.apache.tomcat.util.IntrospectionUtils.java
/** * Construct a URL classpath from files in a directory, a cpath property, * and tools.jar./*w ww . ja v a 2 s .co m*/ */ public static URL[] getClassPath(String dir, String cpath, String cpathProp, boolean addTools) throws IOException, MalformedURLException { Vector jarsV = new Vector(); if (dir != null) { // Add dir/classes first, if it exists URL url = getURL(dir, "classes"); if (url != null) jarsV.addElement(url); addToClassPath(jarsV, dir); } if (cpath != null) addJarsFromClassPath(jarsV, cpath); if (cpathProp != null) { String cpath1 = System.getProperty(cpathProp); addJarsFromClassPath(jarsV, cpath1); } if (addTools) addToolsJar(jarsV); return getClassPath(jarsV); }
From source file:Main.java
public static String[] split(final String s, final char c, final boolean dblquotes, final int max) { int j = 0;// w ww.j a v a 2 s .c om final Vector<String> vector = new Vector<String>(); // add first max-1 components int num = 0; int i = 0; String ss = null; int k1; int k2; for (i = 0; num != max - 1; i = j + 1) { k1 = -1; k2 = -1; j = s.indexOf(c, i); if (dblquotes) { // should have k1=0 k1 = s.indexOf('"', i); // quote found and before delimiter if (k1 >= 0 && k1 < j) { // next quote k2 = s.indexOf('"', k1 + 1); if (k2 >= 0) { // recompute next delimiter - should have j=k2+1 j = s.indexOf(c, k2 + 1); } } } if (j >= 0) { if (dblquotes && k1 >= 0 && k2 >= 0) { ss = s.substring(k1 + 1, k2); } else { ss = s.substring(i, j); } vector.addElement(ss); num++; } else { if (dblquotes && k1 >= 0 && k2 >= 0) { ss = s.substring(k1 + 1, k2); } else { ss = s.substring(i); } vector.addElement(ss); num++; break; } } // add the max-th component k1 = -1; k2 = -1; if (max != 0 && j >= 0) { if (dblquotes) { k1 = s.indexOf('"', i); // quote found and before delimiter if (k1 >= 0) { // next quote k2 = s.indexOf('"', k1 + 1); } } if (dblquotes && k1 >= 0 && k2 >= 0) { ss = s.substring(k1 + 1, k2); } else { ss = s.substring(i); } vector.addElement(ss); num++; } // convert to array final String as[] = new String[num]; vector.copyInto(as); // return the array return as; }
From source file:Main.java
private DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) { String curPath = dir.getPath(); DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(curPath); if (curTop != null) { curTop.add(curDir);/*from ww w . j av a 2 s . c om*/ } Vector<String> ol = new Vector<String>(); String[] tmp = dir.list(); for (int i = 0; i < tmp.length; i++) { ol.addElement(tmp[i]); } Collections.sort(ol, String.CASE_INSENSITIVE_ORDER); File f; Vector<Object> files = new Vector<Object>(); for (int i = 0; i < ol.size(); i++) { String thisObject = ol.elementAt(i); String newPath; if (curPath.equals(".")) { newPath = thisObject; } else { newPath = curPath + File.separator + thisObject; } if ((f = new File(newPath)).isDirectory()) { addNodes(curDir, f); } else { files.addElement(thisObject); } } for (int fnum = 0; fnum < files.size(); fnum++) { curDir.add(new DefaultMutableTreeNode(files.elementAt(fnum))); } return curDir; }
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 a v a 2 s .co m 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:Controlador.ControladorLecturas.java
public Vector vectorTemperatura() { Vector data = new Vector(1, 1); for (Lecturas lectura : lista) { Vector row = new Vector(1, 1); row.addElement(lectura.getTemperatura()); row.addElement(lectura.getHora()); data.addElement(row);/*from ww w. j a v a2 s .c o m*/ } return data; }