List of usage examples for java.util Vector remove
public synchronized E remove(int index)
From source file:com.headstrong.npi.raas.Utils.java
public static String[] deleteSection(int index, String[] strArray) { Vector<String> arrayVector = new Vector<String>(Arrays.asList(strArray)); arrayVector.remove(index); String[] returnStr = (String[]) arrayVector.toArray(new String[0]); return returnStr; }
From source file:org.globus.ftp.test.FTPClientListTest.java
public void test2() throws Exception { logger.info("test two consective list, using both list functions"); FTPClient src = new FTPClient(TestEnv.serverFHost, TestEnv.serverFPort); src.authorize(TestEnv.serverFUser, TestEnv.serverFPassword); String output1 = null;/*from www .j av a2 s . c o m*/ String output2 = null; // using list() src.changeDir(TestEnv.serverFDir); Vector v = src.list(); logger.debug("list received"); StringBuffer output1Buffer = new StringBuffer(); while (!v.isEmpty()) { FileInfo f = (FileInfo) v.remove(0); output1Buffer.append(f.toString()).append("\n"); } output1 = output1Buffer.toString(); // using list(String,String, DataSink) HostPort hp2 = src.setPassive(); src.setLocalActive(); final ByteArrayOutputStream received2 = new ByteArrayOutputStream(1000); // unnamed DataSink subclass will write data channel content // to "received" stream. src.list("*", "-d", new DataSink() { public void write(Buffer buffer) throws IOException { logger.debug("received " + buffer.getLength() + " bytes of directory listing"); received2.write(buffer.getBuffer(), 0, buffer.getLength()); } public void close() throws IOException { }; }); // transfer done. Data is in received2 stream. output2 = received2.toString(); logger.debug(output2); src.close(); }
From source file:org.globus.ftp.test.MlsxTest.java
public void test3() throws Exception { logger.info("show mlsd output using GridFTPClient"); GridFTPClient src = new GridFTPClient(TestEnv.serverAHost, TestEnv.serverAPort); src.setAuthorization(TestEnv.getAuthorization(TestEnv.serverASubject)); src.authenticate(null); // use default creds src.setType(Session.TYPE_ASCII);/*from w w w . ja va 2 s .c om*/ src.changeDir(TestEnv.serverADir); Vector v = src.mlsd(); logger.debug("mlsd received"); while (!v.isEmpty()) { MlsxEntry f = (MlsxEntry) v.remove(0); logger.info(f.toString()); } src.close(); }
From source file:org.apache.cayenne.pref.UpgradeCayennePreference.java
public void upgrade() { try {//from w w w .j ava 2 s .c om if (!Preferences.userRoot().nodeExists(CAYENNE_PREFERENCES_PATH)) { File prefsFile = new File(preferencesDirectory(), PREFERENCES_NAME_OLD); if (prefsFile.exists()) { ExtendedProperties ep = new ExtendedProperties(); try { ep.load(new FileInputStream(prefsFile)); Preferences prefEditor = Preferences.userRoot().node(CAYENNE_PREFERENCES_PATH).node(EDITOR); prefEditor.putBoolean(ModelerPreferences.EDITOR_LOGFILE_ENABLED, ep.getBoolean(EDITOR_LOGFILE_ENABLED_OLD)); prefEditor.put(ModelerPreferences.EDITOR_LOGFILE, ep.getString(EDITOR_LOGFILE_OLD)); Preferences frefLastProjFiles = prefEditor.node(LAST_PROJ_FILES); Vector arr = ep.getVector(LAST_PROJ_FILES_OLD); while (arr.size() > ModelerPreferences.LAST_PROJ_FILES_SIZE) { arr.remove(arr.size() - 1); } frefLastProjFiles.clear(); int size = arr.size(); for (int i = 0; i < size; i++) { frefLastProjFiles.put(String.valueOf(i), arr.get(i).toString()); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } catch (BackingStoreException e) { // do nothing } }
From source file:com.vsquaresystem.safedeals.readyreckoner.ReadyReckonerService.java
private boolean saveToDatabase(Vector dataHolder) throws IOException { readyReckonerDAL.truncateAll();/*from www . j a va 2 s .c om*/ dataHolder.remove(0); Readyreckoner readyReckoner = new Readyreckoner(); String id = ""; String locationId = ""; String rrYear = ""; String rrRateLand = ""; String rrRatePlot = ""; String rrRateApartment = ""; System.out.println(dataHolder); DataFormatter formatter = new DataFormatter(); for (Iterator iterator = dataHolder.iterator(); iterator.hasNext();) { List list = (List) iterator.next(); logger.info("list", list); locationId = list.get(1).toString(); rrYear = list.get(2).toString(); rrRateLand = list.get(3).toString(); rrRatePlot = list.get(4).toString(); rrRateApartment = list.get(5).toString(); try { readyReckoner.setLocationId(Integer.parseInt(locationId)); readyReckoner.setRrYear(Double.parseDouble(rrYear)); readyReckoner.setRrRateLand(Double.parseDouble(rrRateLand)); readyReckoner.setRrRatePlot(Double.parseDouble(rrRatePlot)); readyReckoner.setRrRateApartment(Double.parseDouble(rrRateApartment)); readyReckonerDAL.insert(readyReckoner); } catch (Exception e) { e.printStackTrace(); } } File excelFile = attachmentUtils .getDirectoryByAttachmentType(AttachmentUtils.AttachmentType.READY_RECKONER); FileUtils.cleanDirectory(excelFile); return true; }
From source file:org.globus.ftp.test.MlsxTest.java
public void test4() throws Exception { logger.info("get mlsd output using GridFTPClient, EBlock, Image"); GridFTPClient src = new GridFTPClient(TestEnv.serverAHost, TestEnv.serverAPort); src.setAuthorization(TestEnv.getAuthorization(TestEnv.serverASubject)); src.authenticate(null); // use default creds src.setType(Session.TYPE_IMAGE);/*from ww w .j ava 2 s. c o m*/ src.setMode(GridFTPSession.MODE_EBLOCK); // server sends the listing over data channel. // so in EBlock, it must be active HostPort hp = src.setLocalPassive(); src.setActive(hp); src.changeDir(TestEnv.serverADir); Vector v = src.mlsd(); logger.debug("mlsd received"); while (!v.isEmpty()) { MlsxEntry f = (MlsxEntry) v.remove(0); logger.debug(f.toString()); } src.close(); }
From source file:org.apache.cayenne.modeler.preferences.UpgradeCayennePreference.java
public void upgrade() { try {// w w w . ja v a 2 s . c om if (!Preferences.userRoot().nodeExists(CAYENNE_PREFERENCES_PATH)) { File prefsFile = new File(preferencesDirectory(), PREFERENCES_NAME_OLD); if (prefsFile.exists()) { ExtendedProperties ep = new ExtendedProperties(); try { ep.load(new FileInputStream(prefsFile)); Preferences prefEditor = Preferences.userRoot().node(CAYENNE_PREFERENCES_PATH).node(EDITOR); prefEditor.putBoolean(ModelerPreferences.EDITOR_LOGFILE_ENABLED, ep.getBoolean(EDITOR_LOGFILE_ENABLED_OLD)); prefEditor.put(ModelerPreferences.EDITOR_LOGFILE, ep.getString(EDITOR_LOGFILE_OLD)); Preferences frefLastProjFiles = prefEditor.node(LAST_PROJ_FILES); Vector arr = ep.getVector(LAST_PROJ_FILES_OLD); while (arr.size() > ModelerPreferences.LAST_PROJ_FILES_SIZE) { arr.remove(arr.size() - 1); } frefLastProjFiles.clear(); int size = arr.size(); for (int i = 0; i < size; i++) { frefLastProjFiles.put(String.valueOf(i), arr.get(i).toString()); } } catch (FileNotFoundException e) { LOGGER.error(e); } catch (IOException e) { LOGGER.error(e); } } } } catch (BackingStoreException e) { // do nothing } }
From source file:com.vsquaresystem.safedeals.location.LocationService.java
public boolean saveExcelToDatabase() throws IOException { Vector dataHolder = read(); dataHolder.remove(0); Location location = new Location(); String id = ""; String name = ""; String description = ""; String cityId = ""; String locationTypeId = ""; String locationCategories = ""; String safedealZoneId = ""; String majorApproachRoad = ""; String advantage = ""; String disadvantage = ""; String population = ""; String latitude = ""; String longitude = ""; String sourceOfWater = ""; String publicTransport = ""; String migrationRate = ""; String distanceCenterCity = ""; String isCommercialCenter = ""; String distanceCommercialCenter = ""; String imageUrl = ""; System.out.println("line1785SAVE sop" + dataHolder); DataFormatter formatter = new DataFormatter(); for (Iterator iterator = dataHolder.iterator(); iterator.hasNext();) { List list = (List) iterator.next(); name = list.get(0).toString();//from w ww . j a v a 2s. c om description = list.get(1).toString(); cityId = list.get(2).toString(); locationTypeId = list.get(3).toString(); locationCategories = list.get(4).toString(); safedealZoneId = list.get(5).toString(); majorApproachRoad = list.get(6).toString(); advantage = list.get(7).toString(); disadvantage = list.get(8).toString(); population = list.get(9).toString(); latitude = list.get(10).toString(); longitude = list.get(11).toString(); sourceOfWater = list.get(12).toString(); publicTransport = list.get(13).toString(); migrationRate = list.get(14).toString(); distanceCenterCity = list.get(15).toString(); isCommercialCenter = list.get(16).toString(); distanceCommercialCenter = list.get(17).toString(); imageUrl = list.get(18).toString(); List<String> strList = new ArrayList<String>(Arrays.asList(locationCategories.split(","))); List<Integer> numberList = new ArrayList<Integer>(); for (String number : strList) { numberList.add(Integer.parseInt(number)); } try { location.setName(name); location.setDescription(description); location.setCityId(Integer.parseInt(cityId)); location.setLocationTypeId(Integer.parseInt(locationTypeId)); location.setLocationCategories(numberList); location.setSafedealZoneId(Integer.parseInt(safedealZoneId)); location.setMajorApproachRoad(majorApproachRoad); location.setAdvantage(advantage); location.setDisadvantage(disadvantage); location.setPopulation(Integer.parseInt(population)); location.setLatitude(Double.parseDouble(latitude)); location.setLongitude(Double.parseDouble(longitude)); location.setMigrationRatePerAnnum(MigrationRatePerAnnum.valueOf(migrationRate)); location.setDistanceFromCentreOfCity(Double.parseDouble(distanceCenterCity)); location.setDistanceFromCommercialCenter(Double.parseDouble(distanceCommercialCenter)); location.setIsCommercialCenter(Boolean.valueOf(isCommercialCenter)); location.setImageUrl(imageUrl); System.out.println("location line167 CHECKcheck" + location); System.out.println("numberList" + numberList); locationDAL.insert(location); } catch (Exception e) { e.printStackTrace(); } } File excelFile = attachmentUtils.getDirectoryByAttachmentType(AttachmentUtils.AttachmentType.LOCATION); FileUtils.cleanDirectory(excelFile); return true; }
From source file:tools.httpserver.custom.ScriptList.java
/** * Update GreasySpoon service scripts based on provided parameters * @param params_values String table with each line composed of "param=value" * @param requestmode Set if information concerns REQMOD scripts or not (if not, means RESPMOD scripts) *//*from w w w .j a v a2 s . c o m*/ public static void update(String[] params_values, boolean requestmode) { Hashtable<String, String> table = new Hashtable<String, String>(); for (String s : params_values) { String[] values = s.split("="); if (values.length == 1) { table.put(values[0], ""); } else if (values.length == 2) { values[0] = values[0].replace("+", " "); table.put(values[0], values[1]); } } Vector<SpoonScript> todelete = new Vector<SpoonScript>(); Vector<SpoonScript> scripts = new Vector<SpoonScript>( Arrays.asList(requestmode ? icap.services.GreasySpoon.reqSpoonScripts : icap.services.GreasySpoon.respSpoonScripts)); boolean deleted = false; for (SpoonScript script : scripts) { String name = script.getFile().getName().toLowerCase(); if (table.get("delete_" + name) != null) { todelete.add(script); deleted = true; continue; } boolean newstatus = false; if (table.get("enable_" + name) != null) { newstatus = true; } if (script.getStatus() != newstatus) { script.setStatus(newstatus); script.saveWithNewStatus(); } } for (SpoonScript script : todelete) { scripts.remove(script); script.getFile().delete(); if (script.getFile().getName().endsWith(".java")) { String classname = script.getFile().getParent() + "/nativejava/" + ((JavaSpoonScript) script).getInternalName() + ".class"; new File(classname).delete(); } } if (deleted) { if (requestmode) { icap.services.GreasySpoon.reqSpoonScripts = scripts.toArray(new SpoonScript[0]); } else { icap.services.GreasySpoon.respSpoonScripts = scripts.toArray(new SpoonScript[0]); } } }
From source file:com.xpn.xwiki.plugin.XWikiPluginManager.java
public void removePlugin(String className) { this.plugins.remove(className); Object plugin = this.plugins_classes.get(className); this.plugins_classes.remove(className); for (String name : this.functionList.keySet()) { Vector<XWikiPluginInterface> pluginList = this.functionList.get(name); pluginList.remove(plugin); }// w w w . j ava 2 s .co m }