private static void printSystemProperties(final PrintStream out, final String cr) { try { final SuperProperties p = new SuperProperties(); p.setSpaceBetweenProperties(false); p.setKeyValueSeparator(" = "); p.setLineSeparator(cr); copyOpenEjbProperties(System.getProperties(), p); copyOpenEjbProperties(SystemInstance.get().getProperties(), p); p.store(out, null); final Properties p2 = System.getProperties(); final String[] misc = {"os.version", "os.name", "os.arch", "java.version", "java.vendor"}; for (final String prop : misc) { comment(out, cr, prop + "=" + p2.get(prop)); } } catch (final IOException e) { e.printStackTrace(new PrintWriter(new CommentsFilter(out))); } }
private static Properties asProperties(final String definition) throws IOException { final SuperProperties properties = new SuperProperties(); properties.caseInsensitive(true); properties.putAll(IO.readProperties(IO.read(definition), new Properties())); return properties; }
for (final Map.Entry<Object, Object> entry : entrySet()) { final String key = (String) entry.getKey(); final String value = (String) entry.getValue(); final Map<String, String> attributes = this.attributes.get(key); if (comment != null || !attributes.isEmpty()) { dumpComment(buffer, comment, attributes, "#"); if (spaceAfterComment) { buffer.append(lineSeparator); dumpString(buffer, key, true); if (value != null && value.length() > 0) { buffer.append(keyValueSeparator); dumpString(buffer, value, false);
/** * Gets the value of the properties property. * <p/> * <p/> * This accessor method returns a reference to the live Properties Object, * not a snapshot. Therefore any modification you make to the * returned Properties will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the properties property. * <p/> * <p/> * For example, to add a new value, do as follows: * <pre> * getProperties().setProperty(key, value); * </pre> * <p/> * <p/> * <p/> */ public Properties getProperties() { if (properties == null) { final SuperProperties sp = new SuperProperties(); sp.setCaseInsensitive(true); properties = sp; } return properties; }
continue; case 'u': nextChar = readUnicode(in); break; default: encoded = true; nextChar = decodeEscapeChar(nextChar); break;
int nextByte = decodeNextCharacter(in); if (nextByte == EOF) { break; put(key.toString(), value == null ? "" : value.toString()); setComment(key.toString(), comment.toString()); comment = new StringBuilder(); this.attributes.put(normalize(key.toString()), attributes); attributes = new LinkedHashMap<String, String>(); setIndent(indent); globalIndentSet = true; setIndent(indent); globalIndentSet = true; setCommentIndent(commentIndent); globalCommentIndentSet = true; checkForAttributeOrAppend(comment, attributes, commentLine, commentLineIndent); continue; put(key.toString(), value == null ? "" : value.toString()); setComment(key.toString(), comment.toString()); this.attributes.put(normalize(key.toString()), attributes);
final Properties overrides = new SuperProperties().caseInsensitive(true); overrides.putAll(base); overrides.putAll(module.getProperties()); final SuperProperties properties = new SuperProperties().caseInsensitive(true); properties.putAll(globalProperties); properties.put(entry.getKey().toString(), entry.getValue().toString()); properties.putAll(deployment.getProperties()); deployment.getProperties().clear(); final String property = key.substring(id.length()); if (properties.containsKey(property)) { log.debug("Overriding ejb " + bean.getEjbName() + " property " + property + "=" + entry.getValue()); } else { properties.put(property, entry.getValue()); if (properties.size() > 0) { if (deployment == null) { final EjbDeployment ejbDeployment = openejbJar.addEjbDeployment(bean);
if (properties.size() > 0) { out.println("## Properties"); out.println(); for (final Object key : properties.keySet()) { if (key instanceof String) { final String name = (String) key; final Map<String, String> attributes = properties.getAttributes(name); out.println(); final String value = properties.getProperty(name); String comment = properties.getComment(name);
private void buildDestinationDefinition(final JndiConsumer consumer, final JMSDestinationDefinition definition) { final JMSDestination destination = new JMSDestination(); destination.setName(definition.name()); destination.setClassName(definition.className()); destination.setInterfaceName(definition.interfaceName()); destination.setResourceAdapter(definition.resourceAdapter()); destination.setDestinationName(definition.destinationName()); for (final String s : definition.properties()) { final int equal = s.indexOf('='); if (equal < s.length() - 1) { final SuperProperties props = new SuperProperties(); try { props.load(new ByteArrayInputStream(s.getBytes())); for (final String key : props.stringPropertyNames()) { if (!key.isEmpty()) { destination.property(key, props.getProperty(key)); } } } catch (final IOException e) { final String key = s.substring(0, equal).trim(); final String value = s.substring(equal + 1).trim(); destination.property(key, value); } } else { destination.property(s.trim(), ""); } } consumer.getJMSDestination().add(destination); }
buf.append(indent); buf.append("<comment>"); buf.append(substitutePredefinedEntries(headComment)); buf.append("</comment>"); buf.append(lineSeparator); if (!isEmpty() && (spaceBetweenProperties || spaceAfterComment)) { buf.append(lineSeparator); for (final Map.Entry<Object, Object> entry : entrySet()) { final String key = entry.getKey().toString(); final String value = entry.getValue().toString(); dumpComment(buf, comment, attributes, ""); buf.append(substitutePredefinedEntries(key)); buf.append("\">"); buf.append(substitutePredefinedEntries(value)); buf.append("</entry>"); buf.append(lineSeparator);
/** * Gets the value of the properties property. * <p/> * <p/> * This accessor method returns a reference to the live Properties Object, * not a snapshot. Therefore any modification you make to the * returned Properties will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the properties property. * <p/> * <p/> * For example, to add a new value, do as follows: * <pre> * getProperties().setProperty(key, value); * </pre> * <p/> * <p/> * <p/> */ public Properties getProperties() { if (properties == null) { properties = new SuperProperties(); } return properties; }
if (driver != null && !properties.containsKey("driverClassName")) { converted.setProperty("driverClassName", driver); final String jdbcDriver = (String) properties.remove("JdbcDriver"); if (jdbcDriver != null && !properties.containsKey("driverClassName")) { converted.setProperty("driverClassName", jdbcDriver); final String url = (String) properties.remove("JdbcUrl"); if (url != null && !properties.containsKey("url")) { converted.setProperty("url", url); final String user = (String) properties.remove("user"); if (user != null && !properties.containsKey("username")) { converted.setProperty("username", user); final String maxWait = toMillis((String) properties.remove("maxWaitTime")); if (maxWait != null && !properties.containsKey("maxWait")) { converted.setProperty("maxWait", maxWait); final String tb = toMillis((String) properties.remove("timeBetweenEvictionRuns")); if (tb != null && !properties.containsKey("timeBetweenEvictionRunsMillis")) { converted.setProperty("timeBetweenEvictionRunsMillis", tb); final String minEvict = toMillis((String) properties.remove("minEvictableIdleTime")); if (minEvict != null && !properties.containsKey("minEvictableIdleTimeMillis")) { converted.setProperty("minEvictableIdleTimeMillis", minEvict); final String passwordCipher = properties.getProperty("PasswordCipher"); if (passwordCipher != null && "PlainText".equals(passwordCipher)) { // no need to warn about it
final SuperProperties properties = new SuperProperties(); properties.putAll(parent.getProperties()); properties.putAll(child.getProperties());
final Properties props = new SuperProperties().caseInsensitive(true);
int nextByte = decodeNextCharacter(in); if (nextByte == EOF) break; char nextChar = (char) (nextByte & 0xff); put(key.toString(), value == null ? "" : value.toString()); setComment(key.toString(), comment.toString()); comment = new StringBuilder(); this.attributes.put(normalize(key.toString()), attributes); attributes = new LinkedHashMap<String,String>(); setIndent(indent); globalIndentSet = true; setIndent(indent); globalIndentSet = true; setCommentIndent(commentIndent); globalCommentIndentSet = true; put(key.toString(), value == null ? "" : value.toString()); setComment(key.toString(), comment.toString()); this.attributes.put(normalize(key.toString()), attributes); setIndent(indent);
final Properties overrides = new SuperProperties().caseInsensitive(true); overrides.putAll(base); overrides.putAll(module.getProperties()); final SuperProperties properties = new SuperProperties().caseInsensitive(true); properties.putAll(globalProperties); properties.put(entry.getKey().toString(), entry.getValue().toString()); properties.putAll(deployment.getProperties()); deployment.getProperties().clear(); final String property = key.substring(id.length()); if (properties.containsKey(property)) { log.debug("Overriding ejb " + bean.getEjbName() + " property " + property + "=" + entry.getValue()); } else { properties.put(property, entry.getValue()); if (properties.size() > 0) { if (deployment == null) { final EjbDeployment ejbDeployment = openejbJar.addEjbDeployment(bean);
if (properties.size() > 0) { out.println("Supports the following properties"); out.println(" || Property Name || Description ||"); for (Object key : properties.keySet()) { if (key instanceof String) { String name = (String) key; Map<String, String> attributes = properties.getAttributes(name); if (!attributes.containsKey("hidden")) { String value = properties.getProperty(name); String comment = properties.getComment(name);
final int equal = s.indexOf('='); if (equal < s.length() - 1) { final SuperProperties props = new SuperProperties(); try { props.load(new ByteArrayInputStream(s.getBytes())); for (final String key : props.stringPropertyNames()) { if (!key.isEmpty()) { connectionFactory.property(key, props.getProperty(key));
buf.append(indent); buf.append("<comment>"); buf.append(substitutePredefinedEntries(headComment)); buf.append("</comment>"); buf.append(lineSeparator); if (!isEmpty() && (spaceBetweenProperties || spaceAfterComment)) { buf.append(lineSeparator); for (Map.Entry<Object, Object> entry : entrySet()) { String key = (String) entry.getKey(); String value = (String) entry.getValue(); dumpComment(buf, comment, attributes, ""); buf.append(substitutePredefinedEntries(key)); buf.append("\">"); buf.append(substitutePredefinedEntries(value)); buf.append("</entry>"); buf.append(lineSeparator);
/** * Gets the value of the properties property. * <p/> * <p/> * This accessor method returns a reference to the live Properties Object, * not a snapshot. Therefore any modification you make to the * returned Properties will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the properties property. * <p/> * <p/> * For example, to add a new value, do as follows: * <pre> * getProperties().setProperty(key, value); * </pre> * <p/> * <p/> * <p/> */ public Properties getProperties() { if (properties == null) { properties = new SuperProperties(); } return properties; }