/** * 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; }
/** * 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; }
/** * 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; }
public Properties unmarshal(String s) throws Exception { Properties properties = new SuperProperties(); ByteArrayInputStream in = new ByteArrayInputStream(s.getBytes()); properties.load(in); return properties; }
private ResourceInfo copy(ResourceInfo a) { ResourceInfo b = new ResourceInfo(); b.id = a.id; b.service = a.service; b.className = a.className; b.codebase = a.codebase; b.displayName = a.displayName; b.description = a.description; b.factoryMethod = a.factoryMethod; b.constructorArgs.addAll(a.constructorArgs); b.types.addAll(a.types); b.properties = new SuperProperties(); b.properties.putAll(a.properties); return b; }
private ResourceInfo copy(final ResourceInfo a) { final ResourceInfo b = new ResourceInfo(); b.id = a.id; b.service = a.service; b.className = a.className; b.codebase = a.codebase; b.displayName = a.displayName; b.description = a.description; b.factoryMethod = a.factoryMethod; b.constructorArgs.addAll(a.constructorArgs); b.originAppName = a.originAppName; b.types.addAll(a.types); b.properties = new SuperProperties(); b.properties.putAll(a.properties); if (a.classpath != null) { b.classpath = new URI[a.classpath.length]; System.arraycopy(a.classpath, 0, b.classpath, 0, a.classpath.length); } //b.aliases.addAll(a.aliases); return b; }
private ResourceInfo copy(final ResourceInfo a) { final ResourceInfo b = new ResourceInfo(); b.id = a.id; b.service = a.service; b.className = a.className; b.codebase = a.codebase; b.displayName = a.displayName; b.description = a.description; b.factoryMethod = a.factoryMethod; b.constructorArgs.addAll(a.constructorArgs); b.originAppName = a.originAppName; b.types.addAll(a.types); b.properties = new SuperProperties(); b.properties.putAll(a.properties); if (a.classpath != null) { b.classpath = new URI[a.classpath.length]; System.arraycopy(a.classpath, 0, b.classpath, 0, a.classpath.length); } //b.aliases.addAll(a.aliases); return b; }
private static Properties holds(final Properties properties, final boolean cache) { // we can put null values in SuperProperties, since properties is often of this type we need to tolerate it final Properties updated = new SuperProperties(); if (properties == null) { return updated; } for (final Map.Entry<Object, Object> entry : properties.entrySet()) { final Object rawValue = entry.getValue(); if (rawValue instanceof String) { final String value = (String) rawValue; updated.put(entry.getKey(), cache ? value(value) : simpleValue(value)); } else { updated.put(entry.getKey(), rawValue); } } return updated; }
private static Properties holds(final Properties properties, final boolean cache) { // we can put null values in SuperProperties, since properties is often of this type we need to tolerate it final Properties updated = new SuperProperties(); if (properties == null) { return updated; } for (final Map.Entry<Object, Object> entry : properties.entrySet()) { final Object rawValue = entry.getValue(); if (rawValue instanceof String) { final String value = (String) rawValue; updated.put(entry.getKey(), cache ? value(value) : simpleValueAsStringOrCharArray(value)); } else { updated.put(entry.getKey(), rawValue); } } return updated; }
public Properties unmarshal(final String s) throws Exception { return IO.readProperties(IO.read(s), new SuperProperties()); }
public Properties unmarshal(final String s) throws Exception { return IO.readProperties(IO.read(s), new SuperProperties()); }
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; }
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; }
@Override public CommonDataSource pool(final String name, final String driver, final Properties properties) { final Properties converted = new Properties(); converted.setProperty("name", name); final SuperProperties prop = new SuperProperties().caseInsensitive(true); prop.putAll(properties); updateProperties(prop, converted, driver); final PoolConfiguration config = build(PoolProperties.class, converted); final String xa = String.class.cast(properties.remove("XaDataSource")); if (xa != null) { final XADataSource xaDs = XADataSourceResource.proxy(Thread.currentThread().getContextClassLoader(), xa); final TomEEDataSource instance = new TomEEDataSource(config, name, xaDs); return build(TomEEDataSource.class, instance, converted); } else { final TomEEDataSource instance = new TomEEDataSource(config, name); return build(TomEEDataSource.class, instance, converted); } }
private static void printSystemProperties() { try { SuperProperties p = new SuperProperties(); p.setSpaceBetweenProperties(false); p.setKeyValueSeparator(" = "); copyOpenEjbProperties(System.getProperties(), p); copyOpenEjbProperties(SystemInstance.get().getProperties(), p); p.store(System.out, null); Properties p2 = System.getProperties(); String[] misc = {"os.version", "os.name", "os.arch", "java.version", "java.vendor"}; for (String prop : misc) { comment(prop + "=" + p2.get(prop)); } } catch (IOException e) { e.printStackTrace(new PrintWriter(new CommentsFilter(System.out))); } }
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))); } }
@Override public DataSource pool(final String name, final DataSource ds, final Properties properties) { final Properties converted = new Properties(); final SuperProperties prop = new SuperProperties().caseInsensitive(true); prop.putAll(properties); updateProperties(prop, converted, null); final PoolConfiguration config = build(PoolProperties.class, converted); config.setDataSource(ds); final ConnectionPool pool; try { pool = new ConnectionPool(config); } catch (final SQLException e) { throw new IllegalStateException(e); } return build(TomEEDataSource.class, new TomEEDataSource(config, pool, name), converted); }
@Override public CommonDataSource pool(final String name, final String driver, final Properties properties) { if (!isMonitorDatabase()) { return super.pool(name, driver, properties); } final Properties converted = new Properties(); converted.setProperty("name", name); final SuperProperties prop = new SuperProperties().caseInsensitive(true); prop.putAll(properties); convertProperties(driver, converted, prop); final PoolConfiguration config = build(PoolProperties.class, converted); if (config.getName() == null) { config.setName(name); } final TomEEDataSource ds = build(TribestreamDataSource.class, new TribestreamDataSource(config, name), converted); final String xa = String.class.cast(properties.remove("XaDataSource")); if (xa != null) { cleanProperty(ds, "xadatasource"); final XADataSource xaDs = XADataSourceResource.proxy(Thread.currentThread().getContextClassLoader(), xa); ds.setDataSource(xaDs); } return ds; }
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(JavaSecurityManagers.getSystemProperties(), p); copyOpenEjbProperties(SystemInstance.get().getProperties(), p); p.store(out, null); final Properties p2 = JavaSecurityManagers.getSystemProperties(); 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))); } }
@Override public DataSource pool(final String name, final DataSource ds, final Properties properties) { if (!isMonitorDatabase()) { return super.pool(name, ds, properties); } final Properties converted = new Properties(); final SuperProperties prop = new SuperProperties().caseInsensitive(true); prop.putAll(properties); convertProperties(null, converted, prop); final PoolConfiguration config = build(PoolProperties.class, converted); config.setDataSource(ds); final ConnectionPool pool; try { pool = new ConnectionPool(config); } catch (final SQLException e) { throw new IllegalStateException(e); } if (config.getName() == null) { config.setName(name); } return build(TribestreamDataSource.class, new TribestreamDataSource(config, pool, name), converted); }