org.daisy.pipeline.braille.common.BundledNativePath Maven / Gradle / Ivy
package org.daisy.pipeline.braille.common;
import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import static org.daisy.pipeline.braille.common.util.OS;
public class BundledNativePath extends StandardNativePath {
private static final String OS_FAMILY = "os.family";
private BundledResourcePath resourcePath;
protected ResourcePath delegate() {
return resourcePath;
}
/**
* @throws RuntimeException if the binaries don't work on the current OS
*/
protected void activate(Map,?> properties, Class> context) throws RuntimeException {
if (properties.get(OS_FAMILY) == null
|| properties.get(OS_FAMILY).toString().isEmpty()) {
throw new IllegalArgumentException(OS_FAMILY + " property must not be empty"); }
if (OS.Family.valueOf(properties.get(OS_FAMILY).toString().toUpperCase()) != OS.getFamily())
throw new RuntimeException(toString() + " does not work on " + OS.getFamily());
if (properties.get(BundledResourcePath.UNPACK) != null)
throw new IllegalArgumentException(BundledResourcePath.UNPACK + " property not supported");
Map © 2015 - 2025 Weber Informatics LLC | Privacy Policy