List of usage examples for java.util Hashtable Hashtable
public Hashtable()
From source file:com.oracle.osgi.jmx.compendium.ConfigAdminManager.java
@SuppressWarnings("unchecked") public void addProperty(String pid, String location, String name, String value, String type) throws IOException { Configuration config = admin.getConfiguration(pid, location); Dictionary properties = config.getProperties(); if (properties == null) { properties = new Hashtable(); }/*from w w w . j a v a 2s . c o m*/ properties.put(name, parse(value, type)); config.update(properties); }
From source file:Controller.ControllerImageCustomerIndex.java
/** * Handles the HTTP <code>POST</code> method. * * @param request servlet request/* w w w. j av a 2 s. co m*/ * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (!isMultipart) { } else { FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List items = null; try { items = upload.parseRequest(request); } catch (Exception e) { e.printStackTrace(); } Iterator iter = items.iterator(); Hashtable params = new Hashtable(); String fileName = null; while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (item.isFormField()) { params.put(item.getFieldName(), item.getString()); } else { try { String itemName = item.getName(); fileName = itemName.substring(itemName.lastIndexOf("\\") + 1); System.out.println("path" + fileName); String RealPath = getServletContext().getRealPath("/") + "upload\\" + fileName; System.out.println("Rpath" + RealPath); File savedFile = new File(RealPath); item.write(savedFile); String username = (String) params.get("txtusername"); String password = (String) params.get("txpassword"); String hoten = (String) params.get("txthoten"); String gioitinh = (String) params.get("txtgioitinh"); String email = (String) params.get("txtemail"); String role = "false"; Customer cus = new Customer(username, password, hoten, gioitinh, email, role, "upload\\" + fileName); CustomerDAO.ThemKhachHang(cus); RequestDispatcher rd = request.getRequestDispatcher("index.jsp"); rd.forward(request, response); } catch (Exception e) { e.printStackTrace(); } } } } }
From source file:com.sangachy.license.LicenseHelperCommand.java
public SingleTask getUploadTask(CommandLine commandLine) { String licensePath = commandLine.getOptionValue("lp"); if (null == licensePath) { System.out.println("License "); return null; }/* w ww . j a v a2s.com*/ String envKey = commandLine.getOptionValue("ek"); if (null == envKey) { System.out.println(""); //envKey = ""; } Hashtable hashTable = new Hashtable(); //hashTable.put("", licensePath); //hashTable.put(" ", envKey); SingleTask task = new UploadLicenseTask(); task.preExecute(hashTable); task.excute(); task.aftExcute(); return task; }
From source file:Controller.ControllerImageCustomer.java
/** * Handles the HTTP <code>POST</code> method. * * @param request servlet request/*from w w w. ja v a2 s .c om*/ * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (!isMultipart) { } else { FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List items = null; try { items = upload.parseRequest(request); } catch (Exception e) { e.printStackTrace(); } Iterator iter = items.iterator(); Hashtable params = new Hashtable(); String fileName = null; while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (item.isFormField()) { params.put(item.getFieldName(), item.getString()); } else { try { String itemName = item.getName(); fileName = itemName.substring(itemName.lastIndexOf("\\") + 1); System.out.println("path" + fileName); String RealPath = getServletContext().getRealPath("/") + "upload\\" + fileName; System.out.println("Rpath" + RealPath); File savedFile = new File(RealPath); item.write(savedFile); String username = (String) params.get("txtusername"); String password = (String) params.get("txpassword"); String hoten = (String) params.get("txthoten"); String gioitinh = (String) params.get("txtgioitinh"); String email = (String) params.get("txtemail"); String role = "false"; String Register = (String) params.get("Register"); String url = "CustomerDao.jsp"; if (Register.equals("Register")) { url = "index.jsp"; } Customer cus = new Customer(username, password, hoten, gioitinh, email, role, "upload\\" + fileName); CustomerDAO.ThemKhachHang(cus); RequestDispatcher rd = request.getRequestDispatcher(url); rd.forward(request, response); } catch (Exception e) { e.printStackTrace(); } } } } }
From source file:edu.csun.ecs.cs.multitouchj.ui.test.PhotoTest.java
public PhotoTest() { touchableControls = new LinkedList<TouchableControl>(); desiredPositions = new Hashtable<TouchableControl, Point>(); desiredAngles = new Hashtable<TouchableControl, Float>(); desiredSizes = new Hashtable<TouchableControl, Size>(); }
From source file:com.church.tools.ChartTools.java
/** * Generate pie chart.//from w ww. j av a2s .com * * @param title the title * @param values the values * @param captions the captions * @param width the width * @param height the height * @param color the color * * @return the buffered image */ public static BufferedImage GeneratePieChart(String title, double[] values, String[] captions, int width, int height, Color color) { BufferedImage bufferedImage = null; DefaultPieDataset pieDataset = new DefaultPieDataset(); Hashtable<String, String> ht = new Hashtable<String, String>(); for (int i = 0; i < values.length; i++) ht.put(captions[i], Double.toString(values[i])); Enumeration<String> enu = ht.keys(); int i = 0; while (enu.hasMoreElements()) { String str = (String) enu.nextElement(); pieDataset.setValue(str, new Double(Double.parseDouble((String) ht.get(str)))); i++; } JFreeChart chart = ChartFactory.createPieChart(title, pieDataset, false, false, false); chart.setBackgroundPaint(color); bufferedImage = chart.createBufferedImage(width, height); return bufferedImage; }
From source file:com.alfaariss.oa.engine.attribute.gather.processor.jndi.JNDIGatherer.java
/** * Creates the object./*from ww w. j a v a 2 s. c o m*/ */ public JNDIGatherer() { _logger = LogFactory.getLog(JNDIGatherer.class); _sID = null; _sFriendlyName = null; _bEnabled = false; _sDNBase = null; _sDNUser = null; _sFilter = null; _htJNDIEnvironment = null; _htMapper = new Hashtable<String, String>(); _listGather = new Vector<String>(); }
From source file:au.edu.archer.dimsim.buffer.impl.DeliveryBuffer.java
public DeliveryBuffer(IBufferPoolManager bMgr, int capacity) { if (capacity > 0) { this.capacity = capacity; } else {/*from w w w . j a va 2 s. com*/ capacity = default_capacity; } if (bMgr != null) { this.buffMgr = bMgr; } else { bMgr = new MemoryBufferManager(); } parcelBuffers = new Hashtable<String, IBuffer>(); }
From source file:com.granule.json.utils.internal.JSONObject.java
/** * Constructor.//from w w w. j a va 2 s . c o m * @param objectName The object (tag) name being constructed. * @param attrs A proprerties object of all the attributes present for the tag. */ public JSONObject(String objectName, Properties attrs) { this.objectName = objectName; this.attrs = attrs; this.jsonObjects = new Hashtable(); }
From source file:io.wcm.caravan.jaxrs.publisher.impl.JaxRsBundleTracker.java
@Override public ComponentInstance addingBundle(Bundle bundle, BundleEvent event) { String applicationPath = ApplicationPath.get(bundle); if (StringUtils.isNotBlank(applicationPath)) { if (log.isInfoEnabled()) { log.info("Mount JAX-RS application {} to {}", bundle.getSymbolicName(), applicationPath); }/* w w w .j a v a2 s .co m*/ // register JAX-RS application as servlet on HTTP whiteboard Dictionary<String, Object> serviceConfig = new Hashtable<>(); serviceConfig.put("alias", applicationPath); serviceConfig.put(ServletContainerBridge.PROPERTY_BUNDLE, bundle); return servletContainerBridgeFactory.newInstance(serviceConfig); } return null; }