Java Code Examples for org.apache.ivy.core.IvyPatternHelper#substituteTokens()
The following examples show how to use
org.apache.ivy.core.IvyPatternHelper#substituteTokens() .
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: M2ResourcePattern.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public String toModulePath(ModuleIdentifier module) { String pattern = getPattern(); if (!pattern.endsWith(MavenPattern.M2_PATTERN)) { throw new UnsupportedOperationException("Cannot locate module for non-maven layout."); } String metaDataPattern = pattern.substring(0, pattern.length() - MavenPattern.M2_PER_MODULE_PATTERN.length() - 1); return IvyPatternHelper.substituteTokens(metaDataPattern, toAttributes(module)); }
Example 2
Source File: M2ResourcePattern.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public String toModuleVersionPath(ModuleVersionArtifactMetaData artifact) { String pattern = getPattern(); if (!pattern.endsWith(MavenPattern.M2_PATTERN)) { throw new UnsupportedOperationException("Cannot locate module version for non-maven layout."); } String metaDataPattern = pattern.substring(0, pattern.length() - MavenPattern.M2_PER_MODULE_VERSION_PATTERN.length() - 1); return IvyPatternHelper.substituteTokens(metaDataPattern, toAttributes(artifact)); }
Example 3
Source File: M2ResourcePattern.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public String toModulePath(ModuleIdentifier module) { String pattern = getPattern(); if (!pattern.endsWith(MavenPattern.M2_PATTERN)) { throw new UnsupportedOperationException("Cannot locate module for non-maven layout."); } String metaDataPattern = pattern.substring(0, pattern.length() - MavenPattern.M2_PER_MODULE_PATTERN.length() - 1); return IvyPatternHelper.substituteTokens(metaDataPattern, toAttributes(module)); }
Example 4
Source File: M2ResourcePattern.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public String toModuleVersionPath(ModuleVersionArtifactMetaData artifact) { String pattern = getPattern(); if (!pattern.endsWith(MavenPattern.M2_PATTERN)) { throw new UnsupportedOperationException("Cannot locate module version for non-maven layout."); } String metaDataPattern = pattern.substring(0, pattern.length() - MavenPattern.M2_PER_MODULE_VERSION_PATTERN.length() - 1); return IvyPatternHelper.substituteTokens(metaDataPattern, toAttributes(artifact)); }
Example 5
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 6
Source File: RepositoryResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
@Override protected void findTokenValues(Collection<String> names, List<String> patterns, Map<String, String> tokenValues, String token) { for (String pattern : patterns) { String partiallyResolvedPattern = IvyPatternHelper.substituteTokens(pattern, tokenValues); String[] values = ResolverHelper.listTokenValues(repository, partiallyResolvedPattern, token); if (values != null) { names.addAll(filterNames(new ArrayList<>(Arrays.asList(values)))); } } }
Example 7
Source File: AbstractResourcePattern.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
protected String substituteTokens(String pattern, Map<String, String> attributes) { return IvyPatternHelper.substituteTokens(pattern, attributes); }
Example 8
Source File: M2ResourcePattern.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
@Override public String toPath(ModuleVersionArtifactMetaData artifact) { Map<String, Object> attributes = toAttributes(artifact); return IvyPatternHelper.substituteTokens(getPattern(), attributes); }
Example 9
Source File: IvyResourcePattern.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public String toPath(ModuleVersionArtifactMetaData artifact) { Map<String, Object> attributes = toAttributes(artifact); return IvyPatternHelper.substituteTokens(pattern, attributes); }
Example 10
Source File: IvyResourcePattern.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public String toVersionListPattern(ModuleVersionArtifactMetaData artifactId) { Map<String, Object> attributes = toAttributes(artifactId); attributes.remove(IvyPatternHelper.REVISION_KEY); return IvyPatternHelper.substituteTokens(pattern, attributes); }
Example 11
Source File: AbstractResourcePattern.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
protected String substituteTokens(String pattern, Map<String, String> attributes) { return IvyPatternHelper.substituteTokens(pattern, attributes); }
Example 12
Source File: M2ResourcePattern.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
@Override public String toPath(ModuleVersionArtifactMetaData artifact) { Map<String, Object> attributes = toAttributes(artifact); return IvyPatternHelper.substituteTokens(getPattern(), attributes); }
Example 13
Source File: IvyResourcePattern.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public String toPath(ModuleVersionArtifactMetaData artifact) { Map<String, Object> attributes = toAttributes(artifact); return IvyPatternHelper.substituteTokens(pattern, attributes); }
Example 14
Source File: IvyResourcePattern.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public String toVersionListPattern(ModuleVersionArtifactMetaData artifactId) { Map<String, Object> attributes = toAttributes(artifactId); attributes.remove(IvyPatternHelper.REVISION_KEY); return IvyPatternHelper.substituteTokens(pattern, attributes); }
Example 15
Source File: IBiblioResolver.java From ant-ivy with Apache License 2.0 | 4 votes |
@Override protected String[] listTokenValues(String pattern, String token) { if (IvyPatternHelper.ORGANISATION_KEY.equals(token)) { return new String[0]; } if (IvyPatternHelper.MODULE_KEY.equals(token) && !isM2compatible()) { return new String[0]; } ensureConfigured(getSettings()); // let's see if we should use maven metadata for this listing... if (IvyPatternHelper.REVISION_KEY.equals(token) && shouldUseMavenMetadata(getWholePattern())) { // now we must use metadata if available /* * we substitute tokens with ext token only in the m2 per module pattern, to match has * has been done in the given pattern */ String partiallyResolvedM2PerModulePattern = IvyPatternHelper.substituteTokens( M2_PER_MODULE_PATTERN, Collections.singletonMap(IvyPatternHelper.EXT_KEY, "pom")); if (pattern.endsWith(partiallyResolvedM2PerModulePattern)) { /* * the given pattern already contain resolved org and module, we just have to * replace the per module pattern at the end by 'maven-metadata.xml' to have the * maven metadata file location */ String metadataLocation = pattern.substring(0, pattern.lastIndexOf(partiallyResolvedM2PerModulePattern)) + "maven-metadata.xml"; List<String> revs = listRevisionsWithMavenMetadata(getRepository(), metadataLocation); if (revs != null) { return revs.toArray(new String[revs.size()]); } } else { /* * this is probably because the given pattern has been substituted with jar ext, if * this resolver has optional module descriptors. But since we have to use maven * metadata, we don't care about this case, maven metadata has already been used * when looking for revisions with the pattern substituted with ext=xml for the * "ivy" pattern. */ return new String[0]; } } return super.listTokenValues(pattern, token); }
Example 16
Source File: IBiblioResolver.java From ant-ivy with Apache License 2.0 | 4 votes |
private List<String> listRevisionsWithMavenMetadata(Repository repository, Map<String, String> tokenValues) { String metadataLocation = IvyPatternHelper.substituteTokens(root + "[organisation]/[module]/maven-metadata.xml", tokenValues); return listRevisionsWithMavenMetadata(repository, metadataLocation); }