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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/core/Config.java | Config.parse | private void parse(String propKey, String propValue) {
if (ARG_TAG.equals(propValue)) {
String value = System.getProperty(propKey);
if (StringUtils.isNotBlank(value) && value.startsWith(CRYPTEX_TAG)) {
value = decrypt(value);
}
if (StringUtils.is... | java | private void parse(String propKey, String propValue) {
if (ARG_TAG.equals(propValue)) {
String value = System.getProperty(propKey);
if (StringUtils.isNotBlank(value) && value.startsWith(CRYPTEX_TAG)) {
value = decrypt(value);
}
if (StringUtils.is... | [
"private",
"void",
"parse",
"(",
"String",
"propKey",
",",
"String",
"propValue",
")",
"{",
"if",
"(",
"ARG_TAG",
".",
"equals",
"(",
"propValue",
")",
")",
"{",
"String",
"value",
"=",
"System",
".",
"getProperty",
"(",
"propKey",
")",
";",
"if",
"(",... | Parses a given property key and value and checks if the value comes from
a system property and maybe decrypts the value
@param propKey The property key
@param propValue The property value | [
"Parses",
"a",
"given",
"property",
"key",
"and",
"value",
"and",
"checks",
"if",
"the",
"value",
"comes",
"from",
"a",
"system",
"property",
"and",
"maybe",
"decrypts",
"the",
"value"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Config.java#L86-L102 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/core/Config.java | Config.decrypt | private String decrypt(String value) {
Crypto crypto = new Crypto(this);
String keyFile = System.getProperty(Key.APPLICATION_PRIVATEKEY.toString());
if (StringUtils.isNotBlank(keyFile)) {
try (Stream<String> lines = Files.lines(Paths.get(keyFile))) { //NOSONAR KeyFile can in... | java | private String decrypt(String value) {
Crypto crypto = new Crypto(this);
String keyFile = System.getProperty(Key.APPLICATION_PRIVATEKEY.toString());
if (StringUtils.isNotBlank(keyFile)) {
try (Stream<String> lines = Files.lines(Paths.get(keyFile))) { //NOSONAR KeyFile can in... | [
"private",
"String",
"decrypt",
"(",
"String",
"value",
")",
"{",
"Crypto",
"crypto",
"=",
"new",
"Crypto",
"(",
"this",
")",
";",
"String",
"keyFile",
"=",
"System",
".",
"getProperty",
"(",
"Key",
".",
"APPLICATION_PRIVATEKEY",
".",
"toString",
"(",
")",... | Decrypts a given property key and rewrites it to props
@param propKey The property key
@param propValue The property value | [
"Decrypts",
"a",
"given",
"property",
"key",
"and",
"rewrites",
"it",
"to",
"props"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Config.java#L110-L138 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/core/Server.java | Server.header | public static void header(Header header, String value) {
Objects.requireNonNull(header, Required.HEADER.toString());
Map<Header, String> newHeaders = new EnumMap<>(headers);
newHeaders.put(header, value);
headers = newHeaders;
} | java | public static void header(Header header, String value) {
Objects.requireNonNull(header, Required.HEADER.toString());
Map<Header, String> newHeaders = new EnumMap<>(headers);
newHeaders.put(header, value);
headers = newHeaders;
} | [
"public",
"static",
"void",
"header",
"(",
"Header",
"header",
",",
"String",
"value",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"header",
",",
"Required",
".",
"HEADER",
".",
"toString",
"(",
")",
")",
";",
"Map",
"<",
"Header",
",",
"String",
... | Sets a custom header that is used globally on server responses
@param header The name of the header
@param value The value of the header | [
"Sets",
"a",
"custom",
"header",
"that",
"is",
"used",
"globally",
"on",
"server",
"responses"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Server.java#L40-L46 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/email/Mail.java | Mail.withBuilder | public Mail withBuilder(Email email) {
Objects.requireNonNull(email, Required.EMAIL.toString());
this.email = email;
return this;
} | java | public Mail withBuilder(Email email) {
Objects.requireNonNull(email, Required.EMAIL.toString());
this.email = email;
return this;
} | [
"public",
"Mail",
"withBuilder",
"(",
"Email",
"email",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"email",
",",
"Required",
".",
"EMAIL",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"email",
"=",
"email",
";",
"return",
"this",
";",
"}"
] | Sets the org.Jodd.Email instance that the email is based on
@param email The Email instance
@return A mail object instance | [
"Sets",
"the",
"org",
".",
"Jodd",
".",
"Email",
"instance",
"that",
"the",
"email",
"is",
"based",
"on"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/email/Mail.java#L38-L43 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/email/Mail.java | Mail.templateMessage | public Mail templateMessage(String template, Map<String, Object> content) throws MangooTemplateEngineException {
Objects.requireNonNull(template, Required.TEMPLATE.toString());
Objects.requireNonNull(content, Required.CONTENT.toString());
if (template.charAt(0) == '/' || template.startsWith("\\... | java | public Mail templateMessage(String template, Map<String, Object> content) throws MangooTemplateEngineException {
Objects.requireNonNull(template, Required.TEMPLATE.toString());
Objects.requireNonNull(content, Required.CONTENT.toString());
if (template.charAt(0) == '/' || template.startsWith("\\... | [
"public",
"Mail",
"templateMessage",
"(",
"String",
"template",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"content",
")",
"throws",
"MangooTemplateEngineException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"template",
",",
"Required",
".",
"TEMPLATE",
".... | Sets a template to be rendered for the email. Using a template
will make it a HTML Email by default.
@param template The template to use
@param content The content for the template
@return A mail object instance
@throws MangooTemplateEngineException if rendering of template fails | [
"Sets",
"a",
"template",
"to",
"be",
"rendered",
"for",
"the",
"email",
".",
"Using",
"a",
"template",
"will",
"make",
"it",
"a",
"HTML",
"Email",
"by",
"default",
"."
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/email/Mail.java#L54-L67 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/DateUtils.java | DateUtils.localDateTimeToDate | public static Date localDateTimeToDate(LocalDateTime localDateTime) {
Objects.requireNonNull(localDateTime, Required.LOCAL_DATE_TIME.toString());
Instant instant = localDateTime.atZone(ZoneId.systemDefault()).toInstant();
return Date.from(instant);
} | java | public static Date localDateTimeToDate(LocalDateTime localDateTime) {
Objects.requireNonNull(localDateTime, Required.LOCAL_DATE_TIME.toString());
Instant instant = localDateTime.atZone(ZoneId.systemDefault()).toInstant();
return Date.from(instant);
} | [
"public",
"static",
"Date",
"localDateTimeToDate",
"(",
"LocalDateTime",
"localDateTime",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"localDateTime",
",",
"Required",
".",
"LOCAL_DATE_TIME",
".",
"toString",
"(",
")",
")",
";",
"Instant",
"instant",
"=",
"... | Converts a LocalDateTime to Date
@param localDateTime The LocalDateTime to convert
@return The converted Date | [
"Converts",
"a",
"LocalDateTime",
"to",
"Date"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/DateUtils.java#L31-L36 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/DateUtils.java | DateUtils.localDateToDate | public static Date localDateToDate(LocalDate localDate) {
Objects.requireNonNull(localDate, Required.LOCAL_DATE.toString());
Instant instant = localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant();
return Date.from(instant);
} | java | public static Date localDateToDate(LocalDate localDate) {
Objects.requireNonNull(localDate, Required.LOCAL_DATE.toString());
Instant instant = localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant();
return Date.from(instant);
} | [
"public",
"static",
"Date",
"localDateToDate",
"(",
"LocalDate",
"localDate",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"localDate",
",",
"Required",
".",
"LOCAL_DATE",
".",
"toString",
"(",
")",
")",
";",
"Instant",
"instant",
"=",
"localDate",
".",
... | Converts a localDate to Date
@param localDate The LocalDate to convert
@return The converted Date | [
"Converts",
"a",
"localDate",
"to",
"Date"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/DateUtils.java#L44-L49 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java | RequestHandler.getRequest | protected Request getRequest(HttpServerExchange exchange) {
final String authenticity = Optional.ofNullable(this.attachment.getRequestParameter()
.get(Default.AUTHENTICITY.toString()))
.orElse(this.attachment.getForm().get(Default.AUTHENTICITY.toString()));
retur... | java | protected Request getRequest(HttpServerExchange exchange) {
final String authenticity = Optional.ofNullable(this.attachment.getRequestParameter()
.get(Default.AUTHENTICITY.toString()))
.orElse(this.attachment.getForm().get(Default.AUTHENTICITY.toString()));
retur... | [
"protected",
"Request",
"getRequest",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"final",
"String",
"authenticity",
"=",
"Optional",
".",
"ofNullable",
"(",
"this",
".",
"attachment",
".",
"getRequestParameter",
"(",
")",
".",
"get",
"(",
"Default",
".",
... | Creates a new request object containing the current request data
@param exchange The Undertow HttpServerExchange | [
"Creates",
"a",
"new",
"request",
"object",
"containing",
"the",
"current",
"request",
"data"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java#L68-L79 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java | RequestHandler.invokeController | protected Response invokeController(HttpServerExchange exchange, Response response) throws IllegalAccessException, InvocationTargetException, MangooTemplateEngineException, IOException {
Response invokedResponse;
if (this.attachment.getMethodParameters().isEmpty()) {
invokedResponse = (Resp... | java | protected Response invokeController(HttpServerExchange exchange, Response response) throws IllegalAccessException, InvocationTargetException, MangooTemplateEngineException, IOException {
Response invokedResponse;
if (this.attachment.getMethodParameters().isEmpty()) {
invokedResponse = (Resp... | [
"protected",
"Response",
"invokeController",
"(",
"HttpServerExchange",
"exchange",
",",
"Response",
"response",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"MangooTemplateEngineException",
",",
"IOException",
"{",
"Response",
"invokedRespo... | Invokes the controller methods and retrieves the response which
is later send to the client
@param exchange The Undertow HttpServerExchange
@return A response object
@throws IllegalAccessException
@throws InvocationTargetException
@throws IOException
@throws TemplateException
@throws MangooTemplateEngineException | [
"Invokes",
"the",
"controller",
"methods",
"and",
"retrieves",
"the",
"response",
"which",
"is",
"later",
"send",
"to",
"the",
"client"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java#L135-L179 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java | RequestHandler.getTemplatePath | protected String getTemplatePath(Response response) {
return StringUtils.isBlank(response.getTemplate()) ? (this.attachment.getControllerClassName() + "/" + this.attachment.getTemplateEngine().getTemplateName(this.attachment.getControllerMethodName())) : response.getTemplate();
} | java | protected String getTemplatePath(Response response) {
return StringUtils.isBlank(response.getTemplate()) ? (this.attachment.getControllerClassName() + "/" + this.attachment.getTemplateEngine().getTemplateName(this.attachment.getControllerMethodName())) : response.getTemplate();
} | [
"protected",
"String",
"getTemplatePath",
"(",
"Response",
"response",
")",
"{",
"return",
"StringUtils",
".",
"isBlank",
"(",
"response",
".",
"getTemplate",
"(",
")",
")",
"?",
"(",
"this",
".",
"attachment",
".",
"getControllerClassName",
"(",
")",
"+",
"... | Returns the complete path to the template based on the
controller and method name
@param response The current response
@return A case-sensitive template path, e.g. /ApplicationController/index.ftl | [
"Returns",
"the",
"complete",
"path",
"to",
"the",
"template",
"based",
"on",
"the",
"controller",
"and",
"method",
"name"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java#L189-L191 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java | RequestHandler.executeFilter | protected Response executeFilter(List<Annotation> annotations, Response response) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
for (final Annotation annotation : annotations) {
final FilterWith filterWith = (FilterWith) annotation;
for (final Class<?>... | java | protected Response executeFilter(List<Annotation> annotations, Response response) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
for (final Annotation annotation : annotations) {
final FilterWith filterWith = (FilterWith) annotation;
for (final Class<?>... | [
"protected",
"Response",
"executeFilter",
"(",
"List",
"<",
"Annotation",
">",
"annotations",
",",
"Response",
"response",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"for",
"(",
"final",
"Annotation",
... | Executes all filters on controller and method level
@param annotations An array of @FilterWith annotated classes and methods
@param response
@return True if the request should continue after filter execution, false otherwise
@throws NoSuchMethodException
@throws IllegalAccessException
@throws InvocationTargetExceptio... | [
"Executes",
"all",
"filters",
"on",
"controller",
"and",
"method",
"level"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java#L291-L305 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java | RequestHandler.getRequestBody | protected String getRequestBody(HttpServerExchange exchange) throws IOException {
String body = "";
if (RequestUtils.isPostPutPatch(exchange)) {
exchange.startBlocking();
body = IOUtils.toString(exchange.getInputStream(), Default.ENCODING.toString());
}
return bo... | java | protected String getRequestBody(HttpServerExchange exchange) throws IOException {
String body = "";
if (RequestUtils.isPostPutPatch(exchange)) {
exchange.startBlocking();
body = IOUtils.toString(exchange.getInputStream(), Default.ENCODING.toString());
}
return bo... | [
"protected",
"String",
"getRequestBody",
"(",
"HttpServerExchange",
"exchange",
")",
"throws",
"IOException",
"{",
"String",
"body",
"=",
"\"\"",
";",
"if",
"(",
"RequestUtils",
".",
"isPostPutPatch",
"(",
"exchange",
")",
")",
"{",
"exchange",
".",
"startBlocki... | Retrieves the complete request body from the request
@param exchange The Undertow HttpServerExchange
@return A body object containing the request body
@throws IOException | [
"Retrieves",
"the",
"complete",
"request",
"body",
"from",
"the",
"request"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java#L315-L323 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java | Scheduler.isStarted | public boolean isStarted() throws MangooSchedulerException {
boolean started;
try {
started = this.quartzScheduler != null && this.quartzScheduler.isStarted();
} catch (SchedulerException e) {
throw new MangooSchedulerException(e);
}
return starte... | java | public boolean isStarted() throws MangooSchedulerException {
boolean started;
try {
started = this.quartzScheduler != null && this.quartzScheduler.isStarted();
} catch (SchedulerException e) {
throw new MangooSchedulerException(e);
}
return starte... | [
"public",
"boolean",
"isStarted",
"(",
")",
"throws",
"MangooSchedulerException",
"{",
"boolean",
"started",
";",
"try",
"{",
"started",
"=",
"this",
".",
"quartzScheduler",
"!=",
"null",
"&&",
"this",
".",
"quartzScheduler",
".",
"isStarted",
"(",
")",
";",
... | Checks if the scheduler is initialized and started
@return true if the scheduler is started, false otherwise
@throws MangooSchedulerException if an error occurred accessing the scheduler | [
"Checks",
"if",
"the",
"scheduler",
"is",
"initialized",
"and",
"started"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java#L75-L84 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java | Scheduler.schedule | public void schedule(JobDetail jobDetail, Trigger trigger) throws MangooSchedulerException {
Objects.requireNonNull(jobDetail, Required.JOB_DETAIL.toString());
Objects.requireNonNull(trigger, Required.TRIGGER.toString());
Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString()... | java | public void schedule(JobDetail jobDetail, Trigger trigger) throws MangooSchedulerException {
Objects.requireNonNull(jobDetail, Required.JOB_DETAIL.toString());
Objects.requireNonNull(trigger, Required.TRIGGER.toString());
Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString()... | [
"public",
"void",
"schedule",
"(",
"JobDetail",
"jobDetail",
",",
"Trigger",
"trigger",
")",
"throws",
"MangooSchedulerException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"jobDetail",
",",
"Required",
".",
"JOB_DETAIL",
".",
"toString",
"(",
")",
")",
";",
... | Adds a new job with a given JobDetail and Trigger to the scheduler
@param jobDetail The JobDetail for the Job
@param trigger The Trigger for the job
@throws MangooSchedulerException when accessing the scheduler results in an error | [
"Adds",
"a",
"new",
"job",
"with",
"a",
"given",
"JobDetail",
"and",
"Trigger",
"to",
"the",
"scheduler"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java#L149-L159 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java | Scheduler.getAllJobs | @SuppressWarnings("unchecked")
public List<io.mangoo.models.Job> getAllJobs() throws MangooSchedulerException {
Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());
List<io.mangoo.models.Job> jobs = new ArrayList<>();
try {
for (JobKey jobKey : ge... | java | @SuppressWarnings("unchecked")
public List<io.mangoo.models.Job> getAllJobs() throws MangooSchedulerException {
Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());
List<io.mangoo.models.Job> jobs = new ArrayList<>();
try {
for (JobKey jobKey : ge... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"List",
"<",
"io",
".",
"mangoo",
".",
"models",
".",
"Job",
">",
"getAllJobs",
"(",
")",
"throws",
"MangooSchedulerException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"this",
".",
"quartzSchedu... | Retrieves a list of all jobs and their current status
@return List of io.mangoo.models.Job objects
@throws MangooSchedulerException if an error occurs during access to the Quartz Scheduler | [
"Retrieves",
"a",
"list",
"of",
"all",
"jobs",
"and",
"their",
"current",
"status"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java#L167-L185 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java | Scheduler.getJobKey | public JobKey getJobKey(String name) throws MangooSchedulerException {
Objects.requireNonNull(name, Required.NAME.toString());
return getAllJobKeys().stream()
.filter(jobKey -> jobKey.getName().equalsIgnoreCase(name))
.findFirst()
.orElse(null);
... | java | public JobKey getJobKey(String name) throws MangooSchedulerException {
Objects.requireNonNull(name, Required.NAME.toString());
return getAllJobKeys().stream()
.filter(jobKey -> jobKey.getName().equalsIgnoreCase(name))
.findFirst()
.orElse(null);
... | [
"public",
"JobKey",
"getJobKey",
"(",
"String",
"name",
")",
"throws",
"MangooSchedulerException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"name",
",",
"Required",
".",
"NAME",
".",
"toString",
"(",
")",
")",
";",
"return",
"getAllJobKeys",
"(",
")",
"."... | Retrieves a JobKey by it given name
@param name The name of the Job in the Scheduler
@return Optional of JobKey
@throws MangooSchedulerException if retrieving the job fails | [
"Retrieves",
"a",
"JobKey",
"by",
"it",
"given",
"name"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java#L246-L253 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java | Scheduler.executeJob | public void executeJob(String jobName) throws MangooSchedulerException {
Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());
Objects.requireNonNull(jobName, Required.JOB_NAME.toString());
try {
for (JobKey jobKey : getAllJobKeys()) {
... | java | public void executeJob(String jobName) throws MangooSchedulerException {
Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());
Objects.requireNonNull(jobName, Required.JOB_NAME.toString());
try {
for (JobKey jobKey : getAllJobKeys()) {
... | [
"public",
"void",
"executeJob",
"(",
"String",
"jobName",
")",
"throws",
"MangooSchedulerException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"this",
".",
"quartzScheduler",
",",
"Required",
".",
"SCHEDULER",
".",
"toString",
"(",
")",
")",
";",
"Objects",
... | Executes a single Quartz Scheduler job right away only once
@param jobName The name of the job to execute
@throws MangooSchedulerException if an error occurs during execution of the job | [
"Executes",
"a",
"single",
"Quartz",
"Scheduler",
"job",
"right",
"away",
"only",
"once"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java#L261-L274 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java | Scheduler.getAllJobKeys | public List<JobKey> getAllJobKeys() throws MangooSchedulerException {
Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());
List<JobKey> jobKeys = new ArrayList<>();
try {
for (String groupName : this.quartzScheduler.getJobGroupNames()) {
... | java | public List<JobKey> getAllJobKeys() throws MangooSchedulerException {
Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());
List<JobKey> jobKeys = new ArrayList<>();
try {
for (String groupName : this.quartzScheduler.getJobGroupNames()) {
... | [
"public",
"List",
"<",
"JobKey",
">",
"getAllJobKeys",
"(",
")",
"throws",
"MangooSchedulerException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"this",
".",
"quartzScheduler",
",",
"Required",
".",
"SCHEDULER",
".",
"toString",
"(",
")",
")",
";",
"List",
... | Retrieves a list of all JobKeys from the Quartz Scheduler
@return List of all JobKey objects
@throws MangooSchedulerException if an errors occurs during access to the scheduler | [
"Retrieves",
"a",
"list",
"of",
"all",
"JobKeys",
"from",
"the",
"Quartz",
"Scheduler"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java#L282-L295 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java | Scheduler.changeState | public void changeState(String jobName) throws MangooSchedulerException {
Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());
try {
for (JobKey jobKey : getAllJobKeys()) {
if (jobKey.getName().equalsIgnoreCase(jobName)) {
... | java | public void changeState(String jobName) throws MangooSchedulerException {
Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());
try {
for (JobKey jobKey : getAllJobKeys()) {
if (jobKey.getName().equalsIgnoreCase(jobName)) {
... | [
"public",
"void",
"changeState",
"(",
"String",
"jobName",
")",
"throws",
"MangooSchedulerException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"this",
".",
"quartzScheduler",
",",
"Required",
".",
"SCHEDULER",
".",
"toString",
"(",
")",
")",
";",
"try",
"{"... | Changes the state of a normally running job from pause to resume or resume to pause
@param jobName The name of the job
@throws MangooSchedulerException if an error occurs during access to the quartz scheduler | [
"Changes",
"the",
"state",
"of",
"a",
"normally",
"running",
"job",
"from",
"pause",
"to",
"resume",
"or",
"resume",
"to",
"pause"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java#L303-L320 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/AuthenticationHandler.java | AuthenticationHandler.endRequest | private void endRequest(HttpServerExchange exchange, String redirect) {
exchange.setStatusCode(StatusCodes.FOUND);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResp... | java | private void endRequest(HttpServerExchange exchange, String redirect) {
exchange.setStatusCode(StatusCodes.FOUND);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResp... | [
"private",
"void",
"endRequest",
"(",
"HttpServerExchange",
"exchange",
",",
"String",
"redirect",
")",
"{",
"exchange",
".",
"setStatusCode",
"(",
"StatusCodes",
".",
"FOUND",
")",
";",
"Server",
".",
"headers",
"(",
")",
".",
"entrySet",
"(",
")",
".",
"... | Ends the current request by sending a HTTP 302 status code and a direct to the given URL
@param exchange The HttpServerExchange | [
"Ends",
"the",
"current",
"request",
"by",
"sending",
"a",
"HTTP",
"302",
"status",
"code",
"and",
"a",
"direct",
"to",
"the",
"given",
"URL"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/AuthenticationHandler.java#L62-L73 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/AuthenticationHandler.java | AuthenticationHandler.endRequest | private void endRequest(HttpServerExchange exchange) {
exchange.setStatusCode(StatusCodes.FORBIDDEN);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResponseHeaders()... | java | private void endRequest(HttpServerExchange exchange) {
exchange.setStatusCode(StatusCodes.FORBIDDEN);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResponseHeaders()... | [
"private",
"void",
"endRequest",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"exchange",
".",
"setStatusCode",
"(",
"StatusCodes",
".",
"FORBIDDEN",
")",
";",
"Server",
".",
"headers",
"(",
")",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",... | Ends the current request by sending a HTTP 403 status code and the default forbidden template
@param exchange The HttpServerExchange | [
"Ends",
"the",
"current",
"request",
"by",
"sending",
"a",
"HTTP",
"403",
"status",
"code",
"and",
"the",
"default",
"forbidden",
"template"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/AuthenticationHandler.java#L79-L89 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java | RequestUtils.getRequestParameters | public static Map<String, String> getRequestParameters(HttpServerExchange exchange) {
Objects.requireNonNull(exchange, Required.HTTP_SERVER_EXCHANGE.toString());
final Map<String, String> requestParamater = new HashMap<>();
final Map<String, Deque<String>> queryParameters = exchange.getQueryPar... | java | public static Map<String, String> getRequestParameters(HttpServerExchange exchange) {
Objects.requireNonNull(exchange, Required.HTTP_SERVER_EXCHANGE.toString());
final Map<String, String> requestParamater = new HashMap<>();
final Map<String, Deque<String>> queryParameters = exchange.getQueryPar... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getRequestParameters",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"exchange",
",",
"Required",
".",
"HTTP_SERVER_EXCHANGE",
".",
"toString",
"(",
")",
")"... | Converts request and query parameter into a single map
@param exchange The Undertow HttpServerExchange
@return A single map contain both request and query parameter | [
"Converts",
"request",
"and",
"query",
"parameter",
"into",
"a",
"single",
"map"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java#L78-L87 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java | RequestUtils.isPostPutPatch | public static boolean isPostPutPatch(HttpServerExchange exchange) {
Objects.requireNonNull(exchange, Required.HTTP_SERVER_EXCHANGE.toString());
return (Methods.POST).equals(exchange.getRequestMethod()) || (Methods.PUT).equals(exchange.getRequestMethod()) || (Methods.PATCH).equals(exchange.getRequestMet... | java | public static boolean isPostPutPatch(HttpServerExchange exchange) {
Objects.requireNonNull(exchange, Required.HTTP_SERVER_EXCHANGE.toString());
return (Methods.POST).equals(exchange.getRequestMethod()) || (Methods.PUT).equals(exchange.getRequestMethod()) || (Methods.PATCH).equals(exchange.getRequestMet... | [
"public",
"static",
"boolean",
"isPostPutPatch",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"exchange",
",",
"Required",
".",
"HTTP_SERVER_EXCHANGE",
".",
"toString",
"(",
")",
")",
";",
"return",
"(",
"Methods",
".",... | Checks if the request is a POST, PUT or PATCH request
@param exchange The Undertow HttpServerExchange
@return True if the request is a POST, PUT or PATCH request, false otherwise | [
"Checks",
"if",
"the",
"request",
"is",
"a",
"POST",
"PUT",
"or",
"PATCH",
"request"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java#L95-L99 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java | RequestUtils.hasValidAuthentication | public static boolean hasValidAuthentication(String cookie) {
boolean valid = false;
if (StringUtils.isNotBlank(cookie)) {
Config config = Application.getInstance(Config.class);
String value = null;
String [] contents = cookie.split(";");
for (String cont... | java | public static boolean hasValidAuthentication(String cookie) {
boolean valid = false;
if (StringUtils.isNotBlank(cookie)) {
Config config = Application.getInstance(Config.class);
String value = null;
String [] contents = cookie.split(";");
for (String cont... | [
"public",
"static",
"boolean",
"hasValidAuthentication",
"(",
"String",
"cookie",
")",
"{",
"boolean",
"valid",
"=",
"false",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"cookie",
")",
")",
"{",
"Config",
"config",
"=",
"Application",
".",
"getIns... | Checks if the given header contains a valid authentication
@param cookie The cookie to parse
@return True if the cookie contains a valid authentication, false otherwise | [
"Checks",
"if",
"the",
"given",
"header",
"contains",
"a",
"valid",
"authentication"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java#L121-L154 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java | RequestUtils.wrapBasicAuthentication | public static HttpHandler wrapBasicAuthentication(HttpHandler httpHandler, String username, String password) {
Objects.requireNonNull(httpHandler, Required.HTTP_HANDLER.toString());
Objects.requireNonNull(username, Required.USERNAME.toString());
Objects.requireNonNull(password, Required.PASSWORD... | java | public static HttpHandler wrapBasicAuthentication(HttpHandler httpHandler, String username, String password) {
Objects.requireNonNull(httpHandler, Required.HTTP_HANDLER.toString());
Objects.requireNonNull(username, Required.USERNAME.toString());
Objects.requireNonNull(password, Required.PASSWORD... | [
"public",
"static",
"HttpHandler",
"wrapBasicAuthentication",
"(",
"HttpHandler",
"httpHandler",
",",
"String",
"username",
",",
"String",
"password",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"httpHandler",
",",
"Required",
".",
"HTTP_HANDLER",
".",
"toStrin... | Adds a Wrapper to the handler when the request requires authentication
@param httpHandler The Handler to wrap
@param username The username to use
@param password The password to use
@return An HttpHandler wrapped through BasicAuthentication | [
"Adds",
"a",
"Wrapper",
"to",
"the",
"handler",
"when",
"the",
"request",
"requires",
"authentication"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java#L211-L221 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java | RequestUtils.getOperation | public static String getOperation(HttpString method) {
String operation = "";
if (Methods.POST.equals(method)) {
operation = WRITE;
} else if (Methods.PUT.equals(method)) {
operation = WRITE;
} else if (Methods.DELETE.equals(method)) {
operati... | java | public static String getOperation(HttpString method) {
String operation = "";
if (Methods.POST.equals(method)) {
operation = WRITE;
} else if (Methods.PUT.equals(method)) {
operation = WRITE;
} else if (Methods.DELETE.equals(method)) {
operati... | [
"public",
"static",
"String",
"getOperation",
"(",
"HttpString",
"method",
")",
"{",
"String",
"operation",
"=",
"\"\"",
";",
"if",
"(",
"Methods",
".",
"POST",
".",
"equals",
"(",
"method",
")",
")",
"{",
"operation",
"=",
"WRITE",
";",
"}",
"else",
"... | Return if a given HTTP method results in a read or write request to a resource
GET = read
POST = write
PUT = write
DELETE = write
PATCH = write
OPTIONS = read
HEAD = read
@param method The HTTP method
@return read or write if HTTP method is found, blank otherwise | [
"Return",
"if",
"a",
"given",
"HTTP",
"method",
"results",
"in",
"a",
"read",
"or",
"write",
"request",
"to",
"a",
"resource"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java#L237-L259 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.decrypt | public String decrypt(String encrytedText, String key) {
Objects.requireNonNull(encrytedText, Required.ENCRYPTED_TEXT.toString());
Objects.requireNonNull(key, Required.KEY.toString());
CipherParameters cipherParameters = new ParametersWithRandom(new KeyParameter(getSizedSecret(key).getBytes(Sta... | java | public String decrypt(String encrytedText, String key) {
Objects.requireNonNull(encrytedText, Required.ENCRYPTED_TEXT.toString());
Objects.requireNonNull(key, Required.KEY.toString());
CipherParameters cipherParameters = new ParametersWithRandom(new KeyParameter(getSizedSecret(key).getBytes(Sta... | [
"public",
"String",
"decrypt",
"(",
"String",
"encrytedText",
",",
"String",
"key",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"encrytedText",
",",
"Required",
".",
"ENCRYPTED_TEXT",
".",
"toString",
"(",
")",
")",
";",
"Objects",
".",
"requireNonNull",
... | Decrypts an given encrypted text using the given key
@param encrytedText The encrypted text
@param key The encryption key
@return The clear text or null if decryption fails | [
"Decrypts",
"an",
"given",
"encrypted",
"text",
"using",
"the",
"given",
"key"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L84-L92 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.encrypt | public String encrypt(final String plainText, final String key) {
Objects.requireNonNull(plainText, Required.PLAIN_TEXT.toString());
Objects.requireNonNull(key, Required.KEY.toString());
CipherParameters cipherParameters = new ParametersWithRandom(new KeyParameter(getSizedSecret(key).getBytes(S... | java | public String encrypt(final String plainText, final String key) {
Objects.requireNonNull(plainText, Required.PLAIN_TEXT.toString());
Objects.requireNonNull(key, Required.KEY.toString());
CipherParameters cipherParameters = new ParametersWithRandom(new KeyParameter(getSizedSecret(key).getBytes(S... | [
"public",
"String",
"encrypt",
"(",
"final",
"String",
"plainText",
",",
"final",
"String",
"key",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"plainText",
",",
"Required",
".",
"PLAIN_TEXT",
".",
"toString",
"(",
")",
")",
";",
"Objects",
".",
"requi... | Encrypts a given plain text using the given key
Encryption is done by using AES and CBC Cipher and a key length of 256 bit
@param plainText The plain text to encrypt
@param key The key to use for encryption
@return The encrypted text or null if encryption fails | [
"Encrypts",
"a",
"given",
"plain",
"text",
"using",
"the",
"given",
"key"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L117-L125 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.cipherData | private byte[] cipherData(final byte[] data) {
byte[] result = null;
try {
final byte[] buffer = new byte[this.paddedBufferedBlockCipher.getOutputSize(data.length)];
final int processedBytes = this.paddedBufferedBlockCipher.processBytes(data, 0, data.length, buffer, 0);
... | java | private byte[] cipherData(final byte[] data) {
byte[] result = null;
try {
final byte[] buffer = new byte[this.paddedBufferedBlockCipher.getOutputSize(data.length)];
final int processedBytes = this.paddedBufferedBlockCipher.processBytes(data, 0, data.length, buffer, 0);
... | [
"private",
"byte",
"[",
"]",
"cipherData",
"(",
"final",
"byte",
"[",
"]",
"data",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"null",
";",
"try",
"{",
"final",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"this",
".",
"paddedBufferedBlockCiph... | Encrypts or decrypts a given byte array of data
@param data The data to encrypt or decrypt
@return A clear text or encrypted byte array | [
"Encrypts",
"or",
"decrypts",
"a",
"given",
"byte",
"array",
"of",
"data"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L133-L148 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.generateKeyPair | public KeyPair generateKeyPair() {
KeyPair keyPair = null;
try {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(ALGORITHM);
keyPairGenerator.initialize(KEYLENGTH);
keyPair = keyPairGenerator.generateKeyPair();
} catch (NoSuchAlgorithmExceptio... | java | public KeyPair generateKeyPair() {
KeyPair keyPair = null;
try {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(ALGORITHM);
keyPairGenerator.initialize(KEYLENGTH);
keyPair = keyPairGenerator.generateKeyPair();
} catch (NoSuchAlgorithmExceptio... | [
"public",
"KeyPair",
"generateKeyPair",
"(",
")",
"{",
"KeyPair",
"keyPair",
"=",
"null",
";",
"try",
"{",
"KeyPairGenerator",
"keyPairGenerator",
"=",
"KeyPairGenerator",
".",
"getInstance",
"(",
"ALGORITHM",
")",
";",
"keyPairGenerator",
".",
"initialize",
"(",
... | Generate key which contains a pair of private and public key using 4096 bytes
@return key pair | [
"Generate",
"key",
"which",
"contains",
"a",
"pair",
"of",
"private",
"and",
"public",
"key",
"using",
"4096",
"bytes"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L162-L173 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.encrypt | public byte[] encrypt(byte[] text, PublicKey key) throws MangooEncryptionException {
Objects.requireNonNull(text, Required.PLAIN_TEXT.toString());
Objects.requireNonNull(text, Required.PUBLIC_KEY.toString());
byte[] encrypt = null;
try {
Cipher cipher = Cipher.getIns... | java | public byte[] encrypt(byte[] text, PublicKey key) throws MangooEncryptionException {
Objects.requireNonNull(text, Required.PLAIN_TEXT.toString());
Objects.requireNonNull(text, Required.PUBLIC_KEY.toString());
byte[] encrypt = null;
try {
Cipher cipher = Cipher.getIns... | [
"public",
"byte",
"[",
"]",
"encrypt",
"(",
"byte",
"[",
"]",
"text",
",",
"PublicKey",
"key",
")",
"throws",
"MangooEncryptionException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"text",
",",
"Required",
".",
"PLAIN_TEXT",
".",
"toString",
"(",
")",
")... | Encrypt a text using public key
@param text The plain text
@param key The public key
@return Encrypted text
@throws MangooEncryptionException if encryption fails | [
"Encrypt",
"a",
"text",
"using",
"public",
"key"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L184-L198 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.encrypt | public String encrypt(String text, PublicKey key) throws MangooEncryptionException {
Objects.requireNonNull(text, Required.PLAIN_TEXT.toString());
Objects.requireNonNull(text, Required.PUBLIC_KEY.toString());
String encrypt = null;
try {
byte[] cipherText = encrypt(t... | java | public String encrypt(String text, PublicKey key) throws MangooEncryptionException {
Objects.requireNonNull(text, Required.PLAIN_TEXT.toString());
Objects.requireNonNull(text, Required.PUBLIC_KEY.toString());
String encrypt = null;
try {
byte[] cipherText = encrypt(t... | [
"public",
"String",
"encrypt",
"(",
"String",
"text",
",",
"PublicKey",
"key",
")",
"throws",
"MangooEncryptionException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"text",
",",
"Required",
".",
"PLAIN_TEXT",
".",
"toString",
"(",
")",
")",
";",
"Objects",
... | Encrypt a text using public key. The result is encoded to Base64.
@param text The plain text
@param key The public key
@return Encrypted string as base64
@throws MangooEncryptionException if encryption fails | [
"Encrypt",
"a",
"text",
"using",
"public",
"key",
".",
"The",
"result",
"is",
"encoded",
"to",
"Base64",
"."
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L209-L222 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.decrypt | public byte[] decrypt(byte[] text, PrivateKey key) throws MangooEncryptionException {
Objects.requireNonNull(text, Required.ENCRYPTED_TEXT.toString());
Objects.requireNonNull(text, Required.PRIVATE_KEY.toString());
byte[] decrypt = null;
try {
Cipher cipher = Cipher.getInsta... | java | public byte[] decrypt(byte[] text, PrivateKey key) throws MangooEncryptionException {
Objects.requireNonNull(text, Required.ENCRYPTED_TEXT.toString());
Objects.requireNonNull(text, Required.PRIVATE_KEY.toString());
byte[] decrypt = null;
try {
Cipher cipher = Cipher.getInsta... | [
"public",
"byte",
"[",
"]",
"decrypt",
"(",
"byte",
"[",
"]",
"text",
",",
"PrivateKey",
"key",
")",
"throws",
"MangooEncryptionException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"text",
",",
"Required",
".",
"ENCRYPTED_TEXT",
".",
"toString",
"(",
")",... | Decrypt text using private key
@param text The encrypted text
@param key The private key
@return The unencrypted text
@throws MangooEncryptionException if decryption fails | [
"Decrypt",
"text",
"using",
"private",
"key"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L233-L247 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.decrypt | public String decrypt(String text, PrivateKey key) throws MangooEncryptionException {
Objects.requireNonNull(text, Required.ENCRYPTED_TEXT.toString());
Objects.requireNonNull(text, Required.PRIVATE_KEY.toString());
String decrypt = null;
try {
byte[] dectyptedText = ... | java | public String decrypt(String text, PrivateKey key) throws MangooEncryptionException {
Objects.requireNonNull(text, Required.ENCRYPTED_TEXT.toString());
Objects.requireNonNull(text, Required.PRIVATE_KEY.toString());
String decrypt = null;
try {
byte[] dectyptedText = ... | [
"public",
"String",
"decrypt",
"(",
"String",
"text",
",",
"PrivateKey",
"key",
")",
"throws",
"MangooEncryptionException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"text",
",",
"Required",
".",
"ENCRYPTED_TEXT",
".",
"toString",
"(",
")",
")",
";",
"Object... | Decrypt Base64 encoded text using private key
@param text The encrypted text, encoded as Base64
@param key The private key
@return The plain text encoded as UTF8
@throws MangooEncryptionException if decryption fails | [
"Decrypt",
"Base64",
"encoded",
"text",
"using",
"private",
"key"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L258-L271 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.getKeyAsString | public String getKeyAsString(Key key) {
Objects.requireNonNull(key, Required.KEY.toString());
return encodeBase64(key.getEncoded());
} | java | public String getKeyAsString(Key key) {
Objects.requireNonNull(key, Required.KEY.toString());
return encodeBase64(key.getEncoded());
} | [
"public",
"String",
"getKeyAsString",
"(",
"Key",
"key",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"return",
"encodeBase64",
"(",
"key",
".",
"getEncoded",
"(",
")",
")",
"... | Convert a Key to string encoded as Base64
@param key The key (private or public)
@return A string representation of the key | [
"Convert",
"a",
"Key",
"to",
"string",
"encoded",
"as",
"Base64"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L279-L283 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.getPrivateKeyFromString | public PrivateKey getPrivateKeyFromString(String key) throws MangooEncryptionException {
Objects.requireNonNull(key, Required.KEY.toString());
try {
return KeyFactory.getInstance(ALGORITHM).generatePrivate(new PKCS8EncodedKeySpec(decodeBase64(key)));
} catch (InvalidKeySpecE... | java | public PrivateKey getPrivateKeyFromString(String key) throws MangooEncryptionException {
Objects.requireNonNull(key, Required.KEY.toString());
try {
return KeyFactory.getInstance(ALGORITHM).generatePrivate(new PKCS8EncodedKeySpec(decodeBase64(key)));
} catch (InvalidKeySpecE... | [
"public",
"PrivateKey",
"getPrivateKeyFromString",
"(",
"String",
"key",
")",
"throws",
"MangooEncryptionException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"try",
"{",
"return",
"Key... | Generates Private Key from Base64 encoded string
@param key Base64 encoded string which represents the key
@return The PrivateKey
@throws MangooEncryptionException if getting private key from string fails | [
"Generates",
"Private",
"Key",
"from",
"Base64",
"encoded",
"string"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L293-L301 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.getPublicKeyFromString | public PublicKey getPublicKeyFromString(String key) throws MangooEncryptionException {
Objects.requireNonNull(key, Required.KEY.toString());
try {
return KeyFactory.getInstance(ALGORITHM).generatePublic(new X509EncodedKeySpec(decodeBase64(key)));
} catch (InvalidKeySpecExcep... | java | public PublicKey getPublicKeyFromString(String key) throws MangooEncryptionException {
Objects.requireNonNull(key, Required.KEY.toString());
try {
return KeyFactory.getInstance(ALGORITHM).generatePublic(new X509EncodedKeySpec(decodeBase64(key)));
} catch (InvalidKeySpecExcep... | [
"public",
"PublicKey",
"getPublicKeyFromString",
"(",
"String",
"key",
")",
"throws",
"MangooEncryptionException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"try",
"{",
"return",
"KeyFa... | Generates Public Key from Base64 encoded string
@param key Base64 encoded string which represents the key
@return The PublicKey
@throws MangooEncryptionException if getting public key from string fails | [
"Generates",
"Public",
"Key",
"from",
"Base64",
"encoded",
"string"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L311-L319 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.encodeBase64 | private String encodeBase64(byte[] bytes) {
Objects.requireNonNull(bytes, Required.BYTES.toString());
return org.apache.commons.codec.binary.Base64.encodeBase64String(bytes);
} | java | private String encodeBase64(byte[] bytes) {
Objects.requireNonNull(bytes, Required.BYTES.toString());
return org.apache.commons.codec.binary.Base64.encodeBase64String(bytes);
} | [
"private",
"String",
"encodeBase64",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"bytes",
",",
"Required",
".",
"BYTES",
".",
"toString",
"(",
")",
")",
";",
"return",
"org",
".",
"apache",
".",
"commons",
".",
"cod... | Encode bytes array to Base64 string
@param bytes The bytes
@return Encoded string | [
"Encode",
"bytes",
"array",
"to",
"Base64",
"string"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L327-L330 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java | Crypto.decodeBase64 | private byte[] decodeBase64(String text) {
Objects.requireNonNull(text, Required.PLAIN_TEXT.toString());
return org.apache.commons.codec.binary.Base64.decodeBase64(text);
} | java | private byte[] decodeBase64(String text) {
Objects.requireNonNull(text, Required.PLAIN_TEXT.toString());
return org.apache.commons.codec.binary.Base64.decodeBase64(text);
} | [
"private",
"byte",
"[",
"]",
"decodeBase64",
"(",
"String",
"text",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"text",
",",
"Required",
".",
"PLAIN_TEXT",
".",
"toString",
"(",
")",
")",
";",
"return",
"org",
".",
"apache",
".",
"commons",
".",
"... | Decode Base64 encoded string to bytes array
@param text The string
@return Bytes array | [
"Decode",
"Base64",
"encoded",
"string",
"to",
"bytes",
"array"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/Crypto.java#L338-L341 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java | CodecUtils.hexJBcrypt | public static String hexJBcrypt(String data) {
Objects.requireNonNull(data, Required.DATA.toString());
return BCrypt.hashpw(data, BCrypt.gensalt(Default.JBCRYPT_ROUNDS.toInt()));
} | java | public static String hexJBcrypt(String data) {
Objects.requireNonNull(data, Required.DATA.toString());
return BCrypt.hashpw(data, BCrypt.gensalt(Default.JBCRYPT_ROUNDS.toInt()));
} | [
"public",
"static",
"String",
"hexJBcrypt",
"(",
"String",
"data",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"data",
",",
"Required",
".",
"DATA",
".",
"toString",
"(",
")",
")",
";",
"return",
"BCrypt",
".",
"hashpw",
"(",
"data",
",",
"BCrypt",
... | Hashes a given cleartext data with JBCrypt
@param data The cleartext data
@return JBCrypted hashed value | [
"Hashes",
"a",
"given",
"cleartext",
"data",
"with",
"JBCrypt"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java#L32-L36 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java | CodecUtils.hexSHA512 | public static String hexSHA512(String data) {
Objects.requireNonNull(data, Required.DATA.toString());
return DigestUtils.sha512Hex(data);
} | java | public static String hexSHA512(String data) {
Objects.requireNonNull(data, Required.DATA.toString());
return DigestUtils.sha512Hex(data);
} | [
"public",
"static",
"String",
"hexSHA512",
"(",
"String",
"data",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"data",
",",
"Required",
".",
"DATA",
".",
"toString",
"(",
")",
")",
";",
"return",
"DigestUtils",
".",
"sha512Hex",
"(",
"data",
")",
";"... | Hashes a given cleartext data with SHA512
@param data The cleartext data
@return SHA512 hashed value | [
"Hashes",
"a",
"given",
"cleartext",
"data",
"with",
"SHA512"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java#L44-L48 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java | CodecUtils.hexSHA512 | public static String hexSHA512(String data, String salt) {
Objects.requireNonNull(data, Required.DATA.toString());
Objects.requireNonNull(salt, Required.SALT.toString());
return DigestUtils.sha512Hex(data + salt);
} | java | public static String hexSHA512(String data, String salt) {
Objects.requireNonNull(data, Required.DATA.toString());
Objects.requireNonNull(salt, Required.SALT.toString());
return DigestUtils.sha512Hex(data + salt);
} | [
"public",
"static",
"String",
"hexSHA512",
"(",
"String",
"data",
",",
"String",
"salt",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"data",
",",
"Required",
".",
"DATA",
".",
"toString",
"(",
")",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"s... | Hashes a given cleartext data with SHA512 and an appended salt
@param data The cleartext data
@param salt The salt to use
@return SHA512 hashed value | [
"Hashes",
"a",
"given",
"cleartext",
"data",
"with",
"SHA512",
"and",
"an",
"appended",
"salt"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java#L57-L62 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java | CodecUtils.checkJBCrypt | public static boolean checkJBCrypt(String data, String hash) {
Objects.requireNonNull(data, Required.DATA.toString());
Objects.requireNonNull(hash, Required.HASH.toString());
return BCrypt.checkpw(data, hash);
} | java | public static boolean checkJBCrypt(String data, String hash) {
Objects.requireNonNull(data, Required.DATA.toString());
Objects.requireNonNull(hash, Required.HASH.toString());
return BCrypt.checkpw(data, hash);
} | [
"public",
"static",
"boolean",
"checkJBCrypt",
"(",
"String",
"data",
",",
"String",
"hash",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"data",
",",
"Required",
".",
"DATA",
".",
"toString",
"(",
")",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
... | Checks a given data against a JBCrypted hash
@param data The cleartext data
@param hash The JBCrypt hashed value
@return True if it is a match, false otherwise | [
"Checks",
"a",
"given",
"data",
"against",
"a",
"JBCrypted",
"hash"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java#L71-L76 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java | CodecUtils.serializeToBase64 | public static String serializeToBase64(Serializable object) {
Objects.requireNonNull(object, Required.OBJECT.toString());
byte[] serialize = SerializationUtils.serialize(object);
return base64Encoder.encodeToString(serialize);
} | java | public static String serializeToBase64(Serializable object) {
Objects.requireNonNull(object, Required.OBJECT.toString());
byte[] serialize = SerializationUtils.serialize(object);
return base64Encoder.encodeToString(serialize);
} | [
"public",
"static",
"String",
"serializeToBase64",
"(",
"Serializable",
"object",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"object",
",",
"Required",
".",
"OBJECT",
".",
"toString",
"(",
")",
")",
";",
"byte",
"[",
"]",
"serialize",
"=",
"Serializati... | Serializes an object into an Base64 encoded data string
@param object The object to serialize
@return The base64 encoded data string | [
"Serializes",
"an",
"object",
"into",
"an",
"Base64",
"encoded",
"data",
"string"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java#L84-L89 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java | CodecUtils.deserializeFromBase64 | public static <T> T deserializeFromBase64(String data) {
Objects.requireNonNull(data, Required.DATA.toString());
byte[] bytes = base64Decoder.decode(data);
return SerializationUtils.deserialize(bytes);
} | java | public static <T> T deserializeFromBase64(String data) {
Objects.requireNonNull(data, Required.DATA.toString());
byte[] bytes = base64Decoder.decode(data);
return SerializationUtils.deserialize(bytes);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"deserializeFromBase64",
"(",
"String",
"data",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"data",
",",
"Required",
".",
"DATA",
".",
"toString",
"(",
")",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"base64D... | Deserialize a given Base64 encoded data string into an object
@param data The base64 encoded data string
@param <T> Just for JavaDoc can be ignored
@return The required object | [
"Deserialize",
"a",
"given",
"Base64",
"encoded",
"data",
"string",
"into",
"an",
"object"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java#L98-L103 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java | Form.getString | public Optional<String> getString(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
String value = this.values.get(key);
if (StringUtils.isNotBlank(value)) {
return Optional.of(value);
}
return Optional.empty();
} | java | public Optional<String> getString(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
String value = this.values.get(key);
if (StringUtils.isNotBlank(value)) {
return Optional.of(value);
}
return Optional.empty();
} | [
"public",
"Optional",
"<",
"String",
">",
"getString",
"(",
"String",
"key",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"String",
"value",
"=",
"this",
".",
"values",
".",
... | Retrieves an optional string value corresponding to the name of the form element
@param key The name of the form element
@return Optional of String | [
"Retrieves",
"an",
"optional",
"string",
"value",
"corresponding",
"to",
"the",
"name",
"of",
"the",
"form",
"element"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java#L39-L48 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java | Form.getBoolean | public Optional<Boolean> getBoolean(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
String value = this.values.get(key);
if (StringUtils.isNotBlank(value)) {
if (("1").equals(value)) {
return Optional.of(Boolean.TRUE);
} else if (("tru... | java | public Optional<Boolean> getBoolean(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
String value = this.values.get(key);
if (StringUtils.isNotBlank(value)) {
if (("1").equals(value)) {
return Optional.of(Boolean.TRUE);
} else if (("tru... | [
"public",
"Optional",
"<",
"Boolean",
">",
"getBoolean",
"(",
"String",
"key",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"String",
"value",
"=",
"this",
".",
"values",
".",... | Retrieves an optional boolean value corresponding to the name of the form element
0 maps to false
1 maps to true
"true" maps to true
"false" maps to false
@param key The name of the form element
@return Optional of Boolean | [
"Retrieves",
"an",
"optional",
"boolean",
"value",
"corresponding",
"to",
"the",
"name",
"of",
"the",
"form",
"element"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java#L61-L80 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java | Form.getInteger | public Optional<Integer> getInteger(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
String value = this.values.get(key);
if (StringUtils.isNotBlank(value) && NumberUtils.isCreatable(value)) {
return Optional.of(Integer.valueOf(value));
}
return O... | java | public Optional<Integer> getInteger(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
String value = this.values.get(key);
if (StringUtils.isNotBlank(value) && NumberUtils.isCreatable(value)) {
return Optional.of(Integer.valueOf(value));
}
return O... | [
"public",
"Optional",
"<",
"Integer",
">",
"getInteger",
"(",
"String",
"key",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"String",
"value",
"=",
"this",
".",
"values",
".",... | Retrieves an optional integer value corresponding to the name of the form element
@param key The name of the form element
@return Optional of Integer | [
"Retrieves",
"an",
"optional",
"integer",
"value",
"corresponding",
"to",
"the",
"name",
"of",
"the",
"form",
"element"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java#L88-L97 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java | Form.getFile | public Optional<InputStream> getFile() {
if (!this.files.isEmpty()) {
return Optional.of(this.files.get(0));
}
return Optional.empty();
} | java | public Optional<InputStream> getFile() {
if (!this.files.isEmpty()) {
return Optional.of(this.files.get(0));
}
return Optional.empty();
} | [
"public",
"Optional",
"<",
"InputStream",
">",
"getFile",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"files",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Optional",
".",
"of",
"(",
"this",
".",
"files",
".",
"get",
"(",
"0",
")",
")",
";",
... | Retrieves a single file of the form. If the the form
has multiple files, the first will be returned
@return File or null if no file is present | [
"Retrieves",
"a",
"single",
"file",
"of",
"the",
"form",
".",
"If",
"the",
"the",
"form",
"has",
"multiple",
"files",
"the",
"first",
"will",
"be",
"returned"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java#L148-L154 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java | Form.addValueList | public void addValueList(String key, String value) {
Objects.requireNonNull(key, Required.KEY.toString());
if (!valueMap.containsKey(key)) {
List<String> values = new ArrayList<>();
values.add(value);
valueMap.put(key, values);
} else {
... | java | public void addValueList(String key, String value) {
Objects.requireNonNull(key, Required.KEY.toString());
if (!valueMap.containsKey(key)) {
List<String> values = new ArrayList<>();
values.add(value);
valueMap.put(key, values);
} else {
... | [
"public",
"void",
"addValueList",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"!",
"valueMap",
".",
"containsKey",
"(... | Adds an additional item to the value list
@param key The name of the form element
@param value The value to store | [
"Adds",
"an",
"additional",
"item",
"to",
"the",
"value",
"list"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java#L188-L202 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java | Form.getValueList | public List<String> getValueList(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
return this.valueMap.get(key);
} | java | public List<String> getValueList(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
return this.valueMap.get(key);
} | [
"public",
"List",
"<",
"String",
">",
"getValueList",
"(",
"String",
"key",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"return",
"this",
".",
"valueMap",
".",
"get",
"(",
... | Retrieves the value list for a given key
@param key The name of the form element
@return A value list with elements | [
"Retrieves",
"the",
"value",
"list",
"for",
"a",
"given",
"key"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Form.java#L210-L214 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/services/EventBusService.java | EventBusService.register | public void register(Object eventListener) {
Objects.requireNonNull(eventListener, Required.EVENT_LISTENER.toString());
this.eventBus.register(eventListener);
this.listeners.getAndIncrement();
} | java | public void register(Object eventListener) {
Objects.requireNonNull(eventListener, Required.EVENT_LISTENER.toString());
this.eventBus.register(eventListener);
this.listeners.getAndIncrement();
} | [
"public",
"void",
"register",
"(",
"Object",
"eventListener",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"eventListener",
",",
"Required",
".",
"EVENT_LISTENER",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"eventBus",
".",
"register",
"(",
"event... | Registers an event listener to the event bus
@param eventListener The listener to register | [
"Registers",
"an",
"event",
"listener",
"to",
"the",
"event",
"bus"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/EventBusService.java#L32-L37 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/services/EventBusService.java | EventBusService.unregister | public void unregister(Object eventListener) throws MangooEventBusException {
Objects.requireNonNull(eventListener, Required.EVENT_LISTENER.toString());
try {
this.eventBus.unregister(eventListener);
} catch (IllegalArgumentException e) {
throw new MangooEventBus... | java | public void unregister(Object eventListener) throws MangooEventBusException {
Objects.requireNonNull(eventListener, Required.EVENT_LISTENER.toString());
try {
this.eventBus.unregister(eventListener);
} catch (IllegalArgumentException e) {
throw new MangooEventBus... | [
"public",
"void",
"unregister",
"(",
"Object",
"eventListener",
")",
"throws",
"MangooEventBusException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"eventListener",
",",
"Required",
".",
"EVENT_LISTENER",
".",
"toString",
"(",
")",
")",
";",
"try",
"{",
"this"... | Unregisters an event listener to the event bus
@param eventListener The listener to unregister
@throws MangooEventBusException when unregistering an event fails | [
"Unregisters",
"an",
"event",
"listener",
"to",
"the",
"event",
"bus"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/EventBusService.java#L45-L57 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/services/EventBusService.java | EventBusService.publish | public void publish(Object event) {
Objects.requireNonNull(event, Required.EVENT.toString());
this.eventBus.post(event);
this.events.getAndIncrement();
} | java | public void publish(Object event) {
Objects.requireNonNull(event, Required.EVENT.toString());
this.eventBus.post(event);
this.events.getAndIncrement();
} | [
"public",
"void",
"publish",
"(",
"Object",
"event",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"event",
",",
"Required",
".",
"EVENT",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"eventBus",
".",
"post",
"(",
"event",
")",
";",
"this",
"... | Publishes an event to the event bus
@param event The event to publish | [
"Publishes",
"an",
"event",
"to",
"the",
"event",
"bus"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/EventBusService.java#L64-L69 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/FormHandler.java | FormHandler.getForm | @SuppressWarnings("rawtypes")
protected Form getForm(HttpServerExchange exchange) throws IOException {
final Form form = Application.getInstance(Form.class);
if (RequestUtils.isPostPutPatch(exchange)) {
final Builder builder = FormParserFactory.builder();
builder.setDefaultCh... | java | @SuppressWarnings("rawtypes")
protected Form getForm(HttpServerExchange exchange) throws IOException {
final Form form = Application.getInstance(Form.class);
if (RequestUtils.isPostPutPatch(exchange)) {
final Builder builder = FormParserFactory.builder();
builder.setDefaultCh... | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"protected",
"Form",
"getForm",
"(",
"HttpServerExchange",
"exchange",
")",
"throws",
"IOException",
"{",
"final",
"Form",
"form",
"=",
"Application",
".",
"getInstance",
"(",
"Form",
".",
"class",
")",
";",
"... | Retrieves the form parameter from a request
@param exchange The Undertow HttpServerExchange
@throws IOException | [
"Retrieves",
"the",
"form",
"parameter",
"from",
"a",
"request"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/FormHandler.java#L49-L86 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Session.java | Session.put | public void put(String key, String value) {
if (INVALID_CHRACTERTS.contains(key) || INVALID_CHRACTERTS.contains(value)) {
LOG.error("Session key or value can not contain the following characters: spaces, |, & or :");
} else {
this.changed = true;
this.values.put(key,... | java | public void put(String key, String value) {
if (INVALID_CHRACTERTS.contains(key) || INVALID_CHRACTERTS.contains(value)) {
LOG.error("Session key or value can not contain the following characters: spaces, |, & or :");
} else {
this.changed = true;
this.values.put(key,... | [
"public",
"void",
"put",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"INVALID_CHRACTERTS",
".",
"contains",
"(",
"key",
")",
"||",
"INVALID_CHRACTERTS",
".",
"contains",
"(",
"value",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"\"S... | Adds a value to the session, overwriting an existing value
@param key The key to store the value
@param value The value to store | [
"Adds",
"a",
"value",
"to",
"the",
"session",
"overwriting",
"an",
"existing",
"value"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Session.java#L99-L106 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/DispatcherHandler.java | DispatcherHandler.getMethodParameters | private Map<String, Class<?>> getMethodParameters() {
final Map<String, Class<?>> parameters = new LinkedHashMap<>();
for (final Method declaredMethod : this.controllerClass.getDeclaredMethods()) {
if (declaredMethod.getName().equals(this.controllerMethodName) && declaredMethod.getParameterC... | java | private Map<String, Class<?>> getMethodParameters() {
final Map<String, Class<?>> parameters = new LinkedHashMap<>();
for (final Method declaredMethod : this.controllerClass.getDeclaredMethods()) {
if (declaredMethod.getName().equals(this.controllerMethodName) && declaredMethod.getParameterC... | [
"private",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"getMethodParameters",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"parameters",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"for",
"(",
"f... | Converts the method parameter of a mapped controller method to a map
@return A Map containing the declared methods of the method parameters and their class type | [
"Converts",
"the",
"method",
"parameter",
"of",
"a",
"mapped",
"controller",
"method",
"to",
"a",
"map"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/DispatcherHandler.java#L162-L172 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/routes/WebSocketRoute.java | WebSocketRoute.onController | public WebSocketRoute onController(Class<?> clazz) {
Objects.requireNonNull(clazz, Required.URL.toString());
this.controllerClass = clazz;
return this;
} | java | public WebSocketRoute onController(Class<?> clazz) {
Objects.requireNonNull(clazz, Required.URL.toString());
this.controllerClass = clazz;
return this;
} | [
"public",
"WebSocketRoute",
"onController",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"clazz",
",",
"Required",
".",
"URL",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"controllerClass",
"=",
"clazz",
";... | Sets the controller class for this WebSocket route
@param clazz The controller class
@return WebSocketRoute instance | [
"Sets",
"the",
"controller",
"class",
"for",
"this",
"WebSocket",
"route"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/routes/WebSocketRoute.java#L45-L50 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/JsonUtils.java | JsonUtils.toJson | public static String toJson(Object object) {
Objects.requireNonNull(object, Required.OBJECT.toString());
String json = null;
try {
json = mapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
LOG.error("Failed to convert object to json"... | java | public static String toJson(Object object) {
Objects.requireNonNull(object, Required.OBJECT.toString());
String json = null;
try {
json = mapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
LOG.error("Failed to convert object to json"... | [
"public",
"static",
"String",
"toJson",
"(",
"Object",
"object",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"object",
",",
"Required",
".",
"OBJECT",
".",
"toString",
"(",
")",
")",
";",
"String",
"json",
"=",
"null",
";",
"try",
"{",
"json",
"="... | Converts a given object to a Json string
@param object The object to convert
@return json string or null if conversion fails | [
"Converts",
"a",
"given",
"object",
"to",
"a",
"Json",
"string"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/JsonUtils.java#L45-L56 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/JsonUtils.java | JsonUtils.fromJson | public static ReadContext fromJson(String json) {
Objects.requireNonNull(json, Required.JSON.toString());
return JsonPath.parse(json);
} | java | public static ReadContext fromJson(String json) {
Objects.requireNonNull(json, Required.JSON.toString());
return JsonPath.parse(json);
} | [
"public",
"static",
"ReadContext",
"fromJson",
"(",
"String",
"json",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"json",
",",
"Required",
".",
"JSON",
".",
"toString",
"(",
")",
")",
";",
"return",
"JsonPath",
".",
"parse",
"(",
"json",
")",
";",
... | Converts a given Json string to an JSONPath ReadContext
@param json The json string to convert
@return JSPNPath read context | [
"Converts",
"a",
"given",
"Json",
"string",
"to",
"an",
"JSONPath",
"ReadContext"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/JsonUtils.java#L83-L87 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/JsonUtils.java | JsonUtils.fromJson | public static <T> T fromJson(String json, Class<T> clazz) {
Objects.requireNonNull(json, Required.JSON.toString());
Objects.requireNonNull(clazz, Required.CLASS.toString());
T object = null;
try {
object = mapper.readValue(json, clazz);
} catch (IOException e... | java | public static <T> T fromJson(String json, Class<T> clazz) {
Objects.requireNonNull(json, Required.JSON.toString());
Objects.requireNonNull(clazz, Required.CLASS.toString());
T object = null;
try {
object = mapper.readValue(json, clazz);
} catch (IOException e... | [
"public",
"static",
"<",
"T",
">",
"T",
"fromJson",
"(",
"String",
"json",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"json",
",",
"Required",
".",
"JSON",
".",
"toString",
"(",
")",
")",
";",
"Objects",
... | Converts a given Json string to given Class
@param json The json string to convert
@param clazz The Class to convert to
@param <T> JavaDoc wants this, just ignore it
@return The converted class or null if conversion fails | [
"Converts",
"a",
"given",
"Json",
"string",
"to",
"given",
"Class"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/JsonUtils.java#L98-L110 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.get | public String get(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
return this.values.get(key);
} | java | public String get(String key) {
Objects.requireNonNull(key, Required.KEY.toString());
return this.values.get(key);
} | [
"public",
"String",
"get",
"(",
"String",
"key",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"return",
"this",
".",
"values",
".",
"get",
"(",
"key",
")",
";",
"}"
] | Retrieves a form value corresponding to the name of the form element
@param key The name of the form element
@return The value of the form or null if not present | [
"Retrieves",
"a",
"form",
"value",
"corresponding",
"to",
"the",
"name",
"of",
"the",
"form",
"element"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L530-L534 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/OutboundCookiesHandler.java | OutboundCookiesHandler.setSessionCookie | protected void setSessionCookie(HttpServerExchange exchange) {
Session session = this.attachment.getSession();
if (session.isInvalid()) {
Cookie cookie = new CookieImpl(this.config.getSessionCookieName())
.setSecure(this.config.isSessionCookieSecure())
... | java | protected void setSessionCookie(HttpServerExchange exchange) {
Session session = this.attachment.getSession();
if (session.isInvalid()) {
Cookie cookie = new CookieImpl(this.config.getSessionCookieName())
.setSecure(this.config.isSessionCookieSecure())
... | [
"protected",
"void",
"setSessionCookie",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"Session",
"session",
"=",
"this",
".",
"attachment",
".",
"getSession",
"(",
")",
";",
"if",
"(",
"session",
".",
"isInvalid",
"(",
")",
")",
"{",
"Cookie",
"cookie",
... | Sets the session cookie to the current HttpServerExchange
@param exchange The Undertow HttpServerExchange | [
"Sets",
"the",
"session",
"cookie",
"to",
"the",
"current",
"HttpServerExchange"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/OutboundCookiesHandler.java#L68-L118 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/OutboundCookiesHandler.java | OutboundCookiesHandler.setAuthenticationCookie | protected void setAuthenticationCookie(HttpServerExchange exchange) {
Authentication authentication = this.attachment.getAuthentication();
if (authentication.isInvalid() || authentication.isLogout()) {
Cookie cookie = new CookieImpl(this.config.getAuthenticationCookieName())
... | java | protected void setAuthenticationCookie(HttpServerExchange exchange) {
Authentication authentication = this.attachment.getAuthentication();
if (authentication.isInvalid() || authentication.isLogout()) {
Cookie cookie = new CookieImpl(this.config.getAuthenticationCookieName())
... | [
"protected",
"void",
"setAuthenticationCookie",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"Authentication",
"authentication",
"=",
"this",
".",
"attachment",
".",
"getAuthentication",
"(",
")",
";",
"if",
"(",
"authentication",
".",
"isInvalid",
"(",
")",
"... | Sets the authentication cookie to the current HttpServerExchange
@param exchange The Undertow HttpServerExchange | [
"Sets",
"the",
"authentication",
"cookie",
"to",
"the",
"current",
"HttpServerExchange"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/OutboundCookiesHandler.java#L125-L179 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/OutboundCookiesHandler.java | OutboundCookiesHandler.setFlashCookie | protected void setFlashCookie(HttpServerExchange exchange) {
Flash flash = this.attachment.getFlash();
Form form = this.attachment.getForm();
if (flash.isDiscard() || flash.isInvalid()) {
final Cookie cookie = new CookieImpl(this.config.getFlashCookieName())
... | java | protected void setFlashCookie(HttpServerExchange exchange) {
Flash flash = this.attachment.getFlash();
Form form = this.attachment.getForm();
if (flash.isDiscard() || flash.isInvalid()) {
final Cookie cookie = new CookieImpl(this.config.getFlashCookieName())
... | [
"protected",
"void",
"setFlashCookie",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"Flash",
"flash",
"=",
"this",
".",
"attachment",
".",
"getFlash",
"(",
")",
";",
"Form",
"form",
"=",
"this",
".",
"attachment",
".",
"getForm",
"(",
")",
";",
"if",
... | Sets the flash cookie to current HttpServerExchange
@param exchange The Undertow HttpServerExchange
@throws MangooCookieException | [
"Sets",
"the",
"flash",
"cookie",
"to",
"current",
"HttpServerExchange"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/OutboundCookiesHandler.java#L187-L236 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/ResponseHandler.java | ResponseHandler.handleBinaryResponse | protected void handleBinaryResponse(HttpServerExchange exchange, Response response) {
exchange.dispatch(exchange.getDispatchExecutor(), Application.getInstance(BinaryHandler.class).withResponse(response));
} | java | protected void handleBinaryResponse(HttpServerExchange exchange, Response response) {
exchange.dispatch(exchange.getDispatchExecutor(), Application.getInstance(BinaryHandler.class).withResponse(response));
} | [
"protected",
"void",
"handleBinaryResponse",
"(",
"HttpServerExchange",
"exchange",
",",
"Response",
"response",
")",
"{",
"exchange",
".",
"dispatch",
"(",
"exchange",
".",
"getDispatchExecutor",
"(",
")",
",",
"Application",
".",
"getInstance",
"(",
"BinaryHandler... | Handles a binary response to the client by sending the binary content from the response
to the undertow output stream
@param exchange The Undertow HttpServerExchange
@param response The response object
@throws IOException | [
"Handles",
"a",
"binary",
"response",
"to",
"the",
"client",
"by",
"sending",
"the",
"binary",
"content",
"from",
"the",
"response",
"to",
"the",
"undertow",
"output",
"stream"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/ResponseHandler.java#L53-L55 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/ResponseHandler.java | ResponseHandler.handleRedirectResponse | protected void handleRedirectResponse(HttpServerExchange exchange, Response response) {
exchange.setStatusCode(StatusCodes.FOUND);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> ... | java | protected void handleRedirectResponse(HttpServerExchange exchange, Response response) {
exchange.setStatusCode(StatusCodes.FOUND);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> ... | [
"protected",
"void",
"handleRedirectResponse",
"(",
"HttpServerExchange",
"exchange",
",",
"Response",
"response",
")",
"{",
"exchange",
".",
"setStatusCode",
"(",
"StatusCodes",
".",
"FOUND",
")",
";",
"Server",
".",
"headers",
"(",
")",
".",
"entrySet",
"(",
... | Handles a redirect response to the client by sending a 403 status code to the client
@param exchange The Undertow HttpServerExchange
@param response The response object | [
"Handles",
"a",
"redirect",
"response",
"to",
"the",
"client",
"by",
"sending",
"a",
"403",
"status",
"code",
"to",
"the",
"client"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/ResponseHandler.java#L63-L75 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/ResponseHandler.java | ResponseHandler.handleRenderedResponse | protected void handleRenderedResponse(HttpServerExchange exchange, Response response) {
exchange.setStatusCode(response.getStatusCode());
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(en... | java | protected void handleRenderedResponse(HttpServerExchange exchange, Response response) {
exchange.setStatusCode(response.getStatusCode());
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(en... | [
"protected",
"void",
"handleRenderedResponse",
"(",
"HttpServerExchange",
"exchange",
",",
"Response",
"response",
")",
"{",
"exchange",
".",
"setStatusCode",
"(",
"response",
".",
"getStatusCode",
"(",
")",
")",
";",
"Server",
".",
"headers",
"(",
")",
".",
"... | Handles a rendered response to the client by sending the rendered body from the response object
@param exchange The Undertow HttpServerExchange
@param response The response object | [
"Handles",
"a",
"rendered",
"response",
"to",
"the",
"client",
"by",
"sending",
"the",
"rendered",
"body",
"from",
"the",
"response",
"object"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/ResponseHandler.java#L83-L95 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/core/Application.java | Application.prepareMode | private static void prepareMode(Mode providedMode) {
final String applicationMode = System.getProperty(Key.APPLICATION_MODE.toString());
if (StringUtils.isNotBlank(applicationMode)) {
switch (applicationMode.toLowerCase(Locale.ENGLISH)) {
case "dev" : mode = Mode.DEV;
... | java | private static void prepareMode(Mode providedMode) {
final String applicationMode = System.getProperty(Key.APPLICATION_MODE.toString());
if (StringUtils.isNotBlank(applicationMode)) {
switch (applicationMode.toLowerCase(Locale.ENGLISH)) {
case "dev" : mode = Mode.DEV;
... | [
"private",
"static",
"void",
"prepareMode",
"(",
"Mode",
"providedMode",
")",
"{",
"final",
"String",
"applicationMode",
"=",
"System",
".",
"getProperty",
"(",
"Key",
".",
"APPLICATION_MODE",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"StringUtils",
".... | Sets the mode the application is running in
@param providedMode A given mode or null | [
"Sets",
"the",
"mode",
"the",
"application",
"is",
"running",
"in"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Application.java#L229-L243 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/core/Application.java | Application.prepareConfig | private static void prepareConfig() {
Config config = getInstance(Config.class);
int bitLength = getBitLength(config.getApplicationSecret());
if (bitLength < KEY_MIN_BIT_LENGTH) {
LOG.error("Application requires a 512 bit application secret. The current property for applicat... | java | private static void prepareConfig() {
Config config = getInstance(Config.class);
int bitLength = getBitLength(config.getApplicationSecret());
if (bitLength < KEY_MIN_BIT_LENGTH) {
LOG.error("Application requires a 512 bit application secret. The current property for applicat... | [
"private",
"static",
"void",
"prepareConfig",
"(",
")",
"{",
"Config",
"config",
"=",
"getInstance",
"(",
"Config",
".",
"class",
")",
";",
"int",
"bitLength",
"=",
"getBitLength",
"(",
"config",
".",
"getApplicationSecret",
"(",
")",
")",
";",
"if",
"(",
... | Checks for config failures that prevent the application from starting | [
"Checks",
"for",
"config",
"failures",
"that",
"prevent",
"the",
"application",
"from",
"starting"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Application.java#L262-L311 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/core/Application.java | Application.prepareRoutes | private static void prepareRoutes() {
injector.getInstance(MangooBootstrap.class).initializeRoutes();
Router.getRequestRoutes().forEach((RequestRoute requestRoute) -> {
if (!methodExists(requestRoute.getControllerMethod(), requestRoute.getControllerClass())) {
LOG.er... | java | private static void prepareRoutes() {
injector.getInstance(MangooBootstrap.class).initializeRoutes();
Router.getRequestRoutes().forEach((RequestRoute requestRoute) -> {
if (!methodExists(requestRoute.getControllerMethod(), requestRoute.getControllerClass())) {
LOG.er... | [
"private",
"static",
"void",
"prepareRoutes",
"(",
")",
"{",
"injector",
".",
"getInstance",
"(",
"MangooBootstrap",
".",
"class",
")",
".",
"initializeRoutes",
"(",
")",
";",
"Router",
".",
"getRequestRoutes",
"(",
")",
".",
"forEach",
"(",
"(",
"RequestRou... | Validate if the routes that are defined in the router are valid | [
"Validate",
"if",
"the",
"routes",
"that",
"are",
"defined",
"in",
"the",
"router",
"are",
"valid"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Application.java#L392-L406 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/core/Application.java | Application.createRoutes | private static void createRoutes() {
pathHandler = new PathHandler(getRoutingHandler());
Router.getWebSocketRoutes().forEach((WebSocketRoute webSocketRoute) ->
pathHandler.addExactPath(webSocketRoute.getUrl(),
Handlers.websocket(getInstance(WebSocketHandler.clas... | java | private static void createRoutes() {
pathHandler = new PathHandler(getRoutingHandler());
Router.getWebSocketRoutes().forEach((WebSocketRoute webSocketRoute) ->
pathHandler.addExactPath(webSocketRoute.getUrl(),
Handlers.websocket(getInstance(WebSocketHandler.clas... | [
"private",
"static",
"void",
"createRoutes",
"(",
")",
"{",
"pathHandler",
"=",
"new",
"PathHandler",
"(",
"getRoutingHandler",
"(",
")",
")",
";",
"Router",
".",
"getWebSocketRoutes",
"(",
")",
".",
"forEach",
"(",
"(",
"WebSocketRoute",
"webSocketRoute",
")"... | Create routes for WebSockets ServerSentEvent and Resource files | [
"Create",
"routes",
"for",
"WebSockets",
"ServerSentEvent",
"and",
"Resource",
"files"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Application.java#L425-L450 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/core/Application.java | Application.getLogo | public static String getLogo() {
String logo = "";
try (InputStream inputStream = Resources.getResource(Default.LOGO_FILE.toString()).openStream()) {
logo = IOUtils.toString(inputStream, Default.ENCODING.toString());
} catch (final IOException e) {
LOG.error("Failed to ge... | java | public static String getLogo() {
String logo = "";
try (InputStream inputStream = Resources.getResource(Default.LOGO_FILE.toString()).openStream()) {
logo = IOUtils.toString(inputStream, Default.ENCODING.toString());
} catch (final IOException e) {
LOG.error("Failed to ge... | [
"public",
"static",
"String",
"getLogo",
"(",
")",
"{",
"String",
"logo",
"=",
"\"\"",
";",
"try",
"(",
"InputStream",
"inputStream",
"=",
"Resources",
".",
"getResource",
"(",
"Default",
".",
"LOGO_FILE",
".",
"toString",
"(",
")",
")",
".",
"openStream",... | Retrieves the logo from the logo file and returns the string
@return The mangoo I/O logo string | [
"Retrieves",
"the",
"logo",
"from",
"the",
"logo",
"file",
"and",
"returns",
"the",
"string"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Application.java#L570-L579 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Authentication.java | Authentication.validLogin | public boolean validLogin(String identifier, String password, String hash) {
Objects.requireNonNull(identifier, Required.USERNAME.toString());
Objects.requireNonNull(password, Required.PASSWORD.toString());
Objects.requireNonNull(hash, Required.HASH.toString());
Cache cache = Applicatio... | java | public boolean validLogin(String identifier, String password, String hash) {
Objects.requireNonNull(identifier, Required.USERNAME.toString());
Objects.requireNonNull(password, Required.PASSWORD.toString());
Objects.requireNonNull(hash, Required.HASH.toString());
Cache cache = Applicatio... | [
"public",
"boolean",
"validLogin",
"(",
"String",
"identifier",
",",
"String",
"password",
",",
"String",
"hash",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"identifier",
",",
"Required",
".",
"USERNAME",
".",
"toString",
"(",
")",
")",
";",
"Objects",... | Creates a hashed value of a given clear text password and checks if the
value matches a given, already hashed password
@param identifier The identifier to authenticate
@param password The clear text password
@param hash The previously hashed password to check
@return True if the new hashed password matches the hash, f... | [
"Creates",
"a",
"hashed",
"value",
"of",
"a",
"given",
"clear",
"text",
"password",
"and",
"checks",
"if",
"the",
"value",
"matches",
"a",
"given",
"already",
"hashed",
"password"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Authentication.java#L109-L123 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Authentication.java | Authentication.userHasLock | public boolean userHasLock(String username) {
Objects.requireNonNull(username, Required.USERNAME.toString());
boolean lock = false;
Config config = Application.getInstance(Config.class);
Cache cache = Application.getInstance(CacheProvider.class).getCache(CacheName.AUTH);
... | java | public boolean userHasLock(String username) {
Objects.requireNonNull(username, Required.USERNAME.toString());
boolean lock = false;
Config config = Application.getInstance(Config.class);
Cache cache = Application.getInstance(CacheProvider.class).getCache(CacheName.AUTH);
... | [
"public",
"boolean",
"userHasLock",
"(",
"String",
"username",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"username",
",",
"Required",
".",
"USERNAME",
".",
"toString",
"(",
")",
")",
";",
"boolean",
"lock",
"=",
"false",
";",
"Config",
"config",
"="... | Checks if a username is locked because of to many failed login attempts
@param username The username to check
@return true if the user has a lock, false otherwise | [
"Checks",
"if",
"a",
"username",
"is",
"locked",
"because",
"of",
"to",
"many",
"failed",
"login",
"attempts"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Authentication.java#L174-L186 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Authentication.java | Authentication.validSecondFactor | public boolean validSecondFactor(String secret, String number) {
Objects.requireNonNull(secret, Required.SECRET.toString());
Objects.requireNonNull(number, Required.TOTP.toString());
return TotpUtils.verifiedTotp(secret, number);
} | java | public boolean validSecondFactor(String secret, String number) {
Objects.requireNonNull(secret, Required.SECRET.toString());
Objects.requireNonNull(number, Required.TOTP.toString());
return TotpUtils.verifiedTotp(secret, number);
} | [
"public",
"boolean",
"validSecondFactor",
"(",
"String",
"secret",
",",
"String",
"number",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"secret",
",",
"Required",
".",
"SECRET",
".",
"toString",
"(",
")",
")",
";",
"Objects",
".",
"requireNonNull",
"(",... | Checks if a given number for 2FA is valid for the given secret
@param secret The plaintext secret to use for checking
@param number The number entered by the user
@return True if number is valid, false otherwise | [
"Checks",
"if",
"a",
"given",
"number",
"for",
"2FA",
"is",
"valid",
"for",
"the",
"given",
"secret"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Authentication.java#L195-L200 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/routes/ControllerRoute.java | ControllerRoute.withRoutes | public void withRoutes(MangooRoute... routes) {
Objects.requireNonNull(routes, Required.ROUTE.toString());
for (MangooRoute route : routes) {
RequestRoute requestRoute = (RequestRoute) route;
requestRoute.withControllerClass(this.controllerClass);
if (hasBas... | java | public void withRoutes(MangooRoute... routes) {
Objects.requireNonNull(routes, Required.ROUTE.toString());
for (MangooRoute route : routes) {
RequestRoute requestRoute = (RequestRoute) route;
requestRoute.withControllerClass(this.controllerClass);
if (hasBas... | [
"public",
"void",
"withRoutes",
"(",
"MangooRoute",
"...",
"routes",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"routes",
",",
"Required",
".",
"ROUTE",
".",
"toString",
"(",
")",
")",
";",
"for",
"(",
"MangooRoute",
"route",
":",
"routes",
")",
"{... | Sets the given routes to the defined controller class
@param routes The routes to be configured for the controller | [
"Sets",
"the",
"given",
"routes",
"to",
"the",
"defined",
"controller",
"class"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/routes/ControllerRoute.java#L43-L79 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/ByteUtils.java | ByteUtils.bitLength | public static int bitLength (byte[] bytes) {
Objects.requireNonNull(bytes, Required.BYTES.toString());
int byteLength = bytes.length;
int length = 0;
if (byteLength <= MAX_BYTE_LENGTH && byteLength > 0) {
length = byteLength * BYTES;
}
return... | java | public static int bitLength (byte[] bytes) {
Objects.requireNonNull(bytes, Required.BYTES.toString());
int byteLength = bytes.length;
int length = 0;
if (byteLength <= MAX_BYTE_LENGTH && byteLength > 0) {
length = byteLength * BYTES;
}
return... | [
"public",
"static",
"int",
"bitLength",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"bytes",
",",
"Required",
".",
"BYTES",
".",
"toString",
"(",
")",
")",
";",
"int",
"byteLength",
"=",
"bytes",
".",
"length",
";",... | Calculates the bit length of a given byte array
@param bytes The byte array
@return The number of bit | [
"Calculates",
"the",
"bit",
"length",
"of",
"a",
"given",
"byte",
"array"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/ByteUtils.java#L26-L36 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/ByteUtils.java | ByteUtils.bitLength | public static int bitLength (String string) {
Objects.requireNonNull(string, Required.STRING.toString());
int byteLength = string.getBytes(StandardCharsets.UTF_8).length;
int length = 0;
if (byteLength <= MAX_BYTE_LENGTH && byteLength > 0) {
length = byteLength * BYT... | java | public static int bitLength (String string) {
Objects.requireNonNull(string, Required.STRING.toString());
int byteLength = string.getBytes(StandardCharsets.UTF_8).length;
int length = 0;
if (byteLength <= MAX_BYTE_LENGTH && byteLength > 0) {
length = byteLength * BYT... | [
"public",
"static",
"int",
"bitLength",
"(",
"String",
"string",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"string",
",",
"Required",
".",
"STRING",
".",
"toString",
"(",
")",
")",
";",
"int",
"byteLength",
"=",
"string",
".",
"getBytes",
"(",
"St... | Calculates the bit length of a given string
@param string The string
@return The number of bit | [
"Calculates",
"the",
"bit",
"length",
"of",
"a",
"given",
"string"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/ByteUtils.java#L44-L54 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/AuthorizationHandler.java | AuthorizationHandler.isNotBlank | private boolean isNotBlank(String subject, String resource, String operation) {
return StringUtils.isNotBlank(subject) && StringUtils.isNotBlank(resource) && StringUtils.isNotBlank(operation);
} | java | private boolean isNotBlank(String subject, String resource, String operation) {
return StringUtils.isNotBlank(subject) && StringUtils.isNotBlank(resource) && StringUtils.isNotBlank(operation);
} | [
"private",
"boolean",
"isNotBlank",
"(",
"String",
"subject",
",",
"String",
"resource",
",",
"String",
"operation",
")",
"{",
"return",
"StringUtils",
".",
"isNotBlank",
"(",
"subject",
")",
"&&",
"StringUtils",
".",
"isNotBlank",
"(",
"resource",
")",
"&&",
... | Checks if any of the given strings is blank
@param subject The subject to validate
@param resource The resource to validate
@param operation The operation to validate
@return True if all strings are not blank, false otherwise | [
"Checks",
"if",
"any",
"of",
"the",
"given",
"strings",
"is",
"blank"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/AuthorizationHandler.java#L67-L69 | train |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/AuthorizationHandler.java | AuthorizationHandler.endRequest | private void endRequest(HttpServerExchange exchange) {
exchange.setStatusCode(StatusCodes.UNAUTHORIZED);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResponseHeader... | java | private void endRequest(HttpServerExchange exchange) {
exchange.setStatusCode(StatusCodes.UNAUTHORIZED);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResponseHeader... | [
"private",
"void",
"endRequest",
"(",
"HttpServerExchange",
"exchange",
")",
"{",
"exchange",
".",
"setStatusCode",
"(",
"StatusCodes",
".",
"UNAUTHORIZED",
")",
";",
"Server",
".",
"headers",
"(",
")",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
"... | Ends the current request by sending a HTTP 401 status code and the default unauthorized template
@param exchange The HttpServerExchange | [
"Ends",
"the",
"current",
"request",
"by",
"sending",
"a",
"HTTP",
"401",
"status",
"code",
"and",
"the",
"default",
"unauthorized",
"template"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/AuthorizationHandler.java#L75-L85 | train |
softindex/datakernel | boot/src/main/java/io/datakernel/service/ServiceGraphModule.java | ServiceGraphModule.register | public <T> ServiceGraphModule register(Class<? extends T> type, ServiceAdapter<T> factory) {
registeredServiceAdapters.put(type, factory);
return this;
} | java | public <T> ServiceGraphModule register(Class<? extends T> type, ServiceAdapter<T> factory) {
registeredServiceAdapters.put(type, factory);
return this;
} | [
"public",
"<",
"T",
">",
"ServiceGraphModule",
"register",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"type",
",",
"ServiceAdapter",
"<",
"T",
">",
"factory",
")",
"{",
"registeredServiceAdapters",
".",
"put",
"(",
"type",
",",
"factory",
")",
";",
"re... | Puts an instance of class and its factory to the factoryMap
@param <T> type of service
@param type key with which the specified factory is to be associated
@param factory value to be associated with the specified type
@return ServiceGraphModule with change | [
"Puts",
"an",
"instance",
"of",
"class",
"and",
"its",
"factory",
"to",
"the",
"factoryMap"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/boot/src/main/java/io/datakernel/service/ServiceGraphModule.java#L143-L146 | train |
softindex/datakernel | boot/src/main/java/io/datakernel/service/ServiceGraphModule.java | ServiceGraphModule.registerForSpecificKey | public <T> ServiceGraphModule registerForSpecificKey(Key<T> key, ServiceAdapter<T> factory) {
keys.put(key, factory);
return this;
} | java | public <T> ServiceGraphModule registerForSpecificKey(Key<T> key, ServiceAdapter<T> factory) {
keys.put(key, factory);
return this;
} | [
"public",
"<",
"T",
">",
"ServiceGraphModule",
"registerForSpecificKey",
"(",
"Key",
"<",
"T",
">",
"key",
",",
"ServiceAdapter",
"<",
"T",
">",
"factory",
")",
"{",
"keys",
".",
"put",
"(",
"key",
",",
"factory",
")",
";",
"return",
"this",
";",
"}"
] | Puts the key and its factory to the keys
@param key key with which the specified factory is to be associated
@param factory value to be associated with the specified key
@param <T> type of service
@return ServiceGraphModule with change | [
"Puts",
"the",
"key",
"and",
"its",
"factory",
"to",
"the",
"keys"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/boot/src/main/java/io/datakernel/service/ServiceGraphModule.java#L156-L159 | train |
softindex/datakernel | boot/src/main/java/io/datakernel/service/ServiceGraphModule.java | ServiceGraphModule.addDependency | public ServiceGraphModule addDependency(Key<?> key, Key<?> keyDependency) {
addedDependencies.computeIfAbsent(key, key1 -> new HashSet<>()).add(keyDependency);
return this;
} | java | public ServiceGraphModule addDependency(Key<?> key, Key<?> keyDependency) {
addedDependencies.computeIfAbsent(key, key1 -> new HashSet<>()).add(keyDependency);
return this;
} | [
"public",
"ServiceGraphModule",
"addDependency",
"(",
"Key",
"<",
"?",
">",
"key",
",",
"Key",
"<",
"?",
">",
"keyDependency",
")",
"{",
"addedDependencies",
".",
"computeIfAbsent",
"(",
"key",
",",
"key1",
"->",
"new",
"HashSet",
"<>",
"(",
")",
")",
".... | Adds the dependency for key
@param key key for adding dependency
@param keyDependency key of dependency
@return ServiceGraphModule with change | [
"Adds",
"the",
"dependency",
"for",
"key"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/boot/src/main/java/io/datakernel/service/ServiceGraphModule.java#L173-L176 | train |
softindex/datakernel | boot/src/main/java/io/datakernel/service/ServiceGraphModule.java | ServiceGraphModule.removeDependency | public ServiceGraphModule removeDependency(Key<?> key, Key<?> keyDependency) {
removedDependencies.computeIfAbsent(key, key1 -> new HashSet<>()).add(keyDependency);
return this;
} | java | public ServiceGraphModule removeDependency(Key<?> key, Key<?> keyDependency) {
removedDependencies.computeIfAbsent(key, key1 -> new HashSet<>()).add(keyDependency);
return this;
} | [
"public",
"ServiceGraphModule",
"removeDependency",
"(",
"Key",
"<",
"?",
">",
"key",
",",
"Key",
"<",
"?",
">",
"keyDependency",
")",
"{",
"removedDependencies",
".",
"computeIfAbsent",
"(",
"key",
",",
"key1",
"->",
"new",
"HashSet",
"<>",
"(",
")",
")",... | Removes the dependency
@param key key for removing dependency
@param keyDependency key of dependency
@return ServiceGraphModule with change | [
"Removes",
"the",
"dependency"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/boot/src/main/java/io/datakernel/service/ServiceGraphModule.java#L185-L188 | train |
softindex/datakernel | core-csp/src/main/java/io/datakernel/csp/process/ChannelLZ4Compressor.java | ChannelLZ4Compressor.getInput | @Override
public ChannelInput<ByteBuf> getInput() {
return input -> {
this.input = sanitize(input);
//noinspection ConstantConditions
if (this.input != null && this.output != null) startProcess();
return getProcessCompletion();
};
} | java | @Override
public ChannelInput<ByteBuf> getInput() {
return input -> {
this.input = sanitize(input);
//noinspection ConstantConditions
if (this.input != null && this.output != null) startProcess();
return getProcessCompletion();
};
} | [
"@",
"Override",
"public",
"ChannelInput",
"<",
"ByteBuf",
">",
"getInput",
"(",
")",
"{",
"return",
"input",
"->",
"{",
"this",
".",
"input",
"=",
"sanitize",
"(",
"input",
")",
";",
"//noinspection ConstantConditions",
"if",
"(",
"this",
".",
"input",
"!... | check input for clarity | [
"check",
"input",
"for",
"clarity"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-csp/src/main/java/io/datakernel/csp/process/ChannelLZ4Compressor.java#L123-L131 | train |
softindex/datakernel | boot/src/main/java/io/datakernel/worker/WorkerPools.java | WorkerPools.getCurrentInstance | public <T> T getCurrentInstance(Class<T> type) {
return getCurrentInstance(Key.get(type));
} | java | public <T> T getCurrentInstance(Class<T> type) {
return getCurrentInstance(Key.get(type));
} | [
"public",
"<",
"T",
">",
"T",
"getCurrentInstance",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"getCurrentInstance",
"(",
"Key",
".",
"get",
"(",
"type",
")",
")",
";",
"}"
] | region getCurrentInstance overloads | [
"region",
"getCurrentInstance",
"overloads"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/boot/src/main/java/io/datakernel/worker/WorkerPools.java#L73-L75 | train |
softindex/datakernel | boot/src/main/java/io/datakernel/worker/WorkerPools.java | WorkerPools.getCurrentInstanceProvider | public <T> Provider<T> getCurrentInstanceProvider(Class<T> type) {
return getCurrentInstanceProvider(Key.get(type));
} | java | public <T> Provider<T> getCurrentInstanceProvider(Class<T> type) {
return getCurrentInstanceProvider(Key.get(type));
} | [
"public",
"<",
"T",
">",
"Provider",
"<",
"T",
">",
"getCurrentInstanceProvider",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"getCurrentInstanceProvider",
"(",
"Key",
".",
"get",
"(",
"type",
")",
")",
";",
"}"
] | region getCurrentInstanceProvider overloads | [
"region",
"getCurrentInstanceProvider",
"overloads"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/boot/src/main/java/io/datakernel/worker/WorkerPools.java#L91-L93 | train |
softindex/datakernel | boot/src/main/java/io/datakernel/worker/WorkerPools.java | WorkerPools.getInstances | public <T> List<T> getInstances(Class<T> type) {
return getInstances(Key.get(type));
} | java | public <T> List<T> getInstances(Class<T> type) {
return getInstances(Key.get(type));
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"getInstances",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"getInstances",
"(",
"Key",
".",
"get",
"(",
"type",
")",
")",
";",
"}"
] | region getInstances overloads | [
"region",
"getInstances",
"overloads"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/boot/src/main/java/io/datakernel/worker/WorkerPools.java#L105-L107 | train |
softindex/datakernel | core-promise/src/main/java/io/datakernel/file/AsyncFile.java | AsyncFile.open | public static AsyncFile open(Executor executor, Path path, Set<OpenOption> openOptions) throws IOException {
FileChannel channel = doOpenChannel(path, openOptions);
return new AsyncFile(executor, channel, path, null);
} | java | public static AsyncFile open(Executor executor, Path path, Set<OpenOption> openOptions) throws IOException {
FileChannel channel = doOpenChannel(path, openOptions);
return new AsyncFile(executor, channel, path, null);
} | [
"public",
"static",
"AsyncFile",
"open",
"(",
"Executor",
"executor",
",",
"Path",
"path",
",",
"Set",
"<",
"OpenOption",
">",
"openOptions",
")",
"throws",
"IOException",
"{",
"FileChannel",
"channel",
"=",
"doOpenChannel",
"(",
"path",
",",
"openOptions",
")... | Opens file synchronously.
@param executor executor for running tasks in other thread
@param path the path of the file to open or create
@param openOptions options specifying how the file is opened | [
"Opens",
"file",
"synchronously",
"."
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-promise/src/main/java/io/datakernel/file/AsyncFile.java#L69-L72 | train |
softindex/datakernel | core-promise/src/main/java/io/datakernel/file/AsyncFile.java | AsyncFile.delete | public static Promise<Void> delete(Executor executor, Path path) {
return ofBlockingRunnable(executor, () -> {
try {
Files.delete(path);
} catch (IOException e) {
throw new UncheckedException(e);
}
});
} | java | public static Promise<Void> delete(Executor executor, Path path) {
return ofBlockingRunnable(executor, () -> {
try {
Files.delete(path);
} catch (IOException e) {
throw new UncheckedException(e);
}
});
} | [
"public",
"static",
"Promise",
"<",
"Void",
">",
"delete",
"(",
"Executor",
"executor",
",",
"Path",
"path",
")",
"{",
"return",
"ofBlockingRunnable",
"(",
"executor",
",",
"(",
")",
"->",
"{",
"try",
"{",
"Files",
".",
"delete",
"(",
"path",
")",
";",... | Deletes the file concurrently.
@param path the path of the file to open or create | [
"Deletes",
"the",
"file",
"concurrently",
"."
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-promise/src/main/java/io/datakernel/file/AsyncFile.java#L105-L113 | train |
softindex/datakernel | core-promise/src/main/java/io/datakernel/file/AsyncFile.java | AsyncFile.move | public static Promise<Void> move(Executor executor, Path source, Path target, CopyOption... options) {
return ofBlockingRunnable(executor, () -> {
try {
Files.move(source, target, options);
} catch (IOException e) {
throw new UncheckedException(e);
}
});
} | java | public static Promise<Void> move(Executor executor, Path source, Path target, CopyOption... options) {
return ofBlockingRunnable(executor, () -> {
try {
Files.move(source, target, options);
} catch (IOException e) {
throw new UncheckedException(e);
}
});
} | [
"public",
"static",
"Promise",
"<",
"Void",
">",
"move",
"(",
"Executor",
"executor",
",",
"Path",
"source",
",",
"Path",
"target",
",",
"CopyOption",
"...",
"options",
")",
"{",
"return",
"ofBlockingRunnable",
"(",
"executor",
",",
"(",
")",
"->",
"{",
... | Moves or renames a file to a target file.
@param executor executor for running tasks in another thread
@param source the path to the file to move
@param target the path to the target file (may be associated with a different provider to the source path)
@param options options specifying how the move should be done | [
"Moves",
"or",
"renames",
"a",
"file",
"to",
"a",
"target",
"file",
"."
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-promise/src/main/java/io/datakernel/file/AsyncFile.java#L134-L142 | train |
softindex/datakernel | core-promise/src/main/java/io/datakernel/file/AsyncFile.java | AsyncFile.createDirectories | public static Promise<Void> createDirectories(Executor executor, Path dir, FileAttribute... attrs) {
return ofBlockingRunnable(executor, () -> {
try {
Files.createDirectories(dir, attrs);
} catch (IOException e) {
throw new UncheckedException(e);
}
});
} | java | public static Promise<Void> createDirectories(Executor executor, Path dir, FileAttribute... attrs) {
return ofBlockingRunnable(executor, () -> {
try {
Files.createDirectories(dir, attrs);
} catch (IOException e) {
throw new UncheckedException(e);
}
});
} | [
"public",
"static",
"Promise",
"<",
"Void",
">",
"createDirectories",
"(",
"Executor",
"executor",
",",
"Path",
"dir",
",",
"FileAttribute",
"...",
"attrs",
")",
"{",
"return",
"ofBlockingRunnable",
"(",
"executor",
",",
"(",
")",
"->",
"{",
"try",
"{",
"F... | Creates a directory by creating all nonexistent parent directories first.
@param executor executor for running tasks in other thread
@param dir the directory to create
@param attrs an optional list of file attributes to set atomically when creating the directory | [
"Creates",
"a",
"directory",
"by",
"creating",
"all",
"nonexistent",
"parent",
"directories",
"first",
"."
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-promise/src/main/java/io/datakernel/file/AsyncFile.java#L186-L194 | train |
softindex/datakernel | core-promise/src/main/java/io/datakernel/file/AsyncFile.java | AsyncFile.write | public Promise<Void> write(ByteBuf buf) {
return sanitize(ofBlockingRunnable(executor, () -> {
synchronized (mutexLock) {
try {
int writtenBytes;
do {
ByteBuffer byteBuffer = buf.toReadByteBuffer();
writtenBytes = channel.write(byteBuffer);
buf.ofReadByteBuffer(byteBuffer);
} w... | java | public Promise<Void> write(ByteBuf buf) {
return sanitize(ofBlockingRunnable(executor, () -> {
synchronized (mutexLock) {
try {
int writtenBytes;
do {
ByteBuffer byteBuffer = buf.toReadByteBuffer();
writtenBytes = channel.write(byteBuffer);
buf.ofReadByteBuffer(byteBuffer);
} w... | [
"public",
"Promise",
"<",
"Void",
">",
"write",
"(",
"ByteBuf",
"buf",
")",
"{",
"return",
"sanitize",
"(",
"ofBlockingRunnable",
"(",
"executor",
",",
"(",
")",
"->",
"{",
"synchronized",
"(",
"mutexLock",
")",
"{",
"try",
"{",
"int",
"writtenBytes",
";... | Writes all bytes of the buffer into this file
at its internal position asynchronously.
@param buf byte buffer to be written | [
"Writes",
"all",
"bytes",
"of",
"the",
"buffer",
"into",
"this",
"file",
"at",
"its",
"internal",
"position",
"asynchronously",
"."
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-promise/src/main/java/io/datakernel/file/AsyncFile.java#L260-L277 | train |
softindex/datakernel | core-promise/src/main/java/io/datakernel/file/AsyncFile.java | AsyncFile.forceAndClose | public Promise<Void> forceAndClose(boolean forceMetadata) {
if (!isOpen()) return Promise.ofException(FILE_CLOSED);
return ofBlockingRunnable(executor, () -> {
try {
channel.force(forceMetadata);
channel.close();
} catch (IOException e) {
throw new UncheckedException(e);
}
});
} | java | public Promise<Void> forceAndClose(boolean forceMetadata) {
if (!isOpen()) return Promise.ofException(FILE_CLOSED);
return ofBlockingRunnable(executor, () -> {
try {
channel.force(forceMetadata);
channel.close();
} catch (IOException e) {
throw new UncheckedException(e);
}
});
} | [
"public",
"Promise",
"<",
"Void",
">",
"forceAndClose",
"(",
"boolean",
"forceMetadata",
")",
"{",
"if",
"(",
"!",
"isOpen",
"(",
")",
")",
"return",
"Promise",
".",
"ofException",
"(",
"FILE_CLOSED",
")",
";",
"return",
"ofBlockingRunnable",
"(",
"executor"... | Forces physical write and then closes the channel
if the file is opened.
@param forceMetadata whether or not to force metadata writes too | [
"Forces",
"physical",
"write",
"and",
"then",
"closes",
"the",
"channel",
"if",
"the",
"file",
"is",
"opened",
"."
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-promise/src/main/java/io/datakernel/file/AsyncFile.java#L367-L377 | train |
softindex/datakernel | core-datastream/src/main/java/io/datakernel/stream/processor/StreamSorterStorageImpl.java | StreamSorterStorageImpl.create | public static <T> StreamSorterStorageImpl<T> create(Executor executor,
BinarySerializer<T> serializer, Path path) {
checkArgument(!path.getFileName().toString().contains("%d"), "Filename should not contain '%d'");
try {
Files.createDirectories(path);
} catch (IOException e) {
throw new UncheckedIOExcepti... | java | public static <T> StreamSorterStorageImpl<T> create(Executor executor,
BinarySerializer<T> serializer, Path path) {
checkArgument(!path.getFileName().toString().contains("%d"), "Filename should not contain '%d'");
try {
Files.createDirectories(path);
} catch (IOException e) {
throw new UncheckedIOExcepti... | [
"public",
"static",
"<",
"T",
">",
"StreamSorterStorageImpl",
"<",
"T",
">",
"create",
"(",
"Executor",
"executor",
",",
"BinarySerializer",
"<",
"T",
">",
"serializer",
",",
"Path",
"path",
")",
"{",
"checkArgument",
"(",
"!",
"path",
".",
"getFileName",
... | Creates a new storage
@param executor executor for running tasks in new thread
@param serializer for serialization to bytes
@param path path in which will store received data | [
"Creates",
"a",
"new",
"storage"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-datastream/src/main/java/io/datakernel/stream/processor/StreamSorterStorageImpl.java#L83-L92 | train |
softindex/datakernel | core-datastream/src/main/java/io/datakernel/stream/processor/StreamSorterStorageImpl.java | StreamSorterStorageImpl.read | @Override
public Promise<StreamSupplier<T>> read(int partition) {
Path path = partitionPath(partition);
return AsyncFile.openAsync(executor, path, set(READ))
.map(file -> ChannelFileReader.readFile(file).withBufferSize(readBlockSize)
.transformWith(ChannelLZ4Decompressor.create())
.transformWith(Ch... | java | @Override
public Promise<StreamSupplier<T>> read(int partition) {
Path path = partitionPath(partition);
return AsyncFile.openAsync(executor, path, set(READ))
.map(file -> ChannelFileReader.readFile(file).withBufferSize(readBlockSize)
.transformWith(ChannelLZ4Decompressor.create())
.transformWith(Ch... | [
"@",
"Override",
"public",
"Promise",
"<",
"StreamSupplier",
"<",
"T",
">",
">",
"read",
"(",
"int",
"partition",
")",
"{",
"Path",
"path",
"=",
"partitionPath",
"(",
"partition",
")",
";",
"return",
"AsyncFile",
".",
"openAsync",
"(",
"executor",
",",
"... | Returns supplier for reading data from this storage. It read it from external memory,
decompresses and deserializes it
@param partition index of partition to read | [
"Returns",
"supplier",
"for",
"reading",
"data",
"from",
"this",
"storage",
".",
"It",
"read",
"it",
"from",
"external",
"memory",
"decompresses",
"and",
"deserializes",
"it"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-datastream/src/main/java/io/datakernel/stream/processor/StreamSorterStorageImpl.java#L146-L154 | train |
softindex/datakernel | core-datastream/src/main/java/io/datakernel/stream/processor/StreamSorterStorageImpl.java | StreamSorterStorageImpl.cleanup | @Override
public Promise<Void> cleanup(List<Integer> partitionsToDelete) {
return Promise.ofBlockingCallable(executor, () -> {
for (Integer partitionToDelete : partitionsToDelete) {
Path path1 = partitionPath(partitionToDelete);
try {
Files.delete(path1);
} catch (IOException e) {
logger.war... | java | @Override
public Promise<Void> cleanup(List<Integer> partitionsToDelete) {
return Promise.ofBlockingCallable(executor, () -> {
for (Integer partitionToDelete : partitionsToDelete) {
Path path1 = partitionPath(partitionToDelete);
try {
Files.delete(path1);
} catch (IOException e) {
logger.war... | [
"@",
"Override",
"public",
"Promise",
"<",
"Void",
">",
"cleanup",
"(",
"List",
"<",
"Integer",
">",
"partitionsToDelete",
")",
"{",
"return",
"Promise",
".",
"ofBlockingCallable",
"(",
"executor",
",",
"(",
")",
"->",
"{",
"for",
"(",
"Integer",
"partitio... | Method which removes all creating files | [
"Method",
"which",
"removes",
"all",
"creating",
"files"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-datastream/src/main/java/io/datakernel/stream/processor/StreamSorterStorageImpl.java#L159-L172 | train |
softindex/datakernel | core-eventloop/src/main/java/io/datakernel/jmx/ValueStats.java | ValueStats.resetStats | @Override
public void resetStats() {
smoothedSum = 0.0;
smoothedSqr = 0.0;
smoothedCount = 0.0;
smoothedMin = 0.0;
smoothedMax = 0.0;
lastMaxInteger = Integer.MIN_VALUE;
lastMinInteger = Integer.MAX_VALUE;
lastSumInteger = 0;
lastSqrInteger = 0;
lastCountInteger = 0;
lastValueInteger = 0;
las... | java | @Override
public void resetStats() {
smoothedSum = 0.0;
smoothedSqr = 0.0;
smoothedCount = 0.0;
smoothedMin = 0.0;
smoothedMax = 0.0;
lastMaxInteger = Integer.MIN_VALUE;
lastMinInteger = Integer.MAX_VALUE;
lastSumInteger = 0;
lastSqrInteger = 0;
lastCountInteger = 0;
lastValueInteger = 0;
las... | [
"@",
"Override",
"public",
"void",
"resetStats",
"(",
")",
"{",
"smoothedSum",
"=",
"0.0",
";",
"smoothedSqr",
"=",
"0.0",
";",
"smoothedCount",
"=",
"0.0",
";",
"smoothedMin",
"=",
"0.0",
";",
"smoothedMax",
"=",
"0.0",
";",
"lastMaxInteger",
"=",
"Intege... | Resets stats and sets new parameters | [
"Resets",
"stats",
"and",
"sets",
"new",
"parameters"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-eventloop/src/main/java/io/datakernel/jmx/ValueStats.java#L232-L266 | train |
softindex/datakernel | core-eventloop/src/main/java/io/datakernel/jmx/ValueStats.java | ValueStats.getSmoothedStandardDeviation | @JmxAttribute(optional = true)
public double getSmoothedStandardDeviation() {
if (totalCount == 0) {
return 0.0;
}
double avg = smoothedSum / smoothedCount;
double variance = smoothedSqr / smoothedCount - avg * avg;
if (variance < 0.0)
variance = 0.0;
return sqrt(variance);
} | java | @JmxAttribute(optional = true)
public double getSmoothedStandardDeviation() {
if (totalCount == 0) {
return 0.0;
}
double avg = smoothedSum / smoothedCount;
double variance = smoothedSqr / smoothedCount - avg * avg;
if (variance < 0.0)
variance = 0.0;
return sqrt(variance);
} | [
"@",
"JmxAttribute",
"(",
"optional",
"=",
"true",
")",
"public",
"double",
"getSmoothedStandardDeviation",
"(",
")",
"{",
"if",
"(",
"totalCount",
"==",
"0",
")",
"{",
"return",
"0.0",
";",
"}",
"double",
"avg",
"=",
"smoothedSum",
"/",
"smoothedCount",
"... | Returns smoothed standard deviation
@return smoothed standard deviation | [
"Returns",
"smoothed",
"standard",
"deviation"
] | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-eventloop/src/main/java/io/datakernel/jmx/ValueStats.java#L544-L555 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.