/** * Attempts to download and cache a remote artifact using a set of remote repositories. The * operation is not fail fast and so it keeps trying if the first repository does not have the * artifact in question. * * @param artifact the artifact to retrieve and cache * @return input stream containing the artifact content. * @exception IOException if an IO error occurs. * @exception TransitException if a transit system error occurs. * @exception NullArgumentException if the artifact argument is null. */ public InputStream getResource(Artifact artifact) throws IOException, TransitException, NullArgumentException { File destination = getResourceFile(artifact); if (destination.exists()) { FileInputStream stream = new FileInputStream(destination); return new BufferedInputStream(stream); } String error = "Unresolvable artifact: [" + artifact + "]. (" + destination + ")"; throw new ArtifactNotFoundException(error, artifact.toURI()); }