class DirectoryManagerFactory {

	public static DirectoryManager createDirectoryManager(Path path,
			boolean readOnly) throws IOException {
		try {
			return dmClass.getConstructor(Path.class, Boolean.class)
					.newInstance(path, readOnly);
		} catch (InstantiationException | IllegalAccessException
				| IllegalArgumentException | NoSuchMethodException
				| SecurityException e) {
			throw new RuntimeException(e.toString(), e);
		} catch (InvocationTargetException e) {
			if (e.getTargetException() instanceof IOException) {
				throw (IOException) e.getTargetException();
			} else {
				throw new RuntimeException(e.getTargetException().toString(),
						e.getTargetException());
			}
		}
	}

}