repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/RouteBuilder.java | RouteBuilder.put | public RouteBuilder put(){
if(!methods.contains(HttpMethod.PUT)){
methods.add(HttpMethod.PUT);
}
return this;
} | java | public RouteBuilder put(){
if(!methods.contains(HttpMethod.PUT)){
methods.add(HttpMethod.PUT);
}
return this;
} | [
"public",
"RouteBuilder",
"put",
"(",
")",
"{",
"if",
"(",
"!",
"methods",
".",
"contains",
"(",
"HttpMethod",
".",
"PUT",
")",
")",
"{",
"methods",
".",
"add",
"(",
"HttpMethod",
".",
"PUT",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Specifies that this route is mapped to HTTP PUT method.
@return instance of {@link RouteBuilder}. | [
"Specifies",
"that",
"this",
"route",
"is",
"mapped",
"to",
"HTTP",
"PUT",
"method",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/RouteBuilder.java#L195-L201 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/RouteBuilder.java | RouteBuilder.delete | public RouteBuilder delete(){
if(!methods.contains(HttpMethod.DELETE)){
methods.add(HttpMethod.DELETE);
}
return this;
} | java | public RouteBuilder delete(){
if(!methods.contains(HttpMethod.DELETE)){
methods.add(HttpMethod.DELETE);
}
return this;
} | [
"public",
"RouteBuilder",
"delete",
"(",
")",
"{",
"if",
"(",
"!",
"methods",
".",
"contains",
"(",
"HttpMethod",
".",
"DELETE",
")",
")",
"{",
"methods",
".",
"add",
"(",
"HttpMethod",
".",
"DELETE",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Specifies that this route is mapped to HTTP DELETE method.
@return instance of {@link RouteBuilder}. | [
"Specifies",
"that",
"this",
"route",
"is",
"mapped",
"to",
"HTTP",
"DELETE",
"method",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/RouteBuilder.java#L208-L214 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/RouteBuilder.java | RouteBuilder.matches | protected boolean matches(String requestUri, ControllerPath controllerPath, HttpMethod httpMethod) throws ClassLoadException {
boolean match = false;
String[] requestUriSegments = Util.split(requestUri, '/');
if(isWildcard() && requestUriSegments.length >= segments.size() && wildSegmentsMatch(... | java | protected boolean matches(String requestUri, ControllerPath controllerPath, HttpMethod httpMethod) throws ClassLoadException {
boolean match = false;
String[] requestUriSegments = Util.split(requestUri, '/');
if(isWildcard() && requestUriSegments.length >= segments.size() && wildSegmentsMatch(... | [
"protected",
"boolean",
"matches",
"(",
"String",
"requestUri",
",",
"ControllerPath",
"controllerPath",
",",
"HttpMethod",
"httpMethod",
")",
"throws",
"ClassLoadException",
"{",
"boolean",
"match",
"=",
"false",
";",
"String",
"[",
"]",
"requestUriSegments",
"=",
... | Returns true if this route matches the request URI, otherwise returns false.
@param requestUri incoming URI for request.
@param httpMethod HTTP method of the request.
@return true if this route matches the request URI
@throws ClassLoadException in case could not load controller | [
"Returns",
"true",
"if",
"this",
"route",
"matches",
"the",
"request",
"URI",
"otherwise",
"returns",
"false",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/RouteBuilder.java#L243-L280 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/SessionHelper.java | SessionHelper.getSessionAttributes | protected static Map<String, Object> getSessionAttributes(){
//TODO: cache session attributes map since this method can be called multiple times during a request.
HttpSession session = RequestContext.getHttpRequest().getSession(true);
Enumeration names = session.getAttributeNames();
Map... | java | protected static Map<String, Object> getSessionAttributes(){
//TODO: cache session attributes map since this method can be called multiple times during a request.
HttpSession session = RequestContext.getHttpRequest().getSession(true);
Enumeration names = session.getAttributeNames();
Map... | [
"protected",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"getSessionAttributes",
"(",
")",
"{",
"//TODO: cache session attributes map since this method can be called multiple times during a request.",
"HttpSession",
"session",
"=",
"RequestContext",
".",
"getHttpRequest",... | Returns all session attributes in a map.
@return all session attributes in a map. | [
"Returns",
"all",
"session",
"attributes",
"in",
"a",
"map",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/SessionHelper.java#L36-L47 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/AbstractControllerConfig.java | AbstractControllerConfig.add | protected FilterBuilder add(HttpSupportFilter... filters) {
for (HttpSupportFilter filter : filters) {
if(allFilters.contains(filter)){
throw new IllegalArgumentException("Cannot register the same filter instance more than once.");
}
}
allFilters.addAll(Co... | java | protected FilterBuilder add(HttpSupportFilter... filters) {
for (HttpSupportFilter filter : filters) {
if(allFilters.contains(filter)){
throw new IllegalArgumentException("Cannot register the same filter instance more than once.");
}
}
allFilters.addAll(Co... | [
"protected",
"FilterBuilder",
"add",
"(",
"HttpSupportFilter",
"...",
"filters",
")",
"{",
"for",
"(",
"HttpSupportFilter",
"filter",
":",
"filters",
")",
"{",
"if",
"(",
"allFilters",
".",
"contains",
"(",
"filter",
")",
")",
"{",
"throw",
"new",
"IllegalAr... | Adds a set of filters to a set of controllers.
The filters are invoked in the order specified. Will reject adding the same instance of a filter more than once.
@param filters filters to be added.
@return object with <code>to()</code> method which accepts a controller class. | [
"Adds",
"a",
"set",
"of",
"filters",
"to",
"a",
"set",
"of",
"controllers",
".",
"The",
"filters",
"are",
"invoked",
"in",
"the",
"order",
"specified",
".",
"Will",
"reject",
"adding",
"the",
"same",
"instance",
"of",
"a",
"filter",
"more",
"than",
"once... | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/AbstractControllerConfig.java#L136-L144 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java | RequestUtils.isXhr | public static boolean isXhr(){
String xhr = header("X-Requested-With");
if(xhr == null) {
xhr = header("x-requested-with");
}
return xhr != null && xhr.toLowerCase().equals("xmlhttprequest");
} | java | public static boolean isXhr(){
String xhr = header("X-Requested-With");
if(xhr == null) {
xhr = header("x-requested-with");
}
return xhr != null && xhr.toLowerCase().equals("xmlhttprequest");
} | [
"public",
"static",
"boolean",
"isXhr",
"(",
")",
"{",
"String",
"xhr",
"=",
"header",
"(",
"\"X-Requested-With\"",
")",
";",
"if",
"(",
"xhr",
"==",
"null",
")",
"{",
"xhr",
"=",
"header",
"(",
"\"x-requested-with\"",
")",
";",
"}",
"return",
"xhr",
"... | Returns true if this request is Ajax.
@see <a href="http://en.wikipedia.org/wiki/List_of_HTTP_header_fields">List_of_HTTP_header_fields</a>
@return true if this request is Ajax. | [
"Returns",
"true",
"if",
"this",
"request",
"is",
"Ajax",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java#L122-L128 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java | RequestUtils.params | public static List<String> params(String name){
String[] values = RequestContext.getHttpRequest().getParameterValues(name);
List<String>valuesList = null;
if (name.equals("id")) {
if(values.length == 1){
valuesList = Collections.singletonList(values[0]);
}... | java | public static List<String> params(String name){
String[] values = RequestContext.getHttpRequest().getParameterValues(name);
List<String>valuesList = null;
if (name.equals("id")) {
if(values.length == 1){
valuesList = Collections.singletonList(values[0]);
}... | [
"public",
"static",
"List",
"<",
"String",
">",
"params",
"(",
"String",
"name",
")",
"{",
"String",
"[",
"]",
"values",
"=",
"RequestContext",
".",
"getHttpRequest",
"(",
")",
".",
"getParameterValues",
"(",
"name",
")",
";",
"List",
"<",
"String",
">",... | Returns multiple request values for a name.
@param name name of multiple values from request.
@return multiple request values for a name. | [
"Returns",
"multiple",
"request",
"values",
"for",
"a",
"name",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java#L284-L301 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java | RequestUtils.params1st | public static Map<String, String> params1st(){
//TODO: candidate for performance optimization
Map<String, String> params = new HashMap<>();
Enumeration names = RequestContext.getHttpRequest().getParameterNames();
while (names.hasMoreElements()) {
String name = names.nextEleme... | java | public static Map<String, String> params1st(){
//TODO: candidate for performance optimization
Map<String, String> params = new HashMap<>();
Enumeration names = RequestContext.getHttpRequest().getParameterNames();
while (names.hasMoreElements()) {
String name = names.nextEleme... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"params1st",
"(",
")",
"{",
"//TODO: candidate for performance optimization",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"Enumeration",
"names",
... | Returns a map where keys are names of all parameters, while values are the first value for each parameter, even
if such parameter has more than one value submitted.
@return a map where keys are names of all parameters, while values are first value for each parameter, even
if such parameter has more than one value subm... | [
"Returns",
"a",
"map",
"where",
"keys",
"are",
"names",
"of",
"all",
"parameters",
"while",
"values",
"are",
"the",
"first",
"value",
"for",
"each",
"parameter",
"even",
"if",
"such",
"parameter",
"has",
"more",
"than",
"one",
"value",
"submitted",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java#L329-L343 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java | RequestUtils.cookies | public static List<Cookie> cookies(){
javax.servlet.http.Cookie[] servletCookies = RequestContext.getHttpRequest().getCookies();
if(servletCookies == null)
return new ArrayList<>();
List<Cookie> cookies = new ArrayList<>();
for (javax.servlet.http.Cookie servletCookie: servl... | java | public static List<Cookie> cookies(){
javax.servlet.http.Cookie[] servletCookies = RequestContext.getHttpRequest().getCookies();
if(servletCookies == null)
return new ArrayList<>();
List<Cookie> cookies = new ArrayList<>();
for (javax.servlet.http.Cookie servletCookie: servl... | [
"public",
"static",
"List",
"<",
"Cookie",
">",
"cookies",
"(",
")",
"{",
"javax",
".",
"servlet",
".",
"http",
".",
"Cookie",
"[",
"]",
"servletCookies",
"=",
"RequestContext",
".",
"getHttpRequest",
"(",
")",
".",
"getCookies",
"(",
")",
";",
"if",
"... | Returns collection of all cookies browser sent.
@return collection of all cookies browser sent. | [
"Returns",
"collection",
"of",
"all",
"cookies",
"browser",
"sent",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java#L412-L423 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java | RequestUtils.cookie | public static Cookie cookie(String name){
javax.servlet.http.Cookie[] servletCookies = RequestContext.getHttpRequest().getCookies();
if (servletCookies != null) {
for (javax.servlet.http.Cookie servletCookie : servletCookies) {
if (servletCookie.getName().equals(name)) {
... | java | public static Cookie cookie(String name){
javax.servlet.http.Cookie[] servletCookies = RequestContext.getHttpRequest().getCookies();
if (servletCookies != null) {
for (javax.servlet.http.Cookie servletCookie : servletCookies) {
if (servletCookie.getName().equals(name)) {
... | [
"public",
"static",
"Cookie",
"cookie",
"(",
"String",
"name",
")",
"{",
"javax",
".",
"servlet",
".",
"http",
".",
"Cookie",
"[",
"]",
"servletCookies",
"=",
"RequestContext",
".",
"getHttpRequest",
"(",
")",
".",
"getCookies",
"(",
")",
";",
"if",
"(",... | Returns a cookie by name, null if not found.
@param name name of a cookie.
@return a cookie by name, null if not found. | [
"Returns",
"a",
"cookie",
"by",
"name",
"null",
"if",
"not",
"found",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java#L431-L441 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java | RequestUtils.session | public void session(String name, Object value){
RequestContext.getHttpRequest().getSession().getAttribute(name);
} | java | public void session(String name, Object value){
RequestContext.getHttpRequest().getSession().getAttribute(name);
} | [
"public",
"void",
"session",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"RequestContext",
".",
"getHttpRequest",
"(",
")",
".",
"getSession",
"(",
")",
".",
"getAttribute",
"(",
"name",
")",
";",
"}"
] | Sets an object on a current session.
@param name name of object
@param value value of object | [
"Sets",
"an",
"object",
"on",
"a",
"current",
"session",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/RequestUtils.java#L625-L627 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/controller_filters/DBConnectionFilter.java | DBConnectionFilter.getConnectionWrappers | private List<ConnectionSpecWrapper> getConnectionWrappers() {
List<ConnectionSpecWrapper> allConnections = DbConfiguration.getConnectionSpecWrappers();
List<ConnectionSpecWrapper> result = new LinkedList<>();
for (ConnectionSpecWrapper connectionWrapper : allConnections) {
if (!conn... | java | private List<ConnectionSpecWrapper> getConnectionWrappers() {
List<ConnectionSpecWrapper> allConnections = DbConfiguration.getConnectionSpecWrappers();
List<ConnectionSpecWrapper> result = new LinkedList<>();
for (ConnectionSpecWrapper connectionWrapper : allConnections) {
if (!conn... | [
"private",
"List",
"<",
"ConnectionSpecWrapper",
">",
"getConnectionWrappers",
"(",
")",
"{",
"List",
"<",
"ConnectionSpecWrapper",
">",
"allConnections",
"=",
"DbConfiguration",
".",
"getConnectionSpecWrappers",
"(",
")",
";",
"List",
"<",
"ConnectionSpecWrapper",
">... | Returns all connections which correspond dbName of this filter and not for testing
@return all connections which correspond dbName of this filter and not for testing. | [
"Returns",
"all",
"connections",
"which",
"correspond",
"dbName",
"of",
"this",
"filter",
"and",
"not",
"for",
"testing"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/controller_filters/DBConnectionFilter.java#L142-L151 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java | HttpSupport.assign | protected void assign(String name, Object value) {
KeyWords.check(name);
RequestContext.getValues().put(name, value);
} | java | protected void assign(String name, Object value) {
KeyWords.check(name);
RequestContext.getValues().put(name, value);
} | [
"protected",
"void",
"assign",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"KeyWords",
".",
"check",
"(",
"name",
")",
";",
"RequestContext",
".",
"getValues",
"(",
")",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Assigns a value for a view.
@param name name of value
@param value value. | [
"Assigns",
"a",
"value",
"for",
"a",
"view",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L83-L86 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java | HttpSupport.redirect | protected HttpBuilder redirect(String path) {
RedirectResponse resp = new RedirectResponse(path);
RequestContext.setControllerResponse(resp);
return new HttpBuilder(resp);
} | java | protected HttpBuilder redirect(String path) {
RedirectResponse resp = new RedirectResponse(path);
RequestContext.setControllerResponse(resp);
return new HttpBuilder(resp);
} | [
"protected",
"HttpBuilder",
"redirect",
"(",
"String",
"path",
")",
"{",
"RedirectResponse",
"resp",
"=",
"new",
"RedirectResponse",
"(",
"path",
")",
";",
"RequestContext",
".",
"setControllerResponse",
"(",
"resp",
")",
";",
"return",
"new",
"HttpBuilder",
"("... | Redirects to a an action of this controller, or an action of a different controller.
This method does not expect a full URL.
@param path - expected to be a path within the application.
@return instance of {@link HttpSupport.HttpBuilder} to accept additional information. | [
"Redirects",
"to",
"a",
"an",
"action",
"of",
"this",
"controller",
"or",
"an",
"action",
"of",
"a",
"different",
"controller",
".",
"This",
"method",
"does",
"not",
"expect",
"a",
"full",
"URL",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L327-L331 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java | HttpSupport.uploadedFiles | protected Iterator<FormItem> uploadedFiles(String encoding, long maxFileSize) {
List<FormItem> fileItems = new ArrayList<>();
for(FormItem item : multipartFormItems(encoding, maxFileSize)) {
if (item.isFile()) {
fileItems.add(item);
}
}
return file... | java | protected Iterator<FormItem> uploadedFiles(String encoding, long maxFileSize) {
List<FormItem> fileItems = new ArrayList<>();
for(FormItem item : multipartFormItems(encoding, maxFileSize)) {
if (item.isFile()) {
fileItems.add(item);
}
}
return file... | [
"protected",
"Iterator",
"<",
"FormItem",
">",
"uploadedFiles",
"(",
"String",
"encoding",
",",
"long",
"maxFileSize",
")",
"{",
"List",
"<",
"FormItem",
">",
"fileItems",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"FormItem",
"item",
":",
... | Returns a collection of uploaded files from a multi-part port request.
@param encoding specifies the character encoding to be used when reading the headers of individual part.
When not specified, or null, the request encoding is used. If that is also not specified, or null,
the platform default encoding is used.
@para... | [
"Returns",
"a",
"collection",
"of",
"uploaded",
"files",
"from",
"a",
"multi",
"-",
"part",
"port",
"request",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L762-L770 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java | HttpSupport.parseHashName | private static String parseHashName(String param) {
Matcher matcher = hashPattern.matcher(param);
String name = null;
while (matcher.find()){
name = matcher.group(0);
}
return name == null? null : name.substring(1, name.length() - 1);
} | java | private static String parseHashName(String param) {
Matcher matcher = hashPattern.matcher(param);
String name = null;
while (matcher.find()){
name = matcher.group(0);
}
return name == null? null : name.substring(1, name.length() - 1);
} | [
"private",
"static",
"String",
"parseHashName",
"(",
"String",
"param",
")",
"{",
"Matcher",
"matcher",
"=",
"hashPattern",
".",
"matcher",
"(",
"param",
")",
";",
"String",
"name",
"=",
"null",
";",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
")",
... | Parses name from hash syntax.
@param param something like this: <code>person[account]</code>
@return name of hash key:<code>account</code> | [
"Parses",
"name",
"from",
"hash",
"syntax",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L992-L999 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java | HttpSupport.blank | protected boolean blank(String ... names){
//TODO: write test, move elsewhere - some helper
for(String name:names){
if(Util.blank(param(name))){
return true;
}
}
return false;
} | java | protected boolean blank(String ... names){
//TODO: write test, move elsewhere - some helper
for(String name:names){
if(Util.blank(param(name))){
return true;
}
}
return false;
} | [
"protected",
"boolean",
"blank",
"(",
"String",
"...",
"names",
")",
"{",
"//TODO: write test, move elsewhere - some helper",
"for",
"(",
"String",
"name",
":",
"names",
")",
"{",
"if",
"(",
"Util",
".",
"blank",
"(",
"param",
"(",
"name",
")",
")",
")",
"... | Returns true if any named request parameter is blank.
@param names names of request parameters.
@return true if any request parameter is blank. | [
"Returns",
"true",
"if",
"any",
"named",
"request",
"parameter",
"is",
"blank",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L1632-L1640 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java | HttpSupport.merge | protected String merge(String template, Map values){
StringWriter stringWriter = new StringWriter();
Configuration.getTemplateManager().merge(values, template, stringWriter);
return stringWriter.toString();
} | java | protected String merge(String template, Map values){
StringWriter stringWriter = new StringWriter();
Configuration.getTemplateManager().merge(values, template, stringWriter);
return stringWriter.toString();
} | [
"protected",
"String",
"merge",
"(",
"String",
"template",
",",
"Map",
"values",
")",
"{",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"Configuration",
".",
"getTemplateManager",
"(",
")",
".",
"merge",
"(",
"values",
",",
"tem... | Will merge a template and return resulting string. This method is used for just merging some text with dynamic values.
Once you have the result, you can send it by email, external web service, save it to a database, etc.
@param template name of template - same as in regular templates. Example: <code>"/email-templates/... | [
"Will",
"merge",
"a",
"template",
"and",
"return",
"resulting",
"string",
".",
"This",
"method",
"is",
"used",
"for",
"just",
"merging",
"some",
"text",
"with",
"dynamic",
"values",
".",
"Once",
"you",
"have",
"the",
"result",
"you",
"can",
"send",
"it",
... | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L1708-L1712 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java | HttpSupport.getResponseHeaders | public Map<String, String> getResponseHeaders(){
Collection<String> names = RequestContext.getHttpResponse().getHeaderNames();
Map<String, String> headers = new HashMap<>();
for (String name : names) {
headers.put(name, RequestContext.getHttpResponse().getHeader(name));
}
... | java | public Map<String, String> getResponseHeaders(){
Collection<String> names = RequestContext.getHttpResponse().getHeaderNames();
Map<String, String> headers = new HashMap<>();
for (String name : names) {
headers.put(name, RequestContext.getHttpResponse().getHeader(name));
}
... | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getResponseHeaders",
"(",
")",
"{",
"Collection",
"<",
"String",
">",
"names",
"=",
"RequestContext",
".",
"getHttpResponse",
"(",
")",
".",
"getHeaderNames",
"(",
")",
";",
"Map",
"<",
"String",
",",
... | Returns response headers
@return map with response headers. | [
"Returns",
"response",
"headers"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L1719-L1726 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/freemarker/TagFactory.java | TagFactory.addAttributesExcept | public void addAttributesExcept(Map params, String ... exceptions){
List exceptionList = Arrays.asList(exceptions);
for(Object key: params.keySet()){
if(!exceptionList.contains(key)){
attribute(key.toString(), params.get(key).toString());
}
}
} | java | public void addAttributesExcept(Map params, String ... exceptions){
List exceptionList = Arrays.asList(exceptions);
for(Object key: params.keySet()){
if(!exceptionList.contains(key)){
attribute(key.toString(), params.get(key).toString());
}
}
} | [
"public",
"void",
"addAttributesExcept",
"(",
"Map",
"params",
",",
"String",
"...",
"exceptions",
")",
"{",
"List",
"exceptionList",
"=",
"Arrays",
".",
"asList",
"(",
"exceptions",
")",
";",
"for",
"(",
"Object",
"key",
":",
"params",
".",
"keySet",
"(",... | Will add values from params map except the exceptions.
@param params map with values. Key used as an attribute name, value as value.
@param exceptions list of excepted keys. | [
"Will",
"add",
"values",
"from",
"params",
"map",
"except",
"the",
"exceptions",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/freemarker/TagFactory.java#L100-L107 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/SessionFacade.java | SessionFacade.id | public String id(){
HttpServletRequest r = RequestContext.getHttpRequest();
if(r == null){
return null;
}
HttpSession session = r.getSession(false);
return session == null ? null : session.getId();
} | java | public String id(){
HttpServletRequest r = RequestContext.getHttpRequest();
if(r == null){
return null;
}
HttpSession session = r.getSession(false);
return session == null ? null : session.getId();
} | [
"public",
"String",
"id",
"(",
")",
"{",
"HttpServletRequest",
"r",
"=",
"RequestContext",
".",
"getHttpRequest",
"(",
")",
";",
"if",
"(",
"r",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"HttpSession",
"session",
"=",
"r",
".",
"getSession",
... | Returns a session ID from underlying session.
@return a session ID from underlying session, or null if session does not exist. | [
"Returns",
"a",
"session",
"ID",
"from",
"underlying",
"session",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/SessionFacade.java#L35-L42 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/SessionFacade.java | SessionFacade.get | public Object get(String name){
return RequestContext.getHttpRequest().getSession(true).getAttribute(name);
} | java | public Object get(String name){
return RequestContext.getHttpRequest().getSession(true).getAttribute(name);
} | [
"public",
"Object",
"get",
"(",
"String",
"name",
")",
"{",
"return",
"RequestContext",
".",
"getHttpRequest",
"(",
")",
".",
"getSession",
"(",
"true",
")",
".",
"getAttribute",
"(",
"name",
")",
";",
"}"
] | Retrieve object from session.
@param name name of object.
@return named object. | [
"Retrieve",
"object",
"from",
"session",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/SessionFacade.java#L51-L53 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java | ControllerRunner.injectFreemarkerTags | private void injectFreemarkerTags() {
if(!tagsInjected){
AbstractFreeMarkerConfig freeMarkerConfig = Configuration.getFreeMarkerConfig();
Injector injector = Configuration.getInjector();
tagsInjected = true;
if(injector == null || freeMarkerConfig == null){
... | java | private void injectFreemarkerTags() {
if(!tagsInjected){
AbstractFreeMarkerConfig freeMarkerConfig = Configuration.getFreeMarkerConfig();
Injector injector = Configuration.getInjector();
tagsInjected = true;
if(injector == null || freeMarkerConfig == null){
... | [
"private",
"void",
"injectFreemarkerTags",
"(",
")",
"{",
"if",
"(",
"!",
"tagsInjected",
")",
"{",
"AbstractFreeMarkerConfig",
"freeMarkerConfig",
"=",
"Configuration",
".",
"getFreeMarkerConfig",
"(",
")",
";",
"Injector",
"injector",
"=",
"Configuration",
".",
... | Injects FreeMarker tags with dependencies from Guice module. | [
"Injects",
"FreeMarker",
"tags",
"with",
"dependencies",
"from",
"Guice",
"module",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java#L113-L124 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java | ControllerRunner.injectController | private void injectController(AppController controller) {
Injector injector = Configuration.getInjector();
if (injector != null) {
injector.injectMembers(controller);
}
} | java | private void injectController(AppController controller) {
Injector injector = Configuration.getInjector();
if (injector != null) {
injector.injectMembers(controller);
}
} | [
"private",
"void",
"injectController",
"(",
"AppController",
"controller",
")",
"{",
"Injector",
"injector",
"=",
"Configuration",
".",
"getInjector",
"(",
")",
";",
"if",
"(",
"injector",
"!=",
"null",
")",
"{",
"injector",
".",
"injectMembers",
"(",
"control... | Injects controller with dependencies from Guice module. | [
"Injects",
"controller",
"with",
"dependencies",
"from",
"Guice",
"module",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java#L129-L134 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java | ControllerRunner.configureExplicitResponse | private void configureExplicitResponse(Route route, String controllerLayout, RenderTemplateResponse resp) throws InstantiationException, IllegalAccessException {
if(!Configuration.getDefaultLayout().equals(controllerLayout) && resp.hasDefaultLayout()){
resp.setLayout(controllerLayout);
... | java | private void configureExplicitResponse(Route route, String controllerLayout, RenderTemplateResponse resp) throws InstantiationException, IllegalAccessException {
if(!Configuration.getDefaultLayout().equals(controllerLayout) && resp.hasDefaultLayout()){
resp.setLayout(controllerLayout);
... | [
"private",
"void",
"configureExplicitResponse",
"(",
"Route",
"route",
",",
"String",
"controllerLayout",
",",
"RenderTemplateResponse",
"resp",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"if",
"(",
"!",
"Configuration",
".",
"getDefaul... | response on current thread. | [
"response",
"on",
"current",
"thread",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java#L168-L176 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java | ControllerRunner.createDefaultResponse | private void createDefaultResponse(Route route, String controllerLayout) throws InstantiationException, IllegalAccessException {
String controllerPath = Router.getControllerPath(route.getController().getClass());
String template = controllerPath + "/" + route.getActionName();
RenderT... | java | private void createDefaultResponse(Route route, String controllerLayout) throws InstantiationException, IllegalAccessException {
String controllerPath = Router.getControllerPath(route.getController().getClass());
String template = controllerPath + "/" + route.getActionName();
RenderT... | [
"private",
"void",
"createDefaultResponse",
"(",
"Route",
"route",
",",
"String",
"controllerLayout",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"String",
"controllerPath",
"=",
"Router",
".",
"getControllerPath",
"(",
"route",
".",
"... | this is implicit processing - default behavior, really | [
"this",
"is",
"implicit",
"processing",
"-",
"default",
"behavior",
"really"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java#L179-L191 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java | ControllerRunner.checkActionMethod | private boolean checkActionMethod(AppController controller, String actionMethod) {
HttpMethod method = HttpMethod.getMethod(RequestContext.getHttpRequest());
if (!controller.actionSupportsHttpMethod(actionMethod, method)) {
DirectResponse res = new DirectResponse("");
//see http:... | java | private boolean checkActionMethod(AppController controller, String actionMethod) {
HttpMethod method = HttpMethod.getMethod(RequestContext.getHttpRequest());
if (!controller.actionSupportsHttpMethod(actionMethod, method)) {
DirectResponse res = new DirectResponse("");
//see http:... | [
"private",
"boolean",
"checkActionMethod",
"(",
"AppController",
"controller",
",",
"String",
"actionMethod",
")",
"{",
"HttpMethod",
"method",
"=",
"HttpMethod",
".",
"getMethod",
"(",
"RequestContext",
".",
"getHttpRequest",
"(",
")",
")",
";",
"if",
"(",
"!",... | Checks if the action method supports requested HTTP method | [
"Checks",
"if",
"the",
"action",
"method",
"supports",
"requested",
"HTTP",
"method"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java#L213-L228 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java | ControllerRunner.filterAfter | private void filterAfter(Route route) {
try {
List<HttpSupportFilter> filters = Configuration.getFilters();
for (int i = filters.size() - 1; i >= 0; i--) {
HttpSupportFilter filter = filters.get(i);
if(Configuration.getFilterMetadata(filter).matches(route)... | java | private void filterAfter(Route route) {
try {
List<HttpSupportFilter> filters = Configuration.getFilters();
for (int i = filters.size() - 1; i >= 0; i--) {
HttpSupportFilter filter = filters.get(i);
if(Configuration.getFilterMetadata(filter).matches(route)... | [
"private",
"void",
"filterAfter",
"(",
"Route",
"route",
")",
"{",
"try",
"{",
"List",
"<",
"HttpSupportFilter",
">",
"filters",
"=",
"Configuration",
".",
"getFilters",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"filters",
".",
"size",
"(",
")",
"-",... | Run filters in opposite order | [
"Run",
"filters",
"in",
"opposite",
"order"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/ControllerRunner.java#L274-L289 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/ConnectionBuilder.java | ConnectionBuilder.jdbc | public void jdbc(String driver, String url, String user, String password) {
connectionWrapper.setConnectionSpec(new ConnectionJdbcSpec(driver, url, user, password));
} | java | public void jdbc(String driver, String url, String user, String password) {
connectionWrapper.setConnectionSpec(new ConnectionJdbcSpec(driver, url, user, password));
} | [
"public",
"void",
"jdbc",
"(",
"String",
"driver",
",",
"String",
"url",
",",
"String",
"user",
",",
"String",
"password",
")",
"{",
"connectionWrapper",
".",
"setConnectionSpec",
"(",
"new",
"ConnectionJdbcSpec",
"(",
"driver",
",",
"url",
",",
"user",
",",... | Configure standard JDBC parameters for opening a connection.
@param driver class name of driver
@param url JDBC URL
@param user user name
@param password password | [
"Configure",
"standard",
"JDBC",
"parameters",
"for",
"opening",
"a",
"connection",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/ConnectionBuilder.java#L62-L64 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/ConnectionBuilder.java | ConnectionBuilder.jdbc | public void jdbc(String driver, String url, Properties props) {
connectionWrapper.setConnectionSpec(new ConnectionJdbcSpec(driver, url, props));
} | java | public void jdbc(String driver, String url, Properties props) {
connectionWrapper.setConnectionSpec(new ConnectionJdbcSpec(driver, url, props));
} | [
"public",
"void",
"jdbc",
"(",
"String",
"driver",
",",
"String",
"url",
",",
"Properties",
"props",
")",
"{",
"connectionWrapper",
".",
"setConnectionSpec",
"(",
"new",
"ConnectionJdbcSpec",
"(",
"driver",
",",
"url",
",",
"props",
")",
")",
";",
"}"
] | Configure expanded JDBC parameters for opening a connection if needed
@param driver class name of driver
@param url JDBC URL
@param props properties with additional parameters a driver can take. | [
"Configure",
"expanded",
"JDBC",
"parameters",
"for",
"opening",
"a",
"connection",
"if",
"needed"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/ConnectionBuilder.java#L73-L75 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/Configuration.java | Configuration.injectFilters | protected static void injectFilters() {
if(injector != null ){
if(Configuration.isTesting()){
for (HttpSupportFilter filter : filters) {
injector.injectMembers(filter);
}
} else if (!filtersInjected) {
for (HttpSupportFi... | java | protected static void injectFilters() {
if(injector != null ){
if(Configuration.isTesting()){
for (HttpSupportFilter filter : filters) {
injector.injectMembers(filter);
}
} else if (!filtersInjected) {
for (HttpSupportFi... | [
"protected",
"static",
"void",
"injectFilters",
"(",
")",
"{",
"if",
"(",
"injector",
"!=",
"null",
")",
"{",
"if",
"(",
"Configuration",
".",
"isTesting",
"(",
")",
")",
"{",
"for",
"(",
"HttpSupportFilter",
"filter",
":",
"filters",
")",
"{",
"injector... | the same stuff a few times. | [
"the",
"same",
"stuff",
"a",
"few",
"times",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/Configuration.java#L301-L314 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/Configuration.java | Configuration.getFilterMetadata | static FilterMetadata getFilterMetadata(HttpSupportFilter filter){
FilterMetadata config = filterMetadataMap.get(filter);
if(config == null){
config = new FilterMetadata();
filterMetadataMap.put(filter, config);
}
return config;
} | java | static FilterMetadata getFilterMetadata(HttpSupportFilter filter){
FilterMetadata config = filterMetadataMap.get(filter);
if(config == null){
config = new FilterMetadata();
filterMetadataMap.put(filter, config);
}
return config;
} | [
"static",
"FilterMetadata",
"getFilterMetadata",
"(",
"HttpSupportFilter",
"filter",
")",
"{",
"FilterMetadata",
"config",
"=",
"filterMetadataMap",
".",
"get",
"(",
"filter",
")",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"config",
"=",
"new",
"Filter... | by a single thread when the app is bootstrapped. | [
"by",
"a",
"single",
"thread",
"when",
"the",
"app",
"is",
"bootstrapped",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/Configuration.java#L318-L325 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Command.java | Command.fromXml | public static <T extends Command> T fromXml(String commandXml) {
return (T) X_STREAM.fromXML(commandXml);
} | java | public static <T extends Command> T fromXml(String commandXml) {
return (T) X_STREAM.fromXML(commandXml);
} | [
"public",
"static",
"<",
"T",
"extends",
"Command",
">",
"T",
"fromXml",
"(",
"String",
"commandXml",
")",
"{",
"return",
"(",
"T",
")",
"X_STREAM",
".",
"fromXML",
"(",
"commandXml",
")",
";",
"}"
] | Method used by framework to de-serialize a command from XML.
@param commandXml XML representation of a command.
@return new instance of a command initialized with data from <code>commandXml</code> argument. | [
"Method",
"used",
"by",
"framework",
"to",
"de",
"-",
"serialize",
"a",
"command",
"from",
"XML",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Command.java#L54-L56 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/Captcha.java | Captcha.generateImage | public static byte[] generateImage(String text) {
int w = 180, h = 40;
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
... | java | public static byte[] generateImage(String text) {
int w = 180, h = 40;
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
... | [
"public",
"static",
"byte",
"[",
"]",
"generateImage",
"(",
"String",
"text",
")",
"{",
"int",
"w",
"=",
"180",
",",
"h",
"=",
"40",
";",
"BufferedImage",
"image",
"=",
"new",
"BufferedImage",
"(",
"w",
",",
"h",
",",
"BufferedImage",
".",
"TYPE_INT_RG... | Generates a PNG image of text 180 pixels wide, 40 pixels high with white background.
@param text expects string size eight (8) characters.
@return byte array that is a PNG image generated with text displayed. | [
"Generates",
"a",
"PNG",
"image",
"of",
"text",
"180",
"pixels",
"wide",
"40",
"pixels",
"high",
"with",
"white",
"background",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/Captcha.java#L50-L81 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/FormItem.java | FormItem.getStreamAsString | public String getStreamAsString(){
try {
return Util.read(fileItemStream.openStream());
} catch (Exception e) {
throw new ControllerException(e);
}
} | java | public String getStreamAsString(){
try {
return Util.read(fileItemStream.openStream());
} catch (Exception e) {
throw new ControllerException(e);
}
} | [
"public",
"String",
"getStreamAsString",
"(",
")",
"{",
"try",
"{",
"return",
"Util",
".",
"read",
"(",
"fileItemStream",
".",
"openStream",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"ControllerException",
"(",
"e... | Converts entire content of this item to String.
@return content streamed from this field as string. | [
"Converts",
"entire",
"content",
"of",
"this",
"item",
"to",
"String",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/FormItem.java#L141-L147 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/freemarker/AbstractFreeMarkerConfig.java | AbstractFreeMarkerConfig.registerTag | public void registerTag(String name, FreeMarkerTag tag){
configuration.setSharedVariable(name, tag);
userTags.add(tag);
} | java | public void registerTag(String name, FreeMarkerTag tag){
configuration.setSharedVariable(name, tag);
userTags.add(tag);
} | [
"public",
"void",
"registerTag",
"(",
"String",
"name",
",",
"FreeMarkerTag",
"tag",
")",
"{",
"configuration",
".",
"setSharedVariable",
"(",
"name",
",",
"tag",
")",
";",
"userTags",
".",
"add",
"(",
"tag",
")",
";",
"}"
] | Registers an application-specific tag.
@param name name of tag.
@param tag tag instance. | [
"Registers",
"an",
"application",
"-",
"specific",
"tag",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/freemarker/AbstractFreeMarkerConfig.java#L48-L51 | train |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/ControllerPackageLocator.java | ControllerPackageLocator.hackForWeblogic | private static List<URL> hackForWeblogic(FilterConfig config) {
List<URL> urls = new ArrayList<>();
Set libJars = config.getServletContext().getResourcePaths("/WEB-INF/lib");
for (Object jar : libJars) {
try {
urls.add(config.getServletContext().getResource((String) j... | java | private static List<URL> hackForWeblogic(FilterConfig config) {
List<URL> urls = new ArrayList<>();
Set libJars = config.getServletContext().getResourcePaths("/WEB-INF/lib");
for (Object jar : libJars) {
try {
urls.add(config.getServletContext().getResource((String) j... | [
"private",
"static",
"List",
"<",
"URL",
">",
"hackForWeblogic",
"(",
"FilterConfig",
"config",
")",
"{",
"List",
"<",
"URL",
">",
"urls",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Set",
"libJars",
"=",
"config",
".",
"getServletContext",
"(",
")",
... | Maybe this is a hack for other containers too?? Maybe this is not a hack at all? | [
"Maybe",
"this",
"is",
"a",
"hack",
"for",
"other",
"containers",
"too??",
"Maybe",
"this",
"is",
"not",
"a",
"hack",
"at",
"all?"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/ControllerPackageLocator.java#L106-L119 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/SessionPool.java | SessionPool.close | public void close() {
synchronized (sessions) {
closed = true;
sessionCleaner.close();
sessions.stream().forEach(PooledSession::reallyClose);
}
} | java | public void close() {
synchronized (sessions) {
closed = true;
sessionCleaner.close();
sessions.stream().forEach(PooledSession::reallyClose);
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"synchronized",
"(",
"sessions",
")",
"{",
"closed",
"=",
"true",
";",
"sessionCleaner",
".",
"close",
"(",
")",
";",
"sessions",
".",
"stream",
"(",
")",
".",
"forEach",
"(",
"PooledSession",
"::",
"reallyClose"... | Closes all underlying JMS sessions. | [
"Closes",
"all",
"underlying",
"JMS",
"sessions",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/SessionPool.java#L61-L67 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.stop | public void stop() {
started = false;
senderSessionPool.close();
receiverSessionPool.close();
listenerConsumers.forEach(Util::closeQuietly);
listenerSessions.forEach(Util::closeQuietly);
closeQuietly(producerConnection);
closeQuietly(consumerConnection);
... | java | public void stop() {
started = false;
senderSessionPool.close();
receiverSessionPool.close();
listenerConsumers.forEach(Util::closeQuietly);
listenerSessions.forEach(Util::closeQuietly);
closeQuietly(producerConnection);
closeQuietly(consumerConnection);
... | [
"public",
"void",
"stop",
"(",
")",
"{",
"started",
"=",
"false",
";",
"senderSessionPool",
".",
"close",
"(",
")",
";",
"receiverSessionPool",
".",
"close",
"(",
")",
";",
"listenerConsumers",
".",
"forEach",
"(",
"Util",
"::",
"closeQuietly",
")",
";",
... | Stops this JMS server. | [
"Stops",
"this",
"JMS",
"server",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L218-L242 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.configureNetty | public void configureNetty(String host, int port){
Map<String, Object> params = map(TransportConstants.HOST_PROP_NAME, host, TransportConstants.PORT_PROP_NAME, port);
config.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName(), params));
} | java | public void configureNetty(String host, int port){
Map<String, Object> params = map(TransportConstants.HOST_PROP_NAME, host, TransportConstants.PORT_PROP_NAME, port);
config.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName(), params));
} | [
"public",
"void",
"configureNetty",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"map",
"(",
"TransportConstants",
".",
"HOST_PROP_NAME",
",",
"host",
",",
"TransportConstants",
".",
"PORT_PROP... | Call this method once after a constructor in order to create a Netty instance to accept out of VM messages.
@param host host to bind to
@param port port to listen on | [
"Call",
"this",
"method",
"once",
"after",
"a",
"constructor",
"in",
"order",
"to",
"create",
"a",
"Netty",
"instance",
"to",
"accept",
"out",
"of",
"VM",
"messages",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L307-L310 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.receiveMessage | public Message receiveMessage(String queueName, long timeout) {
checkStarted();
try(Session session = receiverSessionPool.getSession()){
Queue queue = (Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName);
try(MessageConsumer consumer = session.createConsumer(queue)) {
... | java | public Message receiveMessage(String queueName, long timeout) {
checkStarted();
try(Session session = receiverSessionPool.getSession()){
Queue queue = (Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName);
try(MessageConsumer consumer = session.createConsumer(queue)) {
... | [
"public",
"Message",
"receiveMessage",
"(",
"String",
"queueName",
",",
"long",
"timeout",
")",
"{",
"checkStarted",
"(",
")",
";",
"try",
"(",
"Session",
"session",
"=",
"receiverSessionPool",
".",
"getSession",
"(",
")",
")",
"{",
"Queue",
"queue",
"=",
... | Receives a messafge from a queue asynchronously.If this queue also has listeners, then messages will be distributed across
all consumers.
@param queueName name of queue
@param timeout timeout in millis.
@return message if found, null if not. | [
"Receives",
"a",
"messafge",
"from",
"a",
"queue",
"asynchronously",
".",
"If",
"this",
"queue",
"also",
"has",
"listeners",
"then",
"messages",
"will",
"be",
"distributed",
"across",
"all",
"consumers",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L464-L474 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.getTopCommands | public List<Command> getTopCommands(int count, String queueName) {
checkStarted();
List<Command> res = new ArrayList<>();
try(Session session = consumerConnection.createSession()) {
Queue queue = (Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName);
Enumeration message... | java | public List<Command> getTopCommands(int count, String queueName) {
checkStarted();
List<Command> res = new ArrayList<>();
try(Session session = consumerConnection.createSession()) {
Queue queue = (Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName);
Enumeration message... | [
"public",
"List",
"<",
"Command",
">",
"getTopCommands",
"(",
"int",
"count",
",",
"String",
"queueName",
")",
"{",
"checkStarted",
"(",
")",
";",
"List",
"<",
"Command",
">",
"res",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"(",
"Session",
... | Returns top commands in queue. Does not remove anything from queue. This method can be used for
an admin tool to peek inside the queue.
@param count number of commands to lookup.
@return top commands in queue or empty list is nothing is found in queue. | [
"Returns",
"top",
"commands",
"in",
"queue",
".",
"Does",
"not",
"remove",
"anything",
"from",
"queue",
".",
"This",
"method",
"can",
"be",
"used",
"for",
"an",
"admin",
"tool",
"to",
"peek",
"inside",
"the",
"queue",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L543-L565 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.lookupMessage | protected Message lookupMessage(String queueName) {
checkStarted();
try(Session session = consumerConnection.createSession()) {
Queue queue = (Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName);
Enumeration messages = session.createBrowser(queue).getEnumeration();
... | java | protected Message lookupMessage(String queueName) {
checkStarted();
try(Session session = consumerConnection.createSession()) {
Queue queue = (Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName);
Enumeration messages = session.createBrowser(queue).getEnumeration();
... | [
"protected",
"Message",
"lookupMessage",
"(",
"String",
"queueName",
")",
"{",
"checkStarted",
"(",
")",
";",
"try",
"(",
"Session",
"session",
"=",
"consumerConnection",
".",
"createSession",
"(",
")",
")",
"{",
"Queue",
"queue",
"=",
"(",
"Queue",
")",
"... | This method exists for testing | [
"This",
"method",
"exists",
"for",
"testing"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L594-L607 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.getMessageCounts | public Map<String, Long> getMessageCounts(){
Map<String, Long> counts = new HashMap<>();
for (QueueConfig queueConfig : queueConfigsList) {
counts.put(queueConfig.getName(), getMessageCount(queueConfig.getName()));
}
return counts;
} | java | public Map<String, Long> getMessageCounts(){
Map<String, Long> counts = new HashMap<>();
for (QueueConfig queueConfig : queueConfigsList) {
counts.put(queueConfig.getName(), getMessageCount(queueConfig.getName()));
}
return counts;
} | [
"public",
"Map",
"<",
"String",
",",
"Long",
">",
"getMessageCounts",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Long",
">",
"counts",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"QueueConfig",
"queueConfig",
":",
"queueConfigsList",
")",
"... | Returns counts of messages for all queues.
@return map, where a key is a queue name, and value is a number of messages currently in that queue.0 | [
"Returns",
"counts",
"of",
"messages",
"for",
"all",
"queues",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L630-L636 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.getMessageCount | public long getMessageCount(String queue){
try {
return getQueueControl(queue).getMessageCount();
} catch (Exception e) {
throw new AsyncException(e);
}
} | java | public long getMessageCount(String queue){
try {
return getQueueControl(queue).getMessageCount();
} catch (Exception e) {
throw new AsyncException(e);
}
} | [
"public",
"long",
"getMessageCount",
"(",
"String",
"queue",
")",
"{",
"try",
"{",
"return",
"getQueueControl",
"(",
"queue",
")",
".",
"getMessageCount",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"AsyncException",
"(",
... | Returns number of messages currently in queue
@param queue queue name
@return number of messages currently in queue | [
"Returns",
"number",
"of",
"messages",
"currently",
"in",
"queue"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L645-L651 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.resume | public void resume(String queueName) {
try {
getQueueControl(queueName).resume();
} catch (Exception e) {
throw new AsyncException(e);
}
} | java | public void resume(String queueName) {
try {
getQueueControl(queueName).resume();
} catch (Exception e) {
throw new AsyncException(e);
}
} | [
"public",
"void",
"resume",
"(",
"String",
"queueName",
")",
"{",
"try",
"{",
"getQueueControl",
"(",
"queueName",
")",
".",
"resume",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"AsyncException",
"(",
"e",
")",
";",
... | Resumes a paused queue
@param queueName queue name | [
"Resumes",
"a",
"paused",
"queue"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L659-L665 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.pause | public void pause(String queueName) {
try {
getQueueControl(queueName).pause();
} catch (Exception e) {
throw new AsyncException(e);
}
} | java | public void pause(String queueName) {
try {
getQueueControl(queueName).pause();
} catch (Exception e) {
throw new AsyncException(e);
}
} | [
"public",
"void",
"pause",
"(",
"String",
"queueName",
")",
"{",
"try",
"{",
"getQueueControl",
"(",
"queueName",
")",
".",
"pause",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"AsyncException",
"(",
"e",
")",
";",
"... | Pauses a queue. A paused queue stops delivering commands to listeners. It still can accumulate commands.
@param queueName queue name. | [
"Pauses",
"a",
"queue",
".",
"A",
"paused",
"queue",
"stops",
"delivering",
"commands",
"to",
"listeners",
".",
"It",
"still",
"can",
"accumulate",
"commands",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L672-L678 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.removeMessages | public int removeMessages(String queueName, String filter) {
try {
return getQueueControl(queueName).removeMessages(filter);
} catch (Exception e) {
throw new AsyncException(e);
}
} | java | public int removeMessages(String queueName, String filter) {
try {
return getQueueControl(queueName).removeMessages(filter);
} catch (Exception e) {
throw new AsyncException(e);
}
} | [
"public",
"int",
"removeMessages",
"(",
"String",
"queueName",
",",
"String",
"filter",
")",
"{",
"try",
"{",
"return",
"getQueueControl",
"(",
"queueName",
")",
".",
"removeMessages",
"(",
"filter",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",... | Removes messages from queue.
@param queueName queue name
@param filter filter selector as in JMS specification.
See: <a href="http://docs.oracle.com/cd/E19798-01/821-1841/bncer/index.html">JMS Message Selectors</a>
@return number of messages removed | [
"Removes",
"messages",
"from",
"queue",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L700-L706 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.removeAllMessages | public int removeAllMessages(String queueName) {
try {
return getQueueControl(queueName).removeMessages(null);
} catch (Exception e) {
throw new AsyncException(e);
}
} | java | public int removeAllMessages(String queueName) {
try {
return getQueueControl(queueName).removeMessages(null);
} catch (Exception e) {
throw new AsyncException(e);
}
} | [
"public",
"int",
"removeAllMessages",
"(",
"String",
"queueName",
")",
"{",
"try",
"{",
"return",
"getQueueControl",
"(",
"queueName",
")",
".",
"removeMessages",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"AsyncE... | Removes all messages from queue.
@param queueName queue name.
@return number of messages removed | [
"Removes",
"all",
"messages",
"from",
"queue",
"."
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L714-L720 | train |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.moveMessages | public int moveMessages(String source, String target){
try {
return getQueueControl(source).moveMessages("", target);
} catch (Exception e) {
throw new AsyncException(e);
}
} | java | public int moveMessages(String source, String target){
try {
return getQueueControl(source).moveMessages("", target);
} catch (Exception e) {
throw new AsyncException(e);
}
} | [
"public",
"int",
"moveMessages",
"(",
"String",
"source",
",",
"String",
"target",
")",
"{",
"try",
"{",
"return",
"getQueueControl",
"(",
"source",
")",
".",
"moveMessages",
"(",
"\"\"",
",",
"target",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",... | Moves all messages from one queue to another
@param source name of source queue
@param target name of target queue
@return number of messages moved | [
"Moves",
"all",
"messages",
"from",
"one",
"queue",
"to",
"another"
] | f25f589da94852b6f5625182360732e0861794a6 | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L730-L737 | train |
lucasweb78/aws-v4-signer-java | src/main/java/uk/co/lucasweb/aws/v4/signer/encoding/URLEncoding.java | URLEncoding.encode | private static String encode(String value, BitSet unescapedChars) {
// Code from org.apache.commons.codec.net.URLCodec.encodeUrl(BitSet, byte[])
final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
for (final byte c : value.getBytes(CHARSET)) {
int b = c;
if ... | java | private static String encode(String value, BitSet unescapedChars) {
// Code from org.apache.commons.codec.net.URLCodec.encodeUrl(BitSet, byte[])
final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
for (final byte c : value.getBytes(CHARSET)) {
int b = c;
if ... | [
"private",
"static",
"String",
"encode",
"(",
"String",
"value",
",",
"BitSet",
"unescapedChars",
")",
"{",
"// Code from org.apache.commons.codec.net.URLCodec.encodeUrl(BitSet, byte[])",
"final",
"ByteArrayOutputStream",
"buffer",
"=",
"new",
"ByteArrayOutputStream",
"(",
")... | URL-encode a String. | [
"URL",
"-",
"encode",
"a",
"String",
"."
] | 731a5f3974fa5d28361d67c54f6186d763bd9440 | https://github.com/lucasweb78/aws-v4-signer-java/blob/731a5f3974fa5d28361d67c54f6186d763bd9440/src/main/java/uk/co/lucasweb/aws/v4/signer/encoding/URLEncoding.java#L98-L117 | train |
AKSW/RDFUnit | rdfunit-core/src/main/java/org/aksw/rdfunit/prefix/LOVEndpoint.java | LOVEndpoint.extractResourceLocation | public SchemaEntry extractResourceLocation(SchemaEntry entry) {
Optional<String> actualResourceUri = Optional.empty();
if (! entry.getVocabularyDefinedBy().equals(entry.getVocabularyNamespace()))
actualResourceUri = getContentLocation(entry.getVocabularyDefinedBy(), GENERALFORMAT, Lists.newA... | java | public SchemaEntry extractResourceLocation(SchemaEntry entry) {
Optional<String> actualResourceUri = Optional.empty();
if (! entry.getVocabularyDefinedBy().equals(entry.getVocabularyNamespace()))
actualResourceUri = getContentLocation(entry.getVocabularyDefinedBy(), GENERALFORMAT, Lists.newA... | [
"public",
"SchemaEntry",
"extractResourceLocation",
"(",
"SchemaEntry",
"entry",
")",
"{",
"Optional",
"<",
"String",
">",
"actualResourceUri",
"=",
"Optional",
".",
"empty",
"(",
")",
";",
"if",
"(",
"!",
"entry",
".",
"getVocabularyDefinedBy",
"(",
")",
".",... | Will try to get a responsive content location trying
1. VocabularyDefinedBy location
2. VocabularyURI location
@param entry - the origin URL which is used as basis
@return - the optional content location | [
"Will",
"try",
"to",
"get",
"a",
"responsive",
"content",
"location",
"trying",
"1",
".",
"VocabularyDefinedBy",
"location",
"2",
".",
"VocabularyURI",
"location"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/prefix/LOVEndpoint.java#L165-L185 | train |
AKSW/RDFUnit | rdfunit-core/src/main/java/org/aksw/rdfunit/prefix/LOVEndpoint.java | LOVEndpoint.getContentVersions | private Optional<String> getContentVersions(String currentUrl, Collection<SerializationFormat> formats, ArrayList<String> redirects){
Optional<SerializationFormat> test = formats.stream().filter(x -> currentUrl.trim().endsWith(x.getExtension())).findFirst();
if(currentUrl != null && ! test.isPresent()){... | java | private Optional<String> getContentVersions(String currentUrl, Collection<SerializationFormat> formats, ArrayList<String> redirects){
Optional<SerializationFormat> test = formats.stream().filter(x -> currentUrl.trim().endsWith(x.getExtension())).findFirst();
if(currentUrl != null && ! test.isPresent()){... | [
"private",
"Optional",
"<",
"String",
">",
"getContentVersions",
"(",
"String",
"currentUrl",
",",
"Collection",
"<",
"SerializationFormat",
">",
"formats",
",",
"ArrayList",
"<",
"String",
">",
"redirects",
")",
"{",
"Optional",
"<",
"SerializationFormat",
">",
... | Will try to get a responsive content location by adding suffixes based on the given SerializationFormats
@param currentUrl - the base url onto which to concatenate the suffixes
@param formats - the list of SerializationFormats to try out
@param redirects - list of established redirects which led to this point
@return -... | [
"Will",
"try",
"to",
"get",
"a",
"responsive",
"content",
"location",
"by",
"adding",
"suffixes",
"based",
"on",
"the",
"given",
"SerializationFormats"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/prefix/LOVEndpoint.java#L200-L220 | train |
AKSW/RDFUnit | rdfunit-core/src/main/java/org/aksw/rdfunit/prefix/LOVEndpoint.java | LOVEndpoint.main | public static void main(String[] args) {
LOVEndpoint lov = new LOVEndpoint();
String file = args.length > 0 ? args[1].trim() : "rdfunit-model/src/main/resources/org/aksw/rdfunit/configuration/schemaLOV.csv";
lov.writeAllLOVEntriesToFile(file);
} | java | public static void main(String[] args) {
LOVEndpoint lov = new LOVEndpoint();
String file = args.length > 0 ? args[1].trim() : "rdfunit-model/src/main/resources/org/aksw/rdfunit/configuration/schemaLOV.csv";
lov.writeAllLOVEntriesToFile(file);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"LOVEndpoint",
"lov",
"=",
"new",
"LOVEndpoint",
"(",
")",
";",
"String",
"file",
"=",
"args",
".",
"length",
">",
"0",
"?",
"args",
"[",
"1",
"]",
".",
"trim",
"(",
"... | Will start the crawling of the LOV endpoint
@param args - if provided, the first argument is the file location of the results, else the default schemaLOV.csv is used | [
"Will",
"start",
"the",
"crawling",
"of",
"the",
"LOV",
"endpoint"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/prefix/LOVEndpoint.java#L319-L323 | train |
AKSW/RDFUnit | rdfunit-core/src/main/java/org/aksw/rdfunit/validate/wrappers/RDFUnitStaticValidator.java | RDFUnitStaticValidator.validate | public static TestExecution validate(final TestCaseExecutionType testCaseExecutionType, final TestSource testSource, final TestSuite testSuite, final String agentID, DatasetOverviewResults overviewResults) {
checkNotNull(testCaseExecutionType, "Test Execution Type must not be null");
checkNotNull(testS... | java | public static TestExecution validate(final TestCaseExecutionType testCaseExecutionType, final TestSource testSource, final TestSuite testSuite, final String agentID, DatasetOverviewResults overviewResults) {
checkNotNull(testCaseExecutionType, "Test Execution Type must not be null");
checkNotNull(testS... | [
"public",
"static",
"TestExecution",
"validate",
"(",
"final",
"TestCaseExecutionType",
"testCaseExecutionType",
",",
"final",
"TestSource",
"testSource",
",",
"final",
"TestSuite",
"testSuite",
",",
"final",
"String",
"agentID",
",",
"DatasetOverviewResults",
"overviewRe... | Static method that validates a Source. In this case the Source and TestSuite are provided as argument along with a RDFUnitConfiguration object
This function can also serve as standalone | [
"Static",
"method",
"that",
"validates",
"a",
"Source",
".",
"In",
"this",
"case",
"the",
"Source",
"and",
"TestSuite",
"are",
"provided",
"as",
"argument",
"along",
"with",
"a",
"RDFUnitConfiguration",
"object",
"This",
"function",
"can",
"also",
"serve",
"as... | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/validate/wrappers/RDFUnitStaticValidator.java#L124-L143 | train |
AKSW/RDFUnit | rdfunit-webdemo/src/main/java/org/aksw/rdfunit/webdemo/RDFUnitDemoSession.java | RDFUnitDemoSession.init | public static void init(String clientHost) {
VaadinSession.getCurrent().setAttribute("client", clientHost);
String baseDir = _getBaseDir();
VaadinSession.getCurrent().setAttribute(String.class, baseDir);
TestGeneratorExecutor testGeneratorExecutor = new TestGeneratorExecutor();
... | java | public static void init(String clientHost) {
VaadinSession.getCurrent().setAttribute("client", clientHost);
String baseDir = _getBaseDir();
VaadinSession.getCurrent().setAttribute(String.class, baseDir);
TestGeneratorExecutor testGeneratorExecutor = new TestGeneratorExecutor();
... | [
"public",
"static",
"void",
"init",
"(",
"String",
"clientHost",
")",
"{",
"VaadinSession",
".",
"getCurrent",
"(",
")",
".",
"setAttribute",
"(",
"\"client\"",
",",
"clientHost",
")",
";",
"String",
"baseDir",
"=",
"_getBaseDir",
"(",
")",
";",
"VaadinSessi... | Init session variables.
@param clientHost a {@link java.lang.String} object. | [
"Init",
"session",
"variables",
"."
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-webdemo/src/main/java/org/aksw/rdfunit/webdemo/RDFUnitDemoSession.java#L40-L55 | train |
AKSW/RDFUnit | rdfunit-core/src/main/java/org/aksw/rdfunit/utils/StringUtils.java | StringUtils.findLongestOverlap | public static String findLongestOverlap(String first, String second){
if(org.apache.commons.lang3.StringUtils.isEmpty(first) || org.apache.commons.lang3.StringUtils.isEmpty(second))
return "";
int length = Math.min(first.length(), second.length());
for(int i = 0; i < length; i++){
... | java | public static String findLongestOverlap(String first, String second){
if(org.apache.commons.lang3.StringUtils.isEmpty(first) || org.apache.commons.lang3.StringUtils.isEmpty(second))
return "";
int length = Math.min(first.length(), second.length());
for(int i = 0; i < length; i++){
... | [
"public",
"static",
"String",
"findLongestOverlap",
"(",
"String",
"first",
",",
"String",
"second",
")",
"{",
"if",
"(",
"org",
".",
"apache",
".",
"commons",
".",
"lang3",
".",
"StringUtils",
".",
"isEmpty",
"(",
"first",
")",
"||",
"org",
".",
"apache... | Will find the longest suffix of the first sequence which is a prefix of the second.
@param first - first
@param second - second
@return - the longest overlap | [
"Will",
"find",
"the",
"longest",
"suffix",
"of",
"the",
"first",
"sequence",
"which",
"is",
"a",
"prefix",
"of",
"the",
"second",
"."
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/utils/StringUtils.java#L43-L53 | train |
AKSW/RDFUnit | rdfunit-model/src/main/java/org/aksw/rdfunit/RDFUnit.java | RDFUnit.init | public RDFUnit init() {
// Update pattern service
for (Pattern pattern : getPatterns()) {
PatternService.addPattern(pattern.getId(),pattern.getIRI(), pattern);
}
return this;
} | java | public RDFUnit init() {
// Update pattern service
for (Pattern pattern : getPatterns()) {
PatternService.addPattern(pattern.getId(),pattern.getIRI(), pattern);
}
return this;
} | [
"public",
"RDFUnit",
"init",
"(",
")",
"{",
"// Update pattern service",
"for",
"(",
"Pattern",
"pattern",
":",
"getPatterns",
"(",
")",
")",
"{",
"PatternService",
".",
"addPattern",
"(",
"pattern",
".",
"getId",
"(",
")",
",",
"pattern",
".",
"getIRI",
"... | Initializes the patterns library, required
@throws IllegalArgumentException if files do not exist | [
"Initializes",
"the",
"patterns",
"library",
"required"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-model/src/main/java/org/aksw/rdfunit/RDFUnit.java#L91-L98 | train |
AKSW/RDFUnit | rdfunit-validate/src/main/java/org/aksw/rdfunit/validate/ws/AbstractRDFUnitWebService.java | AbstractRDFUnitWebService.handleRequestAndRespond | private void handleRequestAndRespond(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException {
RDFUnitConfiguration configuration = null;
try {
configuration = getConfiguration(httpServletRequest);
} catch (ParameterException e) {
... | java | private void handleRequestAndRespond(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException {
RDFUnitConfiguration configuration = null;
try {
configuration = getConfiguration(httpServletRequest);
} catch (ParameterException e) {
... | [
"private",
"void",
"handleRequestAndRespond",
"(",
"HttpServletRequest",
"httpServletRequest",
",",
"HttpServletResponse",
"httpServletResponse",
")",
"throws",
"IOException",
"{",
"RDFUnitConfiguration",
"configuration",
"=",
"null",
";",
"try",
"{",
"configuration",
"=",
... | Has all the workflow logic for getting the parameters, performing a validation and writing the output | [
"Has",
"all",
"the",
"workflow",
"logic",
"for",
"getting",
"the",
"parameters",
"performing",
"a",
"validation",
"and",
"writing",
"the",
"output"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-validate/src/main/java/org/aksw/rdfunit/validate/ws/AbstractRDFUnitWebService.java#L45-L78 | train |
AKSW/RDFUnit | rdfunit-validate/src/main/java/org/aksw/rdfunit/validate/ws/AbstractRDFUnitWebService.java | AbstractRDFUnitWebService.writeResults | private static void writeResults(final RDFUnitConfiguration configuration, final TestExecution testExecution, HttpServletResponse httpServletResponse) throws RdfWriterException, IOException {
SerializationFormat serializationFormat = configuration.geFirstOutputFormat();
if (serializationFormat == null) ... | java | private static void writeResults(final RDFUnitConfiguration configuration, final TestExecution testExecution, HttpServletResponse httpServletResponse) throws RdfWriterException, IOException {
SerializationFormat serializationFormat = configuration.geFirstOutputFormat();
if (serializationFormat == null) ... | [
"private",
"static",
"void",
"writeResults",
"(",
"final",
"RDFUnitConfiguration",
"configuration",
",",
"final",
"TestExecution",
"testExecution",
",",
"HttpServletResponse",
"httpServletResponse",
")",
"throws",
"RdfWriterException",
",",
"IOException",
"{",
"Serializatio... | Writes the output of the validation to the HttpServletResponse | [
"Writes",
"the",
"output",
"of",
"the",
"validation",
"to",
"the",
"HttpServletResponse"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-validate/src/main/java/org/aksw/rdfunit/validate/ws/AbstractRDFUnitWebService.java#L83-L92 | train |
AKSW/RDFUnit | rdfunit-io/src/main/java/org/aksw/rdfunit/io/format/SerializationFormat.java | SerializationFormat.containsFormatName | private boolean containsFormatName(String format) {
return name.equalsIgnoreCase(format) || synonyms.contains(format.toLowerCase());
} | java | private boolean containsFormatName(String format) {
return name.equalsIgnoreCase(format) || synonyms.contains(format.toLowerCase());
} | [
"private",
"boolean",
"containsFormatName",
"(",
"String",
"format",
")",
"{",
"return",
"name",
".",
"equalsIgnoreCase",
"(",
"format",
")",
"||",
"synonyms",
".",
"contains",
"(",
"format",
".",
"toLowerCase",
"(",
")",
")",
";",
"}"
] | Helper function that matches only the synonyms | [
"Helper",
"function",
"that",
"matches",
"only",
"the",
"synonyms"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-io/src/main/java/org/aksw/rdfunit/io/format/SerializationFormat.java#L106-L109 | train |
AKSW/RDFUnit | rdfunit-commons/src/main/java/org/aksw/rdfunit/services/PrefixNSService.java | PrefixNSService.getURIFromAbbrev | public static String getURIFromAbbrev(final String abbreviation) {
String[] parts = abbreviation.split(":");
if (parts.length == 2) {
return getNSFromPrefix(parts[0]) + parts[1];
}
throw new IllegalArgumentException("Undefined prefix in " + abbreviation);
} | java | public static String getURIFromAbbrev(final String abbreviation) {
String[] parts = abbreviation.split(":");
if (parts.length == 2) {
return getNSFromPrefix(parts[0]) + parts[1];
}
throw new IllegalArgumentException("Undefined prefix in " + abbreviation);
} | [
"public",
"static",
"String",
"getURIFromAbbrev",
"(",
"final",
"String",
"abbreviation",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"abbreviation",
".",
"split",
"(",
"\":\"",
")",
";",
"if",
"(",
"parts",
".",
"length",
"==",
"2",
")",
"{",
"return",
... | Given an abbreviated URI, it returns a full URI
@param abbreviation the abbreviation
@return the URI | [
"Given",
"an",
"abbreviated",
"URI",
"it",
"returns",
"a",
"full",
"URI"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-commons/src/main/java/org/aksw/rdfunit/services/PrefixNSService.java#L101-L107 | train |
AKSW/RDFUnit | rdfunit-commons/src/main/java/org/aksw/rdfunit/services/PrefixNSService.java | PrefixNSService.getLocalName | public static String getLocalName(final String uri, final String prefix) {
String ns = getNSFromPrefix(prefix);
if (ns != null) {
return uri.replace(ns, "");
}
throw new IllegalArgumentException("Undefined prefix (" + prefix + ") in URI: " + uri);
} | java | public static String getLocalName(final String uri, final String prefix) {
String ns = getNSFromPrefix(prefix);
if (ns != null) {
return uri.replace(ns, "");
}
throw new IllegalArgumentException("Undefined prefix (" + prefix + ") in URI: " + uri);
} | [
"public",
"static",
"String",
"getLocalName",
"(",
"final",
"String",
"uri",
",",
"final",
"String",
"prefix",
")",
"{",
"String",
"ns",
"=",
"getNSFromPrefix",
"(",
"prefix",
")",
";",
"if",
"(",
"ns",
"!=",
"null",
")",
"{",
"return",
"uri",
".",
"re... | Returns the local name of a URI by removing the prefix namespace
@param uri the uri
@param prefix the prefix we want to remove
@return the local name (uri without prefix namespace) | [
"Returns",
"the",
"local",
"name",
"of",
"a",
"URI",
"by",
"removing",
"the",
"prefix",
"namespace"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-commons/src/main/java/org/aksw/rdfunit/services/PrefixNSService.java#L117-L123 | train |
AKSW/RDFUnit | rdfunit-core/src/main/java/org/aksw/rdfunit/io/writer/RdfHtmlResultsShaclWriter.java | RdfHtmlResultsShaclWriter.getStatusClass | protected static String getStatusClass(RLOGLevel level) {
String rowClass = "";
switch (level) {
case WARN:
rowClass = "warning";
break;
case ERROR:
rowClass = "danger";
break;
case INFO:
... | java | protected static String getStatusClass(RLOGLevel level) {
String rowClass = "";
switch (level) {
case WARN:
rowClass = "warning";
break;
case ERROR:
rowClass = "danger";
break;
case INFO:
... | [
"protected",
"static",
"String",
"getStatusClass",
"(",
"RLOGLevel",
"level",
")",
"{",
"String",
"rowClass",
"=",
"\"\"",
";",
"switch",
"(",
"level",
")",
"{",
"case",
"WARN",
":",
"rowClass",
"=",
"\"warning\"",
";",
"break",
";",
"case",
"ERROR",
":",
... | return a css class | [
"return",
"a",
"css",
"class"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/io/writer/RdfHtmlResultsShaclWriter.java#L54-L70 | train |
AKSW/RDFUnit | rdfunit-model/src/main/java/org/aksw/rdfunit/model/impl/shacl/ShapeTargetValueShape.java | ShapeTargetValueShape.nodeTargetPattern | private static String nodeTargetPattern(ShapeTargetValueShape target) {
return " " + formatNode(target.getNode()) + " " + writePropertyChain(target.pathChain) + " ?this . ";
} | java | private static String nodeTargetPattern(ShapeTargetValueShape target) {
return " " + formatNode(target.getNode()) + " " + writePropertyChain(target.pathChain) + " ?this . ";
} | [
"private",
"static",
"String",
"nodeTargetPattern",
"(",
"ShapeTargetValueShape",
"target",
")",
"{",
"return",
"\" \"",
"+",
"formatNode",
"(",
"target",
".",
"getNode",
"(",
")",
")",
"+",
"\" \"",
"+",
"writePropertyChain",
"(",
"target",
".",
"pathChain",
... | FIXME add focus node | [
"FIXME",
"add",
"focus",
"node"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-model/src/main/java/org/aksw/rdfunit/model/impl/shacl/ShapeTargetValueShape.java#L102-L104 | train |
AKSW/RDFUnit | rdfunit-core/src/main/java/org/aksw/rdfunit/sources/SchemaSource.java | SchemaSource.initModel | private Model initModel() {
OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM, ModelFactory.createDefaultModel());
try {
schemaReader.read(m);
} catch (RdfReaderException e) {
log.error("Cannot load ontology: {} ", getSchema(), e);
}
re... | java | private Model initModel() {
OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM, ModelFactory.createDefaultModel());
try {
schemaReader.read(m);
} catch (RdfReaderException e) {
log.error("Cannot load ontology: {} ", getSchema(), e);
}
re... | [
"private",
"Model",
"initModel",
"(",
")",
"{",
"OntModel",
"m",
"=",
"ModelFactory",
".",
"createOntologyModel",
"(",
"OntModelSpec",
".",
"OWL_DL_MEM",
",",
"ModelFactory",
".",
"createDefaultModel",
"(",
")",
")",
";",
"try",
"{",
"schemaReader",
".",
"read... | lazy loaded via lombok | [
"lazy",
"loaded",
"via",
"lombok"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/sources/SchemaSource.java#L65-L73 | train |
AKSW/RDFUnit | rdfunit-io/src/main/java/org/aksw/rdfunit/io/format/FormatService.java | FormatService.getInputFormat | public static SerializationFormat getInputFormat(String name) {
for (SerializationFormat ft : Instance.serializationFormats) {
if (ft.isAcceptedAsInput(name)) {
return ft;
}
}
return null;
} | java | public static SerializationFormat getInputFormat(String name) {
for (SerializationFormat ft : Instance.serializationFormats) {
if (ft.isAcceptedAsInput(name)) {
return ft;
}
}
return null;
} | [
"public",
"static",
"SerializationFormat",
"getInputFormat",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"SerializationFormat",
"ft",
":",
"Instance",
".",
"serializationFormats",
")",
"{",
"if",
"(",
"ft",
".",
"isAcceptedAsInput",
"(",
"name",
")",
")",
"{"... | returns an input FormatType for a given name
@param name the name of the format (e.g. 'ttl')
@return a FormatType that corresponds to the format name or null otherwise | [
"returns",
"an",
"input",
"FormatType",
"for",
"a",
"given",
"name"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-io/src/main/java/org/aksw/rdfunit/io/format/FormatService.java#L36-L43 | train |
AKSW/RDFUnit | rdfunit-io/src/main/java/org/aksw/rdfunit/io/format/FormatService.java | FormatService.getOutputFormat | public static SerializationFormat getOutputFormat(String name) {
for (SerializationFormat ft : Instance.serializationFormats) {
if (ft.isAcceptedAsOutput(name)) {
return ft;
}
}
return null;
} | java | public static SerializationFormat getOutputFormat(String name) {
for (SerializationFormat ft : Instance.serializationFormats) {
if (ft.isAcceptedAsOutput(name)) {
return ft;
}
}
return null;
} | [
"public",
"static",
"SerializationFormat",
"getOutputFormat",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"SerializationFormat",
"ft",
":",
"Instance",
".",
"serializationFormats",
")",
"{",
"if",
"(",
"ft",
".",
"isAcceptedAsOutput",
"(",
"name",
")",
")",
"... | returns an output FormatType for a given name
@param name the name of the format (e.g. 'ttl')
@return a FormatType that corresponds to the format name or null otherwise | [
"returns",
"an",
"output",
"FormatType",
"for",
"a",
"given",
"name"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-io/src/main/java/org/aksw/rdfunit/io/format/FormatService.java#L51-L58 | train |
AKSW/RDFUnit | rdfunit-io/src/main/java/org/aksw/rdfunit/io/format/SerializationFormatFactory.java | SerializationFormatFactory.getAllFormats | public static Collection<SerializationFormat> getAllFormats() {
ArrayList<SerializationFormat> serializationFormats = new ArrayList<>();
// single graph formats
serializationFormats.add(createTurtle());
serializationFormats.add(createN3());
serializationFormats.add(createNTriple... | java | public static Collection<SerializationFormat> getAllFormats() {
ArrayList<SerializationFormat> serializationFormats = new ArrayList<>();
// single graph formats
serializationFormats.add(createTurtle());
serializationFormats.add(createN3());
serializationFormats.add(createNTriple... | [
"public",
"static",
"Collection",
"<",
"SerializationFormat",
">",
"getAllFormats",
"(",
")",
"{",
"ArrayList",
"<",
"SerializationFormat",
">",
"serializationFormats",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// single graph formats",
"serializationFormats",
".... | Returns a list with all the defined serialization formats
@return a {@link java.util.Collection} object. | [
"Returns",
"a",
"list",
"with",
"all",
"the",
"defined",
"serialization",
"formats"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-io/src/main/java/org/aksw/rdfunit/io/format/SerializationFormatFactory.java#L21-L44 | train |
AKSW/RDFUnit | rdfunit-core/src/main/java/org/aksw/rdfunit/prefix/TrustingUrlConnection.java | TrustingUrlConnection.executeHeadRequest | static HttpResponse executeHeadRequest(URI uri, SerializationFormat format) throws IOException {
HttpHead headMethod = new HttpHead(uri);
MyRedirectHandler redirectHandler = new MyRedirectHandler(uri);
String acceptHeader = format.getMimeType() != null && ! format.getMimeType().trim().isEmpty(... | java | static HttpResponse executeHeadRequest(URI uri, SerializationFormat format) throws IOException {
HttpHead headMethod = new HttpHead(uri);
MyRedirectHandler redirectHandler = new MyRedirectHandler(uri);
String acceptHeader = format.getMimeType() != null && ! format.getMimeType().trim().isEmpty(... | [
"static",
"HttpResponse",
"executeHeadRequest",
"(",
"URI",
"uri",
",",
"SerializationFormat",
"format",
")",
"throws",
"IOException",
"{",
"HttpHead",
"headMethod",
"=",
"new",
"HttpHead",
"(",
"uri",
")",
";",
"MyRedirectHandler",
"redirectHandler",
"=",
"new",
... | Will execute a HEAD only request, following redirects, trying to locate an rdf document.
@param uri - the initial uri
@param format - the expected mime type
@return - the final http response
@throws IOException | [
"Will",
"execute",
"a",
"HEAD",
"only",
"request",
"following",
"redirects",
"trying",
"to",
"locate",
"an",
"rdf",
"document",
"."
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/prefix/TrustingUrlConnection.java#L101-L123 | train |
AKSW/RDFUnit | rdfunit-io/src/main/java/org/aksw/rdfunit/io/reader/RdfReaderFactory.java | RdfReaderFactory.createDereferenceReader | public static RdfReader createDereferenceReader(String uri) {
Collection<RdfReader> readers = new ArrayList<>();
if (!IOUtils.isFile(uri)) {
readers.add(new RdfDereferenceReader(uri));
//readers.add(new RDFaReader(uri));
} else {
readers.add(new RdfStreamReade... | java | public static RdfReader createDereferenceReader(String uri) {
Collection<RdfReader> readers = new ArrayList<>();
if (!IOUtils.isFile(uri)) {
readers.add(new RdfDereferenceReader(uri));
//readers.add(new RDFaReader(uri));
} else {
readers.add(new RdfStreamReade... | [
"public",
"static",
"RdfReader",
"createDereferenceReader",
"(",
"String",
"uri",
")",
"{",
"Collection",
"<",
"RdfReader",
">",
"readers",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"!",
"IOUtils",
".",
"isFile",
"(",
"uri",
")",
")",
"{",... | Generates a Dereference reader. This can be either a remote url, a local file or a resource
@param uri a uri that can be a remote (http) resource, a local file or a java resource object
@return a RDFFirstSuccessReader that tries to resolve 1) remote 2) local 3) resources | [
"Generates",
"a",
"Dereference",
"reader",
".",
"This",
"can",
"be",
"either",
"a",
"remote",
"url",
"a",
"local",
"file",
"or",
"a",
"resource"
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-io/src/main/java/org/aksw/rdfunit/io/reader/RdfReaderFactory.java#L68-L79 | train |
AKSW/RDFUnit | rdfunit-core/src/main/java/org/aksw/rdfunit/statistics/NamespaceStatistics.java | NamespaceStatistics.getNamespaceFromURI | public String getNamespaceFromURI(String uri) {
String breakChar = "/";
if (uri.contains("#")) {
breakChar = "#";
} else {
if (uri.substring(6).contains(":")) {
breakChar = ":";
}
}
int pos = Math.min(uri.lastIndexOf(breakChar)... | java | public String getNamespaceFromURI(String uri) {
String breakChar = "/";
if (uri.contains("#")) {
breakChar = "#";
} else {
if (uri.substring(6).contains(":")) {
breakChar = ":";
}
}
int pos = Math.min(uri.lastIndexOf(breakChar)... | [
"public",
"String",
"getNamespaceFromURI",
"(",
"String",
"uri",
")",
"{",
"String",
"breakChar",
"=",
"\"/\"",
";",
"if",
"(",
"uri",
".",
"contains",
"(",
"\"#\"",
")",
")",
"{",
"breakChar",
"=",
"\"#\"",
";",
"}",
"else",
"{",
"if",
"(",
"uri",
"... | Gets namespace from uRI.
@param uri the uri
@return the namespace from uRI | [
"Gets",
"namespace",
"from",
"uRI",
"."
] | 083f18ebda4ad790b1fbb4cfe1c9dd1762d51384 | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-core/src/main/java/org/aksw/rdfunit/statistics/NamespaceStatistics.java#L114-L126 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/schedule/ConcurrentTaskScheduler.java | ConcurrentTaskScheduler.decorateTask | private Runnable decorateTask(Runnable task, boolean isRepeatingTask) {
Runnable result = TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, isRepeatingTask);
if (this.enterpriseConcurrentScheduler) {
result = ManagedTaskBuilder.buildManagedTask(result, task.toString());
... | java | private Runnable decorateTask(Runnable task, boolean isRepeatingTask) {
Runnable result = TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, isRepeatingTask);
if (this.enterpriseConcurrentScheduler) {
result = ManagedTaskBuilder.buildManagedTask(result, task.toString());
... | [
"private",
"Runnable",
"decorateTask",
"(",
"Runnable",
"task",
",",
"boolean",
"isRepeatingTask",
")",
"{",
"Runnable",
"result",
"=",
"TaskUtils",
".",
"decorateTaskWithErrorHandler",
"(",
"task",
",",
"this",
".",
"errorHandler",
",",
"isRepeatingTask",
")",
";... | Decorate task.
@param task
the task
@param isRepeatingTask
the is repeating task
@return the runnable | [
"Decorate",
"task",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/schedule/ConcurrentTaskScheduler.java#L287-L293 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/jmx/MBeanAgent.java | MBeanAgent.registerMbeans | public void registerMbeans() {
ServerAdminMBean serverAdministrationBean = new ServerAdmin();
try {
mbeanServer.registerMBean(serverAdministrationBean,
JMXUtils.getObjectName(jmxConfig.getContextName(), "ServerAdmin"));
} catch (InstanceAlreadyExistsException e) ... | java | public void registerMbeans() {
ServerAdminMBean serverAdministrationBean = new ServerAdmin();
try {
mbeanServer.registerMBean(serverAdministrationBean,
JMXUtils.getObjectName(jmxConfig.getContextName(), "ServerAdmin"));
} catch (InstanceAlreadyExistsException e) ... | [
"public",
"void",
"registerMbeans",
"(",
")",
"{",
"ServerAdminMBean",
"serverAdministrationBean",
"=",
"new",
"ServerAdmin",
"(",
")",
";",
"try",
"{",
"mbeanServer",
".",
"registerMBean",
"(",
"serverAdministrationBean",
",",
"JMXUtils",
".",
"getObjectName",
"(",... | Register mbeans. | [
"Register",
"mbeans",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/jmx/MBeanAgent.java#L62-L76 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/command/CommandProcessor.java | CommandProcessor.getInstance | public static CommandProcessor getInstance() {
if (null == instance) {
synchronized (CommandProcessor.class) {
if (null == instance) {
instance = new CommandProcessor();
}
}
}
return instance;
} | java | public static CommandProcessor getInstance() {
if (null == instance) {
synchronized (CommandProcessor.class) {
if (null == instance) {
instance = new CommandProcessor();
}
}
}
return instance;
} | [
"public",
"static",
"CommandProcessor",
"getInstance",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"instance",
")",
"{",
"synchronized",
"(",
"CommandProcessor",
".",
"class",
")",
"{",
"if",
"(",
"null",
"==",
"instance",
")",
"{",
"instance",
"=",
"new",
"... | Gets the single instance of CommandProcessor.
@return single instance of CommandProcessor | [
"Gets",
"the",
"single",
"instance",
"of",
"CommandProcessor",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/command/CommandProcessor.java#L97-L106 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/Configuration.java | Configuration.getDefault | private static Configuration getDefault(){
Configuration config = new Configuration();
config.addHandler(new ConsoleAuditHandler());
config.setMetaData(new DummyMetaData());
config.setLayout(new SimpleLayout());
config.addProperty("log.file.location", "user.dir");
return ... | java | private static Configuration getDefault(){
Configuration config = new Configuration();
config.addHandler(new ConsoleAuditHandler());
config.setMetaData(new DummyMetaData());
config.setLayout(new SimpleLayout());
config.addProperty("log.file.location", "user.dir");
return ... | [
"private",
"static",
"Configuration",
"getDefault",
"(",
")",
"{",
"Configuration",
"config",
"=",
"new",
"Configuration",
"(",
")",
";",
"config",
".",
"addHandler",
"(",
"new",
"ConsoleAuditHandler",
"(",
")",
")",
";",
"config",
".",
"setMetaData",
"(",
"... | Gets the default.
@return the default
@since 2.3.1 | [
"Gets",
"the",
"default",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/Configuration.java#L98-L105 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/Configuration.java | Configuration.addHandler | public void addHandler(Handler handler) {
if (null == handlers) {
handlers = new ArrayList<>();
}
handlers.add(handler);
} | java | public void addHandler(Handler handler) {
if (null == handlers) {
handlers = new ArrayList<>();
}
handlers.add(handler);
} | [
"public",
"void",
"addHandler",
"(",
"Handler",
"handler",
")",
"{",
"if",
"(",
"null",
"==",
"handlers",
")",
"{",
"handlers",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"handlers",
".",
"add",
"(",
"handler",
")",
";",
"}"
] | Adds the handler.
@param handler
the handler
@since 2.2.0 | [
"Adds",
"the",
"handler",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/Configuration.java#L155-L160 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/Configuration.java | Configuration.addProperty | public void addProperty(String key, String value) {
if (null == properties) {
properties = new HashMap<>();
}
properties.put(key, value);
} | java | public void addProperty(String key, String value) {
if (null == properties) {
properties = new HashMap<>();
}
properties.put(key, value);
} | [
"public",
"void",
"addProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"null",
"==",
"properties",
")",
"{",
"properties",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"properties",
".",
"put",
"(",
"key",
",",
"value... | Adds the property.
@param key
the key
@param value
the value
@since 2.2.0 | [
"Adds",
"the",
"property",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/Configuration.java#L212-L217 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/AuditManager.java | AuditManager.audit | public boolean audit(Class<?> clazz, Method method, Object[] args) {
return audit(new AnnotationAuditEvent(clazz, method, args));
} | java | public boolean audit(Class<?> clazz, Method method, Object[] args) {
return audit(new AnnotationAuditEvent(clazz, method, args));
} | [
"public",
"boolean",
"audit",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"return",
"audit",
"(",
"new",
"AnnotationAuditEvent",
"(",
"clazz",
",",
"method",
",",
"args",
")",
")",
";",
"}... | Audit with annotation.
@param clazz
the clazz
@param method
the method
@param args
the args
@return true, if successful | [
"Audit",
"with",
"annotation",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/AuditManager.java#L86-L88 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/AuditManager.java | AuditManager.getInstance | public static IAuditManager getInstance() {
IAuditManager result = auditManager;
if(result == null) {
synchronized (AuditManager.class) {
result = auditManager;
if(result == null) {
Context.init();
auditManager = result ... | java | public static IAuditManager getInstance() {
IAuditManager result = auditManager;
if(result == null) {
synchronized (AuditManager.class) {
result = auditManager;
if(result == null) {
Context.init();
auditManager = result ... | [
"public",
"static",
"IAuditManager",
"getInstance",
"(",
")",
"{",
"IAuditManager",
"result",
"=",
"auditManager",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"synchronized",
"(",
"AuditManager",
".",
"class",
")",
"{",
"result",
"=",
"auditManager",
"... | Gets the single instance of AuditHelper.
@return single instance of AuditHelper | [
"Gets",
"the",
"single",
"instance",
"of",
"AuditHelper",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/AuditManager.java#L115-L127 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/schedule/PeriodicTrigger.java | PeriodicTrigger.nextExecutionTime | @Override
public Date nextExecutionTime(TriggerContext triggerContext) {
if (triggerContext.lastScheduledExecutionTime() == null) {
return new Date(System.currentTimeMillis() + this.initialDelay);
} else if (this.fixedRate) {
return new Date(triggerContext.lastScheduledExecut... | java | @Override
public Date nextExecutionTime(TriggerContext triggerContext) {
if (triggerContext.lastScheduledExecutionTime() == null) {
return new Date(System.currentTimeMillis() + this.initialDelay);
} else if (this.fixedRate) {
return new Date(triggerContext.lastScheduledExecut... | [
"@",
"Override",
"public",
"Date",
"nextExecutionTime",
"(",
"TriggerContext",
"triggerContext",
")",
"{",
"if",
"(",
"triggerContext",
".",
"lastScheduledExecutionTime",
"(",
")",
"==",
"null",
")",
"{",
"return",
"new",
"Date",
"(",
"System",
".",
"currentTime... | Returns the time after which a task should run again.
@param triggerContext the trigger context
@return the date | [
"Returns",
"the",
"time",
"after",
"which",
"a",
"task",
"should",
"run",
"again",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/schedule/PeriodicTrigger.java#L92-L100 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/util/ConcurrentDateFormatAccess.java | ConcurrentDateFormatAccess.convertDateToString | public String convertDateToString(final Date date) {
if (date == null) {
return null;
}
return dateFormat.get().format(date);
} | java | public String convertDateToString(final Date date) {
if (date == null) {
return null;
}
return dateFormat.get().format(date);
} | [
"public",
"String",
"convertDateToString",
"(",
"final",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"dateFormat",
".",
"get",
"(",
")",
".",
"format",
"(",
"date",
")",
";",
"}"
] | Convert date to string.
@param date the date
@return the string | [
"Convert",
"date",
"to",
"string",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/util/ConcurrentDateFormatAccess.java#L94-L99 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/schedule/Schedulers.java | Schedulers.newThreadPoolScheduler | public static Schedulers newThreadPoolScheduler(int poolSize) {
createSingleton();
Schedulers.increaseNoOfSchedullers();
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
CustomizableThreadFactory factory = new CustomizableThreadFactory();
scheduler.initializeExe... | java | public static Schedulers newThreadPoolScheduler(int poolSize) {
createSingleton();
Schedulers.increaseNoOfSchedullers();
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
CustomizableThreadFactory factory = new CustomizableThreadFactory();
scheduler.initializeExe... | [
"public",
"static",
"Schedulers",
"newThreadPoolScheduler",
"(",
"int",
"poolSize",
")",
"{",
"createSingleton",
"(",
")",
";",
"Schedulers",
".",
"increaseNoOfSchedullers",
"(",
")",
";",
"ThreadPoolTaskScheduler",
"scheduler",
"=",
"new",
"ThreadPoolTaskScheduler",
... | New thread pool scheduler.
@param poolSize
the pool size
@return the schedulers | [
"New",
"thread",
"pool",
"scheduler",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/schedule/Schedulers.java#L68-L82 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/schedule/Schedulers.java | Schedulers.stopAll | public static Schedulers stopAll() {
createSingleton();
if (instance.runningSchedullers.isEmpty()) {
throw new IllegalStateException("No schedulers available.");
}
for (Entry<String, ScheduledFuture<?>> entry : instance.runningSchedullers.entrySet()) {
ScheduledF... | java | public static Schedulers stopAll() {
createSingleton();
if (instance.runningSchedullers.isEmpty()) {
throw new IllegalStateException("No schedulers available.");
}
for (Entry<String, ScheduledFuture<?>> entry : instance.runningSchedullers.entrySet()) {
ScheduledF... | [
"public",
"static",
"Schedulers",
"stopAll",
"(",
")",
"{",
"createSingleton",
"(",
")",
";",
"if",
"(",
"instance",
".",
"runningSchedullers",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No schedulers available.\"",
")",... | Stop all.
@return the schedulers | [
"Stop",
"all",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/schedule/Schedulers.java#L113-L127 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/util/ReflectUtil.java | ReflectUtil.getNewInstanceList | public List<I> getNewInstanceList(String[] clsssList) {
List<I> instances = new ArrayList<>();
for (String className : clsssList) {
I instance = new ReflectUtil<I>().getNewInstance(className);
instances.add(instance);
}
return instances;
} | java | public List<I> getNewInstanceList(String[] clsssList) {
List<I> instances = new ArrayList<>();
for (String className : clsssList) {
I instance = new ReflectUtil<I>().getNewInstance(className);
instances.add(instance);
}
return instances;
} | [
"public",
"List",
"<",
"I",
">",
"getNewInstanceList",
"(",
"String",
"[",
"]",
"clsssList",
")",
"{",
"List",
"<",
"I",
">",
"instances",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"className",
":",
"clsssList",
")",
"{",
"I... | Gets the new instance list.
@param clsssList the clsss list
@return the new instance list | [
"Gets",
"the",
"new",
"instance",
"list",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/util/ReflectUtil.java#L76-L83 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/schedule/SimpleTriggerContext.java | SimpleTriggerContext.update | public void update(Date lastScheduledExecutionTime, Date lastActualExecutionTime, Date lastCompletionTime) {
this.lastScheduledExecutionTime = lastScheduledExecutionTime;
this.lastActualExecutionTime = lastActualExecutionTime;
this.lastCompletionTime = lastCompletionTime;
} | java | public void update(Date lastScheduledExecutionTime, Date lastActualExecutionTime, Date lastCompletionTime) {
this.lastScheduledExecutionTime = lastScheduledExecutionTime;
this.lastActualExecutionTime = lastActualExecutionTime;
this.lastCompletionTime = lastCompletionTime;
} | [
"public",
"void",
"update",
"(",
"Date",
"lastScheduledExecutionTime",
",",
"Date",
"lastActualExecutionTime",
",",
"Date",
"lastCompletionTime",
")",
"{",
"this",
".",
"lastScheduledExecutionTime",
"=",
"lastScheduledExecutionTime",
";",
"this",
".",
"lastActualExecution... | Update this holder's state with the latest time values.
@param lastScheduledExecutionTime
last <i>scheduled</i> execution time
@param lastActualExecutionTime
last <i>actual</i> execution time
@param lastCompletionTime
last completion time | [
"Update",
"this",
"holder",
"s",
"state",
"with",
"the",
"latest",
"time",
"values",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/schedule/SimpleTriggerContext.java#L54-L58 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/schedule/TaskUtils.java | TaskUtils.decorateTaskWithErrorHandler | public static DelegatingErrorHandlingRunnable decorateTaskWithErrorHandler(Runnable task,
ErrorHandler errorHandler, boolean isRepeatingTask) {
if (task instanceof DelegatingErrorHandlingRunnable) {
return (DelegatingErrorHandlingRunnable) task;
}
ErrorHandler eh = errorH... | java | public static DelegatingErrorHandlingRunnable decorateTaskWithErrorHandler(Runnable task,
ErrorHandler errorHandler, boolean isRepeatingTask) {
if (task instanceof DelegatingErrorHandlingRunnable) {
return (DelegatingErrorHandlingRunnable) task;
}
ErrorHandler eh = errorH... | [
"public",
"static",
"DelegatingErrorHandlingRunnable",
"decorateTaskWithErrorHandler",
"(",
"Runnable",
"task",
",",
"ErrorHandler",
"errorHandler",
",",
"boolean",
"isRepeatingTask",
")",
"{",
"if",
"(",
"task",
"instanceof",
"DelegatingErrorHandlingRunnable",
")",
"{",
... | Decorate the task for error handling. If the provided
@param task the task
@param errorHandler the error handler
@param isRepeatingTask the is repeating task
@return the delegating error handling runnable
{@link ErrorHandler} is not {@code null}, it will be used. Otherwise,
repeating tasks will have errors suppressed ... | [
"Decorate",
"the",
"task",
"for",
"error",
"handling",
".",
"If",
"the",
"provided"
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/schedule/TaskUtils.java#L53-L60 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/handler/file/FileHandlerUtil.java | FileHandlerUtil.addDate | public static Date addDate(final Date date, final Integer different) {
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DATE, different);
return cal.getTime();
} | java | public static Date addDate(final Date date, final Integer different) {
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DATE, different);
return cal.getTime();
} | [
"public",
"static",
"Date",
"addDate",
"(",
"final",
"Date",
"date",
",",
"final",
"Integer",
"different",
")",
"{",
"final",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"cal",
".... | Add days.
@param date the date
@param different the different
@return the date | [
"Add",
"days",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/handler/file/FileHandlerUtil.java#L196-L201 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/handler/file/archive/FTPArchiveClient.java | FTPArchiveClient.createListener | private static CopyStreamListener createListener() {
return new CopyStreamListener() {
private long megsTotal = 0;
// @Override
@Override
public void bytesTransferred(CopyStreamEvent event) {
bytesTransferred(event.getTotalBytesTransferred(), even... | java | private static CopyStreamListener createListener() {
return new CopyStreamListener() {
private long megsTotal = 0;
// @Override
@Override
public void bytesTransferred(CopyStreamEvent event) {
bytesTransferred(event.getTotalBytesTransferred(), even... | [
"private",
"static",
"CopyStreamListener",
"createListener",
"(",
")",
"{",
"return",
"new",
"CopyStreamListener",
"(",
")",
"{",
"private",
"long",
"megsTotal",
"=",
"0",
";",
"// @Override",
"@",
"Override",
"public",
"void",
"bytesTransferred",
"(",
"CopyStream... | Creates the listener.
@return the copy stream listener | [
"Creates",
"the",
"listener",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/handler/file/archive/FTPArchiveClient.java#L413-L433 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/util/Log.java | Log.info | public static void info(Object... message) {
StringBuilder builder = new StringBuilder(APP_INFO);
for (Object object : message) {
builder.append(object.toString());
}
infoStream.println(builder.toString());
} | java | public static void info(Object... message) {
StringBuilder builder = new StringBuilder(APP_INFO);
for (Object object : message) {
builder.append(object.toString());
}
infoStream.println(builder.toString());
} | [
"public",
"static",
"void",
"info",
"(",
"Object",
"...",
"message",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"APP_INFO",
")",
";",
"for",
"(",
"Object",
"object",
":",
"message",
")",
"{",
"builder",
".",
"append",
"(",
"o... | Write information in the console.
@param message
the message
@since 2.3.0 | [
"Write",
"information",
"in",
"the",
"console",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/util/Log.java#L78-L84 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/util/Log.java | Log.warn | public static void warn(Object... message) {
StringBuilder builder = new StringBuilder(APP_WARN);
for (Object object : message) {
builder.append(object.toString());
}
warnStream.println(builder.toString());
} | java | public static void warn(Object... message) {
StringBuilder builder = new StringBuilder(APP_WARN);
for (Object object : message) {
builder.append(object.toString());
}
warnStream.println(builder.toString());
} | [
"public",
"static",
"void",
"warn",
"(",
"Object",
"...",
"message",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"APP_WARN",
")",
";",
"for",
"(",
"Object",
"object",
":",
"message",
")",
"{",
"builder",
".",
"append",
"(",
"o... | Write warn messasge on console.
@param message
the message
@since 2.3.0 | [
"Write",
"warn",
"messasge",
"on",
"console",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/util/Log.java#L104-L110 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/util/Log.java | Log.warn | public static void warn(final Object message, final Throwable t) {
warnStream.println(APP_WARN + message.toString());
warnStream.println(stackTraceToString(t));
} | java | public static void warn(final Object message, final Throwable t) {
warnStream.println(APP_WARN + message.toString());
warnStream.println(stackTraceToString(t));
} | [
"public",
"static",
"void",
"warn",
"(",
"final",
"Object",
"message",
",",
"final",
"Throwable",
"t",
")",
"{",
"warnStream",
".",
"println",
"(",
"APP_WARN",
"+",
"message",
".",
"toString",
"(",
")",
")",
";",
"warnStream",
".",
"println",
"(",
"stack... | Write warn message on console with exception.
@param message
the message
@param t
the t | [
"Write",
"warn",
"message",
"on",
"console",
"with",
"exception",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/util/Log.java#L120-L123 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/util/Log.java | Log.error | public static void error(Object... message) {
StringBuilder builder = new StringBuilder(APP_ERROR);
for (Object object : message) {
builder.append(object.toString());
}
errorStream.println(builder.toString());
} | java | public static void error(Object... message) {
StringBuilder builder = new StringBuilder(APP_ERROR);
for (Object object : message) {
builder.append(object.toString());
}
errorStream.println(builder.toString());
} | [
"public",
"static",
"void",
"error",
"(",
"Object",
"...",
"message",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"APP_ERROR",
")",
";",
"for",
"(",
"Object",
"object",
":",
"message",
")",
"{",
"builder",
".",
"append",
"(",
... | Write error message on console.
@param message
the message
@since 2.3.0 | [
"Write",
"error",
"message",
"on",
"console",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/util/Log.java#L143-L149 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/util/Log.java | Log.error | public static void error(final Object message, final Throwable t) {
errorStream.println(APP_ERROR + message.toString());
errorStream.println(stackTraceToString(t));
} | java | public static void error(final Object message, final Throwable t) {
errorStream.println(APP_ERROR + message.toString());
errorStream.println(stackTraceToString(t));
} | [
"public",
"static",
"void",
"error",
"(",
"final",
"Object",
"message",
",",
"final",
"Throwable",
"t",
")",
"{",
"errorStream",
".",
"println",
"(",
"APP_ERROR",
"+",
"message",
".",
"toString",
"(",
")",
")",
";",
"errorStream",
".",
"println",
"(",
"s... | Write error messages on console with exception.
@param message
the message
@param t
the t | [
"Write",
"error",
"messages",
"on",
"console",
"with",
"exception",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/util/Log.java#L159-L162 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/jmx/JMXUtils.java | JMXUtils.getObjectName | static ObjectName getObjectName(String type, String name) {
try {
return new ObjectName(JMXUtils.class.getPackage().getName() + ":type=" + type + ",name=" + name);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | static ObjectName getObjectName(String type, String name) {
try {
return new ObjectName(JMXUtils.class.getPackage().getName() + ":type=" + type + ",name=" + name);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"static",
"ObjectName",
"getObjectName",
"(",
"String",
"type",
",",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"new",
"ObjectName",
"(",
"JMXUtils",
".",
"class",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\":type=\"",
"+",
"typ... | Gets the object name.
@param type the type
@param name the name
@return the object name | [
"Gets",
"the",
"object",
"name",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/jmx/JMXUtils.java#L46-L52 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/Audit4jBanner.java | Audit4jBanner.printBanner | void printBanner() {
PrintStream printStream = System.out;
for (String lineLocal : BANNER) {
printStream.println(lineLocal);
}
printStream.print(line);
String version = Audit4jBanner.class.getPackage().getImplementationVersion();
if (version == null) {
... | java | void printBanner() {
PrintStream printStream = System.out;
for (String lineLocal : BANNER) {
printStream.println(lineLocal);
}
printStream.print(line);
String version = Audit4jBanner.class.getPackage().getImplementationVersion();
if (version == null) {
... | [
"void",
"printBanner",
"(",
")",
"{",
"PrintStream",
"printStream",
"=",
"System",
".",
"out",
";",
"for",
"(",
"String",
"lineLocal",
":",
"BANNER",
")",
"{",
"printStream",
".",
"println",
"(",
"lineLocal",
")",
";",
"}",
"printStream",
".",
"print",
"... | Prints banner using system out. | [
"Prints",
"banner",
"using",
"system",
"out",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/Audit4jBanner.java#L44-L57 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/handler/file/archive/AbstractArchiveJob.java | AbstractArchiveJob.getAvailableFiles | protected File[] getAvailableFiles(final String logFileLocation, final Date maxDate) {
File dir = new File(logFileLocation);
return dir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String fileName) {
boolean extentionMatch = fileNam... | java | protected File[] getAvailableFiles(final String logFileLocation, final Date maxDate) {
File dir = new File(logFileLocation);
return dir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String fileName) {
boolean extentionMatch = fileNam... | [
"protected",
"File",
"[",
"]",
"getAvailableFiles",
"(",
"final",
"String",
"logFileLocation",
",",
"final",
"Date",
"maxDate",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"logFileLocation",
")",
";",
"return",
"dir",
".",
"listFiles",
"(",
"new",
"F... | Gets the available files.
@param logFileLocation the log file location
@param maxDate the max date
@return the available files | [
"Gets",
"the",
"available",
"files",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/handler/file/archive/AbstractArchiveJob.java#L66-L79 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/handler/file/archive/AbstractArchiveJob.java | AbstractArchiveJob.fileCreatedDate | private Date fileCreatedDate(String fileName) {
String[] splittedWithoutExtention = fileName.split(".");
String fileNameWithoutExtention = splittedWithoutExtention[0];
String[] splittedWithoutPrefix = fileNameWithoutExtention.split("-");
String fileNameDateInStr = splittedWithoutPrefix[1... | java | private Date fileCreatedDate(String fileName) {
String[] splittedWithoutExtention = fileName.split(".");
String fileNameWithoutExtention = splittedWithoutExtention[0];
String[] splittedWithoutPrefix = fileNameWithoutExtention.split("-");
String fileNameDateInStr = splittedWithoutPrefix[1... | [
"private",
"Date",
"fileCreatedDate",
"(",
"String",
"fileName",
")",
"{",
"String",
"[",
"]",
"splittedWithoutExtention",
"=",
"fileName",
".",
"split",
"(",
"\".\"",
")",
";",
"String",
"fileNameWithoutExtention",
"=",
"splittedWithoutExtention",
"[",
"0",
"]",
... | File created date.
@param fileName the file name
@return the date | [
"File",
"created",
"date",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/handler/file/archive/AbstractArchiveJob.java#L87-L97 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/Configurations.java | Configurations.resolveConfigFileAsStream | static ConfigurationStream resolveConfigFileAsStream(String configFilePath) throws ConfigurationException {
InputStream fileStream;
String fileExtention;
if (configFilePath != null) {
if (new File(configFilePath).isDirectory()) {
String path = scanConfigFile(... | java | static ConfigurationStream resolveConfigFileAsStream(String configFilePath) throws ConfigurationException {
InputStream fileStream;
String fileExtention;
if (configFilePath != null) {
if (new File(configFilePath).isDirectory()) {
String path = scanConfigFile(... | [
"static",
"ConfigurationStream",
"resolveConfigFileAsStream",
"(",
"String",
"configFilePath",
")",
"throws",
"ConfigurationException",
"{",
"InputStream",
"fileStream",
";",
"String",
"fileExtention",
";",
"if",
"(",
"configFilePath",
"!=",
"null",
")",
"{",
"if",
"(... | Resolve config path.
@param configFilePath the config file path
@return the path
@throws ConfigurationException the configuration exception | [
"Resolve",
"config",
"path",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/Configurations.java#L93-L132 | train |
audit4j/audit4j-core | src/main/java/org/audit4j/core/Configurations.java | Configurations.scanConfigFile | static String scanConfigFile(String dirPath) throws ConfigurationException {
String filePath = dirPath + File.separator + CONFIG_FILE_NAME + ".";
String fullFilePath;
// Scan for Yaml file
if (AuditUtil.isFileExists(filePath + YML_EXTENTION)) {
fullFilePath = filePath + YML... | java | static String scanConfigFile(String dirPath) throws ConfigurationException {
String filePath = dirPath + File.separator + CONFIG_FILE_NAME + ".";
String fullFilePath;
// Scan for Yaml file
if (AuditUtil.isFileExists(filePath + YML_EXTENTION)) {
fullFilePath = filePath + YML... | [
"static",
"String",
"scanConfigFile",
"(",
"String",
"dirPath",
")",
"throws",
"ConfigurationException",
"{",
"String",
"filePath",
"=",
"dirPath",
"+",
"File",
".",
"separator",
"+",
"CONFIG_FILE_NAME",
"+",
"\".\"",
";",
"String",
"fullFilePath",
";",
"// Scan f... | Scan config file.
@param dirPath the dir path
@return the string
@throws ConfigurationException the configuration exception | [
"Scan",
"config",
"file",
"."
] | dc8569108851e64cb0ecc7a39048db0ad070fba2 | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/Configurations.java#L141-L160 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.