/** * Returns the "key, parameter" entry parsed form the parsed configuration * line.<p> * This method is useful if the caller need to preserve the oder of multi * line configurations and therefore can not use the parseConfig methods. * @param line a configuration line * @return the key, parameter entry */ public static Entry<String,Map<String,List<String>>> parseConfigEntry(String line){ String[] elements = line.split(";"); return Collections.singletonMap(elements[0].trim(), getParameters(elements,1)) .entrySet().iterator().next(); }
/** * Returns the "key, parameter" entry parsed form the parsed configuration * line.<p> * This method is useful if the caller need to preserve the oder of multi * line configurations and therefore can not use the parseConfig methods. * @param line a configuration line * @return the key, parameter entry */ public static Entry<String,Map<String,List<String>>> parseConfigEntry(String line){ String[] elements = line.split(";"); return Collections.singletonMap(elements[0].trim(), getParameters(elements,1)) .entrySet().iterator().next(); }
/** * Internally used to parse single lines of an parsed {@link Iterable} or * {@link Iterator} * @param config the map used to write the parsed values * @param line the line to parse */ private static void parseLine(Map<String,Map<String,List<String>>> config, String line) { if(line == null || line.isEmpty() || line.charAt(0) == ';'){ log.warn("Configuration entry ignored because of empty Engine name " + "(entry: '"+line+"')!"); } String[] elements = line.split(";"); String key = elements[0].trim(); if(!config.containsKey(key)){ config.put(key, getParameters(elements,1)); } else { throw new IllegalArgumentException("The configuration MUST NOT contain the same key '"+ elements[0]+"' multiple times!"); } }
/** * Internally used to parse single lines of an parsed {@link Iterable} or * {@link Iterator} * @param config the map used to write the parsed values * @param line the line to parse */ private static void parseLine(Map<String,Map<String,List<String>>> config, String line) { if(line == null || line.isEmpty() || line.charAt(0) == ';'){ log.warn("Configuration entry ignored because of empty Engine name " + "(entry: '"+line+"')!"); } String[] elements = line.split(";"); String key = elements[0].trim(); if(!config.containsKey(key)){ config.put(key, getParameters(elements,1)); } else { throw new IllegalArgumentException("The configuration MUST NOT contain the same key '"+ elements[0]+"' multiple times!"); } }
/** * Utility that extracts enhancement properties from a configuration line * using the syntax * <pre> * {prop}={value-1},{value-2},..,{value-n} * </pre> * @param line the configuration of a single enhancement property * @return The enhancement properties extracted from the parsed parameters * @since 0.12.1 */ public static Map<String,Object> getEnhancementProperties(Collection<String> lines){ if(lines == null || lines.isEmpty()){ return null; } else { return getEnhancementProperties(getParameters( lines.toArray(new String[lines.size()]), 0)); } }
/** * Utility that extracts enhancement properties from a configuration line * using the syntax * <pre> * {prop}={value-1},{value-2},..,{value-n} * </pre> * @param line the configuration of a single enhancement property * @return The enhancement properties extracted from the parsed parameters * @since 0.12.1 */ public static Map<String,Object> getEnhancementProperties(Collection<String> lines){ if(lines == null || lines.isEmpty()){ return null; } else { return getEnhancementProperties(getParameters( lines.toArray(new String[lines.size()]), 0)); } }
String[] config = resource.toString().split(";"); String resourceName = config[0]; String format = getValue(getParameters(config, 1),"format"); if(format == null){ format = guessRdfFormat(getExtension(resourceName));