List of usage examples for java.util Hashtable Hashtable
public Hashtable()
From source file:io.fabric8.mq.util.BrokerJmxUtils.java
public static Hashtable<String, String> getProperties(String string) { Hashtable<String, String> result = new Hashtable<>(); String[] props = string.split(","); for (String prop : props) { String[] keyValues = prop.split("="); result.put(keyValues[0].trim(), ObjectName.quote(keyValues[1].trim())); }// ww w .j a v a 2 s . c om return result; }
From source file:io.fabric8.mq.controller.util.BrokerJmxUtils.java
public static Hashtable<String, String> getProperties(String string) { Hashtable<String, String> result = new Hashtable<>(); String[] props = string.split(","); for (int i = 0; i < props.length; i++) { String[] keyValues = props[i].split("="); result.put(keyValues[0].trim(), ObjectName.quote(keyValues[1].trim())); }/*from ww w. j a v a2s . com*/ return result; }
From source file:com.wso2telco.identity.application.authentication.endpoint.util.ReadMobileConnectConfig.java
public static Map<String, String> query(String XpathExpression) { Map<String, String> ConfigfileAttributes = new Hashtable<String, String>(); // standard for reading an XML file DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true);/* w w w . j a v a 2s . c om*/ DocumentBuilder builder; Document doc = null; XPathExpression expr = null; try { builder = factory.newDocumentBuilder(); doc = builder.parse(CarbonUtils.getCarbonConfigDirPath() + File.separator + "mobile-connect.xml"); // create an XPathFactory XPathFactory xFactory = XPathFactory.newInstance(); // create an XPath object XPath xpath = xFactory.newXPath(); // compile the XPath expression expr = xpath.compile("//" + XpathExpression + "/*"); // run the query and get a nodeset Object result = expr.evaluate(doc, XPathConstants.NODESET); // // cast the result to a DOM NodeList NodeList nodes = (NodeList) result; for (int i = 0; i < nodes.getLength(); i++) { ConfigfileAttributes.put(nodes.item(i).getNodeName(), nodes.item(i).getTextContent()); } } catch (SAXException e) { log.error(e.getMessage()); } catch (IOException e) { log.error(e.getMessage()); } catch (ParserConfigurationException e) { log.error(e.getMessage()); } catch (XPathExpressionException e) { log.error(e.getMessage()); } return ConfigfileAttributes; }
From source file:FontDerivation.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Create a 1-point font. Font font = new Font("Serif", Font.PLAIN, 1); float x = 20, y = 20; Font font24 = font.deriveFont(24.0f); g2.setFont(font24);/*from ww w . ja v a2 s.c o m*/ g2.drawString("font.deriveFont(24.0f)", x, y += 30); Font font24italic = font24.deriveFont(Font.ITALIC); g2.setFont(font24italic); g2.drawString("font24.deriveFont(Font.ITALIC)", x, y += 30); AffineTransform at = new AffineTransform(); at.shear(.2, 0); Font font24shear = font24.deriveFont(at); g2.setFont(font24shear); g2.drawString("font24.deriveFont(at)", x, y += 30); Hashtable attributes = new Hashtable(); attributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); Font font24bold = font24.deriveFont(attributes); g2.setFont(font24bold); g2.drawString("font24.deriveFont(attributes)", x, y += 30); }
From source file:net.giovannicapuano.visualnovel.Memory.java
public static Hashtable<String, String> getKeyValues(Context context) { Hashtable<String, String> keyvalues = new Hashtable<String, String>(); try {// w w w .j a v a2 s . c o m StringBuffer buffer = new StringBuffer(); InputStreamReader input = new InputStreamReader(context.openFileInput(KEYVALUES)); BufferedReader reader = new BufferedReader(input); String line; while ((line = reader.readLine()) != null) buffer.append(line); JSONObject json = new JSONObject(buffer.toString()); Iterator<?> keys = json.keys(); while (keys.hasNext()) { String key = (String) keys.next(); keyvalues.put(key, json.getString(key)); } } catch (Exception e) { Utils.error(e); } return keyvalues; }
From source file:MainClass.java
public void paint(Graphics g) { Dimension size = getSize();//from w ww . j av a 2s . co m String s = "To java2s.com or not to java2s.com, that is a question"; Hashtable map = new Hashtable(); map.put(TextAttribute.SIZE, new Float(32.0f)); AttributedString as = new AttributedString(s, map); map = new Hashtable(); map.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); as.addAttributes(map, 33, 52); AttributedCharacterIterator aci = as.getIterator(); int startIndex = aci.getBeginIndex(); int endIndex = aci.getEndIndex(); LineBreakMeasurer measurer; measurer = new LineBreakMeasurer(aci, new FontRenderContext(null, false, false)); measurer.setPosition(startIndex); float wrappingWidth = (float) size.width; float Y = 0.0f; while (measurer.getPosition() < endIndex) { TextLayout layout = measurer.nextLayout(wrappingWidth); Y += layout.getAscent(); float X = 0.0f; switch (justify) { case LEFT: if (layout.isLeftToRight()) X = 0.0f; else X = wrappingWidth - layout.getAdvance(); break; case RIGHT: if (layout.isLeftToRight()) X = wrappingWidth - layout.getVisibleAdvance(); else X = wrappingWidth; break; case CENTER: if (layout.isLeftToRight()) X = (wrappingWidth - layout.getVisibleAdvance()) / 2; else X = (wrappingWidth + layout.getAdvance()) / 2 - layout.getAdvance(); break; case EQUALITY: layout = layout.getJustifiedLayout(wrappingWidth); } layout.draw((Graphics2D) g, X, Y); Y += layout.getDescent() + layout.getLeading(); } }
From source file:org.knowhowlab.osgi.monitoradmin.mocks.MonitorableMockServiceReference.java
public MonitorableMockServiceReference(String pid) { super(new String[] { Monitorable.class.getName() }); Hashtable<String, String> props = new Hashtable<String, String>(); props.put(Constants.SERVICE_PID, pid); setProperties(props);//w w w. java2 s . c om }
From source file:FileMonitor.java
private FileMonitor() { timer = new Timer(true); timerTasks = new Hashtable<String, TimerTask>(); }
From source file:info.magnolia.cms.beans.runtime.MultipartForm.java
public MultipartForm() { this.parameters = new Hashtable(); this.documents = new Hashtable(); this.parameterList = new Hashtable(); }
From source file:com.datasalt.utils.commons.URLUtils.java
/** Extract parameters from a url so that Ning (or other crawling utilities) can properly encode them if necessary. This was necesssary for facebook requests, which are bundled with "next urls" that have funny characters in them such as this /* ww w . j a va2s . c o m*/ "122524694445860|7fc6dd5fe13b43c09dad009d.1-1056745212|An3Xub_HEDRsGxVPkmy71VdkFhQ" * @param url */ public static Hashtable<String, String> extractParameters(String url) { Hashtable<String, String> pars = new Hashtable<String, String>(); if (!url.contains("?")) { log.warn("WARNING : URL HAS NO PARAMETERS ! " + url); return pars; } String parameters = StringUtils.substringAfter(url, "?"); for (String pairs : parameters.split("&")) { String[] nv = pairs.split("="); pars.put(nv[0], nv[1]); } return pars; }