/** * <p>Reads an properties file from an {@link InputStream} * and uses it to configure this {@link FactoryConfiguration}.</p> * * @param url the URL to read from */ protected void readImpl(URL url) throws IOException { ExtProperties props = new ExtProperties(); props.load(url.openStream()); // all factory settings should be prefixed with "tools" read(props.subset("tools")); }
public void read(ExtProperties factory) { // get the global properties readProperties(factory, this); // get the toolboxes readToolboxes(factory); // get the data readData(factory.subset("data")); }
rsvc.getConfiguration().subset(loaderID.toString());
protected void readProperties(ExtProperties configProps, Configuration config) { ExtProperties properties = configProps.subset("property"); if (properties != null) { for (Iterator i = properties.getKeys(); i.hasNext(); ) { String name = (String)i.next(); String value = properties.getString(name); ExtProperties propProps = properties.subset(name); if (propProps.size() == 1) { // then set this as a 'simple' property config.setProperty(name, value); } else { // add it as a convertable property Property property = new Property(); property.setName(name); property.setValue(value); // set the type/converter properties setProperties(propProps, property); } } } }
protected void readData(ExtProperties dataset) { if (dataset != null) { for (Iterator i = dataset.getKeys(); i.hasNext(); ) { String key = (String)i.next(); // if it contains a period, it can't be a context key; // it must be a data property. ignore it for now. if (key.indexOf('.') >= 0) { continue; } Data data = new Data(); data.setKey(key); data.setValue(dataset.getString(key)); // get/set the type/converter properties ExtProperties props = dataset.subset(key); setProperties(props, data); addData(data); } } }
protected void readToolboxes(ExtProperties factory) { String[] scopes = factory.getStringArray("toolbox"); for (String scope : scopes) { ToolboxConfiguration toolbox = new ToolboxConfiguration(); toolbox.setScope(scope); addToolbox(toolbox); ExtProperties toolboxProps = factory.subset(scope); readTools(toolboxProps, toolbox); readProperties(toolboxProps, toolbox); } }
ExtProperties toolProps = tools.subset(key); readProperties(toolProps, tool);