/** * Sets the path of the resource containing the plugin definition. This is used to locate the * manifest entry from which version and source information can be extracted. * * @param path Path of the resource containing this plugin definition. */ public void setPath(String path) { if (path != null) { manifest = ManifestIterator.getInstance().findByPath(path); } }
/** * Returns the primary manifest for the application, if any. * * @return The primary manifest, or null if not found. */ public Manifest getPrimaryManifest() { init(); return primaryManifest; }
/** * Displays the About dialog. */ public static void about() { AboutDialog.execute(ManifestIterator.getInstance().getPrimaryManifest()); }
@Test public void testFindByPath() { ManifestIterator manifests = (ManifestIterator) appContext.getBean("manifestIterator"); String path = ManifestIterator.class.getClassLoader().getResource(ManifestIterator.MANIFEST_PATH).getPath(); assertNotNull(path); assertNotNull(manifests.findByPath(path)); } }
/** * Initialize the manifest list if not already done. This is done by iterating over the class * path to locate all manifest files. */ public void init() { if (manifests == null) { manifests = new ArrayList<Manifest>(); try { primaryManifest = addToList(appContext.getResource(MANIFEST_PATH)); Resource[] resources = appContext.getResources("classpath*:/" + MANIFEST_PATH); for (Resource resource : resources) { addToList(resource); } } catch (IOException e) { log.error("Error enumerating manifests.", e); } } }
renderer = manifestItemRenderer; for (Manifest mnfst : ManifestIterator.getInstance()) { ManifestItem anItem = new ManifestItem(mnfst);
@Test public void testFindByPath() { ManifestIterator manifests = (ManifestIterator) appContext.getBean("manifestIterator"); String path = ManifestIterator.class.getClassLoader().getResource(ManifestIterator.MANIFEST_PATH).getPath(); assertNotNull(path); assertNotNull(manifests.findByPath(path)); } }
/** * Initialize the manifest list if not already done. This is done by iterating over the class * path to locate all manifest files. */ public void init() { if (manifests == null) { manifests = new ArrayList<>(); try { primaryManifest = addToList(SpringUtil.getResource(MANIFEST_PATH)); Resource[] resources = SpringUtil.getResources("classpath*:/" + MANIFEST_PATH); for (Resource resource : resources) { addToList(resource); } if (primaryManifest == null) { primaryManifest = manifests.get(0); } } catch (Exception e) { log.error("Error enumerating manifests.", e); } } }
/** * Returns the primary manifest for the application, if any. * * @return The primary manifest, or null if not found. */ public Manifest getPrimaryManifest() { init(); return primaryManifest; }
/** * Returns the iterator for all registered manifests. * * @return The manifest iterator. */ @Override public Iterator<Manifest> iterator() { init(); return manifests.iterator(); }
/** * Returns the iterator for all registered manifests. * * @return The manifest iterator. */ @Override public Iterator<Manifest> iterator() { init(); return manifests.iterator(); }