/** * @param service * @return a map containing all the properties for the given service. * @see #getProperties(String, String) */ public Map getProperties(QName service) { return getProperties(service, null); }
/** * Clear all existing content, then read the file and parse each property. Simply logs a message and returns if the file does not exist. * * @throws IOException if the file is a Directory */ public void loadFiles() throws IOException { // #1. clear all existing content clear(); // #3. put the root map initRoot(); for (File file : files) { Properties props = loadFile(file); if(!props.isEmpty()) processProperties(props, file); } replacePlaceholders(); }
public String getProperty(QName service, String property) { return getProperty(service, null, property); }
private void processProperties(Properties props, File file) throws IOException { validatePropertyNames(props, file); Map<String, String> nsByAlias = collectAliases(props, file); String[] info = parseProperty(key); String nsalias = info[0]; String service = info[1]; if (s == null) { s = new ChainedMap(getRootMap());
public void init() { try { // do not hold a reference on the file list, so that changes are handled // and always create a new instance of the HierarchicalProperties object = new HierarchicalProperties(collectEndpointConfigFiles()); } catch (IOException e) { throw new ContextException("Integration-Layer Properties cannot be loaded!", e); } } }
public String getProperty(String property) { return (String) getRootMap().get(property); }
/** * @param files the property file to be loaded. The file may not exist. * But if the file exists it has to be a file (not a directory), otherwhise an IOException is thrown. Files will be loaded in the given order. * @param prefix the property prefix * @throws IOException */ public HierarchicalProperties(File[] files, String prefix) throws IOException { this.files = files; this.prefix = prefix; this.dotted_prefix = "." + prefix + "."; loadFiles(); }
protected ChainedMap getRootMap() { Object o = hierarchicalMap.get(null, null); if (o == null) { o = initRoot(); } return (ChainedMap) o; }
public void init() { try { // do not hold a reference on the file list, so that changes are handled // and always create a new instance of the HierarchicalProperties object = new HierarchicalProperties(collectEndpointConfigFiles()); } catch (IOException e) { throw new ContextException("Integration-Layer Properties cannot be loaded!", e); } } }
private void replacePlaceholders() { Pattern systemProperty = Pattern.compile("\\$\\{system\\.([^\\}]+)\\}"); Pattern environmentVariable = Pattern.compile("\\$\\{env\\.([^\\}]+)\\}"); Pattern localPlaceholder = Pattern.compile("\\$\\{([^\\}]+)\\}"); for (Iterator it = hierarchicalMap.values().iterator(); it.hasNext();) { Map properties = ((ChainedMap) it.next()).child; for (Iterator it1 = properties.entrySet().iterator(); it1.hasNext();) { Map.Entry e = (Map.Entry) it1.next(); // /!\ replacement values themselves might contain placeholders. So always retrieve the value from the map entry e.setValue(SystemUtils.replaceProperties((String) e.getValue(), localPlaceholder, getRootMap().child)); e.setValue(SystemUtils.replaceProperties((String) e.getValue(), systemProperty, System.getProperties())); e.setValue(SystemUtils.replaceProperties((String) e.getValue(), environmentVariable, System.getenv())); } } }
public Map getProperties(String serviceNamespaceURI, String serviceLocalPart) { return getProperties(new QName(serviceNamespaceURI, serviceLocalPart)); }
public String getProperty(String serviceNamespaceURI, String serviceLocalPart, String property) { return getProperty(new QName(serviceNamespaceURI, serviceLocalPart), property); }
public String getProperty(QName service, String port, String property) { return (String) getProperties(service, port).get(property); }
public String getProperty(String serviceNamespaceURI, String serviceLocalPart, String port, String property) { return getProperty(new QName(serviceNamespaceURI, serviceLocalPart), port, property); }
public Map getProperties(String serviceNamespaceURI, String serviceLocalPart, String port) { return getProperties(new QName(serviceNamespaceURI, serviceLocalPart), port); }
@SuppressWarnings("unchecked") public Map<String, String> getEndpointProperties(QName service, String port) { // update properties if necessary // do it manually to save resources (instead of using a thread) propertiesWatchDog.check(); final Map prop = propertiesWatchDog.getObserver().get().getProperties(service, port); if(!prop.isEmpty() && __log.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Properties for "); if(service!=null) msg.append("service ").append(service); if(port!=null) msg.append(", port ").append(port); msg.append(": {"); for (Iterator it = prop.entrySet().iterator(); it.hasNext();) { Map.Entry e = (Map.Entry) it.next(); msg.append(e.getKey()).append("=>").append(e.getValue()); if(it.hasNext()) msg.append(", "); } msg.append("}"); __log.debug(msg); } return prop; }
@SuppressWarnings("unchecked") public Map<String, String> getEndpointProperties(EndpointReference epr) { final Map map = eprContext.getConfigLookup(epr); final QName service = (QName) map.get("service"); final String port = (String) map.get("port"); // update properties if necessary // do it manually to save resources (instead of using a thread) propertiesWatchDog.check(); final Map prop = propertiesWatchDog.getObserver().get().getProperties(service, port); if(!prop.isEmpty() && __log.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Properties for "); if(service!=null) msg.append("service ").append(service); if(port!=null) msg.append(", port ").append(port); msg.append(": {"); for (Iterator it = prop.entrySet().iterator(); it.hasNext();) { Map.Entry e = (Map.Entry) it.next(); msg.append(e.getKey()).append("=>").append(e.getValue()); if(it.hasNext()) msg.append(", "); } msg.append("}"); __log.debug(msg); } return prop; }
if (cm == null) { return getProperties((QName) null, null);