Search in sources :

Example 1 with PersistentMap

use of aQute.lib.persistentmap.PersistentMap in project bnd by bndtools.

the class FileRepo method init.

/**
	 * Initialize the repository Subclasses should first call this method and
	 * then if it returns true, do their own initialization
	 * 
	 * @return true if initialized, false if already had been initialized.
	 * @throws Exception
	 */
protected boolean init() throws Exception {
    if (inited)
        return false;
    inited = true;
    if (reporter == null) {
        ReporterAdapter reporter = trace ? new ReporterAdapter(System.out) : new ReporterAdapter();
        reporter.setTrace(trace);
        reporter.setExceptions(trace);
        this.reporter = reporter;
    }
    logger.debug("init");
    if (!root.isDirectory()) {
        IO.mkdirs(root);
        if (!root.isDirectory())
            throw new IllegalArgumentException("Location cannot be turned into a directory " + root);
        exec(init, root.getAbsolutePath());
    }
    if (hasIndex)
        index = new PersistentMap<ResourceDescriptor>(new File(root, ".index"), ResourceDescriptor.class);
    open();
    return true;
}
Also used : PersistentMap(aQute.lib.persistentmap.PersistentMap) ReporterAdapter(aQute.libg.reporter.ReporterAdapter) File(java.io.File)

Aggregations

PersistentMap (aQute.lib.persistentmap.PersistentMap)1 ReporterAdapter (aQute.libg.reporter.ReporterAdapter)1 File (java.io.File)1