repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
cverges/expect4j
src/main/java/expect4j/Expect4j.java
Expect4j.expect
public int expect(String pattern) throws MalformedPatternException, Exception { logger.trace("Searching for '" + pattern + "' in the reader stream"); return expect(pattern, null); }
java
public int expect(String pattern) throws MalformedPatternException, Exception { logger.trace("Searching for '" + pattern + "' in the reader stream"); return expect(pattern, null); }
[ "public", "int", "expect", "(", "String", "pattern", ")", "throws", "MalformedPatternException", ",", "Exception", "{", "logger", ".", "trace", "(", "\"Searching for '\"", "+", "pattern", "+", "\"' in the reader stream\"", ")", ";", "return", "expect", "(", "patte...
Attempts to detect the provided pattern as an exact match. @param pattern the pattern to find in the reader stream @return the number of times the pattern is found, or an error code @throws MalformedPatternException if the pattern is invalid @throws Exception if a generic error is encountered
[ "Attempts", "to", "detect", "the", "provided", "pattern", "as", "an", "exact", "match", "." ]
97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6
https://github.com/cverges/expect4j/blob/97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6/src/main/java/expect4j/Expect4j.java#L261-L264
train
cverges/expect4j
src/main/java/expect4j/Expect4j.java
Expect4j.prepareClosure
protected ExpectState prepareClosure(int pairIndex, MatchResult result) { /* TODO: potentially remove this? { System.out.println( "Begin: " + result.beginOffset(0) ); System.out.println( "Length: " + result.length() ); System.out.println( "Current: " + input.getCurrentOffset() ); System.out.println( "Begin: " + input.getMatchBeginOffset() ); System.out.println( "End: " + input.getMatchEndOffset() ); //System.out.println( "Match: " + input.match() ); //System.out.println( "Pre: >" + input.preMatch() + "<"); //System.out.println( "Post: " + input.postMatch() ); } */ // Prepare Closure environment ExpectState state; Map<String, Object> prevMap = null; if (g_state != null) { prevMap = g_state.getVars(); } int matchedWhere = result.beginOffset(0); String matchedText = result.toString(); // expect_out(0,string) // Unmatched upto end of match // expect_out(buffer) char[] chBuffer = input.getBuffer(); String copyBuffer = new String(chBuffer, 0, result.endOffset(0) ); List<String> groups = new ArrayList<>(); for (int j = 1; j <= result.groups(); j++) { String group = result.group(j); groups.add( group ); } state = new ExpectState(copyBuffer.toString(), matchedWhere, matchedText, pairIndex, groups, prevMap); return state; }
java
protected ExpectState prepareClosure(int pairIndex, MatchResult result) { /* TODO: potentially remove this? { System.out.println( "Begin: " + result.beginOffset(0) ); System.out.println( "Length: " + result.length() ); System.out.println( "Current: " + input.getCurrentOffset() ); System.out.println( "Begin: " + input.getMatchBeginOffset() ); System.out.println( "End: " + input.getMatchEndOffset() ); //System.out.println( "Match: " + input.match() ); //System.out.println( "Pre: >" + input.preMatch() + "<"); //System.out.println( "Post: " + input.postMatch() ); } */ // Prepare Closure environment ExpectState state; Map<String, Object> prevMap = null; if (g_state != null) { prevMap = g_state.getVars(); } int matchedWhere = result.beginOffset(0); String matchedText = result.toString(); // expect_out(0,string) // Unmatched upto end of match // expect_out(buffer) char[] chBuffer = input.getBuffer(); String copyBuffer = new String(chBuffer, 0, result.endOffset(0) ); List<String> groups = new ArrayList<>(); for (int j = 1; j <= result.groups(); j++) { String group = result.group(j); groups.add( group ); } state = new ExpectState(copyBuffer.toString(), matchedWhere, matchedText, pairIndex, groups, prevMap); return state; }
[ "protected", "ExpectState", "prepareClosure", "(", "int", "pairIndex", ",", "MatchResult", "result", ")", "{", "/* TODO: potentially remove this?\n {\n System.out.println( \"Begin: \" + result.beginOffset(0) );\n System.out.println( \"Length: \" + result.length() )...
Don't use input, it's match values might have been reset in the loop that looks for the first possible match. @param pairIndex TODO @param result TODO @return TODO
[ "Don", "t", "use", "input", "it", "s", "match", "values", "might", "have", "been", "reset", "in", "the", "loop", "that", "looks", "for", "the", "first", "possible", "match", "." ]
97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6
https://github.com/cverges/expect4j/blob/97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6/src/main/java/expect4j/Expect4j.java#L541-L578
train
cverges/expect4j
src/main/java/tcl/lang/SubstCrCommand.java
SubstCrCommand.cmdProc
public void cmdProc(Interp interp, TclObject argv[]) throws TclException { int currentObjIndex, len, i; int objc = argv.length - 1; boolean doBackslashes = true; boolean doCmds = true; boolean doVars = true; StringBuffer result = new StringBuffer(); String s; char c; for (currentObjIndex = 1; currentObjIndex < objc; currentObjIndex++) { if (!argv[currentObjIndex].toString().startsWith("-")) { break; } int opt = TclIndex.get(interp, argv[currentObjIndex], validCmds, "switch", 0); switch (opt) { case OPT_NOBACKSLASHES: doBackslashes = false; break; case OPT_NOCOMMANDS: doCmds = false; break; case OPT_NOVARS: doVars = false; break; default: throw new TclException(interp, "SubstCrCmd.cmdProc: bad option " + opt + " index to cmds"); } } if (currentObjIndex != objc) { throw new TclNumArgsException(interp, currentObjIndex, argv, "?-nobackslashes? ?-nocommands? ?-novariables? string"); } /* * Scan through the string one character at a time, performing * command, variable, and backslash substitutions. */ s = argv[currentObjIndex].toString(); len = s.length(); i = 0; while (i < len) { c = s.charAt(i); if ((c == '[') && doCmds) { ParseResult res; try { interp.evalFlags = Parser.TCL_BRACKET_TERM; interp.eval(s.substring(i + 1, len)); TclObject interp_result = interp.getResult(); interp_result.preserve(); res = new ParseResult(interp_result, i + interp.termOffset); } catch (TclException e) { i = e.errIndex + 1; throw e; } i = res.nextIndex + 2; result.append( res.value.toString() ); res.release(); /** * Removed (ToDo) may not be portable on Mac } else if (c == '\r') { i++; */ } else if ((c == '$') && doVars) { ParseResult vres = Parser.parseVar(interp, s.substring(i, len)); i += vres.nextIndex; result.append( vres.value.toString() ); vres.release(); } else if ((c == '\\') && doBackslashes) { BackSlashResult bs = Interp.backslash(s, i, len); i = bs.nextIndex; if (bs.isWordSep) { break; } else { result.append( bs.c ); } } else { result.append( c ); i++; } } interp.setResult(result.toString()); }
java
public void cmdProc(Interp interp, TclObject argv[]) throws TclException { int currentObjIndex, len, i; int objc = argv.length - 1; boolean doBackslashes = true; boolean doCmds = true; boolean doVars = true; StringBuffer result = new StringBuffer(); String s; char c; for (currentObjIndex = 1; currentObjIndex < objc; currentObjIndex++) { if (!argv[currentObjIndex].toString().startsWith("-")) { break; } int opt = TclIndex.get(interp, argv[currentObjIndex], validCmds, "switch", 0); switch (opt) { case OPT_NOBACKSLASHES: doBackslashes = false; break; case OPT_NOCOMMANDS: doCmds = false; break; case OPT_NOVARS: doVars = false; break; default: throw new TclException(interp, "SubstCrCmd.cmdProc: bad option " + opt + " index to cmds"); } } if (currentObjIndex != objc) { throw new TclNumArgsException(interp, currentObjIndex, argv, "?-nobackslashes? ?-nocommands? ?-novariables? string"); } /* * Scan through the string one character at a time, performing * command, variable, and backslash substitutions. */ s = argv[currentObjIndex].toString(); len = s.length(); i = 0; while (i < len) { c = s.charAt(i); if ((c == '[') && doCmds) { ParseResult res; try { interp.evalFlags = Parser.TCL_BRACKET_TERM; interp.eval(s.substring(i + 1, len)); TclObject interp_result = interp.getResult(); interp_result.preserve(); res = new ParseResult(interp_result, i + interp.termOffset); } catch (TclException e) { i = e.errIndex + 1; throw e; } i = res.nextIndex + 2; result.append( res.value.toString() ); res.release(); /** * Removed (ToDo) may not be portable on Mac } else if (c == '\r') { i++; */ } else if ((c == '$') && doVars) { ParseResult vres = Parser.parseVar(interp, s.substring(i, len)); i += vres.nextIndex; result.append( vres.value.toString() ); vres.release(); } else if ((c == '\\') && doBackslashes) { BackSlashResult bs = Interp.backslash(s, i, len); i = bs.nextIndex; if (bs.isWordSep) { break; } else { result.append( bs.c ); } } else { result.append( c ); i++; } } interp.setResult(result.toString()); }
[ "public", "void", "cmdProc", "(", "Interp", "interp", ",", "TclObject", "argv", "[", "]", ")", "throws", "TclException", "{", "int", "currentObjIndex", ",", "len", ",", "i", ";", "int", "objc", "=", "argv", ".", "length", "-", "1", ";", "boolean", "doB...
This procedure is invoked to process the "subst" Tcl command. See the user documentation for details on what it does. @param interp the current interpreter. @param argv command arguments. @exception TclException if wrong # of args or invalid argument(s).
[ "This", "procedure", "is", "invoked", "to", "process", "the", "subst", "Tcl", "command", ".", "See", "the", "user", "documentation", "for", "details", "on", "what", "it", "does", "." ]
97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6
https://github.com/cverges/expect4j/blob/97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6/src/main/java/tcl/lang/SubstCrCommand.java#L41-L133
train
pmayweg/sonar-groovy
sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/jacoco/JaCoCoReportMerger.java
JaCoCoReportMerger.mergeReports
public static void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); boolean isCurrentVersionFormat = loadSourceFiles(infoStore, dataStore, reports); try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall))) { Object visitor; if (isCurrentVersionFormat) { visitor = new ExecutionDataWriter(outputStream); } else { visitor = new org.jacoco.previous.core.data.ExecutionDataWriter(outputStream); } infoStore.accept((ISessionInfoVisitor) visitor); dataStore.accept((IExecutionDataVisitor) visitor); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e); } }
java
public static void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); boolean isCurrentVersionFormat = loadSourceFiles(infoStore, dataStore, reports); try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall))) { Object visitor; if (isCurrentVersionFormat) { visitor = new ExecutionDataWriter(outputStream); } else { visitor = new org.jacoco.previous.core.data.ExecutionDataWriter(outputStream); } infoStore.accept((ISessionInfoVisitor) visitor); dataStore.accept((IExecutionDataVisitor) visitor); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e); } }
[ "public", "static", "void", "mergeReports", "(", "File", "reportOverall", ",", "File", "...", "reports", ")", "{", "SessionInfoStore", "infoStore", "=", "new", "SessionInfoStore", "(", ")", ";", "ExecutionDataStore", "dataStore", "=", "new", "ExecutionDataStore", ...
Merge all reports in reportOverall. @param reportOverall destination file of merge. @param reports files to be merged.
[ "Merge", "all", "reports", "in", "reportOverall", "." ]
2d78d6578304601613db928795d81de340e6fa34
https://github.com/pmayweg/sonar-groovy/blob/2d78d6578304601613db928795d81de340e6fa34/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/jacoco/JaCoCoReportMerger.java#L49-L66
train
pmayweg/sonar-groovy
sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/jacoco/JaCoCoReportReader.java
JaCoCoReportReader.readJacocoReport
public JaCoCoReportReader readJacocoReport(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoStore) { if (jacocoExecutionData == null) { return this; } JaCoCoExtensions.logger().info("Analysing {}", jacocoExecutionData); try (InputStream inputStream = new BufferedInputStream(new FileInputStream(jacocoExecutionData))) { if (useCurrentBinaryFormat) { ExecutionDataReader reader = new ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataVisitor); reader.read(); } else { org.jacoco.previous.core.data.ExecutionDataReader reader = new org.jacoco.previous.core.data.ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataVisitor); reader.read(); } } catch (IOException e) { throw new IllegalArgumentException(String.format("Unable to read %s", jacocoExecutionData.getAbsolutePath()), e); } return this; }
java
public JaCoCoReportReader readJacocoReport(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoStore) { if (jacocoExecutionData == null) { return this; } JaCoCoExtensions.logger().info("Analysing {}", jacocoExecutionData); try (InputStream inputStream = new BufferedInputStream(new FileInputStream(jacocoExecutionData))) { if (useCurrentBinaryFormat) { ExecutionDataReader reader = new ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataVisitor); reader.read(); } else { org.jacoco.previous.core.data.ExecutionDataReader reader = new org.jacoco.previous.core.data.ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataVisitor); reader.read(); } } catch (IOException e) { throw new IllegalArgumentException(String.format("Unable to read %s", jacocoExecutionData.getAbsolutePath()), e); } return this; }
[ "public", "JaCoCoReportReader", "readJacocoReport", "(", "IExecutionDataVisitor", "executionDataVisitor", ",", "ISessionInfoVisitor", "sessionInfoStore", ")", "{", "if", "(", "jacocoExecutionData", "==", "null", ")", "{", "return", "this", ";", "}", "JaCoCoExtensions", ...
Read JaCoCo report determining the format to be used. @param executionDataVisitor visitor to store execution data. @param sessionInfoStore visitor to store info session. @return true if binary format is the latest one. @throws IOException in case of error or binary format not supported.
[ "Read", "JaCoCo", "report", "determining", "the", "format", "to", "be", "used", "." ]
2d78d6578304601613db928795d81de340e6fa34
https://github.com/pmayweg/sonar-groovy/blob/2d78d6578304601613db928795d81de340e6fa34/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/jacoco/JaCoCoReportReader.java#L56-L78
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/repository/ArtifactNameBuilder.java
ArtifactNameBuilder.build
public ArtifactName build() { String groupId = this.groupId; String artifactId = this.artifactId; String classifier = this.classifier; String packaging = this.packaging; String version = this.version; if (artifact != null && !artifact.isEmpty()) { final String[] artifactSegments = artifact.split(":"); // groupId:artifactId:version[:packaging][:classifier]. String value; switch (artifactSegments.length) { case 5: value = artifactSegments[4].trim(); if (!value.isEmpty()) { classifier = value; } case 4: value = artifactSegments[3].trim(); if (!value.isEmpty()) { packaging = value; } case 3: value = artifactSegments[2].trim(); if (!value.isEmpty()) { version = value; } case 2: value = artifactSegments[1].trim(); if (!value.isEmpty()) { artifactId = value; } case 1: value = artifactSegments[0].trim(); if (!value.isEmpty()) { groupId = value; } } } return new ArtifactNameImpl(groupId, artifactId, classifier, packaging, version); }
java
public ArtifactName build() { String groupId = this.groupId; String artifactId = this.artifactId; String classifier = this.classifier; String packaging = this.packaging; String version = this.version; if (artifact != null && !artifact.isEmpty()) { final String[] artifactSegments = artifact.split(":"); // groupId:artifactId:version[:packaging][:classifier]. String value; switch (artifactSegments.length) { case 5: value = artifactSegments[4].trim(); if (!value.isEmpty()) { classifier = value; } case 4: value = artifactSegments[3].trim(); if (!value.isEmpty()) { packaging = value; } case 3: value = artifactSegments[2].trim(); if (!value.isEmpty()) { version = value; } case 2: value = artifactSegments[1].trim(); if (!value.isEmpty()) { artifactId = value; } case 1: value = artifactSegments[0].trim(); if (!value.isEmpty()) { groupId = value; } } } return new ArtifactNameImpl(groupId, artifactId, classifier, packaging, version); }
[ "public", "ArtifactName", "build", "(", ")", "{", "String", "groupId", "=", "this", ".", "groupId", ";", "String", "artifactId", "=", "this", ".", "artifactId", ";", "String", "classifier", "=", "this", ".", "classifier", ";", "String", "packaging", "=", "...
Creates the final artifact name. @return the artifact name
[ "Creates", "the", "final", "artifact", "name", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/repository/ArtifactNameBuilder.java#L172-L211
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/Deployment.java
Deployment.of
public static Deployment of(final File content) { final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("content", content).toPath()); return new Deployment(deploymentContent, null); }
java
public static Deployment of(final File content) { final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("content", content).toPath()); return new Deployment(deploymentContent, null); }
[ "public", "static", "Deployment", "of", "(", "final", "File", "content", ")", "{", "final", "DeploymentContent", "deploymentContent", "=", "DeploymentContent", ".", "of", "(", "Assert", ".", "checkNotNullParam", "(", "\"content\"", ",", "content", ")", ".", "toP...
Creates a new deployment for the file. If the file is a directory the content will be deployed exploded using the file system location. @param content the file containing the content @return the deployment
[ "Creates", "a", "new", "deployment", "for", "the", "file", ".", "If", "the", "file", "is", "a", "directory", "the", "content", "will", "be", "deployed", "exploded", "using", "the", "file", "system", "location", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/Deployment.java#L66-L69
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/Deployment.java
Deployment.of
public static Deployment of(final Path content) { final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("content", content)); return new Deployment(deploymentContent, null); }
java
public static Deployment of(final Path content) { final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("content", content)); return new Deployment(deploymentContent, null); }
[ "public", "static", "Deployment", "of", "(", "final", "Path", "content", ")", "{", "final", "DeploymentContent", "deploymentContent", "=", "DeploymentContent", ".", "of", "(", "Assert", ".", "checkNotNullParam", "(", "\"content\"", ",", "content", ")", ")", ";",...
Creates a new deployment for the path. If the path is a directory the content will be deployed exploded using the file system location. @param content the path containing the content @return the deployment
[ "Creates", "a", "new", "deployment", "for", "the", "path", ".", "If", "the", "path", "is", "a", "directory", "the", "content", "will", "be", "deployed", "exploded", "using", "the", "file", "system", "location", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/Deployment.java#L79-L82
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/Deployment.java
Deployment.of
public static Deployment of(final URL url) { final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("url", url)); return new Deployment(deploymentContent, null); }
java
public static Deployment of(final URL url) { final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("url", url)); return new Deployment(deploymentContent, null); }
[ "public", "static", "Deployment", "of", "(", "final", "URL", "url", ")", "{", "final", "DeploymentContent", "deploymentContent", "=", "DeploymentContent", ".", "of", "(", "Assert", ".", "checkNotNullParam", "(", "\"url\"", ",", "url", ")", ")", ";", "return", ...
Creates a new deployment for the URL. The target server will require access to the URL. @param url the URL representing the content @return the deployment
[ "Creates", "a", "new", "deployment", "for", "the", "URL", ".", "The", "target", "server", "will", "require", "access", "to", "the", "URL", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/Deployment.java#L110-L113
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/Deployment.java
Deployment.setServerGroups
public Deployment setServerGroups(final Collection<String> serverGroups) { this.serverGroups.clear(); this.serverGroups.addAll(serverGroups); return this; }
java
public Deployment setServerGroups(final Collection<String> serverGroups) { this.serverGroups.clear(); this.serverGroups.addAll(serverGroups); return this; }
[ "public", "Deployment", "setServerGroups", "(", "final", "Collection", "<", "String", ">", "serverGroups", ")", "{", "this", ".", "serverGroups", ".", "clear", "(", ")", ";", "this", ".", "serverGroups", ".", "addAll", "(", "serverGroups", ")", ";", "return"...
Sets the server groups for the deployment. @param serverGroups the server groups to set @return this deployment
[ "Sets", "the", "server", "groups", "for", "the", "deployment", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/Deployment.java#L182-L186
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/deployment/AbstractDeployment.java
AbstractDeployment.validate
protected void validate(final boolean isDomain) throws MojoDeploymentException { final boolean hasServerGroups = hasServerGroups(); if (isDomain) { if (!hasServerGroups) { throw new MojoDeploymentException( "Server is running in domain mode, but no server groups have been defined."); } } else if (hasServerGroups) { throw new MojoDeploymentException("Server is running in standalone mode, but server groups have been defined."); } }
java
protected void validate(final boolean isDomain) throws MojoDeploymentException { final boolean hasServerGroups = hasServerGroups(); if (isDomain) { if (!hasServerGroups) { throw new MojoDeploymentException( "Server is running in domain mode, but no server groups have been defined."); } } else if (hasServerGroups) { throw new MojoDeploymentException("Server is running in standalone mode, but server groups have been defined."); } }
[ "protected", "void", "validate", "(", "final", "boolean", "isDomain", ")", "throws", "MojoDeploymentException", "{", "final", "boolean", "hasServerGroups", "=", "hasServerGroups", "(", ")", ";", "if", "(", "isDomain", ")", "{", "if", "(", "!", "hasServerGroups",...
Validates the deployment. @param isDomain {@code true} if this is a domain server, otherwise {@code false} @throws MojoDeploymentException if the deployment is invalid
[ "Validates", "the", "deployment", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/deployment/AbstractDeployment.java#L141-L151
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java
AddResourceMojo.buildAddOperation
private ModelNode buildAddOperation(final ModelNode address, final Map<String, String> properties) { final ModelNode op = ServerOperations.createAddOperation(address); for (Map.Entry<String, String> prop : properties.entrySet()) { final String[] props = prop.getKey().split(","); if (props.length == 0) { throw new RuntimeException("Invalid property " + prop); } ModelNode node = op; for (int i = 0; i < props.length - 1; ++i) { node = node.get(props[i]); } final String value = prop.getValue() == null ? "" : prop.getValue(); if (value.startsWith("!!")) { handleDmrString(node, props[props.length - 1], value); } else { node.get(props[props.length - 1]).set(value); } } return op; }
java
private ModelNode buildAddOperation(final ModelNode address, final Map<String, String> properties) { final ModelNode op = ServerOperations.createAddOperation(address); for (Map.Entry<String, String> prop : properties.entrySet()) { final String[] props = prop.getKey().split(","); if (props.length == 0) { throw new RuntimeException("Invalid property " + prop); } ModelNode node = op; for (int i = 0; i < props.length - 1; ++i) { node = node.get(props[i]); } final String value = prop.getValue() == null ? "" : prop.getValue(); if (value.startsWith("!!")) { handleDmrString(node, props[props.length - 1], value); } else { node.get(props[props.length - 1]).set(value); } } return op; }
[ "private", "ModelNode", "buildAddOperation", "(", "final", "ModelNode", "address", ",", "final", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", "final", "ModelNode", "op", "=", "ServerOperations", ".", "createAddOperation", "(", "address", ")"...
Creates the operation to add a resource. @param address the address of the operation to add. @param properties the properties to set for the resource. @return the operation.
[ "Creates", "the", "operation", "to", "add", "a", "resource", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java#L215-L234
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java
AddResourceMojo.handleDmrString
private void handleDmrString(final ModelNode node, final String name, final String value) { final String realValue = value.substring(2); node.get(name).set(ModelNode.fromString(realValue)); }
java
private void handleDmrString(final ModelNode node, final String name, final String value) { final String realValue = value.substring(2); node.get(name).set(ModelNode.fromString(realValue)); }
[ "private", "void", "handleDmrString", "(", "final", "ModelNode", "node", ",", "final", "String", "name", ",", "final", "String", "value", ")", "{", "final", "String", "realValue", "=", "value", ".", "substring", "(", "2", ")", ";", "node", ".", "get", "(...
Handles DMR strings in the configuration @param node the node to create. @param name the name for the node. @param value the value for the node.
[ "Handles", "DMR", "strings", "in", "the", "configuration" ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java#L274-L277
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java
AddResourceMojo.parseAddress
private ModelNode parseAddress(final String profileName, final String inputAddress) { final ModelNode result = new ModelNode(); if (profileName != null) { result.add(ServerOperations.PROFILE, profileName); } String[] parts = inputAddress.split(","); for (String part : parts) { String[] address = part.split("="); if (address.length != 2) { throw new RuntimeException(part + " is not a valid address segment"); } result.add(address[0], address[1]); } return result; }
java
private ModelNode parseAddress(final String profileName, final String inputAddress) { final ModelNode result = new ModelNode(); if (profileName != null) { result.add(ServerOperations.PROFILE, profileName); } String[] parts = inputAddress.split(","); for (String part : parts) { String[] address = part.split("="); if (address.length != 2) { throw new RuntimeException(part + " is not a valid address segment"); } result.add(address[0], address[1]); } return result; }
[ "private", "ModelNode", "parseAddress", "(", "final", "String", "profileName", ",", "final", "String", "inputAddress", ")", "{", "final", "ModelNode", "result", "=", "new", "ModelNode", "(", ")", ";", "if", "(", "profileName", "!=", "null", ")", "{", "result...
Parses the comma delimited address into model nodes. @param profileName the profile name for the domain or {@code null} if not a domain @param inputAddress the address. @return a collection of the address nodes.
[ "Parses", "the", "comma", "delimited", "address", "into", "model", "nodes", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java#L287-L301
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/ServerHelper.java
ServerHelper.getContainerDescription
public static ContainerDescription getContainerDescription(final ModelControllerClient client) throws IOException, OperationExecutionException { return DefaultContainerDescription.lookup(Assert.checkNotNullParam("client", client)); }
java
public static ContainerDescription getContainerDescription(final ModelControllerClient client) throws IOException, OperationExecutionException { return DefaultContainerDescription.lookup(Assert.checkNotNullParam("client", client)); }
[ "public", "static", "ContainerDescription", "getContainerDescription", "(", "final", "ModelControllerClient", "client", ")", "throws", "IOException", ",", "OperationExecutionException", "{", "return", "DefaultContainerDescription", ".", "lookup", "(", "Assert", ".", "checkN...
Returns the description of the running container. @param client the client used to query the server @return the description of the running container @throws IOException if an error occurs communicating with the server @throws OperationExecutionException if the operation used to query the container fails
[ "Returns", "the", "description", "of", "the", "running", "container", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/ServerHelper.java#L97-L99
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/ServerHelper.java
ServerHelper.waitForDomain
public static void waitForDomain(final ModelControllerClient client, final long startupTimeout) throws InterruptedException, RuntimeException, TimeoutException { waitForDomain(null, client, startupTimeout); }
java
public static void waitForDomain(final ModelControllerClient client, final long startupTimeout) throws InterruptedException, RuntimeException, TimeoutException { waitForDomain(null, client, startupTimeout); }
[ "public", "static", "void", "waitForDomain", "(", "final", "ModelControllerClient", "client", ",", "final", "long", "startupTimeout", ")", "throws", "InterruptedException", ",", "RuntimeException", ",", "TimeoutException", "{", "waitForDomain", "(", "null", ",", "clie...
Waits the given amount of time in seconds for a managed domain to start. A domain is considered started when each of the servers in the domain are started unless the server is disabled. @param client the client used to communicate with the server @param startupTimeout the time, in seconds, to wait for the server start @throws InterruptedException if interrupted while waiting for the server to start @throws RuntimeException if the process has died @throws TimeoutException if the timeout has been reached and the server is still not started
[ "Waits", "the", "given", "amount", "of", "time", "in", "seconds", "for", "a", "managed", "domain", "to", "start", ".", "A", "domain", "is", "considered", "started", "when", "each", "of", "the", "servers", "in", "the", "domain", "are", "started", "unless", ...
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/ServerHelper.java#L141-L144
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/ServerHelper.java
ServerHelper.shutdownDomain
public static void shutdownDomain(final ModelControllerClient client, final int timeout) throws IOException, OperationExecutionException { // Note the following two operations used to shutdown a domain don't seem to work well in a composite operation. // The operation occasionally sees a java.util.concurrent.CancellationException because the operation client // is likely closed before the AsyncFuture.get() is complete. Using a non-composite operation doesn't seem to // have this issue. // First shutdown the servers final ModelNode stopServersOp = Operations.createOperation("stop-servers"); stopServersOp.get("blocking").set(true); stopServersOp.get("timeout").set(timeout); ModelNode response = client.execute(stopServersOp); if (!Operations.isSuccessfulOutcome(response)) { throw new OperationExecutionException("Failed to stop servers.", stopServersOp, response); } // Now shutdown the host final ModelNode address = determineHostAddress(client); final ModelNode shutdownOp = Operations.createOperation("shutdown", address); response = client.execute(shutdownOp); if (Operations.isSuccessfulOutcome(response)) { // Wait until the process has died while (true) { if (isDomainRunning(client, true)) { try { TimeUnit.MILLISECONDS.sleep(20L); } catch (InterruptedException e) { LOGGER.trace("Interrupted during sleep", e); } } else { break; } } } else { throw new OperationExecutionException("Failed to shutdown host.", shutdownOp, response); } }
java
public static void shutdownDomain(final ModelControllerClient client, final int timeout) throws IOException, OperationExecutionException { // Note the following two operations used to shutdown a domain don't seem to work well in a composite operation. // The operation occasionally sees a java.util.concurrent.CancellationException because the operation client // is likely closed before the AsyncFuture.get() is complete. Using a non-composite operation doesn't seem to // have this issue. // First shutdown the servers final ModelNode stopServersOp = Operations.createOperation("stop-servers"); stopServersOp.get("blocking").set(true); stopServersOp.get("timeout").set(timeout); ModelNode response = client.execute(stopServersOp); if (!Operations.isSuccessfulOutcome(response)) { throw new OperationExecutionException("Failed to stop servers.", stopServersOp, response); } // Now shutdown the host final ModelNode address = determineHostAddress(client); final ModelNode shutdownOp = Operations.createOperation("shutdown", address); response = client.execute(shutdownOp); if (Operations.isSuccessfulOutcome(response)) { // Wait until the process has died while (true) { if (isDomainRunning(client, true)) { try { TimeUnit.MILLISECONDS.sleep(20L); } catch (InterruptedException e) { LOGGER.trace("Interrupted during sleep", e); } } else { break; } } } else { throw new OperationExecutionException("Failed to shutdown host.", shutdownOp, response); } }
[ "public", "static", "void", "shutdownDomain", "(", "final", "ModelControllerClient", "client", ",", "final", "int", "timeout", ")", "throws", "IOException", ",", "OperationExecutionException", "{", "// Note the following two operations used to shutdown a domain don't seem to work...
Shuts down a managed domain container. The servers are first stopped, then the host controller is shutdown. @param client the client used to communicate with the server @param timeout the graceful shutdown timeout, a value of {@code -1} will wait indefinitely and a value of {@code 0} will not attempt a graceful shutdown @throws IOException if an error occurs communicating with the server @throws OperationExecutionException if the operation used to shutdown the managed domain failed
[ "Shuts", "down", "a", "managed", "domain", "container", ".", "The", "servers", "are", "first", "stopped", "then", "the", "host", "controller", "is", "shutdown", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/ServerHelper.java#L221-L256
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/ServerHelper.java
ServerHelper.determineHostAddress
public static ModelNode determineHostAddress(final ModelControllerClient client) throws IOException, OperationExecutionException { final ModelNode op = Operations.createReadAttributeOperation(EMPTY_ADDRESS, "local-host-name"); ModelNode response = client.execute(op); if (Operations.isSuccessfulOutcome(response)) { return DeploymentOperations.createAddress("host", Operations.readResult(response).asString()); } throw new OperationExecutionException(op, response); }
java
public static ModelNode determineHostAddress(final ModelControllerClient client) throws IOException, OperationExecutionException { final ModelNode op = Operations.createReadAttributeOperation(EMPTY_ADDRESS, "local-host-name"); ModelNode response = client.execute(op); if (Operations.isSuccessfulOutcome(response)) { return DeploymentOperations.createAddress("host", Operations.readResult(response).asString()); } throw new OperationExecutionException(op, response); }
[ "public", "static", "ModelNode", "determineHostAddress", "(", "final", "ModelControllerClient", "client", ")", "throws", "IOException", ",", "OperationExecutionException", "{", "final", "ModelNode", "op", "=", "Operations", ".", "createReadAttributeOperation", "(", "EMPTY...
Determines the address for the host being used. @param client the client used to communicate with the server @return the address of the host @throws IOException if an error occurs communicating with the server @throws OperationExecutionException if the operation used to determine the host name fails
[ "Determines", "the", "address", "for", "the", "host", "being", "used", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/ServerHelper.java#L268-L275
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/ServerHelper.java
ServerHelper.waitForStandalone
public static void waitForStandalone(final ModelControllerClient client, final long startupTimeout) throws InterruptedException, RuntimeException, TimeoutException { waitForStandalone(null, client, startupTimeout); }
java
public static void waitForStandalone(final ModelControllerClient client, final long startupTimeout) throws InterruptedException, RuntimeException, TimeoutException { waitForStandalone(null, client, startupTimeout); }
[ "public", "static", "void", "waitForStandalone", "(", "final", "ModelControllerClient", "client", ",", "final", "long", "startupTimeout", ")", "throws", "InterruptedException", ",", "RuntimeException", ",", "TimeoutException", "{", "waitForStandalone", "(", "null", ",",...
Waits the given amount of time in seconds for a standalone server to start. @param client the client used to communicate with the server @param startupTimeout the time, in seconds, to wait for the server start @throws InterruptedException if interrupted while waiting for the server to start @throws RuntimeException if the process has died @throws TimeoutException if the timeout has been reached and the server is still not started
[ "Waits", "the", "given", "amount", "of", "time", "in", "seconds", "for", "a", "standalone", "server", "to", "start", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/ServerHelper.java#L287-L290
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/ServerHelper.java
ServerHelper.isStandaloneRunning
public static boolean isStandaloneRunning(final ModelControllerClient client) { try { final ModelNode response = client.execute(Operations.createReadAttributeOperation(EMPTY_ADDRESS, "server-state")); if (Operations.isSuccessfulOutcome(response)) { final String state = Operations.readResult(response).asString(); return !CONTROLLER_PROCESS_STATE_STARTING.equals(state) && !CONTROLLER_PROCESS_STATE_STOPPING.equals(state); } } catch (RuntimeException | IOException e) { LOGGER.trace("Interrupted determining if standalone is running", e); } return false; }
java
public static boolean isStandaloneRunning(final ModelControllerClient client) { try { final ModelNode response = client.execute(Operations.createReadAttributeOperation(EMPTY_ADDRESS, "server-state")); if (Operations.isSuccessfulOutcome(response)) { final String state = Operations.readResult(response).asString(); return !CONTROLLER_PROCESS_STATE_STARTING.equals(state) && !CONTROLLER_PROCESS_STATE_STOPPING.equals(state); } } catch (RuntimeException | IOException e) { LOGGER.trace("Interrupted determining if standalone is running", e); } return false; }
[ "public", "static", "boolean", "isStandaloneRunning", "(", "final", "ModelControllerClient", "client", ")", "{", "try", "{", "final", "ModelNode", "response", "=", "client", ".", "execute", "(", "Operations", ".", "createReadAttributeOperation", "(", "EMPTY_ADDRESS", ...
Checks to see if a standalone server is running. @param client the client used to communicate with the server @return {@code true} if the server is running, otherwise {@code false}
[ "Checks", "to", "see", "if", "a", "standalone", "server", "is", "running", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/ServerHelper.java#L338-L350
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/ServerHelper.java
ServerHelper.shutdownStandalone
public static void shutdownStandalone(final ModelControllerClient client, final int timeout) throws IOException { final ModelNode op = Operations.createOperation("shutdown"); op.get("timeout").set(timeout); final ModelNode response = client.execute(op); if (Operations.isSuccessfulOutcome(response)) { while (true) { if (isStandaloneRunning(client)) { try { TimeUnit.MILLISECONDS.sleep(20L); } catch (InterruptedException e) { LOGGER.trace("Interrupted during sleep", e); } } else { break; } } } else { throw new OperationExecutionException(op, response); } }
java
public static void shutdownStandalone(final ModelControllerClient client, final int timeout) throws IOException { final ModelNode op = Operations.createOperation("shutdown"); op.get("timeout").set(timeout); final ModelNode response = client.execute(op); if (Operations.isSuccessfulOutcome(response)) { while (true) { if (isStandaloneRunning(client)) { try { TimeUnit.MILLISECONDS.sleep(20L); } catch (InterruptedException e) { LOGGER.trace("Interrupted during sleep", e); } } else { break; } } } else { throw new OperationExecutionException(op, response); } }
[ "public", "static", "void", "shutdownStandalone", "(", "final", "ModelControllerClient", "client", ",", "final", "int", "timeout", ")", "throws", "IOException", "{", "final", "ModelNode", "op", "=", "Operations", ".", "createOperation", "(", "\"shutdown\"", ")", "...
Shuts down a standalone server. @param client the client used to communicate with the server @param timeout the graceful shutdown timeout, a value of {@code -1} will wait indefinitely and a value of {@code 0} will not attempt a graceful shutdown @throws IOException if an error occurs communicating with the server
[ "Shuts", "down", "a", "standalone", "server", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/ServerHelper.java#L372-L391
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/deployment/PackageType.java
PackageType.resolve
public static PackageType resolve(final MavenProject project) { final String packaging = project.getPackaging().toLowerCase(Locale.ROOT); if (DEFAULT_TYPES.containsKey(packaging)) { return DEFAULT_TYPES.get(packaging); } return new PackageType(packaging); }
java
public static PackageType resolve(final MavenProject project) { final String packaging = project.getPackaging().toLowerCase(Locale.ROOT); if (DEFAULT_TYPES.containsKey(packaging)) { return DEFAULT_TYPES.get(packaging); } return new PackageType(packaging); }
[ "public", "static", "PackageType", "resolve", "(", "final", "MavenProject", "project", ")", "{", "final", "String", "packaging", "=", "project", ".", "getPackaging", "(", ")", ".", "toLowerCase", "(", "Locale", ".", "ROOT", ")", ";", "if", "(", "DEFAULT_TYPE...
Resolves the package type from the maven project. @param project the maven project @return the package type
[ "Resolves", "the", "package", "type", "from", "the", "maven", "project", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/deployment/PackageType.java#L81-L87
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/common/Environment.java
Environment.getJavaCommand
public static String getJavaCommand(final Path javaHome) { final Path resolvedJavaHome = javaHome == null ? findJavaHome() : javaHome; final String exe; if (resolvedJavaHome == null) { exe = "java"; } else { exe = resolvedJavaHome.resolve("bin").resolve("java").toString(); } if (exe.contains(" ")) { return "\"" + exe + "\""; } if (WINDOWS) { return exe + ".exe"; } return exe; }
java
public static String getJavaCommand(final Path javaHome) { final Path resolvedJavaHome = javaHome == null ? findJavaHome() : javaHome; final String exe; if (resolvedJavaHome == null) { exe = "java"; } else { exe = resolvedJavaHome.resolve("bin").resolve("java").toString(); } if (exe.contains(" ")) { return "\"" + exe + "\""; } if (WINDOWS) { return exe + ".exe"; } return exe; }
[ "public", "static", "String", "getJavaCommand", "(", "final", "Path", "javaHome", ")", "{", "final", "Path", "resolvedJavaHome", "=", "javaHome", "==", "null", "?", "findJavaHome", "(", ")", ":", "javaHome", ";", "final", "String", "exe", ";", "if", "(", "...
Returns the Java command to use. @param javaHome the Java Home, if {@code null} an attempt to determine the command will be done @return the Java executable command
[ "Returns", "the", "Java", "command", "to", "use", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/common/Environment.java#L124-L139
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/UndeployDescription.java
UndeployDescription.of
public static UndeployDescription of(final DeploymentDescription deploymentDescription) { Assert.checkNotNullParam("deploymentDescription", deploymentDescription); return of(deploymentDescription.getName()).addServerGroups(deploymentDescription.getServerGroups()); }
java
public static UndeployDescription of(final DeploymentDescription deploymentDescription) { Assert.checkNotNullParam("deploymentDescription", deploymentDescription); return of(deploymentDescription.getName()).addServerGroups(deploymentDescription.getServerGroups()); }
[ "public", "static", "UndeployDescription", "of", "(", "final", "DeploymentDescription", "deploymentDescription", ")", "{", "Assert", ".", "checkNotNullParam", "(", "\"deploymentDescription\"", ",", "deploymentDescription", ")", ";", "return", "of", "(", "deploymentDescrip...
Creates a new undeploy description. @param deploymentDescription the deployment description to copy @return the description
[ "Creates", "a", "new", "undeploy", "description", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/UndeployDescription.java#L77-L80
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java
DeploymentOperations.createDeployOperation
public static Operation createDeployOperation(final DeploymentDescription deployment) { Assert.checkNotNullParam("deployment", deployment); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); addDeployOperationStep(builder, deployment); return builder.build(); }
java
public static Operation createDeployOperation(final DeploymentDescription deployment) { Assert.checkNotNullParam("deployment", deployment); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); addDeployOperationStep(builder, deployment); return builder.build(); }
[ "public", "static", "Operation", "createDeployOperation", "(", "final", "DeploymentDescription", "deployment", ")", "{", "Assert", ".", "checkNotNullParam", "(", "\"deployment\"", ",", "deployment", ")", ";", "final", "CompositeOperationBuilder", "builder", "=", "Compos...
Creates an operation to deploy existing deployment content to the runtime. @param deployment the deployment to deploy @return the deploy operation
[ "Creates", "an", "operation", "to", "deploy", "existing", "deployment", "content", "to", "the", "runtime", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java#L150-L155
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java
DeploymentOperations.createDeployOperation
public static Operation createDeployOperation(final Set<DeploymentDescription> deployments) { Assertions.requiresNotNullOrNotEmptyParameter("deployments", deployments); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); for (DeploymentDescription deployment : deployments) { addDeployOperationStep(builder, deployment); } return builder.build(); }
java
public static Operation createDeployOperation(final Set<DeploymentDescription> deployments) { Assertions.requiresNotNullOrNotEmptyParameter("deployments", deployments); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); for (DeploymentDescription deployment : deployments) { addDeployOperationStep(builder, deployment); } return builder.build(); }
[ "public", "static", "Operation", "createDeployOperation", "(", "final", "Set", "<", "DeploymentDescription", ">", "deployments", ")", "{", "Assertions", ".", "requiresNotNullOrNotEmptyParameter", "(", "\"deployments\"", ",", "deployments", ")", ";", "final", "CompositeO...
Creates an option to deploy existing content to the runtime for each deployment @param deployments a set of deployments to deploy @return the deploy operation
[ "Creates", "an", "option", "to", "deploy", "existing", "content", "to", "the", "runtime", "for", "each", "deployment" ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java#L164-L171
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java
DeploymentOperations.addDeployOperationStep
static void addDeployOperationStep(final CompositeOperationBuilder builder, final DeploymentDescription deployment) { final String name = deployment.getName(); final Set<String> serverGroups = deployment.getServerGroups(); // If the server groups are empty this is a standalone deployment if (serverGroups.isEmpty()) { final ModelNode address = createAddress(DEPLOYMENT, name); builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address)); } else { for (String serverGroup : serverGroups) { final ModelNode address = createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, name); builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address)); } } }
java
static void addDeployOperationStep(final CompositeOperationBuilder builder, final DeploymentDescription deployment) { final String name = deployment.getName(); final Set<String> serverGroups = deployment.getServerGroups(); // If the server groups are empty this is a standalone deployment if (serverGroups.isEmpty()) { final ModelNode address = createAddress(DEPLOYMENT, name); builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address)); } else { for (String serverGroup : serverGroups) { final ModelNode address = createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, name); builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address)); } } }
[ "static", "void", "addDeployOperationStep", "(", "final", "CompositeOperationBuilder", "builder", ",", "final", "DeploymentDescription", "deployment", ")", "{", "final", "String", "name", "=", "deployment", ".", "getName", "(", ")", ";", "final", "Set", "<", "Stri...
Adds the deploy operation as a step to the composite operation. @param builder the builder to add the step to @param deployment the deployment to deploy
[ "Adds", "the", "deploy", "operation", "as", "a", "step", "to", "the", "composite", "operation", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java#L336-L350
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java
DeploymentOperations.addRedeployOperationStep
private static void addRedeployOperationStep(final CompositeOperationBuilder builder, final DeploymentDescription deployment) { final String deploymentName = deployment.getName(); final Set<String> serverGroups = deployment.getServerGroups(); if (serverGroups.isEmpty()) { builder.addStep(createOperation(DEPLOYMENT_REDEPLOY_OPERATION, createAddress(DEPLOYMENT, deploymentName))); } else { for (String serverGroup : serverGroups) { builder.addStep(createOperation(DEPLOYMENT_REDEPLOY_OPERATION, createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, deploymentName))); } } }
java
private static void addRedeployOperationStep(final CompositeOperationBuilder builder, final DeploymentDescription deployment) { final String deploymentName = deployment.getName(); final Set<String> serverGroups = deployment.getServerGroups(); if (serverGroups.isEmpty()) { builder.addStep(createOperation(DEPLOYMENT_REDEPLOY_OPERATION, createAddress(DEPLOYMENT, deploymentName))); } else { for (String serverGroup : serverGroups) { builder.addStep(createOperation(DEPLOYMENT_REDEPLOY_OPERATION, createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, deploymentName))); } } }
[ "private", "static", "void", "addRedeployOperationStep", "(", "final", "CompositeOperationBuilder", "builder", ",", "final", "DeploymentDescription", "deployment", ")", "{", "final", "String", "deploymentName", "=", "deployment", ".", "getName", "(", ")", ";", "final"...
Adds a redeploy step to the composite operation. @param builder the builder to add the step to @param deployment the deployment being redeployed
[ "Adds", "a", "redeploy", "step", "to", "the", "composite", "operation", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java#L422-L432
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java
ServerOperations.getFailureDescriptionAsString
public static String getFailureDescriptionAsString(final ModelNode result) { if (isSuccessfulOutcome(result)) { return ""; } final String msg; if (result.hasDefined(ClientConstants.FAILURE_DESCRIPTION)) { if (result.hasDefined(ClientConstants.OP)) { msg = String.format("Operation '%s' at address '%s' failed: %s", result.get(ClientConstants.OP), result.get(ClientConstants.OP_ADDR), result .get(ClientConstants.FAILURE_DESCRIPTION)); } else { msg = String.format("Operation failed: %s", result.get(ClientConstants.FAILURE_DESCRIPTION)); } } else { msg = String.format("An unexpected response was found checking the deployment. Result: %s", result); } return msg; }
java
public static String getFailureDescriptionAsString(final ModelNode result) { if (isSuccessfulOutcome(result)) { return ""; } final String msg; if (result.hasDefined(ClientConstants.FAILURE_DESCRIPTION)) { if (result.hasDefined(ClientConstants.OP)) { msg = String.format("Operation '%s' at address '%s' failed: %s", result.get(ClientConstants.OP), result.get(ClientConstants.OP_ADDR), result .get(ClientConstants.FAILURE_DESCRIPTION)); } else { msg = String.format("Operation failed: %s", result.get(ClientConstants.FAILURE_DESCRIPTION)); } } else { msg = String.format("An unexpected response was found checking the deployment. Result: %s", result); } return msg; }
[ "public", "static", "String", "getFailureDescriptionAsString", "(", "final", "ModelNode", "result", ")", "{", "if", "(", "isSuccessfulOutcome", "(", "result", ")", ")", "{", "return", "\"\"", ";", "}", "final", "String", "msg", ";", "if", "(", "result", ".",...
Parses the result and returns the failure description. If the result was successful, an empty string is returned. @param result the result of executing an operation @return the failure message or an empty string
[ "Parses", "the", "result", "and", "returns", "the", "failure", "description", ".", "If", "the", "result", "was", "successful", "an", "empty", "string", "is", "returned", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java#L64-L80
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java
ServerOperations.createListDeploymentsOperation
public static ModelNode createListDeploymentsOperation() { final ModelNode op = createOperation(READ_CHILDREN_NAMES); op.get(CHILD_TYPE).set(DEPLOYMENT); return op; }
java
public static ModelNode createListDeploymentsOperation() { final ModelNode op = createOperation(READ_CHILDREN_NAMES); op.get(CHILD_TYPE).set(DEPLOYMENT); return op; }
[ "public", "static", "ModelNode", "createListDeploymentsOperation", "(", ")", "{", "final", "ModelNode", "op", "=", "createOperation", "(", "READ_CHILDREN_NAMES", ")", ";", "op", ".", "get", "(", "CHILD_TYPE", ")", ".", "set", "(", "DEPLOYMENT", ")", ";", "retu...
Creates an operation to list the deployments. @return the operation
[ "Creates", "an", "operation", "to", "list", "the", "deployments", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java#L87-L91
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java
ServerOperations.createRemoveOperation
public static ModelNode createRemoveOperation(final ModelNode address, final boolean recursive) { final ModelNode op = createRemoveOperation(address); op.get(RECURSIVE).set(recursive); return op; }
java
public static ModelNode createRemoveOperation(final ModelNode address, final boolean recursive) { final ModelNode op = createRemoveOperation(address); op.get(RECURSIVE).set(recursive); return op; }
[ "public", "static", "ModelNode", "createRemoveOperation", "(", "final", "ModelNode", "address", ",", "final", "boolean", "recursive", ")", "{", "final", "ModelNode", "op", "=", "createRemoveOperation", "(", "address", ")", ";", "op", ".", "get", "(", "RECURSIVE"...
Creates a remove operation. @param address the address for the operation @param recursive {@code true} if the remove should be recursive, otherwise {@code false} @return the operation
[ "Creates", "a", "remove", "operation", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java#L101-L105
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java
ServerOperations.getChildAddress
public static Property getChildAddress(final ModelNode address) { if (address.getType() != ModelType.LIST) { throw new IllegalArgumentException("The address type must be a list."); } final List<Property> addressParts = address.asPropertyList(); if (addressParts.isEmpty()) { throw new IllegalArgumentException("The address is empty."); } return addressParts.get(addressParts.size() - 1); }
java
public static Property getChildAddress(final ModelNode address) { if (address.getType() != ModelType.LIST) { throw new IllegalArgumentException("The address type must be a list."); } final List<Property> addressParts = address.asPropertyList(); if (addressParts.isEmpty()) { throw new IllegalArgumentException("The address is empty."); } return addressParts.get(addressParts.size() - 1); }
[ "public", "static", "Property", "getChildAddress", "(", "final", "ModelNode", "address", ")", "{", "if", "(", "address", ".", "getType", "(", ")", "!=", "ModelType", ".", "LIST", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The address type must...
Finds the last entry of the address list and returns it as a property. @param address the address to get the last part of @return the last part of the address @throws IllegalArgumentException if the address is not of type {@link ModelType#LIST} or is empty
[ "Finds", "the", "last", "entry", "of", "the", "address", "list", "and", "returns", "it", "as", "a", "property", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java#L169-L178
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java
ServerOperations.getParentAddress
public static ModelNode getParentAddress(final ModelNode address) { if (address.getType() != ModelType.LIST) { throw new IllegalArgumentException("The address type must be a list."); } final ModelNode result = new ModelNode(); final List<Property> addressParts = address.asPropertyList(); if (addressParts.isEmpty()) { throw new IllegalArgumentException("The address is empty."); } for (int i = 0; i < addressParts.size() - 1; ++i) { final Property property = addressParts.get(i); result.add(property.getName(), property.getValue()); } return result; }
java
public static ModelNode getParentAddress(final ModelNode address) { if (address.getType() != ModelType.LIST) { throw new IllegalArgumentException("The address type must be a list."); } final ModelNode result = new ModelNode(); final List<Property> addressParts = address.asPropertyList(); if (addressParts.isEmpty()) { throw new IllegalArgumentException("The address is empty."); } for (int i = 0; i < addressParts.size() - 1; ++i) { final Property property = addressParts.get(i); result.add(property.getName(), property.getValue()); } return result; }
[ "public", "static", "ModelNode", "getParentAddress", "(", "final", "ModelNode", "address", ")", "{", "if", "(", "address", ".", "getType", "(", ")", "!=", "ModelType", ".", "LIST", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The address type mu...
Finds the parent address, everything before the last address part. @param address the address to get the parent @return the parent address @throws IllegalArgumentException if the address is not of type {@link ModelType#LIST} or is empty
[ "Finds", "the", "parent", "address", "everything", "before", "the", "last", "address", "part", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java#L189-L203
train
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/common/MavenModelControllerClientConfiguration.java
MavenModelControllerClientConfiguration.getController
public String getController() { final StringBuilder controller = new StringBuilder(); if (getProtocol() != null) { controller.append(getProtocol()).append("://"); } if (getHost() != null) { controller.append(getHost()); } else { controller.append("localhost"); } if (getPort() > 0) { controller.append(':').append(getPort()); } return controller.toString(); }
java
public String getController() { final StringBuilder controller = new StringBuilder(); if (getProtocol() != null) { controller.append(getProtocol()).append("://"); } if (getHost() != null) { controller.append(getHost()); } else { controller.append("localhost"); } if (getPort() > 0) { controller.append(':').append(getPort()); } return controller.toString(); }
[ "public", "String", "getController", "(", ")", "{", "final", "StringBuilder", "controller", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "getProtocol", "(", ")", "!=", "null", ")", "{", "controller", ".", "append", "(", "getProtocol", "(", ")", ...
Formats a connection string for CLI to use as it's controller connection. @return the controller string to connect CLI
[ "Formats", "a", "connection", "string", "for", "CLI", "to", "use", "as", "it", "s", "controller", "connection", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/common/MavenModelControllerClientConfiguration.java#L143-L157
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/DefaultContainerDescription.java
DefaultContainerDescription.lookup
static DefaultContainerDescription lookup(final ModelControllerClient client) throws IOException, OperationExecutionException { final ModelNode op = Operations.createReadResourceOperation(new ModelNode().setEmptyList()); op.get(ClientConstants.INCLUDE_RUNTIME).set(true); final ModelNode result = client.execute(op); if (Operations.isSuccessfulOutcome(result)) { final ModelNode model = Operations.readResult(result); final String productName = getValue(model, "product-name", "WildFly"); final String productVersion = getValue(model, "product-version"); final String releaseVersion = getValue(model, "release-version"); final String launchType = getValue(model, "launch-type"); return new DefaultContainerDescription(productName, productVersion, releaseVersion, launchType, "DOMAIN".equalsIgnoreCase(launchType)); } throw new OperationExecutionException(op, result); }
java
static DefaultContainerDescription lookup(final ModelControllerClient client) throws IOException, OperationExecutionException { final ModelNode op = Operations.createReadResourceOperation(new ModelNode().setEmptyList()); op.get(ClientConstants.INCLUDE_RUNTIME).set(true); final ModelNode result = client.execute(op); if (Operations.isSuccessfulOutcome(result)) { final ModelNode model = Operations.readResult(result); final String productName = getValue(model, "product-name", "WildFly"); final String productVersion = getValue(model, "product-version"); final String releaseVersion = getValue(model, "release-version"); final String launchType = getValue(model, "launch-type"); return new DefaultContainerDescription(productName, productVersion, releaseVersion, launchType, "DOMAIN".equalsIgnoreCase(launchType)); } throw new OperationExecutionException(op, result); }
[ "static", "DefaultContainerDescription", "lookup", "(", "final", "ModelControllerClient", "client", ")", "throws", "IOException", ",", "OperationExecutionException", "{", "final", "ModelNode", "op", "=", "Operations", ".", "createReadResourceOperation", "(", "new", "Model...
Queries the running container and attempts to lookup the information from the running container. @param client the client used to execute the management operation @return the container description @throws IOException if an error occurs while executing the management operation @throws OperationExecutionException if the operation used to query the container fails
[ "Queries", "the", "running", "container", "and", "attempts", "to", "lookup", "the", "information", "from", "the", "running", "container", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/DefaultContainerDescription.java#L106-L119
train
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/SimpleDeploymentDescription.java
SimpleDeploymentDescription.of
public static SimpleDeploymentDescription of(final String name, @SuppressWarnings("TypeMayBeWeakened") final Set<String> serverGroups) { final SimpleDeploymentDescription result = of(name); if (serverGroups != null) { result.addServerGroups(serverGroups); } return result; }
java
public static SimpleDeploymentDescription of(final String name, @SuppressWarnings("TypeMayBeWeakened") final Set<String> serverGroups) { final SimpleDeploymentDescription result = of(name); if (serverGroups != null) { result.addServerGroups(serverGroups); } return result; }
[ "public", "static", "SimpleDeploymentDescription", "of", "(", "final", "String", "name", ",", "@", "SuppressWarnings", "(", "\"TypeMayBeWeakened\"", ")", "final", "Set", "<", "String", ">", "serverGroups", ")", "{", "final", "SimpleDeploymentDescription", "result", ...
Creates a simple deployment description. @param name the name for the deployment @param serverGroups the server groups @return the deployment description
[ "Creates", "a", "simple", "deployment", "description", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/SimpleDeploymentDescription.java#L64-L70
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/BuildInfoDeployer.java
BuildInfoDeployer.addBuildInfoProperties
@Override protected void addBuildInfoProperties(BuildInfoBuilder builder) { if (envVars != null) { for (Map.Entry<String, String> entry : envVars.entrySet()) { builder.addProperty(BuildInfoProperties.BUILD_INFO_ENVIRONMENT_PREFIX + entry.getKey(), entry.getValue()); } } if (sysVars != null) { for (Map.Entry<String, String> entry : sysVars.entrySet()) { builder.addProperty(entry.getKey(), entry.getValue()); } } }
java
@Override protected void addBuildInfoProperties(BuildInfoBuilder builder) { if (envVars != null) { for (Map.Entry<String, String> entry : envVars.entrySet()) { builder.addProperty(BuildInfoProperties.BUILD_INFO_ENVIRONMENT_PREFIX + entry.getKey(), entry.getValue()); } } if (sysVars != null) { for (Map.Entry<String, String> entry : sysVars.entrySet()) { builder.addProperty(entry.getKey(), entry.getValue()); } } }
[ "@", "Override", "protected", "void", "addBuildInfoProperties", "(", "BuildInfoBuilder", "builder", ")", "{", "if", "(", "envVars", "!=", "null", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "envVars", ".", ...
Adding environment and system variables to build info. @param builder
[ "Adding", "environment", "and", "system", "variables", "to", "build", "info", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/BuildInfoDeployer.java#L100-L113
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/promotion/UnifiedPromoteBuildAction.java
UnifiedPromoteBuildAction.loadBuild
@JavaScriptMethod @SuppressWarnings({"UnusedDeclaration"}) public LoadBuildsResponse loadBuild(String buildId) { LoadBuildsResponse response = new LoadBuildsResponse(); // When we load a new build we need also to reset the promotion plugin. // The null plugin is related to 'None' plugin. setPromotionPlugin(null); try { this.currentPromotionCandidate = promotionCandidates.get(buildId); if (this.currentPromotionCandidate == null) { throw new IllegalArgumentException("Can't find build by ID: " + buildId); } List<String> repositoryKeys = getRepositoryKeys(); List<UserPluginInfo> plugins = getPromotionsUserPluginInfo(); PromotionConfig promotionConfig = getPromotionConfig(); String defaultTargetRepository = getDefaultPromotionTargetRepository(); if (StringUtils.isNotBlank(defaultTargetRepository) && repositoryKeys.contains(defaultTargetRepository)) { promotionConfig.setTargetRepo(defaultTargetRepository); } response.addRepositories(repositoryKeys); response.setPlugins(plugins); response.setPromotionConfig(promotionConfig); response.setSuccess(true); } catch (Exception e) { response.setResponseMessage(e.getMessage()); } return response; }
java
@JavaScriptMethod @SuppressWarnings({"UnusedDeclaration"}) public LoadBuildsResponse loadBuild(String buildId) { LoadBuildsResponse response = new LoadBuildsResponse(); // When we load a new build we need also to reset the promotion plugin. // The null plugin is related to 'None' plugin. setPromotionPlugin(null); try { this.currentPromotionCandidate = promotionCandidates.get(buildId); if (this.currentPromotionCandidate == null) { throw new IllegalArgumentException("Can't find build by ID: " + buildId); } List<String> repositoryKeys = getRepositoryKeys(); List<UserPluginInfo> plugins = getPromotionsUserPluginInfo(); PromotionConfig promotionConfig = getPromotionConfig(); String defaultTargetRepository = getDefaultPromotionTargetRepository(); if (StringUtils.isNotBlank(defaultTargetRepository) && repositoryKeys.contains(defaultTargetRepository)) { promotionConfig.setTargetRepo(defaultTargetRepository); } response.addRepositories(repositoryKeys); response.setPlugins(plugins); response.setPromotionConfig(promotionConfig); response.setSuccess(true); } catch (Exception e) { response.setResponseMessage(e.getMessage()); } return response; }
[ "@", "JavaScriptMethod", "@", "SuppressWarnings", "(", "{", "\"UnusedDeclaration\"", "}", ")", "public", "LoadBuildsResponse", "loadBuild", "(", "String", "buildId", ")", "{", "LoadBuildsResponse", "response", "=", "new", "LoadBuildsResponse", "(", ")", ";", "// Whe...
Load the related repositories, plugins and a promotion config associated to the buildId. Called from the UI. @param buildId - The unique build id. @return LoadBuildsResponse e.g. list of repositories, plugins and a promotion config.
[ "Load", "the", "related", "repositories", "plugins", "and", "a", "promotion", "config", "associated", "to", "the", "buildId", ".", "Called", "from", "the", "UI", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/promotion/UnifiedPromoteBuildAction.java#L118-L145
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/promotion/UnifiedPromoteBuildAction.java
UnifiedPromoteBuildAction.doIndex
@SuppressWarnings({"UnusedDeclaration"}) public void doIndex(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException { req.getView(this, chooseAction()).forward(req, resp); }
java
@SuppressWarnings({"UnusedDeclaration"}) public void doIndex(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException { req.getView(this, chooseAction()).forward(req, resp); }
[ "@", "SuppressWarnings", "(", "{", "\"UnusedDeclaration\"", "}", ")", "public", "void", "doIndex", "(", "StaplerRequest", "req", ",", "StaplerResponse", "resp", ")", "throws", "IOException", ",", "ServletException", "{", "req", ".", "getView", "(", "this", ",", ...
Select which view to display based on the state of the promotion. Will return the form if user selects to perform promotion. Progress will be returned if the promotion is currently in progress.
[ "Select", "which", "view", "to", "display", "based", "on", "the", "state", "of", "the", "promotion", ".", "Will", "return", "the", "form", "if", "user", "selects", "to", "perform", "promotion", ".", "Progress", "will", "be", "returned", "if", "the", "promo...
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/promotion/UnifiedPromoteBuildAction.java#L270-L273
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/Utils.java
Utils.prepareArtifactoryServer
public static org.jfrog.hudson.ArtifactoryServer prepareArtifactoryServer(String artifactoryServerID, ArtifactoryServer pipelineServer) { if (artifactoryServerID == null && pipelineServer == null) { return null; } if (artifactoryServerID != null && pipelineServer != null) { return null; } if (pipelineServer != null) { CredentialsConfig credentials = pipelineServer.createCredentialsConfig(); return new org.jfrog.hudson.ArtifactoryServer(null, pipelineServer.getUrl(), credentials, credentials, pipelineServer.getConnection().getTimeout(), pipelineServer.isBypassProxy(), pipelineServer.getConnection().getRetry(), pipelineServer.getDeploymentThreads()); } org.jfrog.hudson.ArtifactoryServer server = RepositoriesUtils.getArtifactoryServer(artifactoryServerID, RepositoriesUtils.getArtifactoryServers()); if (server == null) { return null; } return server; }
java
public static org.jfrog.hudson.ArtifactoryServer prepareArtifactoryServer(String artifactoryServerID, ArtifactoryServer pipelineServer) { if (artifactoryServerID == null && pipelineServer == null) { return null; } if (artifactoryServerID != null && pipelineServer != null) { return null; } if (pipelineServer != null) { CredentialsConfig credentials = pipelineServer.createCredentialsConfig(); return new org.jfrog.hudson.ArtifactoryServer(null, pipelineServer.getUrl(), credentials, credentials, pipelineServer.getConnection().getTimeout(), pipelineServer.isBypassProxy(), pipelineServer.getConnection().getRetry(), pipelineServer.getDeploymentThreads()); } org.jfrog.hudson.ArtifactoryServer server = RepositoriesUtils.getArtifactoryServer(artifactoryServerID, RepositoriesUtils.getArtifactoryServers()); if (server == null) { return null; } return server; }
[ "public", "static", "org", ".", "jfrog", ".", "hudson", ".", "ArtifactoryServer", "prepareArtifactoryServer", "(", "String", "artifactoryServerID", ",", "ArtifactoryServer", "pipelineServer", ")", "{", "if", "(", "artifactoryServerID", "==", "null", "&&", "pipelineSer...
Prepares Artifactory server either from serverID or from ArtifactoryServer. @param artifactoryServerID @param pipelineServer @return
[ "Prepares", "Artifactory", "server", "either", "from", "serverID", "or", "from", "ArtifactoryServer", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/Utils.java#L64-L84
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/Utils.java
Utils.appendBuildInfo
public static BuildInfo appendBuildInfo(CpsScript cpsScript, Map<String, Object> stepVariables) { BuildInfo buildInfo = (BuildInfo) stepVariables.get(BUILD_INFO); if (buildInfo == null) { buildInfo = (BuildInfo) cpsScript.invokeMethod("newBuildInfo", Maps.newLinkedHashMap()); stepVariables.put(BUILD_INFO, buildInfo); } buildInfo.setCpsScript(cpsScript); return buildInfo; }
java
public static BuildInfo appendBuildInfo(CpsScript cpsScript, Map<String, Object> stepVariables) { BuildInfo buildInfo = (BuildInfo) stepVariables.get(BUILD_INFO); if (buildInfo == null) { buildInfo = (BuildInfo) cpsScript.invokeMethod("newBuildInfo", Maps.newLinkedHashMap()); stepVariables.put(BUILD_INFO, buildInfo); } buildInfo.setCpsScript(cpsScript); return buildInfo; }
[ "public", "static", "BuildInfo", "appendBuildInfo", "(", "CpsScript", "cpsScript", ",", "Map", "<", "String", ",", "Object", ">", "stepVariables", ")", "{", "BuildInfo", "buildInfo", "=", "(", "BuildInfo", ")", "stepVariables", ".", "get", "(", "BUILD_INFO", "...
Add the buildInfo to step variables if missing and set its cps script. @param cpsScript the cps script @param stepVariables step variables map @return the build info
[ "Add", "the", "buildInfo", "to", "step", "variables", "if", "missing", "and", "set", "its", "cps", "script", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/Utils.java#L346-L354
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/PromotionUtils.java
PromotionUtils.promoteAndCheckResponse
public static boolean promoteAndCheckResponse(Promotion promotion, ArtifactoryBuildInfoClient client, TaskListener listener, String buildName, String buildNumber) throws IOException { // If failFast is true, perform dry run first if (promotion.isFailFast()) { promotion.setDryRun(true); listener.getLogger().println("Performing dry run promotion (no changes are made during dry run) ..."); HttpResponse dryResponse = client.stageBuild(buildName, buildNumber, promotion); try { validatePromotionSuccessful(dryResponse, true, promotion.isFailFast(), listener); } catch (IOException e) { listener.error(e.getMessage()); return false; } listener.getLogger().println("Dry run finished successfully.\nPerforming promotion ..."); } // Perform promotion promotion.setDryRun(false); HttpResponse response = client.stageBuild(buildName, buildNumber, promotion); try { validatePromotionSuccessful(response, false, promotion.isFailFast(), listener); } catch (IOException e) { listener.error(e.getMessage()); return false; } listener.getLogger().println("Promotion completed successfully!"); return true; }
java
public static boolean promoteAndCheckResponse(Promotion promotion, ArtifactoryBuildInfoClient client, TaskListener listener, String buildName, String buildNumber) throws IOException { // If failFast is true, perform dry run first if (promotion.isFailFast()) { promotion.setDryRun(true); listener.getLogger().println("Performing dry run promotion (no changes are made during dry run) ..."); HttpResponse dryResponse = client.stageBuild(buildName, buildNumber, promotion); try { validatePromotionSuccessful(dryResponse, true, promotion.isFailFast(), listener); } catch (IOException e) { listener.error(e.getMessage()); return false; } listener.getLogger().println("Dry run finished successfully.\nPerforming promotion ..."); } // Perform promotion promotion.setDryRun(false); HttpResponse response = client.stageBuild(buildName, buildNumber, promotion); try { validatePromotionSuccessful(response, false, promotion.isFailFast(), listener); } catch (IOException e) { listener.error(e.getMessage()); return false; } listener.getLogger().println("Promotion completed successfully!"); return true; }
[ "public", "static", "boolean", "promoteAndCheckResponse", "(", "Promotion", "promotion", ",", "ArtifactoryBuildInfoClient", "client", ",", "TaskListener", "listener", ",", "String", "buildName", ",", "String", "buildNumber", ")", "throws", "IOException", "{", "// If fai...
Two stage promotion, dry run and actual promotion to verify correctness. @param promotion @param client @param listener @param buildName @param buildNumber @throws IOException
[ "Two", "stage", "promotion", "dry", "run", "and", "actual", "promotion", "to", "verify", "correctness", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/PromotionUtils.java#L27-L55
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/FormValidations.java
FormValidations.validateEmails
public static FormValidation validateEmails(String emails) { if (!Strings.isNullOrEmpty(emails)) { String[] recipients = StringUtils.split(emails, " "); for (String email : recipients) { FormValidation validation = validateInternetAddress(email); if (validation != FormValidation.ok()) { return validation; } } } return FormValidation.ok(); }
java
public static FormValidation validateEmails(String emails) { if (!Strings.isNullOrEmpty(emails)) { String[] recipients = StringUtils.split(emails, " "); for (String email : recipients) { FormValidation validation = validateInternetAddress(email); if (validation != FormValidation.ok()) { return validation; } } } return FormValidation.ok(); }
[ "public", "static", "FormValidation", "validateEmails", "(", "String", "emails", ")", "{", "if", "(", "!", "Strings", ".", "isNullOrEmpty", "(", "emails", ")", ")", "{", "String", "[", "]", "recipients", "=", "StringUtils", ".", "split", "(", "emails", ","...
Validates a space separated list of emails. @param emails Space separated list of emails @return {@link hudson.util.FormValidation.ok()} if valid or empty, error otherwise
[ "Validates", "a", "space", "separated", "list", "of", "emails", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/FormValidations.java#L29-L40
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/FormValidations.java
FormValidations.validateArtifactoryCombinationFilter
public static FormValidation validateArtifactoryCombinationFilter(String value) throws IOException, InterruptedException { String url = Util.fixEmptyAndTrim(value); if (url == null) return FormValidation.error("Mandatory field - You don`t have any deploy matches"); return FormValidation.ok(); }
java
public static FormValidation validateArtifactoryCombinationFilter(String value) throws IOException, InterruptedException { String url = Util.fixEmptyAndTrim(value); if (url == null) return FormValidation.error("Mandatory field - You don`t have any deploy matches"); return FormValidation.ok(); }
[ "public", "static", "FormValidation", "validateArtifactoryCombinationFilter", "(", "String", "value", ")", "throws", "IOException", ",", "InterruptedException", "{", "String", "url", "=", "Util", ".", "fixEmptyAndTrim", "(", "value", ")", ";", "if", "(", "url", "=...
Validate the Combination filter field in Multi configuration jobs
[ "Validate", "the", "Combination", "filter", "field", "in", "Multi", "configuration", "jobs" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/FormValidations.java#L63-L70
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/DistributionUtils.java
DistributionUtils.distributeAndCheckResponse
public static boolean distributeAndCheckResponse(DistributionBuilder distributionBuilder, ArtifactoryBuildInfoClient client, TaskListener listener, String buildName, String buildNumber, boolean dryRun) throws IOException { // do a dry run first listener.getLogger().println("Performing dry run distribution (no changes are made during dry run) ..."); if (!distribute(distributionBuilder, client, listener, buildName, buildNumber, true)) { return false; } listener.getLogger().println("Dry run finished successfully"); if (!dryRun) { listener.getLogger().println("Performing distribution ..."); if (!distribute(distributionBuilder, client, listener, buildName, buildNumber, false)) { return false; } listener.getLogger().println("Distribution completed successfully!"); } return true; }
java
public static boolean distributeAndCheckResponse(DistributionBuilder distributionBuilder, ArtifactoryBuildInfoClient client, TaskListener listener, String buildName, String buildNumber, boolean dryRun) throws IOException { // do a dry run first listener.getLogger().println("Performing dry run distribution (no changes are made during dry run) ..."); if (!distribute(distributionBuilder, client, listener, buildName, buildNumber, true)) { return false; } listener.getLogger().println("Dry run finished successfully"); if (!dryRun) { listener.getLogger().println("Performing distribution ..."); if (!distribute(distributionBuilder, client, listener, buildName, buildNumber, false)) { return false; } listener.getLogger().println("Distribution completed successfully!"); } return true; }
[ "public", "static", "boolean", "distributeAndCheckResponse", "(", "DistributionBuilder", "distributionBuilder", ",", "ArtifactoryBuildInfoClient", "client", ",", "TaskListener", "listener", ",", "String", "buildName", ",", "String", "buildNumber", ",", "boolean", "dryRun", ...
Two stage distribution, dry run and actual promotion to verify correctness. @param distributionBuilder @param client @param listener @param buildName @param buildNumber @throws IOException
[ "Two", "stage", "distribution", "dry", "run", "and", "actual", "promotion", "to", "verify", "correctness", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/DistributionUtils.java#L29-L45
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/publisher/PublisherFlexible.java
PublisherFlexible.getWrappedPublisher
private T getWrappedPublisher(Publisher flexiblePublisher, Class<T> type) { if (!(flexiblePublisher instanceof FlexiblePublisher)) { throw new IllegalArgumentException(String.format("Publisher should be of type: '%s'. Found type: '%s'", FlexiblePublisher.class, flexiblePublisher.getClass())); } List<ConditionalPublisher> conditions = ((FlexiblePublisher) flexiblePublisher).getPublishers(); for (ConditionalPublisher condition : conditions) { if (type.isInstance(condition.getPublisher())) { return type.cast(condition.getPublisher()); } } return null; }
java
private T getWrappedPublisher(Publisher flexiblePublisher, Class<T> type) { if (!(flexiblePublisher instanceof FlexiblePublisher)) { throw new IllegalArgumentException(String.format("Publisher should be of type: '%s'. Found type: '%s'", FlexiblePublisher.class, flexiblePublisher.getClass())); } List<ConditionalPublisher> conditions = ((FlexiblePublisher) flexiblePublisher).getPublishers(); for (ConditionalPublisher condition : conditions) { if (type.isInstance(condition.getPublisher())) { return type.cast(condition.getPublisher()); } } return null; }
[ "private", "T", "getWrappedPublisher", "(", "Publisher", "flexiblePublisher", ",", "Class", "<", "T", ">", "type", ")", "{", "if", "(", "!", "(", "flexiblePublisher", "instanceof", "FlexiblePublisher", ")", ")", "{", "throw", "new", "IllegalArgumentException", "...
Gets the publisher wrapped by the specofoed FlexiblePublisher. @param publisher The FlexiblePublisher wrapping the publisher. @param type The type of the publisher wrapped by the FlexiblePublisher. @return The publisher object wrapped by the FlexiblePublisher. Null is returned if the FlexiblePublisher does not wrap a publisher of the specified type. @throws IllegalArgumentException In case publisher is not of type {@link org.jenkins_ci.plugins.flexible_publish.FlexiblePublisher}
[ "Gets", "the", "publisher", "wrapped", "by", "the", "specofoed", "FlexiblePublisher", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/publisher/PublisherFlexible.java#L29-L43
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/publisher/PublisherFlexible.java
PublisherFlexible.find
public T find(AbstractProject<?, ?> project, Class<T> type) { // First check that the Flexible Publish plugin is installed: if (Jenkins.getInstance().getPlugin(FLEXIBLE_PUBLISH_PLUGIN) != null) { // Iterate all the project's publishers and find the flexible publisher: for (Publisher publisher : project.getPublishersList()) { // Found the flexible publisher: if (publisher instanceof FlexiblePublisher) { // See if it wraps a publisher of the specified type and if it does, return it: T pub = getWrappedPublisher(publisher, type); if (pub != null) { return pub; } } } } return null; }
java
public T find(AbstractProject<?, ?> project, Class<T> type) { // First check that the Flexible Publish plugin is installed: if (Jenkins.getInstance().getPlugin(FLEXIBLE_PUBLISH_PLUGIN) != null) { // Iterate all the project's publishers and find the flexible publisher: for (Publisher publisher : project.getPublishersList()) { // Found the flexible publisher: if (publisher instanceof FlexiblePublisher) { // See if it wraps a publisher of the specified type and if it does, return it: T pub = getWrappedPublisher(publisher, type); if (pub != null) { return pub; } } } } return null; }
[ "public", "T", "find", "(", "AbstractProject", "<", "?", ",", "?", ">", "project", ",", "Class", "<", "T", ">", "type", ")", "{", "// First check that the Flexible Publish plugin is installed:", "if", "(", "Jenkins", ".", "getInstance", "(", ")", ".", "getPlug...
Gets the publisher of the specified type, if it is wrapped by the "Flexible Publish" publisher in a project. Null is returned if no such publisher is found. @param project The project @param type The type of the publisher
[ "Gets", "the", "publisher", "of", "the", "specified", "type", "if", "it", "is", "wrapped", "by", "the", "Flexible", "Publish", "publisher", "in", "a", "project", ".", "Null", "is", "returned", "if", "no", "such", "publisher", "is", "found", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/publisher/PublisherFlexible.java#L51-L68
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/publisher/PublisherFlexible.java
PublisherFlexible.isPublisherWrapped
public boolean isPublisherWrapped(AbstractProject<?, ?> project, Class<T> type) { return find(project, type) != null; }
java
public boolean isPublisherWrapped(AbstractProject<?, ?> project, Class<T> type) { return find(project, type) != null; }
[ "public", "boolean", "isPublisherWrapped", "(", "AbstractProject", "<", "?", ",", "?", ">", "project", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "find", "(", "project", ",", "type", ")", "!=", "null", ";", "}" ]
Determines whether a project has the specified publisher type, wrapped by the "Flexible Publish" publisher. @param project The project @param type The type of the publisher @return true if the project contains a publisher of the specified type wrapped by the "Flexible Publish" publisher.
[ "Determines", "whether", "a", "project", "has", "the", "specified", "publisher", "type", "wrapped", "by", "the", "Flexible", "Publish", "publisher", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/publisher/PublisherFlexible.java#L76-L78
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/scm/svn/SubversionManager.java
SubversionManager.commitWorkingCopy
public void commitWorkingCopy(final String commitMessage) throws IOException, InterruptedException { build.getWorkspace().act(new SVNCommitWorkingCopyCallable(commitMessage, getLocation(), getSvnAuthenticationProvider(build), buildListener)); }
java
public void commitWorkingCopy(final String commitMessage) throws IOException, InterruptedException { build.getWorkspace().act(new SVNCommitWorkingCopyCallable(commitMessage, getLocation(), getSvnAuthenticationProvider(build), buildListener)); }
[ "public", "void", "commitWorkingCopy", "(", "final", "String", "commitMessage", ")", "throws", "IOException", ",", "InterruptedException", "{", "build", ".", "getWorkspace", "(", ")", ".", "act", "(", "new", "SVNCommitWorkingCopyCallable", "(", "commitMessage", ",",...
Commits the working copy. @param commitMessage@return The commit info upon successful operation. @throws IOException On IO of SVN failure
[ "Commits", "the", "working", "copy", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/scm/svn/SubversionManager.java#L58-L61
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/scm/svn/SubversionManager.java
SubversionManager.createTag
public void createTag(final String tagUrl, final String commitMessage) throws IOException, InterruptedException { build.getWorkspace() .act(new SVNCreateTagCallable(tagUrl, commitMessage, getLocation(), getSvnAuthenticationProvider(build), buildListener)); }
java
public void createTag(final String tagUrl, final String commitMessage) throws IOException, InterruptedException { build.getWorkspace() .act(new SVNCreateTagCallable(tagUrl, commitMessage, getLocation(), getSvnAuthenticationProvider(build), buildListener)); }
[ "public", "void", "createTag", "(", "final", "String", "tagUrl", ",", "final", "String", "commitMessage", ")", "throws", "IOException", ",", "InterruptedException", "{", "build", ".", "getWorkspace", "(", ")", ".", "act", "(", "new", "SVNCreateTagCallable", "(",...
Creates a tag directly from the working copy. @param tagUrl The URL of the tag to create. @param commitMessage Commit message @return The commit info upon successful operation. @throws IOException On IO of SVN failure
[ "Creates", "a", "tag", "directly", "from", "the", "working", "copy", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/scm/svn/SubversionManager.java#L71-L76
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/scm/svn/SubversionManager.java
SubversionManager.revertWorkingCopy
public void revertWorkingCopy() throws IOException, InterruptedException { build.getWorkspace() .act(new RevertWorkingCopyCallable(getLocation(), getSvnAuthenticationProvider(build), buildListener)); }
java
public void revertWorkingCopy() throws IOException, InterruptedException { build.getWorkspace() .act(new RevertWorkingCopyCallable(getLocation(), getSvnAuthenticationProvider(build), buildListener)); }
[ "public", "void", "revertWorkingCopy", "(", ")", "throws", "IOException", ",", "InterruptedException", "{", "build", ".", "getWorkspace", "(", ")", ".", "act", "(", "new", "RevertWorkingCopyCallable", "(", "getLocation", "(", ")", ",", "getSvnAuthenticationProvider"...
Revert all the working copy changes.
[ "Revert", "all", "the", "working", "copy", "changes", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/scm/svn/SubversionManager.java#L81-L84
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/scm/svn/SubversionManager.java
SubversionManager.safeRevertWorkingCopy
public void safeRevertWorkingCopy() { try { revertWorkingCopy(); } catch (Exception e) { debuggingLogger.log(Level.FINE, "Failed to revert working copy", e); log("Failed to revert working copy: " + e.getLocalizedMessage()); Throwable cause = e.getCause(); if (!(cause instanceof SVNException)) { return; } SVNException svnException = (SVNException) cause; if (svnException.getErrorMessage().getErrorCode() == SVNErrorCode.WC_LOCKED) { // work space locked attempt cleanup and try to revert again try { cleanupWorkingCopy(); } catch (Exception unlockException) { debuggingLogger.log(Level.FINE, "Failed to cleanup working copy", e); log("Failed to cleanup working copy: " + e.getLocalizedMessage()); return; } try { revertWorkingCopy(); } catch (Exception revertException) { log("Failed to revert working copy on the 2nd attempt: " + e.getLocalizedMessage()); } } } }
java
public void safeRevertWorkingCopy() { try { revertWorkingCopy(); } catch (Exception e) { debuggingLogger.log(Level.FINE, "Failed to revert working copy", e); log("Failed to revert working copy: " + e.getLocalizedMessage()); Throwable cause = e.getCause(); if (!(cause instanceof SVNException)) { return; } SVNException svnException = (SVNException) cause; if (svnException.getErrorMessage().getErrorCode() == SVNErrorCode.WC_LOCKED) { // work space locked attempt cleanup and try to revert again try { cleanupWorkingCopy(); } catch (Exception unlockException) { debuggingLogger.log(Level.FINE, "Failed to cleanup working copy", e); log("Failed to cleanup working copy: " + e.getLocalizedMessage()); return; } try { revertWorkingCopy(); } catch (Exception revertException) { log("Failed to revert working copy on the 2nd attempt: " + e.getLocalizedMessage()); } } } }
[ "public", "void", "safeRevertWorkingCopy", "(", ")", "{", "try", "{", "revertWorkingCopy", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "debuggingLogger", ".", "log", "(", "Level", ".", "FINE", ",", "\"Failed to revert working copy\"", ",", ...
Attempts to revert the working copy. In case of failure it just logs the error.
[ "Attempts", "to", "revert", "the", "working", "copy", ".", "In", "case", "of", "failure", "it", "just", "logs", "the", "error", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/scm/svn/SubversionManager.java#L89-L117
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/IssuesTrackerHelper.java
IssuesTrackerHelper.setIssueTrackerInfo
public void setIssueTrackerInfo(BuildInfoBuilder builder) { Issues issues = new Issues(); issues.setAggregateBuildIssues(aggregateBuildIssues); issues.setAggregationBuildStatus(aggregationBuildStatus); issues.setTracker(new IssueTracker("JIRA", issueTrackerVersion)); Set<Issue> affectedIssuesSet = IssuesTrackerUtils.getAffectedIssuesSet(affectedIssues); if (!affectedIssuesSet.isEmpty()) { issues.setAffectedIssues(affectedIssuesSet); } builder.issues(issues); }
java
public void setIssueTrackerInfo(BuildInfoBuilder builder) { Issues issues = new Issues(); issues.setAggregateBuildIssues(aggregateBuildIssues); issues.setAggregationBuildStatus(aggregationBuildStatus); issues.setTracker(new IssueTracker("JIRA", issueTrackerVersion)); Set<Issue> affectedIssuesSet = IssuesTrackerUtils.getAffectedIssuesSet(affectedIssues); if (!affectedIssuesSet.isEmpty()) { issues.setAffectedIssues(affectedIssuesSet); } builder.issues(issues); }
[ "public", "void", "setIssueTrackerInfo", "(", "BuildInfoBuilder", "builder", ")", "{", "Issues", "issues", "=", "new", "Issues", "(", ")", ";", "issues", ".", "setAggregateBuildIssues", "(", "aggregateBuildIssues", ")", ";", "issues", ".", "setAggregationBuildStatus...
Apply issues tracker info to a build info builder (used by generic tasks and maven2 which doesn't use the extractor
[ "Apply", "issues", "tracker", "info", "to", "a", "build", "info", "builder", "(", "used", "by", "generic", "tasks", "and", "maven2", "which", "doesn", "t", "use", "the", "extractor" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/IssuesTrackerHelper.java#L103-L113
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/BuildRetentionFactory.java
BuildRetentionFactory.createBuildRetention
public static BuildRetention createBuildRetention(Run build, boolean discardOldArtifacts) { BuildRetention buildRetention = new BuildRetention(discardOldArtifacts); LogRotator rotator = null; BuildDiscarder buildDiscarder = build.getParent().getBuildDiscarder(); if (buildDiscarder != null && buildDiscarder instanceof LogRotator) { rotator = (LogRotator) buildDiscarder; } if (rotator == null) { return buildRetention; } if (rotator.getNumToKeep() > -1) { buildRetention.setCount(rotator.getNumToKeep()); } if (rotator.getDaysToKeep() > -1) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, -rotator.getDaysToKeep()); buildRetention.setMinimumBuildDate(new Date(calendar.getTimeInMillis())); } List<String> notToBeDeleted = ExtractorUtils.getBuildNumbersNotToBeDeleted(build); buildRetention.setBuildNumbersNotToBeDiscarded(notToBeDeleted); return buildRetention; }
java
public static BuildRetention createBuildRetention(Run build, boolean discardOldArtifacts) { BuildRetention buildRetention = new BuildRetention(discardOldArtifacts); LogRotator rotator = null; BuildDiscarder buildDiscarder = build.getParent().getBuildDiscarder(); if (buildDiscarder != null && buildDiscarder instanceof LogRotator) { rotator = (LogRotator) buildDiscarder; } if (rotator == null) { return buildRetention; } if (rotator.getNumToKeep() > -1) { buildRetention.setCount(rotator.getNumToKeep()); } if (rotator.getDaysToKeep() > -1) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, -rotator.getDaysToKeep()); buildRetention.setMinimumBuildDate(new Date(calendar.getTimeInMillis())); } List<String> notToBeDeleted = ExtractorUtils.getBuildNumbersNotToBeDeleted(build); buildRetention.setBuildNumbersNotToBeDiscarded(notToBeDeleted); return buildRetention; }
[ "public", "static", "BuildRetention", "createBuildRetention", "(", "Run", "build", ",", "boolean", "discardOldArtifacts", ")", "{", "BuildRetention", "buildRetention", "=", "new", "BuildRetention", "(", "discardOldArtifacts", ")", ";", "LogRotator", "rotator", "=", "n...
Create a Build retention object out of the build @param build The build to create the build retention out of @param discardOldArtifacts Flag whether to discard artifacts of those builds that are to be discarded. @return a new Build retention
[ "Create", "a", "Build", "retention", "object", "out", "of", "the", "build" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/BuildRetentionFactory.java#L24-L45
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java
DockerUtils.getImageIdFromTag
public static String getImageIdFromTag(String imageTag, String host) throws IOException { DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); return dockerClient.inspectImageCmd(imageTag).exec().getId(); } finally { closeQuietly(dockerClient); } }
java
public static String getImageIdFromTag(String imageTag, String host) throws IOException { DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); return dockerClient.inspectImageCmd(imageTag).exec().getId(); } finally { closeQuietly(dockerClient); } }
[ "public", "static", "String", "getImageIdFromTag", "(", "String", "imageTag", ",", "String", "host", ")", "throws", "IOException", "{", "DockerClient", "dockerClient", "=", "null", ";", "try", "{", "dockerClient", "=", "getDockerClient", "(", "host", ")", ";", ...
Get image Id from imageTag using DockerBuildInfoHelper client. @param imageTag @param host @return
[ "Get", "image", "Id", "from", "imageTag", "using", "DockerBuildInfoHelper", "client", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L34-L42
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java
DockerUtils.pushImage
public static void pushImage(String imageTag, String username, String password, String host) throws IOException { final AuthConfig authConfig = new AuthConfig(); authConfig.withUsername(username); authConfig.withPassword(password); DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); dockerClient.pushImageCmd(imageTag).withAuthConfig(authConfig).exec(new PushImageResultCallback()).awaitSuccess(); } finally { closeQuietly(dockerClient); } }
java
public static void pushImage(String imageTag, String username, String password, String host) throws IOException { final AuthConfig authConfig = new AuthConfig(); authConfig.withUsername(username); authConfig.withPassword(password); DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); dockerClient.pushImageCmd(imageTag).withAuthConfig(authConfig).exec(new PushImageResultCallback()).awaitSuccess(); } finally { closeQuietly(dockerClient); } }
[ "public", "static", "void", "pushImage", "(", "String", "imageTag", ",", "String", "username", ",", "String", "password", ",", "String", "host", ")", "throws", "IOException", "{", "final", "AuthConfig", "authConfig", "=", "new", "AuthConfig", "(", ")", ";", ...
Push docker image using the docker java client. @param imageTag @param username @param password @param host
[ "Push", "docker", "image", "using", "the", "docker", "java", "client", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L52-L64
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java
DockerUtils.pullImage
public static void pullImage(String imageTag, String username, String password, String host) throws IOException { final AuthConfig authConfig = new AuthConfig(); authConfig.withUsername(username); authConfig.withPassword(password); DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); dockerClient.pullImageCmd(imageTag).withAuthConfig(authConfig).exec(new PullImageResultCallback()).awaitSuccess(); } finally { closeQuietly(dockerClient); } }
java
public static void pullImage(String imageTag, String username, String password, String host) throws IOException { final AuthConfig authConfig = new AuthConfig(); authConfig.withUsername(username); authConfig.withPassword(password); DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); dockerClient.pullImageCmd(imageTag).withAuthConfig(authConfig).exec(new PullImageResultCallback()).awaitSuccess(); } finally { closeQuietly(dockerClient); } }
[ "public", "static", "void", "pullImage", "(", "String", "imageTag", ",", "String", "username", ",", "String", "password", ",", "String", "host", ")", "throws", "IOException", "{", "final", "AuthConfig", "authConfig", "=", "new", "AuthConfig", "(", ")", ";", ...
Pull docker image using the docker java client. @param imageTag @param username @param password @param host
[ "Pull", "docker", "image", "using", "the", "docker", "java", "client", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L74-L86
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java
DockerUtils.getParentId
public static String getParentId(String digest, String host) throws IOException { DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); return dockerClient.inspectImageCmd(digest).exec().getParent(); } finally { closeQuietly(dockerClient); } }
java
public static String getParentId(String digest, String host) throws IOException { DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); return dockerClient.inspectImageCmd(digest).exec().getParent(); } finally { closeQuietly(dockerClient); } }
[ "public", "static", "String", "getParentId", "(", "String", "digest", ",", "String", "host", ")", "throws", "IOException", "{", "DockerClient", "dockerClient", "=", "null", ";", "try", "{", "dockerClient", "=", "getDockerClient", "(", "host", ")", ";", "return...
Get parent digest of an image. @param digest @param host @return
[ "Get", "parent", "digest", "of", "an", "image", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L95-L103
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java
DockerUtils.getLayersDigests
public static List<String> getLayersDigests(String manifestContent) throws IOException { List<String> dockerLayersDependencies = new ArrayList<String>(); JsonNode manifest = Utils.mapper().readTree(manifestContent); JsonNode schemaVersion = manifest.get("schemaVersion"); if (schemaVersion == null) { throw new IllegalStateException("Could not find 'schemaVersion' in manifest"); } boolean isSchemeVersion1 = schemaVersion.asInt() == 1; JsonNode fsLayers = getFsLayers(manifest, isSchemeVersion1); for (JsonNode fsLayer : fsLayers) { JsonNode blobSum = getBlobSum(isSchemeVersion1, fsLayer); dockerLayersDependencies.add(blobSum.asText()); } dockerLayersDependencies.add(getConfigDigest(manifestContent)); //Add manifest sha1 String manifestSha1 = Hashing.sha1().hashString(manifestContent, Charsets.UTF_8).toString(); dockerLayersDependencies.add("sha1:" + manifestSha1); return dockerLayersDependencies; }
java
public static List<String> getLayersDigests(String manifestContent) throws IOException { List<String> dockerLayersDependencies = new ArrayList<String>(); JsonNode manifest = Utils.mapper().readTree(manifestContent); JsonNode schemaVersion = manifest.get("schemaVersion"); if (schemaVersion == null) { throw new IllegalStateException("Could not find 'schemaVersion' in manifest"); } boolean isSchemeVersion1 = schemaVersion.asInt() == 1; JsonNode fsLayers = getFsLayers(manifest, isSchemeVersion1); for (JsonNode fsLayer : fsLayers) { JsonNode blobSum = getBlobSum(isSchemeVersion1, fsLayer); dockerLayersDependencies.add(blobSum.asText()); } dockerLayersDependencies.add(getConfigDigest(manifestContent)); //Add manifest sha1 String manifestSha1 = Hashing.sha1().hashString(manifestContent, Charsets.UTF_8).toString(); dockerLayersDependencies.add("sha1:" + manifestSha1); return dockerLayersDependencies; }
[ "public", "static", "List", "<", "String", ">", "getLayersDigests", "(", "String", "manifestContent", ")", "throws", "IOException", "{", "List", "<", "String", ">", "dockerLayersDependencies", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "JsonNo...
Get a list of layer digests from docker manifest. @param manifestContent @return @throws IOException
[ "Get", "a", "list", "of", "layer", "digests", "from", "docker", "manifest", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L142-L164
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java
DockerUtils.digestToFileName
public static String digestToFileName(String digest) { if (StringUtils.startsWith(digest, "sha1")) { return "manifest.json"; } return getShaVersion(digest) + "__" + getShaValue(digest); }
java
public static String digestToFileName(String digest) { if (StringUtils.startsWith(digest, "sha1")) { return "manifest.json"; } return getShaVersion(digest) + "__" + getShaValue(digest); }
[ "public", "static", "String", "digestToFileName", "(", "String", "digest", ")", "{", "if", "(", "StringUtils", ".", "startsWith", "(", "digest", ",", "\"sha1\"", ")", ")", "{", "return", "\"manifest.json\"", ";", "}", "return", "getShaVersion", "(", "digest", ...
Digest format to layer file name. @param digest @return
[ "Digest", "format", "to", "layer", "file", "name", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L276-L281
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java
DockerUtils.getNumberOfDependentLayers
public static int getNumberOfDependentLayers(String imageContent) throws IOException { JsonNode history = Utils.mapper().readTree(imageContent).get("history"); if (history == null) { throw new IllegalStateException("Could not find 'history' tag"); } int layersNum = history.size(); boolean newImageLayers = true; for (int i = history.size() - 1; i >= 0; i--) { if (newImageLayers) { layersNum--; } JsonNode layer = history.get(i); JsonNode emptyLayer = layer.get("empty_layer"); if (!newImageLayers && emptyLayer != null) { layersNum--; } if (layer.get("created_by") == null) { continue; } String createdBy = layer.get("created_by").textValue(); if (createdBy.contains("ENTRYPOINT") || createdBy.contains("MAINTAINER")) { newImageLayers = false; } } return layersNum; }
java
public static int getNumberOfDependentLayers(String imageContent) throws IOException { JsonNode history = Utils.mapper().readTree(imageContent).get("history"); if (history == null) { throw new IllegalStateException("Could not find 'history' tag"); } int layersNum = history.size(); boolean newImageLayers = true; for (int i = history.size() - 1; i >= 0; i--) { if (newImageLayers) { layersNum--; } JsonNode layer = history.get(i); JsonNode emptyLayer = layer.get("empty_layer"); if (!newImageLayers && emptyLayer != null) { layersNum--; } if (layer.get("created_by") == null) { continue; } String createdBy = layer.get("created_by").textValue(); if (createdBy.contains("ENTRYPOINT") || createdBy.contains("MAINTAINER")) { newImageLayers = false; } } return layersNum; }
[ "public", "static", "int", "getNumberOfDependentLayers", "(", "String", "imageContent", ")", "throws", "IOException", "{", "JsonNode", "history", "=", "Utils", ".", "mapper", "(", ")", ".", "readTree", "(", "imageContent", ")", ".", "get", "(", "\"history\"", ...
Returns number of dependencies layers in the image. @param imageContent @return @throws IOException
[ "Returns", "number", "of", "dependencies", "layers", "in", "the", "image", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L290-L319
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java
MavenReleaseWrapper.getMavenModules
private List<String> getMavenModules(MavenModuleSetBuild mavenBuild) throws IOException, InterruptedException { FilePath pathToModuleRoot = mavenBuild.getModuleRoot(); FilePath pathToPom = new FilePath(pathToModuleRoot, mavenBuild.getProject().getRootPOM(null)); return pathToPom.act(new MavenModulesExtractor()); }
java
private List<String> getMavenModules(MavenModuleSetBuild mavenBuild) throws IOException, InterruptedException { FilePath pathToModuleRoot = mavenBuild.getModuleRoot(); FilePath pathToPom = new FilePath(pathToModuleRoot, mavenBuild.getProject().getRootPOM(null)); return pathToPom.act(new MavenModulesExtractor()); }
[ "private", "List", "<", "String", ">", "getMavenModules", "(", "MavenModuleSetBuild", "mavenBuild", ")", "throws", "IOException", ",", "InterruptedException", "{", "FilePath", "pathToModuleRoot", "=", "mavenBuild", ".", "getModuleRoot", "(", ")", ";", "FilePath", "p...
Retrieve from the parent pom the path to the modules of the project
[ "Retrieve", "from", "the", "parent", "pom", "the", "path", "to", "the", "modules", "of", "the", "project" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java#L238-L242
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java
MavenReleaseWrapper.getRelativePomPath
private String getRelativePomPath(MavenModule mavenModule, MavenModuleSetBuild mavenBuild) { String relativePath = mavenModule.getRelativePath(); if (StringUtils.isBlank(relativePath)) { return POM_NAME; } // If this is the root module, return the root pom path. if (mavenModule.getModuleName().toString(). equals(mavenBuild.getProject().getRootModule().getModuleName().toString())) { return mavenBuild.getProject().getRootPOM(null); } // to remove the project folder name if exists // keeps only the name of the module String modulePath = relativePath.substring(relativePath.indexOf("/") + 1); for (String moduleName : mavenModules) { if (moduleName.contains(modulePath)) { return createPomPath(relativePath, moduleName); } } // In case this module is not in the parent pom return relativePath + "/" + POM_NAME; }
java
private String getRelativePomPath(MavenModule mavenModule, MavenModuleSetBuild mavenBuild) { String relativePath = mavenModule.getRelativePath(); if (StringUtils.isBlank(relativePath)) { return POM_NAME; } // If this is the root module, return the root pom path. if (mavenModule.getModuleName().toString(). equals(mavenBuild.getProject().getRootModule().getModuleName().toString())) { return mavenBuild.getProject().getRootPOM(null); } // to remove the project folder name if exists // keeps only the name of the module String modulePath = relativePath.substring(relativePath.indexOf("/") + 1); for (String moduleName : mavenModules) { if (moduleName.contains(modulePath)) { return createPomPath(relativePath, moduleName); } } // In case this module is not in the parent pom return relativePath + "/" + POM_NAME; }
[ "private", "String", "getRelativePomPath", "(", "MavenModule", "mavenModule", ",", "MavenModuleSetBuild", "mavenBuild", ")", "{", "String", "relativePath", "=", "mavenModule", ".", "getRelativePath", "(", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "r...
Retrieve the relative path to the pom of the module
[ "Retrieve", "the", "relative", "path", "to", "the", "pom", "of", "the", "module" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java#L271-L294
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java
MavenReleaseWrapper.createPomPath
private String createPomPath(String relativePath, String moduleName) { if (!moduleName.contains(".xml")) { // Inside the parent pom, the reference is to the pom.xml file return relativePath + "/" + POM_NAME; } // There is a reference to another xml file, which is not the pom. String dirName = relativePath.substring(0, relativePath.indexOf("/")); return dirName + "/" + moduleName; }
java
private String createPomPath(String relativePath, String moduleName) { if (!moduleName.contains(".xml")) { // Inside the parent pom, the reference is to the pom.xml file return relativePath + "/" + POM_NAME; } // There is a reference to another xml file, which is not the pom. String dirName = relativePath.substring(0, relativePath.indexOf("/")); return dirName + "/" + moduleName; }
[ "private", "String", "createPomPath", "(", "String", "relativePath", ",", "String", "moduleName", ")", "{", "if", "(", "!", "moduleName", ".", "contains", "(", "\".xml\"", ")", ")", "{", "// Inside the parent pom, the reference is to the pom.xml file", "return", "rela...
Creates the actual path to the xml file of the module.
[ "Creates", "the", "actual", "path", "to", "the", "xml", "file", "of", "the", "module", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java#L299-L307
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/maven/MavenModulesExtractor.java
MavenModulesExtractor.invoke
public List<String> invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { MavenProject mavenProject = getMavenProject(f.getAbsolutePath()); return mavenProject.getModel().getModules(); }
java
public List<String> invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { MavenProject mavenProject = getMavenProject(f.getAbsolutePath()); return mavenProject.getModel().getModules(); }
[ "public", "List", "<", "String", ">", "invoke", "(", "File", "f", ",", "VirtualChannel", "channel", ")", "throws", "IOException", ",", "InterruptedException", "{", "MavenProject", "mavenProject", "=", "getMavenProject", "(", "f", ".", "getAbsolutePath", "(", ")"...
This is needed when running on slaves.
[ "This", "is", "needed", "when", "running", "on", "slaves", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/maven/MavenModulesExtractor.java#L21-L24
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/ExtractorUtils.java
ExtractorUtils.getVcsRevision
public static String getVcsRevision(Map<String, String> env) { String revision = env.get("SVN_REVISION"); if (StringUtils.isBlank(revision)) { revision = env.get(GIT_COMMIT); } if (StringUtils.isBlank(revision)) { revision = env.get("P4_CHANGELIST"); } return revision; }
java
public static String getVcsRevision(Map<String, String> env) { String revision = env.get("SVN_REVISION"); if (StringUtils.isBlank(revision)) { revision = env.get(GIT_COMMIT); } if (StringUtils.isBlank(revision)) { revision = env.get("P4_CHANGELIST"); } return revision; }
[ "public", "static", "String", "getVcsRevision", "(", "Map", "<", "String", ",", "String", ">", "env", ")", "{", "String", "revision", "=", "env", ".", "get", "(", "\"SVN_REVISION\"", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "revision", ")...
Get the VCS revision from the Jenkins build environment. The search will one of "SVN_REVISION", "GIT_COMMIT", "P4_CHANGELIST" in the environment. @param env Th Jenkins build environment. @return The vcs revision for supported VCS
[ "Get", "the", "VCS", "revision", "from", "the", "Jenkins", "build", "environment", ".", "The", "search", "will", "one", "of", "SVN_REVISION", "GIT_COMMIT", "P4_CHANGELIST", "in", "the", "environment", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/ExtractorUtils.java#L81-L90
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/ExtractorUtils.java
ExtractorUtils.getVcsUrl
public static String getVcsUrl(Map<String, String> env) { String url = env.get("SVN_URL"); if (StringUtils.isBlank(url)) { url = publicGitUrl(env.get("GIT_URL")); } if (StringUtils.isBlank(url)) { url = env.get("P4PORT"); } return url; }
java
public static String getVcsUrl(Map<String, String> env) { String url = env.get("SVN_URL"); if (StringUtils.isBlank(url)) { url = publicGitUrl(env.get("GIT_URL")); } if (StringUtils.isBlank(url)) { url = env.get("P4PORT"); } return url; }
[ "public", "static", "String", "getVcsUrl", "(", "Map", "<", "String", ",", "String", ">", "env", ")", "{", "String", "url", "=", "env", ".", "get", "(", "\"SVN_URL\"", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "url", ")", ")", "{", "...
Get the VCS url from the Jenkins build environment. The search will one of "SVN_REVISION", "GIT_COMMIT", "P4_CHANGELIST" in the environment. @param env Th Jenkins build environment. @return The vcs url for supported VCS
[ "Get", "the", "VCS", "url", "from", "the", "Jenkins", "build", "environment", ".", "The", "search", "will", "one", "of", "SVN_REVISION", "GIT_COMMIT", "P4_CHANGELIST", "in", "the", "environment", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/ExtractorUtils.java#L99-L108
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/ExtractorUtils.java
ExtractorUtils.daysBetween
private static long daysBetween(Date date1, Date date2) { long diff; if (date2.after(date1)) { diff = date2.getTime() - date1.getTime(); } else { diff = date1.getTime() - date2.getTime(); } return diff / (24 * 60 * 60 * 1000); }
java
private static long daysBetween(Date date1, Date date2) { long diff; if (date2.after(date1)) { diff = date2.getTime() - date1.getTime(); } else { diff = date1.getTime() - date2.getTime(); } return diff / (24 * 60 * 60 * 1000); }
[ "private", "static", "long", "daysBetween", "(", "Date", "date1", ",", "Date", "date2", ")", "{", "long", "diff", ";", "if", "(", "date2", ".", "after", "(", "date1", ")", ")", "{", "diff", "=", "date2", ".", "getTime", "(", ")", "-", "date1", ".",...
Naive implementation of the difference in days between two dates
[ "Naive", "implementation", "of", "the", "difference", "in", "days", "between", "two", "dates" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/ExtractorUtils.java#L394-L402
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/ExtractorUtils.java
ExtractorUtils.getBuildNumbersNotToBeDeleted
public static List<String> getBuildNumbersNotToBeDeleted(Run build) { List<String> notToDelete = Lists.newArrayList(); List<? extends Run<?, ?>> builds = build.getParent().getBuilds(); for (Run<?, ?> run : builds) { if (run.isKeepLog()) { notToDelete.add(String.valueOf(run.getNumber())); } } return notToDelete; }
java
public static List<String> getBuildNumbersNotToBeDeleted(Run build) { List<String> notToDelete = Lists.newArrayList(); List<? extends Run<?, ?>> builds = build.getParent().getBuilds(); for (Run<?, ?> run : builds) { if (run.isKeepLog()) { notToDelete.add(String.valueOf(run.getNumber())); } } return notToDelete; }
[ "public", "static", "List", "<", "String", ">", "getBuildNumbersNotToBeDeleted", "(", "Run", "build", ")", "{", "List", "<", "String", ">", "notToDelete", "=", "Lists", ".", "newArrayList", "(", ")", ";", "List", "<", "?", "extends", "Run", "<", "?", ","...
Get the list of build numbers that are to be kept forever.
[ "Get", "the", "list", "of", "build", "numbers", "that", "are", "to", "be", "kept", "forever", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/ExtractorUtils.java#L415-L424
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/ExtractorUtils.java
ExtractorUtils.entityToString
public static String entityToString(HttpEntity entity) throws IOException { if (entity != null) { InputStream is = entity.getContent(); return IOUtils.toString(is, "UTF-8"); } return ""; }
java
public static String entityToString(HttpEntity entity) throws IOException { if (entity != null) { InputStream is = entity.getContent(); return IOUtils.toString(is, "UTF-8"); } return ""; }
[ "public", "static", "String", "entityToString", "(", "HttpEntity", "entity", ")", "throws", "IOException", "{", "if", "(", "entity", "!=", "null", ")", "{", "InputStream", "is", "=", "entity", ".", "getContent", "(", ")", ";", "return", "IOUtils", ".", "to...
Converts the http entity to string. If entity is null, returns empty string. @param entity @return @throws IOException
[ "Converts", "the", "http", "entity", "to", "string", ".", "If", "entity", "is", "null", "returns", "empty", "string", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/ExtractorUtils.java#L555-L561
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/ExtractorUtils.java
ExtractorUtils.createAndGetTempDir
public static FilePath createAndGetTempDir(final FilePath ws) throws IOException, InterruptedException { // The token that combines the project name and unique number to create unique workspace directory. String workspaceList = System.getProperty("hudson.slaves.WorkspaceList"); return ws.act(new MasterToSlaveCallable<FilePath, IOException>() { @Override public FilePath call() { final FilePath tempDir = ws.sibling(ws.getName() + Objects.toString(workspaceList, "@") + "tmp").child("artifactory"); File tempDirFile = new File(tempDir.getRemote()); tempDirFile.mkdirs(); tempDirFile.deleteOnExit(); return tempDir; } }); }
java
public static FilePath createAndGetTempDir(final FilePath ws) throws IOException, InterruptedException { // The token that combines the project name and unique number to create unique workspace directory. String workspaceList = System.getProperty("hudson.slaves.WorkspaceList"); return ws.act(new MasterToSlaveCallable<FilePath, IOException>() { @Override public FilePath call() { final FilePath tempDir = ws.sibling(ws.getName() + Objects.toString(workspaceList, "@") + "tmp").child("artifactory"); File tempDirFile = new File(tempDir.getRemote()); tempDirFile.mkdirs(); tempDirFile.deleteOnExit(); return tempDir; } }); }
[ "public", "static", "FilePath", "createAndGetTempDir", "(", "final", "FilePath", "ws", ")", "throws", "IOException", ",", "InterruptedException", "{", "// The token that combines the project name and unique number to create unique workspace directory.", "String", "workspaceList", "...
Create a temporary directory under a given workspace
[ "Create", "a", "temporary", "directory", "under", "a", "given", "workspace" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/ExtractorUtils.java#L586-L599
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/maven2/MavenDependenciesRecorder.java
MavenDependenciesRecorder.postExecute
@Override public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener, Throwable error) { //listener.getLogger().println("[MavenDependenciesRecorder] mojo: " + mojo.getClass() + ":" + mojo.getGoal()); //listener.getLogger().println("[MavenDependenciesRecorder] dependencies: " + pom.getArtifacts()); recordMavenDependencies(pom.getArtifacts()); return true; }
java
@Override public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener, Throwable error) { //listener.getLogger().println("[MavenDependenciesRecorder] mojo: " + mojo.getClass() + ":" + mojo.getGoal()); //listener.getLogger().println("[MavenDependenciesRecorder] dependencies: " + pom.getArtifacts()); recordMavenDependencies(pom.getArtifacts()); return true; }
[ "@", "Override", "public", "boolean", "postExecute", "(", "MavenBuildProxy", "build", ",", "MavenProject", "pom", ",", "MojoInfo", "mojo", ",", "BuildListener", "listener", ",", "Throwable", "error", ")", "{", "//listener.getLogger().println(\"[MavenDependenciesRecorder] ...
Mojos perform different dependency resolution, so we add dependencies for each mojo.
[ "Mojos", "perform", "different", "dependency", "resolution", "so", "we", "add", "dependencies", "for", "each", "mojo", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/maven2/MavenDependenciesRecorder.java#L54-L61
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/maven2/MavenDependenciesRecorder.java
MavenDependenciesRecorder.postBuild
@Override public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener) throws InterruptedException, IOException { build.executeAsync(new BuildCallable<Void, IOException>() { // record is transient, so needs to make a copy first private final Set<MavenDependency> d = dependencies; public Void call(MavenBuild build) throws IOException, InterruptedException { // add the action //TODO: [by yl] These actions are persisted into the build.xml of each build run - we need another //context to store these actions build.getActions().add(new MavenDependenciesRecord(build, d)); return null; } }); return true; }
java
@Override public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener) throws InterruptedException, IOException { build.executeAsync(new BuildCallable<Void, IOException>() { // record is transient, so needs to make a copy first private final Set<MavenDependency> d = dependencies; public Void call(MavenBuild build) throws IOException, InterruptedException { // add the action //TODO: [by yl] These actions are persisted into the build.xml of each build run - we need another //context to store these actions build.getActions().add(new MavenDependenciesRecord(build, d)); return null; } }); return true; }
[ "@", "Override", "public", "boolean", "postBuild", "(", "MavenBuildProxy", "build", ",", "MavenProject", "pom", ",", "BuildListener", "listener", ")", "throws", "InterruptedException", ",", "IOException", "{", "build", ".", "executeAsync", "(", "new", "BuildCallable...
Sends the collected dependencies over to the master and record them.
[ "Sends", "the", "collected", "dependencies", "over", "to", "the", "master", "and", "record", "them", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/maven2/MavenDependenciesRecorder.java#L66-L82
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/CredentialManager.java
CredentialManager.getPreferredDeployer
public static CredentialsConfig getPreferredDeployer(DeployerOverrider deployerOverrider, ArtifactoryServer server) { if (deployerOverrider.isOverridingDefaultDeployer()) { CredentialsConfig deployerCredentialsConfig = deployerOverrider.getDeployerCredentialsConfig(); if (deployerCredentialsConfig != null) { return deployerCredentialsConfig; } } if (server != null) { CredentialsConfig deployerCredentials = server.getDeployerCredentialsConfig(); if (deployerCredentials != null) { return deployerCredentials; } } return CredentialsConfig.EMPTY_CREDENTIALS_CONFIG; }
java
public static CredentialsConfig getPreferredDeployer(DeployerOverrider deployerOverrider, ArtifactoryServer server) { if (deployerOverrider.isOverridingDefaultDeployer()) { CredentialsConfig deployerCredentialsConfig = deployerOverrider.getDeployerCredentialsConfig(); if (deployerCredentialsConfig != null) { return deployerCredentialsConfig; } } if (server != null) { CredentialsConfig deployerCredentials = server.getDeployerCredentialsConfig(); if (deployerCredentials != null) { return deployerCredentials; } } return CredentialsConfig.EMPTY_CREDENTIALS_CONFIG; }
[ "public", "static", "CredentialsConfig", "getPreferredDeployer", "(", "DeployerOverrider", "deployerOverrider", ",", "ArtifactoryServer", "server", ")", "{", "if", "(", "deployerOverrider", ".", "isOverridingDefaultDeployer", "(", ")", ")", "{", "CredentialsConfig", "depl...
Decides and returns the preferred deployment credentials to use from this builder settings and selected server @param deployerOverrider Deploy-overriding capable builder @param server Selected Artifactory server @return Preferred deployment credentials
[ "Decides", "and", "returns", "the", "preferred", "deployment", "credentials", "to", "use", "from", "this", "builder", "settings", "and", "selected", "server" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/CredentialManager.java#L41-L57
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/maven3/Maven3Builder.java
Maven3Builder.perform
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { listener.getLogger().println("Jenkins Artifactory Plugin version: " + ActionableHelper.getArtifactoryPluginVersion()); EnvVars env = build.getEnvironment(listener); FilePath workDir = build.getModuleRoot(); FilePath ws = build.getWorkspace(); FilePath mavenHome = getMavenHome(listener, env, launcher); if (!mavenHome.exists()) { listener.error("Couldn't find Maven home: " + mavenHome.getRemote()); throw new Run.RunnerAbortedException(); } ArgumentListBuilder cmdLine = buildMavenCmdLine(build, listener, env, launcher, mavenHome, ws, ws); String[] cmds = cmdLine.toCommandArray(); return RunMaven(build, launcher, listener, env, workDir, cmds); }
java
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { listener.getLogger().println("Jenkins Artifactory Plugin version: " + ActionableHelper.getArtifactoryPluginVersion()); EnvVars env = build.getEnvironment(listener); FilePath workDir = build.getModuleRoot(); FilePath ws = build.getWorkspace(); FilePath mavenHome = getMavenHome(listener, env, launcher); if (!mavenHome.exists()) { listener.error("Couldn't find Maven home: " + mavenHome.getRemote()); throw new Run.RunnerAbortedException(); } ArgumentListBuilder cmdLine = buildMavenCmdLine(build, listener, env, launcher, mavenHome, ws, ws); String[] cmds = cmdLine.toCommandArray(); return RunMaven(build, launcher, listener, env, workDir, cmds); }
[ "@", "Override", "public", "boolean", "perform", "(", "AbstractBuild", "<", "?", ",", "?", ">", "build", ",", "Launcher", "launcher", ",", "BuildListener", "listener", ")", "throws", "InterruptedException", ",", "IOException", "{", "listener", ".", "getLogger", ...
Used by FreeStyle Maven jobs only
[ "Used", "by", "FreeStyle", "Maven", "jobs", "only" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/maven3/Maven3Builder.java#L81-L97
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/maven3/Maven3Builder.java
Maven3Builder.perform
public boolean perform(Run<?, ?> build, Launcher launcher, TaskListener listener, EnvVars env, FilePath workDir, FilePath tempDir) throws InterruptedException, IOException { listener.getLogger().println("Jenkins Artifactory Plugin version: " + ActionableHelper.getArtifactoryPluginVersion()); FilePath mavenHome = getMavenHome(listener, env, launcher); if (!mavenHome.exists()) { listener.getLogger().println("Couldn't find Maven home at " + mavenHome.getRemote() + " on agent " + Utils.getAgentName(workDir) + ". This could be because this build is running inside a Docker container."); } ArgumentListBuilder cmdLine = buildMavenCmdLine(build, listener, env, launcher, mavenHome, workDir, tempDir); String[] cmds = cmdLine.toCommandArray(); return RunMaven(build, launcher, listener, env, workDir, cmds); }
java
public boolean perform(Run<?, ?> build, Launcher launcher, TaskListener listener, EnvVars env, FilePath workDir, FilePath tempDir) throws InterruptedException, IOException { listener.getLogger().println("Jenkins Artifactory Plugin version: " + ActionableHelper.getArtifactoryPluginVersion()); FilePath mavenHome = getMavenHome(listener, env, launcher); if (!mavenHome.exists()) { listener.getLogger().println("Couldn't find Maven home at " + mavenHome.getRemote() + " on agent " + Utils.getAgentName(workDir) + ". This could be because this build is running inside a Docker container."); } ArgumentListBuilder cmdLine = buildMavenCmdLine(build, listener, env, launcher, mavenHome, workDir, tempDir); String[] cmds = cmdLine.toCommandArray(); return RunMaven(build, launcher, listener, env, workDir, cmds); }
[ "public", "boolean", "perform", "(", "Run", "<", "?", ",", "?", ">", "build", ",", "Launcher", "launcher", ",", "TaskListener", "listener", ",", "EnvVars", "env", ",", "FilePath", "workDir", ",", "FilePath", "tempDir", ")", "throws", "InterruptedException", ...
Used by Pipeline jobs only
[ "Used", "by", "Pipeline", "jobs", "only" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/maven3/Maven3Builder.java#L100-L112
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/maven3/Maven3Builder.java
Maven3Builder.copyClassWorldsFile
private FilePath copyClassWorldsFile(FilePath ws, URL resource) { try { FilePath remoteClassworlds = ws.createTextTempFile("classworlds", "conf", ""); remoteClassworlds.copyFrom(resource); return remoteClassworlds; } catch (Exception e) { throw new RuntimeException(e); } }
java
private FilePath copyClassWorldsFile(FilePath ws, URL resource) { try { FilePath remoteClassworlds = ws.createTextTempFile("classworlds", "conf", ""); remoteClassworlds.copyFrom(resource); return remoteClassworlds; } catch (Exception e) { throw new RuntimeException(e); } }
[ "private", "FilePath", "copyClassWorldsFile", "(", "FilePath", "ws", ",", "URL", "resource", ")", "{", "try", "{", "FilePath", "remoteClassworlds", "=", "ws", ".", "createTextTempFile", "(", "\"classworlds\"", ",", "\"conf\"", ",", "\"\"", ")", ";", "remoteClass...
Copies a classworlds file to a temporary location either on the local filesystem or on a slave depending on the node type. @return The path of the classworlds.conf file
[ "Copies", "a", "classworlds", "file", "to", "a", "temporary", "location", "either", "on", "the", "local", "filesystem", "or", "on", "a", "slave", "depending", "on", "the", "node", "type", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/maven3/Maven3Builder.java#L284-L293
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/action/ActionableHelper.java
ActionableHelper.getPublisher
public static <T extends Publisher> T getPublisher(AbstractProject<?, ?> project, Class<T> type) { // Search for a publisher of the given type in the project and return it if found: T publisher = new PublisherFindImpl<T>().find(project, type); if (publisher != null) { return publisher; } // If not found, the publisher might be wrapped by a "Flexible Publish" publisher. The below searches for it inside the // Flexible Publisher: publisher = new PublisherFlexible<T>().find(project, type); return publisher; }
java
public static <T extends Publisher> T getPublisher(AbstractProject<?, ?> project, Class<T> type) { // Search for a publisher of the given type in the project and return it if found: T publisher = new PublisherFindImpl<T>().find(project, type); if (publisher != null) { return publisher; } // If not found, the publisher might be wrapped by a "Flexible Publish" publisher. The below searches for it inside the // Flexible Publisher: publisher = new PublisherFlexible<T>().find(project, type); return publisher; }
[ "public", "static", "<", "T", "extends", "Publisher", ">", "T", "getPublisher", "(", "AbstractProject", "<", "?", ",", "?", ">", "project", ",", "Class", "<", "T", ">", "type", ")", "{", "// Search for a publisher of the given type in the project and return it if fo...
Search for a publisher of the given type in a project and return it, or null if it is not found. @return The publisher
[ "Search", "for", "a", "publisher", "of", "the", "given", "type", "in", "a", "project", "and", "return", "it", "or", "null", "if", "it", "is", "not", "found", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/action/ActionableHelper.java#L80-L90
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/action/ActionableHelper.java
ActionableHelper.getArtifactoryPluginVersion
public static String getArtifactoryPluginVersion() { String pluginsSortName = "artifactory"; //Validates Jenkins existence because in some jobs the Jenkins instance is unreachable if (Jenkins.getInstance() != null && Jenkins.getInstance().getPlugin(pluginsSortName) != null && Jenkins.getInstance().getPlugin(pluginsSortName).getWrapper() != null) { return Jenkins.getInstance().getPlugin(pluginsSortName).getWrapper().getVersion(); } return ""; }
java
public static String getArtifactoryPluginVersion() { String pluginsSortName = "artifactory"; //Validates Jenkins existence because in some jobs the Jenkins instance is unreachable if (Jenkins.getInstance() != null && Jenkins.getInstance().getPlugin(pluginsSortName) != null && Jenkins.getInstance().getPlugin(pluginsSortName).getWrapper() != null) { return Jenkins.getInstance().getPlugin(pluginsSortName).getWrapper().getVersion(); } return ""; }
[ "public", "static", "String", "getArtifactoryPluginVersion", "(", ")", "{", "String", "pluginsSortName", "=", "\"artifactory\"", ";", "//Validates Jenkins existence because in some jobs the Jenkins instance is unreachable", "if", "(", "Jenkins", ".", "getInstance", "(", ")", ...
Returns the version of Jenkins Artifactory Plugin or empty string if not found @return the version of Jenkins Artifactory Plugin or empty string if not found
[ "Returns", "the", "version", "of", "Jenkins", "Artifactory", "Plugin", "or", "empty", "string", "if", "not", "found" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/action/ActionableHelper.java#L250-L259
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/action/ActionableHelper.java
ActionableHelper.deleteFilePath
public static void deleteFilePath(FilePath workspace, String path) throws IOException { if (StringUtils.isNotBlank(path)) { try { FilePath propertiesFile = new FilePath(workspace, path); propertiesFile.delete(); } catch (Exception e) { throw new IOException("Could not delete temp file: " + path); } } }
java
public static void deleteFilePath(FilePath workspace, String path) throws IOException { if (StringUtils.isNotBlank(path)) { try { FilePath propertiesFile = new FilePath(workspace, path); propertiesFile.delete(); } catch (Exception e) { throw new IOException("Could not delete temp file: " + path); } } }
[ "public", "static", "void", "deleteFilePath", "(", "FilePath", "workspace", ",", "String", "path", ")", "throws", "IOException", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "path", ")", ")", "{", "try", "{", "FilePath", "propertiesFile", "=", "new...
Deletes a FilePath file. @param workspace The build workspace. @param path The path in the workspace. @throws IOException In case of missing file.
[ "Deletes", "a", "FilePath", "file", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/action/ActionableHelper.java#L277-L286
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/scm/git/GitManager.java
GitManager.getRemoteUrl
public String getRemoteUrl(String defaultRemoteUrl) { if (StringUtils.isBlank(defaultRemoteUrl)) { RemoteConfig remoteConfig = getJenkinsScm().getRepositories().get(0); URIish uri = remoteConfig.getURIs().get(0); return uri.toPrivateString(); } return defaultRemoteUrl; }
java
public String getRemoteUrl(String defaultRemoteUrl) { if (StringUtils.isBlank(defaultRemoteUrl)) { RemoteConfig remoteConfig = getJenkinsScm().getRepositories().get(0); URIish uri = remoteConfig.getURIs().get(0); return uri.toPrivateString(); } return defaultRemoteUrl; }
[ "public", "String", "getRemoteUrl", "(", "String", "defaultRemoteUrl", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "defaultRemoteUrl", ")", ")", "{", "RemoteConfig", "remoteConfig", "=", "getJenkinsScm", "(", ")", ".", "getRepositories", "(", ")", ...
This method is currently in use only by the SvnCoordinator
[ "This", "method", "is", "currently", "in", "use", "only", "by", "the", "SvnCoordinator" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/scm/git/GitManager.java#L185-L193
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/RepositoryConf.java
RepositoryConf.getRepoKey
public String getRepoKey() { String repoKey; if (isDynamicMode()) { repoKey = keyFromText; } else { repoKey = keyFromSelect; } return repoKey; }
java
public String getRepoKey() { String repoKey; if (isDynamicMode()) { repoKey = keyFromText; } else { repoKey = keyFromSelect; } return repoKey; }
[ "public", "String", "getRepoKey", "(", ")", "{", "String", "repoKey", ";", "if", "(", "isDynamicMode", "(", ")", ")", "{", "repoKey", "=", "keyFromText", ";", "}", "else", "{", "repoKey", "=", "keyFromSelect", ";", "}", "return", "repoKey", ";", "}" ]
Used to get the current repository key @return keyFromText or keyFromSelect reflected by the dynamicMode flag
[ "Used", "to", "get", "the", "current", "repository", "key" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/RepositoryConf.java#L34-L42
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/types/buildInfo/Env.java
Env.collectVariables
public void collectVariables(EnvVars env, Run build, TaskListener listener) { EnvVars buildParameters = Utils.extractBuildParameters(build, listener); if (buildParameters != null) { env.putAll(buildParameters); } addAllWithFilter(envVars, env, filter.getPatternFilter()); Map<String, String> sysEnv = new HashMap<>(); Properties systemProperties = System.getProperties(); Enumeration<?> enumeration = systemProperties.propertyNames(); while (enumeration.hasMoreElements()) { String propertyKey = (String) enumeration.nextElement(); sysEnv.put(propertyKey, systemProperties.getProperty(propertyKey)); } addAllWithFilter(sysVars, sysEnv, filter.getPatternFilter()); }
java
public void collectVariables(EnvVars env, Run build, TaskListener listener) { EnvVars buildParameters = Utils.extractBuildParameters(build, listener); if (buildParameters != null) { env.putAll(buildParameters); } addAllWithFilter(envVars, env, filter.getPatternFilter()); Map<String, String> sysEnv = new HashMap<>(); Properties systemProperties = System.getProperties(); Enumeration<?> enumeration = systemProperties.propertyNames(); while (enumeration.hasMoreElements()) { String propertyKey = (String) enumeration.nextElement(); sysEnv.put(propertyKey, systemProperties.getProperty(propertyKey)); } addAllWithFilter(sysVars, sysEnv, filter.getPatternFilter()); }
[ "public", "void", "collectVariables", "(", "EnvVars", "env", ",", "Run", "build", ",", "TaskListener", "listener", ")", "{", "EnvVars", "buildParameters", "=", "Utils", ".", "extractBuildParameters", "(", "build", ",", "listener", ")", ";", "if", "(", "buildPa...
Collect environment variables and system properties under with filter constrains
[ "Collect", "environment", "variables", "and", "system", "properties", "under", "with", "filter", "constrains" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/types/buildInfo/Env.java#L36-L50
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/types/buildInfo/Env.java
Env.append
protected void append(Env env) { addAllWithFilter(this.envVars, env.envVars, filter.getPatternFilter()); addAllWithFilter(this.sysVars, env.sysVars, filter.getPatternFilter()); }
java
protected void append(Env env) { addAllWithFilter(this.envVars, env.envVars, filter.getPatternFilter()); addAllWithFilter(this.sysVars, env.sysVars, filter.getPatternFilter()); }
[ "protected", "void", "append", "(", "Env", "env", ")", "{", "addAllWithFilter", "(", "this", ".", "envVars", ",", "env", ".", "envVars", ",", "filter", ".", "getPatternFilter", "(", ")", ")", ";", "addAllWithFilter", "(", "this", ".", "sysVars", ",", "en...
Append environment variables and system properties from othre PipelineEvn object
[ "Append", "environment", "variables", "and", "system", "properties", "from", "othre", "PipelineEvn", "object" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/types/buildInfo/Env.java#L55-L58
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/types/buildInfo/Env.java
Env.addAllWithFilter
private void addAllWithFilter(Map<String, String> toMap, Map<String, String> fromMap, IncludeExcludePatterns pattern) { for (Object o : fromMap.entrySet()) { Map.Entry entry = (Map.Entry) o; String key = (String) entry.getKey(); if (PatternMatcher.pathConflicts(key, pattern)) { continue; } toMap.put(key, (String) entry.getValue()); } }
java
private void addAllWithFilter(Map<String, String> toMap, Map<String, String> fromMap, IncludeExcludePatterns pattern) { for (Object o : fromMap.entrySet()) { Map.Entry entry = (Map.Entry) o; String key = (String) entry.getKey(); if (PatternMatcher.pathConflicts(key, pattern)) { continue; } toMap.put(key, (String) entry.getValue()); } }
[ "private", "void", "addAllWithFilter", "(", "Map", "<", "String", ",", "String", ">", "toMap", ",", "Map", "<", "String", ",", "String", ">", "fromMap", ",", "IncludeExcludePatterns", "pattern", ")", "{", "for", "(", "Object", "o", ":", "fromMap", ".", "...
Adds all pairs from 'fromMap' to 'toMap' excluding once that matching the pattern
[ "Adds", "all", "pairs", "from", "fromMap", "to", "toMap", "excluding", "once", "that", "matching", "the", "pattern" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/types/buildInfo/Env.java#L63-L72
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java
DeployerResolverOverriderConverter.credentialsMigration
public void credentialsMigration(T overrider, Class overriderClass) { try { deployerMigration(overrider, overriderClass); resolverMigration(overrider, overriderClass); } catch (NoSuchFieldException | IllegalAccessException | IOException e) { converterErrors.add(getConversionErrorMessage(overrider, e)); } }
java
public void credentialsMigration(T overrider, Class overriderClass) { try { deployerMigration(overrider, overriderClass); resolverMigration(overrider, overriderClass); } catch (NoSuchFieldException | IllegalAccessException | IOException e) { converterErrors.add(getConversionErrorMessage(overrider, e)); } }
[ "public", "void", "credentialsMigration", "(", "T", "overrider", ",", "Class", "overriderClass", ")", "{", "try", "{", "deployerMigration", "(", "overrider", ",", "overriderClass", ")", ";", "resolverMigration", "(", "overrider", ",", "overriderClass", ")", ";", ...
Migrate to Jenkins "Credentials" plugin from the old credential implementation
[ "Migrate", "to", "Jenkins", "Credentials", "plugin", "from", "the", "old", "credential", "implementation" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java#L72-L79
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java
DeployerResolverOverriderConverter.createInitialResolveDetailsFromDeployDetails
private ServerDetails createInitialResolveDetailsFromDeployDetails(ServerDetails deployerDetails) { RepositoryConf oldResolveRepositoryConfig = deployerDetails.getResolveReleaseRepository(); RepositoryConf oldSnapshotResolveRepositoryConfig = deployerDetails.getResolveSnapshotRepository(); RepositoryConf resolverReleaseRepos = oldResolveRepositoryConfig == null ? RepositoryConf.emptyRepositoryConfig : oldResolveRepositoryConfig; RepositoryConf resolveSnapshotRepos = oldSnapshotResolveRepositoryConfig == null ? RepositoryConf.emptyRepositoryConfig : oldSnapshotResolveRepositoryConfig; return new ServerDetails(deployerDetails.getArtifactoryName(), deployerDetails.getArtifactoryUrl(), null, null, resolverReleaseRepos, resolveSnapshotRepos, null, null); }
java
private ServerDetails createInitialResolveDetailsFromDeployDetails(ServerDetails deployerDetails) { RepositoryConf oldResolveRepositoryConfig = deployerDetails.getResolveReleaseRepository(); RepositoryConf oldSnapshotResolveRepositoryConfig = deployerDetails.getResolveSnapshotRepository(); RepositoryConf resolverReleaseRepos = oldResolveRepositoryConfig == null ? RepositoryConf.emptyRepositoryConfig : oldResolveRepositoryConfig; RepositoryConf resolveSnapshotRepos = oldSnapshotResolveRepositoryConfig == null ? RepositoryConf.emptyRepositoryConfig : oldSnapshotResolveRepositoryConfig; return new ServerDetails(deployerDetails.getArtifactoryName(), deployerDetails.getArtifactoryUrl(), null, null, resolverReleaseRepos, resolveSnapshotRepos, null, null); }
[ "private", "ServerDetails", "createInitialResolveDetailsFromDeployDetails", "(", "ServerDetails", "deployerDetails", ")", "{", "RepositoryConf", "oldResolveRepositoryConfig", "=", "deployerDetails", ".", "getResolveReleaseRepository", "(", ")", ";", "RepositoryConf", "oldSnapshot...
Creates a new ServerDetails object for resolver, this will take URL and name from the deployer ServerDetails as a default behaviour
[ "Creates", "a", "new", "ServerDetails", "object", "for", "resolver", "this", "will", "take", "URL", "and", "name", "from", "the", "deployer", "ServerDetails", "as", "a", "default", "behaviour" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java#L181-L188
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java
DeployerResolverOverriderConverter.createInitialDeployDetailsFromOldDeployDetails
private ServerDetails createInitialDeployDetailsFromOldDeployDetails(ServerDetails oldDeployerDetails) { RepositoryConf oldDeployRepositoryConfig = oldDeployerDetails.getDeployReleaseRepository(); RepositoryConf oldSnapshotDeployRepositoryConfig = oldDeployerDetails.getDeploySnapshotRepository(); RepositoryConf deployReleaseRepos = oldDeployRepositoryConfig == null ? RepositoryConf.emptyRepositoryConfig : oldDeployRepositoryConfig; RepositoryConf deploySnapshotRepos = oldSnapshotDeployRepositoryConfig == null ? RepositoryConf.emptyRepositoryConfig : oldSnapshotDeployRepositoryConfig; return new ServerDetails(oldDeployerDetails.getArtifactoryName(), oldDeployerDetails.getArtifactoryUrl(), deployReleaseRepos, deploySnapshotRepos, null, null, null, null); }
java
private ServerDetails createInitialDeployDetailsFromOldDeployDetails(ServerDetails oldDeployerDetails) { RepositoryConf oldDeployRepositoryConfig = oldDeployerDetails.getDeployReleaseRepository(); RepositoryConf oldSnapshotDeployRepositoryConfig = oldDeployerDetails.getDeploySnapshotRepository(); RepositoryConf deployReleaseRepos = oldDeployRepositoryConfig == null ? RepositoryConf.emptyRepositoryConfig : oldDeployRepositoryConfig; RepositoryConf deploySnapshotRepos = oldSnapshotDeployRepositoryConfig == null ? RepositoryConf.emptyRepositoryConfig : oldSnapshotDeployRepositoryConfig; return new ServerDetails(oldDeployerDetails.getArtifactoryName(), oldDeployerDetails.getArtifactoryUrl(), deployReleaseRepos, deploySnapshotRepos, null, null, null, null); }
[ "private", "ServerDetails", "createInitialDeployDetailsFromOldDeployDetails", "(", "ServerDetails", "oldDeployerDetails", ")", "{", "RepositoryConf", "oldDeployRepositoryConfig", "=", "oldDeployerDetails", ".", "getDeployReleaseRepository", "(", ")", ";", "RepositoryConf", "oldSn...
Creates a new ServerDetails object for deployer, this will take URL and name from the oldDeployer ServerDetails
[ "Creates", "a", "new", "ServerDetails", "object", "for", "deployer", "this", "will", "take", "URL", "and", "name", "from", "the", "oldDeployer", "ServerDetails" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java#L193-L200
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/PropertyUtils.java
PropertyUtils.loadGradleProperties
private static Properties loadGradleProperties(FilePath gradlePropertiesFilePath) throws IOException, InterruptedException { return gradlePropertiesFilePath.act(new MasterToSlaveFileCallable<Properties>() { public Properties invoke(File gradlePropertiesFile, VirtualChannel channel) throws IOException, InterruptedException { Properties gradleProps = new Properties(); if (gradlePropertiesFile.exists()) { debuggingLogger.fine("Gradle properties file exists at: " + gradlePropertiesFile.getAbsolutePath()); FileInputStream stream = null; try { stream = new FileInputStream(gradlePropertiesFile); gradleProps.load(stream); } catch (IOException e) { debuggingLogger.fine("IO exception occurred while trying to read properties file from: " + gradlePropertiesFile.getAbsolutePath()); throw new RuntimeException(e); } finally { IOUtils.closeQuietly(stream); } } return gradleProps; } }); }
java
private static Properties loadGradleProperties(FilePath gradlePropertiesFilePath) throws IOException, InterruptedException { return gradlePropertiesFilePath.act(new MasterToSlaveFileCallable<Properties>() { public Properties invoke(File gradlePropertiesFile, VirtualChannel channel) throws IOException, InterruptedException { Properties gradleProps = new Properties(); if (gradlePropertiesFile.exists()) { debuggingLogger.fine("Gradle properties file exists at: " + gradlePropertiesFile.getAbsolutePath()); FileInputStream stream = null; try { stream = new FileInputStream(gradlePropertiesFile); gradleProps.load(stream); } catch (IOException e) { debuggingLogger.fine("IO exception occurred while trying to read properties file from: " + gradlePropertiesFile.getAbsolutePath()); throw new RuntimeException(e); } finally { IOUtils.closeQuietly(stream); } } return gradleProps; } }); }
[ "private", "static", "Properties", "loadGradleProperties", "(", "FilePath", "gradlePropertiesFilePath", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "gradlePropertiesFilePath", ".", "act", "(", "new", "MasterToSlaveFileCallable", "<", "Propertie...
Load a properties file from a file path @param gradlePropertiesFilePath The file path where the gradle.properties is located. @return The loaded properties. @throws IOException In case an error occurs while reading the properties file, this exception is thrown.
[ "Load", "a", "properties", "file", "from", "a", "file", "path" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/PropertyUtils.java#L81-L104
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/DockerImage.java
DockerImage.generateBuildInfoModule
public Module generateBuildInfoModule(Run build, TaskListener listener, ArtifactoryConfigurator config, String buildName, String buildNumber, String timestamp) throws IOException { if (artifactsProps == null) { artifactsProps = ArrayListMultimap.create(); } artifactsProps.put("build.name", buildName); artifactsProps.put("build.number", buildNumber); artifactsProps.put("build.timestamp", timestamp); String artifactsPropsStr = ExtractorUtils.buildPropertiesString(artifactsProps); Properties buildInfoItemsProps = new Properties(); buildInfoItemsProps.setProperty("build.name", buildName); buildInfoItemsProps.setProperty("build.number", buildNumber); buildInfoItemsProps.setProperty("build.timestamp", timestamp); ArtifactoryServer server = config.getArtifactoryServer(); CredentialsConfig preferredResolver = server.getDeployerCredentialsConfig(); ArtifactoryDependenciesClient dependenciesClient = null; ArtifactoryBuildInfoClient propertyChangeClient = null; try { dependenciesClient = server.createArtifactoryDependenciesClient( preferredResolver.provideUsername(build.getParent()), preferredResolver.providePassword(build.getParent()), server.createProxyConfiguration(Jenkins.getInstance().proxy), listener); CredentialsConfig preferredDeployer = CredentialManager.getPreferredDeployer(config, server); propertyChangeClient = server.createArtifactoryClient( preferredDeployer.provideUsername(build.getParent()), preferredDeployer.providePassword(build.getParent()), server.createProxyConfiguration(Jenkins.getInstance().proxy)); Module buildInfoModule = new Module(); buildInfoModule.setId(imageTag.substring(imageTag.indexOf("/") + 1)); // If manifest and imagePath not found, return. if ((StringUtils.isEmpty(manifest) || StringUtils.isEmpty(imagePath)) && !findAndSetManifestFromArtifactory(server, dependenciesClient, listener)) { return buildInfoModule; } listener.getLogger().println("Fetching details of published docker layers from Artifactory..."); boolean includeVirtualReposSupported = propertyChangeClient.getArtifactoryVersion().isAtLeast(VIRTUAL_REPOS_SUPPORTED_VERSION); DockerLayers layers = createLayers(dependenciesClient, includeVirtualReposSupported); listener.getLogger().println("Tagging published docker layers with build properties in Artifactory..."); setDependenciesAndArtifacts(buildInfoModule, layers, artifactsPropsStr, buildInfoItemsProps, dependenciesClient, propertyChangeClient, server); setBuildInfoModuleProps(buildInfoModule); return buildInfoModule; } finally { if (dependenciesClient != null) { dependenciesClient.close(); } if (propertyChangeClient != null) { propertyChangeClient.close(); } } }
java
public Module generateBuildInfoModule(Run build, TaskListener listener, ArtifactoryConfigurator config, String buildName, String buildNumber, String timestamp) throws IOException { if (artifactsProps == null) { artifactsProps = ArrayListMultimap.create(); } artifactsProps.put("build.name", buildName); artifactsProps.put("build.number", buildNumber); artifactsProps.put("build.timestamp", timestamp); String artifactsPropsStr = ExtractorUtils.buildPropertiesString(artifactsProps); Properties buildInfoItemsProps = new Properties(); buildInfoItemsProps.setProperty("build.name", buildName); buildInfoItemsProps.setProperty("build.number", buildNumber); buildInfoItemsProps.setProperty("build.timestamp", timestamp); ArtifactoryServer server = config.getArtifactoryServer(); CredentialsConfig preferredResolver = server.getDeployerCredentialsConfig(); ArtifactoryDependenciesClient dependenciesClient = null; ArtifactoryBuildInfoClient propertyChangeClient = null; try { dependenciesClient = server.createArtifactoryDependenciesClient( preferredResolver.provideUsername(build.getParent()), preferredResolver.providePassword(build.getParent()), server.createProxyConfiguration(Jenkins.getInstance().proxy), listener); CredentialsConfig preferredDeployer = CredentialManager.getPreferredDeployer(config, server); propertyChangeClient = server.createArtifactoryClient( preferredDeployer.provideUsername(build.getParent()), preferredDeployer.providePassword(build.getParent()), server.createProxyConfiguration(Jenkins.getInstance().proxy)); Module buildInfoModule = new Module(); buildInfoModule.setId(imageTag.substring(imageTag.indexOf("/") + 1)); // If manifest and imagePath not found, return. if ((StringUtils.isEmpty(manifest) || StringUtils.isEmpty(imagePath)) && !findAndSetManifestFromArtifactory(server, dependenciesClient, listener)) { return buildInfoModule; } listener.getLogger().println("Fetching details of published docker layers from Artifactory..."); boolean includeVirtualReposSupported = propertyChangeClient.getArtifactoryVersion().isAtLeast(VIRTUAL_REPOS_SUPPORTED_VERSION); DockerLayers layers = createLayers(dependenciesClient, includeVirtualReposSupported); listener.getLogger().println("Tagging published docker layers with build properties in Artifactory..."); setDependenciesAndArtifacts(buildInfoModule, layers, artifactsPropsStr, buildInfoItemsProps, dependenciesClient, propertyChangeClient, server); setBuildInfoModuleProps(buildInfoModule); return buildInfoModule; } finally { if (dependenciesClient != null) { dependenciesClient.close(); } if (propertyChangeClient != null) { propertyChangeClient.close(); } } }
[ "public", "Module", "generateBuildInfoModule", "(", "Run", "build", ",", "TaskListener", "listener", ",", "ArtifactoryConfigurator", "config", ",", "String", "buildName", ",", "String", "buildNumber", ",", "String", "timestamp", ")", "throws", "IOException", "{", "i...
Generates the build-info module for this docker image. Additionally. this method tags the deployed docker layers with properties, such as build.name, build.number and custom properties defined in the Jenkins build. @param build @param listener @param config @param buildName @param buildNumber @param timestamp @return @throws IOException
[ "Generates", "the", "build", "-", "info", "module", "for", "this", "docker", "image", ".", "Additionally", ".", "this", "method", "tags", "the", "deployed", "docker", "layers", "with", "properties", "such", "as", "build", ".", "name", "build", ".", "number",...
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/DockerImage.java#L115-L169
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/DockerImage.java
DockerImage.findAndSetManifestFromArtifactory
private boolean findAndSetManifestFromArtifactory(ArtifactoryServer server, ArtifactoryDependenciesClient dependenciesClient, TaskListener listener) throws IOException { String candidateImagePath = DockerUtils.getImagePath(imageTag); String manifestPath; // Try to get manifest, assuming reverse proxy manifestPath = StringUtils.join(new String[]{server.getUrl(), targetRepo, candidateImagePath, "manifest.json"}, "/"); if (checkAndSetManifestAndImagePathCandidates(manifestPath, candidateImagePath, dependenciesClient, listener)) { return true; } // Try to get manifest, assuming proxy-less candidateImagePath = candidateImagePath.substring(candidateImagePath.indexOf("/") + 1); manifestPath = StringUtils.join(new String[]{server.getUrl(), targetRepo, candidateImagePath, "manifest.json"}, "/"); if (checkAndSetManifestAndImagePathCandidates(manifestPath, candidateImagePath, dependenciesClient, listener)) { return true; } // Couldn't find correct manifest listener.getLogger().println("Could not find corresponding manifest.json file in Artifactory."); return false; }
java
private boolean findAndSetManifestFromArtifactory(ArtifactoryServer server, ArtifactoryDependenciesClient dependenciesClient, TaskListener listener) throws IOException { String candidateImagePath = DockerUtils.getImagePath(imageTag); String manifestPath; // Try to get manifest, assuming reverse proxy manifestPath = StringUtils.join(new String[]{server.getUrl(), targetRepo, candidateImagePath, "manifest.json"}, "/"); if (checkAndSetManifestAndImagePathCandidates(manifestPath, candidateImagePath, dependenciesClient, listener)) { return true; } // Try to get manifest, assuming proxy-less candidateImagePath = candidateImagePath.substring(candidateImagePath.indexOf("/") + 1); manifestPath = StringUtils.join(new String[]{server.getUrl(), targetRepo, candidateImagePath, "manifest.json"}, "/"); if (checkAndSetManifestAndImagePathCandidates(manifestPath, candidateImagePath, dependenciesClient, listener)) { return true; } // Couldn't find correct manifest listener.getLogger().println("Could not find corresponding manifest.json file in Artifactory."); return false; }
[ "private", "boolean", "findAndSetManifestFromArtifactory", "(", "ArtifactoryServer", "server", ",", "ArtifactoryDependenciesClient", "dependenciesClient", ",", "TaskListener", "listener", ")", "throws", "IOException", "{", "String", "candidateImagePath", "=", "DockerUtils", "...
Find and validate manifest.json file in Artifactory for the current image. Since provided imageTag differs between reverse-proxy and proxy-less configuration, try to build the correct manifest path. @param server @param dependenciesClient @param listener @return @throws IOException
[ "Find", "and", "validate", "manifest", ".", "json", "file", "in", "Artifactory", "for", "the", "current", "image", ".", "Since", "provided", "imageTag", "differs", "between", "reverse", "-", "proxy", "and", "proxy", "-", "less", "configuration", "try", "to", ...
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/DockerImage.java#L180-L200
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/DockerImage.java
DockerImage.checkAndSetManifestAndImagePathCandidates
private boolean checkAndSetManifestAndImagePathCandidates(String manifestPath, String candidateImagePath, ArtifactoryDependenciesClient dependenciesClient, TaskListener listener) throws IOException { String candidateManifest = getManifestFromArtifactory(dependenciesClient, manifestPath); if (candidateManifest == null) { return false; } String imageDigest = DockerUtils.getConfigDigest(candidateManifest); if (imageDigest.equals(imageId)) { manifest = candidateManifest; imagePath = candidateImagePath; return true; } listener.getLogger().println(String.format("Found incorrect manifest.json file in Artifactory in the following path: %s\nExpecting: %s got: %s", manifestPath, imageId, imageDigest)); return false; }
java
private boolean checkAndSetManifestAndImagePathCandidates(String manifestPath, String candidateImagePath, ArtifactoryDependenciesClient dependenciesClient, TaskListener listener) throws IOException { String candidateManifest = getManifestFromArtifactory(dependenciesClient, manifestPath); if (candidateManifest == null) { return false; } String imageDigest = DockerUtils.getConfigDigest(candidateManifest); if (imageDigest.equals(imageId)) { manifest = candidateManifest; imagePath = candidateImagePath; return true; } listener.getLogger().println(String.format("Found incorrect manifest.json file in Artifactory in the following path: %s\nExpecting: %s got: %s", manifestPath, imageId, imageDigest)); return false; }
[ "private", "boolean", "checkAndSetManifestAndImagePathCandidates", "(", "String", "manifestPath", ",", "String", "candidateImagePath", ",", "ArtifactoryDependenciesClient", "dependenciesClient", ",", "TaskListener", "listener", ")", "throws", "IOException", "{", "String", "ca...
Check if the provided manifestPath is correct. Set the manifest and imagePath in case of the correct manifest. @param manifestPath @param candidateImagePath @param dependenciesClient @param listener @return true if found the correct manifest @throws IOException
[ "Check", "if", "the", "provided", "manifestPath", "is", "correct", ".", "Set", "the", "manifest", "and", "imagePath", "in", "case", "of", "the", "correct", "manifest", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/DockerImage.java#L212-L227
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/types/buildInfo/BuildInfo.java
BuildInfo.getBuildFilesList
private List<org.jfrog.hudson.pipeline.types.File> getBuildFilesList(Stream<? extends BaseBuildFileBean> buildFilesStream) { return buildFilesStream .filter(buildFile -> StringUtils.isNotBlank(buildFile.getLocalPath())) .filter(buildFile -> StringUtils.isNotBlank(buildFile.getRemotePath())) .map(org.jfrog.hudson.pipeline.types.File::new) .distinct() .collect(Collectors.toList()); }
java
private List<org.jfrog.hudson.pipeline.types.File> getBuildFilesList(Stream<? extends BaseBuildFileBean> buildFilesStream) { return buildFilesStream .filter(buildFile -> StringUtils.isNotBlank(buildFile.getLocalPath())) .filter(buildFile -> StringUtils.isNotBlank(buildFile.getRemotePath())) .map(org.jfrog.hudson.pipeline.types.File::new) .distinct() .collect(Collectors.toList()); }
[ "private", "List", "<", "org", ".", "jfrog", ".", "hudson", ".", "pipeline", ".", "types", ".", "File", ">", "getBuildFilesList", "(", "Stream", "<", "?", "extends", "BaseBuildFileBean", ">", "buildFilesStream", ")", "{", "return", "buildFilesStream", ".", "...
Return a list of 'Files' of downloaded or uploaded files. Filters build files without local and remote paths. @param buildFilesStream - Stream of build Artifacts or Dependencies. @return - List of build files.
[ "Return", "a", "list", "of", "Files", "of", "downloaded", "or", "uploaded", "files", ".", "Filters", "build", "files", "without", "local", "and", "remote", "paths", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/types/buildInfo/BuildInfo.java#L126-L133
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/ArtifactoryServer.java
ArtifactoryServer.getConnectionRetries
public List<Integer> getConnectionRetries() { List<Integer> items = new ArrayList<Integer>(); for (int i = 0; i < 10; i++) { items.add(i); } return items; }
java
public List<Integer> getConnectionRetries() { List<Integer> items = new ArrayList<Integer>(); for (int i = 0; i < 10; i++) { items.add(i); } return items; }
[ "public", "List", "<", "Integer", ">", "getConnectionRetries", "(", ")", "{", "List", "<", "Integer", ">", "items", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "10", ";", "i", "++"...
To populate the dropdown list from the jelly
[ "To", "populate", "the", "dropdown", "list", "from", "the", "jelly" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/ArtifactoryServer.java#L127-L133
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/ArtifactoryServer.java
ArtifactoryServer.getResolvingCredentialsConfig
public CredentialsConfig getResolvingCredentialsConfig() { if (resolverCredentialsConfig != null && resolverCredentialsConfig.isCredentialsProvided()) { return getResolverCredentialsConfig(); } if (deployerCredentialsConfig != null) { return getDeployerCredentialsConfig(); } return CredentialsConfig.EMPTY_CREDENTIALS_CONFIG; }
java
public CredentialsConfig getResolvingCredentialsConfig() { if (resolverCredentialsConfig != null && resolverCredentialsConfig.isCredentialsProvided()) { return getResolverCredentialsConfig(); } if (deployerCredentialsConfig != null) { return getDeployerCredentialsConfig(); } return CredentialsConfig.EMPTY_CREDENTIALS_CONFIG; }
[ "public", "CredentialsConfig", "getResolvingCredentialsConfig", "(", ")", "{", "if", "(", "resolverCredentialsConfig", "!=", "null", "&&", "resolverCredentialsConfig", ".", "isCredentialsProvided", "(", ")", ")", "{", "return", "getResolverCredentialsConfig", "(", ")", ...
Decides what are the preferred credentials to use for resolving the repo keys of the server @return Preferred credentials for repo resolving. Never null.
[ "Decides", "what", "are", "the", "preferred", "credentials", "to", "use", "for", "resolving", "the", "repo", "keys", "of", "the", "server" ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/ArtifactoryServer.java#L351-L360
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/maven/PomTransformer.java
PomTransformer.invoke
public Boolean invoke(File pomFile, VirtualChannel channel) throws IOException, InterruptedException { org.jfrog.build.extractor.maven.reader.ModuleName current = new org.jfrog.build.extractor.maven.reader.ModuleName( currentModule.groupId, currentModule.artifactId); Map<org.jfrog.build.extractor.maven.reader.ModuleName, String> modules = Maps.newLinkedHashMap(); for (Map.Entry<ModuleName, String> entry : versionsByModule.entrySet()) { modules.put(new org.jfrog.build.extractor.maven.reader.ModuleName( entry.getKey().groupId, entry.getKey().artifactId), entry.getValue()); } org.jfrog.build.extractor.maven.transformer.PomTransformer transformer = new org.jfrog.build.extractor.maven.transformer.PomTransformer(current, modules, scmUrl, failOnSnapshot); return transformer.transform(pomFile); }
java
public Boolean invoke(File pomFile, VirtualChannel channel) throws IOException, InterruptedException { org.jfrog.build.extractor.maven.reader.ModuleName current = new org.jfrog.build.extractor.maven.reader.ModuleName( currentModule.groupId, currentModule.artifactId); Map<org.jfrog.build.extractor.maven.reader.ModuleName, String> modules = Maps.newLinkedHashMap(); for (Map.Entry<ModuleName, String> entry : versionsByModule.entrySet()) { modules.put(new org.jfrog.build.extractor.maven.reader.ModuleName( entry.getKey().groupId, entry.getKey().artifactId), entry.getValue()); } org.jfrog.build.extractor.maven.transformer.PomTransformer transformer = new org.jfrog.build.extractor.maven.transformer.PomTransformer(current, modules, scmUrl, failOnSnapshot); return transformer.transform(pomFile); }
[ "public", "Boolean", "invoke", "(", "File", "pomFile", ",", "VirtualChannel", "channel", ")", "throws", "IOException", ",", "InterruptedException", "{", "org", ".", "jfrog", ".", "build", ".", "extractor", ".", "maven", ".", "reader", ".", "ModuleName", "curre...
Performs the transformation. @return True if the file was modified.
[ "Performs", "the", "transformation", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/maven/PomTransformer.java#L61-L77
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/scm/perforce/AbstractPerforceManager.java
AbstractPerforceManager.edit
public void edit(int currentChangeListId, FilePath filePath) throws Exception { establishConnection().editFile(currentChangeListId, new File(filePath.getRemote())); }
java
public void edit(int currentChangeListId, FilePath filePath) throws Exception { establishConnection().editFile(currentChangeListId, new File(filePath.getRemote())); }
[ "public", "void", "edit", "(", "int", "currentChangeListId", ",", "FilePath", "filePath", ")", "throws", "Exception", "{", "establishConnection", "(", ")", ".", "editFile", "(", "currentChangeListId", ",", "new", "File", "(", "filePath", ".", "getRemote", "(", ...
Opens file for editing. @param currentChangeListId The current change list id to open the file for editing at @param filePath The filePath which contains the file we need to edit @throws IOException Thrown in case of perforce communication errors @throws InterruptedException
[ "Opens", "file", "for", "editing", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/scm/perforce/AbstractPerforceManager.java#L98-L100
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/executors/MavenExecutor.java
MavenExecutor.convertJdkPath
private void convertJdkPath(Launcher launcher, EnvVars extendedEnv) { String separator = launcher.isUnix() ? "/" : "\\"; String java_home = extendedEnv.get("JAVA_HOME"); if (StringUtils.isNotEmpty(java_home)) { if (!StringUtils.endsWith(java_home, separator)) { java_home += separator; } extendedEnv.put("PATH+JDK", java_home + "bin"); } }
java
private void convertJdkPath(Launcher launcher, EnvVars extendedEnv) { String separator = launcher.isUnix() ? "/" : "\\"; String java_home = extendedEnv.get("JAVA_HOME"); if (StringUtils.isNotEmpty(java_home)) { if (!StringUtils.endsWith(java_home, separator)) { java_home += separator; } extendedEnv.put("PATH+JDK", java_home + "bin"); } }
[ "private", "void", "convertJdkPath", "(", "Launcher", "launcher", ",", "EnvVars", "extendedEnv", ")", "{", "String", "separator", "=", "launcher", ".", "isUnix", "(", ")", "?", "\"/\"", ":", "\"\\\\\"", ";", "String", "java_home", "=", "extendedEnv", ".", "g...
The Maven3Builder class is looking for the PATH+JDK environment variable due to legacy code. In The pipeline flow we need to convert the JAVA_HOME to PATH+JDK in order to reuse the code.
[ "The", "Maven3Builder", "class", "is", "looking", "for", "the", "PATH", "+", "JDK", "environment", "variable", "due", "to", "legacy", "code", ".", "In", "The", "pipeline", "flow", "we", "need", "to", "convert", "the", "JAVA_HOME", "to", "PATH", "+", "JDK",...
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/executors/MavenExecutor.java#L84-L93
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/BuildUniqueIdentifierHelper.java
BuildUniqueIdentifierHelper.getRootBuild
public static AbstractBuild<?, ?> getRootBuild(AbstractBuild<?, ?> currentBuild) { AbstractBuild<?, ?> rootBuild = null; AbstractBuild<?, ?> parentBuild = getUpstreamBuild(currentBuild); while (parentBuild != null) { if (isPassIdentifiedDownstream(parentBuild)) { rootBuild = parentBuild; } parentBuild = getUpstreamBuild(parentBuild); } if (rootBuild == null && isPassIdentifiedDownstream(currentBuild)) { return currentBuild; } return rootBuild; }
java
public static AbstractBuild<?, ?> getRootBuild(AbstractBuild<?, ?> currentBuild) { AbstractBuild<?, ?> rootBuild = null; AbstractBuild<?, ?> parentBuild = getUpstreamBuild(currentBuild); while (parentBuild != null) { if (isPassIdentifiedDownstream(parentBuild)) { rootBuild = parentBuild; } parentBuild = getUpstreamBuild(parentBuild); } if (rootBuild == null && isPassIdentifiedDownstream(currentBuild)) { return currentBuild; } return rootBuild; }
[ "public", "static", "AbstractBuild", "<", "?", ",", "?", ">", "getRootBuild", "(", "AbstractBuild", "<", "?", ",", "?", ">", "currentBuild", ")", "{", "AbstractBuild", "<", "?", ",", "?", ">", "rootBuild", "=", "null", ";", "AbstractBuild", "<", "?", "...
Get the root build which triggered the current build. The build root is considered to be the one furthest one away from the current build which has the isPassIdentifiedDownstream active, if no parent build exists, check that the current build needs an upstream identifier, if it does return it. @param currentBuild The current build. @return The root build with isPassIdentifiedDownstream active. Null if no upstream or non is found.
[ "Get", "the", "root", "build", "which", "triggered", "the", "current", "build", ".", "The", "build", "root", "is", "considered", "to", "be", "the", "one", "furthest", "one", "away", "from", "the", "current", "build", "which", "has", "the", "isPassIdentifiedD...
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/BuildUniqueIdentifierHelper.java#L35-L48
train
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/BuildUniqueIdentifierHelper.java
BuildUniqueIdentifierHelper.getProject
private static AbstractProject<?, ?> getProject(String fullName) { Item item = Hudson.getInstance().getItemByFullName(fullName); if (item != null && item instanceof AbstractProject) { return (AbstractProject<?, ?>) item; } return null; }
java
private static AbstractProject<?, ?> getProject(String fullName) { Item item = Hudson.getInstance().getItemByFullName(fullName); if (item != null && item instanceof AbstractProject) { return (AbstractProject<?, ?>) item; } return null; }
[ "private", "static", "AbstractProject", "<", "?", ",", "?", ">", "getProject", "(", "String", "fullName", ")", "{", "Item", "item", "=", "Hudson", ".", "getInstance", "(", ")", ".", "getItemByFullName", "(", "fullName", ")", ";", "if", "(", "item", "!=",...
Get a project according to its full name. @param fullName The full name of the project. @return The project which answers the full name.
[ "Get", "a", "project", "according", "to", "its", "full", "name", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/BuildUniqueIdentifierHelper.java#L75-L81
train