Java Code Examples for org.apache.ivy.util.Message#debug()
The following examples show how to use
org.apache.ivy.util.Message#debug() .
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: VfsResource.java From ant-ivy with Apache License 2.0 | 6 votes |
private void init() { if (!init) { try { resourceImpl = fsManager.resolveFile(vfsURI); content = resourceImpl.getContent(); exists = resourceImpl.exists(); lastModified = content.getLastModifiedTime(); contentLength = content.getSize(); } catch (FileSystemException e) { Message.debug(e); Message.verbose(e.getLocalizedMessage()); exists = false; lastModified = 0; contentLength = 0; } init = true; } }
Example 2
Source File: RepositoryAnalyser.java From ant-ivy with Apache License 2.0 | 6 votes |
public void analyse(String pattern, DependencyAnalyser depAnalyser) { JarModuleFinder finder = new JarModuleFinder(pattern); ModuleDescriptor[] mds = depAnalyser.analyze(finder.findJarModules()); Message.info("found " + mds.length + " modules"); for (ModuleDescriptor md : mds) { File ivyFile = new File(IvyPatternHelper.substitute( pattern, DefaultArtifact.newIvyArtifact(md.getModuleRevisionId(), md.getPublicationDate()))); try { Message.info("generating " + ivyFile); XmlModuleDescriptorWriter.write(md, ivyFile); } catch (IOException e) { Message.debug(e); } } }
Example 3
Source File: SFTPRepository.java From ant-ivy with Apache License 2.0 | 6 votes |
/** * This method is similar to getResource, except that the returned resource is fully initialized * (resolved in the sftp repository), and that the given string is a full remote path * * @param path * the full remote path in the repository of the resource * @return a fully initialized resource, able to answer to all its methods without needing any * further connection */ @SuppressWarnings("unchecked") public Resource resolveResource(String path) { try { List<LsEntry> r = getSftpChannel(path).ls(getPath(path)); if (r != null) { SftpATTRS attrs = r.get(0).getAttrs(); return new BasicResource(path, true, attrs.getSize(), attrs.getMTime() * MILLIS_PER_SECOND, false); } } catch (Exception e) { Message.debug("Error while resolving resource " + path, e); // silent fail, return nonexistent resource } return new BasicResource(path, false, 0, 0, false); }
Example 4
Source File: VsftpRepository.java From ant-ivy with Apache License 2.0 | 6 votes |
/** * Parses a ls -l line and transforms it in a resource * * @param file ditto * @param responseLine ditto * @return Resource */ protected Resource lslToResource(String file, String responseLine) { if (responseLine == null || responseLine.startsWith("ls")) { return new BasicResource(file, false, 0, 0, false); } else { String[] parts = responseLine.split("\\s+"); if (parts.length != LS_PARTS_NUMBER) { Message.debug("unrecognized ls format: " + responseLine); return new BasicResource(file, false, 0, 0, false); } else { try { long contentLength = Long.parseLong(parts[LS_SIZE_INDEX]); String date = parts[LS_DATE_INDEX1] + " " + parts[LS_DATE_INDEX2] + " " + parts[LS_DATE_INDEX3] + " " + parts[LS_DATE_INDEX4]; return new BasicResource(file, true, contentLength, FORMAT.parse(date) .getTime(), false); } catch (Exception ex) { Message.warn("impossible to parse server response: " + responseLine, ex); return new BasicResource(file, false, 0, 0, false); } } } }
Example 5
Source File: AbstractResolver.java From ant-ivy with Apache License 2.0 | 6 votes |
private void initLatestStrategyFromSettings() { if (getSettings() != null) { if (latestStrategyName != null && !"default".equals(latestStrategyName)) { latestStrategy = getSettings().getLatestStrategy(latestStrategyName); if (latestStrategy == null) { throw new IllegalStateException("unknown latest strategy '" + latestStrategyName + "'"); } } else { latestStrategy = getSettings().getDefaultLatestStrategy(); Message.debug(getName() + ": no latest strategy defined: using default"); } } else { throw new IllegalStateException("no ivy instance found: " + "impossible to get a latest strategy without ivy instance"); } }
Example 6
Source File: IvyAuthenticator.java From ant-ivy with Apache License 2.0 | 5 votes |
protected PasswordAuthentication getPasswordAuthentication() { PasswordAuthentication result = null; if (isProxyAuthentication()) { String proxyUser = System.getProperty("http.proxyUser"); if (!isNullOrEmpty(proxyUser)) { String proxyPass = System.getProperty("http.proxyPassword", ""); Message.debug("authenticating to proxy server with username [" + proxyUser + "]"); result = new PasswordAuthentication(proxyUser, proxyPass.toCharArray()); } } else { Credentials c = CredentialsStore.INSTANCE.getCredentials(getRequestingPrompt(), getRequestingHost()); Message.debug("authentication: k='" + Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='" + c + "'"); if (c != null) { final String password = c.getPasswd() == null ? "" : c.getPasswd(); result = new PasswordAuthentication(c.getUserName(), password.toCharArray()); } } if (result == null && original != null) { Authenticator.setDefault(original); try { result = Authenticator.requestPasswordAuthentication(getRequestingHost(), getRequestingSite(), getRequestingPort(), getRequestingProtocol(), getRequestingPrompt(), getRequestingScheme(), getRequestingURL(), getRequestorType()); } finally { Authenticator.setDefault(this); } } return result; }
Example 7
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 8
Source File: AbstractResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
protected ResolvedModuleRevision checkLatest(DependencyDescriptor dd, ResolvedModuleRevision newModuleFound, ResolveData data) { Checks.checkNotNull(dd, "dd"); Checks.checkNotNull(data, "data"); // always cache dynamic mrids because we can store per-resolver values saveModuleRevisionIfNeeded(dd, newModuleFound); // check if latest is asked and compare to return the most recent ResolvedModuleRevision previousModuleFound = data.getCurrentResolvedModuleRevision(); String newModuleDesc = describe(newModuleFound); Message.debug("\tchecking " + newModuleDesc + " against " + describe(previousModuleFound)); if (previousModuleFound == null) { Message.debug("\tmodule revision kept as first found: " + newModuleDesc); return newModuleFound; } else if (isAfter(newModuleFound, previousModuleFound, data.getDate())) { Message.debug("\tmodule revision kept as younger: " + newModuleDesc); return newModuleFound; } else if (!newModuleFound.getDescriptor().isDefault() && previousModuleFound.getDescriptor().isDefault()) { Message.debug("\tmodule revision kept as better (not default): " + newModuleDesc); return newModuleFound; } else { Message.debug("\tmodule revision discarded as older: " + newModuleDesc); return previousModuleFound; } }
Example 9
Source File: ChainResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
@Override public void dumpSettings() { Message.verbose("\t" + getName() + " [chain] " + chain); Message.debug("\t\treturn first: " + isReturnFirst()); Message.debug("\t\tdual: " + isDual()); for (DependencyResolver resolver : chain) { Message.debug("\t\t-> " + resolver.getName()); } }
Example 10
Source File: LatestCompatibleConflictManager.java From ant-ivy with Apache License 2.0 | 5 votes |
private void blackListIncompatibleCallerAndRestartResolveIfPossible(IvySettings settings, IvyNode parent, IvyNode selected, IvyNode evicted) { Stack<IvyNode> callerStack = new Stack<>(); callerStack.push(evicted); Collection<IvyNodeBlacklist> toBlacklist = blackListIncompatibleCaller( settings.getVersionMatcher(), parent, selected, evicted, callerStack); if (toBlacklist != null) { final StringBuilder blacklisted = new StringBuilder(); for (IvyNodeBlacklist blacklist : toBlacklist) { if (blacklisted.length() > 0) { blacklisted.append(" "); } IvyNode blacklistedNode = blacklist.getBlacklistedNode(); blacklistedNode.blacklist(blacklist); blacklisted.append(blacklistedNode); } String rootModuleConf = parent.getData().getReport().getConfiguration(); evicted.markEvicted(new EvictionData(rootModuleConf, parent, this, Collections .singleton(selected), "with blacklisting of " + blacklisted)); if (settings.debugConflictResolution()) { Message.debug("evicting " + evicted + " by " + evicted.getEvictedData(rootModuleConf)); } throw new RestartResolveProcess("trying to handle incompatibilities between " + selected + " and " + evicted); } }
Example 11
Source File: EditableRepoDescriptor.java From ant-ivy with Apache License 2.0 | 5 votes |
public void addBundle(BundleInfo bundleInfo) { ModuleDescriptorWrapper module = findModule(bundleInfo.getSymbolicName(), bundleInfo.getVersion()); if (module != null) { Message.debug("Duplicate module " + bundleInfo.getSymbolicName() + "@" + bundleInfo.getVersion()); return; } ModuleDescriptorWrapper md = new ModuleDescriptorWrapper(bundleInfo, baseUri, profileProvider); add(BundleInfo.BUNDLE_TYPE, bundleInfo.getSymbolicName(), md); for (BundleCapability capability : bundleInfo.getCapabilities()) { add(capability.getType(), capability.getName(), md); } }
Example 12
Source File: HttpClientHandler.java From ant-ivy with Apache License 2.0 | 5 votes |
/** * Checks the status code of the response and if it's considered as successful response, then * this method just returns back. Else it {@link CloseableHttpResponse#close() closes the * response} and throws an {@link IOException} for the unsuccessful response. * * @param httpMethod The HTTP method that was used for the source request * @param sourceURL The URL of the source request * @param response The response to the source request * @throws IOException Thrown if the response was considered unsuccessful */ private void requireSuccessStatus(final String httpMethod, final URL sourceURL, final CloseableHttpResponse response) throws IOException { if (this.checkStatusCode(httpMethod, sourceURL, response)) { return; } // this is now considered an unsuccessful response, so close the response and throw an exception try { response.close(); } catch (Exception e) { // log and move on Message.debug("Could not close the HTTP response for url=" + sourceURL, e); } throw new IOException("Failed response to request '" + httpMethod + " " + sourceURL + "' " + response.getStatusLine().getStatusCode() + " - '" + response.getStatusLine().getReasonPhrase()); }
Example 13
Source File: IvyTask.java From ant-ivy with Apache License 2.0 | 5 votes |
protected String getProperty(IvySettings ivy, String name) { String val = ivy.getVariable(name); if (val == null) { val = ivy.substitute(getProject().getProperty(name)); if (val == null) { Message.debug("parameter not found: " + name); } else { Message.debug("parameter found as ant project property: " + name + "=" + val); } } else { val = ivy.substitute(val); Message.debug("parameter found as ivy variable: " + name + "=" + val); } return val; }
Example 14
Source File: IBiblioResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
private ResolvedResource findSnapshotArtifact(final Artifact artifact, final Date date, final ModuleRevisionId mrid, final MavenTimedSnapshotVersionMatcher.MavenSnapshotRevision snapshotRevision) { if (!isM2compatible()) { return null; } final String snapshotArtifactPattern; 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 snapshotArtifactPattern = 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 artifact 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 snapshotArtifactPattern = getWholePattern().replaceFirst("\\-\\[revision\\]", "-" + timestampedRev); } return findResourceUsingPattern(mrid, snapshotArtifactPattern, artifact, getDefaultRMDParser(artifact .getModuleRevisionId().getModuleId()), date); }
Example 15
Source File: XmlModuleDescriptorParser.java From ant-ivy with Apache License 2.0 | 5 votes |
/** * Describes how dependencies should be inherited * * @param dependencies * array of dependencies to inherit */ protected void mergeDependencies(DependencyDescriptor[] dependencies) { DefaultModuleDescriptor md = getMd(); for (DependencyDescriptor dependencyDescriptor : dependencies) { Message.debug("Merging dependency with: " + dependencyDescriptor.getDependencyRevisionId().toString()); md.addDependency(dependencyDescriptor); } }
Example 16
Source File: DefaultRepositoryCacheManager.java From ant-ivy with Apache License 2.0 | 5 votes |
public void dumpSettings() { Message.verbose("\t" + getName()); Message.debug("\t\tivyPattern: " + getIvyPattern()); Message.debug("\t\tartifactPattern: " + getArtifactPattern()); Message.debug("\t\tlockingStrategy: " + getLockStrategy().getName()); Message.debug("\t\tchangingPattern: " + getChangingPattern()); Message.debug("\t\tchangingMatcher: " + getChangingMatcherName()); }
Example 17
Source File: ParserSettingsMonitor.java From ant-ivy with Apache License 2.0 | 5 votes |
/** * Check if the newSettings is compatible with the original settings that has been monitored. * Only the info that was actually used is compared. */ public boolean hasChanged(ParserSettings newSettings) { for (Map.Entry<String, String> entry : substitutes.entrySet()) { String key = entry.getKey(); if (!entry.getValue().equals(newSettings.substitute(key))) { Message.debug("settings variable has changed for : " + key); return true; } } return false; }
Example 18
Source File: IvyContext.java From ant-ivy with Apache License 2.0 | 5 votes |
private Ivy getDefaultIvy() { if (defaultIvy == null) { defaultIvy = Ivy.newInstance(); try { defaultIvy.configureDefault(); } catch (Exception e) { Message.debug(e); // ??? } } return defaultIvy; }
Example 19
Source File: IvyAuthenticator.java From ant-ivy with Apache License 2.0 | 4 votes |
private static void handleReflectionException(final Throwable t) { Message.debug("Error occurred while getting the original authenticator: " + t.getMessage()); }
Example 20
Source File: BasicResolver.java From ant-ivy with Apache License 2.0 | 4 votes |
public ResolvedModuleRevision parse(final ResolvedResource mdRef, DependencyDescriptor dd, ResolveData data) throws ParseException { DependencyDescriptor nsDd = dd; dd = toSystem(nsDd); ModuleRevisionId mrid = dd.getDependencyRevisionId(); ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser( mdRef.getResource()); if (parser == null) { Message.warn("no module descriptor parser available for " + mdRef.getResource()); return null; } Message.verbose("\t" + getName() + ": found md file for " + mrid); Message.verbose("\t\t=> " + mdRef); Message.debug("\tparser = " + parser); ModuleRevisionId resolvedMrid = mrid; // first check if this dependency has not yet been resolved if (getSettings().getVersionMatcher().isDynamic(mrid)) { resolvedMrid = ModuleRevisionId.newInstance(mrid, mdRef.getRevision()); IvyNode node = data.getNode(resolvedMrid); if (node != null && node.getModuleRevision() != null) { // this revision has already be resolved : return it if (node.getDescriptor() == null || !node.getDescriptor().isDefault()) { Message.verbose("\t" + getName() + ": revision already resolved: " + resolvedMrid); node.getModuleRevision().getReport().setSearched(true); return node.getModuleRevision(); } Message.verbose("\t" + getName() + ": found already resolved revision: " + resolvedMrid + ": but it's a default one, maybe we can find a better one"); } } Artifact moduleArtifact = parser.getMetadataArtifact(resolvedMrid, mdRef.getResource()); return getRepositoryCacheManager().cacheModuleDescriptor(this, mdRef, dd, moduleArtifact, downloader, getCacheOptions(data)); }