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
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
100,900
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/util/QueryFilter.java
QueryFilter.or
public static QueryFilter or(QueryFilter... queryFilters) { QueryFilter result = null; for (QueryFilter q : queryFilters) { result = result == null ? q : result.or(q); } return result; }
java
public static QueryFilter or(QueryFilter... queryFilters) { QueryFilter result = null; for (QueryFilter q : queryFilters) { result = result == null ? q : result.or(q); } return result; }
[ "public", "static", "QueryFilter", "or", "(", "QueryFilter", "...", "queryFilters", ")", "{", "QueryFilter", "result", "=", "null", ";", "for", "(", "QueryFilter", "q", ":", "queryFilters", ")", "{", "result", "=", "result", "==", "null", "?", "q", ":", ...
Get a query filter that is the ORed combination of the specified filters. @param queryFilters one or more query filters to be ORed together @return the ORed query filter
[ "Get", "a", "query", "filter", "that", "is", "the", "ORed", "combination", "of", "the", "specified", "filters", "." ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/util/QueryFilter.java#L108-L114
100,901
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/request/CreateRequest.java
CreateRequest.getBody
public String getBody() { JsonObject wrapper = new JsonObject(); wrapper.add(type, obj); return gsonBuilder.create().toJson(wrapper); }
java
public String getBody() { JsonObject wrapper = new JsonObject(); wrapper.add(type, obj); return gsonBuilder.create().toJson(wrapper); }
[ "public", "String", "getBody", "(", ")", "{", "JsonObject", "wrapper", "=", "new", "JsonObject", "(", ")", ";", "wrapper", ".", "add", "(", "type", ",", "obj", ")", ";", "return", "gsonBuilder", ".", "create", "(", ")", ".", "toJson", "(", "wrapper", ...
Get the JSON encoded string representation of the object to be created. @return the JSON encoded object
[ "Get", "the", "JSON", "encoded", "string", "representation", "of", "the", "object", "to", "be", "created", "." ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/request/CreateRequest.java#L37-L41
100,902
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/util/Ref.java
Ref.getRelativeRef
public static String getRelativeRef(String ref) { Matcher matcher = match(ref); return matcher != null ? String.format("/%s/%s", matcher.group(1), matcher.group(2)) : null; }
java
public static String getRelativeRef(String ref) { Matcher matcher = match(ref); return matcher != null ? String.format("/%s/%s", matcher.group(1), matcher.group(2)) : null; }
[ "public", "static", "String", "getRelativeRef", "(", "String", "ref", ")", "{", "Matcher", "matcher", "=", "match", "(", "ref", ")", ";", "return", "matcher", "!=", "null", "?", "String", ".", "format", "(", "\"/%s/%s\"", ",", "matcher", ".", "group", "(...
Create a relative ref url from the specified ref @param ref the ref url to be made relative @return the relative ref url or null if the specified ref was not valid
[ "Create", "a", "relative", "ref", "url", "from", "the", "specified", "ref" ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/util/Ref.java#L75-L78
100,903
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/util/Ref.java
Ref.getTypeFromRef
public static String getTypeFromRef(String ref) { Matcher matcher = match(ref); return matcher != null ? matcher.group(1) : null; }
java
public static String getTypeFromRef(String ref) { Matcher matcher = match(ref); return matcher != null ? matcher.group(1) : null; }
[ "public", "static", "String", "getTypeFromRef", "(", "String", "ref", ")", "{", "Matcher", "matcher", "=", "match", "(", "ref", ")", ";", "return", "matcher", "!=", "null", "?", "matcher", ".", "group", "(", "1", ")", ":", "null", ";", "}" ]
Get the type from the specified ref url @param ref the ref url to extract the type from @return the extracted type or null if the specified ref was not valid
[ "Get", "the", "type", "from", "the", "specified", "ref", "url" ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/util/Ref.java#L87-L90
100,904
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/util/Ref.java
Ref.getOidFromRef
public static String getOidFromRef(String ref) { Matcher matcher = match(ref); return matcher != null ? matcher.group(2) : null; }
java
public static String getOidFromRef(String ref) { Matcher matcher = match(ref); return matcher != null ? matcher.group(2) : null; }
[ "public", "static", "String", "getOidFromRef", "(", "String", "ref", ")", "{", "Matcher", "matcher", "=", "match", "(", "ref", ")", ";", "return", "matcher", "!=", "null", "?", "matcher", ".", "group", "(", "2", ")", ":", "null", ";", "}" ]
Get the ObjectID from the specified ref url @param ref the ref url to extract the ObjectID from @return the extracted ObjectID or null if the specified ref was not valid
[ "Get", "the", "ObjectID", "from", "the", "specified", "ref", "url" ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/util/Ref.java#L99-L102
100,905
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/request/Request.java
Request.addParam
public void addParam(String name, String value) { getParams().add(new BasicNameValuePair(name, value)); }
java
public void addParam(String name, String value) { getParams().add(new BasicNameValuePair(name, value)); }
[ "public", "void", "addParam", "(", "String", "name", ",", "String", "value", ")", "{", "getParams", "(", ")", ".", "add", "(", "new", "BasicNameValuePair", "(", "name", ",", "value", ")", ")", ";", "}" ]
Add the specified parameter to this request. @param name the parameter name @param value the parameter value
[ "Add", "the", "specified", "parameter", "to", "this", "request", "." ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/request/Request.java#L54-L56
100,906
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/client/HttpClient.java
HttpClient.setProxy
public void setProxy(URI proxy) { this.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, new HttpHost(proxy.getHost(), proxy.getPort(), proxy.getScheme())); }
java
public void setProxy(URI proxy) { this.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, new HttpHost(proxy.getHost(), proxy.getPort(), proxy.getScheme())); }
[ "public", "void", "setProxy", "(", "URI", "proxy", ")", "{", "this", ".", "getParams", "(", ")", ".", "setParameter", "(", "ConnRoutePNames", ".", "DEFAULT_PROXY", ",", "new", "HttpHost", "(", "proxy", ".", "getHost", "(", ")", ",", "proxy", ".", "getPor...
Set the unauthenticated proxy server to use. By default no proxy is configured. @param proxy The proxy server, e.g. {@code new URI("http://my.proxy.com:8000")}
[ "Set", "the", "unauthenticated", "proxy", "server", "to", "use", ".", "By", "default", "no", "proxy", "is", "configured", "." ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/client/HttpClient.java#L59-L61
100,907
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/client/HttpClient.java
HttpClient.doPost
public String doPost(String url, String body) throws IOException { HttpPost httpPost = new HttpPost(getWsapiUrl() + url); httpPost.setEntity(new StringEntity(body, "utf-8")); return doRequest(httpPost); }
java
public String doPost(String url, String body) throws IOException { HttpPost httpPost = new HttpPost(getWsapiUrl() + url); httpPost.setEntity(new StringEntity(body, "utf-8")); return doRequest(httpPost); }
[ "public", "String", "doPost", "(", "String", "url", ",", "String", "body", ")", "throws", "IOException", "{", "HttpPost", "httpPost", "=", "new", "HttpPost", "(", "getWsapiUrl", "(", ")", "+", "url", ")", ";", "httpPost", ".", "setEntity", "(", "new", "S...
Perform a post against the WSAPI @param url the request url @param body the body of the post @return the JSON encoded string response @throws IOException if a non-200 response code is returned or if some other problem occurs while executing the request
[ "Perform", "a", "post", "against", "the", "WSAPI" ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/client/HttpClient.java#L176-L180
100,908
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/client/HttpClient.java
HttpClient.doPut
public String doPut(String url, String body) throws IOException { HttpPut httpPut = new HttpPut(getWsapiUrl() + url); httpPut.setEntity(new StringEntity(body, "utf-8")); return doRequest(httpPut); }
java
public String doPut(String url, String body) throws IOException { HttpPut httpPut = new HttpPut(getWsapiUrl() + url); httpPut.setEntity(new StringEntity(body, "utf-8")); return doRequest(httpPut); }
[ "public", "String", "doPut", "(", "String", "url", ",", "String", "body", ")", "throws", "IOException", "{", "HttpPut", "httpPut", "=", "new", "HttpPut", "(", "getWsapiUrl", "(", ")", "+", "url", ")", ";", "httpPut", ".", "setEntity", "(", "new", "String...
Perform a put against the WSAPI @param url the request url @param body the body of the put @return the JSON encoded string response @throws IOException if a non-200 response code is returned or if some other problem occurs while executing the request
[ "Perform", "a", "put", "against", "the", "WSAPI" ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/client/HttpClient.java#L192-L196
100,909
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/client/HttpClient.java
HttpClient.doDelete
public String doDelete(String url) throws IOException { HttpDelete httpDelete = new HttpDelete(getWsapiUrl() + url); return doRequest(httpDelete); }
java
public String doDelete(String url) throws IOException { HttpDelete httpDelete = new HttpDelete(getWsapiUrl() + url); return doRequest(httpDelete); }
[ "public", "String", "doDelete", "(", "String", "url", ")", "throws", "IOException", "{", "HttpDelete", "httpDelete", "=", "new", "HttpDelete", "(", "getWsapiUrl", "(", ")", "+", "url", ")", ";", "return", "doRequest", "(", "httpDelete", ")", ";", "}" ]
Perform a delete against the WSAPI @param url the request url @return the JSON encoded string response @throws IOException if a non-200 response code is returned or if some other problem occurs while executing the request
[ "Perform", "a", "delete", "against", "the", "WSAPI" ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/client/HttpClient.java#L206-L209
100,910
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/client/HttpClient.java
HttpClient.doGet
public String doGet(String url) throws IOException { HttpGet httpGet = new HttpGet(getWsapiUrl() + url); return doRequest(httpGet); }
java
public String doGet(String url) throws IOException { HttpGet httpGet = new HttpGet(getWsapiUrl() + url); return doRequest(httpGet); }
[ "public", "String", "doGet", "(", "String", "url", ")", "throws", "IOException", "{", "HttpGet", "httpGet", "=", "new", "HttpGet", "(", "getWsapiUrl", "(", ")", "+", "url", ")", ";", "return", "doRequest", "(", "httpGet", ")", ";", "}" ]
Perform a get against the WSAPI @param url the request url @return the JSON encoded string response @throws IOException if a non-200 response code is returned or if some other problem occurs while executing the request
[ "Perform", "a", "get", "against", "the", "WSAPI" ]
542afa16ea44c9c64cebb0299500dcbbb50b6d7d
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/client/HttpClient.java#L219-L222
100,911
dkharrat/NexusDialog
nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/FormSectionController.java
FormSectionController.addElement
public FormElementController addElement(FormElementController element, int position) { if (element instanceof FormSectionController) { throw new IllegalArgumentException("Sub-sections are not supported"); } if (elements.containsKey(element.getName())) { throw new Illegal...
java
public FormElementController addElement(FormElementController element, int position) { if (element instanceof FormSectionController) { throw new IllegalArgumentException("Sub-sections are not supported"); } if (elements.containsKey(element.getName())) { throw new Illegal...
[ "public", "FormElementController", "addElement", "(", "FormElementController", "element", ",", "int", "position", ")", "{", "if", "(", "element", "instanceof", "FormSectionController", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Sub-sections are not supp...
Adds a form element to this section. Note that sub-sections are not supported. @param element the form element to add @param position the position at which to insert the element @return the same instance of the form element that was added to support method chaining
[ "Adds", "a", "form", "element", "to", "this", "section", ".", "Note", "that", "sub", "-", "sections", "are", "not", "supported", "." ]
f43a6a07940cced12286c622140f3a8ae3d178a1
https://github.com/dkharrat/NexusDialog/blob/f43a6a07940cced12286c622140f3a8ae3d178a1/nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/FormSectionController.java#L75-L87
100,912
dkharrat/NexusDialog
nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/FormSectionController.java
FormSectionController.removeElement
public FormElementController removeElement(String name) { FormElementController element = elements.remove(name); orderedElements.remove(element); return element; }
java
public FormElementController removeElement(String name) { FormElementController element = elements.remove(name); orderedElements.remove(element); return element; }
[ "public", "FormElementController", "removeElement", "(", "String", "name", ")", "{", "FormElementController", "element", "=", "elements", ".", "remove", "(", "name", ")", ";", "orderedElements", ".", "remove", "(", "element", ")", ";", "return", "element", ";", ...
Removes the form element with the specified name from this section. @param name the name of the form element to remove @return the removed form element instance, or null of no such element was found.
[ "Removes", "the", "form", "element", "with", "the", "specified", "name", "from", "this", "section", "." ]
f43a6a07940cced12286c622140f3a8ae3d178a1
https://github.com/dkharrat/NexusDialog/blob/f43a6a07940cced12286c622140f3a8ae3d178a1/nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/FormSectionController.java#L117-L121
100,913
dkharrat/NexusDialog
nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/LabeledFieldController.java
LabeledFieldController.setIsRequired
public void setIsRequired(boolean required) { if (! required) { validators.remove(REQUIRED_FIELD_VALIDATOR); } else if (! isRequired()) { validators.add(REQUIRED_FIELD_VALIDATOR); } }
java
public void setIsRequired(boolean required) { if (! required) { validators.remove(REQUIRED_FIELD_VALIDATOR); } else if (! isRequired()) { validators.add(REQUIRED_FIELD_VALIDATOR); } }
[ "public", "void", "setIsRequired", "(", "boolean", "required", ")", "{", "if", "(", "!", "required", ")", "{", "validators", ".", "remove", "(", "REQUIRED_FIELD_VALIDATOR", ")", ";", "}", "else", "if", "(", "!", "isRequired", "(", ")", ")", "{", "validat...
Sets whether this field is required to have user input. @param required if true, this field checks for a non-empty or non-null value upon validation. Otherwise, this field can be empty.
[ "Sets", "whether", "this", "field", "is", "required", "to", "have", "user", "input", "." ]
f43a6a07940cced12286c622140f3a8ae3d178a1
https://github.com/dkharrat/NexusDialog/blob/f43a6a07940cced12286c622140f3a8ae3d178a1/nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/LabeledFieldController.java#L75-L81
100,914
dkharrat/NexusDialog
nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/CheckBoxController.java
CheckBoxController.retrieveModelValues
private Set<Object> retrieveModelValues() { Set<Object> modelValues = (Set<Object>) getModel().getValue(getName()); if (modelValues == null) { modelValues = new HashSet<>(); } return modelValues; }
java
private Set<Object> retrieveModelValues() { Set<Object> modelValues = (Set<Object>) getModel().getValue(getName()); if (modelValues == null) { modelValues = new HashSet<>(); } return modelValues; }
[ "private", "Set", "<", "Object", ">", "retrieveModelValues", "(", ")", "{", "Set", "<", "Object", ">", "modelValues", "=", "(", "Set", "<", "Object", ">", ")", "getModel", "(", ")", ".", "getValue", "(", "getName", "(", ")", ")", ";", "if", "(", "m...
Returns the values hold in the model. @return The values from the model.
[ "Returns", "the", "values", "hold", "in", "the", "model", "." ]
f43a6a07940cced12286c622140f3a8ae3d178a1
https://github.com/dkharrat/NexusDialog/blob/f43a6a07940cced12286c622140f3a8ae3d178a1/nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/CheckBoxController.java#L175-L181
100,915
dkharrat/NexusDialog
nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/FormController.java
FormController.getNumberOfElements
public int getNumberOfElements() { int count = 0; for (FormSectionController section : getSections()) { count += section.getElements().size(); } return count; }
java
public int getNumberOfElements() { int count = 0; for (FormSectionController section : getSections()) { count += section.getElements().size(); } return count; }
[ "public", "int", "getNumberOfElements", "(", ")", "{", "int", "count", "=", "0", ";", "for", "(", "FormSectionController", "section", ":", "getSections", "(", ")", ")", "{", "count", "+=", "section", ".", "getElements", "(", ")", ".", "size", "(", ")", ...
Returns the total number of elements in this form, not including sections. @return the total number of elements in this form, not including sections
[ "Returns", "the", "total", "number", "of", "elements", "in", "this", "form", "not", "including", "sections", "." ]
f43a6a07940cced12286c622140f3a8ae3d178a1
https://github.com/dkharrat/NexusDialog/blob/f43a6a07940cced12286c622140f3a8ae3d178a1/nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/FormController.java#L153-L160
100,916
dkharrat/NexusDialog
nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/FormController.java
FormController.validateInput
public List<ValidationError> validateInput() { List<ValidationError> errors = new ArrayList<ValidationError>(); for (FormSectionController section : getSections()) { for (FormElementController element : section.getElements()) { if (element instanceof LabeledFieldController) ...
java
public List<ValidationError> validateInput() { List<ValidationError> errors = new ArrayList<ValidationError>(); for (FormSectionController section : getSections()) { for (FormElementController element : section.getElements()) { if (element instanceof LabeledFieldController) ...
[ "public", "List", "<", "ValidationError", ">", "validateInput", "(", ")", "{", "List", "<", "ValidationError", ">", "errors", "=", "new", "ArrayList", "<", "ValidationError", ">", "(", ")", ";", "for", "(", "FormSectionController", "section", ":", "getSections...
Returns a list of validation errors of the form's input @return a list of validation errors of the form's input
[ "Returns", "a", "list", "of", "validation", "errors", "of", "the", "form", "s", "input" ]
f43a6a07940cced12286c622140f3a8ae3d178a1
https://github.com/dkharrat/NexusDialog/blob/f43a6a07940cced12286c622140f3a8ae3d178a1/nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/FormController.java#L176-L189
100,917
dkharrat/NexusDialog
nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/FormFragment.java
FormFragment.recreateViews
protected void recreateViews() { ViewGroup containerView = (ViewGroup) getActivity().findViewById(R.id.form_elements_container); formController.recreateViews(containerView); }
java
protected void recreateViews() { ViewGroup containerView = (ViewGroup) getActivity().findViewById(R.id.form_elements_container); formController.recreateViews(containerView); }
[ "protected", "void", "recreateViews", "(", ")", "{", "ViewGroup", "containerView", "=", "(", "ViewGroup", ")", "getActivity", "(", ")", ".", "findViewById", "(", "R", ".", "id", ".", "form_elements_container", ")", ";", "formController", ".", "recreateViews", ...
Recreates the views for all the elements that are in the form. This method needs to be called when field are dynamically added or removed
[ "Recreates", "the", "views", "for", "all", "the", "elements", "that", "are", "in", "the", "form", ".", "This", "method", "needs", "to", "be", "called", "when", "field", "are", "dynamically", "added", "or", "removed" ]
f43a6a07940cced12286c622140f3a8ae3d178a1
https://github.com/dkharrat/NexusDialog/blob/f43a6a07940cced12286c622140f3a8ae3d178a1/nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/FormFragment.java#L77-L80
100,918
sterodium/selenium-grid-extensions
extension-clients/file-extension-client/src/main/java/io/sterodium/extensions/client/FileExtensionClient.java
FileExtensionClient.download
public File download(String pathToFile, String extension) { return fileDownloadRequest.download(pathToFile, extension); }
java
public File download(String pathToFile, String extension) { return fileDownloadRequest.download(pathToFile, extension); }
[ "public", "File", "download", "(", "String", "pathToFile", ",", "String", "extension", ")", "{", "return", "fileDownloadRequest", ".", "download", "(", "pathToFile", ",", "extension", ")", ";", "}" ]
Download file from Selenium Node. @param pathToFile absolute path to file @return downloaded file with extension in temp directory
[ "Download", "file", "from", "Selenium", "Node", "." ]
407cde003020f7ab9e7bb5405371b0b52b5018c8
https://github.com/sterodium/selenium-grid-extensions/blob/407cde003020f7ab9e7bb5405371b0b52b5018c8/extension-clients/file-extension-client/src/main/java/io/sterodium/extensions/client/FileExtensionClient.java#L48-L50
100,919
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.refreshAccessToken
private void refreshAccessToken() { final Long expiresIn = credential.getExpiresInSeconds(); // trigger refresh if token is about to expire String accessToken = credential.getAccessToken(); if (accessToken == null || expiresIn != null && expiresIn <= 60) { try { credential.refreshToken();...
java
private void refreshAccessToken() { final Long expiresIn = credential.getExpiresInSeconds(); // trigger refresh if token is about to expire String accessToken = credential.getAccessToken(); if (accessToken == null || expiresIn != null && expiresIn <= 60) { try { credential.refreshToken();...
[ "private", "void", "refreshAccessToken", "(", ")", "{", "final", "Long", "expiresIn", "=", "credential", ".", "getExpiresInSeconds", "(", ")", ";", "// trigger refresh if token is about to expire", "String", "accessToken", "=", "credential", ".", "getAccessToken", "(", ...
Refresh the Google Cloud API access token, if necessary.
[ "Refresh", "the", "Google", "Cloud", "API", "access", "token", "if", "necessary", "." ]
7d021528fa5bc29be458e6f210fa62f59b71d004
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L230-L246
100,920
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.get
private <T> PubsubFuture<T> get(final String operation, final String path, final ResponseReader<T> responseReader) { return request(operation, HttpMethod.GET, path, responseReader); }
java
private <T> PubsubFuture<T> get(final String operation, final String path, final ResponseReader<T> responseReader) { return request(operation, HttpMethod.GET, path, responseReader); }
[ "private", "<", "T", ">", "PubsubFuture", "<", "T", ">", "get", "(", "final", "String", "operation", ",", "final", "String", "path", ",", "final", "ResponseReader", "<", "T", ">", "responseReader", ")", "{", "return", "request", "(", "operation", ",", "H...
Make a GET request.
[ "Make", "a", "GET", "request", "." ]
7d021528fa5bc29be458e6f210fa62f59b71d004
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L714-L716
100,921
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.post
private <T> PubsubFuture<T> post(final String operation, final String path, final Object payload, final ResponseReader<T> responseReader) { return request(operation, HttpMethod.POST, path, payload, responseReader); }
java
private <T> PubsubFuture<T> post(final String operation, final String path, final Object payload, final ResponseReader<T> responseReader) { return request(operation, HttpMethod.POST, path, payload, responseReader); }
[ "private", "<", "T", ">", "PubsubFuture", "<", "T", ">", "post", "(", "final", "String", "operation", ",", "final", "String", "path", ",", "final", "Object", "payload", ",", "final", "ResponseReader", "<", "T", ">", "responseReader", ")", "{", "return", ...
Make a POST request.
[ "Make", "a", "POST", "request", "." ]
7d021528fa5bc29be458e6f210fa62f59b71d004
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L721-L724
100,922
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.put
private <T> PubsubFuture<T> put(final String operation, final String path, final Object payload, final ResponseReader<T> responseReader) { return request(operation, HttpMethod.PUT, path, payload, responseReader); }
java
private <T> PubsubFuture<T> put(final String operation, final String path, final Object payload, final ResponseReader<T> responseReader) { return request(operation, HttpMethod.PUT, path, payload, responseReader); }
[ "private", "<", "T", ">", "PubsubFuture", "<", "T", ">", "put", "(", "final", "String", "operation", ",", "final", "String", "path", ",", "final", "Object", "payload", ",", "final", "ResponseReader", "<", "T", ">", "responseReader", ")", "{", "return", "...
Make a PUT request.
[ "Make", "a", "PUT", "request", "." ]
7d021528fa5bc29be458e6f210fa62f59b71d004
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L729-L732
100,923
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.delete
private <T> PubsubFuture<T> delete(final String operation, final String path, final ResponseReader<T> responseReader) { return request(operation, HttpMethod.DELETE, path, responseReader); }
java
private <T> PubsubFuture<T> delete(final String operation, final String path, final ResponseReader<T> responseReader) { return request(operation, HttpMethod.DELETE, path, responseReader); }
[ "private", "<", "T", ">", "PubsubFuture", "<", "T", ">", "delete", "(", "final", "String", "operation", ",", "final", "String", "path", ",", "final", "ResponseReader", "<", "T", ">", "responseReader", ")", "{", "return", "request", "(", "operation", ",", ...
Make a DELETE request.
[ "Make", "a", "DELETE", "request", "." ]
7d021528fa5bc29be458e6f210fa62f59b71d004
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L737-L739
100,924
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Publisher.java
Publisher.publish
public CompletableFuture<String> publish(final String topic, final Message message) { final TopicQueue queue = topics.computeIfAbsent(topic, TopicQueue::new); final CompletableFuture<String> future = queue.send(message); listener.publishingMessage(this, topic, message, future); return future; }
java
public CompletableFuture<String> publish(final String topic, final Message message) { final TopicQueue queue = topics.computeIfAbsent(topic, TopicQueue::new); final CompletableFuture<String> future = queue.send(message); listener.publishingMessage(this, topic, message, future); return future; }
[ "public", "CompletableFuture", "<", "String", ">", "publish", "(", "final", "String", "topic", ",", "final", "Message", "message", ")", "{", "final", "TopicQueue", "queue", "=", "topics", ".", "computeIfAbsent", "(", "topic", ",", "TopicQueue", "::", "new", ...
Publish a message on a specific topic. @param topic The topic name to publish on. Note that this is the short name, not the fully qualified name including project. The project to publish on is configured using the {@link Builder}. @param message The message to publish. @return A future that is fulfilled with the res...
[ "Publish", "a", "message", "on", "a", "specific", "topic", "." ]
7d021528fa5bc29be458e6f210fa62f59b71d004
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Publisher.java#L180-L185
100,925
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Publisher.java
Publisher.topicQueueSize
public int topicQueueSize(final String topic) { final TopicQueue topicQueue = this.topics.get(topic); return topicQueue == null ? 0 : topicQueue.queue.size(); }
java
public int topicQueueSize(final String topic) { final TopicQueue topicQueue = this.topics.get(topic); return topicQueue == null ? 0 : topicQueue.queue.size(); }
[ "public", "int", "topicQueueSize", "(", "final", "String", "topic", ")", "{", "final", "TopicQueue", "topicQueue", "=", "this", ".", "topics", ".", "get", "(", "topic", ")", ";", "return", "topicQueue", "==", "null", "?", "0", ":", "topicQueue", ".", "qu...
Get the current queue size for the given topic name. Returns 0 if the topic does not exist. @param topic the topic name
[ "Get", "the", "current", "queue", "size", "for", "the", "given", "topic", "name", ".", "Returns", "0", "if", "the", "topic", "does", "not", "exist", "." ]
7d021528fa5bc29be458e6f210fa62f59b71d004
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Publisher.java#L250-L253
100,926
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Publisher.java
Publisher.sendPending
private void sendPending() { while (outstanding.get() < concurrency) { final TopicQueue queue = pendingTopics.poll(); if (queue == null) { return; } queue.pending = false; final int sent = queue.sendBatch(); // Did we send a whole batch? Then there might be more message...
java
private void sendPending() { while (outstanding.get() < concurrency) { final TopicQueue queue = pendingTopics.poll(); if (queue == null) { return; } queue.pending = false; final int sent = queue.sendBatch(); // Did we send a whole batch? Then there might be more message...
[ "private", "void", "sendPending", "(", ")", "{", "while", "(", "outstanding", ".", "get", "(", ")", "<", "concurrency", ")", "{", "final", "TopicQueue", "queue", "=", "pendingTopics", ".", "poll", "(", ")", ";", "if", "(", "queue", "==", "null", ")", ...
Send any pending topics.
[ "Send", "any", "pending", "topics", "." ]
7d021528fa5bc29be458e6f210fa62f59b71d004
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Publisher.java#L455-L471
100,927
Dynatrace/OneAgent-SDK-for-Java
samples/webrequest/src/main/java/com/dynatrace/oneagent/sdk/samples/webrequest/FakedWebserver.java
FakedWebserver.serve
private void serve(HttpRequest request, HttpResponse response) { String url = request.getUri(); System.out.println("[Server] serve " + url); IncomingWebRequestTracer incomingWebrequestTracer = oneAgentSDK.traceIncomingWebRequest(webAppInfo, url, request.getMethod()); // add request header, parameter and remote...
java
private void serve(HttpRequest request, HttpResponse response) { String url = request.getUri(); System.out.println("[Server] serve " + url); IncomingWebRequestTracer incomingWebrequestTracer = oneAgentSDK.traceIncomingWebRequest(webAppInfo, url, request.getMethod()); // add request header, parameter and remote...
[ "private", "void", "serve", "(", "HttpRequest", "request", ",", "HttpResponse", "response", ")", "{", "String", "url", "=", "request", ".", "getUri", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"[Server] serve \"", "+", "url", ")", ";", "...
faked http request handling. shows usage of OneAgent SDK's incoming webrequest API
[ "faked", "http", "request", "handling", ".", "shows", "usage", "of", "OneAgent", "SDK", "s", "incoming", "webrequest", "API" ]
a554cd971179faf8e598dd93df342a603d39e734
https://github.com/Dynatrace/OneAgent-SDK-for-Java/blob/a554cd971179faf8e598dd93df342a603d39e734/samples/webrequest/src/main/java/com/dynatrace/oneagent/sdk/samples/webrequest/FakedWebserver.java#L110-L141
100,928
Dynatrace/OneAgent-SDK-for-Java
samples/messaging/src/main/java/com/dynatrace/oneagent/sdk/samples/messaging/MessagingApp.java
MessagingApp.receiveMessage
private void receiveMessage() { MessagingSystemInfo messagingSystemInfo = oneAgentSdk.createMessagingSystemInfo("DynatraceSample", "theQueue", MessageDestinationType.QUEUE, ChannelType.IN_PROCESS, null); IncomingMessageReceiveTracer incomingMessageReceiveTracer = oneAgentSdk.traceIncomingMessageReceive(messagingSys...
java
private void receiveMessage() { MessagingSystemInfo messagingSystemInfo = oneAgentSdk.createMessagingSystemInfo("DynatraceSample", "theQueue", MessageDestinationType.QUEUE, ChannelType.IN_PROCESS, null); IncomingMessageReceiveTracer incomingMessageReceiveTracer = oneAgentSdk.traceIncomingMessageReceive(messagingSys...
[ "private", "void", "receiveMessage", "(", ")", "{", "MessagingSystemInfo", "messagingSystemInfo", "=", "oneAgentSdk", ".", "createMessagingSystemInfo", "(", "\"DynatraceSample\"", ",", "\"theQueue\"", ",", "MessageDestinationType", ".", "QUEUE", ",", "ChannelType", ".", ...
shows how to trace a blocking receive of a message
[ "shows", "how", "to", "trace", "a", "blocking", "receive", "of", "a", "message" ]
a554cd971179faf8e598dd93df342a603d39e734
https://github.com/Dynatrace/OneAgent-SDK-for-Java/blob/a554cd971179faf8e598dd93df342a603d39e734/samples/messaging/src/main/java/com/dynatrace/oneagent/sdk/samples/messaging/MessagingApp.java#L122-L151
100,929
rampo/UpdateChecker
library/src/main/java/com/rampo/updatechecker/UpdateChecker.java
UpdateChecker.versionDownloadableFound
@Override public void versionDownloadableFound(String versionDownloadable) { if (Comparator.isVersionDownloadableNewer(mActivity, versionDownloadable)) { if (hasToShowNotice(versionDownloadable) && !hasUserTappedToNotShowNoticeAgain(versionDownloadable)) { mLibraryResultCallaback...
java
@Override public void versionDownloadableFound(String versionDownloadable) { if (Comparator.isVersionDownloadableNewer(mActivity, versionDownloadable)) { if (hasToShowNotice(versionDownloadable) && !hasUserTappedToNotShowNoticeAgain(versionDownloadable)) { mLibraryResultCallaback...
[ "@", "Override", "public", "void", "versionDownloadableFound", "(", "String", "versionDownloadable", ")", "{", "if", "(", "Comparator", ".", "isVersionDownloadableNewer", "(", "mActivity", ",", "versionDownloadable", ")", ")", "{", "if", "(", "hasToShowNotice", "(",...
If the library found a version available on the Store, and it's different from the installed one, notify it to the user. @param versionDownloadable String to compare to the version installed of the app.
[ "If", "the", "library", "found", "a", "version", "available", "on", "the", "Store", "and", "it", "s", "different", "from", "the", "installed", "one", "notify", "it", "to", "the", "user", "." ]
738da234d46396b6396e15e7261f38b0cabf9913
https://github.com/rampo/UpdateChecker/blob/738da234d46396b6396e15e7261f38b0cabf9913/library/src/main/java/com/rampo/updatechecker/UpdateChecker.java#L137-L149
100,930
rampo/UpdateChecker
library/src/main/java/com/rampo/updatechecker/UpdateChecker.java
UpdateChecker.hasUserTappedToNotShowNoticeAgain
private boolean hasUserTappedToNotShowNoticeAgain(String versionDownloadable) { SharedPreferences prefs = mActivity.getSharedPreferences(PREFS_FILENAME, 0); String prefKey = DONT_SHOW_AGAIN_PREF_KEY + versionDownloadable; return prefs.getBoolean(prefKey, false); }
java
private boolean hasUserTappedToNotShowNoticeAgain(String versionDownloadable) { SharedPreferences prefs = mActivity.getSharedPreferences(PREFS_FILENAME, 0); String prefKey = DONT_SHOW_AGAIN_PREF_KEY + versionDownloadable; return prefs.getBoolean(prefKey, false); }
[ "private", "boolean", "hasUserTappedToNotShowNoticeAgain", "(", "String", "versionDownloadable", ")", "{", "SharedPreferences", "prefs", "=", "mActivity", ".", "getSharedPreferences", "(", "PREFS_FILENAME", ",", "0", ")", ";", "String", "prefKey", "=", "DONT_SHOW_AGAIN_...
Get if the user has tapped on "No, thanks" button on dialog for this downloable version. @param versionDownloadable version downloadable from the Store. @see com.rampo.updatechecker.notice.Dialog#userHasTappedToNotShowNoticeAgain(android.content.Context, String)
[ "Get", "if", "the", "user", "has", "tapped", "on", "No", "thanks", "button", "on", "dialog", "for", "this", "downloable", "version", "." ]
738da234d46396b6396e15e7261f38b0cabf9913
https://github.com/rampo/UpdateChecker/blob/738da234d46396b6396e15e7261f38b0cabf9913/library/src/main/java/com/rampo/updatechecker/UpdateChecker.java#L251-L255
100,931
rampo/UpdateChecker
library/src/main/java/com/rampo/updatechecker/UpdateChecker.java
UpdateChecker.saveNumberOfChecksForUpdatedVersion
private void saveNumberOfChecksForUpdatedVersion(String versionDownloadable, int mChecksMade) { mChecksMade++; SharedPreferences prefs = mActivity.getSharedPreferences(PREFS_FILENAME, 0); SharedPreferences.Editor editor = prefs.edit(); editor.putInt(SUCCESSFUL_CHEKS_PREF_KEY + versionDow...
java
private void saveNumberOfChecksForUpdatedVersion(String versionDownloadable, int mChecksMade) { mChecksMade++; SharedPreferences prefs = mActivity.getSharedPreferences(PREFS_FILENAME, 0); SharedPreferences.Editor editor = prefs.edit(); editor.putInt(SUCCESSFUL_CHEKS_PREF_KEY + versionDow...
[ "private", "void", "saveNumberOfChecksForUpdatedVersion", "(", "String", "versionDownloadable", ",", "int", "mChecksMade", ")", "{", "mChecksMade", "++", ";", "SharedPreferences", "prefs", "=", "mActivity", ".", "getSharedPreferences", "(", "PREFS_FILENAME", ",", "0", ...
Update number of checks for this version downloadable from the Store.
[ "Update", "number", "of", "checks", "for", "this", "version", "downloadable", "from", "the", "Store", "." ]
738da234d46396b6396e15e7261f38b0cabf9913
https://github.com/rampo/UpdateChecker/blob/738da234d46396b6396e15e7261f38b0cabf9913/library/src/main/java/com/rampo/updatechecker/UpdateChecker.java#L276-L283
100,932
rampo/UpdateChecker
library/src/main/java/com/rampo/updatechecker/Comparator.java
Comparator.isVersionDownloadableNewer
public static boolean isVersionDownloadableNewer(Activity mActivity, String versionDownloadable) { String versionInstalled = null; try { versionInstalled = mActivity.getPackageManager().getPackageInfo(mActivity.getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundExc...
java
public static boolean isVersionDownloadableNewer(Activity mActivity, String versionDownloadable) { String versionInstalled = null; try { versionInstalled = mActivity.getPackageManager().getPackageInfo(mActivity.getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundExc...
[ "public", "static", "boolean", "isVersionDownloadableNewer", "(", "Activity", "mActivity", ",", "String", "versionDownloadable", ")", "{", "String", "versionInstalled", "=", "null", ";", "try", "{", "versionInstalled", "=", "mActivity", ".", "getPackageManager", "(", ...
Compare the string versionDownloadable to the version installed of the app. @param versionDownloadable String to compare to the version installed of the app.
[ "Compare", "the", "string", "versionDownloadable", "to", "the", "version", "installed", "of", "the", "app", "." ]
738da234d46396b6396e15e7261f38b0cabf9913
https://github.com/rampo/UpdateChecker/blob/738da234d46396b6396e15e7261f38b0cabf9913/library/src/main/java/com/rampo/updatechecker/Comparator.java#L27-L38
100,933
rampo/UpdateChecker
library/src/main/java/com/rampo/updatechecker/utils/Network.java
Network.isAvailable
public static boolean isAvailable(Context context) { boolean connected = false; ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (cm != null) { NetworkInfo ni = cm.getActiveNetworkInfo(); if (ni != null) { ...
java
public static boolean isAvailable(Context context) { boolean connected = false; ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (cm != null) { NetworkInfo ni = cm.getActiveNetworkInfo(); if (ni != null) { ...
[ "public", "static", "boolean", "isAvailable", "(", "Context", "context", ")", "{", "boolean", "connected", "=", "false", ";", "ConnectivityManager", "cm", "=", "(", "ConnectivityManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "CONNECTIVITY_...
Check if a network is available
[ "Check", "if", "a", "network", "is", "available" ]
738da234d46396b6396e15e7261f38b0cabf9913
https://github.com/rampo/UpdateChecker/blob/738da234d46396b6396e15e7261f38b0cabf9913/library/src/main/java/com/rampo/updatechecker/utils/Network.java#L14-L24
100,934
rampo/UpdateChecker
library/src/main/java/com/rampo/updatechecker/ASyncCheck.java
ASyncCheck.onPostExecute
@Override protected void onPostExecute(Integer result) { if (result == VERSION_DOWNLOADABLE_FOUND) { mResultInterface.versionDownloadableFound(mVersionDownloadable); } else if (result == NETWORK_ERROR) { mResultInterface.networkError(); Network.logConnectionError(...
java
@Override protected void onPostExecute(Integer result) { if (result == VERSION_DOWNLOADABLE_FOUND) { mResultInterface.versionDownloadableFound(mVersionDownloadable); } else if (result == NETWORK_ERROR) { mResultInterface.networkError(); Network.logConnectionError(...
[ "@", "Override", "protected", "void", "onPostExecute", "(", "Integer", "result", ")", "{", "if", "(", "result", "==", "VERSION_DOWNLOADABLE_FOUND", ")", "{", "mResultInterface", ".", "versionDownloadableFound", "(", "mVersionDownloadable", ")", ";", "}", "else", "...
Return to UpdateChecker class to work with the versionDownloadable if the library found it. @param result
[ "Return", "to", "UpdateChecker", "class", "to", "work", "with", "the", "versionDownloadable", "if", "the", "library", "found", "it", "." ]
738da234d46396b6396e15e7261f38b0cabf9913
https://github.com/rampo/UpdateChecker/blob/738da234d46396b6396e15e7261f38b0cabf9913/library/src/main/java/com/rampo/updatechecker/ASyncCheck.java#L134-L151
100,935
bazaarvoice/ostrich
zookeeper/registry/src/main/java/com/bazaarvoice/ostrich/registry/zookeeper/ZooKeeperServiceRegistry.java
ZooKeeperServiceRegistry.makeServicePath
public static String makeServicePath(String serviceName) { checkNotNull(serviceName); checkArgument(!"".equals(serviceName)); return ZKPaths.makePath(ROOT_SERVICES_PATH, serviceName); }
java
public static String makeServicePath(String serviceName) { checkNotNull(serviceName); checkArgument(!"".equals(serviceName)); return ZKPaths.makePath(ROOT_SERVICES_PATH, serviceName); }
[ "public", "static", "String", "makeServicePath", "(", "String", "serviceName", ")", "{", "checkNotNull", "(", "serviceName", ")", ";", "checkArgument", "(", "!", "\"\"", ".", "equals", "(", "serviceName", ")", ")", ";", "return", "ZKPaths", ".", "makePath", ...
Construct the path in ZooKeeper to where a service's children live. @param serviceName The name of the service to get the ZooKeeper path for. @return The ZooKeeper path.
[ "Construct", "the", "path", "in", "ZooKeeper", "to", "where", "a", "service", "s", "children", "live", "." ]
13591867870ab23445253f11fc872662a8028191
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/zookeeper/registry/src/main/java/com/bazaarvoice/ostrich/registry/zookeeper/ZooKeeperServiceRegistry.java#L153-L157
100,936
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/ServiceCachingPolicyBuilder.java
ServiceCachingPolicyBuilder.withMaxServiceInstanceIdleTime
public ServiceCachingPolicyBuilder withMaxServiceInstanceIdleTime(int maxServiceInstanceIdleTime, TimeUnit unit) { checkState(maxServiceInstanceIdleTime > 0); checkNotNull(unit); _maxServiceInstanceIdleTimeNanos = unit.toNanos(maxServiceInstanceIdleTime); return this; }
java
public ServiceCachingPolicyBuilder withMaxServiceInstanceIdleTime(int maxServiceInstanceIdleTime, TimeUnit unit) { checkState(maxServiceInstanceIdleTime > 0); checkNotNull(unit); _maxServiceInstanceIdleTimeNanos = unit.toNanos(maxServiceInstanceIdleTime); return this; }
[ "public", "ServiceCachingPolicyBuilder", "withMaxServiceInstanceIdleTime", "(", "int", "maxServiceInstanceIdleTime", ",", "TimeUnit", "unit", ")", "{", "checkState", "(", "maxServiceInstanceIdleTime", ">", "0", ")", ";", "checkNotNull", "(", "unit", ")", ";", "_maxServi...
Set the amount of time a cached instance is allowed to sit idle in the cache before being eligible for expiration. If never called, cached instances will not expire solely due to idle time. @param maxServiceInstanceIdleTime The time an instance may be idle before allowed to expire. @param unit T...
[ "Set", "the", "amount", "of", "time", "a", "cached", "instance", "is", "allowed", "to", "sit", "idle", "in", "the", "cache", "before", "being", "eligible", "for", "expiration", ".", "If", "never", "called", "cached", "instances", "will", "not", "expire", "...
13591867870ab23445253f11fc872662a8028191
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/pool/ServiceCachingPolicyBuilder.java#L102-L108
100,937
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/MultiThreadedClientServiceCache.java
MultiThreadedClientServiceCache.destroyService
private void destroyService(ServiceHandle<S> serviceHandle) { try { _serviceFactory.destroy(serviceHandle.getEndPoint(), serviceHandle.getService()); } catch (Exception e) { // this should not happen, but if it does, swallow the exception and log it LOG.warn("Error de...
java
private void destroyService(ServiceHandle<S> serviceHandle) { try { _serviceFactory.destroy(serviceHandle.getEndPoint(), serviceHandle.getService()); } catch (Exception e) { // this should not happen, but if it does, swallow the exception and log it LOG.warn("Error de...
[ "private", "void", "destroyService", "(", "ServiceHandle", "<", "S", ">", "serviceHandle", ")", "{", "try", "{", "_serviceFactory", ".", "destroy", "(", "serviceHandle", ".", "getEndPoint", "(", ")", ",", "serviceHandle", ".", "getService", "(", ")", ")", ";...
Destroys a service handle quietly, swallows any exception occurred @param serviceHandle to destroy
[ "Destroys", "a", "service", "handle", "quietly", "swallows", "any", "exception", "occurred" ]
13591867870ab23445253f11fc872662a8028191
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/pool/MultiThreadedClientServiceCache.java#L353-L360
100,938
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java
PartitionContextBuilder.put
public PartitionContextBuilder put(String key, Object value) { _map.put(key, value); return this; }
java
public PartitionContextBuilder put(String key, Object value) { _map.put(key, value); return this; }
[ "public", "PartitionContextBuilder", "put", "(", "String", "key", ",", "Object", "value", ")", "{", "_map", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not allowed. @return this
[ "Adds", "the", "specified", "key", "and", "value", "to", "the", "partition", "context", ".", "Null", "keys", "or", "values", "and", "duplicate", "keys", "are", "not", "allowed", "." ]
13591867870ab23445253f11fc872662a8028191
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java#L41-L44
100,939
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/metrics/Metrics.java
Metrics.forInstance
public static InstanceMetrics forInstance(MetricRegistry metrics, Object instance, String serviceName) { return new InstanceMetrics(metrics, instance, serviceName); }
java
public static InstanceMetrics forInstance(MetricRegistry metrics, Object instance, String serviceName) { return new InstanceMetrics(metrics, instance, serviceName); }
[ "public", "static", "InstanceMetrics", "forInstance", "(", "MetricRegistry", "metrics", ",", "Object", "instance", ",", "String", "serviceName", ")", "{", "return", "new", "InstanceMetrics", "(", "metrics", ",", "instance", ",", "serviceName", ")", ";", "}" ]
Create a metrics instance that corresponds to a single instance of a class. This is useful for cases where there exists one instance per service. For example in a ServicePool.
[ "Create", "a", "metrics", "instance", "that", "corresponds", "to", "a", "single", "instance", "of", "a", "class", ".", "This", "is", "useful", "for", "cases", "where", "there", "exists", "one", "instance", "per", "service", ".", "For", "example", "in", "a"...
13591867870ab23445253f11fc872662a8028191
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/metrics/Metrics.java#L39-L41
100,940
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/AnnotationPartitionContextSupplier.java
AnnotationPartitionContextSupplier.collectPartitionKeyAnnotations
private String[] collectPartitionKeyAnnotations(Method method) { Annotation[][] annotations = method.getParameterAnnotations(); String[] keyMappings = new String[annotations.length]; boolean keyMappingFound = false; Map<String, Integer> unique = Maps.newHashMap(); for (int i = 0;...
java
private String[] collectPartitionKeyAnnotations(Method method) { Annotation[][] annotations = method.getParameterAnnotations(); String[] keyMappings = new String[annotations.length]; boolean keyMappingFound = false; Map<String, Integer> unique = Maps.newHashMap(); for (int i = 0;...
[ "private", "String", "[", "]", "collectPartitionKeyAnnotations", "(", "Method", "method", ")", "{", "Annotation", "[", "]", "[", "]", "annotations", "=", "method", ".", "getParameterAnnotations", "(", ")", ";", "String", "[", "]", "keyMappings", "=", "new", ...
Returns an array indexed by argument index with the value of the @PartitionKey annotation for each argument, or null if no arguments are annotated with @PartitionKey.
[ "Returns", "an", "array", "indexed", "by", "argument", "index", "with", "the", "value", "of", "the" ]
13591867870ab23445253f11fc872662a8028191
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/pool/AnnotationPartitionContextSupplier.java#L81-L99
100,941
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/SingleThreadedClientServiceCache.java
SingleThreadedClientServiceCache.checkIn
@Override public void checkIn(ServiceHandle<S> handle) throws Exception { checkNotNull(handle); S service = handle.getService(); ServiceEndPoint endPoint = handle.getEndPoint(); // Figure out if we should check this revision in. If it was created before the last known invalid revi...
java
@Override public void checkIn(ServiceHandle<S> handle) throws Exception { checkNotNull(handle); S service = handle.getService(); ServiceEndPoint endPoint = handle.getEndPoint(); // Figure out if we should check this revision in. If it was created before the last known invalid revi...
[ "@", "Override", "public", "void", "checkIn", "(", "ServiceHandle", "<", "S", ">", "handle", ")", "throws", "Exception", "{", "checkNotNull", "(", "handle", ")", ";", "S", "service", "=", "handle", ".", "getService", "(", ")", ";", "ServiceEndPoint", "endP...
Returns a service instance for an end point to the cache so that it may be used by other users. @param handle The service handle that is being checked in. @throws Exception Never.
[ "Returns", "a", "service", "instance", "for", "an", "end", "point", "to", "the", "cache", "so", "that", "it", "may", "be", "used", "by", "other", "users", "." ]
13591867870ab23445253f11fc872662a8028191
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/pool/SingleThreadedClientServiceCache.java#L197-L214
100,942
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/partition/ConsistentHashPartitionFilter.java
ConsistentHashPartitionFilter.computeHashCodes
private List<Integer> computeHashCodes(String endPointId) { // Use the libketama approach of using MD5 hashes to generate 32-bit random values. This assigns a set of // randomly generated ranges to each end point. The individual ranges may vary widely in size, but, with // sufficient # of entr...
java
private List<Integer> computeHashCodes(String endPointId) { // Use the libketama approach of using MD5 hashes to generate 32-bit random values. This assigns a set of // randomly generated ranges to each end point. The individual ranges may vary widely in size, but, with // sufficient # of entr...
[ "private", "List", "<", "Integer", ">", "computeHashCodes", "(", "String", "endPointId", ")", "{", "// Use the libketama approach of using MD5 hashes to generate 32-bit random values. This assigns a set of", "// randomly generated ranges to each end point. The individual ranges may vary wi...
Returns a list of pseudo-random 32-bit values derived from the specified end point ID.
[ "Returns", "a", "list", "of", "pseudo", "-", "random", "32", "-", "bit", "values", "derived", "from", "the", "specified", "end", "point", "ID", "." ]
13591867870ab23445253f11fc872662a8028191
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/partition/ConsistentHashPartitionFilter.java#L144-L160
100,943
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolProxies.java
ServicePoolProxies.close
public static <S> void close(S dynamicProxy) { // Use closeQuietly since ServicePool.close() doesn't throw IOException. try { Closeables.close(getPool(dynamicProxy), true); } catch (IOException e) { throw new AssertionError(); // close swallows IOExceptions } ...
java
public static <S> void close(S dynamicProxy) { // Use closeQuietly since ServicePool.close() doesn't throw IOException. try { Closeables.close(getPool(dynamicProxy), true); } catch (IOException e) { throw new AssertionError(); // close swallows IOExceptions } ...
[ "public", "static", "<", "S", ">", "void", "close", "(", "S", "dynamicProxy", ")", "{", "// Use closeQuietly since ServicePool.close() doesn't throw IOException.", "try", "{", "Closeables", ".", "close", "(", "getPool", "(", "dynamicProxy", ")", ",", "true", ")", ...
Closes the service pool associated with the specified dynamic service proxy. @param dynamicProxy A service pool dynamic proxy created by {@link ServicePoolBuilder#buildProxy}. @param <S> The service interface type.
[ "Closes", "the", "service", "pool", "associated", "with", "the", "specified", "dynamic", "service", "proxy", "." ]
13591867870ab23445253f11fc872662a8028191
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolProxies.java#L33-L40
100,944
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/discovery/ConfiguredFixedHostDiscoverySource.java
ConfiguredFixedHostDiscoverySource.serialize
@SuppressWarnings("UnusedParameters") protected String serialize(String serviceName, String id, Payload payload) { return String.valueOf(payload); }
java
@SuppressWarnings("UnusedParameters") protected String serialize(String serviceName, String id, Payload payload) { return String.valueOf(payload); }
[ "@", "SuppressWarnings", "(", "\"UnusedParameters\"", ")", "protected", "String", "serialize", "(", "String", "serviceName", ",", "String", "id", ",", "Payload", "payload", ")", "{", "return", "String", ".", "valueOf", "(", "payload", ")", ";", "}" ]
Subclasses may override this to customize the persistent format of the payload.
[ "Subclasses", "may", "override", "this", "to", "customize", "the", "persistent", "format", "of", "the", "payload", "." ]
13591867870ab23445253f11fc872662a8028191
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/discovery/ConfiguredFixedHostDiscoverySource.java#L64-L67
100,945
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/ElementUtil.java
ElementUtil.getDeepName
static String getDeepName(final Element element) { if (element == null) { return ""; } return getDeepName(element.getParentElement()) + '/' + element.getName(); }
java
static String getDeepName(final Element element) { if (element == null) { return ""; } return getDeepName(element.getParentElement()) + '/' + element.getName(); }
[ "static", "String", "getDeepName", "(", "final", "Element", "element", ")", "{", "if", "(", "element", "==", "null", ")", "{", "return", "\"\"", ";", "}", "return", "getDeepName", "(", "element", ".", "getParentElement", "(", ")", ")", "+", "'", "'", "...
Returns fully qualified name for an Xml element.
[ "Returns", "fully", "qualified", "name", "for", "an", "Xml", "element", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/ElementUtil.java#L17-L22
100,946
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/ElementUtil.java
ElementUtil.isElementParentName
static boolean isElementParentName(Element element, String name) { Element parent = element.getParentElement(); if (parent == null) { return false; } return isElementName(parent, name); }
java
static boolean isElementParentName(Element element, String name) { Element parent = element.getParentElement(); if (parent == null) { return false; } return isElementName(parent, name); }
[ "static", "boolean", "isElementParentName", "(", "Element", "element", ",", "String", "name", ")", "{", "Element", "parent", "=", "element", ".", "getParentElement", "(", ")", ";", "if", "(", "parent", "==", "null", ")", "{", "return", "false", ";", "}", ...
Returns true if an elements parents name is same as argument
[ "Returns", "true", "if", "an", "elements", "parents", "name", "is", "same", "as", "argument" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/ElementUtil.java#L25-L31
100,947
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/HierarchyWrapper.java
HierarchyWrapper.createWrappedStructure
void createWrappedStructure(final WrapperFactory factory) { HierarchyWrapper currentWrapper = null; for (Content child : castToContentList(elementContent)) { Wrapper<?> wrapper = factory.create(child); if (wrapper instanceof SingleNewlineInTextWrapper) { continue;...
java
void createWrappedStructure(final WrapperFactory factory) { HierarchyWrapper currentWrapper = null; for (Content child : castToContentList(elementContent)) { Wrapper<?> wrapper = factory.create(child); if (wrapper instanceof SingleNewlineInTextWrapper) { continue;...
[ "void", "createWrappedStructure", "(", "final", "WrapperFactory", "factory", ")", "{", "HierarchyWrapper", "currentWrapper", "=", "null", ";", "for", "(", "Content", "child", ":", "castToContentList", "(", "elementContent", ")", ")", "{", "Wrapper", "<", "?", ">...
Traverses the initial xml element wrapper and builds hierarchy
[ "Traverses", "the", "initial", "xml", "element", "wrapper", "and", "builds", "hierarchy" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/HierarchyWrapper.java#L36-L54
100,948
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/HierarchyWrapper.java
HierarchyWrapper.processOperation
void processOperation(HierarchyWrapperOperation operation) { // Hook for start operation.startOfProcess(); // Hook to process other content (newlines and comments) otherContentList.forEach(operation::processOtherContent); if (elementContent != null && elementContent.isContentEl...
java
void processOperation(HierarchyWrapperOperation operation) { // Hook for start operation.startOfProcess(); // Hook to process other content (newlines and comments) otherContentList.forEach(operation::processOtherContent); if (elementContent != null && elementContent.isContentEl...
[ "void", "processOperation", "(", "HierarchyWrapperOperation", "operation", ")", "{", "// Hook for start", "operation", ".", "startOfProcess", "(", ")", ";", "// Hook to process other content (newlines and comments)", "otherContentList", ".", "forEach", "(", "operation", "::",...
Template method to traverse xml hierarchy
[ "Template", "method", "to", "traverse", "xml", "hierarchy" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/HierarchyWrapper.java#L71-L95
100,949
Ekryd/sortpom
sorter/src/main/java/sortpom/processinstruction/XmlProcessingInstructionParser.java
XmlProcessingInstructionParser.scanForIgnoredSections
public void scanForIgnoredSections(String originalXml) { this.originalXml = originalXml; SortpomPiScanner sortpomPiScanner = new SortpomPiScanner(logger); sortpomPiScanner.scan(originalXml); if (sortpomPiScanner.isScanError()) { throw new FailureException(sortpomPiScanner.get...
java
public void scanForIgnoredSections(String originalXml) { this.originalXml = originalXml; SortpomPiScanner sortpomPiScanner = new SortpomPiScanner(logger); sortpomPiScanner.scan(originalXml); if (sortpomPiScanner.isScanError()) { throw new FailureException(sortpomPiScanner.get...
[ "public", "void", "scanForIgnoredSections", "(", "String", "originalXml", ")", "{", "this", ".", "originalXml", "=", "originalXml", ";", "SortpomPiScanner", "sortpomPiScanner", "=", "new", "SortpomPiScanner", "(", "logger", ")", ";", "sortpomPiScanner", ".", "scan",...
Checks if pom file contains any processing instructions
[ "Checks", "if", "pom", "file", "contains", "any", "processing", "instructions" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/processinstruction/XmlProcessingInstructionParser.java#L23-L31
100,950
Ekryd/sortpom
sorter/src/main/java/sortpom/parameter/IndentCharacters.java
IndentCharacters.getIndentCharacters
public String getIndentCharacters() { if (nrOfIndentSpace == 0) { return ""; } if (nrOfIndentSpace == INDENT_TAB) { return "\t"; } if (nrOfIndentSpace < INDENT_TAB || nrOfIndentSpace > MAX_INDENT_SPACES) { throw new FailureException("nrOfIndent...
java
public String getIndentCharacters() { if (nrOfIndentSpace == 0) { return ""; } if (nrOfIndentSpace == INDENT_TAB) { return "\t"; } if (nrOfIndentSpace < INDENT_TAB || nrOfIndentSpace > MAX_INDENT_SPACES) { throw new FailureException("nrOfIndent...
[ "public", "String", "getIndentCharacters", "(", ")", "{", "if", "(", "nrOfIndentSpace", "==", "0", ")", "{", "return", "\"\"", ";", "}", "if", "(", "nrOfIndentSpace", "==", "INDENT_TAB", ")", "{", "return", "\"\\t\"", ";", "}", "if", "(", "nrOfIndentSpace"...
Gets the indent characters from parameter. @return the indent characters
[ "Gets", "the", "indent", "characters", "from", "parameter", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/parameter/IndentCharacters.java#L28-L41
100,951
Ekryd/sortpom
sorter/src/main/java/sortpom/util/FileUtil.java
FileUtil.setup
public void setup(PluginParameters parameters) { this.pomFile = parameters.pomFile; this.backupFileExtension = parameters.backupFileExtension; this.encoding = parameters.encoding; this.customSortOrderFile = parameters.customSortOrderFile; this.predefinedSortOrder = parameters.pre...
java
public void setup(PluginParameters parameters) { this.pomFile = parameters.pomFile; this.backupFileExtension = parameters.backupFileExtension; this.encoding = parameters.encoding; this.customSortOrderFile = parameters.customSortOrderFile; this.predefinedSortOrder = parameters.pre...
[ "public", "void", "setup", "(", "PluginParameters", "parameters", ")", "{", "this", ".", "pomFile", "=", "parameters", ".", "pomFile", ";", "this", ".", "backupFileExtension", "=", "parameters", ".", "backupFileExtension", ";", "this", ".", "encoding", "=", "p...
Initializes the class with sortpom parameters.
[ "Initializes", "the", "class", "with", "sortpom", "parameters", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/util/FileUtil.java#L30-L37
100,952
Ekryd/sortpom
sorter/src/main/java/sortpom/util/FileUtil.java
FileUtil.getPomFileContent
public String getPomFileContent() { try (InputStream inputStream = new FileInputStream(pomFile)) { return IOUtils.toString(inputStream, encoding); } catch (UnsupportedCharsetException ex) { throw new FailureException("Could not handle encoding: " + encoding, ex); } catch ...
java
public String getPomFileContent() { try (InputStream inputStream = new FileInputStream(pomFile)) { return IOUtils.toString(inputStream, encoding); } catch (UnsupportedCharsetException ex) { throw new FailureException("Could not handle encoding: " + encoding, ex); } catch ...
[ "public", "String", "getPomFileContent", "(", ")", "{", "try", "(", "InputStream", "inputStream", "=", "new", "FileInputStream", "(", "pomFile", ")", ")", "{", "return", "IOUtils", ".", "toString", "(", "inputStream", ",", "encoding", ")", ";", "}", "catch",...
Loads the pom file that will be sorted. @return Content of the file
[ "Loads", "the", "pom", "file", "that", "will", "be", "sorted", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/util/FileUtil.java#L72-L80
100,953
Ekryd/sortpom
sorter/src/main/java/sortpom/util/FileUtil.java
FileUtil.getDefaultSortOrderXml
private String getDefaultSortOrderXml() throws IOException { CheckedSupplier<InputStream, IOException> createStreamFunc = () -> { if (customSortOrderFile != null) { UrlWrapper urlWrapper = new UrlWrapper(customSortOrderFile); if (urlWrapper.isUrl()) { ...
java
private String getDefaultSortOrderXml() throws IOException { CheckedSupplier<InputStream, IOException> createStreamFunc = () -> { if (customSortOrderFile != null) { UrlWrapper urlWrapper = new UrlWrapper(customSortOrderFile); if (urlWrapper.isUrl()) { ...
[ "private", "String", "getDefaultSortOrderXml", "(", ")", "throws", "IOException", "{", "CheckedSupplier", "<", "InputStream", ",", "IOException", ">", "createStreamFunc", "=", "(", ")", "->", "{", "if", "(", "customSortOrderFile", "!=", "null", ")", "{", "UrlWra...
Retrieves the default sort order for sortpom @return Content of the default sort order file
[ "Retrieves", "the", "default", "sort", "order", "for", "sortpom" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/util/FileUtil.java#L114-L132
100,954
Ekryd/sortpom
sorter/src/main/java/sortpom/util/FileUtil.java
FileUtil.openCustomSortOrderFile
private InputStream openCustomSortOrderFile() throws FileNotFoundException { InputStream inputStream; try { inputStream = new FileInputStream(customSortOrderFile); } catch (FileNotFoundException ex) { // try classpath try { URL resource = this....
java
private InputStream openCustomSortOrderFile() throws FileNotFoundException { InputStream inputStream; try { inputStream = new FileInputStream(customSortOrderFile); } catch (FileNotFoundException ex) { // try classpath try { URL resource = this....
[ "private", "InputStream", "openCustomSortOrderFile", "(", ")", "throws", "FileNotFoundException", "{", "InputStream", "inputStream", ";", "try", "{", "inputStream", "=", "new", "FileInputStream", "(", "customSortOrderFile", ")", ";", "}", "catch", "(", "FileNotFoundEx...
Load custom sort order file from absolute or class path. @return a stream to the opened resource
[ "Load", "custom", "sort", "order", "file", "from", "absolute", "or", "class", "path", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/util/FileUtil.java#L139-L157
100,955
Ekryd/sortpom
sorter/src/main/java/sortpom/util/XmlOrderedResult.java
XmlOrderedResult.nameDiffers
public static XmlOrderedResult nameDiffers(String originalElementName, String newElementName) { return new XmlOrderedResult(false, String.format("The xml element <%s> should be placed before <%s>", newElementName, originalElementName)); }
java
public static XmlOrderedResult nameDiffers(String originalElementName, String newElementName) { return new XmlOrderedResult(false, String.format("The xml element <%s> should be placed before <%s>", newElementName, originalElementName)); }
[ "public", "static", "XmlOrderedResult", "nameDiffers", "(", "String", "originalElementName", ",", "String", "newElementName", ")", "{", "return", "new", "XmlOrderedResult", "(", "false", ",", "String", ".", "format", "(", "\"The xml element <%s> should be placed before <%...
The xml elements was not in the right order
[ "The", "xml", "elements", "was", "not", "in", "the", "right", "order" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/util/XmlOrderedResult.java#L24-L27
100,956
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/DetachOperation.java
DetachOperation.processElement
@Override public void processElement(Wrapper<Element> elementWrapper) { Element content = elementWrapper.getContent(); content.detach(); content.removeContent(); }
java
@Override public void processElement(Wrapper<Element> elementWrapper) { Element content = elementWrapper.getContent(); content.detach(); content.removeContent(); }
[ "@", "Override", "public", "void", "processElement", "(", "Wrapper", "<", "Element", ">", "elementWrapper", ")", "{", "Element", "content", "=", "elementWrapper", ".", "getContent", "(", ")", ";", "content", ".", "detach", "(", ")", ";", "content", ".", "r...
Detach each xml element
[ "Detach", "each", "xml", "element" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/DetachOperation.java#L22-L27
100,957
Ekryd/sortpom
sorter/src/main/java/sortpom/processinstruction/SortpomPiScanner.java
SortpomPiScanner.scan
public void scan(String originalXml) { Matcher matcher = INSTRUCTION_PATTERN.matcher(originalXml); while (matcher.find()) { scanOneInstruction(matcher.group(1)); containsIgnoredSections = true; } if (expectedNextInstruction != IGNORE) { addError(String...
java
public void scan(String originalXml) { Matcher matcher = INSTRUCTION_PATTERN.matcher(originalXml); while (matcher.find()) { scanOneInstruction(matcher.group(1)); containsIgnoredSections = true; } if (expectedNextInstruction != IGNORE) { addError(String...
[ "public", "void", "scan", "(", "String", "originalXml", ")", "{", "Matcher", "matcher", "=", "INSTRUCTION_PATTERN", ".", "matcher", "(", "originalXml", ")", ";", "while", "(", "matcher", ".", "find", "(", ")", ")", "{", "scanOneInstruction", "(", "matcher", ...
Scan and verifies the pom file for processing instructions
[ "Scan", "and", "verifies", "the", "pom", "file", "for", "processing", "instructions" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/processinstruction/SortpomPiScanner.java#L26-L36
100,958
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/SortAttributesOperation.java
SortAttributesOperation.processElement
@Override public void processElement(Wrapper<Element> elementWrapper) { Element element = elementWrapper.getContent(); element.setAttributes(getSortedAttributes(element)); }
java
@Override public void processElement(Wrapper<Element> elementWrapper) { Element element = elementWrapper.getContent(); element.setAttributes(getSortedAttributes(element)); }
[ "@", "Override", "public", "void", "processElement", "(", "Wrapper", "<", "Element", ">", "elementWrapper", ")", "{", "Element", "element", "=", "elementWrapper", ".", "getContent", "(", ")", ";", "element", ".", "setAttributes", "(", "getSortedAttributes", "(",...
Sort attributes of each element
[ "Sort", "attributes", "of", "each", "element" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/SortAttributesOperation.java#L21-L25
100,959
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/GetContentStructureOperation.java
GetContentStructureOperation.processOtherContent
@Override public void processOtherContent(Wrapper<Content> content) { if (parentElement != null) { parentElement.addContent(content.getContent()); } }
java
@Override public void processOtherContent(Wrapper<Content> content) { if (parentElement != null) { parentElement.addContent(content.getContent()); } }
[ "@", "Override", "public", "void", "processOtherContent", "(", "Wrapper", "<", "Content", ">", "content", ")", "{", "if", "(", "parentElement", "!=", "null", ")", "{", "parentElement", ".", "addContent", "(", "content", ".", "getContent", "(", ")", ")", ";...
Add all 'other content' to the parent xml element
[ "Add", "all", "other", "content", "to", "the", "parent", "xml", "element" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/GetContentStructureOperation.java#L27-L32
100,960
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/GetContentStructureOperation.java
GetContentStructureOperation.processElement
@Override public void processElement(Wrapper<Element> element) { activeElement = element.getContent(); if (parentElement != null) { parentElement.addContent(activeElement); } }
java
@Override public void processElement(Wrapper<Element> element) { activeElement = element.getContent(); if (parentElement != null) { parentElement.addContent(activeElement); } }
[ "@", "Override", "public", "void", "processElement", "(", "Wrapper", "<", "Element", ">", "element", ")", "{", "activeElement", "=", "element", ".", "getContent", "(", ")", ";", "if", "(", "parentElement", "!=", "null", ")", "{", "parentElement", ".", "add...
Add the element to its parent
[ "Add", "the", "element", "to", "its", "parent" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/GetContentStructureOperation.java#L35-L42
100,961
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/SortChildrenOperation.java
SortChildrenOperation.manipulateChildElements
@Override public void manipulateChildElements(List<HierarchyWrapper> children) { for (int i = 0; i < children.size(); i++) { HierarchyWrapper wrapperImpl = children.get(i); final Wrapper<Element> wrapper = wrapperImpl.getElementContent(); if (wrapper != null && wrapper.i...
java
@Override public void manipulateChildElements(List<HierarchyWrapper> children) { for (int i = 0; i < children.size(); i++) { HierarchyWrapper wrapperImpl = children.get(i); final Wrapper<Element> wrapper = wrapperImpl.getElementContent(); if (wrapper != null && wrapper.i...
[ "@", "Override", "public", "void", "manipulateChildElements", "(", "List", "<", "HierarchyWrapper", ">", "children", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "size", "(", ")", ";", "i", "++", ")", "{", "HierarchyWrapp...
Sort all children of an element
[ "Sort", "all", "children", "of", "an", "element" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/SortChildrenOperation.java#L17-L28
100,962
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/ToStringOperation.java
ToStringOperation.startOfProcess
@Override public void startOfProcess() { String previousBaseIndent = baseIndent.substring(INDENT_LENGTH); builder.append(previousBaseIndent).append("HierarchyWrapper{\n"); processFirstOtherContent = true; }
java
@Override public void startOfProcess() { String previousBaseIndent = baseIndent.substring(INDENT_LENGTH); builder.append(previousBaseIndent).append("HierarchyWrapper{\n"); processFirstOtherContent = true; }
[ "@", "Override", "public", "void", "startOfProcess", "(", ")", "{", "String", "previousBaseIndent", "=", "baseIndent", ".", "substring", "(", "INDENT_LENGTH", ")", ";", "builder", ".", "append", "(", "previousBaseIndent", ")", ".", "append", "(", "\"HierarchyWra...
Add text before each element
[ "Add", "text", "before", "each", "element" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/ToStringOperation.java#L34-L39
100,963
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/ToStringOperation.java
ToStringOperation.processOtherContent
@Override public void processOtherContent(Wrapper<Content> content) { if (processFirstOtherContent) { builder.append(baseIndent).append("otherContentList=").append("\n"); processFirstOtherContent = false; } builder.append(content.toString(baseIndent)).append("\n"); ...
java
@Override public void processOtherContent(Wrapper<Content> content) { if (processFirstOtherContent) { builder.append(baseIndent).append("otherContentList=").append("\n"); processFirstOtherContent = false; } builder.append(content.toString(baseIndent)).append("\n"); ...
[ "@", "Override", "public", "void", "processOtherContent", "(", "Wrapper", "<", "Content", ">", "content", ")", "{", "if", "(", "processFirstOtherContent", ")", "{", "builder", ".", "append", "(", "baseIndent", ")", ".", "append", "(", "\"otherContentList=\"", ...
Add each 'other element' to string
[ "Add", "each", "other", "element", "to", "string" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/ToStringOperation.java#L42-L49
100,964
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/ToStringOperation.java
ToStringOperation.processElement
@Override public void processElement(Wrapper<Element> elementWrapper) { builder.append(baseIndent).append("elementContent=").append(elementWrapper).append("\n"); }
java
@Override public void processElement(Wrapper<Element> elementWrapper) { builder.append(baseIndent).append("elementContent=").append(elementWrapper).append("\n"); }
[ "@", "Override", "public", "void", "processElement", "(", "Wrapper", "<", "Element", ">", "elementWrapper", ")", "{", "builder", ".", "append", "(", "baseIndent", ")", ".", "append", "(", "\"elementContent=\"", ")", ".", "append", "(", "elementWrapper", ")", ...
Add each element to string
[ "Add", "each", "element", "to", "string" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/ToStringOperation.java#L52-L55
100,965
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/operation/ToStringOperation.java
ToStringOperation.manipulateChildElements
@Override public void manipulateChildElements(List<HierarchyWrapper> children) { if (!children.isEmpty()) { builder.append(baseIndent).append("children=").append("\n"); } }
java
@Override public void manipulateChildElements(List<HierarchyWrapper> children) { if (!children.isEmpty()) { builder.append(baseIndent).append("children=").append("\n"); } }
[ "@", "Override", "public", "void", "manipulateChildElements", "(", "List", "<", "HierarchyWrapper", ">", "children", ")", "{", "if", "(", "!", "children", ".", "isEmpty", "(", ")", ")", "{", "builder", ".", "append", "(", "baseIndent", ")", ".", "append", ...
Add text before processing each child
[ "Add", "text", "before", "processing", "each", "child" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/operation/ToStringOperation.java#L58-L63
100,966
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/ElementSortOrderMap.java
ElementSortOrderMap.addElement
public void addElement(Element element, int sortOrder) { final String deepName = getDeepName(element); elementNameSortOrderMap.put(deepName, sortOrder); }
java
public void addElement(Element element, int sortOrder) { final String deepName = getDeepName(element); elementNameSortOrderMap.put(deepName, sortOrder); }
[ "public", "void", "addElement", "(", "Element", "element", ",", "int", "sortOrder", ")", "{", "final", "String", "deepName", "=", "getDeepName", "(", "element", ")", ";", "elementNameSortOrderMap", ".", "put", "(", "deepName", ",", "sortOrder", ")", ";", "}"...
Add an Xml element to the map @param element Xml element @param sortOrder an index describing the sort order (lower number == element towards the start of the file)
[ "Add", "an", "Xml", "element", "to", "the", "map" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/ElementSortOrderMap.java#L24-L28
100,967
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/ElementSortOrderMap.java
ElementSortOrderMap.containsElement
public boolean containsElement(Element element) { String deepName = getDeepName(element); return elementNameSortOrderMap.containsKey(deepName); }
java
public boolean containsElement(Element element) { String deepName = getDeepName(element); return elementNameSortOrderMap.containsKey(deepName); }
[ "public", "boolean", "containsElement", "(", "Element", "element", ")", "{", "String", "deepName", "=", "getDeepName", "(", "element", ")", ";", "return", "elementNameSortOrderMap", ".", "containsKey", "(", "deepName", ")", ";", "}" ]
Returns true if element is in the map
[ "Returns", "true", "if", "element", "is", "in", "the", "map" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/ElementSortOrderMap.java#L31-L34
100,968
Ekryd/sortpom
sorter/src/main/java/sortpom/XmlProcessor.java
XmlProcessor.setOriginalXml
public void setOriginalXml(final InputStream originalXml) throws JDOMException, IOException { SAXBuilder parser = new SAXBuilder(); originalDocument = parser.build(originalXml); }
java
public void setOriginalXml(final InputStream originalXml) throws JDOMException, IOException { SAXBuilder parser = new SAXBuilder(); originalDocument = parser.build(originalXml); }
[ "public", "void", "setOriginalXml", "(", "final", "InputStream", "originalXml", ")", "throws", "JDOMException", ",", "IOException", "{", "SAXBuilder", "parser", "=", "new", "SAXBuilder", "(", ")", ";", "originalDocument", "=", "parser", ".", "build", "(", "origi...
Sets the original xml that should be sorted. Builds a dom document of the xml. @param originalXml the new original xml @throws org.jdom.JDOMException the jDOM exception @throws java.io.IOException Signals that an I/O exception has occurred.
[ "Sets", "the", "original", "xml", "that", "should", "be", "sorted", ".", "Builds", "a", "dom", "document", "of", "the", "xml", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/XmlProcessor.java#L38-L41
100,969
Ekryd/sortpom
sorter/src/main/java/sortpom/XmlProcessor.java
XmlProcessor.sortXml
public void sortXml() { newDocument = (Document) originalDocument.clone(); final Element rootElement = (Element) originalDocument.getRootElement().clone(); HierarchyRootWrapper rootWrapper = factory.createFromRootElement(rootElement); rootWrapper.createWrappedStructure(factory); ...
java
public void sortXml() { newDocument = (Document) originalDocument.clone(); final Element rootElement = (Element) originalDocument.getRootElement().clone(); HierarchyRootWrapper rootWrapper = factory.createFromRootElement(rootElement); rootWrapper.createWrappedStructure(factory); ...
[ "public", "void", "sortXml", "(", ")", "{", "newDocument", "=", "(", "Document", ")", "originalDocument", ".", "clone", "(", ")", ";", "final", "Element", "rootElement", "=", "(", "Element", ")", "originalDocument", ".", "getRootElement", "(", ")", ".", "c...
Creates a new dom document that contains the sorted xml.
[ "Creates", "a", "new", "dom", "document", "that", "contains", "the", "sorted", "xml", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/XmlProcessor.java#L44-L57
100,970
Ekryd/sortpom
sorter/src/main/java/sortpom/XmlOutputGenerator.java
XmlOutputGenerator.setup
public void setup(PluginParameters pluginParameters) { this.indentCharacters = pluginParameters.indentCharacters; this.lineSeparatorUtil = pluginParameters.lineSeparatorUtil; this.encoding = pluginParameters.encoding; this.expandEmptyElements = pluginParameters.expandEmptyElements; ...
java
public void setup(PluginParameters pluginParameters) { this.indentCharacters = pluginParameters.indentCharacters; this.lineSeparatorUtil = pluginParameters.lineSeparatorUtil; this.encoding = pluginParameters.encoding; this.expandEmptyElements = pluginParameters.expandEmptyElements; ...
[ "public", "void", "setup", "(", "PluginParameters", "pluginParameters", ")", "{", "this", ".", "indentCharacters", "=", "pluginParameters", ".", "indentCharacters", ";", "this", ".", "lineSeparatorUtil", "=", "pluginParameters", ".", "lineSeparatorUtil", ";", "this", ...
Setup default configuration
[ "Setup", "default", "configuration" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/XmlOutputGenerator.java#L28-L34
100,971
Ekryd/sortpom
sorter/src/main/java/sortpom/XmlOutputGenerator.java
XmlOutputGenerator.getSortedXml
public String getSortedXml(Document newDocument) { try (ByteArrayOutputStream sortedXml = new ByteArrayOutputStream()) { BufferedLineSeparatorOutputStream bufferedLineOutputStream = new BufferedLineSeparatorOutputStream(lineSeparatorUtil.toString(), sortedXml); XMLOu...
java
public String getSortedXml(Document newDocument) { try (ByteArrayOutputStream sortedXml = new ByteArrayOutputStream()) { BufferedLineSeparatorOutputStream bufferedLineOutputStream = new BufferedLineSeparatorOutputStream(lineSeparatorUtil.toString(), sortedXml); XMLOu...
[ "public", "String", "getSortedXml", "(", "Document", "newDocument", ")", "{", "try", "(", "ByteArrayOutputStream", "sortedXml", "=", "new", "ByteArrayOutputStream", "(", ")", ")", "{", "BufferedLineSeparatorOutputStream", "bufferedLineOutputStream", "=", "new", "Buffere...
Returns the sorted xml as an OutputStream. @return the sorted xml
[ "Returns", "the", "sorted", "xml", "as", "an", "OutputStream", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/XmlOutputGenerator.java#L41-L55
100,972
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/WrapperFactoryImpl.java
WrapperFactoryImpl.initializeSortOrderMap
private void initializeSortOrderMap() { try { Document document = createDocumentFromDefaultSortOrderFile(); addElementsToSortOrderMap(document.getRootElement(), SORT_ORDER_BASE); } catch (IOException | JDOMException e) { throw new FailureException(e.getMessage(), e); ...
java
private void initializeSortOrderMap() { try { Document document = createDocumentFromDefaultSortOrderFile(); addElementsToSortOrderMap(document.getRootElement(), SORT_ORDER_BASE); } catch (IOException | JDOMException e) { throw new FailureException(e.getMessage(), e); ...
[ "private", "void", "initializeSortOrderMap", "(", ")", "{", "try", "{", "Document", "document", "=", "createDocumentFromDefaultSortOrderFile", "(", ")", ";", "addElementsToSortOrderMap", "(", "document", ".", "getRootElement", "(", ")", ",", "SORT_ORDER_BASE", ")", ...
Creates sort order map from chosen sort order.
[ "Creates", "sort", "order", "map", "from", "chosen", "sort", "order", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/WrapperFactoryImpl.java#L63-L70
100,973
Ekryd/sortpom
sorter/src/main/java/sortpom/wrapper/WrapperFactoryImpl.java
WrapperFactoryImpl.addElementsToSortOrderMap
private void addElementsToSortOrderMap(final Element element, int baseSortOrder) { elementSortOrderMap.addElement(element, baseSortOrder); final List<Element> castToChildElementList = castToChildElementList(element); // Increments the sort order index for each element int sortOrder = bas...
java
private void addElementsToSortOrderMap(final Element element, int baseSortOrder) { elementSortOrderMap.addElement(element, baseSortOrder); final List<Element> castToChildElementList = castToChildElementList(element); // Increments the sort order index for each element int sortOrder = bas...
[ "private", "void", "addElementsToSortOrderMap", "(", "final", "Element", "element", ",", "int", "baseSortOrder", ")", "{", "elementSortOrderMap", ".", "addElement", "(", "element", ",", "baseSortOrder", ")", ";", "final", "List", "<", "Element", ">", "castToChildE...
Processes the chosen sort order. Adds sort order element and sort index to a map.
[ "Processes", "the", "chosen", "sort", "order", ".", "Adds", "sort", "order", "element", "and", "sort", "index", "to", "a", "map", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/wrapper/WrapperFactoryImpl.java#L84-L93
100,974
Ekryd/sortpom
sorter/src/main/java/sortpom/SortPomImpl.java
SortPomImpl.sortPom
public void sortPom() { log.info("Sorting file " + pomFile.getAbsolutePath()); String originalXml = fileUtil.getPomFileContent(); String sortedXml = sortXml(originalXml); if (pomFileIsSorted(originalXml, sortedXml)) { log.info("Pom file is already sorted, exiting"); ...
java
public void sortPom() { log.info("Sorting file " + pomFile.getAbsolutePath()); String originalXml = fileUtil.getPomFileContent(); String sortedXml = sortXml(originalXml); if (pomFileIsSorted(originalXml, sortedXml)) { log.info("Pom file is already sorted, exiting"); ...
[ "public", "void", "sortPom", "(", ")", "{", "log", ".", "info", "(", "\"Sorting file \"", "+", "pomFile", ".", "getAbsolutePath", "(", ")", ")", ";", "String", "originalXml", "=", "fileUtil", ".", "getPomFileContent", "(", ")", ";", "String", "sortedXml", ...
Sorts the pom file.
[ "Sorts", "the", "pom", "file", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/SortPomImpl.java#L91-L102
100,975
Ekryd/sortpom
sorter/src/main/java/sortpom/SortPomImpl.java
SortPomImpl.sortXml
private String sortXml(final String originalXml) { xmlProcessingInstructionParser.scanForIgnoredSections(originalXml); String xml = xmlProcessingInstructionParser.replaceIgnoredSections(); insertXmlInXmlProcessor(xml, () -> "Could not sort " + pomFile.getAbsolutePath() + " content: "); ...
java
private String sortXml(final String originalXml) { xmlProcessingInstructionParser.scanForIgnoredSections(originalXml); String xml = xmlProcessingInstructionParser.replaceIgnoredSections(); insertXmlInXmlProcessor(xml, () -> "Could not sort " + pomFile.getAbsolutePath() + " content: "); ...
[ "private", "String", "sortXml", "(", "final", "String", "originalXml", ")", "{", "xmlProcessingInstructionParser", ".", "scanForIgnoredSections", "(", "originalXml", ")", ";", "String", "xml", "=", "xmlProcessingInstructionParser", ".", "replaceIgnoredSections", "(", ")...
Sorts the incoming xml. @param originalXml the xml that should be sorted. @return the sorted xml
[ "Sorts", "the", "incoming", "xml", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/SortPomImpl.java#L110-L124
100,976
Ekryd/sortpom
sorter/src/main/java/sortpom/SortPomImpl.java
SortPomImpl.createBackupFile
private void createBackupFile() { if (createBackupFile) { if (backupFileExtension.trim().length() == 0) { throw new FailureException("Could not create backup file, extension name was empty"); } fileUtil.backupFile(); log.info(String.format("Saved b...
java
private void createBackupFile() { if (createBackupFile) { if (backupFileExtension.trim().length() == 0) { throw new FailureException("Could not create backup file, extension name was empty"); } fileUtil.backupFile(); log.info(String.format("Saved b...
[ "private", "void", "createBackupFile", "(", ")", "{", "if", "(", "createBackupFile", ")", "{", "if", "(", "backupFileExtension", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "FailureException", "(", "\"Could not crea...
Creates the backup file for pom.
[ "Creates", "the", "backup", "file", "for", "pom", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/SortPomImpl.java#L137-L146
100,977
Ekryd/sortpom
sorter/src/main/java/sortpom/SortPomImpl.java
SortPomImpl.saveSortedPomFile
private void saveSortedPomFile(final String sortedXml) { fileUtil.savePomFile(sortedXml); log.info("Saved sorted pom file to " + pomFile.getAbsolutePath()); }
java
private void saveSortedPomFile(final String sortedXml) { fileUtil.savePomFile(sortedXml); log.info("Saved sorted pom file to " + pomFile.getAbsolutePath()); }
[ "private", "void", "saveSortedPomFile", "(", "final", "String", "sortedXml", ")", "{", "fileUtil", ".", "savePomFile", "(", "sortedXml", ")", ";", "log", ".", "info", "(", "\"Saved sorted pom file to \"", "+", "pomFile", ".", "getAbsolutePath", "(", ")", ")", ...
Saves the sorted pom file. @param sortedXml the sorted xml
[ "Saves", "the", "sorted", "pom", "file", "." ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/SortPomImpl.java#L153-L156
100,978
Ekryd/sortpom
sorter/src/main/java/sortpom/SortPomImpl.java
SortPomImpl.verifyPom
public void verifyPom() { String pomFileName = pomFile.getAbsolutePath(); log.info("Verifying file " + pomFileName); XmlOrderedResult xmlOrderedResult = isPomElementsSorted(); if (!xmlOrderedResult.isOrdered()) { switch (verifyFailType) { case WARN: ...
java
public void verifyPom() { String pomFileName = pomFile.getAbsolutePath(); log.info("Verifying file " + pomFileName); XmlOrderedResult xmlOrderedResult = isPomElementsSorted(); if (!xmlOrderedResult.isOrdered()) { switch (verifyFailType) { case WARN: ...
[ "public", "void", "verifyPom", "(", ")", "{", "String", "pomFileName", "=", "pomFile", ".", "getAbsolutePath", "(", ")", ";", "log", ".", "info", "(", "\"Verifying file \"", "+", "pomFileName", ")", ";", "XmlOrderedResult", "xmlOrderedResult", "=", "isPomElement...
Verify that the pom-file is sorted regardless of formatting
[ "Verify", "that", "the", "pom", "-", "file", "is", "sorted", "regardless", "of", "formatting" ]
27056420803ed04001e4149b04a719fbac774c5d
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/SortPomImpl.java#L161-L186
100,979
voikko/corevoikko
libvoikko/java/src/main/java/org/puimula/libvoikko/ByteArray.java
ByteArray.s2n
public static byte[] s2n(String string) { if (string == null) { return null; } byte[] stringBytes = string.getBytes(UTF8); byte[] allBytes = new byte[stringBytes.length + 1]; System.arraycopy(stringBytes, 0, allBytes, 0, stringBytes.length); return allBytes; ...
java
public static byte[] s2n(String string) { if (string == null) { return null; } byte[] stringBytes = string.getBytes(UTF8); byte[] allBytes = new byte[stringBytes.length + 1]; System.arraycopy(stringBytes, 0, allBytes, 0, stringBytes.length); return allBytes; ...
[ "public", "static", "byte", "[", "]", "s2n", "(", "String", "string", ")", "{", "if", "(", "string", "==", "null", ")", "{", "return", "null", ";", "}", "byte", "[", "]", "stringBytes", "=", "string", ".", "getBytes", "(", "UTF8", ")", ";", "byte",...
Java-to-native string mapping @param string @return native string
[ "Java", "-", "to", "-", "native", "string", "mapping" ]
b726429a7796a19ff0965ea0cc0bcf7c6580837e
https://github.com/voikko/corevoikko/blob/b726429a7796a19ff0965ea0cc0bcf7c6580837e/libvoikko/java/src/main/java/org/puimula/libvoikko/ByteArray.java#L61-L69
100,980
voikko/corevoikko
libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java
Voikko.spell
public synchronized boolean spell(String word) { requireValidHandle(); if (!isValidInput(word)) { return false; } int spellResult = getLib().voikkoSpellCstr(handle, s2n(word)); return (spellResult == Libvoikko.VOIKKO_SPELL_OK); }
java
public synchronized boolean spell(String word) { requireValidHandle(); if (!isValidInput(word)) { return false; } int spellResult = getLib().voikkoSpellCstr(handle, s2n(word)); return (spellResult == Libvoikko.VOIKKO_SPELL_OK); }
[ "public", "synchronized", "boolean", "spell", "(", "String", "word", ")", "{", "requireValidHandle", "(", ")", ";", "if", "(", "!", "isValidInput", "(", "word", ")", ")", "{", "return", "false", ";", "}", "int", "spellResult", "=", "getLib", "(", ")", ...
Check the spelling of given word. @param word @return true if the word is correct, false if it is incorrect.
[ "Check", "the", "spelling", "of", "given", "word", "." ]
b726429a7796a19ff0965ea0cc0bcf7c6580837e
https://github.com/voikko/corevoikko/blob/b726429a7796a19ff0965ea0cc0bcf7c6580837e/libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java#L140-L147
100,981
voikko/corevoikko
libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java
Voikko.grammarErrors
public synchronized List<GrammarError> grammarErrors(String text, String language) { requireValidHandle(); List<GrammarError> errorList = new ArrayList<GrammarError>(); if (!isValidInput(text)) { return errorList; } int offset = 0; for (String paragraph : text...
java
public synchronized List<GrammarError> grammarErrors(String text, String language) { requireValidHandle(); List<GrammarError> errorList = new ArrayList<GrammarError>(); if (!isValidInput(text)) { return errorList; } int offset = 0; for (String paragraph : text...
[ "public", "synchronized", "List", "<", "GrammarError", ">", "grammarErrors", "(", "String", "text", ",", "String", "language", ")", "{", "requireValidHandle", "(", ")", ";", "List", "<", "GrammarError", ">", "errorList", "=", "new", "ArrayList", "<", "GrammarE...
Check the given text for grammar errors and return a list of GrammarError objects representing the errors that were found. Unlike the C based API this method accepts multiple paragraphs separated by newline characters. @param text @param language language in which error descriptions should be returned @return list of g...
[ "Check", "the", "given", "text", "for", "grammar", "errors", "and", "return", "a", "list", "of", "GrammarError", "objects", "representing", "the", "errors", "that", "were", "found", ".", "Unlike", "the", "C", "based", "API", "this", "method", "accepts", "mul...
b726429a7796a19ff0965ea0cc0bcf7c6580837e
https://github.com/voikko/corevoikko/blob/b726429a7796a19ff0965ea0cc0bcf7c6580837e/libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java#L222-L234
100,982
voikko/corevoikko
libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java
Voikko.analyze
public synchronized List<Analysis> analyze(String word) { requireValidHandle(); List<Analysis> analysisList = new ArrayList<Analysis>(); if (!isValidInput(word)) { return analysisList; } Libvoikko lib = getLib(); Pointer cAnalysisList = lib.voikko...
java
public synchronized List<Analysis> analyze(String word) { requireValidHandle(); List<Analysis> analysisList = new ArrayList<Analysis>(); if (!isValidInput(word)) { return analysisList; } Libvoikko lib = getLib(); Pointer cAnalysisList = lib.voikko...
[ "public", "synchronized", "List", "<", "Analysis", ">", "analyze", "(", "String", "word", ")", "{", "requireValidHandle", "(", ")", ";", "List", "<", "Analysis", ">", "analysisList", "=", "new", "ArrayList", "<", "Analysis", ">", "(", ")", ";", "if", "("...
Analyze the morphology of given word and return the list of analysis results. @param word @return analysis results
[ "Analyze", "the", "morphology", "of", "given", "word", "and", "return", "the", "list", "of", "analysis", "results", "." ]
b726429a7796a19ff0965ea0cc0bcf7c6580837e
https://github.com/voikko/corevoikko/blob/b726429a7796a19ff0965ea0cc0bcf7c6580837e/libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java#L280-L308
100,983
voikko/corevoikko
libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java
Voikko.tokens
public synchronized List<Token> tokens(String text) { requireValidHandle(); List<Token> allTokens = new ArrayList<Token>(); int lastStart = 0; for (int i = indexOfSpecialUnknown(text, 0); i != -1; i = indexOfSpecialUnknown(text, i + 1)) { allTokens.addAll(tokensNonNull(text.s...
java
public synchronized List<Token> tokens(String text) { requireValidHandle(); List<Token> allTokens = new ArrayList<Token>(); int lastStart = 0; for (int i = indexOfSpecialUnknown(text, 0); i != -1; i = indexOfSpecialUnknown(text, i + 1)) { allTokens.addAll(tokensNonNull(text.s...
[ "public", "synchronized", "List", "<", "Token", ">", "tokens", "(", "String", "text", ")", "{", "requireValidHandle", "(", ")", ";", "List", "<", "Token", ">", "allTokens", "=", "new", "ArrayList", "<", "Token", ">", "(", ")", ";", "int", "lastStart", ...
Split the given natural language text into a list of Token objects. @param text @return list of tokens
[ "Split", "the", "given", "natural", "language", "text", "into", "a", "list", "of", "Token", "objects", "." ]
b726429a7796a19ff0965ea0cc0bcf7c6580837e
https://github.com/voikko/corevoikko/blob/b726429a7796a19ff0965ea0cc0bcf7c6580837e/libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java#L315-L326
100,984
voikko/corevoikko
libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java
Voikko.sentences
public synchronized List<Sentence> sentences(String text) { requireValidHandle(); Libvoikko lib = getLib(); List<Sentence> result = new ArrayList<Sentence>(); if (!isValidInput(text)) { result.add(new Sentence(text, SentenceStartType.NONE)); return result; ...
java
public synchronized List<Sentence> sentences(String text) { requireValidHandle(); Libvoikko lib = getLib(); List<Sentence> result = new ArrayList<Sentence>(); if (!isValidInput(text)) { result.add(new Sentence(text, SentenceStartType.NONE)); return result; ...
[ "public", "synchronized", "List", "<", "Sentence", ">", "sentences", "(", "String", "text", ")", "{", "requireValidHandle", "(", ")", ";", "Libvoikko", "lib", "=", "getLib", "(", ")", ";", "List", "<", "Sentence", ">", "result", "=", "new", "ArrayList", ...
Split the given natural language text into a list of Sentence objects. @param text @return list of sentences
[ "Split", "the", "given", "natural", "language", "text", "into", "a", "list", "of", "Sentence", "objects", "." ]
b726429a7796a19ff0965ea0cc0bcf7c6580837e
https://github.com/voikko/corevoikko/blob/b726429a7796a19ff0965ea0cc0bcf7c6580837e/libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java#L367-L389
100,985
voikko/corevoikko
libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java
Voikko.addLibraryPath
public static void addLibraryPath(String libraryPath) { for (String libraryName : LIBRARY_NAMES) { NativeLibrary.addSearchPath(libraryName, libraryPath); } }
java
public static void addLibraryPath(String libraryPath) { for (String libraryName : LIBRARY_NAMES) { NativeLibrary.addSearchPath(libraryName, libraryPath); } }
[ "public", "static", "void", "addLibraryPath", "(", "String", "libraryPath", ")", "{", "for", "(", "String", "libraryName", ":", "LIBRARY_NAMES", ")", "{", "NativeLibrary", ".", "addSearchPath", "(", "libraryName", ",", "libraryPath", ")", ";", "}", "}" ]
Set the explicit path to the folder containing shared library files. @param libraryPath
[ "Set", "the", "explicit", "path", "to", "the", "folder", "containing", "shared", "library", "files", "." ]
b726429a7796a19ff0965ea0cc0bcf7c6580837e
https://github.com/voikko/corevoikko/blob/b726429a7796a19ff0965ea0cc0bcf7c6580837e/libvoikko/java/src/main/java/org/puimula/libvoikko/Voikko.java#L643-L647
100,986
xmlet/HtmlFlow
src/main/java/htmlflow/HtmlView.java
HtmlView.addPartial
public final <U> void addPartial(HtmlView<U> partial, U model) { getVisitor().closeBeginTag(); partial.getVisitor().depth = getVisitor().depth; if (this.getVisitor().isWriting()) getVisitor().write(partial.render(model)); }
java
public final <U> void addPartial(HtmlView<U> partial, U model) { getVisitor().closeBeginTag(); partial.getVisitor().depth = getVisitor().depth; if (this.getVisitor().isWriting()) getVisitor().write(partial.render(model)); }
[ "public", "final", "<", "U", ">", "void", "addPartial", "(", "HtmlView", "<", "U", ">", "partial", ",", "U", "model", ")", "{", "getVisitor", "(", ")", ".", "closeBeginTag", "(", ")", ";", "partial", ".", "getVisitor", "(", ")", ".", "depth", "=", ...
Adds a partial view to this view. @param partial inner view. @param model the domain object bound to the partial view. @param <U> the type of the domain model of the partial view.
[ "Adds", "a", "partial", "view", "to", "this", "view", "." ]
5318be5765b0850496645d7c11bdf2848c094b17
https://github.com/xmlet/HtmlFlow/blob/5318be5765b0850496645d7c11bdf2848c094b17/src/main/java/htmlflow/HtmlView.java#L170-L175
100,987
Ardesco/selenium-standalone-server-plugin
src/main/java/com/lazerycode/selenium/download/FileDownloader.java
FileDownloader.attemptToDownload
public File attemptToDownload(URL fileLocation) throws URISyntaxException, IOException { String filename = FilenameUtils.getName(fileLocation.getFile()); SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(fileDownloadReadTimeout).build(); RequestConfig requestConfig = RequestConfig....
java
public File attemptToDownload(URL fileLocation) throws URISyntaxException, IOException { String filename = FilenameUtils.getName(fileLocation.getFile()); SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(fileDownloadReadTimeout).build(); RequestConfig requestConfig = RequestConfig....
[ "public", "File", "attemptToDownload", "(", "URL", "fileLocation", ")", "throws", "URISyntaxException", ",", "IOException", "{", "String", "filename", "=", "FilenameUtils", ".", "getName", "(", "fileLocation", ".", "getFile", "(", ")", ")", ";", "SocketConfig", ...
Attempt to download a file @param fileLocation URL of the file to download @return File @throws URISyntaxException Invalid URI @throws IOException Unable to interact with file system
[ "Attempt", "to", "download", "a", "file" ]
e0ecfad426c1a28115cab60def84731d7a4d7e6f
https://github.com/Ardesco/selenium-standalone-server-plugin/blob/e0ecfad426c1a28115cab60def84731d7a4d7e6f/src/main/java/com/lazerycode/selenium/download/FileDownloader.java#L58-L90
100,988
Ardesco/selenium-standalone-server-plugin
src/main/java/com/lazerycode/selenium/download/FileDownloader.java
FileDownloader.localFilePath
private String localFilePath(File downloadDirectory) throws MojoFailureException { if (downloadDirectory.exists()) { if (downloadDirectory.isDirectory()) { return downloadDirectory.getAbsolutePath(); } else { throw new MojoFailureException("'" + downloadDi...
java
private String localFilePath(File downloadDirectory) throws MojoFailureException { if (downloadDirectory.exists()) { if (downloadDirectory.isDirectory()) { return downloadDirectory.getAbsolutePath(); } else { throw new MojoFailureException("'" + downloadDi...
[ "private", "String", "localFilePath", "(", "File", "downloadDirectory", ")", "throws", "MojoFailureException", "{", "if", "(", "downloadDirectory", ".", "exists", "(", ")", ")", "{", "if", "(", "downloadDirectory", ".", "isDirectory", "(", ")", ")", "{", "retu...
Set the location directory where files will be downloaded to @param downloadDirectory The directory that the file will be downloaded to.
[ "Set", "the", "location", "directory", "where", "files", "will", "be", "downloaded", "to" ]
e0ecfad426c1a28115cab60def84731d7a4d7e6f
https://github.com/Ardesco/selenium-standalone-server-plugin/blob/e0ecfad426c1a28115cab60def84731d7a4d7e6f/src/main/java/com/lazerycode/selenium/download/FileDownloader.java#L97-L111
100,989
Ardesco/selenium-standalone-server-plugin
src/main/java/com/lazerycode/selenium/download/DownloadHandler.java
DownloadHandler.downloadFile
protected File downloadFile(DriverDetails driverDetails, boolean shouldWeCheckFileHash) throws MojoExecutionException, IOException, URISyntaxException { URL remoteFileLocation = driverDetails.fileLocation; final String filename = FilenameUtils.getName(remoteFileLocation.getFile()); for (int re...
java
protected File downloadFile(DriverDetails driverDetails, boolean shouldWeCheckFileHash) throws MojoExecutionException, IOException, URISyntaxException { URL remoteFileLocation = driverDetails.fileLocation; final String filename = FilenameUtils.getName(remoteFileLocation.getFile()); for (int re...
[ "protected", "File", "downloadFile", "(", "DriverDetails", "driverDetails", ",", "boolean", "shouldWeCheckFileHash", ")", "throws", "MojoExecutionException", ",", "IOException", ",", "URISyntaxException", "{", "URL", "remoteFileLocation", "=", "driverDetails", ".", "fileL...
Perform the file download @param driverDetails Driver details extracted from Repositorymap.xml @param shouldWeCheckFileHash true if file hash should be checked @return File @throws MojoExecutionException Unable to download file @throws IOException Error writing to file system @throws URISyntaxExcept...
[ "Perform", "the", "file", "download" ]
e0ecfad426c1a28115cab60def84731d7a4d7e6f
https://github.com/Ardesco/selenium-standalone-server-plugin/blob/e0ecfad426c1a28115cab60def84731d7a4d7e6f/src/main/java/com/lazerycode/selenium/download/DownloadHandler.java#L61-L83
100,990
Ardesco/selenium-standalone-server-plugin
src/main/java/com/lazerycode/selenium/extract/CompressedFile.java
CompressedFile.getInputStream
InputStream getInputStream() throws IOException { switch (filetype) { case GZ: LOG.debug("Decompressing .gz file"); return new GzipCompressorInputStream(new FileInputStream(compressedFile)); case BZ2: LOG.debug("Decompressing .bz2 file"); ...
java
InputStream getInputStream() throws IOException { switch (filetype) { case GZ: LOG.debug("Decompressing .gz file"); return new GzipCompressorInputStream(new FileInputStream(compressedFile)); case BZ2: LOG.debug("Decompressing .bz2 file"); ...
[ "InputStream", "getInputStream", "(", ")", "throws", "IOException", "{", "switch", "(", "filetype", ")", "{", "case", "GZ", ":", "LOG", ".", "debug", "(", "\"Decompressing .gz file\"", ")", ";", "return", "new", "GzipCompressorInputStream", "(", "new", "FileInpu...
Get an InputStream for the decompressed file. @return An InputStream, the type could be BZip2CompressorInputStream, or GzipCompressorInputStream depending on what type of file was initially supplied @throws IOException IOException
[ "Get", "an", "InputStream", "for", "the", "decompressed", "file", "." ]
e0ecfad426c1a28115cab60def84731d7a4d7e6f
https://github.com/Ardesco/selenium-standalone-server-plugin/blob/e0ecfad426c1a28115cab60def84731d7a4d7e6f/src/main/java/com/lazerycode/selenium/extract/CompressedFile.java#L54-L64
100,991
Ardesco/selenium-standalone-server-plugin
src/main/java/com/lazerycode/selenium/extract/CompressedFile.java
CompressedFile.getArchiveType
DownloadableFileType getArchiveType() { try { return DownloadableFileType.valueOf(FilenameUtils.getExtension(decompressedFilename).toUpperCase()); } catch (IllegalArgumentException e) { LOG.debug("Not a recognised Archive type"); return null; } }
java
DownloadableFileType getArchiveType() { try { return DownloadableFileType.valueOf(FilenameUtils.getExtension(decompressedFilename).toUpperCase()); } catch (IllegalArgumentException e) { LOG.debug("Not a recognised Archive type"); return null; } }
[ "DownloadableFileType", "getArchiveType", "(", ")", "{", "try", "{", "return", "DownloadableFileType", ".", "valueOf", "(", "FilenameUtils", ".", "getExtension", "(", "decompressedFilename", ")", ".", "toUpperCase", "(", ")", ")", ";", "}", "catch", "(", "Illega...
Find out if the uncompressed file is an archive @return ArchiveType.TAR if a tar, or null if not an archive
[ "Find", "out", "if", "the", "uncompressed", "file", "is", "an", "archive" ]
e0ecfad426c1a28115cab60def84731d7a4d7e6f
https://github.com/Ardesco/selenium-standalone-server-plugin/blob/e0ecfad426c1a28115cab60def84731d7a4d7e6f/src/main/java/com/lazerycode/selenium/extract/CompressedFile.java#L71-L78
100,992
Ardesco/selenium-standalone-server-plugin
src/main/java/com/lazerycode/selenium/SeleniumServerMojo.java
SeleniumServerMojo.setRepositoryMapFile
private void setRepositoryMapFile() throws MojoExecutionException { if (this.customRepositoryMap != null && !this.customRepositoryMap.isEmpty()) { File repositoryMap = getRepositoryMapFile(this.customRepositoryMap); if (repositoryMap.exists()) { checkRepositoryMapIsVa...
java
private void setRepositoryMapFile() throws MojoExecutionException { if (this.customRepositoryMap != null && !this.customRepositoryMap.isEmpty()) { File repositoryMap = getRepositoryMapFile(this.customRepositoryMap); if (repositoryMap.exists()) { checkRepositoryMapIsVa...
[ "private", "void", "setRepositoryMapFile", "(", ")", "throws", "MojoExecutionException", "{", "if", "(", "this", ".", "customRepositoryMap", "!=", "null", "&&", "!", "this", ".", "customRepositoryMap", ".", "isEmpty", "(", ")", ")", "{", "File", "repositoryMap",...
Set the RepositoryMap used to get file information. If the supplied map is invalid it will default to the pre-packaged one here. @throws MojoExecutionException
[ "Set", "the", "RepositoryMap", "used", "to", "get", "file", "information", ".", "If", "the", "supplied", "map", "is", "invalid", "it", "will", "default", "to", "the", "pre", "-", "packaged", "one", "here", "." ]
e0ecfad426c1a28115cab60def84731d7a4d7e6f
https://github.com/Ardesco/selenium-standalone-server-plugin/blob/e0ecfad426c1a28115cab60def84731d7a4d7e6f/src/main/java/com/lazerycode/selenium/SeleniumServerMojo.java#L307-L325
100,993
Ardesco/selenium-standalone-server-plugin
src/main/java/com/lazerycode/selenium/SeleniumServerMojo.java
SeleniumServerMojo.checkRepositoryMapIsValid
protected void checkRepositoryMapIsValid(File repositoryMap) throws MojoExecutionException { URL schemaFile = this.getClass().getResource("/RepositoryMap.xsd"); Source xmlFile = new StreamSource(repositoryMap); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEM...
java
protected void checkRepositoryMapIsValid(File repositoryMap) throws MojoExecutionException { URL schemaFile = this.getClass().getResource("/RepositoryMap.xsd"); Source xmlFile = new StreamSource(repositoryMap); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEM...
[ "protected", "void", "checkRepositoryMapIsValid", "(", "File", "repositoryMap", ")", "throws", "MojoExecutionException", "{", "URL", "schemaFile", "=", "this", ".", "getClass", "(", ")", ".", "getResource", "(", "\"/RepositoryMap.xsd\"", ")", ";", "Source", "xmlFile...
Validate any custom repository maps that are supplied against the xsd. Throw an error and stop if it is not valid. Assume it doesn't exist if we get an IOError and fall back to default file. @throws MojoExecutionException thrown if customRepositoryMap is not valid
[ "Validate", "any", "custom", "repository", "maps", "that", "are", "supplied", "against", "the", "xsd", ".", "Throw", "an", "error", "and", "stop", "if", "it", "is", "not", "valid", ".", "Assume", "it", "doesn", "t", "exist", "if", "we", "get", "an", "I...
e0ecfad426c1a28115cab60def84731d7a4d7e6f
https://github.com/Ardesco/selenium-standalone-server-plugin/blob/e0ecfad426c1a28115cab60def84731d7a4d7e6f/src/main/java/com/lazerycode/selenium/SeleniumServerMojo.java#L334-L347
100,994
Ardesco/selenium-standalone-server-plugin
src/main/java/com/lazerycode/selenium/extract/FileExtractor.java
FileExtractor.extractFileFromArchive
public String extractFileFromArchive(File downloadedCompressedFile, String extractedToFilePath, BinaryType possibleFilenames) throws IOException, IllegalArgumentException, MojoFailureException { DownloadableFileType fileType = DownloadableFileType.valueOf(FilenameUtils.getExtension(downloadedCompressedFile.getN...
java
public String extractFileFromArchive(File downloadedCompressedFile, String extractedToFilePath, BinaryType possibleFilenames) throws IOException, IllegalArgumentException, MojoFailureException { DownloadableFileType fileType = DownloadableFileType.valueOf(FilenameUtils.getExtension(downloadedCompressedFile.getN...
[ "public", "String", "extractFileFromArchive", "(", "File", "downloadedCompressedFile", ",", "String", "extractedToFilePath", ",", "BinaryType", "possibleFilenames", ")", "throws", "IOException", ",", "IllegalArgumentException", ",", "MojoFailureException", "{", "DownloadableF...
Extract binary from a downloaded archive file @param downloadedCompressedFile The downloaded compressed file @param extractedToFilePath Path to extracted file @param possibleFilenames Names of the files we want to extract @return boolean @throws IOException Unable to write to filesystem @throw...
[ "Extract", "binary", "from", "a", "downloaded", "archive", "file" ]
e0ecfad426c1a28115cab60def84731d7a4d7e6f
https://github.com/Ardesco/selenium-standalone-server-plugin/blob/e0ecfad426c1a28115cab60def84731d7a4d7e6f/src/main/java/com/lazerycode/selenium/extract/FileExtractor.java#L49-L72
100,995
Ardesco/selenium-standalone-server-plugin
src/main/java/com/lazerycode/selenium/extract/FileExtractor.java
FileExtractor.copyFileToDisk
private String copyFileToDisk(InputStream inputStream, String pathToExtractTo, String filename) throws IOException { if (!overwriteFilesThatExist) { File[] existingFiles = new File(pathToExtractTo).listFiles(); if (null != existingFiles && existingFiles.length > 0) { for ...
java
private String copyFileToDisk(InputStream inputStream, String pathToExtractTo, String filename) throws IOException { if (!overwriteFilesThatExist) { File[] existingFiles = new File(pathToExtractTo).listFiles(); if (null != existingFiles && existingFiles.length > 0) { for ...
[ "private", "String", "copyFileToDisk", "(", "InputStream", "inputStream", ",", "String", "pathToExtractTo", ",", "String", "filename", ")", "throws", "IOException", "{", "if", "(", "!", "overwriteFilesThatExist", ")", "{", "File", "[", "]", "existingFiles", "=", ...
Copy a file from an inputsteam to disk @param inputStream A valid input stream to read @param pathToExtractTo Path of the file we want to create @param filename Filename of the file we want to create @return Absolute path of the newly created file (Or existing file if overwriteFilesThatExist is set to false...
[ "Copy", "a", "file", "from", "an", "inputsteam", "to", "disk" ]
e0ecfad426c1a28115cab60def84731d7a4d7e6f
https://github.com/Ardesco/selenium-standalone-server-plugin/blob/e0ecfad426c1a28115cab60def84731d7a4d7e6f/src/main/java/com/lazerycode/selenium/extract/FileExtractor.java#L218-L249
100,996
Coolerfall/Android-HttpDownloadManager
library/src/main/java/com/coolerfall/download/DownloadDelivery.java
DownloadDelivery.postStart
void postStart(final DownloadRequest request, final long totalBytes) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onStart(request.downloadId(), totalBytes); } }); }
java
void postStart(final DownloadRequest request, final long totalBytes) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onStart(request.downloadId(), totalBytes); } }); }
[ "void", "postStart", "(", "final", "DownloadRequest", "request", ",", "final", "long", "totalBytes", ")", "{", "downloadPoster", ".", "execute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "request", ".",...
Post download start event. @param request download request @param totalBytes total bytes
[ "Post", "download", "start", "event", "." ]
2b32451c1799c77708c12bf8155e43c7dc25bc57
https://github.com/Coolerfall/Android-HttpDownloadManager/blob/2b32451c1799c77708c12bf8155e43c7dc25bc57/library/src/main/java/com/coolerfall/download/DownloadDelivery.java#L29-L35
100,997
Coolerfall/Android-HttpDownloadManager
library/src/main/java/com/coolerfall/download/DownloadDelivery.java
DownloadDelivery.postRetry
void postRetry(final DownloadRequest request) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onRetry(request.downloadId()); } }); }
java
void postRetry(final DownloadRequest request) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onRetry(request.downloadId()); } }); }
[ "void", "postRetry", "(", "final", "DownloadRequest", "request", ")", "{", "downloadPoster", ".", "execute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "request", ".", "downloadCallback", "(", ")", ".", ...
Post download retry event. @param request download request
[ "Post", "download", "retry", "event", "." ]
2b32451c1799c77708c12bf8155e43c7dc25bc57
https://github.com/Coolerfall/Android-HttpDownloadManager/blob/2b32451c1799c77708c12bf8155e43c7dc25bc57/library/src/main/java/com/coolerfall/download/DownloadDelivery.java#L42-L48
100,998
Coolerfall/Android-HttpDownloadManager
library/src/main/java/com/coolerfall/download/DownloadDelivery.java
DownloadDelivery.postProgress
void postProgress(final DownloadRequest request, final long bytesWritten, final long totalBytes) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onProgress(request.downloadId(), bytesWritten, totalBytes); } }); }
java
void postProgress(final DownloadRequest request, final long bytesWritten, final long totalBytes) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onProgress(request.downloadId(), bytesWritten, totalBytes); } }); }
[ "void", "postProgress", "(", "final", "DownloadRequest", "request", ",", "final", "long", "bytesWritten", ",", "final", "long", "totalBytes", ")", "{", "downloadPoster", ".", "execute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", ...
Post download progress event. @param request download request @param bytesWritten the bytes have written to file @param totalBytes the total bytes of currnet file in downloading
[ "Post", "download", "progress", "event", "." ]
2b32451c1799c77708c12bf8155e43c7dc25bc57
https://github.com/Coolerfall/Android-HttpDownloadManager/blob/2b32451c1799c77708c12bf8155e43c7dc25bc57/library/src/main/java/com/coolerfall/download/DownloadDelivery.java#L57-L63
100,999
Coolerfall/Android-HttpDownloadManager
library/src/main/java/com/coolerfall/download/DownloadDelivery.java
DownloadDelivery.postSuccess
void postSuccess(final DownloadRequest request) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onSuccess(request.downloadId(), request.destinationFilePath()); } }); }
java
void postSuccess(final DownloadRequest request) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onSuccess(request.downloadId(), request.destinationFilePath()); } }); }
[ "void", "postSuccess", "(", "final", "DownloadRequest", "request", ")", "{", "downloadPoster", ".", "execute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "request", ".", "downloadCallback", "(", ")", "."...
Post download success event. @param request download request
[ "Post", "download", "success", "event", "." ]
2b32451c1799c77708c12bf8155e43c7dc25bc57
https://github.com/Coolerfall/Android-HttpDownloadManager/blob/2b32451c1799c77708c12bf8155e43c7dc25bc57/library/src/main/java/com/coolerfall/download/DownloadDelivery.java#L70-L76