Java Code Examples for org.apache.ivy.util.Message#verbose()
The following examples show how to use
org.apache.ivy.util.Message#verbose() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheResolver.java From ant-ivy with Apache License 2.0 | 6 votes |
private void ensureConfigured() { if (getIvyPatterns().isEmpty()) { setIvyPatterns(new ArrayList<String>()); setArtifactPatterns(new ArrayList<String>()); for (RepositoryCacheManager cache : getSettings().getRepositoryCacheManagers()) { if (cache instanceof DefaultRepositoryCacheManager) { DefaultRepositoryCacheManager c = (DefaultRepositoryCacheManager) cache; addIvyPattern(c.getBasedir().getAbsolutePath() + "/" + c.getIvyPattern()); addArtifactPattern(c.getBasedir().getAbsolutePath() + "/" + c.getArtifactPattern()); } else { Message.verbose(cache + ": cache implementation is not a DefaultRepositoryCacheManager:" + " unable to configure cache resolver with it"); } } } }
Example 2
Source File: AbstractResolver.java From ant-ivy with Apache License 2.0 | 6 votes |
private void initNamespaceFromSettings() { if (getSettings() != null) { if (namespaceName != null) { namespace = getSettings().getNamespace(namespaceName); if (namespace == null) { throw new IllegalStateException("unknown namespace '" + namespaceName + "'"); } } else { namespace = getSettings().getSystemNamespace(); Message.debug(getName() + ": no namespace defined: using system"); } } else { Message.verbose(getName() + ": no namespace defined nor ivy instance: using system namespace"); namespace = Namespace.SYSTEM_NAMESPACE; } }
Example 3
Source File: URLHandlerRegistry.java From ant-ivy with Apache License 2.0 | 6 votes |
/** * This method is used to get appropriate http downloader depending on HttpComponents * HttpClient availability in classpath, or simply use jdk url handling in other cases. * * @return most accurate http downloader */ public static TimeoutConstrainedURLHandler getHttp() { try { // check for the presence of HttpComponents HttpClient Class.forName("org.apache.http.client.HttpClient"); // load our (wrapper) http handler final Class<?> handler = Class.forName("org.apache.ivy.util.url.HttpClientHandler"); // we always use just one instance which is internally registered to be closed // when the JVM exits final Field instance = handler.getDeclaredField("DELETE_ON_EXIT_INSTANCE"); return (TimeoutConstrainedURLHandler) instance.get(null); } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { Message.verbose("Using JDK backed URL handler for HTTP interaction since the " + "Apache HttpComponents HttpClient backed handler couldn't be created due to: " + e.getMessage()); return new BasicURLHandler(); } }
Example 4
Source File: VfsResource.java From ant-ivy with Apache License 2.0 | 6 votes |
/** * Get a list of direct descendants of the given resource. Note that attempts to get a list of * children does <em>not</em> result in an error. Instead an error message is * logged and an empty ArrayList returned. * * @return A <code>ArrayList</code> of VFSResources */ public List<String> getChildren() { init(); List<String> list = new ArrayList<>(); try { if (resourceImpl != null && resourceImpl.exists() && resourceImpl.getType() == FileType.FOLDER) { for (FileObject child : resourceImpl.getChildren()) { list.add(normalize(child.getName().getURI())); } } } catch (IOException e) { Message.debug(e); Message.verbose(e.getLocalizedMessage()); } return list; }
Example 5
Source File: UpdateSiteLoader.java From ant-ivy with Apache License 2.0 | 6 votes |
private UpdateSiteDescriptor loadFromDigest(UpdateSite site) throws IOException, SAXException { URI digestBaseUri = site.getDigestUri(); if (digestBaseUri == null) { digestBaseUri = site.getUri(); } else if (!digestBaseUri.isAbsolute()) { digestBaseUri = site.getUri().resolve(digestBaseUri); } URL digest = digestBaseUri.resolve("digest.zip").toURL(); Message.verbose("\tReading " + digest); final URLResource res = new URLResource(digest, this.timeoutConstraint); ArtifactDownloadReport report = repositoryCacheManager.downloadRepositoryResource(res, "digest", "digest", "zip", options, urlRepository); if (report.getDownloadStatus() == DownloadStatus.FAILED) { return null; } try (InputStream in = new FileInputStream(report.getLocalFile())) { ZipInputStream zipped = findEntry(in, "digest.xml"); if (zipped == null) { return null; } return UpdateSiteDigestParser.parse(zipped, site); } }
Example 6
Source File: IvySettings.java From ant-ivy with Apache License 2.0 | 6 votes |
public synchronized void load(URL settingsURL) throws ParseException, IOException { Message.info(":: loading settings :: url = " + settingsURL); long start = System.currentTimeMillis(); setSettingsVariables(settingsURL); if (getVariable("ivy.default.ivy.user.dir") != null) { setDefaultIvyUserDir(Checks.checkAbsolute(getVariable("ivy.default.ivy.user.dir"), "ivy.default.ivy.user.dir")); } else { getDefaultIvyUserDir(); } loadDefaultProperties(); new XmlSettingsParser(this).parse(settingsURL); setVariable("ivy.default.ivy.user.dir", getDefaultIvyUserDir().getAbsolutePath(), false); Message.verbose("settings loaded (" + (System.currentTimeMillis() - start) + "ms)"); dumpSettings(); }
Example 7
Source File: BasicResolver.java From ant-ivy with Apache License 2.0 | 6 votes |
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) { RepositoryCacheManager cacheManager = getRepositoryCacheManager(); clearArtifactAttempts(); DownloadReport dr = new DownloadReport(); for (Artifact artifact : artifacts) { ArtifactDownloadReport adr = cacheManager.download(artifact, artifactResourceResolver, downloader, getCacheDownloadOptions(options)); if (DownloadStatus.FAILED == adr.getDownloadStatus()) { if (!ArtifactDownloadReport.MISSING_ARTIFACT.equals(adr.getDownloadDetails())) { Message.warn("\t" + adr); } } else if (DownloadStatus.NO == adr.getDownloadStatus()) { Message.verbose("\t" + adr); } else if (LogOptions.LOG_QUIET.equals(options.getLog())) { Message.verbose("\t" + adr); } else { Message.info("\t" + adr); } dr.addArtifactReport(adr); checkInterrupted(); } return dr; }
Example 8
Source File: SshCache.java From ant-ivy with Apache License 2.0 | 6 votes |
/** * Sets a session to a given combined key into the cache If an old session object already * exists, close and remove it * * @param user * of the session * @param host * of the session * @param port * of the session * @param newSession * Session to save */ private void setSession(String user, String host, int port, Session newSession) { Entry entry = uriCacheMap.get(createCacheKey(user, host, port)); Session oldSession = null; if (entry != null) { oldSession = entry.getSession(); } if (oldSession != null && !oldSession.equals(newSession) && oldSession.isConnected()) { entry.releaseChannelSftp(); String oldhost = oldSession.getHost(); Message.verbose(":: SSH :: closing ssh connection from " + oldhost + "..."); oldSession.disconnect(); Message.verbose(":: SSH :: ssh connection closed from " + oldhost); } if (newSession == null && entry != null) { uriCacheMap.remove(createCacheKey(user, host, port)); if (entry.getSession() != null) { sessionCacheMap.remove(entry.getSession()); } } else { Entry newEntry = new Entry(newSession, user, host, port); uriCacheMap.put(createCacheKey(user, host, port), newEntry); sessionCacheMap.put(newSession, newEntry); } }
Example 9
Source File: DualResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
@Override public void dumpSettings() { if (ivyResolver == null || artifactResolver == null) { throw new IllegalStateException( "exactly two resolvers must be added: ivy(1) and artifact(2) one"); } Message.verbose("\t" + getName() + " [dual " + ivyResolver.getName() + " " + artifactResolver.getName() + "]"); }
Example 10
Source File: IBiblioResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
private ResolvedResource findSnapshotDescriptor(final DependencyDescriptor dd, final ResolveData data, final ModuleRevisionId mrid, final MavenTimedSnapshotVersionMatcher.MavenSnapshotRevision snapshotRevision) { if (!isM2compatible()) { return null; } final String snapshotDescriptorPattern; if (snapshotRevision.isTimestampedSnapshot()) { Message.debug(mrid + " has been identified as a (Maven) timestamped snapshot revision"); // this is a Maven timestamped snapshot revision. Something like 1.0.0-<timestampedRev> // We now get the base revision from it, which is "1.0.0" and append the "-SNAPSHOT" to it. final String inferredSnapshotRevision = snapshotRevision.getBaseRevision() + "-SNAPSHOT"; // we replace the "/[revision]" in the descriptor pattern with the "inferred" snapshot // revision which is like "1.0.0-SNAPSHOT". // Ultimately, this will translate to something like // org/module/1.0.0-SNAPSHOT/artifact-1.0.0-<timestampedRev>(-[classifier]).ext snapshotDescriptorPattern = getWholePattern().replaceFirst("/\\[revision\\]", "/" + inferredSnapshotRevision); } else { // it's not a timestamped revision, but a regular snapshot. Try and find any potential // timestamped revisions of this regular snapshot, by looking into the Maven metadata final String timestampedRev = findTimestampedSnapshotVersion(mrid); if (timestampedRev == null) { // no timestamped snapshots found and instead this is just a regular snapshot // version. So let's just fallback to our logic of finding resources using // configured Ivy pattern(s) return null; } Message.verbose(mrid + " has been identified as a snapshot revision which has a timestamped snapshot revision " + timestampedRev); // we have found a timestamped revision for a snapshot. So we replace the "-[revision]" // in the artifact file name to use the timestamped revision. // Ultimately, this will translate to something like // org/module/1.0.0-SNAPSHOT/artifact-1.0.0-<timestampedRev>(-[classifier]).ext snapshotDescriptorPattern = getWholePattern().replaceFirst("\\-\\[revision\\]", "-" + timestampedRev); } // find the descriptor using the snapshot descriptor pattern return findResourceUsingPattern(mrid, snapshotDescriptorPattern, DefaultArtifact.newPomArtifact(mrid, data.getDate()), getRMDParser(dd, data), data.getDate()); }
Example 11
Source File: AntCallTrigger.java From ant-ivy with Apache License 2.0 | 5 votes |
public void progress(IvyEvent event) { Project project = (Project) IvyContext.peekInContextStack(IvyTask.ANT_PROJECT_CONTEXT_KEY); if (project == null) { Message.info("ant call trigger can only be used from an ant build. Ignoring."); return; } if (onlyonce && isTriggered(event)) { Message.verbose("call already triggered for this event, skipping: " + event); } else { CallTarget call = new CallTarget(); call.setProject(project); call.setTaskName("antcall"); Map<String, String> attributes = event.getAttributes(); String target = IvyPatternHelper.substituteTokens(getTarget(), attributes); call.setTarget(target); for (Map.Entry<String, String> entry : attributes.entrySet()) { Property p = call.createParam(); p.setName(prefix == null ? entry.getKey() : prefix + entry.getKey()); p.setValue(entry.getValue() == null ? "" : entry.getValue()); } Message.verbose("triggering ant call: target=" + target + " for " + event); call.execute(); markTriggered(event); Message.debug("triggered ant call finished: target=" + target + " for " + event); } }
Example 12
Source File: IvyPostResolveTask.java From ant-ivy with Apache License 2.0 | 5 votes |
protected IvyResolve setupResolve(boolean haltOnFailure, boolean useOrigin) { Message.verbose("no resolved descriptor found: launching default resolve"); resolve.setTaskName(getTaskName()); resolve.setProject(getProject()); resolve.setHaltonfailure(haltOnFailure); resolve.setUseOrigin(useOrigin); resolve.setValidate(doValidate(getSettings())); resolve.setKeep(isKeep()); resolve.setRefresh(isRefresh()); resolve.setLog(getLog()); resolve.setSettingsRef(getSettingsRef()); resolve.setResolveMode(getResolveMode()); return resolve; }
Example 13
Source File: IvySettings.java From ant-ivy with Apache License 2.0 | 5 votes |
public synchronized void setVariable(String varName, String value, boolean overwrite, String ifSetVar, String unlessSetVar) { if (ifSetVar != null && variableContainer.getVariable(ifSetVar) == null) { Message.verbose("Not setting '" + varName + "' to '" + value + "' since '" + ifSetVar + "' is not set."); return; } if (unlessSetVar != null && variableContainer.getVariable(unlessSetVar) != null) { Message.verbose("Not setting '" + varName + "' to '" + value + "' since '" + unlessSetVar + "' is set."); return; } variableContainer.setVariable(varName, value, overwrite); }
Example 14
Source File: XmlModuleDescriptorWriter.java From ant-ivy with Apache License 2.0 | 5 votes |
private static void printAllMediators(ModuleDescriptor md, PrintWriter out) { Map<MapMatcher, DependencyDescriptorMediator> mediators = md .getAllDependencyDescriptorMediators().getAllRules(); for (Map.Entry<MapMatcher, DependencyDescriptorMediator> mediatorRule : mediators.entrySet()) { MapMatcher matcher = mediatorRule.getKey(); DependencyDescriptorMediator mediator = mediatorRule.getValue(); if (mediator instanceof OverrideDependencyDescriptorMediator) { OverrideDependencyDescriptorMediator oddm = (OverrideDependencyDescriptorMediator) mediator; out.print(String.format("\t\t<override org=\"%s\" module=\"%s\" matcher=\"%s\"", XMLHelper.escape(matcher.getAttributes().get(IvyPatternHelper.ORGANISATION_KEY)), XMLHelper.escape(matcher.getAttributes().get(IvyPatternHelper.MODULE_KEY)), XMLHelper.escape(matcher.getPatternMatcher().getName()) )); if (oddm.getBranch() != null) { out.print(" branch=\"" + XMLHelper.escape(oddm.getBranch()) + "\""); } if (oddm.getVersion() != null) { out.print(" rev=\"" + XMLHelper.escape(oddm.getVersion()) + "\""); } out.println("/>"); } else { Message.verbose("ignoring unhandled DependencyDescriptorMediator: " + mediator.getClass()); } } }
Example 15
Source File: BasicResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
/** * Checks the given resource checksum if a checksum resource exists. * * @param resource * the resource to check * @param dest * the file where the resource has been downloaded * @param algorithm * the checksum algorithm to use * @return true if the checksum has been successfully checked, false if the checksum wasn't * available * @throws IOException * if a checksum exist but do not match the downloaded file checksum */ private boolean check(Resource resource, File dest, String algorithm) throws IOException { if (!ChecksumHelper.isKnownAlgorithm(algorithm)) { throw new IllegalArgumentException("Unknown checksum algorithm: " + algorithm); } Resource csRes = resource.clone(resource.getName() + "." + algorithm); if (csRes.exists()) { Message.debug(algorithm + " file found for " + resource + ": checking..."); File csFile = File.createTempFile("ivytmp", algorithm); try { get(csRes, csFile); try { ChecksumHelper.check(dest, csFile, algorithm); Message.verbose(algorithm + " OK for " + resource); return true; } catch (IOException ex) { dest.delete(); throw ex; } } finally { csFile.delete(); } } else { return false; } }
Example 16
Source File: ResolveData.java From ant-ivy with Apache License 2.0 | 5 votes |
public DependencyDescriptor mediate(DependencyDescriptor dd) { DependencyDescriptor originalDD = dd; dd = getEngine().mediate(dd, getOptions()); VisitNode current = getCurrentVisitNode(); if (current != null) { // mediating dd through dependers stack List<VisitNode> dependers = new ArrayList<>(current.getPath()); // the returned path contains the currently visited node, we are only interested in // the dependers, so we remove the currently visited node from the end dependers.remove(dependers.size() - 1); // we want to apply mediation going up in the dependers stack, not the opposite Collections.reverse(dependers); for (VisitNode n : dependers) { ModuleDescriptor md = n.getDescriptor(); if (md != null) { dd = md.mediate(dd); } } } if (originalDD != dd) { Message.verbose("dependency descriptor has been mediated: " + originalDD + " => " + dd); } return dd; }
Example 17
Source File: VfsResource.java From ant-ivy with Apache License 2.0 | 5 votes |
/** * Return a flag indicating whether a provided VFS resource physically exists * * @return <code>true</code> if the resource physically exists, <code>false</code> otherwise. */ public boolean physicallyExists() { // TODO: there is no need for this method anymore, replace it by calling exists(); init(); try { return resourceImpl.exists(); // originally I only checked for a FileSystemException. I expanded it to // include all exceptions when I found it would throw a NPE exception when the query was // run on ill-formed VFS URI. } catch (Exception e) { Message.verbose("Fail to check the existence of the resource " + getName(), e); return false; } }
Example 18
Source File: ResolveEngine.java From ant-ivy with Apache License 2.0 | 5 votes |
public void outputReport(ResolveReport report, ResolutionCacheManager cacheMgr, ResolveOptions options) throws IOException { if (ResolveOptions.LOG_DEFAULT.equals(options.getLog())) { Message.info(":: resolution report :: resolve " + report.getResolveTime() + "ms" + " :: artifacts dl " + report.getDownloadTime() + "ms"); } else { Message.verbose(":: resolution report :: resolve " + report.getResolveTime() + "ms" + " :: artifacts dl " + report.getDownloadTime() + "ms"); } report.setProblemMessages(Message.getProblems()); // output report report.output(settings.getReportOutputters(), cacheMgr, options); }
Example 19
Source File: CacheResolver.java From ant-ivy with Apache License 2.0 | 4 votes |
@Override public void dumpSettings() { Message.verbose("\t" + getName() + " [cache]"); }
Example 20
Source File: IBiblioResolver.java From ant-ivy with Apache License 2.0 | 4 votes |
private String findTimestampedSnapshotVersion(final ModuleRevisionId mrid) { if (!isM2compatible()) { return null; } if (!shouldUseMavenMetadata(getWholePattern())) { return null; } try { final String metadataLocation = IvyPatternHelper.substitute(root + "[organisation]/[module]/[revision]/maven-metadata.xml", mrid); final Resource metadata = getRepository().getResource(metadataLocation); if (!metadata.exists()) { Message.verbose("\tmaven-metadata not available for: " + mrid); return null; } try (final InputStream metadataStream = metadata.openStream()) { final StringBuilder timestamp = new StringBuilder(); final StringBuilder buildNumber = new StringBuilder(); XMLHelper.parse(metadataStream, null, new ContextualSAXHandler() { @Override public void endElement(String uri, String localName, String qName) throws SAXException { if ("metadata/versioning/snapshot/timestamp".equals(getContext())) { timestamp.append(getText()); } if ("metadata/versioning/snapshot/buildNumber".equals(getContext())) { buildNumber.append(getText()); } super.endElement(uri, localName, qName); } }, null); if (timestamp.length() > 0) { // we have found a timestamp, so this is a snapshot unique version String rev = mrid.getRevision(); rev = rev.substring(0, rev.length() - "SNAPSHOT".length()); rev += timestamp.toString() + "-" + buildNumber.toString(); return rev; } } } catch (IOException | SAXException | ParserConfigurationException e) { Message.debug("impossible to access maven metadata file, ignored", e); } return null; }