public boolean contains(Artifact artifact) { // Note: getLocation(artifact) does an artifact.isResolved() check - no need to do it here. File location = getLocation(artifact); return location.canRead() && (location.isFile() || new File(location, "META-INF").isDirectory()); }
URL url; try { File location = getLocation(artifact); url = location.toURL(); } catch (MalformedURLException e) { for (int i = 0; i < configs.getLength(); i++) { Element dependencyElement = (Element) configs.item(i); String groupId = getString(dependencyElement, "groupId"); String artifactId = getString(dependencyElement, "artifactId"); String version = getString(dependencyElement, "version"); String type = getString(dependencyElement, "type"); if (type == null) { type = "jar";
copyToRepository(is, size, destination, monitor); } finally { try {
public void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor) throws IOException { if(!destination.isResolved()) { throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved"); } // is this a writable repository if (!rootFile.canWrite()) { throw new IllegalStateException("This repository is not writable: " + rootFile.getAbsolutePath() + ")"); } // where are we going to install the file File location = getLocation(destination); // assure that there isn't already a file installed at the specified location if (location.exists()) { throw new IllegalArgumentException("Destination " + location.getAbsolutePath() + " already exists!"); } ArtifactTypeHandler typeHandler = (ArtifactTypeHandler) typeHandlers.get(destination.getType()); if (typeHandler == null) typeHandler = DEFAULT_TYPE_HANDLER; typeHandler.install(source, size, destination, monitor, location); if (destination.getType().equalsIgnoreCase("car")) { log.debug("Installed module configuration; id=" + destination + "; location=" + location); } } }