id
int32
0
165k
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
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
164,500
tcurdt/jdeb
src/main/java/org/vafer/jdeb/producers/Producers.java
Producers.produceInputStreamWithEntry
static void produceInputStreamWithEntry( final DataConsumer consumer, final InputStream inputStream, final TarArchiveEntry entry ) throws IOException { try { consumer.onEachFile(inputStream, entry); } finally { IOUtils.closeQuietly(inputStream); } }
java
static void produceInputStreamWithEntry( final DataConsumer consumer, final InputStream inputStream, final TarArchiveEntry entry ) throws IOException { try { consumer.onEachFile(inputStream, entry); } finally { IOUtils.closeQuietly(inputStream); } }
[ "static", "void", "produceInputStreamWithEntry", "(", "final", "DataConsumer", "consumer", ",", "final", "InputStream", "inputStream", ",", "final", "TarArchiveEntry", "entry", ")", "throws", "IOException", "{", "try", "{", "consumer", ".", "onEachFile", "(", "inputStream", ",", "entry", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "inputStream", ")", ";", "}", "}" ]
Feeds input stream to data consumer using metadata from tar entry. @param consumer the consumer @param inputStream the stream to feed @param entry the entry to use for metadata @throws IOException on consume error
[ "Feeds", "input", "stream", "to", "data", "consumer", "using", "metadata", "from", "tar", "entry", "." ]
b899a7b1b3391356aafc491ab601f258961f67f0
https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/producers/Producers.java#L86-L94
164,501
tcurdt/jdeb
src/main/java/org/vafer/jdeb/debian/ControlField.java
ControlField.format
public String format(String value) { StringBuilder s = new StringBuilder(); if (value != null && value.trim().length() > 0) { boolean continuationLine = false; s.append(getName()).append(":"); if (isFirstLineEmpty()) { s.append("\n"); continuationLine = true; } try { BufferedReader reader = new BufferedReader(new StringReader(value)); String line; while ((line = reader.readLine()) != null) { if (continuationLine && line.trim().length() == 0) { // put a dot on the empty continuation lines s.append(" .\n"); } else { s.append(" ").append(line).append("\n"); } continuationLine = true; } } catch (IOException e) { e.printStackTrace(); } } return s.toString(); }
java
public String format(String value) { StringBuilder s = new StringBuilder(); if (value != null && value.trim().length() > 0) { boolean continuationLine = false; s.append(getName()).append(":"); if (isFirstLineEmpty()) { s.append("\n"); continuationLine = true; } try { BufferedReader reader = new BufferedReader(new StringReader(value)); String line; while ((line = reader.readLine()) != null) { if (continuationLine && line.trim().length() == 0) { // put a dot on the empty continuation lines s.append(" .\n"); } else { s.append(" ").append(line).append("\n"); } continuationLine = true; } } catch (IOException e) { e.printStackTrace(); } } return s.toString(); }
[ "public", "String", "format", "(", "String", "value", ")", "{", "StringBuilder", "s", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "value", "!=", "null", "&&", "value", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "boolean", "continuationLine", "=", "false", ";", "s", ".", "append", "(", "getName", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "if", "(", "isFirstLineEmpty", "(", ")", ")", "{", "s", ".", "append", "(", "\"\\n\"", ")", ";", "continuationLine", "=", "true", ";", "}", "try", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "StringReader", "(", "value", ")", ")", ";", "String", "line", ";", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "continuationLine", "&&", "line", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "// put a dot on the empty continuation lines", "s", ".", "append", "(", "\" .\\n\"", ")", ";", "}", "else", "{", "s", ".", "append", "(", "\" \"", ")", ".", "append", "(", "line", ")", ".", "append", "(", "\"\\n\"", ")", ";", "}", "continuationLine", "=", "true", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "return", "s", ".", "toString", "(", ")", ";", "}" ]
Returns the field with the specified value properly formatted. Multiline values are automatically indented, and dots are added on the empty lines. <pre> Field-Name: value </pre>
[ "Returns", "the", "field", "with", "the", "specified", "value", "properly", "formatted", ".", "Multiline", "values", "are", "automatically", "indented", "and", "dots", "are", "added", "on", "the", "empty", "lines", "." ]
b899a7b1b3391356aafc491ab601f258961f67f0
https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/debian/ControlField.java#L96-L127
164,502
tcurdt/jdeb
src/main/java/org/vafer/jdeb/debian/ChangesFile.java
ChangesFile.initialize
public void initialize(BinaryPackageControlFile packageControlFile) { set("Binary", packageControlFile.get("Package")); set("Source", Utils.defaultString(packageControlFile.get("Source"), packageControlFile.get("Package"))); set("Architecture", packageControlFile.get("Architecture")); set("Version", packageControlFile.get("Version")); set("Maintainer", packageControlFile.get("Maintainer")); set("Changed-By", packageControlFile.get("Maintainer")); set("Distribution", packageControlFile.get("Distribution")); for (Entry<String, String> entry : packageControlFile.getUserDefinedFields().entrySet()) { set(entry.getKey(), entry.getValue()); } StringBuilder description = new StringBuilder(); description.append(packageControlFile.get("Package")); if (packageControlFile.get("Description") != null) { description.append(" - "); description.append(packageControlFile.getShortDescription()); } set("Description", description.toString()); }
java
public void initialize(BinaryPackageControlFile packageControlFile) { set("Binary", packageControlFile.get("Package")); set("Source", Utils.defaultString(packageControlFile.get("Source"), packageControlFile.get("Package"))); set("Architecture", packageControlFile.get("Architecture")); set("Version", packageControlFile.get("Version")); set("Maintainer", packageControlFile.get("Maintainer")); set("Changed-By", packageControlFile.get("Maintainer")); set("Distribution", packageControlFile.get("Distribution")); for (Entry<String, String> entry : packageControlFile.getUserDefinedFields().entrySet()) { set(entry.getKey(), entry.getValue()); } StringBuilder description = new StringBuilder(); description.append(packageControlFile.get("Package")); if (packageControlFile.get("Description") != null) { description.append(" - "); description.append(packageControlFile.getShortDescription()); } set("Description", description.toString()); }
[ "public", "void", "initialize", "(", "BinaryPackageControlFile", "packageControlFile", ")", "{", "set", "(", "\"Binary\"", ",", "packageControlFile", ".", "get", "(", "\"Package\"", ")", ")", ";", "set", "(", "\"Source\"", ",", "Utils", ".", "defaultString", "(", "packageControlFile", ".", "get", "(", "\"Source\"", ")", ",", "packageControlFile", ".", "get", "(", "\"Package\"", ")", ")", ")", ";", "set", "(", "\"Architecture\"", ",", "packageControlFile", ".", "get", "(", "\"Architecture\"", ")", ")", ";", "set", "(", "\"Version\"", ",", "packageControlFile", ".", "get", "(", "\"Version\"", ")", ")", ";", "set", "(", "\"Maintainer\"", ",", "packageControlFile", ".", "get", "(", "\"Maintainer\"", ")", ")", ";", "set", "(", "\"Changed-By\"", ",", "packageControlFile", ".", "get", "(", "\"Maintainer\"", ")", ")", ";", "set", "(", "\"Distribution\"", ",", "packageControlFile", ".", "get", "(", "\"Distribution\"", ")", ")", ";", "for", "(", "Entry", "<", "String", ",", "String", ">", "entry", ":", "packageControlFile", ".", "getUserDefinedFields", "(", ")", ".", "entrySet", "(", ")", ")", "{", "set", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "StringBuilder", "description", "=", "new", "StringBuilder", "(", ")", ";", "description", ".", "append", "(", "packageControlFile", ".", "get", "(", "\"Package\"", ")", ")", ";", "if", "(", "packageControlFile", ".", "get", "(", "\"Description\"", ")", "!=", "null", ")", "{", "description", ".", "append", "(", "\" - \"", ")", ";", "description", ".", "append", "(", "packageControlFile", ".", "getShortDescription", "(", ")", ")", ";", "}", "set", "(", "\"Description\"", ",", "description", ".", "toString", "(", ")", ")", ";", "}" ]
Initializes the fields on the changes file with the values of the specified binary package control file. @param packageControlFile
[ "Initializes", "the", "fields", "on", "the", "changes", "file", "with", "the", "values", "of", "the", "specified", "binary", "package", "control", "file", "." ]
b899a7b1b3391356aafc491ab601f258961f67f0
https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/debian/ChangesFile.java#L66-L86
164,503
tcurdt/jdeb
src/main/java/org/vafer/jdeb/maven/DebMojo.java
DebMojo.initializeSignProperties
private void initializeSignProperties() { if (!signPackage && !signChanges) { return; } if (key != null && keyring != null && passphrase != null) { return; } Map<String, String> properties = readPropertiesFromActiveProfiles(signCfgPrefix, KEY, KEYRING, PASSPHRASE); key = lookupIfEmpty(key, properties, KEY); keyring = lookupIfEmpty(keyring, properties, KEYRING); passphrase = decrypt(lookupIfEmpty(passphrase, properties, PASSPHRASE)); if (keyring == null) { try { keyring = Utils.guessKeyRingFile().getAbsolutePath(); console.info("Located keyring at " + keyring); } catch (FileNotFoundException e) { console.warn(e.getMessage()); } } }
java
private void initializeSignProperties() { if (!signPackage && !signChanges) { return; } if (key != null && keyring != null && passphrase != null) { return; } Map<String, String> properties = readPropertiesFromActiveProfiles(signCfgPrefix, KEY, KEYRING, PASSPHRASE); key = lookupIfEmpty(key, properties, KEY); keyring = lookupIfEmpty(keyring, properties, KEYRING); passphrase = decrypt(lookupIfEmpty(passphrase, properties, PASSPHRASE)); if (keyring == null) { try { keyring = Utils.guessKeyRingFile().getAbsolutePath(); console.info("Located keyring at " + keyring); } catch (FileNotFoundException e) { console.warn(e.getMessage()); } } }
[ "private", "void", "initializeSignProperties", "(", ")", "{", "if", "(", "!", "signPackage", "&&", "!", "signChanges", ")", "{", "return", ";", "}", "if", "(", "key", "!=", "null", "&&", "keyring", "!=", "null", "&&", "passphrase", "!=", "null", ")", "{", "return", ";", "}", "Map", "<", "String", ",", "String", ">", "properties", "=", "readPropertiesFromActiveProfiles", "(", "signCfgPrefix", ",", "KEY", ",", "KEYRING", ",", "PASSPHRASE", ")", ";", "key", "=", "lookupIfEmpty", "(", "key", ",", "properties", ",", "KEY", ")", ";", "keyring", "=", "lookupIfEmpty", "(", "keyring", ",", "properties", ",", "KEYRING", ")", ";", "passphrase", "=", "decrypt", "(", "lookupIfEmpty", "(", "passphrase", ",", "properties", ",", "PASSPHRASE", ")", ")", ";", "if", "(", "keyring", "==", "null", ")", "{", "try", "{", "keyring", "=", "Utils", ".", "guessKeyRingFile", "(", ")", ".", "getAbsolutePath", "(", ")", ";", "console", ".", "info", "(", "\"Located keyring at \"", "+", "keyring", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "console", ".", "warn", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
Initializes unspecified sign properties using available defaults and global settings.
[ "Initializes", "unspecified", "sign", "properties", "using", "available", "defaults", "and", "global", "settings", "." ]
b899a7b1b3391356aafc491ab601f258961f67f0
https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/maven/DebMojo.java#L623-L647
164,504
tcurdt/jdeb
src/main/java/org/vafer/jdeb/maven/DebMojo.java
DebMojo.readPropertiesFromActiveProfiles
public Map<String, String> readPropertiesFromActiveProfiles( final String prefix, final String... properties ) { if (settings == null) { console.debug("No maven setting injected"); return Collections.emptyMap(); } final List<String> activeProfilesList = settings.getActiveProfiles(); if (activeProfilesList.isEmpty()) { console.debug("No active profiles found"); return Collections.emptyMap(); } final Map<String, String> map = new HashMap<String, String>(); final Set<String> activeProfiles = new HashSet<String>(activeProfilesList); // Iterate over all active profiles in order for (final Profile profile : settings.getProfiles()) { // Check if the profile is active final String profileId = profile.getId(); if (activeProfiles.contains(profileId)) { console.debug("Trying active profile " + profileId); for (final String property : properties) { final String propKey = prefix != null ? prefix + property : property; final String value = profile.getProperties().getProperty(propKey); if (value != null) { console.debug("Found property " + property + " in profile " + profileId); map.put(property, value); } } } } return map; }
java
public Map<String, String> readPropertiesFromActiveProfiles( final String prefix, final String... properties ) { if (settings == null) { console.debug("No maven setting injected"); return Collections.emptyMap(); } final List<String> activeProfilesList = settings.getActiveProfiles(); if (activeProfilesList.isEmpty()) { console.debug("No active profiles found"); return Collections.emptyMap(); } final Map<String, String> map = new HashMap<String, String>(); final Set<String> activeProfiles = new HashSet<String>(activeProfilesList); // Iterate over all active profiles in order for (final Profile profile : settings.getProfiles()) { // Check if the profile is active final String profileId = profile.getId(); if (activeProfiles.contains(profileId)) { console.debug("Trying active profile " + profileId); for (final String property : properties) { final String propKey = prefix != null ? prefix + property : property; final String value = profile.getProperties().getProperty(propKey); if (value != null) { console.debug("Found property " + property + " in profile " + profileId); map.put(property, value); } } } } return map; }
[ "public", "Map", "<", "String", ",", "String", ">", "readPropertiesFromActiveProfiles", "(", "final", "String", "prefix", ",", "final", "String", "...", "properties", ")", "{", "if", "(", "settings", "==", "null", ")", "{", "console", ".", "debug", "(", "\"No maven setting injected\"", ")", ";", "return", "Collections", ".", "emptyMap", "(", ")", ";", "}", "final", "List", "<", "String", ">", "activeProfilesList", "=", "settings", ".", "getActiveProfiles", "(", ")", ";", "if", "(", "activeProfilesList", ".", "isEmpty", "(", ")", ")", "{", "console", ".", "debug", "(", "\"No active profiles found\"", ")", ";", "return", "Collections", ".", "emptyMap", "(", ")", ";", "}", "final", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "final", "Set", "<", "String", ">", "activeProfiles", "=", "new", "HashSet", "<", "String", ">", "(", "activeProfilesList", ")", ";", "// Iterate over all active profiles in order", "for", "(", "final", "Profile", "profile", ":", "settings", ".", "getProfiles", "(", ")", ")", "{", "// Check if the profile is active", "final", "String", "profileId", "=", "profile", ".", "getId", "(", ")", ";", "if", "(", "activeProfiles", ".", "contains", "(", "profileId", ")", ")", "{", "console", ".", "debug", "(", "\"Trying active profile \"", "+", "profileId", ")", ";", "for", "(", "final", "String", "property", ":", "properties", ")", "{", "final", "String", "propKey", "=", "prefix", "!=", "null", "?", "prefix", "+", "property", ":", "property", ";", "final", "String", "value", "=", "profile", ".", "getProperties", "(", ")", ".", "getProperty", "(", "propKey", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "console", ".", "debug", "(", "\"Found property \"", "+", "property", "+", "\" in profile \"", "+", "profileId", ")", ";", "map", ".", "put", "(", "property", ",", "value", ")", ";", "}", "}", "}", "}", "return", "map", ";", "}" ]
Read properties from the active profiles. Goes through all active profiles (in the order the profiles are defined in settings.xml) and extracts the desired properties (if present). The prefix is used when looking up properties in the profile but not in the returned map. @param prefix The prefix to use or null if no prefix should be used @param properties The properties to read @return A map containing the values for the properties that were found
[ "Read", "properties", "from", "the", "active", "profiles", "." ]
b899a7b1b3391356aafc491ab601f258961f67f0
https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/maven/DebMojo.java#L704-L738
164,505
tcurdt/jdeb
src/main/java/org/vafer/jdeb/ControlBuilder.java
ControlBuilder.buildControl
void buildControl(BinaryPackageControlFile packageControlFile, File[] controlFiles, List<String> conffiles, StringBuilder checksums, File output) throws IOException, ParseException { final File dir = output.getParentFile(); if (dir != null && (!dir.exists() || !dir.isDirectory())) { throw new IOException("Cannot write control file at '" + output.getAbsolutePath() + "'"); } final TarArchiveOutputStream outputStream = new TarArchiveOutputStream(new GZIPOutputStream(new FileOutputStream(output))); outputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); boolean foundConffiles = false; // create the final package control file out of the "control" file, copy all other files, ignore the directories for (File file : controlFiles) { if (file.isDirectory()) { // warn about the misplaced directory, except for directories ignored by default (.svn, cvs, etc) if (!isDefaultExcludes(file)) { console.warn("Found directory '" + file + "' in the control directory. Maybe you are pointing to wrong dir?"); } continue; } if ("conffiles".equals(file.getName())) { foundConffiles = true; } if (CONFIGURATION_FILENAMES.contains(file.getName()) || MAINTAINER_SCRIPTS.contains(file.getName())) { FilteredFile configurationFile = new FilteredFile(new FileInputStream(file), resolver); configurationFile.setOpenToken(openReplaceToken); configurationFile.setCloseToken(closeReplaceToken); addControlEntry(file.getName(), configurationFile.toString(), outputStream); } else if (!"control".equals(file.getName())) { // initialize the information stream to guess the type of the file InformationInputStream infoStream = new InformationInputStream(new FileInputStream(file)); Utils.copy(infoStream, NullOutputStream.NULL_OUTPUT_STREAM); infoStream.close(); // fix line endings for shell scripts InputStream in = new FileInputStream(file); if (infoStream.isShell() && !infoStream.hasUnixLineEndings()) { byte[] buf = Utils.toUnixLineEndings(in); in = new ByteArrayInputStream(buf); } addControlEntry(file.getName(), IOUtils.toString(in), outputStream); in.close(); } } if (foundConffiles) { console.info("Found file 'conffiles' in the control directory. Skipping conffiles generation."); } else if ((conffiles != null) && (conffiles.size() > 0)) { addControlEntry("conffiles", createPackageConffilesFile(conffiles), outputStream); } else { console.info("Skipping 'conffiles' generation. No entries defined in maven/pom or ant/build.xml."); } if (packageControlFile == null) { throw new FileNotFoundException("No 'control' file found in " + controlFiles.toString()); } addControlEntry("control", packageControlFile.toString(), outputStream); addControlEntry("md5sums", checksums.toString(), outputStream); outputStream.close(); }
java
void buildControl(BinaryPackageControlFile packageControlFile, File[] controlFiles, List<String> conffiles, StringBuilder checksums, File output) throws IOException, ParseException { final File dir = output.getParentFile(); if (dir != null && (!dir.exists() || !dir.isDirectory())) { throw new IOException("Cannot write control file at '" + output.getAbsolutePath() + "'"); } final TarArchiveOutputStream outputStream = new TarArchiveOutputStream(new GZIPOutputStream(new FileOutputStream(output))); outputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); boolean foundConffiles = false; // create the final package control file out of the "control" file, copy all other files, ignore the directories for (File file : controlFiles) { if (file.isDirectory()) { // warn about the misplaced directory, except for directories ignored by default (.svn, cvs, etc) if (!isDefaultExcludes(file)) { console.warn("Found directory '" + file + "' in the control directory. Maybe you are pointing to wrong dir?"); } continue; } if ("conffiles".equals(file.getName())) { foundConffiles = true; } if (CONFIGURATION_FILENAMES.contains(file.getName()) || MAINTAINER_SCRIPTS.contains(file.getName())) { FilteredFile configurationFile = new FilteredFile(new FileInputStream(file), resolver); configurationFile.setOpenToken(openReplaceToken); configurationFile.setCloseToken(closeReplaceToken); addControlEntry(file.getName(), configurationFile.toString(), outputStream); } else if (!"control".equals(file.getName())) { // initialize the information stream to guess the type of the file InformationInputStream infoStream = new InformationInputStream(new FileInputStream(file)); Utils.copy(infoStream, NullOutputStream.NULL_OUTPUT_STREAM); infoStream.close(); // fix line endings for shell scripts InputStream in = new FileInputStream(file); if (infoStream.isShell() && !infoStream.hasUnixLineEndings()) { byte[] buf = Utils.toUnixLineEndings(in); in = new ByteArrayInputStream(buf); } addControlEntry(file.getName(), IOUtils.toString(in), outputStream); in.close(); } } if (foundConffiles) { console.info("Found file 'conffiles' in the control directory. Skipping conffiles generation."); } else if ((conffiles != null) && (conffiles.size() > 0)) { addControlEntry("conffiles", createPackageConffilesFile(conffiles), outputStream); } else { console.info("Skipping 'conffiles' generation. No entries defined in maven/pom or ant/build.xml."); } if (packageControlFile == null) { throw new FileNotFoundException("No 'control' file found in " + controlFiles.toString()); } addControlEntry("control", packageControlFile.toString(), outputStream); addControlEntry("md5sums", checksums.toString(), outputStream); outputStream.close(); }
[ "void", "buildControl", "(", "BinaryPackageControlFile", "packageControlFile", ",", "File", "[", "]", "controlFiles", ",", "List", "<", "String", ">", "conffiles", ",", "StringBuilder", "checksums", ",", "File", "output", ")", "throws", "IOException", ",", "ParseException", "{", "final", "File", "dir", "=", "output", ".", "getParentFile", "(", ")", ";", "if", "(", "dir", "!=", "null", "&&", "(", "!", "dir", ".", "exists", "(", ")", "||", "!", "dir", ".", "isDirectory", "(", ")", ")", ")", "{", "throw", "new", "IOException", "(", "\"Cannot write control file at '\"", "+", "output", ".", "getAbsolutePath", "(", ")", "+", "\"'\"", ")", ";", "}", "final", "TarArchiveOutputStream", "outputStream", "=", "new", "TarArchiveOutputStream", "(", "new", "GZIPOutputStream", "(", "new", "FileOutputStream", "(", "output", ")", ")", ")", ";", "outputStream", ".", "setLongFileMode", "(", "TarArchiveOutputStream", ".", "LONGFILE_GNU", ")", ";", "boolean", "foundConffiles", "=", "false", ";", "// create the final package control file out of the \"control\" file, copy all other files, ignore the directories", "for", "(", "File", "file", ":", "controlFiles", ")", "{", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "// warn about the misplaced directory, except for directories ignored by default (.svn, cvs, etc)", "if", "(", "!", "isDefaultExcludes", "(", "file", ")", ")", "{", "console", ".", "warn", "(", "\"Found directory '\"", "+", "file", "+", "\"' in the control directory. Maybe you are pointing to wrong dir?\"", ")", ";", "}", "continue", ";", "}", "if", "(", "\"conffiles\"", ".", "equals", "(", "file", ".", "getName", "(", ")", ")", ")", "{", "foundConffiles", "=", "true", ";", "}", "if", "(", "CONFIGURATION_FILENAMES", ".", "contains", "(", "file", ".", "getName", "(", ")", ")", "||", "MAINTAINER_SCRIPTS", ".", "contains", "(", "file", ".", "getName", "(", ")", ")", ")", "{", "FilteredFile", "configurationFile", "=", "new", "FilteredFile", "(", "new", "FileInputStream", "(", "file", ")", ",", "resolver", ")", ";", "configurationFile", ".", "setOpenToken", "(", "openReplaceToken", ")", ";", "configurationFile", ".", "setCloseToken", "(", "closeReplaceToken", ")", ";", "addControlEntry", "(", "file", ".", "getName", "(", ")", ",", "configurationFile", ".", "toString", "(", ")", ",", "outputStream", ")", ";", "}", "else", "if", "(", "!", "\"control\"", ".", "equals", "(", "file", ".", "getName", "(", ")", ")", ")", "{", "// initialize the information stream to guess the type of the file", "InformationInputStream", "infoStream", "=", "new", "InformationInputStream", "(", "new", "FileInputStream", "(", "file", ")", ")", ";", "Utils", ".", "copy", "(", "infoStream", ",", "NullOutputStream", ".", "NULL_OUTPUT_STREAM", ")", ";", "infoStream", ".", "close", "(", ")", ";", "// fix line endings for shell scripts", "InputStream", "in", "=", "new", "FileInputStream", "(", "file", ")", ";", "if", "(", "infoStream", ".", "isShell", "(", ")", "&&", "!", "infoStream", ".", "hasUnixLineEndings", "(", ")", ")", "{", "byte", "[", "]", "buf", "=", "Utils", ".", "toUnixLineEndings", "(", "in", ")", ";", "in", "=", "new", "ByteArrayInputStream", "(", "buf", ")", ";", "}", "addControlEntry", "(", "file", ".", "getName", "(", ")", ",", "IOUtils", ".", "toString", "(", "in", ")", ",", "outputStream", ")", ";", "in", ".", "close", "(", ")", ";", "}", "}", "if", "(", "foundConffiles", ")", "{", "console", ".", "info", "(", "\"Found file 'conffiles' in the control directory. Skipping conffiles generation.\"", ")", ";", "}", "else", "if", "(", "(", "conffiles", "!=", "null", ")", "&&", "(", "conffiles", ".", "size", "(", ")", ">", "0", ")", ")", "{", "addControlEntry", "(", "\"conffiles\"", ",", "createPackageConffilesFile", "(", "conffiles", ")", ",", "outputStream", ")", ";", "}", "else", "{", "console", ".", "info", "(", "\"Skipping 'conffiles' generation. No entries defined in maven/pom or ant/build.xml.\"", ")", ";", "}", "if", "(", "packageControlFile", "==", "null", ")", "{", "throw", "new", "FileNotFoundException", "(", "\"No 'control' file found in \"", "+", "controlFiles", ".", "toString", "(", ")", ")", ";", "}", "addControlEntry", "(", "\"control\"", ",", "packageControlFile", ".", "toString", "(", ")", ",", "outputStream", ")", ";", "addControlEntry", "(", "\"md5sums\"", ",", "checksums", ".", "toString", "(", ")", ",", "outputStream", ")", ";", "outputStream", ".", "close", "(", ")", ";", "}" ]
Build control archive of the deb @param packageControlFile the package control file @param controlFiles the other control information files (maintainer scripts, etc) @param dataSize the size of the installed package @param checksums the md5 checksums of the files in the data archive @param output @return @throws java.io.FileNotFoundException @throws java.io.IOException @throws java.text.ParseException
[ "Build", "control", "archive", "of", "the", "deb" ]
b899a7b1b3391356aafc491ab601f258961f67f0
https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/ControlBuilder.java#L82-L148
164,506
Instamojo/instamojo-java
src/main/java/com/instamojo/wrapper/util/HttpUtils.java
HttpUtils.get
public static String get(String url, Map<String, String> customHeaders, Map<String, String> params) throws URISyntaxException, IOException, HTTPException { LOGGER.log(Level.INFO, "Sending GET request to the url {0}", url); URIBuilder uriBuilder = new URIBuilder(url); if (params != null && params.size() > 0) { for (Map.Entry<String, String> param : params.entrySet()) { uriBuilder.setParameter(param.getKey(), param.getValue()); } } HttpGet httpGet = new HttpGet(uriBuilder.build()); populateHeaders(httpGet, customHeaders); HttpClient httpClient = HttpClientBuilder.create().build(); HttpResponse httpResponse = httpClient.execute(httpGet); int statusCode = httpResponse.getStatusLine().getStatusCode(); if (isErrorStatus(statusCode)) { String jsonErrorResponse = EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8); throw new HTTPException(statusCode, httpResponse.getStatusLine().getReasonPhrase(), jsonErrorResponse); } return EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8); }
java
public static String get(String url, Map<String, String> customHeaders, Map<String, String> params) throws URISyntaxException, IOException, HTTPException { LOGGER.log(Level.INFO, "Sending GET request to the url {0}", url); URIBuilder uriBuilder = new URIBuilder(url); if (params != null && params.size() > 0) { for (Map.Entry<String, String> param : params.entrySet()) { uriBuilder.setParameter(param.getKey(), param.getValue()); } } HttpGet httpGet = new HttpGet(uriBuilder.build()); populateHeaders(httpGet, customHeaders); HttpClient httpClient = HttpClientBuilder.create().build(); HttpResponse httpResponse = httpClient.execute(httpGet); int statusCode = httpResponse.getStatusLine().getStatusCode(); if (isErrorStatus(statusCode)) { String jsonErrorResponse = EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8); throw new HTTPException(statusCode, httpResponse.getStatusLine().getReasonPhrase(), jsonErrorResponse); } return EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8); }
[ "public", "static", "String", "get", "(", "String", "url", ",", "Map", "<", "String", ",", "String", ">", "customHeaders", ",", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "URISyntaxException", ",", "IOException", ",", "HTTPException", "{", "LOGGER", ".", "log", "(", "Level", ".", "INFO", ",", "\"Sending GET request to the url {0}\"", ",", "url", ")", ";", "URIBuilder", "uriBuilder", "=", "new", "URIBuilder", "(", "url", ")", ";", "if", "(", "params", "!=", "null", "&&", "params", ".", "size", "(", ")", ">", "0", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "param", ":", "params", ".", "entrySet", "(", ")", ")", "{", "uriBuilder", ".", "setParameter", "(", "param", ".", "getKey", "(", ")", ",", "param", ".", "getValue", "(", ")", ")", ";", "}", "}", "HttpGet", "httpGet", "=", "new", "HttpGet", "(", "uriBuilder", ".", "build", "(", ")", ")", ";", "populateHeaders", "(", "httpGet", ",", "customHeaders", ")", ";", "HttpClient", "httpClient", "=", "HttpClientBuilder", ".", "create", "(", ")", ".", "build", "(", ")", ";", "HttpResponse", "httpResponse", "=", "httpClient", ".", "execute", "(", "httpGet", ")", ";", "int", "statusCode", "=", "httpResponse", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", ";", "if", "(", "isErrorStatus", "(", "statusCode", ")", ")", "{", "String", "jsonErrorResponse", "=", "EntityUtils", ".", "toString", "(", "httpResponse", ".", "getEntity", "(", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "throw", "new", "HTTPException", "(", "statusCode", ",", "httpResponse", ".", "getStatusLine", "(", ")", ".", "getReasonPhrase", "(", ")", ",", "jsonErrorResponse", ")", ";", "}", "return", "EntityUtils", ".", "toString", "(", "httpResponse", ".", "getEntity", "(", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "}" ]
Send get request. @param url the url @param customHeaders the customHeaders @param params the params @return the string @throws URISyntaxException the uri syntax exception @throws IOException the io exception
[ "Send", "get", "request", "." ]
7b1bf5edb6ade1f1b816a7db1262ef09f7d5273a
https://github.com/Instamojo/instamojo-java/blob/7b1bf5edb6ade1f1b816a7db1262ef09f7d5273a/src/main/java/com/instamojo/wrapper/util/HttpUtils.java#L54-L80
164,507
Instamojo/instamojo-java
src/main/java/com/instamojo/wrapper/util/HttpUtils.java
HttpUtils.post
public static String post(String url, Map<String, String> customHeaders, Map<String, String> params) throws IOException, HTTPException { LOGGER.log(Level.INFO, "Sending POST request to the url {0}", url); HttpPost httpPost = new HttpPost(url); populateHeaders(httpPost, customHeaders); if (params != null && params.size() > 0) { List<NameValuePair> nameValuePairs = new ArrayList<>(); for (Map.Entry<String, String> param : params.entrySet()) { nameValuePairs.add(new BasicNameValuePair(param.getKey(), param.getValue())); } httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); } HttpClient httpClient = HttpClientBuilder.create().build(); HttpResponse httpResponse = httpClient.execute(httpPost); int statusCode = httpResponse.getStatusLine().getStatusCode(); if (isErrorStatus(statusCode)) { String jsonErrorResponse = EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8); throw new HTTPException(statusCode, httpResponse.getStatusLine().getReasonPhrase(), jsonErrorResponse); } return EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8); }
java
public static String post(String url, Map<String, String> customHeaders, Map<String, String> params) throws IOException, HTTPException { LOGGER.log(Level.INFO, "Sending POST request to the url {0}", url); HttpPost httpPost = new HttpPost(url); populateHeaders(httpPost, customHeaders); if (params != null && params.size() > 0) { List<NameValuePair> nameValuePairs = new ArrayList<>(); for (Map.Entry<String, String> param : params.entrySet()) { nameValuePairs.add(new BasicNameValuePair(param.getKey(), param.getValue())); } httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); } HttpClient httpClient = HttpClientBuilder.create().build(); HttpResponse httpResponse = httpClient.execute(httpPost); int statusCode = httpResponse.getStatusLine().getStatusCode(); if (isErrorStatus(statusCode)) { String jsonErrorResponse = EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8); throw new HTTPException(statusCode, httpResponse.getStatusLine().getReasonPhrase(), jsonErrorResponse); } return EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8); }
[ "public", "static", "String", "post", "(", "String", "url", ",", "Map", "<", "String", ",", "String", ">", "customHeaders", ",", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "IOException", ",", "HTTPException", "{", "LOGGER", ".", "log", "(", "Level", ".", "INFO", ",", "\"Sending POST request to the url {0}\"", ",", "url", ")", ";", "HttpPost", "httpPost", "=", "new", "HttpPost", "(", "url", ")", ";", "populateHeaders", "(", "httpPost", ",", "customHeaders", ")", ";", "if", "(", "params", "!=", "null", "&&", "params", ".", "size", "(", ")", ">", "0", ")", "{", "List", "<", "NameValuePair", ">", "nameValuePairs", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "param", ":", "params", ".", "entrySet", "(", ")", ")", "{", "nameValuePairs", ".", "add", "(", "new", "BasicNameValuePair", "(", "param", ".", "getKey", "(", ")", ",", "param", ".", "getValue", "(", ")", ")", ")", ";", "}", "httpPost", ".", "setEntity", "(", "new", "UrlEncodedFormEntity", "(", "nameValuePairs", ")", ")", ";", "}", "HttpClient", "httpClient", "=", "HttpClientBuilder", ".", "create", "(", ")", ".", "build", "(", ")", ";", "HttpResponse", "httpResponse", "=", "httpClient", ".", "execute", "(", "httpPost", ")", ";", "int", "statusCode", "=", "httpResponse", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", ";", "if", "(", "isErrorStatus", "(", "statusCode", ")", ")", "{", "String", "jsonErrorResponse", "=", "EntityUtils", ".", "toString", "(", "httpResponse", ".", "getEntity", "(", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "throw", "new", "HTTPException", "(", "statusCode", ",", "httpResponse", ".", "getStatusLine", "(", ")", ".", "getReasonPhrase", "(", ")", ",", "jsonErrorResponse", ")", ";", "}", "return", "EntityUtils", ".", "toString", "(", "httpResponse", ".", "getEntity", "(", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "}" ]
Send post request. @param url the url @param customHeaders the customHeaders @param params the params @return the string @throws IOException the io exception
[ "Send", "post", "request", "." ]
7b1bf5edb6ade1f1b816a7db1262ef09f7d5273a
https://github.com/Instamojo/instamojo-java/blob/7b1bf5edb6ade1f1b816a7db1262ef09f7d5273a/src/main/java/com/instamojo/wrapper/util/HttpUtils.java#L91-L117
164,508
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/internal/TransitionController.java
TransitionController.reverse
public T reverse() { String id = getId(); String REVERSE = "_REVERSE"; if (id.endsWith(REVERSE)) { setId(id.substring(0, id.length() - REVERSE.length())); } float start = mStart; float end = mEnd; mStart = end; mEnd = start; mReverse = !mReverse; return self(); }
java
public T reverse() { String id = getId(); String REVERSE = "_REVERSE"; if (id.endsWith(REVERSE)) { setId(id.substring(0, id.length() - REVERSE.length())); } float start = mStart; float end = mEnd; mStart = end; mEnd = start; mReverse = !mReverse; return self(); }
[ "public", "T", "reverse", "(", ")", "{", "String", "id", "=", "getId", "(", ")", ";", "String", "REVERSE", "=", "\"_REVERSE\"", ";", "if", "(", "id", ".", "endsWith", "(", "REVERSE", ")", ")", "{", "setId", "(", "id", ".", "substring", "(", "0", ",", "id", ".", "length", "(", ")", "-", "REVERSE", ".", "length", "(", ")", ")", ")", ";", "}", "float", "start", "=", "mStart", ";", "float", "end", "=", "mEnd", ";", "mStart", "=", "end", ";", "mEnd", "=", "start", ";", "mReverse", "=", "!", "mReverse", ";", "return", "self", "(", ")", ";", "}" ]
Reverse how the transition is applied, such that the transition previously performed when progress=start of range is only performed when progress=end of range @return
[ "Reverse", "how", "the", "transition", "is", "applied", "such", "that", "the", "transition", "previously", "performed", "when", "progress", "=", "start", "of", "range", "is", "only", "performed", "when", "progress", "=", "end", "of", "range" ]
7b53074206622f5cf5d82091d891a7ed8b9f06cd
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/internal/TransitionController.java#L125-L138
164,509
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/AbstractTransitionBuilder.java
AbstractTransitionBuilder.transitFloat
public T transitFloat(int propertyId, float... vals) { String property = getPropertyName(propertyId); mHolders.put(propertyId, PropertyValuesHolder.ofFloat(property, vals)); mShadowHolders.put(propertyId, ShadowValuesHolder.ofFloat(property, vals)); return self(); }
java
public T transitFloat(int propertyId, float... vals) { String property = getPropertyName(propertyId); mHolders.put(propertyId, PropertyValuesHolder.ofFloat(property, vals)); mShadowHolders.put(propertyId, ShadowValuesHolder.ofFloat(property, vals)); return self(); }
[ "public", "T", "transitFloat", "(", "int", "propertyId", ",", "float", "...", "vals", ")", "{", "String", "property", "=", "getPropertyName", "(", "propertyId", ")", ";", "mHolders", ".", "put", "(", "propertyId", ",", "PropertyValuesHolder", ".", "ofFloat", "(", "property", ",", "vals", ")", ")", ";", "mShadowHolders", ".", "put", "(", "propertyId", ",", "ShadowValuesHolder", ".", "ofFloat", "(", "property", ",", "vals", ")", ")", ";", "return", "self", "(", ")", ";", "}" ]
Transits a float propertyId from the start value to the end value. @param propertyId @param vals @return self
[ "Transits", "a", "float", "propertyId", "from", "the", "start", "value", "to", "the", "end", "value", "." ]
7b53074206622f5cf5d82091d891a7ed8b9f06cd
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/AbstractTransitionBuilder.java#L642-L647
164,510
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/AbstractTransitionBuilder.java
AbstractTransitionBuilder.transitInt
public T transitInt(int propertyId, int... vals) { String property = getPropertyName(propertyId); mHolders.put(propertyId, PropertyValuesHolder.ofInt(property, vals)); mShadowHolders.put(propertyId, ShadowValuesHolder.ofInt(property, vals)); return self(); }
java
public T transitInt(int propertyId, int... vals) { String property = getPropertyName(propertyId); mHolders.put(propertyId, PropertyValuesHolder.ofInt(property, vals)); mShadowHolders.put(propertyId, ShadowValuesHolder.ofInt(property, vals)); return self(); }
[ "public", "T", "transitInt", "(", "int", "propertyId", ",", "int", "...", "vals", ")", "{", "String", "property", "=", "getPropertyName", "(", "propertyId", ")", ";", "mHolders", ".", "put", "(", "propertyId", ",", "PropertyValuesHolder", ".", "ofInt", "(", "property", ",", "vals", ")", ")", ";", "mShadowHolders", ".", "put", "(", "propertyId", ",", "ShadowValuesHolder", ".", "ofInt", "(", "property", ",", "vals", ")", ")", ";", "return", "self", "(", ")", ";", "}" ]
Transits a float property from the start value to the end value. @param propertyId @param vals @return self
[ "Transits", "a", "float", "property", "from", "the", "start", "value", "to", "the", "end", "value", "." ]
7b53074206622f5cf5d82091d891a7ed8b9f06cd
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/AbstractTransitionBuilder.java#L656-L661
164,511
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/AbstractTransition.java
AbstractTransition.isCompatible
@CheckResult public boolean isCompatible(AbstractTransition another) { if (getClass().equals(another.getClass()) && mTarget == another.mTarget && mReverse == another.mReverse && ((mInterpolator == null && another.mInterpolator == null) || mInterpolator.getClass().equals(another.mInterpolator.getClass()))) { return true; } return false; }
java
@CheckResult public boolean isCompatible(AbstractTransition another) { if (getClass().equals(another.getClass()) && mTarget == another.mTarget && mReverse == another.mReverse && ((mInterpolator == null && another.mInterpolator == null) || mInterpolator.getClass().equals(another.mInterpolator.getClass()))) { return true; } return false; }
[ "@", "CheckResult", "public", "boolean", "isCompatible", "(", "AbstractTransition", "another", ")", "{", "if", "(", "getClass", "(", ")", ".", "equals", "(", "another", ".", "getClass", "(", ")", ")", "&&", "mTarget", "==", "another", ".", "mTarget", "&&", "mReverse", "==", "another", ".", "mReverse", "&&", "(", "(", "mInterpolator", "==", "null", "&&", "another", ".", "mInterpolator", "==", "null", ")", "||", "mInterpolator", ".", "getClass", "(", ")", ".", "equals", "(", "another", ".", "mInterpolator", ".", "getClass", "(", ")", ")", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Checks to see if another AbstractTransition's states is isCompatible for merging. @param another @return
[ "Checks", "to", "see", "if", "another", "AbstractTransition", "s", "states", "is", "isCompatible", "for", "merging", "." ]
7b53074206622f5cf5d82091d891a7ed8b9f06cd
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/AbstractTransition.java#L140-L147
164,512
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/AbstractTransition.java
AbstractTransition.merge
public boolean merge(AbstractTransition another) { if (!isCompatible(another)) { return false; } if (another.mId != null) { if (mId == null) { mId = another.mId; } else { StringBuilder sb = new StringBuilder(mId.length() + another.mId.length()); sb.append(mId); sb.append("_MERGED_"); sb.append(another.mId); mId = sb.toString(); } } mUpdateStateAfterUpdateProgress |= another.mUpdateStateAfterUpdateProgress; mSetupList.addAll(another.mSetupList); Collections.sort(mSetupList, new Comparator<S>() { @Override public int compare(S lhs, S rhs) { if (lhs instanceof AbstractTransitionBuilder && rhs instanceof AbstractTransitionBuilder) { AbstractTransitionBuilder left = (AbstractTransitionBuilder) lhs; AbstractTransitionBuilder right = (AbstractTransitionBuilder) rhs; float startLeft = left.mReverse ? left.mEnd : left.mStart; float startRight = right.mReverse ? right.mEnd : right.mStart; return (int) ((startRight - startLeft) * 1000); } return 0; } }); return true; }
java
public boolean merge(AbstractTransition another) { if (!isCompatible(another)) { return false; } if (another.mId != null) { if (mId == null) { mId = another.mId; } else { StringBuilder sb = new StringBuilder(mId.length() + another.mId.length()); sb.append(mId); sb.append("_MERGED_"); sb.append(another.mId); mId = sb.toString(); } } mUpdateStateAfterUpdateProgress |= another.mUpdateStateAfterUpdateProgress; mSetupList.addAll(another.mSetupList); Collections.sort(mSetupList, new Comparator<S>() { @Override public int compare(S lhs, S rhs) { if (lhs instanceof AbstractTransitionBuilder && rhs instanceof AbstractTransitionBuilder) { AbstractTransitionBuilder left = (AbstractTransitionBuilder) lhs; AbstractTransitionBuilder right = (AbstractTransitionBuilder) rhs; float startLeft = left.mReverse ? left.mEnd : left.mStart; float startRight = right.mReverse ? right.mEnd : right.mStart; return (int) ((startRight - startLeft) * 1000); } return 0; } }); return true; }
[ "public", "boolean", "merge", "(", "AbstractTransition", "another", ")", "{", "if", "(", "!", "isCompatible", "(", "another", ")", ")", "{", "return", "false", ";", "}", "if", "(", "another", ".", "mId", "!=", "null", ")", "{", "if", "(", "mId", "==", "null", ")", "{", "mId", "=", "another", ".", "mId", ";", "}", "else", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "mId", ".", "length", "(", ")", "+", "another", ".", "mId", ".", "length", "(", ")", ")", ";", "sb", ".", "append", "(", "mId", ")", ";", "sb", ".", "append", "(", "\"_MERGED_\"", ")", ";", "sb", ".", "append", "(", "another", ".", "mId", ")", ";", "mId", "=", "sb", ".", "toString", "(", ")", ";", "}", "}", "mUpdateStateAfterUpdateProgress", "|=", "another", ".", "mUpdateStateAfterUpdateProgress", ";", "mSetupList", ".", "addAll", "(", "another", ".", "mSetupList", ")", ";", "Collections", ".", "sort", "(", "mSetupList", ",", "new", "Comparator", "<", "S", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "S", "lhs", ",", "S", "rhs", ")", "{", "if", "(", "lhs", "instanceof", "AbstractTransitionBuilder", "&&", "rhs", "instanceof", "AbstractTransitionBuilder", ")", "{", "AbstractTransitionBuilder", "left", "=", "(", "AbstractTransitionBuilder", ")", "lhs", ";", "AbstractTransitionBuilder", "right", "=", "(", "AbstractTransitionBuilder", ")", "rhs", ";", "float", "startLeft", "=", "left", ".", "mReverse", "?", "left", ".", "mEnd", ":", "left", ".", "mStart", ";", "float", "startRight", "=", "right", ".", "mReverse", "?", "right", ".", "mEnd", ":", "right", ".", "mStart", ";", "return", "(", "int", ")", "(", "(", "startRight", "-", "startLeft", ")", "*", "1000", ")", ";", "}", "return", "0", ";", "}", "}", ")", ";", "return", "true", ";", "}" ]
Merge another AbstractTransition's states into this object, such that the other AbstractTransition can be discarded. @param another @return true if the merge is successful.
[ "Merge", "another", "AbstractTransition", "s", "states", "into", "this", "object", "such", "that", "the", "other", "AbstractTransition", "can", "be", "discarded", "." ]
7b53074206622f5cf5d82091d891a7ed8b9f06cd
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/AbstractTransition.java#L156-L188
164,513
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/animation/AnimationManager.java
AnimationManager.removeAllAnimations
public void removeAllAnimations() { for (int i = 0, size = mAnimationList.size(); i < size; i++) { mAnimationList.get(i).removeAnimationListener(mAnimationListener); } mAnimationList.clear(); }
java
public void removeAllAnimations() { for (int i = 0, size = mAnimationList.size(); i < size; i++) { mAnimationList.get(i).removeAnimationListener(mAnimationListener); } mAnimationList.clear(); }
[ "public", "void", "removeAllAnimations", "(", ")", "{", "for", "(", "int", "i", "=", "0", ",", "size", "=", "mAnimationList", ".", "size", "(", ")", ";", "i", "<", "size", ";", "i", "++", ")", "{", "mAnimationList", ".", "get", "(", "i", ")", ".", "removeAnimationListener", "(", "mAnimationListener", ")", ";", "}", "mAnimationList", ".", "clear", "(", ")", ";", "}" ]
Stops and clears all transitions
[ "Stops", "and", "clears", "all", "transitions" ]
7b53074206622f5cf5d82091d891a7ed8b9f06cd
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/animation/AnimationManager.java#L123-L128
164,514
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/DefaultTransitionManager.java
DefaultTransitionManager.stopTransition
@Override public void stopTransition() { //call listeners so they can perform their actions first, like modifying this adapter's transitions for (int i = 0, size = mListenerList.size(); i < size; i++) { mListenerList.get(i).onTransitionEnd(this); } for (int i = 0, size = mTransitionList.size(); i < size; i++) { mTransitionList.get(i).stopTransition(); } }
java
@Override public void stopTransition() { //call listeners so they can perform their actions first, like modifying this adapter's transitions for (int i = 0, size = mListenerList.size(); i < size; i++) { mListenerList.get(i).onTransitionEnd(this); } for (int i = 0, size = mTransitionList.size(); i < size; i++) { mTransitionList.get(i).stopTransition(); } }
[ "@", "Override", "public", "void", "stopTransition", "(", ")", "{", "//call listeners so they can perform their actions first, like modifying this adapter's transitions", "for", "(", "int", "i", "=", "0", ",", "size", "=", "mListenerList", ".", "size", "(", ")", ";", "i", "<", "size", ";", "i", "++", ")", "{", "mListenerList", ".", "get", "(", "i", ")", ".", "onTransitionEnd", "(", "this", ")", ";", "}", "for", "(", "int", "i", "=", "0", ",", "size", "=", "mTransitionList", ".", "size", "(", ")", ";", "i", "<", "size", ";", "i", "++", ")", "{", "mTransitionList", ".", "get", "(", "i", ")", ".", "stopTransition", "(", ")", ";", "}", "}" ]
Stops all transitions.
[ "Stops", "all", "transitions", "." ]
7b53074206622f5cf5d82091d891a7ed8b9f06cd
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/DefaultTransitionManager.java#L137-L147
164,515
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/internal/TransitionControllerManager.java
TransitionControllerManager.start
public void start() { if (TransitionConfig.isDebug()) { getTransitionStateHolder().start(); } mLastProgress = Float.MIN_VALUE; TransitionController transitionController; for (int i = 0, size = mTransitionControls.size(); i < size; i++) { transitionController = mTransitionControls.get(i); if (mInterpolator != null) { transitionController.setInterpolator(mInterpolator); } //required for ViewPager transitions to work if (mTarget != null) { transitionController.setTarget(mTarget); } transitionController.setUpdateStateAfterUpdateProgress(mUpdateStateAfterUpdateProgress); transitionController.start(); } }
java
public void start() { if (TransitionConfig.isDebug()) { getTransitionStateHolder().start(); } mLastProgress = Float.MIN_VALUE; TransitionController transitionController; for (int i = 0, size = mTransitionControls.size(); i < size; i++) { transitionController = mTransitionControls.get(i); if (mInterpolator != null) { transitionController.setInterpolator(mInterpolator); } //required for ViewPager transitions to work if (mTarget != null) { transitionController.setTarget(mTarget); } transitionController.setUpdateStateAfterUpdateProgress(mUpdateStateAfterUpdateProgress); transitionController.start(); } }
[ "public", "void", "start", "(", ")", "{", "if", "(", "TransitionConfig", ".", "isDebug", "(", ")", ")", "{", "getTransitionStateHolder", "(", ")", ".", "start", "(", ")", ";", "}", "mLastProgress", "=", "Float", ".", "MIN_VALUE", ";", "TransitionController", "transitionController", ";", "for", "(", "int", "i", "=", "0", ",", "size", "=", "mTransitionControls", ".", "size", "(", ")", ";", "i", "<", "size", ";", "i", "++", ")", "{", "transitionController", "=", "mTransitionControls", ".", "get", "(", "i", ")", ";", "if", "(", "mInterpolator", "!=", "null", ")", "{", "transitionController", ".", "setInterpolator", "(", "mInterpolator", ")", ";", "}", "//required for ViewPager transitions to work", "if", "(", "mTarget", "!=", "null", ")", "{", "transitionController", ".", "setTarget", "(", "mTarget", ")", ";", "}", "transitionController", ".", "setUpdateStateAfterUpdateProgress", "(", "mUpdateStateAfterUpdateProgress", ")", ";", "transitionController", ".", "start", "(", ")", ";", "}", "}" ]
Starts the transition
[ "Starts", "the", "transition" ]
7b53074206622f5cf5d82091d891a7ed8b9f06cd
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/internal/TransitionControllerManager.java#L100-L120
164,516
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/internal/TransitionControllerManager.java
TransitionControllerManager.end
public void end() { if (TransitionConfig.isPrintDebug()) { getTransitionStateHolder().end(); getTransitionStateHolder().print(); } for (int i = 0, size = mTransitionControls.size(); i < size; i++) { mTransitionControls.get(i).end(); } }
java
public void end() { if (TransitionConfig.isPrintDebug()) { getTransitionStateHolder().end(); getTransitionStateHolder().print(); } for (int i = 0, size = mTransitionControls.size(); i < size; i++) { mTransitionControls.get(i).end(); } }
[ "public", "void", "end", "(", ")", "{", "if", "(", "TransitionConfig", ".", "isPrintDebug", "(", ")", ")", "{", "getTransitionStateHolder", "(", ")", ".", "end", "(", ")", ";", "getTransitionStateHolder", "(", ")", ".", "print", "(", ")", ";", "}", "for", "(", "int", "i", "=", "0", ",", "size", "=", "mTransitionControls", ".", "size", "(", ")", ";", "i", "<", "size", ";", "i", "++", ")", "{", "mTransitionControls", ".", "get", "(", "i", ")", ".", "end", "(", ")", ";", "}", "}" ]
Ends the transition
[ "Ends", "the", "transition" ]
7b53074206622f5cf5d82091d891a7ed8b9f06cd
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/internal/TransitionControllerManager.java#L133-L142
164,517
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/internal/TransitionControllerManager.java
TransitionControllerManager.reverse
public void reverse() { for (int i = 0, size = mTransitionControls.size(); i < size; i++) { mTransitionControls.get(i).reverse(); } }
java
public void reverse() { for (int i = 0, size = mTransitionControls.size(); i < size; i++) { mTransitionControls.get(i).reverse(); } }
[ "public", "void", "reverse", "(", ")", "{", "for", "(", "int", "i", "=", "0", ",", "size", "=", "mTransitionControls", ".", "size", "(", ")", ";", "i", "<", "size", ";", "i", "++", ")", "{", "mTransitionControls", ".", "get", "(", "i", ")", ".", "reverse", "(", ")", ";", "}", "}" ]
Reverses all the TransitionControllers managed by this TransitionManager
[ "Reverses", "all", "the", "TransitionControllers", "managed", "by", "this", "TransitionManager" ]
7b53074206622f5cf5d82091d891a7ed8b9f06cd
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/internal/TransitionControllerManager.java#L206-L210
164,518
wildfly-extras/wildfly-camel
subsystem/security/src/main/java/org/wildfly/extension/camel/security/LoginContextBuilder.java
LoginContextBuilder.getClientLoginContext
private LoginContext getClientLoginContext() throws LoginException { Configuration config = new Configuration() { @Override public AppConfigurationEntry[] getAppConfigurationEntry(String name) { Map<String, String> options = new HashMap<String, String>(); options.put("multi-threaded", "true"); options.put("restore-login-identity", "true"); AppConfigurationEntry clmEntry = new AppConfigurationEntry(ClientLoginModule.class.getName(), LoginModuleControlFlag.REQUIRED, options); return new AppConfigurationEntry[] { clmEntry }; } }; return getLoginContext(config); }
java
private LoginContext getClientLoginContext() throws LoginException { Configuration config = new Configuration() { @Override public AppConfigurationEntry[] getAppConfigurationEntry(String name) { Map<String, String> options = new HashMap<String, String>(); options.put("multi-threaded", "true"); options.put("restore-login-identity", "true"); AppConfigurationEntry clmEntry = new AppConfigurationEntry(ClientLoginModule.class.getName(), LoginModuleControlFlag.REQUIRED, options); return new AppConfigurationEntry[] { clmEntry }; } }; return getLoginContext(config); }
[ "private", "LoginContext", "getClientLoginContext", "(", ")", "throws", "LoginException", "{", "Configuration", "config", "=", "new", "Configuration", "(", ")", "{", "@", "Override", "public", "AppConfigurationEntry", "[", "]", "getAppConfigurationEntry", "(", "String", "name", ")", "{", "Map", "<", "String", ",", "String", ">", "options", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "options", ".", "put", "(", "\"multi-threaded\"", ",", "\"true\"", ")", ";", "options", ".", "put", "(", "\"restore-login-identity\"", ",", "\"true\"", ")", ";", "AppConfigurationEntry", "clmEntry", "=", "new", "AppConfigurationEntry", "(", "ClientLoginModule", ".", "class", ".", "getName", "(", ")", ",", "LoginModuleControlFlag", ".", "REQUIRED", ",", "options", ")", ";", "return", "new", "AppConfigurationEntry", "[", "]", "{", "clmEntry", "}", ";", "}", "}", ";", "return", "getLoginContext", "(", "config", ")", ";", "}" ]
Provides a RunAs client login context
[ "Provides", "a", "RunAs", "client", "login", "context" ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/subsystem/security/src/main/java/org/wildfly/extension/camel/security/LoginContextBuilder.java#L101-L114
164,519
wildfly-extras/wildfly-camel
config/src/main/java/org/wildfly/extras/config/internal/Main.java
Main.mainInternal
public static void mainInternal(String[] args) throws Exception { Options options = new Options(); CmdLineParser parser = new CmdLineParser(options); try { parser.parseArgument(args); } catch (CmdLineException e) { helpScreen(parser); return; } try { List<String> configs = new ArrayList<>(); if (options.configs != null) { configs.addAll(Arrays.asList(options.configs.split(","))); } ConfigSupport.applyConfigChange(ConfigSupport.getJBossHome(), configs, options.enable); } catch (ConfigException ex) { ConfigLogger.error(ex); throw ex; } catch (Throwable th) { ConfigLogger.error(th); throw th; } }
java
public static void mainInternal(String[] args) throws Exception { Options options = new Options(); CmdLineParser parser = new CmdLineParser(options); try { parser.parseArgument(args); } catch (CmdLineException e) { helpScreen(parser); return; } try { List<String> configs = new ArrayList<>(); if (options.configs != null) { configs.addAll(Arrays.asList(options.configs.split(","))); } ConfigSupport.applyConfigChange(ConfigSupport.getJBossHome(), configs, options.enable); } catch (ConfigException ex) { ConfigLogger.error(ex); throw ex; } catch (Throwable th) { ConfigLogger.error(th); throw th; } }
[ "public", "static", "void", "mainInternal", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "Options", "options", "=", "new", "Options", "(", ")", ";", "CmdLineParser", "parser", "=", "new", "CmdLineParser", "(", "options", ")", ";", "try", "{", "parser", ".", "parseArgument", "(", "args", ")", ";", "}", "catch", "(", "CmdLineException", "e", ")", "{", "helpScreen", "(", "parser", ")", ";", "return", ";", "}", "try", "{", "List", "<", "String", ">", "configs", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "options", ".", "configs", "!=", "null", ")", "{", "configs", ".", "addAll", "(", "Arrays", ".", "asList", "(", "options", ".", "configs", ".", "split", "(", "\",\"", ")", ")", ")", ";", "}", "ConfigSupport", ".", "applyConfigChange", "(", "ConfigSupport", ".", "getJBossHome", "(", ")", ",", "configs", ",", "options", ".", "enable", ")", ";", "}", "catch", "(", "ConfigException", "ex", ")", "{", "ConfigLogger", ".", "error", "(", "ex", ")", ";", "throw", "ex", ";", "}", "catch", "(", "Throwable", "th", ")", "{", "ConfigLogger", ".", "error", "(", "th", ")", ";", "throw", "th", ";", "}", "}" ]
Entry point with no system exit
[ "Entry", "point", "with", "no", "system", "exit" ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/config/src/main/java/org/wildfly/extras/config/internal/Main.java#L42-L66
164,520
wildfly-extras/wildfly-camel
common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java
IllegalStateAssertion.assertNull
public static <T> T assertNull(T value, String message) { if (value != null) throw new IllegalStateException(message); return value; }
java
public static <T> T assertNull(T value, String message) { if (value != null) throw new IllegalStateException(message); return value; }
[ "public", "static", "<", "T", ">", "T", "assertNull", "(", "T", "value", ",", "String", "message", ")", "{", "if", "(", "value", "!=", "null", ")", "throw", "new", "IllegalStateException", "(", "message", ")", ";", "return", "value", ";", "}" ]
Throws an IllegalStateException when the given value is not null. @return the value
[ "Throws", "an", "IllegalStateException", "when", "the", "given", "value", "is", "not", "null", "." ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java#L38-L42
164,521
wildfly-extras/wildfly-camel
common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java
IllegalStateAssertion.assertNotNull
public static <T> T assertNotNull(T value, String message) { if (value == null) throw new IllegalStateException(message); return value; }
java
public static <T> T assertNotNull(T value, String message) { if (value == null) throw new IllegalStateException(message); return value; }
[ "public", "static", "<", "T", ">", "T", "assertNotNull", "(", "T", "value", ",", "String", "message", ")", "{", "if", "(", "value", "==", "null", ")", "throw", "new", "IllegalStateException", "(", "message", ")", ";", "return", "value", ";", "}" ]
Throws an IllegalStateException when the given value is null. @return the value
[ "Throws", "an", "IllegalStateException", "when", "the", "given", "value", "is", "null", "." ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java#L48-L52
164,522
wildfly-extras/wildfly-camel
common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java
IllegalStateAssertion.assertTrue
public static Boolean assertTrue(Boolean value, String message) { if (!Boolean.valueOf(value)) throw new IllegalStateException(message); return value; }
java
public static Boolean assertTrue(Boolean value, String message) { if (!Boolean.valueOf(value)) throw new IllegalStateException(message); return value; }
[ "public", "static", "Boolean", "assertTrue", "(", "Boolean", "value", ",", "String", "message", ")", "{", "if", "(", "!", "Boolean", ".", "valueOf", "(", "value", ")", ")", "throw", "new", "IllegalStateException", "(", "message", ")", ";", "return", "value", ";", "}" ]
Throws an IllegalStateException when the given value is not true.
[ "Throws", "an", "IllegalStateException", "when", "the", "given", "value", "is", "not", "true", "." ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java#L57-L62
164,523
wildfly-extras/wildfly-camel
common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java
IllegalStateAssertion.assertFalse
public static Boolean assertFalse(Boolean value, String message) { if (Boolean.valueOf(value)) throw new IllegalStateException(message); return value; }
java
public static Boolean assertFalse(Boolean value, String message) { if (Boolean.valueOf(value)) throw new IllegalStateException(message); return value; }
[ "public", "static", "Boolean", "assertFalse", "(", "Boolean", "value", ",", "String", "message", ")", "{", "if", "(", "Boolean", ".", "valueOf", "(", "value", ")", ")", "throw", "new", "IllegalStateException", "(", "message", ")", ";", "return", "value", ";", "}" ]
Throws an IllegalStateException when the given value is not false.
[ "Throws", "an", "IllegalStateException", "when", "the", "given", "value", "is", "not", "false", "." ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java#L67-L71
164,524
wildfly-extras/wildfly-camel
config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java
IllegalArgumentAssertion.assertNotNull
public static <T> T assertNotNull(T value, String name) { if (value == null) throw new IllegalArgumentException("Null " + name); return value; }
java
public static <T> T assertNotNull(T value, String name) { if (value == null) throw new IllegalArgumentException("Null " + name); return value; }
[ "public", "static", "<", "T", ">", "T", "assertNotNull", "(", "T", "value", ",", "String", "name", ")", "{", "if", "(", "value", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Null \"", "+", "name", ")", ";", "return", "value", ";", "}" ]
Throws an IllegalArgumentException when the given value is null. @param value the value to assert if not null @param name the name of the argument @param <T> The generic type of the value to assert if not null @return the value
[ "Throws", "an", "IllegalArgumentException", "when", "the", "given", "value", "is", "null", "." ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java#L41-L46
164,525
wildfly-extras/wildfly-camel
config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java
IllegalArgumentAssertion.assertTrue
public static Boolean assertTrue(Boolean value, String message) { if (!Boolean.valueOf(value)) throw new IllegalArgumentException(message); return value; }
java
public static Boolean assertTrue(Boolean value, String message) { if (!Boolean.valueOf(value)) throw new IllegalArgumentException(message); return value; }
[ "public", "static", "Boolean", "assertTrue", "(", "Boolean", "value", ",", "String", "message", ")", "{", "if", "(", "!", "Boolean", ".", "valueOf", "(", "value", ")", ")", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "return", "value", ";", "}" ]
Throws an IllegalArgumentException when the given value is not true. @param value the value to assert if true @param message the message to display if the value is false @return the value
[ "Throws", "an", "IllegalArgumentException", "when", "the", "given", "value", "is", "not", "true", "." ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java#L54-L58
164,526
wildfly-extras/wildfly-camel
config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java
IllegalArgumentAssertion.assertFalse
public static Boolean assertFalse(Boolean value, String message) { if (Boolean.valueOf(value)) throw new IllegalArgumentException(message); return value; }
java
public static Boolean assertFalse(Boolean value, String message) { if (Boolean.valueOf(value)) throw new IllegalArgumentException(message); return value; }
[ "public", "static", "Boolean", "assertFalse", "(", "Boolean", "value", ",", "String", "message", ")", "{", "if", "(", "Boolean", ".", "valueOf", "(", "value", ")", ")", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "return", "value", ";", "}" ]
Throws an IllegalArgumentException when the given value is not false. @param value the value to assert if false @param message the message to display if the value is false @return the value
[ "Throws", "an", "IllegalArgumentException", "when", "the", "given", "value", "is", "not", "false", "." ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java#L66-L70
164,527
wildfly-extras/wildfly-camel
cxfhttp/src/main/java/org/apache/cxf/transport/undertow/UndertowHTTPDestination.java
UndertowHTTPDestination.retrieveEngine
public void retrieveEngine() throws GeneralSecurityException, IOException { if (serverEngineFactory == null) { return; } engine = serverEngineFactory.retrieveHTTPServerEngine(nurl.getPort()); if (engine == null) { engine = serverEngineFactory.getHTTPServerEngine(nurl.getHost(), nurl.getPort(), nurl.getProtocol()); } assert engine != null; TLSServerParameters serverParameters = engine.getTlsServerParameters(); if (serverParameters != null && serverParameters.getCertConstraints() != null) { CertificateConstraintsType constraints = serverParameters.getCertConstraints(); if (constraints != null) { certConstraints = CertConstraintsJaxBUtils.createCertConstraints(constraints); } } // When configuring for "http", however, it is still possible that // Spring configuration has configured the port for https. if (!nurl.getProtocol().equals(engine.getProtocol())) { throw new IllegalStateException("Port " + engine.getPort() + " is configured with wrong protocol \"" + engine.getProtocol() + "\" for \"" + nurl + "\""); } }
java
public void retrieveEngine() throws GeneralSecurityException, IOException { if (serverEngineFactory == null) { return; } engine = serverEngineFactory.retrieveHTTPServerEngine(nurl.getPort()); if (engine == null) { engine = serverEngineFactory.getHTTPServerEngine(nurl.getHost(), nurl.getPort(), nurl.getProtocol()); } assert engine != null; TLSServerParameters serverParameters = engine.getTlsServerParameters(); if (serverParameters != null && serverParameters.getCertConstraints() != null) { CertificateConstraintsType constraints = serverParameters.getCertConstraints(); if (constraints != null) { certConstraints = CertConstraintsJaxBUtils.createCertConstraints(constraints); } } // When configuring for "http", however, it is still possible that // Spring configuration has configured the port for https. if (!nurl.getProtocol().equals(engine.getProtocol())) { throw new IllegalStateException("Port " + engine.getPort() + " is configured with wrong protocol \"" + engine.getProtocol() + "\" for \"" + nurl + "\""); } }
[ "public", "void", "retrieveEngine", "(", ")", "throws", "GeneralSecurityException", ",", "IOException", "{", "if", "(", "serverEngineFactory", "==", "null", ")", "{", "return", ";", "}", "engine", "=", "serverEngineFactory", ".", "retrieveHTTPServerEngine", "(", "nurl", ".", "getPort", "(", ")", ")", ";", "if", "(", "engine", "==", "null", ")", "{", "engine", "=", "serverEngineFactory", ".", "getHTTPServerEngine", "(", "nurl", ".", "getHost", "(", ")", ",", "nurl", ".", "getPort", "(", ")", ",", "nurl", ".", "getProtocol", "(", ")", ")", ";", "}", "assert", "engine", "!=", "null", ";", "TLSServerParameters", "serverParameters", "=", "engine", ".", "getTlsServerParameters", "(", ")", ";", "if", "(", "serverParameters", "!=", "null", "&&", "serverParameters", ".", "getCertConstraints", "(", ")", "!=", "null", ")", "{", "CertificateConstraintsType", "constraints", "=", "serverParameters", ".", "getCertConstraints", "(", ")", ";", "if", "(", "constraints", "!=", "null", ")", "{", "certConstraints", "=", "CertConstraintsJaxBUtils", ".", "createCertConstraints", "(", "constraints", ")", ";", "}", "}", "// When configuring for \"http\", however, it is still possible that", "// Spring configuration has configured the port for https.", "if", "(", "!", "nurl", ".", "getProtocol", "(", ")", ".", "equals", "(", "engine", ".", "getProtocol", "(", ")", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Port \"", "+", "engine", ".", "getPort", "(", ")", "+", "\" is configured with wrong protocol \\\"\"", "+", "engine", ".", "getProtocol", "(", ")", "+", "\"\\\" for \\\"\"", "+", "nurl", "+", "\"\\\"\"", ")", ";", "}", "}" ]
Post-configure retreival of server engine.
[ "Post", "-", "configure", "retreival", "of", "server", "engine", "." ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/cxfhttp/src/main/java/org/apache/cxf/transport/undertow/UndertowHTTPDestination.java#L82-L105
164,528
wildfly-extras/wildfly-camel
cxfhttp/src/main/java/org/apache/cxf/transport/undertow/UndertowHTTPDestination.java
UndertowHTTPDestination.finalizeConfig
public void finalizeConfig() { assert !configFinalized; try { retrieveEngine(); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } configFinalized = true; }
java
public void finalizeConfig() { assert !configFinalized; try { retrieveEngine(); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } configFinalized = true; }
[ "public", "void", "finalizeConfig", "(", ")", "{", "assert", "!", "configFinalized", ";", "try", "{", "retrieveEngine", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "configFinalized", "=", "true", ";", "}" ]
This method is used to finalize the configuration after the configuration items have been set.
[ "This", "method", "is", "used", "to", "finalize", "the", "configuration", "after", "the", "configuration", "items", "have", "been", "set", "." ]
9ebd7e28574f277a6d5b583e8a4c357e1538c370
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/cxfhttp/src/main/java/org/apache/cxf/transport/undertow/UndertowHTTPDestination.java#L112-L121
164,529
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/ReportMetadata.java
ReportMetadata.getStylesheetPath
public File getStylesheetPath() { String path = System.getProperty(STYLESHEET_KEY); return path == null ? null : new File(path); }
java
public File getStylesheetPath() { String path = System.getProperty(STYLESHEET_KEY); return path == null ? null : new File(path); }
[ "public", "File", "getStylesheetPath", "(", ")", "{", "String", "path", "=", "System", ".", "getProperty", "(", "STYLESHEET_KEY", ")", ";", "return", "path", "==", "null", "?", "null", ":", "new", "File", "(", "path", ")", ";", "}" ]
If a custom CSS file has been specified, returns the path. Otherwise returns null. @return A {@link File} pointing to the stylesheet, or null if no stylesheet is specified.
[ "If", "a", "custom", "CSS", "file", "has", "been", "specified", "returns", "the", "path", ".", "Otherwise", "returns", "null", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/ReportMetadata.java#L95-L99
164,530
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/JUnitXMLReporter.java
JUnitXMLReporter.flattenResults
private Collection<TestClassResults> flattenResults(List<ISuite> suites) { Map<IClass, TestClassResults> flattenedResults = new HashMap<IClass, TestClassResults>(); for (ISuite suite : suites) { for (ISuiteResult suiteResult : suite.getResults().values()) { // Failed and skipped configuration methods are treated as test failures. organiseByClass(suiteResult.getTestContext().getFailedConfigurations().getAllResults(), flattenedResults); organiseByClass(suiteResult.getTestContext().getSkippedConfigurations().getAllResults(), flattenedResults); // Successful configuration methods are not included. organiseByClass(suiteResult.getTestContext().getFailedTests().getAllResults(), flattenedResults); organiseByClass(suiteResult.getTestContext().getSkippedTests().getAllResults(), flattenedResults); organiseByClass(suiteResult.getTestContext().getPassedTests().getAllResults(), flattenedResults); } } return flattenedResults.values(); }
java
private Collection<TestClassResults> flattenResults(List<ISuite> suites) { Map<IClass, TestClassResults> flattenedResults = new HashMap<IClass, TestClassResults>(); for (ISuite suite : suites) { for (ISuiteResult suiteResult : suite.getResults().values()) { // Failed and skipped configuration methods are treated as test failures. organiseByClass(suiteResult.getTestContext().getFailedConfigurations().getAllResults(), flattenedResults); organiseByClass(suiteResult.getTestContext().getSkippedConfigurations().getAllResults(), flattenedResults); // Successful configuration methods are not included. organiseByClass(suiteResult.getTestContext().getFailedTests().getAllResults(), flattenedResults); organiseByClass(suiteResult.getTestContext().getSkippedTests().getAllResults(), flattenedResults); organiseByClass(suiteResult.getTestContext().getPassedTests().getAllResults(), flattenedResults); } } return flattenedResults.values(); }
[ "private", "Collection", "<", "TestClassResults", ">", "flattenResults", "(", "List", "<", "ISuite", ">", "suites", ")", "{", "Map", "<", "IClass", ",", "TestClassResults", ">", "flattenedResults", "=", "new", "HashMap", "<", "IClass", ",", "TestClassResults", ">", "(", ")", ";", "for", "(", "ISuite", "suite", ":", "suites", ")", "{", "for", "(", "ISuiteResult", "suiteResult", ":", "suite", ".", "getResults", "(", ")", ".", "values", "(", ")", ")", "{", "// Failed and skipped configuration methods are treated as test failures.", "organiseByClass", "(", "suiteResult", ".", "getTestContext", "(", ")", ".", "getFailedConfigurations", "(", ")", ".", "getAllResults", "(", ")", ",", "flattenedResults", ")", ";", "organiseByClass", "(", "suiteResult", ".", "getTestContext", "(", ")", ".", "getSkippedConfigurations", "(", ")", ".", "getAllResults", "(", ")", ",", "flattenedResults", ")", ";", "// Successful configuration methods are not included.", "organiseByClass", "(", "suiteResult", ".", "getTestContext", "(", ")", ".", "getFailedTests", "(", ")", ".", "getAllResults", "(", ")", ",", "flattenedResults", ")", ";", "organiseByClass", "(", "suiteResult", ".", "getTestContext", "(", ")", ".", "getSkippedTests", "(", ")", ".", "getAllResults", "(", ")", ",", "flattenedResults", ")", ";", "organiseByClass", "(", "suiteResult", ".", "getTestContext", "(", ")", ".", "getPassedTests", "(", ")", ".", "getAllResults", "(", ")", ",", "flattenedResults", ")", ";", "}", "}", "return", "flattenedResults", ".", "values", "(", ")", ";", "}" ]
Flatten a list of test suite results into a collection of results grouped by test class. This method basically strips away the TestNG way of organising tests and arranges the results by test class.
[ "Flatten", "a", "list", "of", "test", "suite", "results", "into", "a", "collection", "of", "results", "grouped", "by", "test", "class", ".", "This", "method", "basically", "strips", "away", "the", "TestNG", "way", "of", "organising", "tests", "and", "arranges", "the", "results", "by", "test", "class", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/JUnitXMLReporter.java#L94-L112
164,531
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/JUnitXMLReporter.java
JUnitXMLReporter.getResultsForClass
private TestClassResults getResultsForClass(Map<IClass, TestClassResults> flattenedResults, ITestResult testResult) { TestClassResults resultsForClass = flattenedResults.get(testResult.getTestClass()); if (resultsForClass == null) { resultsForClass = new TestClassResults(testResult.getTestClass()); flattenedResults.put(testResult.getTestClass(), resultsForClass); } return resultsForClass; }
java
private TestClassResults getResultsForClass(Map<IClass, TestClassResults> flattenedResults, ITestResult testResult) { TestClassResults resultsForClass = flattenedResults.get(testResult.getTestClass()); if (resultsForClass == null) { resultsForClass = new TestClassResults(testResult.getTestClass()); flattenedResults.put(testResult.getTestClass(), resultsForClass); } return resultsForClass; }
[ "private", "TestClassResults", "getResultsForClass", "(", "Map", "<", "IClass", ",", "TestClassResults", ">", "flattenedResults", ",", "ITestResult", "testResult", ")", "{", "TestClassResults", "resultsForClass", "=", "flattenedResults", ".", "get", "(", "testResult", ".", "getTestClass", "(", ")", ")", ";", "if", "(", "resultsForClass", "==", "null", ")", "{", "resultsForClass", "=", "new", "TestClassResults", "(", "testResult", ".", "getTestClass", "(", ")", ")", ";", "flattenedResults", ".", "put", "(", "testResult", ".", "getTestClass", "(", ")", ",", "resultsForClass", ")", ";", "}", "return", "resultsForClass", ";", "}" ]
Look-up the results data for a particular test class.
[ "Look", "-", "up", "the", "results", "data", "for", "a", "particular", "test", "class", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/JUnitXMLReporter.java#L128-L138
164,532
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java
AbstractReporter.createContext
protected VelocityContext createContext() { VelocityContext context = new VelocityContext(); context.put(META_KEY, META); context.put(UTILS_KEY, UTILS); context.put(MESSAGES_KEY, MESSAGES); return context; }
java
protected VelocityContext createContext() { VelocityContext context = new VelocityContext(); context.put(META_KEY, META); context.put(UTILS_KEY, UTILS); context.put(MESSAGES_KEY, MESSAGES); return context; }
[ "protected", "VelocityContext", "createContext", "(", ")", "{", "VelocityContext", "context", "=", "new", "VelocityContext", "(", ")", ";", "context", ".", "put", "(", "META_KEY", ",", "META", ")", ";", "context", ".", "put", "(", "UTILS_KEY", ",", "UTILS", ")", ";", "context", ".", "put", "(", "MESSAGES_KEY", ",", "MESSAGES", ")", ";", "return", "context", ";", "}" ]
Helper method that creates a Velocity context and initialises it with a reference to the ReportNG utils, report metadata and localised messages. @return An initialised Velocity context.
[ "Helper", "method", "that", "creates", "a", "Velocity", "context", "and", "initialises", "it", "with", "a", "reference", "to", "the", "ReportNG", "utils", "report", "metadata", "and", "localised", "messages", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java#L87-L94
164,533
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java
AbstractReporter.generateFile
protected void generateFile(File file, String templateName, VelocityContext context) throws Exception { Writer writer = new BufferedWriter(new FileWriter(file)); try { Velocity.mergeTemplate(classpathPrefix + templateName, ENCODING, context, writer); writer.flush(); } finally { writer.close(); } }
java
protected void generateFile(File file, String templateName, VelocityContext context) throws Exception { Writer writer = new BufferedWriter(new FileWriter(file)); try { Velocity.mergeTemplate(classpathPrefix + templateName, ENCODING, context, writer); writer.flush(); } finally { writer.close(); } }
[ "protected", "void", "generateFile", "(", "File", "file", ",", "String", "templateName", ",", "VelocityContext", "context", ")", "throws", "Exception", "{", "Writer", "writer", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "file", ")", ")", ";", "try", "{", "Velocity", ".", "mergeTemplate", "(", "classpathPrefix", "+", "templateName", ",", "ENCODING", ",", "context", ",", "writer", ")", ";", "writer", ".", "flush", "(", ")", ";", "}", "finally", "{", "writer", ".", "close", "(", ")", ";", "}", "}" ]
Generate the specified output file by merging the specified Velocity template with the supplied context.
[ "Generate", "the", "specified", "output", "file", "by", "merging", "the", "specified", "Velocity", "template", "with", "the", "supplied", "context", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java#L101-L118
164,534
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java
AbstractReporter.copyClasspathResource
protected void copyClasspathResource(File outputDirectory, String resourceName, String targetFileName) throws IOException { String resourcePath = classpathPrefix + resourceName; InputStream resourceStream = getClass().getClassLoader().getResourceAsStream(resourcePath); copyStream(outputDirectory, resourceStream, targetFileName); }
java
protected void copyClasspathResource(File outputDirectory, String resourceName, String targetFileName) throws IOException { String resourcePath = classpathPrefix + resourceName; InputStream resourceStream = getClass().getClassLoader().getResourceAsStream(resourcePath); copyStream(outputDirectory, resourceStream, targetFileName); }
[ "protected", "void", "copyClasspathResource", "(", "File", "outputDirectory", ",", "String", "resourceName", ",", "String", "targetFileName", ")", "throws", "IOException", "{", "String", "resourcePath", "=", "classpathPrefix", "+", "resourceName", ";", "InputStream", "resourceStream", "=", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", "resourcePath", ")", ";", "copyStream", "(", "outputDirectory", ",", "resourceStream", ",", "targetFileName", ")", ";", "}" ]
Copy a single named resource from the classpath to the output directory. @param outputDirectory The destination directory for the copied resource. @param resourceName The filename of the resource. @param targetFileName The name of the file created in {@literal outputDirectory}. @throws IOException If the resource cannot be copied.
[ "Copy", "a", "single", "named", "resource", "from", "the", "classpath", "to", "the", "output", "directory", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java#L128-L135
164,535
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java
AbstractReporter.copyFile
protected void copyFile(File outputDirectory, File sourceFile, String targetFileName) throws IOException { InputStream fileStream = new FileInputStream(sourceFile); try { copyStream(outputDirectory, fileStream, targetFileName); } finally { fileStream.close(); } }
java
protected void copyFile(File outputDirectory, File sourceFile, String targetFileName) throws IOException { InputStream fileStream = new FileInputStream(sourceFile); try { copyStream(outputDirectory, fileStream, targetFileName); } finally { fileStream.close(); } }
[ "protected", "void", "copyFile", "(", "File", "outputDirectory", ",", "File", "sourceFile", ",", "String", "targetFileName", ")", "throws", "IOException", "{", "InputStream", "fileStream", "=", "new", "FileInputStream", "(", "sourceFile", ")", ";", "try", "{", "copyStream", "(", "outputDirectory", ",", "fileStream", ",", "targetFileName", ")", ";", "}", "finally", "{", "fileStream", ".", "close", "(", ")", ";", "}", "}" ]
Copy a single named file to the output directory. @param outputDirectory The destination directory for the copied resource. @param sourceFile The path of the file to copy. @param targetFileName The name of the file created in {@literal outputDirectory}. @throws IOException If the file cannot be copied.
[ "Copy", "a", "single", "named", "file", "to", "the", "output", "directory", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java#L145-L158
164,536
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java
AbstractReporter.copyStream
protected void copyStream(File outputDirectory, InputStream stream, String targetFileName) throws IOException { File resourceFile = new File(outputDirectory, targetFileName); BufferedReader reader = null; Writer writer = null; try { reader = new BufferedReader(new InputStreamReader(stream, ENCODING)); writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(resourceFile), ENCODING)); String line = reader.readLine(); while (line != null) { writer.write(line); writer.write('\n'); line = reader.readLine(); } writer.flush(); } finally { if (reader != null) { reader.close(); } if (writer != null) { writer.close(); } } }
java
protected void copyStream(File outputDirectory, InputStream stream, String targetFileName) throws IOException { File resourceFile = new File(outputDirectory, targetFileName); BufferedReader reader = null; Writer writer = null; try { reader = new BufferedReader(new InputStreamReader(stream, ENCODING)); writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(resourceFile), ENCODING)); String line = reader.readLine(); while (line != null) { writer.write(line); writer.write('\n'); line = reader.readLine(); } writer.flush(); } finally { if (reader != null) { reader.close(); } if (writer != null) { writer.close(); } } }
[ "protected", "void", "copyStream", "(", "File", "outputDirectory", ",", "InputStream", "stream", ",", "String", "targetFileName", ")", "throws", "IOException", "{", "File", "resourceFile", "=", "new", "File", "(", "outputDirectory", ",", "targetFileName", ")", ";", "BufferedReader", "reader", "=", "null", ";", "Writer", "writer", "=", "null", ";", "try", "{", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "stream", ",", "ENCODING", ")", ")", ";", "writer", "=", "new", "BufferedWriter", "(", "new", "OutputStreamWriter", "(", "new", "FileOutputStream", "(", "resourceFile", ")", ",", "ENCODING", ")", ")", ";", "String", "line", "=", "reader", ".", "readLine", "(", ")", ";", "while", "(", "line", "!=", "null", ")", "{", "writer", ".", "write", "(", "line", ")", ";", "writer", ".", "write", "(", "'", "'", ")", ";", "line", "=", "reader", ".", "readLine", "(", ")", ";", "}", "writer", ".", "flush", "(", ")", ";", "}", "finally", "{", "if", "(", "reader", "!=", "null", ")", "{", "reader", ".", "close", "(", ")", ";", "}", "if", "(", "writer", "!=", "null", ")", "{", "writer", ".", "close", "(", ")", ";", "}", "}", "}" ]
Helper method to copy the contents of a stream to a file. @param outputDirectory The directory in which the new file is created. @param stream The stream to copy. @param targetFileName The file to write the stream contents to. @throws IOException If the stream cannot be copied.
[ "Helper", "method", "to", "copy", "the", "contents", "of", "a", "stream", "to", "a", "file", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java#L168-L200
164,537
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java
AbstractReporter.removeEmptyDirectories
protected void removeEmptyDirectories(File outputDirectory) { if (outputDirectory.exists()) { for (File file : outputDirectory.listFiles(new EmptyDirectoryFilter())) { file.delete(); } } }
java
protected void removeEmptyDirectories(File outputDirectory) { if (outputDirectory.exists()) { for (File file : outputDirectory.listFiles(new EmptyDirectoryFilter())) { file.delete(); } } }
[ "protected", "void", "removeEmptyDirectories", "(", "File", "outputDirectory", ")", "{", "if", "(", "outputDirectory", ".", "exists", "(", ")", ")", "{", "for", "(", "File", "file", ":", "outputDirectory", ".", "listFiles", "(", "new", "EmptyDirectoryFilter", "(", ")", ")", ")", "{", "file", ".", "delete", "(", ")", ";", "}", "}", "}" ]
Deletes any empty directories under the output directory. These directories are created by TestNG for its own reports regardless of whether those reports are generated. If you are using the default TestNG reports as well as ReportNG, these directories will not be empty and will be retained. Otherwise they will be removed. @param outputDirectory The directory to search for empty directories.
[ "Deletes", "any", "empty", "directories", "under", "the", "output", "directory", ".", "These", "directories", "are", "created", "by", "TestNG", "for", "its", "own", "reports", "regardless", "of", "whether", "those", "reports", "are", "generated", ".", "If", "you", "are", "using", "the", "default", "TestNG", "reports", "as", "well", "as", "ReportNG", "these", "directories", "will", "not", "be", "empty", "and", "will", "be", "retained", ".", "Otherwise", "they", "will", "be", "removed", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java#L211-L220
164,538
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java
HTMLReporter.generateReport
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectoryName) { removeEmptyDirectories(new File(outputDirectoryName)); boolean useFrames = System.getProperty(FRAMES_PROPERTY, "true").equals("true"); boolean onlyFailures = System.getProperty(ONLY_FAILURES_PROPERTY, "false").equals("true"); File outputDirectory = new File(outputDirectoryName, REPORT_DIRECTORY); outputDirectory.mkdirs(); try { if (useFrames) { createFrameset(outputDirectory); } createOverview(suites, outputDirectory, !useFrames, onlyFailures); createSuiteList(suites, outputDirectory, onlyFailures); createGroups(suites, outputDirectory); createResults(suites, outputDirectory, onlyFailures); createLog(outputDirectory, onlyFailures); copyResources(outputDirectory); } catch (Exception ex) { throw new ReportNGException("Failed generating HTML report.", ex); } }
java
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectoryName) { removeEmptyDirectories(new File(outputDirectoryName)); boolean useFrames = System.getProperty(FRAMES_PROPERTY, "true").equals("true"); boolean onlyFailures = System.getProperty(ONLY_FAILURES_PROPERTY, "false").equals("true"); File outputDirectory = new File(outputDirectoryName, REPORT_DIRECTORY); outputDirectory.mkdirs(); try { if (useFrames) { createFrameset(outputDirectory); } createOverview(suites, outputDirectory, !useFrames, onlyFailures); createSuiteList(suites, outputDirectory, onlyFailures); createGroups(suites, outputDirectory); createResults(suites, outputDirectory, onlyFailures); createLog(outputDirectory, onlyFailures); copyResources(outputDirectory); } catch (Exception ex) { throw new ReportNGException("Failed generating HTML report.", ex); } }
[ "public", "void", "generateReport", "(", "List", "<", "XmlSuite", ">", "xmlSuites", ",", "List", "<", "ISuite", ">", "suites", ",", "String", "outputDirectoryName", ")", "{", "removeEmptyDirectories", "(", "new", "File", "(", "outputDirectoryName", ")", ")", ";", "boolean", "useFrames", "=", "System", ".", "getProperty", "(", "FRAMES_PROPERTY", ",", "\"true\"", ")", ".", "equals", "(", "\"true\"", ")", ";", "boolean", "onlyFailures", "=", "System", ".", "getProperty", "(", "ONLY_FAILURES_PROPERTY", ",", "\"false\"", ")", ".", "equals", "(", "\"true\"", ")", ";", "File", "outputDirectory", "=", "new", "File", "(", "outputDirectoryName", ",", "REPORT_DIRECTORY", ")", ";", "outputDirectory", ".", "mkdirs", "(", ")", ";", "try", "{", "if", "(", "useFrames", ")", "{", "createFrameset", "(", "outputDirectory", ")", ";", "}", "createOverview", "(", "suites", ",", "outputDirectory", ",", "!", "useFrames", ",", "onlyFailures", ")", ";", "createSuiteList", "(", "suites", ",", "outputDirectory", ",", "onlyFailures", ")", ";", "createGroups", "(", "suites", ",", "outputDirectory", ")", ";", "createResults", "(", "suites", ",", "outputDirectory", ",", "onlyFailures", ")", ";", "createLog", "(", "outputDirectory", ",", "onlyFailures", ")", ";", "copyResources", "(", "outputDirectory", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "ReportNGException", "(", "\"Failed generating HTML report.\"", ",", "ex", ")", ";", "}", "}" ]
Generates a set of HTML files that contain data about the outcome of the specified test suites. @param suites Data about the test runs. @param outputDirectoryName The directory in which to create the report.
[ "Generates", "a", "set", "of", "HTML", "files", "that", "contain", "data", "about", "the", "outcome", "of", "the", "specified", "test", "suites", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java#L90-L119
164,539
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java
HTMLReporter.createFrameset
private void createFrameset(File outputDirectory) throws Exception { VelocityContext context = createContext(); generateFile(new File(outputDirectory, INDEX_FILE), INDEX_FILE + TEMPLATE_EXTENSION, context); }
java
private void createFrameset(File outputDirectory) throws Exception { VelocityContext context = createContext(); generateFile(new File(outputDirectory, INDEX_FILE), INDEX_FILE + TEMPLATE_EXTENSION, context); }
[ "private", "void", "createFrameset", "(", "File", "outputDirectory", ")", "throws", "Exception", "{", "VelocityContext", "context", "=", "createContext", "(", ")", ";", "generateFile", "(", "new", "File", "(", "outputDirectory", ",", "INDEX_FILE", ")", ",", "INDEX_FILE", "+", "TEMPLATE_EXTENSION", ",", "context", ")", ";", "}" ]
Create the index file that sets up the frameset. @param outputDirectory The target directory for the generated file(s).
[ "Create", "the", "index", "file", "that", "sets", "up", "the", "frameset", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java#L126-L132
164,540
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java
HTMLReporter.createSuiteList
private void createSuiteList(List<ISuite> suites, File outputDirectory, boolean onlyFailures) throws Exception { VelocityContext context = createContext(); context.put(SUITES_KEY, suites); context.put(ONLY_FAILURES_KEY, onlyFailures); generateFile(new File(outputDirectory, SUITES_FILE), SUITES_FILE + TEMPLATE_EXTENSION, context); }
java
private void createSuiteList(List<ISuite> suites, File outputDirectory, boolean onlyFailures) throws Exception { VelocityContext context = createContext(); context.put(SUITES_KEY, suites); context.put(ONLY_FAILURES_KEY, onlyFailures); generateFile(new File(outputDirectory, SUITES_FILE), SUITES_FILE + TEMPLATE_EXTENSION, context); }
[ "private", "void", "createSuiteList", "(", "List", "<", "ISuite", ">", "suites", ",", "File", "outputDirectory", ",", "boolean", "onlyFailures", ")", "throws", "Exception", "{", "VelocityContext", "context", "=", "createContext", "(", ")", ";", "context", ".", "put", "(", "SUITES_KEY", ",", "suites", ")", ";", "context", ".", "put", "(", "ONLY_FAILURES_KEY", ",", "onlyFailures", ")", ";", "generateFile", "(", "new", "File", "(", "outputDirectory", ",", "SUITES_FILE", ")", ",", "SUITES_FILE", "+", "TEMPLATE_EXTENSION", ",", "context", ")", ";", "}" ]
Create the navigation frame. @param outputDirectory The target directory for the generated file(s).
[ "Create", "the", "navigation", "frame", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java#L153-L163
164,541
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java
HTMLReporter.createResults
private void createResults(List<ISuite> suites, File outputDirectory, boolean onlyShowFailures) throws Exception { int index = 1; for (ISuite suite : suites) { int index2 = 1; for (ISuiteResult result : suite.getResults().values()) { boolean failuresExist = result.getTestContext().getFailedTests().size() > 0 || result.getTestContext().getFailedConfigurations().size() > 0; if (!onlyShowFailures || failuresExist) { VelocityContext context = createContext(); context.put(RESULT_KEY, result); context.put(FAILED_CONFIG_KEY, sortByTestClass(result.getTestContext().getFailedConfigurations())); context.put(SKIPPED_CONFIG_KEY, sortByTestClass(result.getTestContext().getSkippedConfigurations())); context.put(FAILED_TESTS_KEY, sortByTestClass(result.getTestContext().getFailedTests())); context.put(SKIPPED_TESTS_KEY, sortByTestClass(result.getTestContext().getSkippedTests())); context.put(PASSED_TESTS_KEY, sortByTestClass(result.getTestContext().getPassedTests())); String fileName = String.format("suite%d_test%d_%s", index, index2, RESULTS_FILE); generateFile(new File(outputDirectory, fileName), RESULTS_FILE + TEMPLATE_EXTENSION, context); } ++index2; } ++index; } }
java
private void createResults(List<ISuite> suites, File outputDirectory, boolean onlyShowFailures) throws Exception { int index = 1; for (ISuite suite : suites) { int index2 = 1; for (ISuiteResult result : suite.getResults().values()) { boolean failuresExist = result.getTestContext().getFailedTests().size() > 0 || result.getTestContext().getFailedConfigurations().size() > 0; if (!onlyShowFailures || failuresExist) { VelocityContext context = createContext(); context.put(RESULT_KEY, result); context.put(FAILED_CONFIG_KEY, sortByTestClass(result.getTestContext().getFailedConfigurations())); context.put(SKIPPED_CONFIG_KEY, sortByTestClass(result.getTestContext().getSkippedConfigurations())); context.put(FAILED_TESTS_KEY, sortByTestClass(result.getTestContext().getFailedTests())); context.put(SKIPPED_TESTS_KEY, sortByTestClass(result.getTestContext().getSkippedTests())); context.put(PASSED_TESTS_KEY, sortByTestClass(result.getTestContext().getPassedTests())); String fileName = String.format("suite%d_test%d_%s", index, index2, RESULTS_FILE); generateFile(new File(outputDirectory, fileName), RESULTS_FILE + TEMPLATE_EXTENSION, context); } ++index2; } ++index; } }
[ "private", "void", "createResults", "(", "List", "<", "ISuite", ">", "suites", ",", "File", "outputDirectory", ",", "boolean", "onlyShowFailures", ")", "throws", "Exception", "{", "int", "index", "=", "1", ";", "for", "(", "ISuite", "suite", ":", "suites", ")", "{", "int", "index2", "=", "1", ";", "for", "(", "ISuiteResult", "result", ":", "suite", ".", "getResults", "(", ")", ".", "values", "(", ")", ")", "{", "boolean", "failuresExist", "=", "result", ".", "getTestContext", "(", ")", ".", "getFailedTests", "(", ")", ".", "size", "(", ")", ">", "0", "||", "result", ".", "getTestContext", "(", ")", ".", "getFailedConfigurations", "(", ")", ".", "size", "(", ")", ">", "0", ";", "if", "(", "!", "onlyShowFailures", "||", "failuresExist", ")", "{", "VelocityContext", "context", "=", "createContext", "(", ")", ";", "context", ".", "put", "(", "RESULT_KEY", ",", "result", ")", ";", "context", ".", "put", "(", "FAILED_CONFIG_KEY", ",", "sortByTestClass", "(", "result", ".", "getTestContext", "(", ")", ".", "getFailedConfigurations", "(", ")", ")", ")", ";", "context", ".", "put", "(", "SKIPPED_CONFIG_KEY", ",", "sortByTestClass", "(", "result", ".", "getTestContext", "(", ")", ".", "getSkippedConfigurations", "(", ")", ")", ")", ";", "context", ".", "put", "(", "FAILED_TESTS_KEY", ",", "sortByTestClass", "(", "result", ".", "getTestContext", "(", ")", ".", "getFailedTests", "(", ")", ")", ")", ";", "context", ".", "put", "(", "SKIPPED_TESTS_KEY", ",", "sortByTestClass", "(", "result", ".", "getTestContext", "(", ")", ".", "getSkippedTests", "(", ")", ")", ")", ";", "context", ".", "put", "(", "PASSED_TESTS_KEY", ",", "sortByTestClass", "(", "result", ".", "getTestContext", "(", ")", ".", "getPassedTests", "(", ")", ")", ")", ";", "String", "fileName", "=", "String", ".", "format", "(", "\"suite%d_test%d_%s\"", ",", "index", ",", "index2", ",", "RESULTS_FILE", ")", ";", "generateFile", "(", "new", "File", "(", "outputDirectory", ",", "fileName", ")", ",", "RESULTS_FILE", "+", "TEMPLATE_EXTENSION", ",", "context", ")", ";", "}", "++", "index2", ";", "}", "++", "index", ";", "}", "}" ]
Generate a results file for each test in each suite. @param outputDirectory The target directory for the generated file(s).
[ "Generate", "a", "results", "file", "for", "each", "test", "in", "each", "suite", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java#L170-L200
164,542
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java
HTMLReporter.copyResources
private void copyResources(File outputDirectory) throws IOException { copyClasspathResource(outputDirectory, "reportng.css", "reportng.css"); copyClasspathResource(outputDirectory, "reportng.js", "reportng.js"); // If there is a custom stylesheet, copy that. File customStylesheet = META.getStylesheetPath(); if (customStylesheet != null) { if (customStylesheet.exists()) { copyFile(outputDirectory, customStylesheet, CUSTOM_STYLE_FILE); } else { // If not found, try to read the file as a resource on the classpath // useful when reportng is called by a jarred up library InputStream stream = ClassLoader.getSystemClassLoader().getResourceAsStream(customStylesheet.getPath()); if (stream != null) { copyStream(outputDirectory, stream, CUSTOM_STYLE_FILE); } } } }
java
private void copyResources(File outputDirectory) throws IOException { copyClasspathResource(outputDirectory, "reportng.css", "reportng.css"); copyClasspathResource(outputDirectory, "reportng.js", "reportng.js"); // If there is a custom stylesheet, copy that. File customStylesheet = META.getStylesheetPath(); if (customStylesheet != null) { if (customStylesheet.exists()) { copyFile(outputDirectory, customStylesheet, CUSTOM_STYLE_FILE); } else { // If not found, try to read the file as a resource on the classpath // useful when reportng is called by a jarred up library InputStream stream = ClassLoader.getSystemClassLoader().getResourceAsStream(customStylesheet.getPath()); if (stream != null) { copyStream(outputDirectory, stream, CUSTOM_STYLE_FILE); } } } }
[ "private", "void", "copyResources", "(", "File", "outputDirectory", ")", "throws", "IOException", "{", "copyClasspathResource", "(", "outputDirectory", ",", "\"reportng.css\"", ",", "\"reportng.css\"", ")", ";", "copyClasspathResource", "(", "outputDirectory", ",", "\"reportng.js\"", ",", "\"reportng.js\"", ")", ";", "// If there is a custom stylesheet, copy that.", "File", "customStylesheet", "=", "META", ".", "getStylesheetPath", "(", ")", ";", "if", "(", "customStylesheet", "!=", "null", ")", "{", "if", "(", "customStylesheet", ".", "exists", "(", ")", ")", "{", "copyFile", "(", "outputDirectory", ",", "customStylesheet", ",", "CUSTOM_STYLE_FILE", ")", ";", "}", "else", "{", "// If not found, try to read the file as a resource on the classpath", "// useful when reportng is called by a jarred up library", "InputStream", "stream", "=", "ClassLoader", ".", "getSystemClassLoader", "(", ")", ".", "getResourceAsStream", "(", "customStylesheet", ".", "getPath", "(", ")", ")", ";", "if", "(", "stream", "!=", "null", ")", "{", "copyStream", "(", "outputDirectory", ",", "stream", ",", "CUSTOM_STYLE_FILE", ")", ";", "}", "}", "}", "}" ]
Reads the CSS and JavaScript files from the JAR file and writes them to the output directory. @param outputDirectory Where to put the resources. @throws IOException If the resources can't be read or written.
[ "Reads", "the", "CSS", "and", "JavaScript", "files", "from", "the", "JAR", "file", "and", "writes", "them", "to", "the", "output", "directory", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java#L295-L319
164,543
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/ReportNGUtils.java
ReportNGUtils.getCauses
public List<Throwable> getCauses(Throwable t) { List<Throwable> causes = new LinkedList<Throwable>(); Throwable next = t; while (next.getCause() != null) { next = next.getCause(); causes.add(next); } return causes; }
java
public List<Throwable> getCauses(Throwable t) { List<Throwable> causes = new LinkedList<Throwable>(); Throwable next = t; while (next.getCause() != null) { next = next.getCause(); causes.add(next); } return causes; }
[ "public", "List", "<", "Throwable", ">", "getCauses", "(", "Throwable", "t", ")", "{", "List", "<", "Throwable", ">", "causes", "=", "new", "LinkedList", "<", "Throwable", ">", "(", ")", ";", "Throwable", "next", "=", "t", ";", "while", "(", "next", ".", "getCause", "(", ")", "!=", "null", ")", "{", "next", "=", "next", ".", "getCause", "(", ")", ";", "causes", ".", "add", "(", "next", ")", ";", "}", "return", "causes", ";", "}" ]
Convert a Throwable into a list containing all of its causes. @param t The throwable for which the causes are to be returned. @return A (possibly empty) list of {@link Throwable}s.
[ "Convert", "a", "Throwable", "into", "a", "list", "containing", "all", "of", "its", "causes", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/ReportNGUtils.java#L100-L110
164,544
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/ReportNGUtils.java
ReportNGUtils.commaSeparate
private String commaSeparate(Collection<String> strings) { StringBuilder buffer = new StringBuilder(); Iterator<String> iterator = strings.iterator(); while (iterator.hasNext()) { String string = iterator.next(); buffer.append(string); if (iterator.hasNext()) { buffer.append(", "); } } return buffer.toString(); }
java
private String commaSeparate(Collection<String> strings) { StringBuilder buffer = new StringBuilder(); Iterator<String> iterator = strings.iterator(); while (iterator.hasNext()) { String string = iterator.next(); buffer.append(string); if (iterator.hasNext()) { buffer.append(", "); } } return buffer.toString(); }
[ "private", "String", "commaSeparate", "(", "Collection", "<", "String", ">", "strings", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "Iterator", "<", "String", ">", "iterator", "=", "strings", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "String", "string", "=", "iterator", ".", "next", "(", ")", ";", "buffer", ".", "append", "(", "string", ")", ";", "if", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "buffer", ".", "append", "(", "\", \"", ")", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
Takes a list of Strings and combines them into a single comma-separated String. @param strings The Strings to combine. @return The combined, comma-separated, String.
[ "Takes", "a", "list", "of", "Strings", "and", "combines", "them", "into", "a", "single", "comma", "-", "separated", "String", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/ReportNGUtils.java#L248-L262
164,545
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/ReportNGUtils.java
ReportNGUtils.stripThreadName
public String stripThreadName(String threadId) { if (threadId == null) { return null; } else { int index = threadId.lastIndexOf('@'); return index >= 0 ? threadId.substring(0, index) : threadId; } }
java
public String stripThreadName(String threadId) { if (threadId == null) { return null; } else { int index = threadId.lastIndexOf('@'); return index >= 0 ? threadId.substring(0, index) : threadId; } }
[ "public", "String", "stripThreadName", "(", "String", "threadId", ")", "{", "if", "(", "threadId", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "int", "index", "=", "threadId", ".", "lastIndexOf", "(", "'", "'", ")", ";", "return", "index", ">=", "0", "?", "threadId", ".", "substring", "(", "0", ",", "index", ")", ":", "threadId", ";", "}", "}" ]
TestNG returns a compound thread ID that includes the thread name and its numeric ID, separated by an 'at' sign. We only want to use the thread name as the ID is mostly unimportant and it takes up too much space in the generated report. @param threadId The compound thread ID. @return The thread name.
[ "TestNG", "returns", "a", "compound", "thread", "ID", "that", "includes", "the", "thread", "name", "and", "its", "numeric", "ID", "separated", "by", "an", "at", "sign", ".", "We", "only", "want", "to", "use", "the", "thread", "name", "as", "the", "ID", "is", "mostly", "unimportant", "and", "it", "takes", "up", "too", "much", "space", "in", "the", "generated", "report", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/ReportNGUtils.java#L354-L365
164,546
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/ReportNGUtils.java
ReportNGUtils.getStartTime
public long getStartTime(List<IInvokedMethod> methods) { long startTime = System.currentTimeMillis(); for (IInvokedMethod method : methods) { startTime = Math.min(startTime, method.getDate()); } return startTime; }
java
public long getStartTime(List<IInvokedMethod> methods) { long startTime = System.currentTimeMillis(); for (IInvokedMethod method : methods) { startTime = Math.min(startTime, method.getDate()); } return startTime; }
[ "public", "long", "getStartTime", "(", "List", "<", "IInvokedMethod", ">", "methods", ")", "{", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "for", "(", "IInvokedMethod", "method", ":", "methods", ")", "{", "startTime", "=", "Math", ".", "min", "(", "startTime", ",", "method", ".", "getDate", "(", ")", ")", ";", "}", "return", "startTime", ";", "}" ]
Find the earliest start time of the specified methods. @param methods A list of test methods. @return The earliest start time.
[ "Find", "the", "earliest", "start", "time", "of", "the", "specified", "methods", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/ReportNGUtils.java#L373-L381
164,547
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/ReportNGUtils.java
ReportNGUtils.getEndTime
private long getEndTime(ISuite suite, IInvokedMethod method) { // Find the latest end time for all tests in the suite. for (Map.Entry<String, ISuiteResult> entry : suite.getResults().entrySet()) { ITestContext testContext = entry.getValue().getTestContext(); for (ITestNGMethod m : testContext.getAllTestMethods()) { if (method == m) { return testContext.getEndDate().getTime(); } } // If we can't find a matching test method it must be a configuration method. for (ITestNGMethod m : testContext.getPassedConfigurations().getAllMethods()) { if (method == m) { return testContext.getEndDate().getTime(); } } for (ITestNGMethod m : testContext.getFailedConfigurations().getAllMethods()) { if (method == m) { return testContext.getEndDate().getTime(); } } } throw new IllegalStateException("Could not find matching end time."); }
java
private long getEndTime(ISuite suite, IInvokedMethod method) { // Find the latest end time for all tests in the suite. for (Map.Entry<String, ISuiteResult> entry : suite.getResults().entrySet()) { ITestContext testContext = entry.getValue().getTestContext(); for (ITestNGMethod m : testContext.getAllTestMethods()) { if (method == m) { return testContext.getEndDate().getTime(); } } // If we can't find a matching test method it must be a configuration method. for (ITestNGMethod m : testContext.getPassedConfigurations().getAllMethods()) { if (method == m) { return testContext.getEndDate().getTime(); } } for (ITestNGMethod m : testContext.getFailedConfigurations().getAllMethods()) { if (method == m) { return testContext.getEndDate().getTime(); } } } throw new IllegalStateException("Could not find matching end time."); }
[ "private", "long", "getEndTime", "(", "ISuite", "suite", ",", "IInvokedMethod", "method", ")", "{", "// Find the latest end time for all tests in the suite.", "for", "(", "Map", ".", "Entry", "<", "String", ",", "ISuiteResult", ">", "entry", ":", "suite", ".", "getResults", "(", ")", ".", "entrySet", "(", ")", ")", "{", "ITestContext", "testContext", "=", "entry", ".", "getValue", "(", ")", ".", "getTestContext", "(", ")", ";", "for", "(", "ITestNGMethod", "m", ":", "testContext", ".", "getAllTestMethods", "(", ")", ")", "{", "if", "(", "method", "==", "m", ")", "{", "return", "testContext", ".", "getEndDate", "(", ")", ".", "getTime", "(", ")", ";", "}", "}", "// If we can't find a matching test method it must be a configuration method.", "for", "(", "ITestNGMethod", "m", ":", "testContext", ".", "getPassedConfigurations", "(", ")", ".", "getAllMethods", "(", ")", ")", "{", "if", "(", "method", "==", "m", ")", "{", "return", "testContext", ".", "getEndDate", "(", ")", ".", "getTime", "(", ")", ";", "}", "}", "for", "(", "ITestNGMethod", "m", ":", "testContext", ".", "getFailedConfigurations", "(", ")", ".", "getAllMethods", "(", ")", ")", "{", "if", "(", "method", "==", "m", ")", "{", "return", "testContext", ".", "getEndDate", "(", ")", ".", "getTime", "(", ")", ";", "}", "}", "}", "throw", "new", "IllegalStateException", "(", "\"Could not find matching end time.\"", ")", ";", "}" ]
Returns the timestamp for the time at which the suite finished executing. This is determined by finding the latest end time for each of the individual tests in the suite. @param suite The suite to find the end time of. @return The end time (as a number of milliseconds since 00:00 1st January 1970 UTC).
[ "Returns", "the", "timestamp", "for", "the", "time", "at", "which", "the", "suite", "finished", "executing", ".", "This", "is", "determined", "by", "finding", "the", "latest", "end", "time", "for", "each", "of", "the", "individual", "tests", "in", "the", "suite", "." ]
df11f9cd9ab3fb5847fbba94ed3098ae0448f770
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/ReportNGUtils.java#L410-L440
164,548
cverges/expect4j
src/main/java/expect4j/PollingConsumer.java
PollingConsumer.waitForBuffer
public void waitForBuffer(long timeoutMilli) { //assert(callerProcessing.booleanValue() == false); synchronized(buffer) { if( dirtyBuffer ) return; if( !foundEOF() ) { logger.trace("Waiting for things to come in, or until timeout"); try { if( timeoutMilli > 0 ) buffer.wait(timeoutMilli); else buffer.wait(); } catch(InterruptedException ie) { logger.trace("Woken up, while waiting for buffer"); } // this might went early, but running the processing again isn't a big deal logger.trace("Waited"); } } }
java
public void waitForBuffer(long timeoutMilli) { //assert(callerProcessing.booleanValue() == false); synchronized(buffer) { if( dirtyBuffer ) return; if( !foundEOF() ) { logger.trace("Waiting for things to come in, or until timeout"); try { if( timeoutMilli > 0 ) buffer.wait(timeoutMilli); else buffer.wait(); } catch(InterruptedException ie) { logger.trace("Woken up, while waiting for buffer"); } // this might went early, but running the processing again isn't a big deal logger.trace("Waited"); } } }
[ "public", "void", "waitForBuffer", "(", "long", "timeoutMilli", ")", "{", "//assert(callerProcessing.booleanValue() == false);", "synchronized", "(", "buffer", ")", "{", "if", "(", "dirtyBuffer", ")", "return", ";", "if", "(", "!", "foundEOF", "(", ")", ")", "{", "logger", ".", "trace", "(", "\"Waiting for things to come in, or until timeout\"", ")", ";", "try", "{", "if", "(", "timeoutMilli", ">", "0", ")", "buffer", ".", "wait", "(", "timeoutMilli", ")", ";", "else", "buffer", ".", "wait", "(", ")", ";", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "logger", ".", "trace", "(", "\"Woken up, while waiting for buffer\"", ")", ";", "}", "// this might went early, but running the processing again isn't a big deal", "logger", ".", "trace", "(", "\"Waited\"", ")", ";", "}", "}", "}" ]
What is something came in between when we last checked and when this method is called
[ "What", "is", "something", "came", "in", "between", "when", "we", "last", "checked", "and", "when", "this", "method", "is", "called" ]
97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6
https://github.com/cverges/expect4j/blob/97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6/src/main/java/expect4j/PollingConsumer.java#L164-L184
164,549
cverges/expect4j
src/main/java/expect4j/PollingConsumer.java
PollingConsumer.main
public static void main(String args[]) throws Exception { final StringBuffer buffer = new StringBuffer("The lazy fox"); Thread t1 = new Thread() { public void run() { synchronized(buffer) { buffer.delete(0,4); buffer.append(" in the middle"); System.err.println("Middle"); try { Thread.sleep(4000); } catch(Exception e) {} buffer.append(" of fall"); System.err.println("Fall"); } } }; Thread t2 = new Thread() { public void run() { try { Thread.sleep(1000); } catch(Exception e) {} buffer.append(" jump over the fence"); System.err.println("Fence"); } }; t1.start(); t2.start(); t1.join(); t2.join(); System.err.println(buffer); }
java
public static void main(String args[]) throws Exception { final StringBuffer buffer = new StringBuffer("The lazy fox"); Thread t1 = new Thread() { public void run() { synchronized(buffer) { buffer.delete(0,4); buffer.append(" in the middle"); System.err.println("Middle"); try { Thread.sleep(4000); } catch(Exception e) {} buffer.append(" of fall"); System.err.println("Fall"); } } }; Thread t2 = new Thread() { public void run() { try { Thread.sleep(1000); } catch(Exception e) {} buffer.append(" jump over the fence"); System.err.println("Fence"); } }; t1.start(); t2.start(); t1.join(); t2.join(); System.err.println(buffer); }
[ "public", "static", "void", "main", "(", "String", "args", "[", "]", ")", "throws", "Exception", "{", "final", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"The lazy fox\"", ")", ";", "Thread", "t1", "=", "new", "Thread", "(", ")", "{", "public", "void", "run", "(", ")", "{", "synchronized", "(", "buffer", ")", "{", "buffer", ".", "delete", "(", "0", ",", "4", ")", ";", "buffer", ".", "append", "(", "\" in the middle\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"Middle\"", ")", ";", "try", "{", "Thread", ".", "sleep", "(", "4000", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "buffer", ".", "append", "(", "\" of fall\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"Fall\"", ")", ";", "}", "}", "}", ";", "Thread", "t2", "=", "new", "Thread", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "1000", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "buffer", ".", "append", "(", "\" jump over the fence\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"Fence\"", ")", ";", "}", "}", ";", "t1", ".", "start", "(", ")", ";", "t2", ".", "start", "(", ")", ";", "t1", ".", "join", "(", ")", ";", "t2", ".", "join", "(", ")", ";", "System", ".", "err", ".", "println", "(", "buffer", ")", ";", "}" ]
We have more input since wait started
[ "We", "have", "more", "input", "since", "wait", "started" ]
97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6
https://github.com/cverges/expect4j/blob/97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6/src/main/java/expect4j/PollingConsumer.java#L217-L244
164,550
cverges/expect4j
src/main/java/expect4j/ConsumerImpl.java
ConsumerImpl.notifyBufferChange
protected void notifyBufferChange(char[] newData, int numChars) { synchronized(bufferChangeLoggers) { Iterator<BufferChangeLogger> iterator = bufferChangeLoggers.iterator(); while (iterator.hasNext()) { iterator.next().bufferChanged(newData, numChars); } } }
java
protected void notifyBufferChange(char[] newData, int numChars) { synchronized(bufferChangeLoggers) { Iterator<BufferChangeLogger> iterator = bufferChangeLoggers.iterator(); while (iterator.hasNext()) { iterator.next().bufferChanged(newData, numChars); } } }
[ "protected", "void", "notifyBufferChange", "(", "char", "[", "]", "newData", ",", "int", "numChars", ")", "{", "synchronized", "(", "bufferChangeLoggers", ")", "{", "Iterator", "<", "BufferChangeLogger", ">", "iterator", "=", "bufferChangeLoggers", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "iterator", ".", "next", "(", ")", ".", "bufferChanged", "(", "newData", ",", "numChars", ")", ";", "}", "}", "}" ]
Notifies all registered BufferChangeLogger instances of a change. @param newData the buffer that contains the new data being added @param numChars the number of valid characters in the buffer
[ "Notifies", "all", "registered", "BufferChangeLogger", "instances", "of", "a", "change", "." ]
97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6
https://github.com/cverges/expect4j/blob/97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6/src/main/java/expect4j/ConsumerImpl.java#L175-L182
164,551
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", "(", "pattern", ",", "null", ")", ";", "}" ]
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
164,552
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() );\n System.out.println( \"Current: \" + input.getCurrentOffset() );\n System.out.println( \"Begin: \" + input.getMatchBeginOffset() );\n System.out.println( \"End: \" + input.getMatchEndOffset() );\n //System.out.println( \"Match: \" + input.match() );\n //System.out.println( \"Pre: >\" + input.preMatch() + \"<\");\n //System.out.println( \"Post: \" + input.postMatch() );\n }\n */", "// 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", ";", "}" ]
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
164,553
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", "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\"", ")", ";", "}", "/*\n * Scan through the string one character at a time, performing\n * command, variable, and backslash substitutions.\n */", "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", "(", ")", ";", "/**\n * Removed\n (ToDo) may not be portable on Mac\n } else if (c == '\\r') {\n i++;\n */", "}", "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", "(", ")", ")", ";", "}" ]
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
164,554
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", "(", ")", ";", "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", ")", ";", "}", "}" ]
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
164,555
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", ".", "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", ";", "}" ]
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
164,556
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", "=", "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", ")", ";", "}" ]
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
164,557
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", ")", ".", "toPath", "(", ")", ")", ";", "return", "new", "Deployment", "(", "deploymentContent", ",", "null", ")", ";", "}" ]
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
164,558
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", ")", ")", ";", "return", "new", "Deployment", "(", "deploymentContent", ",", "null", ")", ";", "}" ]
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
164,559
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", "new", "Deployment", "(", "deploymentContent", ",", "null", ")", ";", "}" ]
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
164,560
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", "this", ";", "}" ]
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
164,561
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", ")", "{", "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.\"", ")", ";", "}", "}" ]
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
164,562
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", ")", ";", "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", ";", "}" ]
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
164,563
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", "(", "name", ")", ".", "set", "(", "ModelNode", ".", "fromString", "(", "realValue", ")", ")", ";", "}" ]
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
164,564
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", ".", "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", ";", "}" ]
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
164,565
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", ".", "checkNotNullParam", "(", "\"client\"", ",", "client", ")", ")", ";", "}" ]
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
164,566
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", ",", "client", ",", "startupTimeout", ")", ";", "}" ]
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", "the", "server", "is", "disabled", "." ]
c0e2d7ee28e511092561801959eae253b2b56def
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/ServerHelper.java#L141-L144
164,567
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 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", ")", ";", "}", "}" ]
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
164,568
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_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", ")", ";", "}" ]
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
164,569
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", ",", "client", ",", "startupTimeout", ")", ";", "}" ]
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
164,570
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", ",", "\"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", ";", "}" ]
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
164,571
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\"", ")", ";", "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", ")", ";", "}", "}" ]
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
164,572
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_TYPES", ".", "containsKey", "(", "packaging", ")", ")", "{", "return", "DEFAULT_TYPES", ".", "get", "(", "packaging", ")", ";", "}", "return", "new", "PackageType", "(", "packaging", ")", ";", "}" ]
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
164,573
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", "(", "resolvedJavaHome", "==", "null", ")", "{", "exe", "=", "\"java\"", ";", "}", "else", "{", "exe", "=", "resolvedJavaHome", ".", "resolve", "(", "\"bin\"", ")", ".", "resolve", "(", "\"java\"", ")", ".", "toString", "(", ")", ";", "}", "if", "(", "exe", ".", "contains", "(", "\" \"", ")", ")", "{", "return", "\"\\\"\"", "+", "exe", "+", "\"\\\"\"", ";", "}", "if", "(", "WINDOWS", ")", "{", "return", "exe", "+", "\".exe\"", ";", "}", "return", "exe", ";", "}" ]
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
164,574
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", "(", "deploymentDescription", ".", "getName", "(", ")", ")", ".", "addServerGroups", "(", "deploymentDescription", ".", "getServerGroups", "(", ")", ")", ";", "}" ]
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
164,575
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", "=", "CompositeOperationBuilder", ".", "create", "(", "true", ")", ";", "addDeployOperationStep", "(", "builder", ",", "deployment", ")", ";", "return", "builder", ".", "build", "(", ")", ";", "}" ]
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
164,576
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", "CompositeOperationBuilder", "builder", "=", "CompositeOperationBuilder", ".", "create", "(", "true", ")", ";", "for", "(", "DeploymentDescription", "deployment", ":", "deployments", ")", "{", "addDeployOperationStep", "(", "builder", ",", "deployment", ")", ";", "}", "return", "builder", ".", "build", "(", ")", ";", "}" ]
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
164,577
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", "<", "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", ")", ")", ";", "}", "}", "}" ]
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
164,578
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", "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", ")", ")", ")", ";", "}", "}", "}" ]
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
164,579
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", ".", "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", ";", "}" ]
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
164,580
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", ")", ";", "return", "op", ";", "}" ]
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
164,581
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", ")", ".", "set", "(", "recursive", ")", ";", "return", "op", ";", "}" ]
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
164,582
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 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", ")", ";", "}" ]
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
164,583
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 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", ";", "}" ]
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
164,584
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", "(", ")", ")", ".", "append", "(", "\"://\"", ")", ";", "}", "if", "(", "getHost", "(", ")", "!=", "null", ")", "{", "controller", ".", "append", "(", "getHost", "(", ")", ")", ";", "}", "else", "{", "controller", ".", "append", "(", "\"localhost\"", ")", ";", "}", "if", "(", "getPort", "(", ")", ">", "0", ")", "{", "controller", ".", "append", "(", "'", "'", ")", ".", "append", "(", "getPort", "(", ")", ")", ";", "}", "return", "controller", ".", "toString", "(", ")", ";", "}" ]
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
164,585
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", "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", ")", ";", "}" ]
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
164,586
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", "=", "of", "(", "name", ")", ";", "if", "(", "serverGroups", "!=", "null", ")", "{", "result", ".", "addServerGroups", "(", "serverGroups", ")", ";", "}", "return", "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
164,587
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", ".", "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", "(", ")", ")", ";", "}", "}", "}" ]
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
164,588
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", "(", ")", ";", "// 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", ";", "}" ]
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
164,589
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", ",", "chooseAction", "(", ")", ")", ".", "forward", "(", "req", ",", "resp", ")", ";", "}" ]
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", "promotion", "is", "currently", "in", "progress", "." ]
f5fcfff6a5a50be5374813e49d1fe3aaf6422333
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/promotion/UnifiedPromoteBuildAction.java#L270-L273
164,590
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", "&&", "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", ";", "}" ]
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
164,591
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", ")", ";", "if", "(", "buildInfo", "==", "null", ")", "{", "buildInfo", "=", "(", "BuildInfo", ")", "cpsScript", ".", "invokeMethod", "(", "\"newBuildInfo\"", ",", "Maps", ".", "newLinkedHashMap", "(", ")", ")", ";", "stepVariables", ".", "put", "(", "BUILD_INFO", ",", "buildInfo", ")", ";", "}", "buildInfo", ".", "setCpsScript", "(", "cpsScript", ")", ";", "return", "buildInfo", ";", "}" ]
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
164,592
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 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", ";", "}" ]
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
164,593
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", ",", "\" \"", ")", ";", "for", "(", "String", "email", ":", "recipients", ")", "{", "FormValidation", "validation", "=", "validateInternetAddress", "(", "email", ")", ";", "if", "(", "validation", "!=", "FormValidation", ".", "ok", "(", ")", ")", "{", "return", "validation", ";", "}", "}", "}", "return", "FormValidation", ".", "ok", "(", ")", ";", "}" ]
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
164,594
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", "==", "null", ")", "return", "FormValidation", ".", "error", "(", "\"Mandatory field - You don`t have any deploy matches\"", ")", ";", "return", "FormValidation", ".", "ok", "(", ")", ";", "}" ]
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
164,595
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", ")", "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", ";", "}" ]
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
164,596
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", "(", "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", ";", "}" ]
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
164,597
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", "(", ")", ".", "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", ";", "}" ]
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
164,598
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
164,599
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", ",", "getLocation", "(", ")", ",", "getSvnAuthenticationProvider", "(", "build", ")", ",", "buildListener", ")", ")", ";", "}" ]
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