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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/AsyncInputStream.java | AsyncInputStream.resume | @Override
public AsyncInputStream resume() {
switch (state) {
case STATUS_CLOSED:
throw new IllegalStateException("Cannot resume, already closed");
case STATUS_PAUSED:
state = STATUS_ACTIVE;
doRead();
}
return this;
... | java | @Override
public AsyncInputStream resume() {
switch (state) {
case STATUS_CLOSED:
throw new IllegalStateException("Cannot resume, already closed");
case STATUS_PAUSED:
state = STATUS_ACTIVE;
doRead();
}
return this;
... | [
"@",
"Override",
"public",
"AsyncInputStream",
"resume",
"(",
")",
"{",
"switch",
"(",
"state",
")",
"{",
"case",
"STATUS_CLOSED",
":",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot resume, already closed\"",
")",
";",
"case",
"STATUS_PAUSED",
":",
"stat... | Resumes the reading.
@return the current {@code AsyncInputStream} | [
"Resumes",
"the",
"reading",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/AsyncInputStream.java#L263-L273 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/AsyncInputStream.java | AsyncInputStream.readChunk | private byte[] readChunk() throws Exception {
if (isEndOfInput()) {
return EMPTY_BYTE_ARRAY;
}
try {
// transfer to buffer
byte[] tmp = new byte[chunkSize];
int readBytes = in.read(tmp);
if (readBytes <= 0) {
return nul... | java | private byte[] readChunk() throws Exception {
if (isEndOfInput()) {
return EMPTY_BYTE_ARRAY;
}
try {
// transfer to buffer
byte[] tmp = new byte[chunkSize];
int readBytes = in.read(tmp);
if (readBytes <= 0) {
return nul... | [
"private",
"byte",
"[",
"]",
"readChunk",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isEndOfInput",
"(",
")",
")",
"{",
"return",
"EMPTY_BYTE_ARRAY",
";",
"}",
"try",
"{",
"// transfer to buffer",
"byte",
"[",
"]",
"tmp",
"=",
"new",
"byte",
"[",
... | Reads a chunk.
@return the read bytes, empty if we reached the end of the stream. The returned array has exactly the sisize
of the chunk.
@throws Exception if the stream cannot be read. | [
"Reads",
"a",
"chunk",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/AsyncInputStream.java#L327-L348 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Pipeline.java | Pipeline.watch | public Pipeline watch() {
// Delete all error reports before starting the watcher.
error = new File(baseDir, "target/pipeline");
FileUtils.deleteQuietly(error);
mojo.getLog().debug("Creating the target/pipeline directory : " + error.mkdirs());
// Start the watching process.
... | java | public Pipeline watch() {
// Delete all error reports before starting the watcher.
error = new File(baseDir, "target/pipeline");
FileUtils.deleteQuietly(error);
mojo.getLog().debug("Creating the target/pipeline directory : " + error.mkdirs());
// Start the watching process.
... | [
"public",
"Pipeline",
"watch",
"(",
")",
"{",
"// Delete all error reports before starting the watcher.",
"error",
"=",
"new",
"File",
"(",
"baseDir",
",",
"\"target/pipeline\"",
")",
";",
"FileUtils",
".",
"deleteQuietly",
"(",
"error",
")",
";",
"mojo",
".",
"ge... | Starts the watching.
@return the current pipeline. | [
"Starts",
"the",
"watching",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Pipeline.java#L98-L131 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Pipeline.java | Pipeline.createErrorFile | @SuppressWarnings("unchecked")
private void createErrorFile(Watcher watcher, WatchingException e) {
mojo.getLog().debug("Creating error file for '" + e.getMessage() + "' happening at " + e.getLine() + ":" + e
.getCharacter() + " of " + e.getFile() + ", created by watcher : " + watcher);
... | java | @SuppressWarnings("unchecked")
private void createErrorFile(Watcher watcher, WatchingException e) {
mojo.getLog().debug("Creating error file for '" + e.getMessage() + "' happening at " + e.getLine() + ":" + e
.getCharacter() + " of " + e.getFile() + ", created by watcher : " + watcher);
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"createErrorFile",
"(",
"Watcher",
"watcher",
",",
"WatchingException",
"e",
")",
"{",
"mojo",
".",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"Creating error file for '\"",
"+",
"e",
".",
"g... | Creates the error file storing the information from the given exception in JSON. This file is consumed by the
Wisdom server to generate an error page reporting the watching exception.
@param watcher the watcher having thrown the exception
@param e the exception | [
"Creates",
"the",
"error",
"file",
"storing",
"the",
"information",
"from",
"the",
"given",
"exception",
"in",
"JSON",
".",
"This",
"file",
"is",
"consumed",
"by",
"the",
"Wisdom",
"server",
"to",
"generate",
"an",
"error",
"page",
"reporting",
"the",
"watch... | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Pipeline.java#L172-L203 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Pipeline.java | Pipeline.cleanupErrorFile | private void cleanupErrorFile(Watcher watcher) {
File file = getErrorFileForWatcher(watcher);
FileUtils.deleteQuietly(file);
} | java | private void cleanupErrorFile(Watcher watcher) {
File file = getErrorFileForWatcher(watcher);
FileUtils.deleteQuietly(file);
} | [
"private",
"void",
"cleanupErrorFile",
"(",
"Watcher",
"watcher",
")",
"{",
"File",
"file",
"=",
"getErrorFileForWatcher",
"(",
"watcher",
")",
";",
"FileUtils",
".",
"deleteQuietly",
"(",
"file",
")",
";",
"}"
] | Method called on each event before the processing, deleting the error file is this file exists.
@param watcher the watcher | [
"Method",
"called",
"on",
"each",
"event",
"before",
"the",
"processing",
"deleting",
"the",
"error",
"file",
"is",
"this",
"file",
"exists",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Pipeline.java#L210-L213 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Pipeline.java | Pipeline.onFileChange | public void onFileChange(File file) {
mojo.getLog().info(EMPTY_STRING);
mojo.getLog().info("The watcher has detected a change in " + file.getAbsolutePath());
mojo.getLog().info(EMPTY_STRING);
for (Watcher watcher : watchers) {
if (watcher.accept(file)) {
clean... | java | public void onFileChange(File file) {
mojo.getLog().info(EMPTY_STRING);
mojo.getLog().info("The watcher has detected a change in " + file.getAbsolutePath());
mojo.getLog().info(EMPTY_STRING);
for (Watcher watcher : watchers) {
if (watcher.accept(file)) {
clean... | [
"public",
"void",
"onFileChange",
"(",
"File",
"file",
")",
"{",
"mojo",
".",
"getLog",
"(",
")",
".",
"info",
"(",
"EMPTY_STRING",
")",
";",
"mojo",
".",
"getLog",
"(",
")",
".",
"info",
"(",
"\"The watcher has detected a change in \"",
"+",
"file",
".",
... | The FAM has detected a change in a file. It dispatches this event to the watchers plugged on the current
pipeline.
@param file the updated file | [
"The",
"FAM",
"has",
"detected",
"a",
"change",
"in",
"a",
"file",
".",
"It",
"dispatches",
"this",
"event",
"to",
"the",
"watchers",
"plugged",
"on",
"the",
"current",
"pipeline",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Pipeline.java#L229-L254 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/utils/KnownMimeTypes.java | KnownMimeTypes.addMimeToCompressedWithExtension | private static void addMimeToCompressedWithExtension(String extension) {
String mime = EXTENSIONS.get(extension);
if (mime != null && !COMPRESSED_MIME.contains(mime)) {
COMPRESSED_MIME.add(mime);
}
} | java | private static void addMimeToCompressedWithExtension(String extension) {
String mime = EXTENSIONS.get(extension);
if (mime != null && !COMPRESSED_MIME.contains(mime)) {
COMPRESSED_MIME.add(mime);
}
} | [
"private",
"static",
"void",
"addMimeToCompressedWithExtension",
"(",
"String",
"extension",
")",
"{",
"String",
"mime",
"=",
"EXTENSIONS",
".",
"get",
"(",
"extension",
")",
";",
"if",
"(",
"mime",
"!=",
"null",
"&&",
"!",
"COMPRESSED_MIME",
".",
"contains",
... | Adds a mime-type to the compressed list.
@param extension the extension, without the "." | [
"Adds",
"a",
"mime",
"-",
"type",
"to",
"the",
"compressed",
"list",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/utils/KnownMimeTypes.java#L131-L136 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/utils/KnownMimeTypes.java | KnownMimeTypes.addMimeGroups | private static void addMimeGroups(String... groups) {
for (String mimeType : EXTENSIONS.values()) {
for (String group : groups) {
if (mimeType.startsWith(group) && !COMPRESSED_MIME.contains(mimeType)) {
COMPRESSED_MIME.add(mimeType);
}
... | java | private static void addMimeGroups(String... groups) {
for (String mimeType : EXTENSIONS.values()) {
for (String group : groups) {
if (mimeType.startsWith(group) && !COMPRESSED_MIME.contains(mimeType)) {
COMPRESSED_MIME.add(mimeType);
}
... | [
"private",
"static",
"void",
"addMimeGroups",
"(",
"String",
"...",
"groups",
")",
"{",
"for",
"(",
"String",
"mimeType",
":",
"EXTENSIONS",
".",
"values",
"(",
")",
")",
"{",
"for",
"(",
"String",
"group",
":",
"groups",
")",
"{",
"if",
"(",
"mimeType... | Adds a group to the compressed list.
@param groups the groups | [
"Adds",
"a",
"group",
"to",
"the",
"compressed",
"list",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/utils/KnownMimeTypes.java#L143-L151 | train |
wisdom-framework/wisdom | core/wisdom-executors/src/main/java/org/wisdom/executors/scheduler/Job.java | Job.function | public Runnable function() {
return new Runnable() {
@Override
public void run() {
try {
method.invoke(scheduled);
} catch (IllegalAccessException e) {
WisdomTaskScheduler.getLogger().error("Error while accessing to ... | java | public Runnable function() {
return new Runnable() {
@Override
public void run() {
try {
method.invoke(scheduled);
} catch (IllegalAccessException e) {
WisdomTaskScheduler.getLogger().error("Error while accessing to ... | [
"public",
"Runnable",
"function",
"(",
")",
"{",
"return",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"method",
".",
"invoke",
"(",
"scheduled",
")",
";",
"}",
"catch",
"(",
"IllegalAccessExce... | Gets the runnable invoking the scheduled method.
@return the runnable. | [
"Gets",
"the",
"runnable",
"invoking",
"the",
"scheduled",
"method",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-executors/src/main/java/org/wisdom/executors/scheduler/Job.java#L118-L133 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/BalancerFilter.java | BalancerFilter.updateHeaders | @Override
public void updateHeaders(RequestContext context, Multimap<String, String> headers) {
if (!proxyPassReverse) {
return;
}
for (Map.Entry<String, String> h : new LinkedHashSet<>(headers.entries())) {
if (REVERSE_PROXY_HEADERS.contains(h.getKey())) {
... | java | @Override
public void updateHeaders(RequestContext context, Multimap<String, String> headers) {
if (!proxyPassReverse) {
return;
}
for (Map.Entry<String, String> h : new LinkedHashSet<>(headers.entries())) {
if (REVERSE_PROXY_HEADERS.contains(h.getKey())) {
... | [
"@",
"Override",
"public",
"void",
"updateHeaders",
"(",
"RequestContext",
"context",
",",
"Multimap",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"if",
"(",
"!",
"proxyPassReverse",
")",
"{",
"return",
";",
"}",
"for",
"(",
"Map",
".",
"Entr... | Callback that can be overridden to customize the header ot the request. This method implements the reverse
routing. It updates URLs contained in the headers.
@param context the request context
@param headers the current set of headers, that need to be modified | [
"Callback",
"that",
"can",
"be",
"overridden",
"to",
"customize",
"the",
"header",
"ot",
"the",
"request",
".",
"This",
"method",
"implements",
"the",
"reverse",
"routing",
".",
"It",
"updates",
"URLs",
"contained",
"in",
"the",
"headers",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/BalancerFilter.java#L202-L225 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/BalancerFilter.java | BalancerFilter.addMember | public synchronized void addMember(BalancerMember member) {
if (member.getBalancerName().equals(name)) {
logger.info("Adding balancer member '{}' to balancer '{}'", member.getName(), name);
members.add(member);
}
} | java | public synchronized void addMember(BalancerMember member) {
if (member.getBalancerName().equals(name)) {
logger.info("Adding balancer member '{}' to balancer '{}'", member.getName(), name);
members.add(member);
}
} | [
"public",
"synchronized",
"void",
"addMember",
"(",
"BalancerMember",
"member",
")",
"{",
"if",
"(",
"member",
".",
"getBalancerName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Adding balancer member '{}' to balancer '{}... | Adds a new member.
@param member the member. | [
"Adds",
"a",
"new",
"member",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/BalancerFilter.java#L293-L298 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/BalancerFilter.java | BalancerFilter.removeMember | public synchronized void removeMember(BalancerMember member) {
if (members.remove(member)) {
logger.info("Removing balancer member '{}' from balancer '{}'", member.getName(), name);
}
} | java | public synchronized void removeMember(BalancerMember member) {
if (members.remove(member)) {
logger.info("Removing balancer member '{}' from balancer '{}'", member.getName(), name);
}
} | [
"public",
"synchronized",
"void",
"removeMember",
"(",
"BalancerMember",
"member",
")",
"{",
"if",
"(",
"members",
".",
"remove",
"(",
"member",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Removing balancer member '{}' from balancer '{}'\"",
",",
"member",
".",
... | Removes a member.
@param member the member. | [
"Removes",
"a",
"member",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/BalancerFilter.java#L305-L309 | train |
wisdom-framework/wisdom | framework/i18n-service/src/main/java/org/wisdom/i18n/InternationalizationServiceSingleton.java | InternationalizationServiceSingleton.bundles | @Override
public Collection<ResourceBundle> bundles() {
Set<ResourceBundle> bundles = new LinkedHashSet<>();
for (I18nExtension extension : extensions) {
bundles.add(extension.bundle());
}
return bundles;
} | java | @Override
public Collection<ResourceBundle> bundles() {
Set<ResourceBundle> bundles = new LinkedHashSet<>();
for (I18nExtension extension : extensions) {
bundles.add(extension.bundle());
}
return bundles;
} | [
"@",
"Override",
"public",
"Collection",
"<",
"ResourceBundle",
">",
"bundles",
"(",
")",
"{",
"Set",
"<",
"ResourceBundle",
">",
"bundles",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
"I18nExtension",
"extension",
":",
"extensions",
")",
... | Retrieves the set of resource bundles handled by the system.
@return the set of resource bundle, empty if none. | [
"Retrieves",
"the",
"set",
"of",
"resource",
"bundles",
"handled",
"by",
"the",
"system",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/i18n-service/src/main/java/org/wisdom/i18n/InternationalizationServiceSingleton.java#L111-L118 | train |
wisdom-framework/wisdom | framework/i18n-service/src/main/java/org/wisdom/i18n/InternationalizationServiceSingleton.java | InternationalizationServiceSingleton.bundles | @Override
public Collection<ResourceBundle> bundles(Locale locale) {
Set<ResourceBundle> bundles = new LinkedHashSet<>();
for (I18nExtension extension : extensions) {
if (extension.locale().equals(locale)) {
bundles.add(extension.bundle());
}
}
... | java | @Override
public Collection<ResourceBundle> bundles(Locale locale) {
Set<ResourceBundle> bundles = new LinkedHashSet<>();
for (I18nExtension extension : extensions) {
if (extension.locale().equals(locale)) {
bundles.add(extension.bundle());
}
}
... | [
"@",
"Override",
"public",
"Collection",
"<",
"ResourceBundle",
">",
"bundles",
"(",
"Locale",
"locale",
")",
"{",
"Set",
"<",
"ResourceBundle",
">",
"bundles",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
"I18nExtension",
"extension",
":",
... | Retrieves the set of resource bundles handled by the system providing messages for the given locale.
@param locale the locale
@return the set of resource bundle, empty if none. | [
"Retrieves",
"the",
"set",
"of",
"resource",
"bundles",
"handled",
"by",
"the",
"system",
"providing",
"messages",
"for",
"the",
"given",
"locale",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/i18n-service/src/main/java/org/wisdom/i18n/InternationalizationServiceSingleton.java#L126-L135 | train |
wisdom-framework/wisdom | framework/i18n-service/src/main/java/org/wisdom/i18n/InternationalizationServiceSingleton.java | InternationalizationServiceSingleton.etag | @Override
public String etag(Locale locale) {
String etag = etags.get(locale);
if (etag == null) {
// We don't have a stored etag, that means we don't have messages. We returns 0.
// There is a potential race condition here:
// We retrieve the etag get 0, but when... | java | @Override
public String etag(Locale locale) {
String etag = etags.get(locale);
if (etag == null) {
// We don't have a stored etag, that means we don't have messages. We returns 0.
// There is a potential race condition here:
// We retrieve the etag get 0, but when... | [
"@",
"Override",
"public",
"String",
"etag",
"(",
"Locale",
"locale",
")",
"{",
"String",
"etag",
"=",
"etags",
".",
"get",
"(",
"locale",
")",
";",
"if",
"(",
"etag",
"==",
"null",
")",
"{",
"// We don't have a stored etag, that means we don't have messages. We... | Retrieves the ETAG for the given locale.
@param locale the locale
@return the computed etag, must not be {@code null} or empty | [
"Retrieves",
"the",
"ETAG",
"for",
"the",
"given",
"locale",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/i18n-service/src/main/java/org/wisdom/i18n/InternationalizationServiceSingleton.java#L232-L245 | train |
wisdom-framework/wisdom | extensions/wisdom-instantiatedby/src/main/java/org/wisdom/framework/instances/InstantiatedByManager.java | InstantiatedByManager.bindFactory | @Bind(aggregate = true)
public void bindFactory(Factory factory) {
// Only support primitive component
if (!(factory instanceof ComponentFactory)) {
return;
}
String cn = factory.getClassName();
if (cn == null) {
return;
}
// Has the... | java | @Bind(aggregate = true)
public void bindFactory(Factory factory) {
// Only support primitive component
if (!(factory instanceof ComponentFactory)) {
return;
}
String cn = factory.getClassName();
if (cn == null) {
return;
}
// Has the... | [
"@",
"Bind",
"(",
"aggregate",
"=",
"true",
")",
"public",
"void",
"bindFactory",
"(",
"Factory",
"factory",
")",
"{",
"// Only support primitive component",
"if",
"(",
"!",
"(",
"factory",
"instanceof",
"ComponentFactory",
")",
")",
"{",
"return",
";",
"}",
... | Bind a factory.
@param factory the factory | [
"Bind",
"a",
"factory",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-instantiatedby/src/main/java/org/wisdom/framework/instances/InstantiatedByManager.java#L68-L97 | train |
wisdom-framework/wisdom | extensions/wisdom-instantiatedby/src/main/java/org/wisdom/framework/instances/InstantiatedByManager.java | InstantiatedByManager.unbindFactory | @Unbind
public void unbindFactory(Factory factory) {
try {
lock.lock();
InstanceDeclaration declaration = getDeclarationByFactory(factory);
if (declaration != null) {
LOGGER.info("Disposing instance created by");
declaration.dispose();
... | java | @Unbind
public void unbindFactory(Factory factory) {
try {
lock.lock();
InstanceDeclaration declaration = getDeclarationByFactory(factory);
if (declaration != null) {
LOGGER.info("Disposing instance created by");
declaration.dispose();
... | [
"@",
"Unbind",
"public",
"void",
"unbindFactory",
"(",
"Factory",
"factory",
")",
"{",
"try",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"InstanceDeclaration",
"declaration",
"=",
"getDeclarationByFactory",
"(",
"factory",
")",
";",
"if",
"(",
"declaration",
"... | Unbinds a factory.
@param factory the factory | [
"Unbinds",
"a",
"factory",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-instantiatedby/src/main/java/org/wisdom/framework/instances/InstantiatedByManager.java#L104-L117 | train |
wisdom-framework/wisdom | extensions/wisdom-instantiatedby/src/main/java/org/wisdom/framework/instances/InstantiatedByManager.java | InstantiatedByManager.configurationEvent | @Override
public void configurationEvent(ConfigurationEvent event) {
LOGGER.debug("event received : " + event.getPid() + " - " + event.getType());
try {
lock.lock();
final List<InstanceDeclaration> impacted
= getDeclarationsByConfiguration(event.getPid(), ... | java | @Override
public void configurationEvent(ConfigurationEvent event) {
LOGGER.debug("event received : " + event.getPid() + " - " + event.getType());
try {
lock.lock();
final List<InstanceDeclaration> impacted
= getDeclarationsByConfiguration(event.getPid(), ... | [
"@",
"Override",
"public",
"void",
"configurationEvent",
"(",
"ConfigurationEvent",
"event",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"event received : \"",
"+",
"event",
".",
"getPid",
"(",
")",
"+",
"\" - \"",
"+",
"event",
".",
"getType",
"(",
")",
")",
... | Receives a configuration event.
@param event the event. | [
"Receives",
"a",
"configuration",
"event",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-instantiatedby/src/main/java/org/wisdom/framework/instances/InstantiatedByManager.java#L186-L222 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/ipojo/FactoryModel.java | FactoryModel.factories | public static List<FactoryModel> factories(BundleContext context) {
List<FactoryModel> factories = new ArrayList<FactoryModel>();
try {
for (ServiceReference ref : context.getServiceReferences(Factory.class, null)) {
factories.add(new FactoryModel((Factory) context.getService... | java | public static List<FactoryModel> factories(BundleContext context) {
List<FactoryModel> factories = new ArrayList<FactoryModel>();
try {
for (ServiceReference ref : context.getServiceReferences(Factory.class, null)) {
factories.add(new FactoryModel((Factory) context.getService... | [
"public",
"static",
"List",
"<",
"FactoryModel",
">",
"factories",
"(",
"BundleContext",
"context",
")",
"{",
"List",
"<",
"FactoryModel",
">",
"factories",
"=",
"new",
"ArrayList",
"<",
"FactoryModel",
">",
"(",
")",
";",
"try",
"{",
"for",
"(",
"ServiceR... | Creates a list of factory model from the factory exposed. These factories are retrieved from the bundle context.
@param context the context
@return the list of factory model | [
"Creates",
"a",
"list",
"of",
"factory",
"model",
"from",
"the",
"factory",
"exposed",
".",
"These",
"factories",
"are",
"retrieved",
"from",
"the",
"bundle",
"context",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/ipojo/FactoryModel.java#L43-L56 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/router/RouteUtils.java | RouteUtils.getPrefixedUri | public static String getPrefixedUri(String prefix, String uri) {
String localURI = uri;
if (localURI.length() > 0) {
// Put a / between the prefix and the tail only if:
// the prefix does not ends with a /
// the tail does not start with a /
// the tail st... | java | public static String getPrefixedUri(String prefix, String uri) {
String localURI = uri;
if (localURI.length() > 0) {
// Put a / between the prefix and the tail only if:
// the prefix does not ends with a /
// the tail does not start with a /
// the tail st... | [
"public",
"static",
"String",
"getPrefixedUri",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"{",
"String",
"localURI",
"=",
"uri",
";",
"if",
"(",
"localURI",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"// Put a / between the prefix and the tail only... | Prepends the given prefix to the given uri.
@param prefix the prefix
@param uri the uri
@return the full uri | [
"Prepends",
"the",
"given",
"prefix",
"to",
"the",
"given",
"uri",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/RouteUtils.java#L204-L223 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/router/RouteUtils.java | RouteUtils.buildActionParameterList | public static List<ActionParameter> buildActionParameterList(Method method) {
List<ActionParameter> arguments = new ArrayList<>();
Annotation[][] annotations = method.getParameterAnnotations();
Class<?>[] typesOfParameters = method.getParameterTypes();
Type[] genericTypeOfParameters = me... | java | public static List<ActionParameter> buildActionParameterList(Method method) {
List<ActionParameter> arguments = new ArrayList<>();
Annotation[][] annotations = method.getParameterAnnotations();
Class<?>[] typesOfParameters = method.getParameterTypes();
Type[] genericTypeOfParameters = me... | [
"public",
"static",
"List",
"<",
"ActionParameter",
">",
"buildActionParameterList",
"(",
"Method",
"method",
")",
"{",
"List",
"<",
"ActionParameter",
">",
"arguments",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Annotation",
"[",
"]",
"[",
"]",
"annotat... | Gets the list of Argument, i.e. formal parameter metadata for the given method.
@param method the method
@return the list of arguments | [
"Gets",
"the",
"list",
"of",
"Argument",
"i",
".",
"e",
".",
"formal",
"parameter",
"metadata",
"for",
"the",
"given",
"method",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/RouteUtils.java#L231-L241 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/router/parameters/ActionParameter.java | ActionParameter.from | public static ActionParameter from(Member member, Annotation[] annotations, Class<?> rawType,
Type genericType) {
ActionParameter parameter = null;
String defaultValue = null;
for (Annotation annotation : annotations) {
if (annotation instanceof... | java | public static ActionParameter from(Member member, Annotation[] annotations, Class<?> rawType,
Type genericType) {
ActionParameter parameter = null;
String defaultValue = null;
for (Annotation annotation : annotations) {
if (annotation instanceof... | [
"public",
"static",
"ActionParameter",
"from",
"(",
"Member",
"member",
",",
"Annotation",
"[",
"]",
"annotations",
",",
"Class",
"<",
"?",
">",
"rawType",
",",
"Type",
"genericType",
")",
"{",
"ActionParameter",
"parameter",
"=",
"null",
";",
"String",
"def... | Creates a new action parameter instance from the given parameter. Action Parameter contain the metadata of a
specific method or constructor parameter to identify the injected data.
@param member the constructor or method having the analyzed parameter.
@param annotations the parameter's annotations
@param rawType ... | [
"Creates",
"a",
"new",
"action",
"parameter",
"instance",
"from",
"the",
"given",
"parameter",
".",
"Action",
"Parameter",
"contain",
"the",
"metadata",
"of",
"a",
"specific",
"method",
"or",
"constructor",
"parameter",
"to",
"identify",
"the",
"injected",
"data... | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/parameters/ActionParameter.java#L198-L223 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/Packages.java | Packages.toClause | public static String toClause(List<String> packages) {
return Joiner.on(", ").skipNulls().join(packages);
} | java | public static String toClause(List<String> packages) {
return Joiner.on(", ").skipNulls().join(packages);
} | [
"public",
"static",
"String",
"toClause",
"(",
"List",
"<",
"String",
">",
"packages",
")",
"{",
"return",
"Joiner",
".",
"on",
"(",
"\", \"",
")",
".",
"skipNulls",
"(",
")",
".",
"join",
"(",
"packages",
")",
";",
"}"
] | Computes the BND clause from the given set of packages.
@param packages the packages
@return the clause | [
"Computes",
"the",
"BND",
"clause",
"from",
"the",
"given",
"set",
"of",
"packages",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/Packages.java#L44-L46 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/Packages.java | Packages.shouldBeExported | public static boolean shouldBeExported(String packageName) {
boolean service = packageName.endsWith(".service");
service = service
|| packageName.contains(".service.")
|| packageName.endsWith(".services")
|| packageName.contains(".services.");
boo... | java | public static boolean shouldBeExported(String packageName) {
boolean service = packageName.endsWith(".service");
service = service
|| packageName.contains(".service.")
|| packageName.endsWith(".services")
|| packageName.contains(".services.");
boo... | [
"public",
"static",
"boolean",
"shouldBeExported",
"(",
"String",
"packageName",
")",
"{",
"boolean",
"service",
"=",
"packageName",
".",
"endsWith",
"(",
"\".service\"",
")",
";",
"service",
"=",
"service",
"||",
"packageName",
".",
"contains",
"(",
"\".service... | Checks whether the given package must be exported. The decision is made from heuristics.
@param packageName the package name
@return {@literal true} if the package has to be exported, {@literal false} otherwise. | [
"Checks",
"whether",
"the",
"given",
"package",
"must",
"be",
"exported",
".",
"The",
"decision",
"is",
"made",
"from",
"heuristics",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/Packages.java#L74-L100 | train |
wisdom-framework/wisdom | framework/hibernate-validation-service/src/main/java/org/wisdom/validation/hibernate/HibernateValidatorService.java | HibernateValidatorService.tearDown | @Invalidate
public void tearDown() {
if (registration != null) {
registration.unregister();
registration = null;
}
if (factoryRegistration != null) {
factoryRegistration.unregister();
factoryRegistration = null;
}
} | java | @Invalidate
public void tearDown() {
if (registration != null) {
registration.unregister();
registration = null;
}
if (factoryRegistration != null) {
factoryRegistration.unregister();
factoryRegistration = null;
}
} | [
"@",
"Invalidate",
"public",
"void",
"tearDown",
"(",
")",
"{",
"if",
"(",
"registration",
"!=",
"null",
")",
"{",
"registration",
".",
"unregister",
"(",
")",
";",
"registration",
"=",
"null",
";",
"}",
"if",
"(",
"factoryRegistration",
"!=",
"null",
")... | Unregisters the validator service. | [
"Unregisters",
"the",
"validator",
"service",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/hibernate-validation-service/src/main/java/org/wisdom/validation/hibernate/HibernateValidatorService.java#L98-L108 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java | CacheUtils.addLastModified | public static void addLastModified(Result result, long lastModified) {
result.with(HeaderNames.LAST_MODIFIED, DateUtil.formatForHttpHeader(lastModified));
} | java | public static void addLastModified(Result result, long lastModified) {
result.with(HeaderNames.LAST_MODIFIED, DateUtil.formatForHttpHeader(lastModified));
} | [
"public",
"static",
"void",
"addLastModified",
"(",
"Result",
"result",
",",
"long",
"lastModified",
")",
"{",
"result",
".",
"with",
"(",
"HeaderNames",
".",
"LAST_MODIFIED",
",",
"DateUtil",
".",
"formatForHttpHeader",
"(",
"lastModified",
")",
")",
";",
"}"... | Add the last modified header to the given result. This method handle the HTTP Date format.
@param result the result
@param lastModified the date | [
"Add",
"the",
"last",
"modified",
"header",
"to",
"the",
"given",
"result",
".",
"This",
"method",
"handle",
"the",
"HTTP",
"Date",
"format",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java#L61-L63 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java | CacheUtils.isNotModified | public static boolean isNotModified(Context context, long lastModified, String etag) {
// First check etag. Important, if there is an If-None-Match header, we MUST not check the
// If-Modified-Since header, regardless of whether If-None-Match matches or not. This is in
// accordance with section... | java | public static boolean isNotModified(Context context, long lastModified, String etag) {
// First check etag. Important, if there is an If-None-Match header, we MUST not check the
// If-Modified-Since header, regardless of whether If-None-Match matches or not. This is in
// accordance with section... | [
"public",
"static",
"boolean",
"isNotModified",
"(",
"Context",
"context",
",",
"long",
"lastModified",
",",
"String",
"etag",
")",
"{",
"// First check etag. Important, if there is an If-None-Match header, we MUST not check the",
"// If-Modified-Since header, regardless of whether I... | Check whether the request can send a NOT_MODIFIED response.
@param context the context
@param lastModified the last modification date
@param etag the etag.
@return true if the content is modified | [
"Check",
"whether",
"the",
"request",
"can",
"send",
"a",
"NOT_MODIFIED",
"response",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java#L73-L100 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java | CacheUtils.computeEtag | public static String computeEtag(long lastModification, ApplicationConfiguration configuration, Crypto crypto) {
boolean useEtag = configuration.getBooleanWithDefault(HTTP_USE_ETAG,
HTTP_USE_ETAG_DEFAULT);
if (!useEtag) {
return null;
}
String raw = Long.toStr... | java | public static String computeEtag(long lastModification, ApplicationConfiguration configuration, Crypto crypto) {
boolean useEtag = configuration.getBooleanWithDefault(HTTP_USE_ETAG,
HTTP_USE_ETAG_DEFAULT);
if (!useEtag) {
return null;
}
String raw = Long.toStr... | [
"public",
"static",
"String",
"computeEtag",
"(",
"long",
"lastModification",
",",
"ApplicationConfiguration",
"configuration",
",",
"Crypto",
"crypto",
")",
"{",
"boolean",
"useEtag",
"=",
"configuration",
".",
"getBooleanWithDefault",
"(",
"HTTP_USE_ETAG",
",",
"HTT... | Computes the ETAG value based on the last modification date passed as parameter.
@param lastModification the last modification (must be valid)
@param configuration the configuration
@param crypto the crypto service
@return the encoded etag | [
"Computes",
"the",
"ETAG",
"value",
"based",
"on",
"the",
"last",
"modification",
"date",
"passed",
"as",
"parameter",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java#L110-L118 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java | CacheUtils.addCacheControlAndEtagToResult | public static void addCacheControlAndEtagToResult(Result result, String etag, ApplicationConfiguration configuration) {
String maxAge = configuration.getWithDefault(HTTP_CACHE_CONTROL_MAX_AGE,
HTTP_CACHE_CONTROL_DEFAULT);
if ("0".equals(maxAge)) {
result.with(HeaderNames.CAC... | java | public static void addCacheControlAndEtagToResult(Result result, String etag, ApplicationConfiguration configuration) {
String maxAge = configuration.getWithDefault(HTTP_CACHE_CONTROL_MAX_AGE,
HTTP_CACHE_CONTROL_DEFAULT);
if ("0".equals(maxAge)) {
result.with(HeaderNames.CAC... | [
"public",
"static",
"void",
"addCacheControlAndEtagToResult",
"(",
"Result",
"result",
",",
"String",
"etag",
",",
"ApplicationConfiguration",
"configuration",
")",
"{",
"String",
"maxAge",
"=",
"configuration",
".",
"getWithDefault",
"(",
"HTTP_CACHE_CONTROL_MAX_AGE",
... | Adds cache control and etag to the given result.
@param result the result
@param etag the etag
@param configuration the application configuration | [
"Adds",
"cache",
"control",
"and",
"etag",
"to",
"the",
"given",
"result",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java#L127-L144 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java | CacheUtils.fromFile | public static Result fromFile(File file, Context context, ApplicationConfiguration configuration, Crypto crypto) {
long lastModified = file.lastModified();
String etag = computeEtag(lastModified, configuration, crypto);
if (isNotModified(context, lastModified, etag)) {
return new Res... | java | public static Result fromFile(File file, Context context, ApplicationConfiguration configuration, Crypto crypto) {
long lastModified = file.lastModified();
String etag = computeEtag(lastModified, configuration, crypto);
if (isNotModified(context, lastModified, etag)) {
return new Res... | [
"public",
"static",
"Result",
"fromFile",
"(",
"File",
"file",
",",
"Context",
"context",
",",
"ApplicationConfiguration",
"configuration",
",",
"Crypto",
"crypto",
")",
"{",
"long",
"lastModified",
"=",
"file",
".",
"lastModified",
"(",
")",
";",
"String",
"e... | Computes the result to sent the given file. Cache headers are automatically set by this method.
@param file the file to send to the client
@param context the context
@param configuration the application configuration
@param crypto the crypto service
@return the result, it can be a NOT_MODIFIED if... | [
"Computes",
"the",
"result",
"to",
"sent",
"the",
"given",
"file",
".",
"Cache",
"headers",
"are",
"automatically",
"set",
"by",
"this",
"method",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java#L156-L167 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/Properties2HoconConverter.java | Properties2HoconConverter.convertToHocon | public static String convertToHocon(File props) throws IOException {
StringBuilder output = new StringBuilder();
List<String> lines = FileUtils.readLines(props);
boolean readingValue = false;
for (String line : lines) {
if (isComment(line)) {
// Comment
... | java | public static String convertToHocon(File props) throws IOException {
StringBuilder output = new StringBuilder();
List<String> lines = FileUtils.readLines(props);
boolean readingValue = false;
for (String line : lines) {
if (isComment(line)) {
// Comment
... | [
"public",
"static",
"String",
"convertToHocon",
"(",
"File",
"props",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"output",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"List",
"<",
"String",
">",
"lines",
"=",
"FileUtils",
".",
"readLines",
"(",
"pro... | Generates the hocon string resulting from the conversion of the given properties file.
@param props the properties file, must exist and be a valid properties file.
@return the converted configuration (hocon format).
@throws IOException | [
"Generates",
"the",
"hocon",
"string",
"resulting",
"from",
"the",
"conversion",
"of",
"the",
"given",
"properties",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/Properties2HoconConverter.java#L117-L181 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/ConfBasedCorsFilter.java | ConfBasedCorsFilter.activate | @Validate
public void activate() {
active = configuration.getBooleanWithDefault(CORS_FILTER_ENABLED, false);
extraHeaders = configuration.getList(CORS_FILTER_ALLOW_HEADERS);
allowedHosts = configuration.getList(CORS_FILTER_ALLOW_ORIGIN);
allowCredentials = configuration.getBooleanWit... | java | @Validate
public void activate() {
active = configuration.getBooleanWithDefault(CORS_FILTER_ENABLED, false);
extraHeaders = configuration.getList(CORS_FILTER_ALLOW_HEADERS);
allowedHosts = configuration.getList(CORS_FILTER_ALLOW_ORIGIN);
allowCredentials = configuration.getBooleanWit... | [
"@",
"Validate",
"public",
"void",
"activate",
"(",
")",
"{",
"active",
"=",
"configuration",
".",
"getBooleanWithDefault",
"(",
"CORS_FILTER_ENABLED",
",",
"false",
")",
";",
"extraHeaders",
"=",
"configuration",
".",
"getList",
"(",
"CORS_FILTER_ALLOW_HEADERS",
... | Initialisation method. It checks whether the CORS support needs to be enabled or not. | [
"Initialisation",
"method",
".",
"It",
"checks",
"whether",
"the",
"CORS",
"support",
"needs",
"to",
"be",
"enabled",
"or",
"not",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/ConfBasedCorsFilter.java#L77-L87 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DefaultMaven2OsgiConverter.java | DefaultMaven2OsgiConverter.cleanupVersion | public static String cleanupVersion(String version) {
StringBuilder result = new StringBuilder();
Matcher m = FUZZY_VERSION.matcher(version);
if (m.matches()) {
String major = m.group(1);
String minor = m.group(3);
String micro = m.group(5);
String... | java | public static String cleanupVersion(String version) {
StringBuilder result = new StringBuilder();
Matcher m = FUZZY_VERSION.matcher(version);
if (m.matches()) {
String major = m.group(1);
String minor = m.group(3);
String micro = m.group(5);
String... | [
"public",
"static",
"String",
"cleanupVersion",
"(",
"String",
"version",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Matcher",
"m",
"=",
"FUZZY_VERSION",
".",
"matcher",
"(",
"version",
")",
";",
"if",
"(",
"m",
".",
... | Cleans up the version to be OSGi compliant.
@param version a Maven version
@return the OSGi version computed from the given Maven version. | [
"Cleans",
"up",
"the",
"version",
"to",
"be",
"OSGi",
"compliant",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DefaultMaven2OsgiConverter.java#L160-L199 | train |
wisdom-framework/wisdom | documentation/samples/src/main/java/org/wisdom/samples/session/SessionController.java | SessionController.clear | @Route(method = HttpMethod.POST, uri = "/session/clear")
public Result clear() {
session().clear();
return redirect(router.getReverseRouteFor(this, "index"));
} | java | @Route(method = HttpMethod.POST, uri = "/session/clear")
public Result clear() {
session().clear();
return redirect(router.getReverseRouteFor(this, "index"));
} | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"POST",
",",
"uri",
"=",
"\"/session/clear\"",
")",
"public",
"Result",
"clear",
"(",
")",
"{",
"session",
"(",
")",
".",
"clear",
"(",
")",
";",
"return",
"redirect",
"(",
"router",
".",
"getReverse... | Action called to clear the session | [
"Action",
"called",
"to",
"clear",
"the",
"session"
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/documentation/samples/src/main/java/org/wisdom/samples/session/SessionController.java#L58-L62 | train |
wisdom-framework/wisdom | documentation/samples/src/main/java/org/wisdom/samples/session/SessionController.java | SessionController.populate | @Route(method = HttpMethod.POST, uri = "/session/populate")
public Result populate() {
session().put("createdBy", "wisdom");
session().put("at", DateFormat.getDateTimeInstance().format(new Date()));
return redirect(router.getReverseRouteFor(this, "index"));
} | java | @Route(method = HttpMethod.POST, uri = "/session/populate")
public Result populate() {
session().put("createdBy", "wisdom");
session().put("at", DateFormat.getDateTimeInstance().format(new Date()));
return redirect(router.getReverseRouteFor(this, "index"));
} | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"POST",
",",
"uri",
"=",
"\"/session/populate\"",
")",
"public",
"Result",
"populate",
"(",
")",
"{",
"session",
"(",
")",
".",
"put",
"(",
"\"createdBy\"",
",",
"\"wisdom\"",
")",
";",
"session",
"(",... | Action called to populate the session | [
"Action",
"called",
"to",
"populate",
"the",
"session"
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/documentation/samples/src/main/java/org/wisdom/samples/session/SessionController.java#L67-L72 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/AbstractCorsFilter.java | AbstractCorsFilter.call | public Result call(Route route, RequestContext context) throws Exception {
// Is CORS required?
String originHeader = context.request().getHeader(ORIGIN);
if (originHeader != null) {
originHeader = originHeader.toLowerCase();
}
// If not Preflight
if (route.... | java | public Result call(Route route, RequestContext context) throws Exception {
// Is CORS required?
String originHeader = context.request().getHeader(ORIGIN);
if (originHeader != null) {
originHeader = originHeader.toLowerCase();
}
// If not Preflight
if (route.... | [
"public",
"Result",
"call",
"(",
"Route",
"route",
",",
"RequestContext",
"context",
")",
"throws",
"Exception",
"{",
"// Is CORS required?",
"String",
"originHeader",
"=",
"context",
".",
"request",
"(",
")",
".",
"getHeader",
"(",
"ORIGIN",
")",
";",
"if",
... | Interception method.
It checks whether or not the request requires CORS support or not. It also checks whether the requests is allowed
or not.
@param route the router
@param context the filter context
@return the result, containing the CORS headers as defined in the recommendation
@throws Exception if the result can... | [
"Interception",
"method",
".",
"It",
"checks",
"whether",
"or",
"not",
"the",
"request",
"requires",
"CORS",
"support",
"or",
"not",
".",
"It",
"also",
"checks",
"whether",
"the",
"requests",
"is",
"allowed",
"or",
"not",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/AbstractCorsFilter.java#L67-L133 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/TypeScriptCompilerMojo.java | TypeScriptCompilerMojo.fileCreated | @Override
public boolean fileCreated(File file) throws WatchingException {
if (WatcherUtils.isInDirectory(file, internalSources)) {
processDirectory(internalSources, destinationForInternals);
} else if (WatcherUtils.isInDirectory(file, externalSources)) {
processDirectory(ext... | java | @Override
public boolean fileCreated(File file) throws WatchingException {
if (WatcherUtils.isInDirectory(file, internalSources)) {
processDirectory(internalSources, destinationForInternals);
} else if (WatcherUtils.isInDirectory(file, externalSources)) {
processDirectory(ext... | [
"@",
"Override",
"public",
"boolean",
"fileCreated",
"(",
"File",
"file",
")",
"throws",
"WatchingException",
"{",
"if",
"(",
"WatcherUtils",
".",
"isInDirectory",
"(",
"file",
",",
"internalSources",
")",
")",
"{",
"processDirectory",
"(",
"internalSources",
",... | A file is created - process it.
@param file the file
@return {@literal true} as the pipeline should continue
@throws WatchingException if the processing failed | [
"A",
"file",
"is",
"created",
"-",
"process",
"it",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/TypeScriptCompilerMojo.java#L150-L158 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/TypeScriptCompilerMojo.java | TypeScriptCompilerMojo.processDirectory | protected void processDirectory(File input, File destination) throws WatchingException {
if (! input.isDirectory()) {
return;
}
if (! destination.isDirectory()) {
destination.mkdirs();
}
// Now execute the compiler
// We compute the set of argume... | java | protected void processDirectory(File input, File destination) throws WatchingException {
if (! input.isDirectory()) {
return;
}
if (! destination.isDirectory()) {
destination.mkdirs();
}
// Now execute the compiler
// We compute the set of argume... | [
"protected",
"void",
"processDirectory",
"(",
"File",
"input",
",",
"File",
"destination",
")",
"throws",
"WatchingException",
"{",
"if",
"(",
"!",
"input",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"destination",
".",
"... | Process all typescripts file from the given directory. Output files are generated in the given destination.
@param input the input directory
@param destination the output directory
@throws WatchingException if the compilation failed | [
"Process",
"all",
"typescripts",
"file",
"from",
"the",
"given",
"directory",
".",
"Output",
"files",
"are",
"generated",
"in",
"the",
"given",
"destination",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/TypeScriptCompilerMojo.java#L167-L199 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/TypeScriptCompilerMojo.java | TypeScriptCompilerMojo.getOutputFile | public File getOutputFile(File input, String ext) {
File source;
File destination;
if (input.getAbsolutePath().startsWith(internalSources.getAbsolutePath())) {
source = internalSources;
destination = destinationForInternals;
} else if (input.getAbsolutePath().star... | java | public File getOutputFile(File input, String ext) {
File source;
File destination;
if (input.getAbsolutePath().startsWith(internalSources.getAbsolutePath())) {
source = internalSources;
destination = destinationForInternals;
} else if (input.getAbsolutePath().star... | [
"public",
"File",
"getOutputFile",
"(",
"File",
"input",
",",
"String",
"ext",
")",
"{",
"File",
"source",
";",
"File",
"destination",
";",
"if",
"(",
"input",
".",
"getAbsolutePath",
"(",
")",
".",
"startsWith",
"(",
"internalSources",
".",
"getAbsolutePath... | Gets the output file for the given input and the given extension.
@param input the input file
@param ext the extension
@return the output file, may not exist | [
"Gets",
"the",
"output",
"file",
"for",
"the",
"given",
"input",
"and",
"the",
"given",
"extension",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/TypeScriptCompilerMojo.java#L263-L280 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/visitor/ControllerSourceVisitor.java | ControllerSourceVisitor.visit | @Override
public void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller) {
controller.setName(declaration.getName());
LOGGER.info("[controller]Visit " + controller.getName());
//Go on with the methods and annotations
super.visit(declaration,controller);
} | java | @Override
public void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller) {
controller.setName(declaration.getName());
LOGGER.info("[controller]Visit " + controller.getName());
//Go on with the methods and annotations
super.visit(declaration,controller);
} | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"ClassOrInterfaceDeclaration",
"declaration",
",",
"ControllerModel",
"controller",
")",
"{",
"controller",
".",
"setName",
"(",
"declaration",
".",
"getName",
"(",
")",
")",
";",
"LOGGER",
".",
"info",
"(",
"\"... | Visit the class declaration, this is the visitor entry point!
@param declaration {@inheritDoc}
@param controller The ControllerModel we are building. | [
"Visit",
"the",
"class",
"declaration",
"this",
"is",
"the",
"visitor",
"entry",
"point!"
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/visitor/ControllerSourceVisitor.java#L70-L77 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/MonitorCenter.java | MonitorCenter.start | @Validate
public void start() {
module = new SimpleModule(MonitorExtension.class.getName());
module.addSerializer(MonitorExtension.class, new JsonSerializer<MonitorExtension>() {
@Override
public void serialize(MonitorExtension monitorExtension, JsonGenerator jsonGenerator,
... | java | @Validate
public void start() {
module = new SimpleModule(MonitorExtension.class.getName());
module.addSerializer(MonitorExtension.class, new JsonSerializer<MonitorExtension>() {
@Override
public void serialize(MonitorExtension monitorExtension, JsonGenerator jsonGenerator,
... | [
"@",
"Validate",
"public",
"void",
"start",
"(",
")",
"{",
"module",
"=",
"new",
"SimpleModule",
"(",
"MonitorExtension",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"module",
".",
"addSerializer",
"(",
"MonitorExtension",
".",
"class",
",",
"new",
... | When the monitor starts, we initializes and registers a JSON module handling the serialization of
the monitor extension. | [
"When",
"the",
"monitor",
"starts",
"we",
"initializes",
"and",
"registers",
"a",
"JSON",
"module",
"handling",
"the",
"serialization",
"of",
"the",
"monitor",
"extension",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/MonitorCenter.java#L72-L87 | train |
wisdom-framework/wisdom | core/wisdom-executors/src/main/java/org/wisdom/executors/ManagedScheduledExecutorServiceImpl.java | ManagedScheduledExecutorServiceImpl.schedule | @Override
public synchronized <V> ManagedScheduledFutureTask<V> schedule(Callable<V> callable, long delay, TimeUnit unit) {
ScheduledTask<V> task = getNewScheduledTaskFor(callable, false);
ScheduledFuture<V> future =
((ScheduledExecutorService) executor).schedule(task.callable, delay... | java | @Override
public synchronized <V> ManagedScheduledFutureTask<V> schedule(Callable<V> callable, long delay, TimeUnit unit) {
ScheduledTask<V> task = getNewScheduledTaskFor(callable, false);
ScheduledFuture<V> future =
((ScheduledExecutorService) executor).schedule(task.callable, delay... | [
"@",
"Override",
"public",
"synchronized",
"<",
"V",
">",
"ManagedScheduledFutureTask",
"<",
"V",
">",
"schedule",
"(",
"Callable",
"<",
"V",
">",
"callable",
",",
"long",
"delay",
",",
"TimeUnit",
"unit",
")",
"{",
"ScheduledTask",
"<",
"V",
">",
"task",
... | Creates and executes a ScheduledFuture that becomes enabled after the
given delay.
@param callable the function to execute
@param delay the time from now to delay execution
@param unit the time unit of the delay parameter
@return a ScheduledFuture that can be used to extract result or cancel
@throws java.util.c... | [
"Creates",
"and",
"executes",
"a",
"ScheduledFuture",
"that",
"becomes",
"enabled",
"after",
"the",
"given",
"delay",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-executors/src/main/java/org/wisdom/executors/ManagedScheduledExecutorServiceImpl.java#L96-L103 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/concurrent/CompositeExecutionContext.java | CompositeExecutionContext.addAll | private CompositeExecutionContext addAll(List<ExecutionContext> contexts) {
this.elements = new ImmutableList.Builder().addAll(contexts).build();
return this;
} | java | private CompositeExecutionContext addAll(List<ExecutionContext> contexts) {
this.elements = new ImmutableList.Builder().addAll(contexts).build();
return this;
} | [
"private",
"CompositeExecutionContext",
"addAll",
"(",
"List",
"<",
"ExecutionContext",
">",
"contexts",
")",
"{",
"this",
".",
"elements",
"=",
"new",
"ImmutableList",
".",
"Builder",
"(",
")",
".",
"addAll",
"(",
"contexts",
")",
".",
"build",
"(",
")",
... | Sets the composing context.
@param contexts the elements
@return the current instance | [
"Sets",
"the",
"composing",
"context",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/concurrent/CompositeExecutionContext.java#L74-L77 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleModel.java | BundleModel.bundles | public static List<BundleModel> bundles(BundleContext context) {
List<BundleModel> bundles = new ArrayList<>();
for (Bundle bundle : context.getBundles()) {
bundles.add(new BundleModel(bundle));
}
return bundles;
} | java | public static List<BundleModel> bundles(BundleContext context) {
List<BundleModel> bundles = new ArrayList<>();
for (Bundle bundle : context.getBundles()) {
bundles.add(new BundleModel(bundle));
}
return bundles;
} | [
"public",
"static",
"List",
"<",
"BundleModel",
">",
"bundles",
"(",
"BundleContext",
"context",
")",
"{",
"List",
"<",
"BundleModel",
">",
"bundles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Bundle",
"bundle",
":",
"context",
".",
"get... | Creates the list of bundle models based on the bundle currently deployed.
@param context the bundle context.
@return the list of models | [
"Creates",
"the",
"list",
"of",
"bundle",
"models",
"based",
"on",
"the",
"bundle",
"currently",
"deployed",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleModel.java#L48-L54 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/HttpHandler.java | HttpHandler.cleanup | private static void cleanup(ContextFromVertx context) {
// Release all resources, especially uploaded file.
if (context != null) {
context.cleanup();
}
Context.CONTEXT.remove();
} | java | private static void cleanup(ContextFromVertx context) {
// Release all resources, especially uploaded file.
if (context != null) {
context.cleanup();
}
Context.CONTEXT.remove();
} | [
"private",
"static",
"void",
"cleanup",
"(",
"ContextFromVertx",
"context",
")",
"{",
"// Release all resources, especially uploaded file.",
"if",
"(",
"context",
"!=",
"null",
")",
"{",
"context",
".",
"cleanup",
"(",
")",
";",
"}",
"Context",
".",
"CONTEXT",
"... | The request is now completed, clean everything.
@param context the context | [
"The",
"request",
"is",
"now",
"completed",
"clean",
"everything",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/HttpHandler.java#L167-L173 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/http/RequestHeader.java | RequestHeader.getHeader | public String getHeader(String headerName) {
List<String> headers = null;
for (String h : headers().keySet()) {
if (headerName.equalsIgnoreCase(h)) {
headers = headers().get(h);
break;
}
}
if (headers == null || headers.isEmpty()) {... | java | public String getHeader(String headerName) {
List<String> headers = null;
for (String h : headers().keySet()) {
if (headerName.equalsIgnoreCase(h)) {
headers = headers().get(h);
break;
}
}
if (headers == null || headers.isEmpty()) {... | [
"public",
"String",
"getHeader",
"(",
"String",
"headerName",
")",
"{",
"List",
"<",
"String",
">",
"headers",
"=",
"null",
";",
"for",
"(",
"String",
"h",
":",
"headers",
"(",
")",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"headerName",
".",
"... | Retrieves a single header.
@param headerName the header name
@return the value of the header. If the header has multiple value,
the first one is returned. If the header has no value (is not specified in the request),
{@literal null} is returned. | [
"Retrieves",
"a",
"single",
"header",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/http/RequestHeader.java#L115-L127 | train |
wisdom-framework/wisdom | core/router/src/main/java/org/wisdom/router/parameter/Bindings.java | Bindings.bind | public static void bind(Source source, RouteParameterHandler handler) {
if (BINDINGS.containsKey(source)) {
LoggerFactory.getLogger(Bindings.class).warn("Replacing a route parameter binding for {} by {}",
source.name(), handler);
}
BINDINGS.put(source, handler);
... | java | public static void bind(Source source, RouteParameterHandler handler) {
if (BINDINGS.containsKey(source)) {
LoggerFactory.getLogger(Bindings.class).warn("Replacing a route parameter binding for {} by {}",
source.name(), handler);
}
BINDINGS.put(source, handler);
... | [
"public",
"static",
"void",
"bind",
"(",
"Source",
"source",
",",
"RouteParameterHandler",
"handler",
")",
"{",
"if",
"(",
"BINDINGS",
".",
"containsKey",
"(",
"source",
")",
")",
"{",
"LoggerFactory",
".",
"getLogger",
"(",
"Bindings",
".",
"class",
")",
... | Associates the given source to the given handler.
@param source the source, must not be {@code null}
@param handler the handler, must not be {@code null} | [
"Associates",
"the",
"given",
"source",
"to",
"the",
"given",
"handler",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/router/src/main/java/org/wisdom/router/parameter/Bindings.java#L56-L62 | train |
wisdom-framework/wisdom | core/router/src/main/java/org/wisdom/router/parameter/Bindings.java | Bindings.create | public static Object create(ActionParameter argument, Context context,
ParameterFactories engine) {
RouteParameterHandler handler = BINDINGS.get(argument.getSource());
if (handler != null) {
return handler.create(argument, context, engine);
} else {
... | java | public static Object create(ActionParameter argument, Context context,
ParameterFactories engine) {
RouteParameterHandler handler = BINDINGS.get(argument.getSource());
if (handler != null) {
return handler.create(argument, context, engine);
} else {
... | [
"public",
"static",
"Object",
"create",
"(",
"ActionParameter",
"argument",
",",
"Context",
"context",
",",
"ParameterFactories",
"engine",
")",
"{",
"RouteParameterHandler",
"handler",
"=",
"BINDINGS",
".",
"get",
"(",
"argument",
".",
"getSource",
"(",
")",
")... | Creates the value to be injected.
@param argument the argument
@param context the context
@param engine the engine
@return the created object | [
"Creates",
"the",
"value",
"to",
"be",
"injected",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/router/src/main/java/org/wisdom/router/parameter/Bindings.java#L72-L82 | train |
wisdom-framework/wisdom | framework/default-error-handler/src/main/java/org/wisdom/error/InterestingLines.java | InterestingLines.extractInterestedLines | public static InterestingLines extractInterestedLines(String source, int line, int border, Logger logger) {
try {
if (source == null) {
return null;
}
String[] lines = source.split("\n");
int firstLine = Math.max(0, line - border);
int ... | java | public static InterestingLines extractInterestedLines(String source, int line, int border, Logger logger) {
try {
if (source == null) {
return null;
}
String[] lines = source.split("\n");
int firstLine = Math.max(0, line - border);
int ... | [
"public",
"static",
"InterestingLines",
"extractInterestedLines",
"(",
"String",
"source",
",",
"int",
"line",
",",
"int",
"border",
",",
"Logger",
"logger",
")",
"{",
"try",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"... | Extracts interesting lines to be displayed to the user.
@param source the source
@param line the line responsible of the error
@param border number of lines to use as a border
@param logger the logger to use to report errors
@return the interested line structure | [
"Extracts",
"interesting",
"lines",
"to",
"be",
"displayed",
"to",
"the",
"user",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/default-error-handler/src/main/java/org/wisdom/error/InterestingLines.java#L71-L86 | train |
wisdom-framework/wisdom | core/wisdom-ipojo-module/src/main/java/org/wisdom/bnd/plugins/ImportedPackageRangeFixer.java | ImportedPackageRangeFixer.analyzeJar | @Override
public boolean analyzeJar(Analyzer analyzer) throws Exception {
loadInternalRangeFix();
loadExternalRangeFix();
if (analyzer.getReferred() == null) {
return false;
}
// Data loaded, start analysis
for (Map.Entry<Descriptors.PackageRef, Attrs> e... | java | @Override
public boolean analyzeJar(Analyzer analyzer) throws Exception {
loadInternalRangeFix();
loadExternalRangeFix();
if (analyzer.getReferred() == null) {
return false;
}
// Data loaded, start analysis
for (Map.Entry<Descriptors.PackageRef, Attrs> e... | [
"@",
"Override",
"public",
"boolean",
"analyzeJar",
"(",
"Analyzer",
"analyzer",
")",
"throws",
"Exception",
"{",
"loadInternalRangeFix",
"(",
")",
";",
"loadExternalRangeFix",
"(",
")",
";",
"if",
"(",
"analyzer",
".",
"getReferred",
"(",
")",
"==",
"null",
... | Analyzes the jar and update the version range.
@param analyzer the analyzer
@return {@code false}
@throws Exception if the analaysis fails. | [
"Analyzes",
"the",
"jar",
"and",
"update",
"the",
"version",
"range",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-ipojo-module/src/main/java/org/wisdom/bnd/plugins/ImportedPackageRangeFixer.java#L97-L119 | train |
wisdom-framework/wisdom | core/wisdom-ipojo-module/src/main/java/org/wisdom/bnd/plugins/ImportedPackageRangeFixer.java | ImportedPackageRangeFixer.load | public static Properties load(URL url) throws IOException {
InputStream fis = null;
try {
Properties props = new Properties();
fis = url.openStream();
props.load(fis);
return props;
} finally {
IOUtils.closeQuietly(fis);
}
} | java | public static Properties load(URL url) throws IOException {
InputStream fis = null;
try {
Properties props = new Properties();
fis = url.openStream();
props.load(fis);
return props;
} finally {
IOUtils.closeQuietly(fis);
}
} | [
"public",
"static",
"Properties",
"load",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"InputStream",
"fis",
"=",
"null",
";",
"try",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"fis",
"=",
"url",
".",
"openStream",
"(",... | Utility method to load a properties file pointed by the given url.
@param url the url
@return the read properties, empty if the file cannot be found.
@throws IOException if the file cannot be loaded. | [
"Utility",
"method",
"to",
"load",
"a",
"properties",
"file",
"pointed",
"by",
"the",
"given",
"url",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-ipojo-module/src/main/java/org/wisdom/bnd/plugins/ImportedPackageRangeFixer.java#L193-L203 | train |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ApplicationConfigurationImpl.java | ApplicationConfigurationImpl.reloadConfiguration | private String reloadConfiguration() {
String location = System.getProperty(APPLICATION_CONFIGURATION);
if (location == null) {
location = "conf/application.conf";
}
Config configuration = loadConfiguration(location);
if (configuration == null) {
throw n... | java | private String reloadConfiguration() {
String location = System.getProperty(APPLICATION_CONFIGURATION);
if (location == null) {
location = "conf/application.conf";
}
Config configuration = loadConfiguration(location);
if (configuration == null) {
throw n... | [
"private",
"String",
"reloadConfiguration",
"(",
")",
"{",
"String",
"location",
"=",
"System",
".",
"getProperty",
"(",
"APPLICATION_CONFIGURATION",
")",
";",
"if",
"(",
"location",
"==",
"null",
")",
"{",
"location",
"=",
"\"conf/application.conf\"",
";",
"}",... | Reloads the configuration file.
@return the location of the file. | [
"Reloads",
"the",
"configuration",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ApplicationConfigurationImpl.java#L140-L156 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java | RequestFromVertx.path | @Override
public String path() {
try {
return new URI(request.uri()).getRawPath();
} catch (URISyntaxException e) { //NOSONAR
// Should never be the case.
return uri();
}
} | java | @Override
public String path() {
try {
return new URI(request.uri()).getRawPath();
} catch (URISyntaxException e) { //NOSONAR
// Should never be the case.
return uri();
}
} | [
"@",
"Override",
"public",
"String",
"path",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"URI",
"(",
"request",
".",
"uri",
"(",
")",
")",
".",
"getRawPath",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"//NOSONAR",
"// Shou... | The URI path, without the query part. | [
"The",
"URI",
"path",
"without",
"the",
"query",
"part",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java#L197-L205 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java | RequestFromVertx.accepts | @Override
public boolean accepts(String mimeType) {
String contentType = request.headers().get(HeaderNames.ACCEPT);
if (contentType == null) {
contentType = MimeTypes.HTML;
}
// For performance reason, we first try a full match:
if (contentType.contains(mimeType))... | java | @Override
public boolean accepts(String mimeType) {
String contentType = request.headers().get(HeaderNames.ACCEPT);
if (contentType == null) {
contentType = MimeTypes.HTML;
}
// For performance reason, we first try a full match:
if (contentType.contains(mimeType))... | [
"@",
"Override",
"public",
"boolean",
"accepts",
"(",
"String",
"mimeType",
")",
"{",
"String",
"contentType",
"=",
"request",
".",
"headers",
"(",
")",
".",
"get",
"(",
"HeaderNames",
".",
"ACCEPT",
")",
";",
"if",
"(",
"contentType",
"==",
"null",
")",... | Check if this request accepts a given media type.
@return true if <code>mimeType</code> is in the Accept header, otherwise false | [
"Check",
"if",
"this",
"request",
"accepts",
"a",
"given",
"media",
"type",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java#L290-L308 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java | RequestFromVertx.headers | @Override
public Map<String, List<String>> headers() {
if (headers != null) {
return headers;
}
headers = new HashMap<>();
final MultiMap requestHeaders = request.headers();
Set<String> names = requestHeaders.names();
for (String name : names) {
... | java | @Override
public Map<String, List<String>> headers() {
if (headers != null) {
return headers;
}
headers = new HashMap<>();
final MultiMap requestHeaders = request.headers();
Set<String> names = requestHeaders.names();
for (String name : names) {
... | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
"(",
")",
"{",
"if",
"(",
"headers",
"!=",
"null",
")",
"{",
"return",
"headers",
";",
"}",
"headers",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"... | Retrieves all headers.
@return headers | [
"Retrieves",
"all",
"headers",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java#L335-L347 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java | RequestFromVertx.parameters | @Override
public Map<String, List<String>> parameters() {
Map<String, List<String>> result = new HashMap<>();
for (String key : request.params().names()) {
result.put(key, request.params().getAll(key));
}
return result;
} | java | @Override
public Map<String, List<String>> parameters() {
Map<String, List<String>> result = new HashMap<>();
for (String key : request.params().names()) {
result.put(key, request.params().getAll(key));
}
return result;
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"parameters",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"result",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Str... | Gets all the parameters from the request.
@return The parameters | [
"Gets",
"all",
"the",
"parameters",
"from",
"the",
"request",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java#L495-L502 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java | RequestFromVertx.getRawBodyAsString | public String getRawBodyAsString() {
if (raw == null) {
return null;
}
return raw.toString(Charsets.UTF_8.displayName());
} | java | public String getRawBodyAsString() {
if (raw == null) {
return null;
}
return raw.toString(Charsets.UTF_8.displayName());
} | [
"public",
"String",
"getRawBodyAsString",
"(",
")",
"{",
"if",
"(",
"raw",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"raw",
".",
"toString",
"(",
"Charsets",
".",
"UTF_8",
".",
"displayName",
"(",
")",
")",
";",
"}"
] | Gets the 'raw' body.
@return the raw body, {@code null} if there is no body. | [
"Gets",
"the",
"raw",
"body",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java#L540-L545 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java | RequestFromVertx.ready | public boolean ready() {
for (VertxFileUpload file : files) {
if (file.getErrorIfAny() != null) {
return false;
}
}
String contentType = request.headers().get(HeaderNames.CONTENT_TYPE);
if (contentType != null) {
contentType = HttpUtil... | java | public boolean ready() {
for (VertxFileUpload file : files) {
if (file.getErrorIfAny() != null) {
return false;
}
}
String contentType = request.headers().get(HeaderNames.CONTENT_TYPE);
if (contentType != null) {
contentType = HttpUtil... | [
"public",
"boolean",
"ready",
"(",
")",
"{",
"for",
"(",
"VertxFileUpload",
"file",
":",
"files",
")",
"{",
"if",
"(",
"file",
".",
"getErrorIfAny",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"false",
";",
"}",
"}",
"String",
"contentType",
"=",
"re... | Callbacks invokes when the request has been read completely.
@return a boolean indicating if the request was handled correctly. | [
"Callbacks",
"invokes",
"when",
"the",
"request",
"has",
"been",
"read",
"completely",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java#L570-L592 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyFinder.java | DependencyFinder.getArtifactFileFromProjectDependencies | public static File getArtifactFileFromProjectDependencies(AbstractWisdomMojo mojo, String artifactId,
String type) {
Preconditions.checkNotNull(mojo);
Preconditions.checkNotNull(artifactId);
Preconditions.checkNotNull(type);
... | java | public static File getArtifactFileFromProjectDependencies(AbstractWisdomMojo mojo, String artifactId,
String type) {
Preconditions.checkNotNull(mojo);
Preconditions.checkNotNull(artifactId);
Preconditions.checkNotNull(type);
... | [
"public",
"static",
"File",
"getArtifactFileFromProjectDependencies",
"(",
"AbstractWisdomMojo",
"mojo",
",",
"String",
"artifactId",
",",
"String",
"type",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"mojo",
")",
";",
"Preconditions",
".",
"checkNotNull",
... | Gets the file of the dependency with the given artifact id from the project dependencies.
@param mojo the mojo
@param artifactId the name of the artifact to find
@param type the extension of the artifact to find
@return the artifact file, {@code null} if not found | [
"Gets",
"the",
"file",
"of",
"the",
"dependency",
"with",
"the",
"given",
"artifact",
"id",
"from",
"the",
"project",
"dependencies",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyFinder.java#L73-L86 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyFinder.java | DependencyFinder.getArtifactFile | public static File getArtifactFile(AbstractWisdomMojo mojo, String artifactId, String type) {
File file = getArtifactFileFromProjectDependencies(mojo, artifactId, type);
if (file == null) {
file = getArtifactFileFromPluginDependencies(mojo, artifactId, type);
}
return file;
... | java | public static File getArtifactFile(AbstractWisdomMojo mojo, String artifactId, String type) {
File file = getArtifactFileFromProjectDependencies(mojo, artifactId, type);
if (file == null) {
file = getArtifactFileFromPluginDependencies(mojo, artifactId, type);
}
return file;
... | [
"public",
"static",
"File",
"getArtifactFile",
"(",
"AbstractWisdomMojo",
"mojo",
",",
"String",
"artifactId",
",",
"String",
"type",
")",
"{",
"File",
"file",
"=",
"getArtifactFileFromProjectDependencies",
"(",
"mojo",
",",
"artifactId",
",",
"type",
")",
";",
... | Gets the file of the dependency with the given artifact id from the project dependencies and if not found from
the plugin dependencies. This method also check the extension.
@param mojo the mojo
@param artifactId the name of the artifact to find
@param type the extension of the artifact to find
@return the arti... | [
"Gets",
"the",
"file",
"of",
"the",
"dependency",
"with",
"the",
"given",
"artifact",
"id",
"from",
"the",
"project",
"dependencies",
"and",
"if",
"not",
"found",
"from",
"the",
"plugin",
"dependencies",
".",
"This",
"method",
"also",
"check",
"the",
"extens... | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyFinder.java#L97-L103 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/WisdomRuntimeExpander.java | WisdomRuntimeExpander.expand | public static boolean expand(AbstractWisdomMojo mojo, File destination,
String profileOrGAV) throws MojoExecutionException {
if (destination.exists() && isWisdomAlreadyInstalled(destination)) {
return false;
}
File archive = getArchive(mojo, profileOr... | java | public static boolean expand(AbstractWisdomMojo mojo, File destination,
String profileOrGAV) throws MojoExecutionException {
if (destination.exists() && isWisdomAlreadyInstalled(destination)) {
return false;
}
File archive = getArchive(mojo, profileOr... | [
"public",
"static",
"boolean",
"expand",
"(",
"AbstractWisdomMojo",
"mojo",
",",
"File",
"destination",
",",
"String",
"profileOrGAV",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"destination",
".",
"exists",
"(",
")",
"&&",
"isWisdomAlreadyInstalled",
... | Downloads and expands the Wisdom distribution.
@param mojo the mojo
@param destination the output directory
@param profileOrGAV indicates the profile (regular, base, equinox) or the GAV of the distribution to use. The
GAV are given as follows: GROUP_ID:ARTIFACT_ID:EXTENSION:CLASSIFIER:VERSION.
@return {@liter... | [
"Downloads",
"and",
"expands",
"the",
"Wisdom",
"distribution",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/WisdomRuntimeExpander.java#L46-L58 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/security/MonitorAuthenticator.java | MonitorAuthenticator.getUserName | @Override
public String getUserName(Context context) {
if (!enabled) {
// Fake user.
return "admin";
}
String user = context.session().get("wisdom.monitor.username");
if (user != null && user.equals(username)) {
return user;
}
ret... | java | @Override
public String getUserName(Context context) {
if (!enabled) {
// Fake user.
return "admin";
}
String user = context.session().get("wisdom.monitor.username");
if (user != null && user.equals(username)) {
return user;
}
ret... | [
"@",
"Override",
"public",
"String",
"getUserName",
"(",
"Context",
"context",
")",
"{",
"if",
"(",
"!",
"enabled",
")",
"{",
"// Fake user.",
"return",
"\"admin\"",
";",
"}",
"String",
"user",
"=",
"context",
".",
"session",
"(",
")",
".",
"get",
"(",
... | Retrieves the username from the HTTP context.
It reads the 'wisdom.monitor.username' in the session, and checks it is equal to the username set in the
application configuration.
@param context the context
@return {@literal null} if the user is not authenticated, the user name otherwise. | [
"Retrieves",
"the",
"username",
"from",
"the",
"HTTP",
"context",
".",
"It",
"reads",
"the",
"wisdom",
".",
"monitor",
".",
"username",
"in",
"the",
"session",
"and",
"checks",
"it",
"is",
"equal",
"to",
"the",
"username",
"set",
"in",
"the",
"application"... | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/security/MonitorAuthenticator.java#L72-L85 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/WebSocketHandler.java | WebSocketHandler.handle | @Override
public void handle(final ServerWebSocket socket) {
LOGGER.info("New web socket connection {}, {}", socket, socket.uri());
if (! configuration.accept(socket.uri())) {
LOGGER.warn("Web Socket connection denied on {} by {}", socket.uri(), configuration.name());
return... | java | @Override
public void handle(final ServerWebSocket socket) {
LOGGER.info("New web socket connection {}, {}", socket, socket.uri());
if (! configuration.accept(socket.uri())) {
LOGGER.warn("Web Socket connection denied on {} by {}", socket.uri(), configuration.name());
return... | [
"@",
"Override",
"public",
"void",
"handle",
"(",
"final",
"ServerWebSocket",
"socket",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"New web socket connection {}, {}\"",
",",
"socket",
",",
"socket",
".",
"uri",
"(",
")",
")",
";",
"if",
"(",
"!",
"configuration... | Handles a web socket connection.
@param socket the opening socket. | [
"Handles",
"a",
"web",
"socket",
"connection",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/WebSocketHandler.java#L64-L83 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleMonitorExtension.java | BundleMonitorExtension.toggleBundle | @Route(method = HttpMethod.GET, uri = "/{id}")
public Result toggleBundle(@Parameter("id") long id) {
Bundle bundle = context.getBundle(id);
if (bundle == null) {
return notFound("Bundle " + id + " not found");
} else {
if (! isFragment(bundle)) {
if (... | java | @Route(method = HttpMethod.GET, uri = "/{id}")
public Result toggleBundle(@Parameter("id") long id) {
Bundle bundle = context.getBundle(id);
if (bundle == null) {
return notFound("Bundle " + id + " not found");
} else {
if (! isFragment(bundle)) {
if (... | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"GET",
",",
"uri",
"=",
"\"/{id}\"",
")",
"public",
"Result",
"toggleBundle",
"(",
"@",
"Parameter",
"(",
"\"id\"",
")",
"long",
"id",
")",
"{",
"Bundle",
"bundle",
"=",
"context",
".",
"getBundle",
... | Toggles the states of the bundle. If the bundle is active, the bundle is stopped. If the bundle is resolved or
installed, the bundle is started.
@param id the bundle's id
@return OK if everything is fine, BAD_REQUEST if the bundle cannot be started or stopped correctly,
NOT_FOUND if there are no bundles with the given... | [
"Toggles",
"the",
"states",
"of",
"the",
"bundle",
".",
"If",
"the",
"bundle",
"is",
"active",
"the",
"bundle",
"is",
"stopped",
".",
"If",
"the",
"bundle",
"is",
"resolved",
"or",
"installed",
"the",
"bundle",
"is",
"started",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleMonitorExtension.java#L130-L164 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleMonitorExtension.java | BundleMonitorExtension.updateBundle | @Route(method = HttpMethod.POST, uri = "/{id}")
public Result updateBundle(@Parameter("id") long id) {
final Bundle bundle = context.getBundle(id);
if (bundle == null) {
return notFound("Bundle " + id + " not found");
} else {
return async(new Callable<Result>() {
... | java | @Route(method = HttpMethod.POST, uri = "/{id}")
public Result updateBundle(@Parameter("id") long id) {
final Bundle bundle = context.getBundle(id);
if (bundle == null) {
return notFound("Bundle " + id + " not found");
} else {
return async(new Callable<Result>() {
... | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"POST",
",",
"uri",
"=",
"\"/{id}\"",
")",
"public",
"Result",
"updateBundle",
"(",
"@",
"Parameter",
"(",
"\"id\"",
")",
"long",
"id",
")",
"{",
"final",
"Bundle",
"bundle",
"=",
"context",
".",
"ge... | Updates the given bundle. The bundle is updated from the installation url.
@param id the bundle's id
@return OK if the bundle is updated, BAD_REQUEST if an error occurs when the bundle is updated,
NOT_FOUND if there are no bundles with the given id. | [
"Updates",
"the",
"given",
"bundle",
".",
"The",
"bundle",
"is",
"updated",
"from",
"the",
"installation",
"url",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleMonitorExtension.java#L173-L193 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleMonitorExtension.java | BundleMonitorExtension.installBundle | @Route(method = HttpMethod.POST, uri = "")
public Result installBundle(@FormParameter("bundle") final FileItem bundle,
@FormParameter("start") @DefaultValue("false") final boolean startIfNeeded) {
if (bundle != null) {
return async(new Callable<Result>() {
... | java | @Route(method = HttpMethod.POST, uri = "")
public Result installBundle(@FormParameter("bundle") final FileItem bundle,
@FormParameter("start") @DefaultValue("false") final boolean startIfNeeded) {
if (bundle != null) {
return async(new Callable<Result>() {
... | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"POST",
",",
"uri",
"=",
"\"\"",
")",
"public",
"Result",
"installBundle",
"(",
"@",
"FormParameter",
"(",
"\"bundle\"",
")",
"final",
"FileItem",
"bundle",
",",
"@",
"FormParameter",
"(",
"\"start\"",
"... | Installs a new bundle.
@param bundle the bundle file
@param startIfNeeded whether or not the bundle need to be started
@return the bundle page, with a flash message. | [
"Installs",
"a",
"new",
"bundle",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleMonitorExtension.java#L202-L241 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleMonitorExtension.java | BundleMonitorExtension.uninstallBundle | @Route(method = HttpMethod.DELETE, uri = "/{id}")
public Result uninstallBundle(@Parameter("id") long id) {
final Bundle bundle = context.getBundle(id);
if (bundle == null) {
return notFound("Bundle " + id + " not found");
} else {
return async(new Callable<Result>() ... | java | @Route(method = HttpMethod.DELETE, uri = "/{id}")
public Result uninstallBundle(@Parameter("id") long id) {
final Bundle bundle = context.getBundle(id);
if (bundle == null) {
return notFound("Bundle " + id + " not found");
} else {
return async(new Callable<Result>() ... | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"DELETE",
",",
"uri",
"=",
"\"/{id}\"",
")",
"public",
"Result",
"uninstallBundle",
"(",
"@",
"Parameter",
"(",
"\"id\"",
")",
"long",
"id",
")",
"{",
"final",
"Bundle",
"bundle",
"=",
"context",
".",
... | Uninstalls the given bundle.
@param id the bundle's id
@return OK if the bundle is updated, BAD_REQUEST if an error occurs when the bundle is uninstalled,
NOT_FOUND if there are no bundles with the given id. | [
"Uninstalls",
"the",
"given",
"bundle",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleMonitorExtension.java#L250-L270 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleMonitorExtension.java | BundleMonitorExtension.isFragment | public static boolean isFragment(Bundle bundle) {
Dictionary<String, String> headers = bundle.getHeaders();
return headers.get(Constants.FRAGMENT_HOST) != null;
} | java | public static boolean isFragment(Bundle bundle) {
Dictionary<String, String> headers = bundle.getHeaders();
return headers.get(Constants.FRAGMENT_HOST) != null;
} | [
"public",
"static",
"boolean",
"isFragment",
"(",
"Bundle",
"bundle",
")",
"{",
"Dictionary",
"<",
"String",
",",
"String",
">",
"headers",
"=",
"bundle",
".",
"getHeaders",
"(",
")",
";",
"return",
"headers",
".",
"get",
"(",
"Constants",
".",
"FRAGMENT_H... | Checks whether or not the given bundle is a fragment
@param bundle the bundle
@return {@code true} if the bundle is a fragment, {@code false} otherwise. | [
"Checks",
"whether",
"or",
"not",
"the",
"given",
"bundle",
"is",
"a",
"fragment"
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleMonitorExtension.java#L352-L355 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/node/NPM.java | NPM.findExecutable | public File findExecutable(String binary) throws IOException, ParseException {
File npmDirectory = getNPMDirectory();
File packageFile = new File(npmDirectory, PACKAGE_JSON);
if (!packageFile.isFile()) {
throw new IllegalStateException("Invalid NPM " + npmName + " - " + packageFile.g... | java | public File findExecutable(String binary) throws IOException, ParseException {
File npmDirectory = getNPMDirectory();
File packageFile = new File(npmDirectory, PACKAGE_JSON);
if (!packageFile.isFile()) {
throw new IllegalStateException("Invalid NPM " + npmName + " - " + packageFile.g... | [
"public",
"File",
"findExecutable",
"(",
"String",
"binary",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"File",
"npmDirectory",
"=",
"getNPMDirectory",
"(",
")",
";",
"File",
"packageFile",
"=",
"new",
"File",
"(",
"npmDirectory",
",",
"PACKAGE_JS... | Tries to find the main JS file.
This search is based on the `package.json` file and it's `bin` entry.
If there is an entry in the `bin` object matching `binary`, it uses this javascript file.
If the search failed, `null` is returned
@return the JavaScript file to execute, null if not found | [
"Tries",
"to",
"find",
"the",
"main",
"JS",
"file",
".",
"This",
"search",
"is",
"based",
"on",
"the",
"package",
".",
"json",
"file",
"and",
"it",
"s",
"bin",
"entry",
".",
"If",
"there",
"is",
"an",
"entry",
"in",
"the",
"bin",
"object",
"matching"... | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/node/NPM.java#L269-L302 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/node/NPM.java | NPM.getVersionFromNPM | public static String getVersionFromNPM(File npmDirectory, Log log) {
File packageFile = new File(npmDirectory, PACKAGE_JSON);
if (!packageFile.isFile()) {
return "0.0.0";
}
FileReader reader = null;
try {
reader = new FileReader(packageFile); //NOSONAR
... | java | public static String getVersionFromNPM(File npmDirectory, Log log) {
File packageFile = new File(npmDirectory, PACKAGE_JSON);
if (!packageFile.isFile()) {
return "0.0.0";
}
FileReader reader = null;
try {
reader = new FileReader(packageFile); //NOSONAR
... | [
"public",
"static",
"String",
"getVersionFromNPM",
"(",
"File",
"npmDirectory",
",",
"Log",
"log",
")",
"{",
"File",
"packageFile",
"=",
"new",
"File",
"(",
"npmDirectory",
",",
"PACKAGE_JSON",
")",
";",
"if",
"(",
"!",
"packageFile",
".",
"isFile",
"(",
"... | Utility method to extract the version from a NPM by reading its 'package.json' file.
@param npmDirectory the directory in which the NPM is installed
@param log the logger object
@return the read version, "0.0.0" if there are not 'package.json' file, {@code null} if this file cannot be
read or does not contain... | [
"Utility",
"method",
"to",
"extract",
"the",
"version",
"from",
"a",
"NPM",
"by",
"reading",
"its",
"package",
".",
"json",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/node/NPM.java#L371-L389 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/node/NPM.java | NPM.configureRegistry | public static void configureRegistry(NodeManager node, Log log, String npmRegistryUrl) {
try {
node.factory().getNpmRunner(node.proxy()).execute("config set registry " + npmRegistryUrl);
} catch (TaskRunnerException e) {
log.error("Error during the configuration of NPM registry w... | java | public static void configureRegistry(NodeManager node, Log log, String npmRegistryUrl) {
try {
node.factory().getNpmRunner(node.proxy()).execute("config set registry " + npmRegistryUrl);
} catch (TaskRunnerException e) {
log.error("Error during the configuration of NPM registry w... | [
"public",
"static",
"void",
"configureRegistry",
"(",
"NodeManager",
"node",
",",
"Log",
"log",
",",
"String",
"npmRegistryUrl",
")",
"{",
"try",
"{",
"node",
".",
"factory",
"(",
")",
".",
"getNpmRunner",
"(",
"node",
".",
"proxy",
"(",
")",
")",
".",
... | Configures the NPM registry location.
@param node the node manager
@param log the logger
@param npmRegistryUrl the registry url | [
"Configures",
"the",
"NPM",
"registry",
"location",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/node/NPM.java#L415-L421 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/model/ControllerRouteModel.java | ControllerRouteModel.compareTo | @Override
public int compareTo(ControllerRouteModel rElem) {
if (rElem == null) {
throw new NullPointerException("Cannot compare to null");
}
if (rElem.equals(this)) {
return 0;
}
int compare = getPath().compareTo(rElem.getPath());
if(compar... | java | @Override
public int compareTo(ControllerRouteModel rElem) {
if (rElem == null) {
throw new NullPointerException("Cannot compare to null");
}
if (rElem.equals(this)) {
return 0;
}
int compare = getPath().compareTo(rElem.getPath());
if(compar... | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"ControllerRouteModel",
"rElem",
")",
"{",
"if",
"(",
"rElem",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Cannot compare to null\"",
")",
";",
"}",
"if",
"(",
"rElem",
".",
"equ... | A bit dummy compareTo implementation use by the tree Map.
@param rElem the {@link ControllerRouteModel} that we want to compare to <code>this</code>.
@return {@inheritDoc} | [
"A",
"bit",
"dummy",
"compareTo",
"implementation",
"use",
"by",
"the",
"tree",
"Map",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/model/ControllerRouteModel.java#L247-L268 | train |
wisdom-framework/wisdom | core/wisdom-ipojo-module/src/main/java/org/wisdom/ipojo/module/WisdomBindingModule.java | WisdomBindingModule.configure | @Override
public void configure() {
bind(Controller.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
return new WisdomControllerVisitor(context.getWorkbench(), context.getReporter()... | java | @Override
public void configure() {
bind(Controller.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
return new WisdomControllerVisitor(context.getWorkbench(), context.getReporter()... | [
"@",
"Override",
"public",
"void",
"configure",
"(",
")",
"{",
"bind",
"(",
"Controller",
".",
"class",
")",
".",
"to",
"(",
"new",
"AnnotationVisitorFactory",
"(",
")",
"{",
"public",
"AnnotationVisitor",
"newAnnotationVisitor",
"(",
"BindingContext",
"context"... | Adds the Wisdom annotation to the iPOJO manipulator. | [
"Adds",
"the",
"Wisdom",
"annotation",
"to",
"the",
"iPOJO",
"manipulator",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-ipojo-module/src/main/java/org/wisdom/ipojo/module/WisdomBindingModule.java#L42-L75 | train |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.generateAESKey | private SecretKey generateAESKey(String privateKey, String salt) {
try {
byte[] raw = decodeHex(salt);
KeySpec spec = new PBEKeySpec(privateKey.toCharArray(), raw, iterationCount, keySize);
SecretKeyFactory factory = SecretKeyFactory.getInstance(PBKDF_2_WITH_HMAC_SHA_1);
... | java | private SecretKey generateAESKey(String privateKey, String salt) {
try {
byte[] raw = decodeHex(salt);
KeySpec spec = new PBEKeySpec(privateKey.toCharArray(), raw, iterationCount, keySize);
SecretKeyFactory factory = SecretKeyFactory.getInstance(PBKDF_2_WITH_HMAC_SHA_1);
... | [
"private",
"SecretKey",
"generateAESKey",
"(",
"String",
"privateKey",
",",
"String",
"salt",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"raw",
"=",
"decodeHex",
"(",
"salt",
")",
";",
"KeySpec",
"spec",
"=",
"new",
"PBEKeySpec",
"(",
"privateKey",
".",
"to... | Generate the AES key from the salt and the private key.
@param salt the salt (hexadecimal)
@param privateKey the private key
@return the generated key. | [
"Generate",
"the",
"AES",
"key",
"from",
"the",
"salt",
"and",
"the",
"private",
"key",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L99-L108 | train |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.sign | @Override
public String sign(String message, byte[] key) {
Preconditions.checkNotNull(message);
Preconditions.checkNotNull(key);
try {
// Get an hmac_sha1 key from the raw key bytes
SecretKeySpec signingKey = new SecretKeySpec(key, HMAC_SHA_1);
// Get an ... | java | @Override
public String sign(String message, byte[] key) {
Preconditions.checkNotNull(message);
Preconditions.checkNotNull(key);
try {
// Get an hmac_sha1 key from the raw key bytes
SecretKeySpec signingKey = new SecretKeySpec(key, HMAC_SHA_1);
// Get an ... | [
"@",
"Override",
"public",
"String",
"sign",
"(",
"String",
"message",
",",
"byte",
"[",
"]",
"key",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"message",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"key",
")",
";",
"try",
"{",
"// Get... | Sign a message with a key.
@param message The message to sign
@param key The key to use
@return The signed message (in hexadecimal) | [
"Sign",
"a",
"message",
"with",
"a",
"key",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L214-L234 | train |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.hash | @Override
public String hash(String input, Hash hashType) {
Preconditions.checkNotNull(input);
Preconditions.checkNotNull(hashType);
try {
MessageDigest m = MessageDigest.getInstance(hashType.toString());
byte[] out = m.digest(input.getBytes(Charsets.UTF_8));
... | java | @Override
public String hash(String input, Hash hashType) {
Preconditions.checkNotNull(input);
Preconditions.checkNotNull(hashType);
try {
MessageDigest m = MessageDigest.getInstance(hashType.toString());
byte[] out = m.digest(input.getBytes(Charsets.UTF_8));
... | [
"@",
"Override",
"public",
"String",
"hash",
"(",
"String",
"input",
",",
"Hash",
"hashType",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"input",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"hashType",
")",
";",
"try",
"{",
"MessageDigest"... | Create a hash using specific hashing algorithm.
@param input The password
@param hashType The hashing algorithm
@return The password hash | [
"Create",
"a",
"hash",
"using",
"specific",
"hashing",
"algorithm",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L254-L265 | train |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.encodeBase64 | @Override
public String encodeBase64(byte[] value) {
return new String(Base64.encodeBase64(value), Charsets.UTF_8);
} | java | @Override
public String encodeBase64(byte[] value) {
return new String(Base64.encodeBase64(value), Charsets.UTF_8);
} | [
"@",
"Override",
"public",
"String",
"encodeBase64",
"(",
"byte",
"[",
"]",
"value",
")",
"{",
"return",
"new",
"String",
"(",
"Base64",
".",
"encodeBase64",
"(",
"value",
")",
",",
"Charsets",
".",
"UTF_8",
")",
";",
"}"
] | Encode binary data to base64.
@param value The binary data
@return The base64 encoded String | [
"Encode",
"binary",
"data",
"to",
"base64",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L417-L420 | train |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.hexMD5 | @Override
public String hexMD5(String value) {
return String.valueOf(Hex.encodeHex(md5(value)));
} | java | @Override
public String hexMD5(String value) {
return String.valueOf(Hex.encodeHex(md5(value)));
} | [
"@",
"Override",
"public",
"String",
"hexMD5",
"(",
"String",
"value",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"Hex",
".",
"encodeHex",
"(",
"md5",
"(",
"value",
")",
")",
")",
";",
"}"
] | Build an hexadecimal MD5 hash for a String.
@param value The String to hash
@return An hexadecimal Hash | [
"Build",
"an",
"hexadecimal",
"MD5",
"hash",
"for",
"a",
"String",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L439-L442 | train |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.hexSHA1 | @Override
public String hexSHA1(String value) {
return String.valueOf(Hex.encodeHex(sha1(value)));
} | java | @Override
public String hexSHA1(String value) {
return String.valueOf(Hex.encodeHex(sha1(value)));
} | [
"@",
"Override",
"public",
"String",
"hexSHA1",
"(",
"String",
"value",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"Hex",
".",
"encodeHex",
"(",
"sha1",
"(",
"value",
")",
")",
")",
";",
"}"
] | Build an hexadecimal SHA1 hash for a String.
@param value The String to hash
@return An hexadecimal Hash | [
"Build",
"an",
"hexadecimal",
"SHA1",
"hash",
"for",
"a",
"String",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L450-L453 | train |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.compareSignedTokens | @Override
public boolean compareSignedTokens(String tokenA, String tokenB) {
String a = extractSignedToken(tokenA);
String b = extractSignedToken(tokenB);
return a != null && b != null && constantTimeEquals(a, b);
} | java | @Override
public boolean compareSignedTokens(String tokenA, String tokenB) {
String a = extractSignedToken(tokenA);
String b = extractSignedToken(tokenB);
return a != null && b != null && constantTimeEquals(a, b);
} | [
"@",
"Override",
"public",
"boolean",
"compareSignedTokens",
"(",
"String",
"tokenA",
",",
"String",
"tokenB",
")",
"{",
"String",
"a",
"=",
"extractSignedToken",
"(",
"tokenA",
")",
";",
"String",
"b",
"=",
"extractSignedToken",
"(",
"tokenB",
")",
";",
"re... | Compares two signed tokens.
@param tokenA the first token
@param tokenB the second token
@return {@code true} if the tokens are equals, {@code false} otherwise | [
"Compares",
"two",
"signed",
"tokens",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L484-L489 | train |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.md5 | @Override
public byte[] md5(String toHash) {
try {
MessageDigest messageDigest = MessageDigest.getInstance(Hash.MD5.toString());
messageDigest.reset();
messageDigest.update(toHash.getBytes(UTF_8));
return messageDigest.digest();
} catch (NoSuchAlgorith... | java | @Override
public byte[] md5(String toHash) {
try {
MessageDigest messageDigest = MessageDigest.getInstance(Hash.MD5.toString());
messageDigest.reset();
messageDigest.update(toHash.getBytes(UTF_8));
return messageDigest.digest();
} catch (NoSuchAlgorith... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"md5",
"(",
"String",
"toHash",
")",
"{",
"try",
"{",
"MessageDigest",
"messageDigest",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"Hash",
".",
"MD5",
".",
"toString",
"(",
")",
")",
";",
"messageDigest",
... | Computes the MD5 hash of the given String.
@param toHash the string to hash
@return the MD5 hash | [
"Computes",
"the",
"MD5",
"hash",
"of",
"the",
"given",
"String",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L497-L508 | train |
wisdom-framework/wisdom | core/wisdom-executors/src/main/java/org/wisdom/executors/ScheduledTask.java | ScheduledTask.asRunnable | public Runnable asRunnable() {
return new Runnable() {
@Override
public void run() {
try {
callable.call();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
} | java | public Runnable asRunnable() {
return new Runnable() {
@Override
public void run() {
try {
callable.call();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
} | [
"public",
"Runnable",
"asRunnable",
"(",
")",
"{",
"return",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"callable",
".",
"call",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{... | Wraps the enhanced callable as a runnable.
@return the wrapped runnable. | [
"Wraps",
"the",
"enhanced",
"callable",
"as",
"a",
"runnable",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-executors/src/main/java/org/wisdom/executors/ScheduledTask.java#L96-L107 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/utils/CookieDataCodec.java | CookieDataCodec.safeEquals | public static boolean safeEquals(String a, String b) {
if (a.length() != b.length()) {
return false;
} else {
char equal = 0;
for (int i = 0; i < a.length(); i++) {
equal |= a.charAt(i) ^ b.charAt(i);
}
return equal == 0;
... | java | public static boolean safeEquals(String a, String b) {
if (a.length() != b.length()) {
return false;
} else {
char equal = 0;
for (int i = 0; i < a.length(); i++) {
equal |= a.charAt(i) ^ b.charAt(i);
}
return equal == 0;
... | [
"public",
"static",
"boolean",
"safeEquals",
"(",
"String",
"a",
",",
"String",
"b",
")",
"{",
"if",
"(",
"a",
".",
"length",
"(",
")",
"!=",
"b",
".",
"length",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"char",
"equal",
"=",
... | Constant time for same length String comparison, to prevent timing attacks. | [
"Constant",
"time",
"for",
"same",
"length",
"String",
"comparison",
"to",
"prevent",
"timing",
"attacks",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/utils/CookieDataCodec.java#L87-L97 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/Server.java | Server.from | public static Server from(ServiceAccessor accessor,
Vertx vertx,
String name,
Configuration configuration) {
return new Server(
accessor,
vertx,
name,
configu... | java | public static Server from(ServiceAccessor accessor,
Vertx vertx,
String name,
Configuration configuration) {
return new Server(
accessor,
vertx,
name,
configu... | [
"public",
"static",
"Server",
"from",
"(",
"ServiceAccessor",
"accessor",
",",
"Vertx",
"vertx",
",",
"String",
"name",
",",
"Configuration",
"configuration",
")",
"{",
"return",
"new",
"Server",
"(",
"accessor",
",",
"vertx",
",",
"name",
",",
"configuration"... | Creates a new server from the given configuration object.
@param accessor the service accessor
@param vertx the vertx singleton
@param name the server name
@param configuration the configuration
@return the configured server (not bound, not started) | [
"Creates",
"a",
"new",
"server",
"from",
"the",
"given",
"configuration",
"object",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/Server.java#L169-L185 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/Server.java | Server.accept | public boolean accept(String path) {
if (allow.isEmpty() && deny.isEmpty()) {
return true;
}
// Check if the path is denied
for (Pattern p : deny) {
if (p.matcher(path).matches()) {
return false;
}
}
// Check if the pat... | java | public boolean accept(String path) {
if (allow.isEmpty() && deny.isEmpty()) {
return true;
}
// Check if the path is denied
for (Pattern p : deny) {
if (p.matcher(path).matches()) {
return false;
}
}
// Check if the pat... | [
"public",
"boolean",
"accept",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"allow",
".",
"isEmpty",
"(",
")",
"&&",
"deny",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"// Check if the path is denied",
"for",
"(",
"Pattern",
"p",
":... | Checks whether the given path is accepted or rejected by the current server.
@param path the path
@return {@code true} if the path is accepted, {@code false} otherwise. | [
"Checks",
"whether",
"the",
"given",
"path",
"is",
"accepted",
"or",
"rejected",
"by",
"the",
"current",
"server",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/Server.java#L314-L334 | train |
wisdom-framework/wisdom | core/wisdom-ipojo-module/src/main/java/org/wisdom/ipojo/module/ElementHelper.java | ElementHelper.declareInstance | public static Element declareInstance(ComponentWorkbench workbench) {
Element instance = new Element("instance", "");
instance.addAttribute(new Attribute(COMPONENT, workbench.getType().getClassName()));
return instance;
} | java | public static Element declareInstance(ComponentWorkbench workbench) {
Element instance = new Element("instance", "");
instance.addAttribute(new Attribute(COMPONENT, workbench.getType().getClassName()));
return instance;
} | [
"public",
"static",
"Element",
"declareInstance",
"(",
"ComponentWorkbench",
"workbench",
")",
"{",
"Element",
"instance",
"=",
"new",
"Element",
"(",
"\"instance\"",
",",
"\"\"",
")",
";",
"instance",
".",
"addAttribute",
"(",
"new",
"Attribute",
"(",
"COMPONEN... | Declares an instance.
@param workbench the workbench
@return the Instance element | [
"Declares",
"an",
"instance",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-ipojo-module/src/main/java/org/wisdom/ipojo/module/ElementHelper.java#L43-L47 | train |
wisdom-framework/wisdom | core/wisdom-ipojo-module/src/main/java/org/wisdom/ipojo/module/ElementHelper.java | ElementHelper.getProvidesElement | public static Element getProvidesElement(String specifications) {
Element provides = new Element("provides", "");
if (specifications == null) {
return provides;
} else {
Attribute attribute = new Attribute("specifications", specifications);
provides.addAttribu... | java | public static Element getProvidesElement(String specifications) {
Element provides = new Element("provides", "");
if (specifications == null) {
return provides;
} else {
Attribute attribute = new Attribute("specifications", specifications);
provides.addAttribu... | [
"public",
"static",
"Element",
"getProvidesElement",
"(",
"String",
"specifications",
")",
"{",
"Element",
"provides",
"=",
"new",
"Element",
"(",
"\"provides\"",
",",
"\"\"",
")",
";",
"if",
"(",
"specifications",
"==",
"null",
")",
"{",
"return",
"provides",... | Gets the 'provides' element.
@return the provides element | [
"Gets",
"the",
"provides",
"element",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-ipojo-module/src/main/java/org/wisdom/ipojo/module/ElementHelper.java#L54-L63 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/ControllerModel.java | ControllerModel.from | public static JsonNode from(InstanceDescription description, Json json) {
ObjectNode node = json.newObject();
node.put("classname", description.getComponentDescription().getName())
.put("invalid", description.getState() == ComponentInstance.INVALID)
.put("reason", extract... | java | public static JsonNode from(InstanceDescription description, Json json) {
ObjectNode node = json.newObject();
node.put("classname", description.getComponentDescription().getName())
.put("invalid", description.getState() == ComponentInstance.INVALID)
.put("reason", extract... | [
"public",
"static",
"JsonNode",
"from",
"(",
"InstanceDescription",
"description",
",",
"Json",
"json",
")",
"{",
"ObjectNode",
"node",
"=",
"json",
".",
"newObject",
"(",
")",
";",
"node",
".",
"put",
"(",
"\"classname\"",
",",
"description",
".",
"getCompo... | Creates the Json representation for an invalid controller.
@param description the instance's description
@param json the json service
@return the json representation | [
"Creates",
"the",
"Json",
"representation",
"for",
"an",
"invalid",
"controller",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/ControllerModel.java#L63-L69 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/ControllerModel.java | ControllerModel.extractTemplateName | private static String extractTemplateName(String filter) {
Matcher matcher = TEMPLATE_FILTER_PATTERN.matcher(filter);
if (matcher.matches()) {
return matcher.group(1);
} else {
return "Unknown template";
}
} | java | private static String extractTemplateName(String filter) {
Matcher matcher = TEMPLATE_FILTER_PATTERN.matcher(filter);
if (matcher.matches()) {
return matcher.group(1);
} else {
return "Unknown template";
}
} | [
"private",
"static",
"String",
"extractTemplateName",
"(",
"String",
"filter",
")",
"{",
"Matcher",
"matcher",
"=",
"TEMPLATE_FILTER_PATTERN",
".",
"matcher",
"(",
"filter",
")",
";",
"if",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
"{",
"return",
"match... | Extracts the template name from the given LDAP filter.
The LDAP filter is structure as established in the WisdomViewVisitor.
@param filter the filter
@return the extracted template name | [
"Extracts",
"the",
"template",
"name",
"from",
"the",
"given",
"LDAP",
"filter",
".",
"The",
"LDAP",
"filter",
"is",
"structure",
"as",
"established",
"in",
"the",
"WisdomViewVisitor",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/ControllerModel.java#L135-L142 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/ControllerModel.java | ControllerModel.extractModelName | private static String extractModelName(String filter) {
Matcher matcher = MODEL_FILTER_PATTERN.matcher(filter);
if (matcher.matches()) {
return matcher.group(1);
} else {
return "Unknown model";
}
} | java | private static String extractModelName(String filter) {
Matcher matcher = MODEL_FILTER_PATTERN.matcher(filter);
if (matcher.matches()) {
return matcher.group(1);
} else {
return "Unknown model";
}
} | [
"private",
"static",
"String",
"extractModelName",
"(",
"String",
"filter",
")",
"{",
"Matcher",
"matcher",
"=",
"MODEL_FILTER_PATTERN",
".",
"matcher",
"(",
"filter",
")",
";",
"if",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
"{",
"return",
"matcher",
... | Extracts the model name from the given LDAP filter.
The LDAP filter is structure as established in the WisdomModelVisitor.
@param filter the filter
@return the extracted template name | [
"Extracts",
"the",
"model",
"name",
"from",
"the",
"given",
"LDAP",
"filter",
".",
"The",
"LDAP",
"filter",
"is",
"structure",
"as",
"established",
"in",
"the",
"WisdomModelVisitor",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/ControllerModel.java#L151-L158 | train |
wisdom-framework/wisdom | core/wisdom-ipojo-module/src/main/java/org/wisdom/ipojo/module/WisdomModelVisitor.java | WisdomModelVisitor.visitEnd | @Override
public void visitEnd() {
if (name == null || name.length() == 0) {
reporter.error("The 'name' attribute of @Model from " + workbench.getType().getClassName() + " must be " +
"set");
return;
}
// Check the type of the field
if (!... | java | @Override
public void visitEnd() {
if (name == null || name.length() == 0) {
reporter.error("The 'name' attribute of @Model from " + workbench.getType().getClassName() + " must be " +
"set");
return;
}
// Check the type of the field
if (!... | [
"@",
"Override",
"public",
"void",
"visitEnd",
"(",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"reporter",
".",
"error",
"(",
"\"The 'name' attribute of @Model from \"",
"+",
"workbench",
".",
"... | Generates the element-attribute structure to be added. | [
"Generates",
"the",
"element",
"-",
"attribute",
"structure",
"to",
"be",
"added",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-ipojo-module/src/main/java/org/wisdom/ipojo/module/WisdomModelVisitor.java#L74-L93 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/interception/RequestContext.java | RequestContext.getConfigurationForInterceptor | <A> A getConfigurationForInterceptor(Interceptor<A> interceptor) {
return (A) interceptors.get(interceptor);
} | java | <A> A getConfigurationForInterceptor(Interceptor<A> interceptor) {
return (A) interceptors.get(interceptor);
} | [
"<",
"A",
">",
"A",
"getConfigurationForInterceptor",
"(",
"Interceptor",
"<",
"A",
">",
"interceptor",
")",
"{",
"return",
"(",
"A",
")",
"interceptors",
".",
"get",
"(",
"interceptor",
")",
";",
"}"
] | Retrieves the configuration annotation for the given interceptor.
@param interceptor the interceptor
@return the configuration, {@code null} if not found | [
"Retrieves",
"the",
"configuration",
"annotation",
"for",
"the",
"given",
"interceptor",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/interception/RequestContext.java#L106-L108 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/interception/RequestContext.java | RequestContext.proceed | public Result proceed() throws Exception {
if (iterator == null) {
iterator = chain.listIterator();
}
if (!iterator.hasNext()) {
throw new IllegalStateException("Reached the end of the chain without result.");
}
Filter filter = iterator.next();
ret... | java | public Result proceed() throws Exception {
if (iterator == null) {
iterator = chain.listIterator();
}
if (!iterator.hasNext()) {
throw new IllegalStateException("Reached the end of the chain without result.");
}
Filter filter = iterator.next();
ret... | [
"public",
"Result",
"proceed",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"iterator",
"==",
"null",
")",
"{",
"iterator",
"=",
"chain",
".",
"listIterator",
"(",
")",
";",
"}",
"if",
"(",
"!",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"... | Calls the next interceptors.
@return the result from the next interceptor
@throws java.lang.Exception if the invocation fails. | [
"Calls",
"the",
"next",
"interceptors",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/interception/RequestContext.java#L116-L125 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/router/RouteBuilder.java | RouteBuilder._build | private Route _build() {
Preconditions.checkNotNull(controller);
Preconditions.checkNotNull(httpMethod);
Preconditions.checkNotNull(uri);
Preconditions.checkNotNull(httpMethod);
return new Route(httpMethod, uri, controller, controllerMethod);
} | java | private Route _build() {
Preconditions.checkNotNull(controller);
Preconditions.checkNotNull(httpMethod);
Preconditions.checkNotNull(uri);
Preconditions.checkNotNull(httpMethod);
return new Route(httpMethod, uri, controller, controllerMethod);
} | [
"private",
"Route",
"_build",
"(",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"controller",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"httpMethod",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"uri",
")",
";",
"Preconditions",
".",... | Internal method building the route.
@return the route. | [
"Internal",
"method",
"building",
"the",
"route",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/RouteBuilder.java#L122-L129 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/router/RouteBuilder.java | RouteBuilder.verifyThatControllerAndMethodExists | private Method verifyThatControllerAndMethodExists(Class<?> controller,
String controllerMethod) throws NoSuchMethodException {
Method methodFromQueryingClass = null;
// 1. Make sure method is in class
// 2. Make sure only one method is th... | java | private Method verifyThatControllerAndMethodExists(Class<?> controller,
String controllerMethod) throws NoSuchMethodException {
Method methodFromQueryingClass = null;
// 1. Make sure method is in class
// 2. Make sure only one method is th... | [
"private",
"Method",
"verifyThatControllerAndMethodExists",
"(",
"Class",
"<",
"?",
">",
"controller",
",",
"String",
"controllerMethod",
")",
"throws",
"NoSuchMethodException",
"{",
"Method",
"methodFromQueryingClass",
"=",
"null",
";",
"// 1. Make sure method is in class"... | Checks that the action method really exists.
@param controller the controller object
@param controllerMethod the method name
@return the Method object.
@throws NoSuchMethodException if the action method does not exist in the given controller object. | [
"Checks",
"that",
"the",
"action",
"method",
"really",
"exists",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/RouteBuilder.java#L139-L171 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/mojo/AbstractWisdomSourceWatcherMojo.java | AbstractWisdomSourceWatcherMojo.accept | public boolean accept(File file) {
if( !WatcherUtils.isInDirectory(file, javaSourceDir) || !WatcherUtils.hasExtension(file,"java")){
return false;
}
// If the file has been deleted by may have been a controller, return true.
// The cleanup will be applied.
if (! file... | java | public boolean accept(File file) {
if( !WatcherUtils.isInDirectory(file, javaSourceDir) || !WatcherUtils.hasExtension(file,"java")){
return false;
}
// If the file has been deleted by may have been a controller, return true.
// The cleanup will be applied.
if (! file... | [
"public",
"boolean",
"accept",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"!",
"WatcherUtils",
".",
"isInDirectory",
"(",
"file",
",",
"javaSourceDir",
")",
"||",
"!",
"WatcherUtils",
".",
"hasExtension",
"(",
"file",
",",
"\"java\"",
")",
")",
"{",
"retu... | Check if we can create a model from the given source.
@param file {@link File} required to be processed by this plugin.
@return <code>true</code> if the <code>file</code> implements
{@link org.wisdom.api.Controller}, <code>false</code> otherwise. | [
"Check",
"if",
"we",
"can",
"create",
"a",
"model",
"from",
"the",
"given",
"source",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/mojo/AbstractWisdomSourceWatcherMojo.java#L114-L135 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/RouteModel.java | RouteModel.from | public static ObjectNode from(Route route, Json json) {
return json.newObject().put("url", route.getUrl())
.put("controller", route.getControllerClass().getName())
.put("method", route.getControllerMethod().getName())
.put("http_method", route.getHttpMethod().toSt... | java | public static ObjectNode from(Route route, Json json) {
return json.newObject().put("url", route.getUrl())
.put("controller", route.getControllerClass().getName())
.put("method", route.getControllerMethod().getName())
.put("http_method", route.getHttpMethod().toSt... | [
"public",
"static",
"ObjectNode",
"from",
"(",
"Route",
"route",
",",
"Json",
"json",
")",
"{",
"return",
"json",
".",
"newObject",
"(",
")",
".",
"put",
"(",
"\"url\"",
",",
"route",
".",
"getUrl",
"(",
")",
")",
".",
"put",
"(",
"\"controller\"",
"... | Creates the JSON representation of the given route.
@param route the route
@param json the JSON service
@return the json representation | [
"Creates",
"the",
"JSON",
"representation",
"of",
"the",
"given",
"route",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/wisdom/RouteModel.java#L37-L42 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java | JacksonSingleton.toJsonP | public String toJsonP(final String callback, final Object data) {
synchronized (lock) {
try {
return callback + "(" + stringify((JsonNode) mapper.valueToTree(data)) + ");";
} catch (Exception e) {
throw new RuntimeException(e);
}
}
... | java | public String toJsonP(final String callback, final Object data) {
synchronized (lock) {
try {
return callback + "(" + stringify((JsonNode) mapper.valueToTree(data)) + ");";
} catch (Exception e) {
throw new RuntimeException(e);
}
}
... | [
"public",
"String",
"toJsonP",
"(",
"final",
"String",
"callback",
",",
"final",
"Object",
"data",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"try",
"{",
"return",
"callback",
"+",
"\"(\"",
"+",
"stringify",
"(",
"(",
"JsonNode",
")",
"mapper",
"."... | Gets the JSONP response for the given callback and value.
@param callback the callback name
@param data the data to transform to json
@return the String built as follows: "callback(json(data))" | [
"Gets",
"the",
"JSONP",
"response",
"for",
"the",
"given",
"callback",
"and",
"value",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L154-L162 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java | JacksonSingleton.stringify | public String stringify(JsonNode json) {
try {
return mapper().writerWithDefaultPrettyPrinter().writeValueAsString(json);
} catch (JsonProcessingException e) {
throw new RuntimeException("Cannot stringify the input json node", e);
}
} | java | public String stringify(JsonNode json) {
try {
return mapper().writerWithDefaultPrettyPrinter().writeValueAsString(json);
} catch (JsonProcessingException e) {
throw new RuntimeException("Cannot stringify the input json node", e);
}
} | [
"public",
"String",
"stringify",
"(",
"JsonNode",
"json",
")",
"{",
"try",
"{",
"return",
"mapper",
"(",
")",
".",
"writerWithDefaultPrettyPrinter",
"(",
")",
".",
"writeValueAsString",
"(",
"json",
")",
";",
"}",
"catch",
"(",
"JsonProcessingException",
"e",
... | Converts a JsonNode to its string representation.
This implementation use a `pretty printer`.
@param json the json node
@return the String representation of the given Json Object
@throws java.lang.RuntimeException if the String form cannot be created | [
"Converts",
"a",
"JsonNode",
"to",
"its",
"string",
"representation",
".",
"This",
"implementation",
"use",
"a",
"pretty",
"printer",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L209-L215 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java | JacksonSingleton.parse | public JsonNode parse(String src) {
synchronized (lock) {
try {
return mapper.readValue(src, JsonNode.class);
} catch (Exception t) {
throw new RuntimeException(t);
}
}
} | java | public JsonNode parse(String src) {
synchronized (lock) {
try {
return mapper.readValue(src, JsonNode.class);
} catch (Exception t) {
throw new RuntimeException(t);
}
}
} | [
"public",
"JsonNode",
"parse",
"(",
"String",
"src",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"try",
"{",
"return",
"mapper",
".",
"readValue",
"(",
"src",
",",
"JsonNode",
".",
"class",
")",
";",
"}",
"catch",
"(",
"Exception",
"t",
")",
"{"... | Parses a String representing a json, and return it as a JsonNode.
@param src the JSON String
@return the Json Node
@throws java.lang.RuntimeException if the given string is not a valid JSON String | [
"Parses",
"a",
"String",
"representing",
"a",
"json",
"and",
"return",
"it",
"as",
"a",
"JsonNode",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/jackson/JacksonSingleton.java#L224-L232 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.