protected void init() throws Exception { if (lock.tryLock(50, TimeUnit.SECONDS) == false) throw new TimeLimitExceededException( "Cached File Repo is locked and can't acquire it"); try { if (!inited) { inited = true; root.mkdirs(); if (!root.isDirectory()) throw new IllegalArgumentException("Cannot create cache dir " + root); InputStream in = getClass().getResourceAsStream(EMBEDDED_REPO); if (in != null) unzip(in, root); else { System.out.println("!!!! Couldn't find embedded-repo.jar in bundle "); error("Couldn't find embedded-repo.jar in bundle "); } } } finally { lock.unlock(); } }
@Override protected boolean init() throws Exception { if (lock.tryLock(50, TimeUnit.SECONDS) == false) throw new TimeLimitExceededException("Cached File Repo is locked and can't acquire it"); try { if (super.init()) { inited = true; if (!root.exists() && !root.mkdirs()) { throw new IOException("Could not create cache directory " + root); } if (!root.isDirectory()) throw new IllegalArgumentException("Cache directory " + root + " not a directory"); InputStream in = getClass().getResourceAsStream(EMBEDDED_REPO); if (in != null) unzip(in, root); else { error("Couldn't find embedded-repo.jar in bundle "); } return true; } else return false; } finally { lock.unlock(); } }
@Override protected boolean init() throws Exception { if (lock.tryLock(50, TimeUnit.SECONDS) == false) throw new TimeLimitExceededException("Cached File Repo is locked and can't acquire it"); try { if (super.init()) { inited = true; if (!root.exists() && !root.mkdirs()) { throw new IOException("Could not create cache directory " + root); } if (!root.isDirectory()) throw new IllegalArgumentException("Cache directory " + root + " not a directory"); InputStream in = getClass().getResourceAsStream(EMBEDDED_REPO); if (in != null) unzip(in, root); else { if (root.isDirectory() && root.list().length >= 2) { trace("Assuming I am in a bnd test ... the embedded repo is missig but it exists on the file system"); return true; } error("Couldn't find embedded-repo.jar in bundle "); } return true; } else return false; } finally { lock.unlock(); } }
@Override protected boolean init() throws Exception { if (lock.tryLock(50, TimeUnit.SECONDS) == false) throw new TimeLimitExceededException("Cached File Repo is locked and can't acquire it"); try { if (super.init()) { inited = true; if (!root.exists() && !root.mkdirs()) { throw new IOException("Could not create cache directory " + root); } if (!root.isDirectory()) throw new IllegalArgumentException("Cache directory " + root + " not a directory"); InputStream in = getClass().getResourceAsStream(EMBEDDED_REPO); if (in != null) unzip(in, root); else { if (root.isDirectory() && root.list().length >= 2) { trace("Assuming I am in a bnd test ... the embedded repo is missig but it exists on the file system"); return true; } error("Couldn't find embedded-repo.jar in bundle "); } return true; } else return false; } finally { lock.unlock(); } }