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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.getValueMap | public Map<String, String> getValueMap() {
if (tokensMap == null) {
return null;
}
if (tokensMap.isEmpty()) {
return new LinkedHashMap<>();
} else {
Map<String, String> map = new LinkedHashMap<>(tokensMap.size());
for (Map.Entry<String, Tok... | java | public Map<String, String> getValueMap() {
if (tokensMap == null) {
return null;
}
if (tokensMap.isEmpty()) {
return new LinkedHashMap<>();
} else {
Map<String, String> map = new LinkedHashMap<>(tokensMap.size());
for (Map.Entry<String, Tok... | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getValueMap",
"(",
")",
"{",
"if",
"(",
"tokensMap",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"tokensMap",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"new",
"LinkedHashMap"... | Returns a map of string values of this item.
@return a map of string values | [
"Returns",
"a",
"map",
"of",
"string",
"values",
"of",
"this",
"item",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L191-L204 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.setValue | public void setValue(Map<String, Token[]> tokensMap) {
if (type == null) {
type = ItemType.MAP;
}
if (!isMappableType()) {
throw new IllegalArgumentException("The type of this item must be 'map' or 'properties'");
}
this.tokensMap = tokensMap;
} | java | public void setValue(Map<String, Token[]> tokensMap) {
if (type == null) {
type = ItemType.MAP;
}
if (!isMappableType()) {
throw new IllegalArgumentException("The type of this item must be 'map' or 'properties'");
}
this.tokensMap = tokensMap;
} | [
"public",
"void",
"setValue",
"(",
"Map",
"<",
"String",
",",
"Token",
"[",
"]",
">",
"tokensMap",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"type",
"=",
"ItemType",
".",
"MAP",
";",
"}",
"if",
"(",
"!",
"isMappableType",
"(",
")",
")"... | Sets a value to this Map type item.
@param tokensMap the tokens map | [
"Sets",
"a",
"value",
"to",
"this",
"Map",
"type",
"item",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L268-L276 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.setValue | public void setValue(Properties properties) {
if (properties == null) {
throw new IllegalArgumentException("properties must not be null");
}
if (type == null) {
type = ItemType.PROPERTIES;
}
if (!isMappableType()) {
throw new IllegalArgumentEx... | java | public void setValue(Properties properties) {
if (properties == null) {
throw new IllegalArgumentException("properties must not be null");
}
if (type == null) {
type = ItemType.PROPERTIES;
}
if (!isMappableType()) {
throw new IllegalArgumentEx... | [
"public",
"void",
"setValue",
"(",
"Properties",
"properties",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"properties must not be null\"",
")",
";",
"}",
"if",
"(",
"type",
"==",
"null",
")",
... | Sets a value to this Properties type item.
@param properties the properties | [
"Sets",
"a",
"value",
"to",
"this",
"Properties",
"type",
"item",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L283-L306 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.setValue | public void setValue(List<Token[]> tokensList) {
if (type == null) {
type = ItemType.LIST;
}
if (!isListableType()) {
throw new IllegalArgumentException("The item type must be 'array', 'list' or 'set' for this item " + this);
}
this.tokensList = tokensList... | java | public void setValue(List<Token[]> tokensList) {
if (type == null) {
type = ItemType.LIST;
}
if (!isListableType()) {
throw new IllegalArgumentException("The item type must be 'array', 'list' or 'set' for this item " + this);
}
this.tokensList = tokensList... | [
"public",
"void",
"setValue",
"(",
"List",
"<",
"Token",
"[",
"]",
">",
"tokensList",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"type",
"=",
"ItemType",
".",
"LIST",
";",
"}",
"if",
"(",
"!",
"isListableType",
"(",
")",
")",
"{",
"thro... | Sets a value to this List type item.
@param tokensList the tokens list | [
"Sets",
"a",
"value",
"to",
"this",
"List",
"type",
"item",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L342-L350 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.setValue | public void setValue(Set<Token[]> tokensSet) {
if (tokensSet == null) {
throw new IllegalArgumentException("tokensSet must not be null");
}
if (type == null) {
type = ItemType.SET;
}
if (!isListableType()) {
throw new IllegalArgumentException("... | java | public void setValue(Set<Token[]> tokensSet) {
if (tokensSet == null) {
throw new IllegalArgumentException("tokensSet must not be null");
}
if (type == null) {
type = ItemType.SET;
}
if (!isListableType()) {
throw new IllegalArgumentException("... | [
"public",
"void",
"setValue",
"(",
"Set",
"<",
"Token",
"[",
"]",
">",
"tokensSet",
")",
"{",
"if",
"(",
"tokensSet",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"tokensSet must not be null\"",
")",
";",
"}",
"if",
"(",
"type... | Sets a value to this Set type item.
@param tokensSet the tokens set | [
"Sets",
"a",
"value",
"to",
"this",
"Set",
"type",
"item",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L357-L368 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.isListableType | public boolean isListableType() {
return (type == ItemType.ARRAY || type == ItemType.LIST || type == ItemType.SET);
} | java | public boolean isListableType() {
return (type == ItemType.ARRAY || type == ItemType.LIST || type == ItemType.SET);
} | [
"public",
"boolean",
"isListableType",
"(",
")",
"{",
"return",
"(",
"type",
"==",
"ItemType",
".",
"ARRAY",
"||",
"type",
"==",
"ItemType",
".",
"LIST",
"||",
"type",
"==",
"ItemType",
".",
"SET",
")",
";",
"}"
] | Return whether this item is listable type.
@return true, if this item is listable type | [
"Return",
"whether",
"this",
"item",
"is",
"listable",
"type",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L456-L458 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.newInstance | public static ItemRule newInstance(String type, String name, String valueType,
String defaultValue, Boolean tokenize,
Boolean mandatory, Boolean secret) throws IllegalRuleException {
ItemRule itemRule = new ItemRule();
ItemTy... | java | public static ItemRule newInstance(String type, String name, String valueType,
String defaultValue, Boolean tokenize,
Boolean mandatory, Boolean secret) throws IllegalRuleException {
ItemRule itemRule = new ItemRule();
ItemTy... | [
"public",
"static",
"ItemRule",
"newInstance",
"(",
"String",
"type",
",",
"String",
"name",
",",
"String",
"valueType",
",",
"String",
"defaultValue",
",",
"Boolean",
"tokenize",
",",
"Boolean",
"mandatory",
",",
"Boolean",
"secret",
")",
"throws",
"IllegalRule... | Returns a new derived instance of ItemRule.
@param type the item type
@param name the name of the item
@param valueType the type of value an item can have
@param defaultValue the default value used if the item has not been assigned a value or is null
@param tokenize whether to tokenize
@param mandatory whether or not ... | [
"Returns",
"a",
"new",
"derived",
"instance",
"of",
"ItemRule",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L668-L714 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.makeReferenceToken | public static Token makeReferenceToken(String bean, String template, String parameter,
String attribute, String property) {
Token token;
if (bean != null) {
token = new Token(TokenType.BEAN, bean);
} else if (template != null) {
... | java | public static Token makeReferenceToken(String bean, String template, String parameter,
String attribute, String property) {
Token token;
if (bean != null) {
token = new Token(TokenType.BEAN, bean);
} else if (template != null) {
... | [
"public",
"static",
"Token",
"makeReferenceToken",
"(",
"String",
"bean",
",",
"String",
"template",
",",
"String",
"parameter",
",",
"String",
"attribute",
",",
"String",
"property",
")",
"{",
"Token",
"token",
";",
"if",
"(",
"bean",
"!=",
"null",
")",
"... | Returns a made reference token.
@param bean the bean id
@param template the template id
@param parameter the parameter name
@param attribute the attribute name
@param property the property name
@return the token | [
"Returns",
"a",
"made",
"reference",
"token",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L726-L743 | train |
aspectran/aspectran | web/src/main/java/com/aspectran/web/support/multipart/commons/CommonsMultipartFileParameter.java | CommonsMultipartFileParameter.getInputStream | @Override
public InputStream getInputStream() throws IOException {
InputStream inputStream = fileItem.getInputStream();
return (inputStream != null ? inputStream : new ByteArrayInputStream(new byte[0]));
} | java | @Override
public InputStream getInputStream() throws IOException {
InputStream inputStream = fileItem.getInputStream();
return (inputStream != null ? inputStream : new ByteArrayInputStream(new byte[0]));
} | [
"@",
"Override",
"public",
"InputStream",
"getInputStream",
"(",
")",
"throws",
"IOException",
"{",
"InputStream",
"inputStream",
"=",
"fileItem",
".",
"getInputStream",
"(",
")",
";",
"return",
"(",
"inputStream",
"!=",
"null",
"?",
"inputStream",
":",
"new",
... | Return an InputStream to read the contents of the file from.
@return the contents of the file as stream, or an empty stream if empty
@throws IOException in case of access errors (if the temporary store fails) | [
"Return",
"an",
"InputStream",
"to",
"read",
"the",
"contents",
"of",
"the",
"file",
"from",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/support/multipart/commons/CommonsMultipartFileParameter.java#L98-L102 | train |
aspectran/aspectran | web/src/main/java/com/aspectran/web/support/multipart/commons/CommonsMultipartFileParameter.java | CommonsMultipartFileParameter.saveAs | @Override
public File saveAs(File destFile, boolean overwrite) throws IOException {
if (destFile == null) {
throw new IllegalArgumentException("destFile can not be null");
}
validateFile();
try {
destFile = determineDestinationFile(destFile, overwrite);
... | java | @Override
public File saveAs(File destFile, boolean overwrite) throws IOException {
if (destFile == null) {
throw new IllegalArgumentException("destFile can not be null");
}
validateFile();
try {
destFile = determineDestinationFile(destFile, overwrite);
... | [
"@",
"Override",
"public",
"File",
"saveAs",
"(",
"File",
"destFile",
",",
"boolean",
"overwrite",
")",
"throws",
"IOException",
"{",
"if",
"(",
"destFile",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"destFile can not be null\"",
... | Save an uploaded file as a given destination file.
@param destFile the destination file
@param overwrite whether to overwrite if it already exists
@return a saved file
@throws IOException if an I/O error has occurred | [
"Save",
"an",
"uploaded",
"file",
"as",
"a",
"given",
"destination",
"file",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/support/multipart/commons/CommonsMultipartFileParameter.java#L123-L142 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/apon/AponSyntaxException.java | AponSyntaxException.makeMessage | private static String makeMessage(int lineNumber, String line, String tline, String msg) {
int columnNumber = (tline != null ? line.indexOf(tline) : 0);
StringBuilder sb = new StringBuilder();
if (msg != null) {
sb.append(msg);
}
sb.append(" [lineNumber: ").append(lin... | java | private static String makeMessage(int lineNumber, String line, String tline, String msg) {
int columnNumber = (tline != null ? line.indexOf(tline) : 0);
StringBuilder sb = new StringBuilder();
if (msg != null) {
sb.append(msg);
}
sb.append(" [lineNumber: ").append(lin... | [
"private",
"static",
"String",
"makeMessage",
"(",
"int",
"lineNumber",
",",
"String",
"line",
",",
"String",
"tline",
",",
"String",
"msg",
")",
"{",
"int",
"columnNumber",
"=",
"(",
"tline",
"!=",
"null",
"?",
"line",
".",
"indexOf",
"(",
"tline",
")",... | Create a detail message.
@param lineNumber the line number
@param line the character line
@param tline the trimmed character line
@param msg the message
@return the detail message | [
"Create",
"a",
"detail",
"message",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/apon/AponSyntaxException.java#L72-L95 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/CoreActivity.java | CoreActivity.prepare | private void prepare(String requestName, MethodType requestMethod, TransletRule transletRule,
Translet parentTranslet) {
try {
if (log.isDebugEnabled()) {
log.debug("Translet " + transletRule);
}
newTranslet(requestMethod, requestName... | java | private void prepare(String requestName, MethodType requestMethod, TransletRule transletRule,
Translet parentTranslet) {
try {
if (log.isDebugEnabled()) {
log.debug("Translet " + transletRule);
}
newTranslet(requestMethod, requestName... | [
"private",
"void",
"prepare",
"(",
"String",
"requestName",
",",
"MethodType",
"requestMethod",
",",
"TransletRule",
"transletRule",
",",
"Translet",
"parentTranslet",
")",
"{",
"try",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
... | Prepares a new activity for the Translet Rule by taking
the results of the process that was created earlier.
@param requestName the request name
@param requestMethod the request method
@param transletRule the translet rule
@param parentTranslet the process result that was created earlier | [
"Prepares",
"a",
"new",
"activity",
"for",
"the",
"Translet",
"Rule",
"by",
"taking",
"the",
"results",
"of",
"the",
"process",
"that",
"was",
"created",
"earlier",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/CoreActivity.java#L144-L175 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/CoreActivity.java | CoreActivity.produce | private void produce() {
ContentList contentList = getTransletRule().getContentList();
if (contentList != null) {
ProcessResult processResult = translet.getProcessResult();
if (processResult == null) {
processResult = new ProcessResult(contentList.size());
... | java | private void produce() {
ContentList contentList = getTransletRule().getContentList();
if (contentList != null) {
ProcessResult processResult = translet.getProcessResult();
if (processResult == null) {
processResult = new ProcessResult(contentList.size());
... | [
"private",
"void",
"produce",
"(",
")",
"{",
"ContentList",
"contentList",
"=",
"getTransletRule",
"(",
")",
".",
"getContentList",
"(",
")",
";",
"if",
"(",
"contentList",
"!=",
"null",
")",
"{",
"ProcessResult",
"processResult",
"=",
"translet",
".",
"getP... | Produce the result of the content and its subordinate actions. | [
"Produce",
"the",
"result",
"of",
"the",
"content",
"and",
"its",
"subordinate",
"actions",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/CoreActivity.java#L253-L279 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/CoreActivity.java | CoreActivity.resolveRequestEncoding | protected String resolveRequestEncoding() {
String encoding = getRequestRule().getEncoding();
if (encoding == null) {
encoding = getSetting(RequestRule.CHARACTER_ENCODING_SETTING_NAME);
}
return encoding;
} | java | protected String resolveRequestEncoding() {
String encoding = getRequestRule().getEncoding();
if (encoding == null) {
encoding = getSetting(RequestRule.CHARACTER_ENCODING_SETTING_NAME);
}
return encoding;
} | [
"protected",
"String",
"resolveRequestEncoding",
"(",
")",
"{",
"String",
"encoding",
"=",
"getRequestRule",
"(",
")",
".",
"getEncoding",
"(",
")",
";",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"encoding",
"=",
"getSetting",
"(",
"RequestRule",
".",
... | Determines the request encoding.
@return the request encoding | [
"Determines",
"the",
"request",
"encoding",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/CoreActivity.java#L380-L386 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/CoreActivity.java | CoreActivity.resolveResponseEncoding | protected String resolveResponseEncoding() {
String encoding = getRequestRule().getEncoding();
if (encoding == null) {
encoding = resolveRequestEncoding();
}
return encoding;
} | java | protected String resolveResponseEncoding() {
String encoding = getRequestRule().getEncoding();
if (encoding == null) {
encoding = resolveRequestEncoding();
}
return encoding;
} | [
"protected",
"String",
"resolveResponseEncoding",
"(",
")",
"{",
"String",
"encoding",
"=",
"getRequestRule",
"(",
")",
".",
"getEncoding",
"(",
")",
";",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"encoding",
"=",
"resolveRequestEncoding",
"(",
")",
";"... | Determines the response encoding.
@return the response encoding | [
"Determines",
"the",
"response",
"encoding",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/CoreActivity.java#L393-L399 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/CoreActivity.java | CoreActivity.resolveLocale | protected LocaleResolver resolveLocale() {
LocaleResolver localeResolver = null;
String localeResolverBeanId = getSetting(RequestRule.LOCALE_RESOLVER_SETTING_NAME);
if (localeResolverBeanId != null) {
localeResolver = getBean(localeResolverBeanId, LocaleResolver.class);
l... | java | protected LocaleResolver resolveLocale() {
LocaleResolver localeResolver = null;
String localeResolverBeanId = getSetting(RequestRule.LOCALE_RESOLVER_SETTING_NAME);
if (localeResolverBeanId != null) {
localeResolver = getBean(localeResolverBeanId, LocaleResolver.class);
l... | [
"protected",
"LocaleResolver",
"resolveLocale",
"(",
")",
"{",
"LocaleResolver",
"localeResolver",
"=",
"null",
";",
"String",
"localeResolverBeanId",
"=",
"getSetting",
"(",
"RequestRule",
".",
"LOCALE_RESOLVER_SETTING_NAME",
")",
";",
"if",
"(",
"localeResolverBeanId"... | Resolve the current locale.
@return the current locale | [
"Resolve",
"the",
"current",
"locale",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/CoreActivity.java#L406-L415 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/CoreActivity.java | CoreActivity.parseDeclaredParameters | protected void parseDeclaredParameters() {
ItemRuleMap parameterItemRuleMap = getRequestRule().getParameterItemRuleMap();
if (parameterItemRuleMap != null && !parameterItemRuleMap.isEmpty()) {
ItemEvaluator evaluator = null;
ItemRuleList missingItemRules = null;
for (... | java | protected void parseDeclaredParameters() {
ItemRuleMap parameterItemRuleMap = getRequestRule().getParameterItemRuleMap();
if (parameterItemRuleMap != null && !parameterItemRuleMap.isEmpty()) {
ItemEvaluator evaluator = null;
ItemRuleList missingItemRules = null;
for (... | [
"protected",
"void",
"parseDeclaredParameters",
"(",
")",
"{",
"ItemRuleMap",
"parameterItemRuleMap",
"=",
"getRequestRule",
"(",
")",
".",
"getParameterItemRuleMap",
"(",
")",
";",
"if",
"(",
"parameterItemRuleMap",
"!=",
"null",
"&&",
"!",
"parameterItemRuleMap",
... | Parses the declared parameters. | [
"Parses",
"the",
"declared",
"parameters",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/CoreActivity.java#L428-L459 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/CoreActivity.java | CoreActivity.parseDeclaredAttributes | protected void parseDeclaredAttributes() {
ItemRuleMap attributeItemRuleMap = getRequestRule().getAttributeItemRuleMap();
if (attributeItemRuleMap != null && !attributeItemRuleMap.isEmpty()) {
ItemEvaluator evaluator = new ItemExpression(this);
for (ItemRule itemRule : attributeI... | java | protected void parseDeclaredAttributes() {
ItemRuleMap attributeItemRuleMap = getRequestRule().getAttributeItemRuleMap();
if (attributeItemRuleMap != null && !attributeItemRuleMap.isEmpty()) {
ItemEvaluator evaluator = new ItemExpression(this);
for (ItemRule itemRule : attributeI... | [
"protected",
"void",
"parseDeclaredAttributes",
"(",
")",
"{",
"ItemRuleMap",
"attributeItemRuleMap",
"=",
"getRequestRule",
"(",
")",
".",
"getAttributeItemRuleMap",
"(",
")",
";",
"if",
"(",
"attributeItemRuleMap",
"!=",
"null",
"&&",
"!",
"attributeItemRuleMap",
... | Parses the declared attributes. | [
"Parses",
"the",
"declared",
"attributes",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/CoreActivity.java#L464-L473 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/CoreActivity.java | CoreActivity.execute | protected void execute(ActionList actionList) {
ProcessResult processResult = translet.getProcessResult();
if (processResult == null) {
processResult = new ProcessResult(1);
translet.setProcessResult(processResult);
}
ContentResult contentResult = processResult.g... | java | protected void execute(ActionList actionList) {
ProcessResult processResult = translet.getProcessResult();
if (processResult == null) {
processResult = new ProcessResult(1);
translet.setProcessResult(processResult);
}
ContentResult contentResult = processResult.g... | [
"protected",
"void",
"execute",
"(",
"ActionList",
"actionList",
")",
"{",
"ProcessResult",
"processResult",
"=",
"translet",
".",
"getProcessResult",
"(",
")",
";",
"if",
"(",
"processResult",
"==",
"null",
")",
"{",
"processResult",
"=",
"new",
"ProcessResult"... | Execute actions.
@param actionList the action list | [
"Execute",
"actions",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/CoreActivity.java#L521-L543 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/CoreActivity.java | CoreActivity.execute | private void execute(Executable action, ContentResult contentResult) {
try {
ChooseWhenRule chooseWhenRule = null;
if (action.getCaseNo() > 0) {
ChooseRuleMap chooseRuleMap = getTransletRule().getChooseRuleMap();
if (chooseRuleMap == null || chooseRuleMap.... | java | private void execute(Executable action, ContentResult contentResult) {
try {
ChooseWhenRule chooseWhenRule = null;
if (action.getCaseNo() > 0) {
ChooseRuleMap chooseRuleMap = getTransletRule().getChooseRuleMap();
if (chooseRuleMap == null || chooseRuleMap.... | [
"private",
"void",
"execute",
"(",
"Executable",
"action",
",",
"ContentResult",
"contentResult",
")",
"{",
"try",
"{",
"ChooseWhenRule",
"chooseWhenRule",
"=",
"null",
";",
"if",
"(",
"action",
".",
"getCaseNo",
"(",
")",
">",
"0",
")",
"{",
"ChooseRuleMap"... | Execute action.
@param action the executable action
@param contentResult the content result | [
"Execute",
"action",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/CoreActivity.java#L551-L607 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/bean/BeanRuleRegistry.java | BeanRuleRegistry.scanConfigurableBeans | public void scanConfigurableBeans(String... basePackages) throws BeanRuleException {
if (basePackages == null || basePackages.length == 0) {
return;
}
log.info("Auto component scanning on packages [" + StringUtils.joinCommaDelimitedList(basePackages) + "]");
for (String bas... | java | public void scanConfigurableBeans(String... basePackages) throws BeanRuleException {
if (basePackages == null || basePackages.length == 0) {
return;
}
log.info("Auto component scanning on packages [" + StringUtils.joinCommaDelimitedList(basePackages) + "]");
for (String bas... | [
"public",
"void",
"scanConfigurableBeans",
"(",
"String",
"...",
"basePackages",
")",
"throws",
"BeanRuleException",
"{",
"if",
"(",
"basePackages",
"==",
"null",
"||",
"basePackages",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}",
"log",
".",
"info... | Scans for annotated components.
@param basePackages the base packages to scan for annotated components
@throws BeanRuleException if an illegal bean rule is found | [
"Scans",
"for",
"annotated",
"components",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/bean/BeanRuleRegistry.java#L179-L201 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/bean/BeanRuleRegistry.java | BeanRuleRegistry.addBeanRule | public void addBeanRule(final BeanRule beanRule) throws IllegalRuleException {
PrefixSuffixPattern prefixSuffixPattern = PrefixSuffixPattern.parse(beanRule.getId());
String scanPattern = beanRule.getScanPattern();
if (scanPattern != null) {
BeanClassScanner scanner = createBeanClassS... | java | public void addBeanRule(final BeanRule beanRule) throws IllegalRuleException {
PrefixSuffixPattern prefixSuffixPattern = PrefixSuffixPattern.parse(beanRule.getId());
String scanPattern = beanRule.getScanPattern();
if (scanPattern != null) {
BeanClassScanner scanner = createBeanClassS... | [
"public",
"void",
"addBeanRule",
"(",
"final",
"BeanRule",
"beanRule",
")",
"throws",
"IllegalRuleException",
"{",
"PrefixSuffixPattern",
"prefixSuffixPattern",
"=",
"PrefixSuffixPattern",
".",
"parse",
"(",
"beanRule",
".",
"getId",
"(",
")",
")",
";",
"String",
... | Adds a bean rule.
@param beanRule the bean rule to add
@throws IllegalRuleException if an error occurs while adding a bean rule | [
"Adds",
"a",
"bean",
"rule",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/bean/BeanRuleRegistry.java#L209-L248 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/support/i18n/message/AbstractMessageSource.java | AbstractMessageSource.getMessageFromParent | protected String getMessageFromParent(String code, Object[] args, Locale locale) {
MessageSource parent = getParentMessageSource();
if (parent != null) {
if (parent instanceof AbstractMessageSource) {
// Call internal method to avoid getting the default code back
... | java | protected String getMessageFromParent(String code, Object[] args, Locale locale) {
MessageSource parent = getParentMessageSource();
if (parent != null) {
if (parent instanceof AbstractMessageSource) {
// Call internal method to avoid getting the default code back
... | [
"protected",
"String",
"getMessageFromParent",
"(",
"String",
"code",
",",
"Object",
"[",
"]",
"args",
",",
"Locale",
"locale",
")",
"{",
"MessageSource",
"parent",
"=",
"getParentMessageSource",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
... | Try to retrieve the given message from the parent MessageSource, if any.
@param code the code to lookup up, such as 'calculator.noRateSet'
@param args array of arguments that will be filled in for params within the message
@param locale the Locale in which to do the lookup
@return the resolved message, or {@code null}... | [
"Try",
"to",
"retrieve",
"the",
"given",
"message",
"from",
"the",
"parent",
"MessageSource",
"if",
"any",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/AbstractMessageSource.java#L208-L222 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/assistant/BeanReferenceInspector.java | BeanReferenceInspector.reserve | public void reserve(String beanId, Class<?> beanClass, BeanReferenceable referenceable, RuleAppender ruleAppender) {
RefererKey key = new RefererKey(beanClass, beanId);
Set<RefererInfo> refererInfoSet = refererInfoMap.get(key);
if (refererInfoSet == null) {
refererInfoSet = new Linke... | java | public void reserve(String beanId, Class<?> beanClass, BeanReferenceable referenceable, RuleAppender ruleAppender) {
RefererKey key = new RefererKey(beanClass, beanId);
Set<RefererInfo> refererInfoSet = refererInfoMap.get(key);
if (refererInfoSet == null) {
refererInfoSet = new Linke... | [
"public",
"void",
"reserve",
"(",
"String",
"beanId",
",",
"Class",
"<",
"?",
">",
"beanClass",
",",
"BeanReferenceable",
"referenceable",
",",
"RuleAppender",
"ruleAppender",
")",
"{",
"RefererKey",
"key",
"=",
"new",
"RefererKey",
"(",
"beanClass",
",",
"bea... | Reserves to bean reference inspection.
@param beanId the bean id
@param beanClass the bean class
@param referenceable the object to be inspected
@param ruleAppender the rule appender | [
"Reserves",
"to",
"bean",
"reference",
"inspection",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/BeanReferenceInspector.java#L59-L69 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/assistant/BeanReferenceInspector.java | BeanReferenceInspector.inspect | public void inspect(BeanRuleRegistry beanRuleRegistry) throws BeanReferenceException, BeanRuleException {
Set<Object> brokenReferences = new LinkedHashSet<>();
for (Map.Entry<RefererKey, Set<RefererInfo>> entry : refererInfoMap.entrySet()) {
RefererKey refererKey = entry.getKey();
... | java | public void inspect(BeanRuleRegistry beanRuleRegistry) throws BeanReferenceException, BeanRuleException {
Set<Object> brokenReferences = new LinkedHashSet<>();
for (Map.Entry<RefererKey, Set<RefererInfo>> entry : refererInfoMap.entrySet()) {
RefererKey refererKey = entry.getKey();
... | [
"public",
"void",
"inspect",
"(",
"BeanRuleRegistry",
"beanRuleRegistry",
")",
"throws",
"BeanReferenceException",
",",
"BeanRuleException",
"{",
"Set",
"<",
"Object",
">",
"brokenReferences",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
... | Inspect bean reference.
@param beanRuleRegistry the bean rule registry
@throws BeanReferenceException the bean reference exception
@throws BeanRuleException if an illegal bean rule is found | [
"Inspect",
"bean",
"reference",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/BeanReferenceInspector.java#L78-L158 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRuleMap.java | ItemRuleMap.putItemRule | public ItemRule putItemRule(ItemRule itemRule) {
if (itemRule.isAutoNamed()) {
autoNaming(itemRule);
}
return put(itemRule.getName(), itemRule);
} | java | public ItemRule putItemRule(ItemRule itemRule) {
if (itemRule.isAutoNamed()) {
autoNaming(itemRule);
}
return put(itemRule.getName(), itemRule);
} | [
"public",
"ItemRule",
"putItemRule",
"(",
"ItemRule",
"itemRule",
")",
"{",
"if",
"(",
"itemRule",
".",
"isAutoNamed",
"(",
")",
")",
"{",
"autoNaming",
"(",
"itemRule",
")",
";",
"}",
"return",
"put",
"(",
"itemRule",
".",
"getName",
"(",
")",
",",
"i... | Adds a item rule.
@param itemRule the item rule
@return the item rule | [
"Adds",
"a",
"item",
"rule",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRuleMap.java#L52-L57 | train |
aspectran/aspectran | web/src/main/java/com/aspectran/web/support/cors/DefaultCorsProcessor.java | DefaultCorsProcessor.rejectRequest | protected void rejectRequest(Translet translet, CorsException ce) throws CorsException {
HttpServletResponse res = translet.getResponseAdaptee();
res.setStatus(ce.getHttpStatusCode());
translet.setAttribute(CORS_HTTP_STATUS_CODE, ce.getHttpStatusCode());
translet.setAttribute(CORS_HTTP_... | java | protected void rejectRequest(Translet translet, CorsException ce) throws CorsException {
HttpServletResponse res = translet.getResponseAdaptee();
res.setStatus(ce.getHttpStatusCode());
translet.setAttribute(CORS_HTTP_STATUS_CODE, ce.getHttpStatusCode());
translet.setAttribute(CORS_HTTP_... | [
"protected",
"void",
"rejectRequest",
"(",
"Translet",
"translet",
",",
"CorsException",
"ce",
")",
"throws",
"CorsException",
"{",
"HttpServletResponse",
"res",
"=",
"translet",
".",
"getResponseAdaptee",
"(",
")",
";",
"res",
".",
"setStatus",
"(",
"ce",
".",
... | Invoked when one of the CORS checks failed.
The default implementation sets the response status to 403.
@param translet the Translet instance
@param ce the CORS Exception
@throws CorsException if the request is denied | [
"Invoked",
"when",
"one",
"of",
"the",
"CORS",
"checks",
"failed",
".",
"The",
"default",
"implementation",
"sets",
"the",
"response",
"status",
"to",
"403",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/support/cors/DefaultCorsProcessor.java#L158-L166 | train |
aspectran/aspectran | web/src/main/java/com/aspectran/web/startup/servlet/SpecificIPAllowedWebActivityServlet.java | SpecificIPAllowedWebActivityServlet.isAllowedAddress | private boolean isAllowedAddress(String ipAddress) {
if (allowedAddresses == null) {
return false;
}
// IPv4
int offset = ipAddress.lastIndexOf('.');
if (offset == -1) {
// IPv6
offset = ipAddress.lastIndexOf(':');
if (offset == -1... | java | private boolean isAllowedAddress(String ipAddress) {
if (allowedAddresses == null) {
return false;
}
// IPv4
int offset = ipAddress.lastIndexOf('.');
if (offset == -1) {
// IPv6
offset = ipAddress.lastIndexOf(':');
if (offset == -1... | [
"private",
"boolean",
"isAllowedAddress",
"(",
"String",
"ipAddress",
")",
"{",
"if",
"(",
"allowedAddresses",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"// IPv4",
"int",
"offset",
"=",
"ipAddress",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
... | Returns whether IP address is valid.
@param ipAddress the IP address
@return true if IP address is a valid; false otherwise | [
"Returns",
"whether",
"IP",
"address",
"is",
"valid",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/startup/servlet/SpecificIPAllowedWebActivityServlet.java#L85-L102 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/request/FileParameter.java | FileParameter.getBytes | public byte[] getBytes() throws IOException {
InputStream input = getInputStream();
ByteArrayOutputStream output = new ByteArrayOutputStream();
final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int len;
try {
while ((len = input.read(buffer)) != -1) {
... | java | public byte[] getBytes() throws IOException {
InputStream input = getInputStream();
ByteArrayOutputStream output = new ByteArrayOutputStream();
final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int len;
try {
while ((len = input.read(buffer)) != -1) {
... | [
"public",
"byte",
"[",
"]",
"getBytes",
"(",
")",
"throws",
"IOException",
"{",
"InputStream",
"input",
"=",
"getInputStream",
"(",
")",
";",
"ByteArrayOutputStream",
"output",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"final",
"byte",
"[",
"]",
"b... | Returns the contents of the file in a byte array.
Can not use a large array of memory than the JVM Heap deal.
@return a byte array
@throws IOException if an I/O error has occurred | [
"Returns",
"the",
"contents",
"of",
"the",
"file",
"in",
"a",
"byte",
"array",
".",
"Can",
"not",
"use",
"a",
"large",
"array",
"of",
"memory",
"than",
"the",
"JVM",
"Heap",
"deal",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/request/FileParameter.java#L112-L137 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/request/FileParameter.java | FileParameter.saveAs | public File saveAs(File destFile, boolean overwrite) throws IOException {
if (destFile == null) {
throw new IllegalArgumentException("destFile can not be null");
}
try {
destFile = determineDestinationFile(destFile, overwrite);
final byte[] buffer = new byte... | java | public File saveAs(File destFile, boolean overwrite) throws IOException {
if (destFile == null) {
throw new IllegalArgumentException("destFile can not be null");
}
try {
destFile = determineDestinationFile(destFile, overwrite);
final byte[] buffer = new byte... | [
"public",
"File",
"saveAs",
"(",
"File",
"destFile",
",",
"boolean",
"overwrite",
")",
"throws",
"IOException",
"{",
"if",
"(",
"destFile",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"destFile can not be null\"",
")",
";",
"}",
... | Save an file as a given destination file.
@param destFile the destination file
@param overwrite whether to overwrite if it already exists
@return a saved file
@throws IOException if an I/O error has occurred | [
"Save",
"an",
"file",
"as",
"a",
"given",
"destination",
"file",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/request/FileParameter.java#L177-L198 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/request/FileParameter.java | FileParameter.release | public void release() {
if (file != null) {
file.setWritable(true);
}
if (savedFile != null) {
savedFile.setWritable(true);
}
} | java | public void release() {
if (file != null) {
file.setWritable(true);
}
if (savedFile != null) {
savedFile.setWritable(true);
}
} | [
"public",
"void",
"release",
"(",
")",
"{",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"file",
".",
"setWritable",
"(",
"true",
")",
";",
"}",
"if",
"(",
"savedFile",
"!=",
"null",
")",
"{",
"savedFile",
".",
"setWritable",
"(",
"true",
")",
";",
... | Sets the access permission that allow write operations on the file
associated with this FileParameter. | [
"Sets",
"the",
"access",
"permission",
"that",
"allow",
"write",
"operations",
"on",
"the",
"file",
"associated",
"with",
"this",
"FileParameter",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/request/FileParameter.java#L282-L289 | train |
aspectran/aspectran | web/src/main/java/com/aspectran/web/service/AspectranWebService.java | AspectranWebService.getActivityContext | public static ActivityContext getActivityContext(ServletContext servletContext) {
ActivityContext activityContext = getActivityContext(servletContext, ROOT_WEB_SERVICE_ATTRIBUTE);
if (activityContext == null) {
throw new IllegalStateException("No Root AspectranWebService found; " +
... | java | public static ActivityContext getActivityContext(ServletContext servletContext) {
ActivityContext activityContext = getActivityContext(servletContext, ROOT_WEB_SERVICE_ATTRIBUTE);
if (activityContext == null) {
throw new IllegalStateException("No Root AspectranWebService found; " +
... | [
"public",
"static",
"ActivityContext",
"getActivityContext",
"(",
"ServletContext",
"servletContext",
")",
"{",
"ActivityContext",
"activityContext",
"=",
"getActivityContext",
"(",
"servletContext",
",",
"ROOT_WEB_SERVICE_ATTRIBUTE",
")",
";",
"if",
"(",
"activityContext",... | Find the root ActivityContext for this web aspectran service.
@param servletContext ServletContext to find the web aspectran service for
@return the ActivityContext for this web aspectran service | [
"Find",
"the",
"root",
"ActivityContext",
"for",
"this",
"web",
"aspectran",
"service",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/service/AspectranWebService.java#L372-L379 | train |
aspectran/aspectran | web/src/main/java/com/aspectran/web/service/AspectranWebService.java | AspectranWebService.getActivityContext | public static ActivityContext getActivityContext(HttpServlet servlet) {
ServletContext servletContext = servlet.getServletContext();
String attrName = STANDALONE_WEB_SERVICE_ATTRIBUTE_PREFIX + servlet.getServletName();
ActivityContext activityContext = getActivityContext(servletContext, attrName... | java | public static ActivityContext getActivityContext(HttpServlet servlet) {
ServletContext servletContext = servlet.getServletContext();
String attrName = STANDALONE_WEB_SERVICE_ATTRIBUTE_PREFIX + servlet.getServletName();
ActivityContext activityContext = getActivityContext(servletContext, attrName... | [
"public",
"static",
"ActivityContext",
"getActivityContext",
"(",
"HttpServlet",
"servlet",
")",
"{",
"ServletContext",
"servletContext",
"=",
"servlet",
".",
"getServletContext",
"(",
")",
";",
"String",
"attrName",
"=",
"STANDALONE_WEB_SERVICE_ATTRIBUTE_PREFIX",
"+",
... | Find the standalone ActivityContext for this web aspectran service.
@param servlet the servlet
@return the ActivityContext for this web aspectran service | [
"Find",
"the",
"standalone",
"ActivityContext",
"for",
"this",
"web",
"aspectran",
"service",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/service/AspectranWebService.java#L387-L396 | train |
aspectran/aspectran | web/src/main/java/com/aspectran/web/service/AspectranWebService.java | AspectranWebService.getActivityContext | private static ActivityContext getActivityContext(ServletContext servletContext, String attrName) {
Object attr = servletContext.getAttribute(attrName);
if (attr == null) {
return null;
}
if (!(attr instanceof AspectranWebService)) {
throw new IllegalStateExceptio... | java | private static ActivityContext getActivityContext(ServletContext servletContext, String attrName) {
Object attr = servletContext.getAttribute(attrName);
if (attr == null) {
return null;
}
if (!(attr instanceof AspectranWebService)) {
throw new IllegalStateExceptio... | [
"private",
"static",
"ActivityContext",
"getActivityContext",
"(",
"ServletContext",
"servletContext",
",",
"String",
"attrName",
")",
"{",
"Object",
"attr",
"=",
"servletContext",
".",
"getAttribute",
"(",
"attrName",
")",
";",
"if",
"(",
"attr",
"==",
"null",
... | Find the ActivityContext for this web aspectran service.
@param servletContext ServletContext to find the web aspectran service for
@param attrName the name of the ServletContext attribute to look for
@return the ActivityContext for this web aspectran service | [
"Find",
"the",
"ActivityContext",
"for",
"this",
"web",
"aspectran",
"service",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/service/AspectranWebService.java#L405-L415 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java | FileSessionDataStore.deleteFile | private boolean deleteFile(String filename) throws Exception {
if (filename == null) {
return false;
}
File file = new File(storeDir, filename);
return Files.deleteIfExists(file.toPath());
} | java | private boolean deleteFile(String filename) throws Exception {
if (filename == null) {
return false;
}
File file = new File(storeDir, filename);
return Files.deleteIfExists(file.toPath());
} | [
"private",
"boolean",
"deleteFile",
"(",
"String",
"filename",
")",
"throws",
"Exception",
"{",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"File",
"file",
"=",
"new",
"File",
"(",
"storeDir",
",",
"filename",
")",
";",
... | Delete the file associated with a session
@param filename name of the file containing the session's information
@return true if file was deleted, false otherwise
@throws Exception if the file associated with the session fails to be deleted | [
"Delete",
"the",
"file",
"associated",
"with",
"a",
"session"
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L101-L107 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java | FileSessionDataStore.doGetExpired | @Override
public Set<String> doGetExpired(final Set<String> candidates) {
final long now = System.currentTimeMillis();
Set<String> expired = new HashSet<>();
// iterate over the files and work out which have expired
for (String filename : sessionFileMap.values()) {
... | java | @Override
public Set<String> doGetExpired(final Set<String> candidates) {
final long now = System.currentTimeMillis();
Set<String> expired = new HashSet<>();
// iterate over the files and work out which have expired
for (String filename : sessionFileMap.values()) {
... | [
"@",
"Override",
"public",
"Set",
"<",
"String",
">",
"doGetExpired",
"(",
"final",
"Set",
"<",
"String",
">",
"candidates",
")",
"{",
"final",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"Set",
"<",
"String",
">",
"expired",
... | Check to see which sessions have expired.
@param candidates the set of session ids that the SessionCache believes
have expired
@return the complete set of sessions that have expired, including those
that are not currently loaded into the SessionCache | [
"Check",
"to",
"see",
"which",
"sessions",
"have",
"expired",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L117-L156 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java | FileSessionDataStore.getIdFromFilename | private String getIdFromFilename(String filename) {
if (!StringUtils.hasText(filename) || filename.indexOf('_') < 0) {
return null;
}
return filename.substring(0, filename.lastIndexOf('_'));
} | java | private String getIdFromFilename(String filename) {
if (!StringUtils.hasText(filename) || filename.indexOf('_') < 0) {
return null;
}
return filename.substring(0, filename.lastIndexOf('_'));
} | [
"private",
"String",
"getIdFromFilename",
"(",
"String",
"filename",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"filename",
")",
"||",
"filename",
".",
"indexOf",
"(",
"'",
"'",
")",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
... | Extract the session id from the filename.
@param filename the name of the file to use
@return the session id | [
"Extract",
"the",
"session",
"id",
"from",
"the",
"filename",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L257-L262 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java | FileSessionDataStore.isSessionFilename | private boolean isSessionFilename(String filename) {
if (!StringUtils.hasText(filename)) {
return false;
}
String[] parts = filename.split("_");
// Need at least 2 parts for a valid filename
return (parts.length >= 2);
} | java | private boolean isSessionFilename(String filename) {
if (!StringUtils.hasText(filename)) {
return false;
}
String[] parts = filename.split("_");
// Need at least 2 parts for a valid filename
return (parts.length >= 2);
} | [
"private",
"boolean",
"isSessionFilename",
"(",
"String",
"filename",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"filename",
")",
")",
"{",
"return",
"false",
";",
"}",
"String",
"[",
"]",
"parts",
"=",
"filename",
".",
"split",
"(",
... | Check if the filename matches our session pattern.
@param filename the name of the file to checks
@return true if pattern matches | [
"Check",
"if",
"the",
"filename",
"matches",
"our",
"session",
"pattern",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L270-L277 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java | FileSessionDataStore.sweepFile | public void sweepFile(long now, Path p) throws Exception {
if (p == null) {
return;
}
long expiry = getExpiryFromFilename(p.getFileName().toString());
// files with 0 expiry never expire
if (expiry > 0 && ((now - expiry) >= (5 * TimeUnit.SECONDS.toMillis(gracePe... | java | public void sweepFile(long now, Path p) throws Exception {
if (p == null) {
return;
}
long expiry = getExpiryFromFilename(p.getFileName().toString());
// files with 0 expiry never expire
if (expiry > 0 && ((now - expiry) >= (5 * TimeUnit.SECONDS.toMillis(gracePe... | [
"public",
"void",
"sweepFile",
"(",
"long",
"now",
",",
"Path",
"p",
")",
"throws",
"Exception",
"{",
"if",
"(",
"p",
"==",
"null",
")",
"{",
"return",
";",
"}",
"long",
"expiry",
"=",
"getExpiryFromFilename",
"(",
"p",
".",
"getFileName",
"(",
")",
... | Check to see if the expiry on the file is very old, and
delete the file if so. "Old" means that it expired at least
5 gracePeriods ago.
@param now the time now in msec
@param p the file to check
@throws Exception indicating error in sweep | [
"Check",
"to",
"see",
"if",
"the",
"expiry",
"on",
"the",
"file",
"is",
"very",
"old",
"and",
"delete",
"the",
"file",
"if",
"so",
".",
"Old",
"means",
"that",
"it",
"expired",
"at",
"least",
"5",
"gracePeriods",
"ago",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L315-L327 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java | FileSessionDataStore.save | private void save(OutputStream os, String id, SessionData data) throws IOException {
DataOutputStream out = new DataOutputStream(os);
out.writeUTF(id);
out.writeLong(data.getCreationTime());
out.writeLong(data.getAccessedTime());
out.writeLong(data.getLastAccessedTime());
... | java | private void save(OutputStream os, String id, SessionData data) throws IOException {
DataOutputStream out = new DataOutputStream(os);
out.writeUTF(id);
out.writeLong(data.getCreationTime());
out.writeLong(data.getAccessedTime());
out.writeLong(data.getLastAccessedTime());
... | [
"private",
"void",
"save",
"(",
"OutputStream",
"os",
",",
"String",
"id",
",",
"SessionData",
"data",
")",
"throws",
"IOException",
"{",
"DataOutputStream",
"out",
"=",
"new",
"DataOutputStream",
"(",
"os",
")",
";",
"out",
".",
"writeUTF",
"(",
"id",
")"... | Save the session data.
@param os the output stream to save to
@param id identity of the session
@param data the info of the session
@throws IOException if an I/O error has occurred | [
"Save",
"the",
"session",
"data",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L337-L353 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java | FileSessionDataStore.load | private SessionData load(InputStream is, String expectedId) throws Exception {
try {
DataInputStream di = new DataInputStream(is);
String id = di.readUTF(); // the actual id from inside the file
long created = di.readLong();
long accessed = di.readLong();
... | java | private SessionData load(InputStream is, String expectedId) throws Exception {
try {
DataInputStream di = new DataInputStream(is);
String id = di.readUTF(); // the actual id from inside the file
long created = di.readLong();
long accessed = di.readLong();
... | [
"private",
"SessionData",
"load",
"(",
"InputStream",
"is",
",",
"String",
"expectedId",
")",
"throws",
"Exception",
"{",
"try",
"{",
"DataInputStream",
"di",
"=",
"new",
"DataInputStream",
"(",
"is",
")",
";",
"String",
"id",
"=",
"di",
".",
"readUTF",
"(... | Load session data from an input stream that contains session data.
@param is the input stream containing session data
@param expectedId the id we've been told to load
@return the session data
@throws Exception if the session data could not be read from the file | [
"Load",
"session",
"data",
"from",
"an",
"input",
"stream",
"that",
"contains",
"session",
"data",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L363-L384 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java | FileSessionDataStore.restoreAttributes | private void restoreAttributes(InputStream is, int size, SessionData data) throws Exception {
if (size > 0) {
// input stream should not be closed here
Map<String, Object> attributes = new HashMap<>();
ObjectInputStream ois = new CustomObjectInputStream(is);
... | java | private void restoreAttributes(InputStream is, int size, SessionData data) throws Exception {
if (size > 0) {
// input stream should not be closed here
Map<String, Object> attributes = new HashMap<>();
ObjectInputStream ois = new CustomObjectInputStream(is);
... | [
"private",
"void",
"restoreAttributes",
"(",
"InputStream",
"is",
",",
"int",
"size",
",",
"SessionData",
"data",
")",
"throws",
"Exception",
"{",
"if",
"(",
"size",
">",
"0",
")",
"{",
"// input stream should not be closed here\r",
"Map",
"<",
"String",
",",
... | Load attributes from an input stream that contains session data.
@param is the input stream containing session data
@param size number of attributes
@param data the data to restore to
@throws Exception if the input stream is invalid or fails to read | [
"Load",
"attributes",
"from",
"an",
"input",
"stream",
"that",
"contains",
"session",
"data",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L394-L406 | train |
aspectran/aspectran | web/src/main/java/com/aspectran/web/support/multipart/inmemory/MemoryMultipartFormDataParser.java | MemoryMultipartFormDataParser.parseMultipartParameters | private void parseMultipartParameters(Map<String, List<FileItem>> fileItemListMap, RequestAdapter requestAdapter) {
String encoding = requestAdapter.getEncoding();
MultiValueMap<String, String> parameterMap = new LinkedMultiValueMap<>();
MultiValueMap<String, FileParameter> fileParameterMap = ne... | java | private void parseMultipartParameters(Map<String, List<FileItem>> fileItemListMap, RequestAdapter requestAdapter) {
String encoding = requestAdapter.getEncoding();
MultiValueMap<String, String> parameterMap = new LinkedMultiValueMap<>();
MultiValueMap<String, FileParameter> fileParameterMap = ne... | [
"private",
"void",
"parseMultipartParameters",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"FileItem",
">",
">",
"fileItemListMap",
",",
"RequestAdapter",
"requestAdapter",
")",
"{",
"String",
"encoding",
"=",
"requestAdapter",
".",
"getEncoding",
"(",
")",
";"... | Parse form fields and file items.
@param fileItemListMap the file item list map
@param requestAdapter the request adapter | [
"Parse",
"form",
"fields",
"and",
"file",
"items",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/support/multipart/inmemory/MemoryMultipartFormDataParser.java#L151-L208 | train |
aspectran/aspectran | with-freemarker/src/main/java/com/aspectran/freemarker/FreeMarkerConfigurationFactory.java | FreeMarkerConfigurationFactory.createConfiguration | public Configuration createConfiguration() throws IOException, TemplateException {
Configuration config = newConfiguration();
Properties props = new Properties();
// Merge local properties if specified.
if (this.freemarkerSettings != null) {
props.putAll(this.freemarkerSetti... | java | public Configuration createConfiguration() throws IOException, TemplateException {
Configuration config = newConfiguration();
Properties props = new Properties();
// Merge local properties if specified.
if (this.freemarkerSettings != null) {
props.putAll(this.freemarkerSetti... | [
"public",
"Configuration",
"createConfiguration",
"(",
")",
"throws",
"IOException",
",",
"TemplateException",
"{",
"Configuration",
"config",
"=",
"newConfiguration",
"(",
")",
";",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"// Merge local pro... | Prepare the FreeMarker Configuration and return it.
@return the FreeMarker Configuration object
@throws IOException if the config file wasn't found
@throws TemplateException on FreeMarker initialization failure | [
"Prepare",
"the",
"FreeMarker",
"Configuration",
"and",
"return",
"it",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-freemarker/src/main/java/com/aspectran/freemarker/FreeMarkerConfigurationFactory.java#L219-L267 | train |
aspectran/aspectran | with-freemarker/src/main/java/com/aspectran/freemarker/FreeMarkerConfigurationFactory.java | FreeMarkerConfigurationFactory.getAggregateTemplateLoader | protected TemplateLoader getAggregateTemplateLoader(TemplateLoader[] templateLoaders) {
int loaderCount = (templateLoaders != null ? templateLoaders.length : 0);
switch (loaderCount) {
case 0:
if (log.isDebugEnabled()) {
log.debug("No FreeMarker TemplateLo... | java | protected TemplateLoader getAggregateTemplateLoader(TemplateLoader[] templateLoaders) {
int loaderCount = (templateLoaders != null ? templateLoaders.length : 0);
switch (loaderCount) {
case 0:
if (log.isDebugEnabled()) {
log.debug("No FreeMarker TemplateLo... | [
"protected",
"TemplateLoader",
"getAggregateTemplateLoader",
"(",
"TemplateLoader",
"[",
"]",
"templateLoaders",
")",
"{",
"int",
"loaderCount",
"=",
"(",
"templateLoaders",
"!=",
"null",
"?",
"templateLoaders",
".",
"length",
":",
"0",
")",
";",
"switch",
"(",
... | Return a TemplateLoader based on the given TemplateLoader list.
If more than one TemplateLoader has been registered, a FreeMarker
MultiTemplateLoader needs to be created.
@param templateLoaders the final List of TemplateLoader instances
@return the aggregate TemplateLoader | [
"Return",
"a",
"TemplateLoader",
"based",
"on",
"the",
"given",
"TemplateLoader",
"list",
".",
"If",
"more",
"than",
"one",
"TemplateLoader",
"has",
"been",
"registered",
"a",
"FreeMarker",
"MultiTemplateLoader",
"needs",
"to",
"be",
"created",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-freemarker/src/main/java/com/aspectran/freemarker/FreeMarkerConfigurationFactory.java#L289-L309 | train |
aspectran/aspectran | with-freemarker/src/main/java/com/aspectran/freemarker/FreeMarkerConfigurationFactory.java | FreeMarkerConfigurationFactory.getTemplateLoaderForPath | protected TemplateLoader getTemplateLoaderForPath(String templateLoaderPath) throws IOException {
if (templateLoaderPath.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
String basePackagePath = templateLoaderPath.substring(ResourceUtils.CLASSPATH_URL_PREFIX.length());
if (log.isDebugEn... | java | protected TemplateLoader getTemplateLoaderForPath(String templateLoaderPath) throws IOException {
if (templateLoaderPath.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
String basePackagePath = templateLoaderPath.substring(ResourceUtils.CLASSPATH_URL_PREFIX.length());
if (log.isDebugEn... | [
"protected",
"TemplateLoader",
"getTemplateLoaderForPath",
"(",
"String",
"templateLoaderPath",
")",
"throws",
"IOException",
"{",
"if",
"(",
"templateLoaderPath",
".",
"startsWith",
"(",
"ResourceUtils",
".",
"CLASSPATH_URL_PREFIX",
")",
")",
"{",
"String",
"basePackag... | Determine a FreeMarker TemplateLoader for the given path.
@param templateLoaderPath the path to load templates from
@return an appropriate TemplateLoader
@throws IOException if an I/O error has occurred
@see freemarker.cache.FileTemplateLoader | [
"Determine",
"a",
"FreeMarker",
"TemplateLoader",
"for",
"the",
"given",
"path",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-freemarker/src/main/java/com/aspectran/freemarker/FreeMarkerConfigurationFactory.java#L319-L342 | train |
aspectran/aspectran | shell/src/main/java/com/aspectran/shell/command/option/Options.java | Options.addOption | public Options addOption(Option opt) {
String key = opt.getKey();
// add it to the long option list
if (opt.hasLongName()) {
longOpts.put(opt.getLongName(), opt);
}
// if the option is required add it to the required list
if (opt.isRequired()) {
... | java | public Options addOption(Option opt) {
String key = opt.getKey();
// add it to the long option list
if (opt.hasLongName()) {
longOpts.put(opt.getLongName(), opt);
}
// if the option is required add it to the required list
if (opt.isRequired()) {
... | [
"public",
"Options",
"addOption",
"(",
"Option",
"opt",
")",
"{",
"String",
"key",
"=",
"opt",
".",
"getKey",
"(",
")",
";",
"// add it to the long option list",
"if",
"(",
"opt",
".",
"hasLongName",
"(",
")",
")",
"{",
"longOpts",
".",
"put",
"(",
"opt"... | Adds an option instance.
@param opt the option that is to be added
@return the resulting Options instance | [
"Adds",
"an",
"option",
"instance",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/Options.java#L120-L138 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/HeaderActionRule.java | HeaderActionRule.newHeaderItemRule | public ItemRule newHeaderItemRule(String headerName) {
ItemRule itemRule = new ItemRule();
itemRule.setName(headerName);
addHeaderItemRule(itemRule);
return itemRule;
} | java | public ItemRule newHeaderItemRule(String headerName) {
ItemRule itemRule = new ItemRule();
itemRule.setName(headerName);
addHeaderItemRule(itemRule);
return itemRule;
} | [
"public",
"ItemRule",
"newHeaderItemRule",
"(",
"String",
"headerName",
")",
"{",
"ItemRule",
"itemRule",
"=",
"new",
"ItemRule",
"(",
")",
";",
"itemRule",
".",
"setName",
"(",
"headerName",
")",
";",
"addHeaderItemRule",
"(",
"itemRule",
")",
";",
"return",
... | Adds a new header rule with the specified name and returns it.
@param headerName the header name
@return the header item rule | [
"Adds",
"a",
"new",
"header",
"rule",
"with",
"the",
"specified",
"name",
"and",
"returns",
"it",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/HeaderActionRule.java#L78-L83 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/HeaderActionRule.java | HeaderActionRule.addHeaderItemRule | public void addHeaderItemRule(ItemRule headerItemRule) {
if (headerItemRuleMap == null) {
headerItemRuleMap = new ItemRuleMap();
}
headerItemRuleMap.putItemRule(headerItemRule);
} | java | public void addHeaderItemRule(ItemRule headerItemRule) {
if (headerItemRuleMap == null) {
headerItemRuleMap = new ItemRuleMap();
}
headerItemRuleMap.putItemRule(headerItemRule);
} | [
"public",
"void",
"addHeaderItemRule",
"(",
"ItemRule",
"headerItemRule",
")",
"{",
"if",
"(",
"headerItemRuleMap",
"==",
"null",
")",
"{",
"headerItemRuleMap",
"=",
"new",
"ItemRuleMap",
"(",
")",
";",
"}",
"headerItemRuleMap",
".",
"putItemRule",
"(",
"headerI... | Adds the header item rule.
@param headerItemRule the header item rule | [
"Adds",
"the",
"header",
"item",
"rule",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/HeaderActionRule.java#L90-L95 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/HeaderActionRule.java | HeaderActionRule.newInstance | public static HeaderActionRule newInstance(String id, Boolean hidden) {
HeaderActionRule headerActionRule = new HeaderActionRule();
headerActionRule.setActionId(id);
headerActionRule.setHidden(hidden);
return headerActionRule;
} | java | public static HeaderActionRule newInstance(String id, Boolean hidden) {
HeaderActionRule headerActionRule = new HeaderActionRule();
headerActionRule.setActionId(id);
headerActionRule.setHidden(hidden);
return headerActionRule;
} | [
"public",
"static",
"HeaderActionRule",
"newInstance",
"(",
"String",
"id",
",",
"Boolean",
"hidden",
")",
"{",
"HeaderActionRule",
"headerActionRule",
"=",
"new",
"HeaderActionRule",
"(",
")",
";",
"headerActionRule",
".",
"setActionId",
"(",
"id",
")",
";",
"h... | Returns a new derived instance of HeaderActionRule.
@param id the action id
@param hidden whether to hide result of the action
@return the header action rule | [
"Returns",
"a",
"new",
"derived",
"instance",
"of",
"HeaderActionRule",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/HeaderActionRule.java#L142-L147 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/expr/TokenExpression.java | TokenExpression.getBean | protected Object getBean(Token token) {
Object value;
if (token.getAlternativeValue() != null) {
if (token.getDirectiveType() == TokenDirectiveType.FIELD) {
Field field = (Field)token.getAlternativeValue();
if (Modifier.isStatic(field.getModifiers())) {
... | java | protected Object getBean(Token token) {
Object value;
if (token.getAlternativeValue() != null) {
if (token.getDirectiveType() == TokenDirectiveType.FIELD) {
Field field = (Field)token.getAlternativeValue();
if (Modifier.isStatic(field.getModifiers())) {
... | [
"protected",
"Object",
"getBean",
"(",
"Token",
"token",
")",
"{",
"Object",
"value",
";",
"if",
"(",
"token",
".",
"getAlternativeValue",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"token",
".",
"getDirectiveType",
"(",
")",
"==",
"TokenDirectiveType",
... | Returns the bean instance that matches the given token.
@param token the token
@return an instance of the bean | [
"Returns",
"the",
"bean",
"instance",
"that",
"matches",
"the",
"given",
"token",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/TokenExpression.java#L363-L416 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/expr/TokenExpression.java | TokenExpression.getBeanProperty | protected Object getBeanProperty(final Object object, String propertyName) {
Object value;
try {
value = BeanUtils.getProperty(object, propertyName);
} catch (InvocationTargetException e) {
// ignore
value = null;
}
return value;
} | java | protected Object getBeanProperty(final Object object, String propertyName) {
Object value;
try {
value = BeanUtils.getProperty(object, propertyName);
} catch (InvocationTargetException e) {
// ignore
value = null;
}
return value;
} | [
"protected",
"Object",
"getBeanProperty",
"(",
"final",
"Object",
"object",
",",
"String",
"propertyName",
")",
"{",
"Object",
"value",
";",
"try",
"{",
"value",
"=",
"BeanUtils",
".",
"getProperty",
"(",
"object",
",",
"propertyName",
")",
";",
"}",
"catch"... | Invoke bean's property.
@param object the object
@param propertyName the property name
@return the object | [
"Invoke",
"bean",
"s",
"property",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/TokenExpression.java#L425-L434 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/expr/TokenExpression.java | TokenExpression.getProperty | protected Object getProperty(Token token) throws IOException {
if (token.getDirectiveType() == TokenDirectiveType.CLASSPATH) {
Properties props = PropertiesLoaderUtils.loadProperties(token.getValue(), activity.getEnvironment().getClassLoader());
Object value = (token.getGetterName() != n... | java | protected Object getProperty(Token token) throws IOException {
if (token.getDirectiveType() == TokenDirectiveType.CLASSPATH) {
Properties props = PropertiesLoaderUtils.loadProperties(token.getValue(), activity.getEnvironment().getClassLoader());
Object value = (token.getGetterName() != n... | [
"protected",
"Object",
"getProperty",
"(",
"Token",
"token",
")",
"throws",
"IOException",
"{",
"if",
"(",
"token",
".",
"getDirectiveType",
"(",
")",
"==",
"TokenDirectiveType",
".",
"CLASSPATH",
")",
"{",
"Properties",
"props",
"=",
"PropertiesLoaderUtils",
".... | Returns an Environment variable that matches the given token.
<pre>
%{classpath:/com/aspectran/sample.properties}
%{classpath:/com/aspectran/sample.properties^propertyName:defaultValue}
</pre>
@param token the token
@return an environment variable
@throws IOException if an I/O error has occurred | [
"Returns",
"an",
"Environment",
"variable",
"that",
"matches",
"the",
"given",
"token",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/TokenExpression.java#L448-L460 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/expr/TokenExpression.java | TokenExpression.getTemplate | protected String getTemplate(Token token) {
TemplateRenderer templateRenderer = activity.getActivityContext().getTemplateRenderer();
StringWriter writer = new StringWriter();
templateRenderer.render(token.getName(), activity, writer);
String result = writer.toString();
return (... | java | protected String getTemplate(Token token) {
TemplateRenderer templateRenderer = activity.getActivityContext().getTemplateRenderer();
StringWriter writer = new StringWriter();
templateRenderer.render(token.getName(), activity, writer);
String result = writer.toString();
return (... | [
"protected",
"String",
"getTemplate",
"(",
"Token",
"token",
")",
"{",
"TemplateRenderer",
"templateRenderer",
"=",
"activity",
".",
"getActivityContext",
"(",
")",
".",
"getTemplateRenderer",
"(",
")",
";",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(... | Executes template, returns the generated output.
@param token the token
@return the generated output as {@code String} | [
"Executes",
"template",
"returns",
"the",
"generated",
"output",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/TokenExpression.java#L468-L476 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/expr/token/Token.java | Token.stringify | public String stringify() {
if (type == TokenType.TEXT) {
return defaultValue;
}
StringBuilder sb = new StringBuilder();
if (type == TokenType.BEAN) {
sb.append(BEAN_SYMBOL);
sb.append(START_BRACKET);
if (name != null) {
sb.... | java | public String stringify() {
if (type == TokenType.TEXT) {
return defaultValue;
}
StringBuilder sb = new StringBuilder();
if (type == TokenType.BEAN) {
sb.append(BEAN_SYMBOL);
sb.append(START_BRACKET);
if (name != null) {
sb.... | [
"public",
"String",
"stringify",
"(",
")",
"{",
"if",
"(",
"type",
"==",
"TokenType",
".",
"TEXT",
")",
"{",
"return",
"defaultValue",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"type",
"==",
"TokenType",
".... | Convert a Token object into a string.
@return a string representation of the token | [
"Convert",
"a",
"Token",
"object",
"into",
"a",
"string",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/token/Token.java#L299-L363 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/expr/token/Token.java | Token.isTokenSymbol | public static boolean isTokenSymbol(char c) {
return (c == BEAN_SYMBOL
|| c == TEMPLATE_SYMBOL
|| c == PARAMETER_SYMBOL
|| c == ATTRIBUTE_SYMBOL
|| c == PROPERTY_SYMBOL);
} | java | public static boolean isTokenSymbol(char c) {
return (c == BEAN_SYMBOL
|| c == TEMPLATE_SYMBOL
|| c == PARAMETER_SYMBOL
|| c == ATTRIBUTE_SYMBOL
|| c == PROPERTY_SYMBOL);
} | [
"public",
"static",
"boolean",
"isTokenSymbol",
"(",
"char",
"c",
")",
"{",
"return",
"(",
"c",
"==",
"BEAN_SYMBOL",
"||",
"c",
"==",
"TEMPLATE_SYMBOL",
"||",
"c",
"==",
"PARAMETER_SYMBOL",
"||",
"c",
"==",
"ATTRIBUTE_SYMBOL",
"||",
"c",
"==",
"PROPERTY_SYMB... | Returns whether a specified character is the token symbol.
@param c a character
@return true, if a specified character is one of the token symbols | [
"Returns",
"whether",
"a",
"specified",
"character",
"is",
"the",
"token",
"symbol",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/token/Token.java#L454-L460 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/expr/token/Token.java | Token.resolveTypeAsSymbol | public static TokenType resolveTypeAsSymbol(char symbol) {
TokenType type;
if (symbol == Token.BEAN_SYMBOL) {
type = TokenType.BEAN;
} else if (symbol == Token.TEMPLATE_SYMBOL) {
type = TokenType.TEMPLATE;
} else if (symbol == Token.PARAMETER_SYMBOL) {
... | java | public static TokenType resolveTypeAsSymbol(char symbol) {
TokenType type;
if (symbol == Token.BEAN_SYMBOL) {
type = TokenType.BEAN;
} else if (symbol == Token.TEMPLATE_SYMBOL) {
type = TokenType.TEMPLATE;
} else if (symbol == Token.PARAMETER_SYMBOL) {
... | [
"public",
"static",
"TokenType",
"resolveTypeAsSymbol",
"(",
"char",
"symbol",
")",
"{",
"TokenType",
"type",
";",
"if",
"(",
"symbol",
"==",
"Token",
".",
"BEAN_SYMBOL",
")",
"{",
"type",
"=",
"TokenType",
".",
"BEAN",
";",
"}",
"else",
"if",
"(",
"symb... | Returns the token type for the specified character.
@param symbol the token symbol character
@return the token type | [
"Returns",
"the",
"token",
"type",
"for",
"the",
"specified",
"character",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/token/Token.java#L482-L498 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/TransformRule.java | TransformRule.setTransformType | public void setTransformType(TransformType transformType) {
this.transformType = transformType;
if (contentType == null && transformType != null) {
if (transformType == TransformType.TEXT) {
contentType = ContentType.TEXT_PLAIN.toString();
} else if (transformTyp... | java | public void setTransformType(TransformType transformType) {
this.transformType = transformType;
if (contentType == null && transformType != null) {
if (transformType == TransformType.TEXT) {
contentType = ContentType.TEXT_PLAIN.toString();
} else if (transformTyp... | [
"public",
"void",
"setTransformType",
"(",
"TransformType",
"transformType",
")",
"{",
"this",
".",
"transformType",
"=",
"transformType",
";",
"if",
"(",
"contentType",
"==",
"null",
"&&",
"transformType",
"!=",
"null",
")",
"{",
"if",
"(",
"transformType",
"... | Sets the transform type.
@param transformType the transformType to set | [
"Sets",
"the",
"transform",
"type",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/TransformRule.java#L66-L78 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/TransformRule.java | TransformRule.setTemplateRule | public void setTemplateRule(TemplateRule templateRule) {
this.templateRule = templateRule;
if (templateRule != null) {
if (this.transformType == null) {
setTransformType(TransformType.TEXT);
}
if (templateRule.getEncoding() != null && this.encoding == ... | java | public void setTemplateRule(TemplateRule templateRule) {
this.templateRule = templateRule;
if (templateRule != null) {
if (this.transformType == null) {
setTransformType(TransformType.TEXT);
}
if (templateRule.getEncoding() != null && this.encoding == ... | [
"public",
"void",
"setTemplateRule",
"(",
"TemplateRule",
"templateRule",
")",
"{",
"this",
".",
"templateRule",
"=",
"templateRule",
";",
"if",
"(",
"templateRule",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"transformType",
"==",
"null",
")",
"{",
"... | Sets the template rule.
@param templateRule the template rule | [
"Sets",
"the",
"template",
"rule",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/TransformRule.java#L181-L191 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/process/result/ActionResult.java | ActionResult.setResultValue | public void setResultValue(String actionId, Object resultValue) {
if (actionId == null || !actionId.contains(ActivityContext.ID_SEPARATOR)) {
this.actionId = actionId;
this.resultValue = resultValue;
} else {
String[] ids = StringUtils.tokenize(actionId, ActivityConte... | java | public void setResultValue(String actionId, Object resultValue) {
if (actionId == null || !actionId.contains(ActivityContext.ID_SEPARATOR)) {
this.actionId = actionId;
this.resultValue = resultValue;
} else {
String[] ids = StringUtils.tokenize(actionId, ActivityConte... | [
"public",
"void",
"setResultValue",
"(",
"String",
"actionId",
",",
"Object",
"resultValue",
")",
"{",
"if",
"(",
"actionId",
"==",
"null",
"||",
"!",
"actionId",
".",
"contains",
"(",
"ActivityContext",
".",
"ID_SEPARATOR",
")",
")",
"{",
"this",
".",
"ac... | Sets the result value of the action.
@param actionId the new action id
@param resultValue the new result value of the action | [
"Sets",
"the",
"result",
"value",
"of",
"the",
"action",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/process/result/ActionResult.java#L59-L85 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/ResourceUtils.java | ResourceUtils.getResource | public static URL getResource(String resource, ClassLoader classLoader) throws IOException {
URL url = null;
if (classLoader != null) {
url = classLoader.getResource(resource);
}
if (url == null) {
url = ClassLoader.getSystemResource(resource);
}
i... | java | public static URL getResource(String resource, ClassLoader classLoader) throws IOException {
URL url = null;
if (classLoader != null) {
url = classLoader.getResource(resource);
}
if (url == null) {
url = ClassLoader.getSystemResource(resource);
}
i... | [
"public",
"static",
"URL",
"getResource",
"(",
"String",
"resource",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"null",
";",
"if",
"(",
"classLoader",
"!=",
"null",
")",
"{",
"url",
"=",
"classLoader",
".",
"ge... | Returns the URL of the resource on the classpath.
@param classLoader the class loader used to load the resource
@param resource the resource to find
@return {@code URL} object for reading the resource;
{@code null} if the resource could not be found
@throws IOException if the resource cannot be found or read | [
"Returns",
"the",
"URL",
"of",
"the",
"resource",
"on",
"the",
"classpath",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ResourceUtils.java#L229-L241 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/ResourceUtils.java | ResourceUtils.getReader | public static Reader getReader(final File file, String encoding) throws IOException {
InputStream stream;
try {
stream = AccessController.doPrivileged(
new PrivilegedExceptionAction<InputStream>() {
@Override
public InputStr... | java | public static Reader getReader(final File file, String encoding) throws IOException {
InputStream stream;
try {
stream = AccessController.doPrivileged(
new PrivilegedExceptionAction<InputStream>() {
@Override
public InputStr... | [
"public",
"static",
"Reader",
"getReader",
"(",
"final",
"File",
"file",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"InputStream",
"stream",
";",
"try",
"{",
"stream",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExcept... | Returns a Reader for reading the specified file.
@param file the file
@param encoding the encoding
@return the reader instance
@throws IOException if an error occurred when reading resources using any I/O operations | [
"Returns",
"a",
"Reader",
"for",
"reading",
"the",
"specified",
"file",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ResourceUtils.java#L294-L316 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/ResourceUtils.java | ResourceUtils.getReader | public static Reader getReader(final URL url, String encoding) throws IOException {
InputStream stream;
try {
stream = AccessController.doPrivileged(
new PrivilegedExceptionAction<InputStream>() {
@Override
public InputStrea... | java | public static Reader getReader(final URL url, String encoding) throws IOException {
InputStream stream;
try {
stream = AccessController.doPrivileged(
new PrivilegedExceptionAction<InputStream>() {
@Override
public InputStrea... | [
"public",
"static",
"Reader",
"getReader",
"(",
"final",
"URL",
"url",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"InputStream",
"stream",
";",
"try",
"{",
"stream",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptio... | Returns a Reader for reading the specified url.
@param url the url
@param encoding the encoding
@return the reader instance
@throws IOException if an error occurred when reading resources using any I/O operations | [
"Returns",
"a",
"Reader",
"for",
"reading",
"the",
"specified",
"url",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ResourceUtils.java#L326-L357 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/ResourceUtils.java | ResourceUtils.read | public static String read(File file, String encoding) throws IOException {
Reader reader = getReader(file, encoding);
String source;
try {
source = read(reader);
} finally {
reader.close();
}
return source;
} | java | public static String read(File file, String encoding) throws IOException {
Reader reader = getReader(file, encoding);
String source;
try {
source = read(reader);
} finally {
reader.close();
}
return source;
} | [
"public",
"static",
"String",
"read",
"(",
"File",
"file",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"Reader",
"reader",
"=",
"getReader",
"(",
"file",
",",
"encoding",
")",
";",
"String",
"source",
";",
"try",
"{",
"source",
"=",
"re... | Returns a string from the specified file.
@param file the file
@param encoding the encoding
@return the reader instance
@throws IOException if an error occurred when reading resources using any I/O operations | [
"Returns",
"a",
"string",
"from",
"the",
"specified",
"file",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ResourceUtils.java#L367-L376 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/ResourceUtils.java | ResourceUtils.read | public static String read(URL url, String encoding) throws IOException {
Reader reader = getReader(url, encoding);
String source;
try {
source = read(reader);
} finally {
reader.close();
}
return source;
} | java | public static String read(URL url, String encoding) throws IOException {
Reader reader = getReader(url, encoding);
String source;
try {
source = read(reader);
} finally {
reader.close();
}
return source;
} | [
"public",
"static",
"String",
"read",
"(",
"URL",
"url",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"Reader",
"reader",
"=",
"getReader",
"(",
"url",
",",
"encoding",
")",
";",
"String",
"source",
";",
"try",
"{",
"source",
"=",
"read"... | Returns a string from the specified url.
@param url the url
@param encoding the encoding
@return the string
@throws IOException if an error occurred when reading resources using any I/O operations | [
"Returns",
"a",
"string",
"from",
"the",
"specified",
"url",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ResourceUtils.java#L386-L395 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/ResourceUtils.java | ResourceUtils.read | public static String read(Reader reader) throws IOException {
final char[] buffer = new char[1024];
StringBuilder sb = new StringBuilder();
int len;
while ((len = reader.read(buffer)) != -1) {
sb.append(buffer, 0, len);
}
return sb.toString();
} | java | public static String read(Reader reader) throws IOException {
final char[] buffer = new char[1024];
StringBuilder sb = new StringBuilder();
int len;
while ((len = reader.read(buffer)) != -1) {
sb.append(buffer, 0, len);
}
return sb.toString();
} | [
"public",
"static",
"String",
"read",
"(",
"Reader",
"reader",
")",
"throws",
"IOException",
"{",
"final",
"char",
"[",
"]",
"buffer",
"=",
"new",
"char",
"[",
"1024",
"]",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
... | Returns a string from the specified Reader object.
@param reader the reader
@return the string
@throws IOException if an error occurred when reading resources using any I/O operations | [
"Returns",
"a",
"string",
"from",
"the",
"specified",
"Reader",
"object",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ResourceUtils.java#L404-L412 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/response/dispatch/DispatchResponse.java | DispatchResponse.getViewDispatcher | private ViewDispatcher getViewDispatcher(Activity activity) throws ViewDispatcherException {
if (dispatchRule.getViewDispatcher() != null) {
return dispatchRule.getViewDispatcher();
}
try {
String dispatcherName;
if (dispatchRule.getDispatcherName() != null) ... | java | private ViewDispatcher getViewDispatcher(Activity activity) throws ViewDispatcherException {
if (dispatchRule.getViewDispatcher() != null) {
return dispatchRule.getViewDispatcher();
}
try {
String dispatcherName;
if (dispatchRule.getDispatcherName() != null) ... | [
"private",
"ViewDispatcher",
"getViewDispatcher",
"(",
"Activity",
"activity",
")",
"throws",
"ViewDispatcherException",
"{",
"if",
"(",
"dispatchRule",
".",
"getViewDispatcher",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"dispatchRule",
".",
"getViewDispatcher",
"... | Determine the view dispatcher.
@param activity the current Activity
@throws ViewDispatcherException if ViewDispatcher can not be determined | [
"Determine",
"the",
"view",
"dispatcher",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/response/dispatch/DispatchResponse.java#L119-L163 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/response/dispatch/DispatchResponse.java | DispatchResponse.fetchAttributes | public static void fetchAttributes(RequestAdapter requestAdapter, ProcessResult processResult) {
if (processResult != null) {
for (ContentResult contentResult : processResult) {
for (ActionResult actionResult : contentResult) {
Object actionResultValue = actionRes... | java | public static void fetchAttributes(RequestAdapter requestAdapter, ProcessResult processResult) {
if (processResult != null) {
for (ContentResult contentResult : processResult) {
for (ActionResult actionResult : contentResult) {
Object actionResultValue = actionRes... | [
"public",
"static",
"void",
"fetchAttributes",
"(",
"RequestAdapter",
"requestAdapter",
",",
"ProcessResult",
"processResult",
")",
"{",
"if",
"(",
"processResult",
"!=",
"null",
")",
"{",
"for",
"(",
"ContentResult",
"contentResult",
":",
"processResult",
")",
"{... | Stores an attribute in request.
@param requestAdapter the request adapter
@param processResult the process result | [
"Stores",
"an",
"attribute",
"in",
"request",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/response/dispatch/DispatchResponse.java#L176-L192 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/resource/AspectranClassLoader.java | AspectranClassLoader.excludePackage | public void excludePackage(String... packageNames) {
if (packageNames == null) {
excludePackageNames = null;
} else {
for (String packageName : packageNames) {
if (excludePackageNames == null) {
excludePackageNames = new HashSet<>();
... | java | public void excludePackage(String... packageNames) {
if (packageNames == null) {
excludePackageNames = null;
} else {
for (String packageName : packageNames) {
if (excludePackageNames == null) {
excludePackageNames = new HashSet<>();
... | [
"public",
"void",
"excludePackage",
"(",
"String",
"...",
"packageNames",
")",
"{",
"if",
"(",
"packageNames",
"==",
"null",
")",
"{",
"excludePackageNames",
"=",
"null",
";",
"}",
"else",
"{",
"for",
"(",
"String",
"packageName",
":",
"packageNames",
")",
... | Adds packages that this ClassLoader should not handle.
Any class whose fully-qualified name starts with the name registered here will be handled
by the parent ClassLoader in the usual fashion.
@param packageNames package names that we be compared against fully qualified package names to exclude | [
"Adds",
"packages",
"that",
"this",
"ClassLoader",
"should",
"not",
"handle",
".",
"Any",
"class",
"whose",
"fully",
"-",
"qualified",
"name",
"starts",
"with",
"the",
"name",
"registered",
"here",
"will",
"be",
"handled",
"by",
"the",
"parent",
"ClassLoader",... | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/resource/AspectranClassLoader.java#L179-L190 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/resource/AspectranClassLoader.java | AspectranClassLoader.excludeClass | public void excludeClass(String... classNames) {
if (classNames == null) {
excludeClassNames = null;
} else {
for (String className : classNames) {
if (!isExcludePackage(className)) {
if (excludeClassNames == null) {
exc... | java | public void excludeClass(String... classNames) {
if (classNames == null) {
excludeClassNames = null;
} else {
for (String className : classNames) {
if (!isExcludePackage(className)) {
if (excludeClassNames == null) {
exc... | [
"public",
"void",
"excludeClass",
"(",
"String",
"...",
"classNames",
")",
"{",
"if",
"(",
"classNames",
"==",
"null",
")",
"{",
"excludeClassNames",
"=",
"null",
";",
"}",
"else",
"{",
"for",
"(",
"String",
"className",
":",
"classNames",
")",
"{",
"if"... | Adds classes that this ClassLoader should not handle.
Any class whose fully-qualified name starts with the name registered here will be handled
by the parent ClassLoader in the usual fashion.
@param classNames class names that we be compared against fully qualified class names to exclude | [
"Adds",
"classes",
"that",
"this",
"ClassLoader",
"should",
"not",
"handle",
".",
"Any",
"class",
"whose",
"fully",
"-",
"qualified",
"name",
"starts",
"with",
"the",
"name",
"registered",
"here",
"will",
"be",
"handled",
"by",
"the",
"parent",
"ClassLoader",
... | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/resource/AspectranClassLoader.java#L199-L212 | train |
aspectran/aspectran | with-mybatis/src/main/java/com/aspectran/mybatis/SqlSessionTxAdvice.java | SqlSessionTxAdvice.open | public void open() {
if(sqlSession == null) {
if (executorType == null) {
executorType = ExecutorType.SIMPLE;
}
sqlSession = sqlSessionFactory.openSession(executorType, autoCommit);
if (log.isDebugEnabled()) {
ToStringBuilder tsb ... | java | public void open() {
if(sqlSession == null) {
if (executorType == null) {
executorType = ExecutorType.SIMPLE;
}
sqlSession = sqlSessionFactory.openSession(executorType, autoCommit);
if (log.isDebugEnabled()) {
ToStringBuilder tsb ... | [
"public",
"void",
"open",
"(",
")",
"{",
"if",
"(",
"sqlSession",
"==",
"null",
")",
"{",
"if",
"(",
"executorType",
"==",
"null",
")",
"{",
"executorType",
"=",
"ExecutorType",
".",
"SIMPLE",
";",
"}",
"sqlSession",
"=",
"sqlSessionFactory",
".",
"openS... | Opens a new SqlSession and store its instance inside. Therefore, whenever
there is a request for a SqlSessionTxAdvice bean, a new bean instance of
the object must be created. | [
"Opens",
"a",
"new",
"SqlSession",
"and",
"store",
"its",
"instance",
"inside",
".",
"Therefore",
"whenever",
"there",
"is",
"a",
"request",
"for",
"a",
"SqlSessionTxAdvice",
"bean",
"a",
"new",
"bean",
"instance",
"of",
"the",
"object",
"must",
"be",
"creat... | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-mybatis/src/main/java/com/aspectran/mybatis/SqlSessionTxAdvice.java#L72-L92 | train |
aspectran/aspectran | with-mybatis/src/main/java/com/aspectran/mybatis/SqlSessionTxAdvice.java | SqlSessionTxAdvice.commit | public void commit(boolean force) {
if (checkSession()) {
return;
}
if (log.isDebugEnabled()) {
ToStringBuilder tsb = new ToStringBuilder(String.format("Committing transactional %s@%x",
sqlSession.getClass().getSimpleName(),sqlSession.hashCode()));
... | java | public void commit(boolean force) {
if (checkSession()) {
return;
}
if (log.isDebugEnabled()) {
ToStringBuilder tsb = new ToStringBuilder(String.format("Committing transactional %s@%x",
sqlSession.getClass().getSimpleName(),sqlSession.hashCode()));
... | [
"public",
"void",
"commit",
"(",
"boolean",
"force",
")",
"{",
"if",
"(",
"checkSession",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"ToStringBuilder",
"tsb",
"=",
"new",
"ToStringBuilder",
"(",... | Flushes batch statements and commits database connection.
@param force forces connection commit | [
"Flushes",
"batch",
"statements",
"and",
"commits",
"database",
"connection",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-mybatis/src/main/java/com/aspectran/mybatis/SqlSessionTxAdvice.java#L134-L147 | train |
aspectran/aspectran | with-mybatis/src/main/java/com/aspectran/mybatis/SqlSessionTxAdvice.java | SqlSessionTxAdvice.close | public void close(boolean arbitrarily) {
if (checkSession()) {
return;
}
arbitrarilyClosed = arbitrarily;
sqlSession.close();
if (log.isDebugEnabled()) {
log.debug(String.format("Closed %s@%x",
sqlSession.getClass().getSimpleName(),
... | java | public void close(boolean arbitrarily) {
if (checkSession()) {
return;
}
arbitrarilyClosed = arbitrarily;
sqlSession.close();
if (log.isDebugEnabled()) {
log.debug(String.format("Closed %s@%x",
sqlSession.getClass().getSimpleName(),
... | [
"public",
"void",
"close",
"(",
"boolean",
"arbitrarily",
")",
"{",
"if",
"(",
"checkSession",
"(",
")",
")",
"{",
"return",
";",
"}",
"arbitrarilyClosed",
"=",
"arbitrarily",
";",
"sqlSession",
".",
"close",
"(",
")",
";",
"if",
"(",
"log",
".",
"isDe... | Closes the session arbitrarily.
If the transaction advice does not finally close the session, the session
will automatically reopen whenever necessary.
@param arbitrarily true if the session is closed arbitrarily; otherwise false | [
"Closes",
"the",
"session",
"arbitrarily",
".",
"If",
"the",
"transaction",
"advice",
"does",
"not",
"finally",
"close",
"the",
"session",
"the",
"session",
"will",
"automatically",
"reopen",
"whenever",
"necessary",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-mybatis/src/main/java/com/aspectran/mybatis/SqlSessionTxAdvice.java#L202-L217 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/MultiException.java | MultiException.ifExceptionThrow | public void ifExceptionThrow() throws Exception {
if(nested == null || nested.isEmpty()) {
return;
}
if (nested.size() == 1) {
Throwable th = nested.get(0);
if (th instanceof Error) {
throw (Error)th;
}
if (th instanceof... | java | public void ifExceptionThrow() throws Exception {
if(nested == null || nested.isEmpty()) {
return;
}
if (nested.size() == 1) {
Throwable th = nested.get(0);
if (th instanceof Error) {
throw (Error)th;
}
if (th instanceof... | [
"public",
"void",
"ifExceptionThrow",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"nested",
"==",
"null",
"||",
"nested",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"nested",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
... | Throw a MultiException.
If this multi exception is empty then no action is taken. If it
contains a single exception that is thrown, otherwise the this
multi exception is thrown.
@exception Exception the Error or Exception if nested is 1, or the
MultiException itself if nested is more than 1. | [
"Throw",
"a",
"MultiException",
".",
"If",
"this",
"multi",
"exception",
"is",
"empty",
"then",
"no",
"action",
"is",
"taken",
".",
"If",
"it",
"contains",
"a",
"single",
"exception",
"that",
"is",
"thrown",
"otherwise",
"the",
"this",
"multi",
"exception",
... | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MultiException.java#L80-L94 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/MultiException.java | MultiException.ifExceptionThrowRuntime | public void ifExceptionThrowRuntime() throws Error {
if(nested == null || nested.isEmpty()) {
return;
}
if (nested.size() == 1) {
Throwable th = nested.get(0);
if (th instanceof Error) {
throw (Error)th;
} else if (th instanceof Run... | java | public void ifExceptionThrowRuntime() throws Error {
if(nested == null || nested.isEmpty()) {
return;
}
if (nested.size() == 1) {
Throwable th = nested.get(0);
if (th instanceof Error) {
throw (Error)th;
} else if (th instanceof Run... | [
"public",
"void",
"ifExceptionThrowRuntime",
"(",
")",
"throws",
"Error",
"{",
"if",
"(",
"nested",
"==",
"null",
"||",
"nested",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"nested",
".",
"size",
"(",
")",
"==",
"1",
")",
"{... | Throw a Runtime exception.
If this multi exception is empty then no action is taken. If it
contains a single error or runtime exception that is thrown, otherwise the this
multi exception is thrown, wrapped in a runtime exception.
@exception Error if this exception contains exactly 1 {@link Error}
@exception RuntimeExc... | [
"Throw",
"a",
"Runtime",
"exception",
".",
"If",
"this",
"multi",
"exception",
"is",
"empty",
"then",
"no",
"action",
"is",
"taken",
".",
"If",
"it",
"contains",
"a",
"single",
"error",
"or",
"runtime",
"exception",
"that",
"is",
"thrown",
"otherwise",
"th... | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MultiException.java#L106-L121 | train |
aspectran/aspectran | shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java | HelpFormatter.printHelp | public void printHelp(Command command) {
if (command.getDescriptor().getUsage() != null) {
printUsage(command.getDescriptor().getUsage());
} else {
printUsage(command);
}
int leftWidth = printOptions(command.getOptions());
printArguments(command.getArgumen... | java | public void printHelp(Command command) {
if (command.getDescriptor().getUsage() != null) {
printUsage(command.getDescriptor().getUsage());
} else {
printUsage(command);
}
int leftWidth = printOptions(command.getOptions());
printArguments(command.getArgumen... | [
"public",
"void",
"printHelp",
"(",
"Command",
"command",
")",
"{",
"if",
"(",
"command",
".",
"getDescriptor",
"(",
")",
".",
"getUsage",
"(",
")",
"!=",
"null",
")",
"{",
"printUsage",
"(",
"command",
".",
"getDescriptor",
"(",
")",
".",
"getUsage",
... | Print the help with the given Command object.
@param command the Command instance | [
"Print",
"the",
"help",
"with",
"the",
"given",
"Command",
"object",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java#L180-L188 | train |
aspectran/aspectran | shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java | HelpFormatter.printUsage | public void printUsage(Command command) {
String commandName = command.getDescriptor().getName();
StringBuilder sb = new StringBuilder(getSyntaxPrefix()).append(commandName).append(" ");
// create a list for processed option groups
Collection<OptionGroup> processedGroups = new ArrayList... | java | public void printUsage(Command command) {
String commandName = command.getDescriptor().getName();
StringBuilder sb = new StringBuilder(getSyntaxPrefix()).append(commandName).append(" ");
// create a list for processed option groups
Collection<OptionGroup> processedGroups = new ArrayList... | [
"public",
"void",
"printUsage",
"(",
"Command",
"command",
")",
"{",
"String",
"commandName",
"=",
"command",
".",
"getDescriptor",
"(",
")",
".",
"getName",
"(",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"getSyntaxPrefix",
"(",
")",... | Prints the usage statement for the specified command.
@param command the Command instance | [
"Prints",
"the",
"usage",
"statement",
"for",
"the",
"specified",
"command",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java#L206-L251 | train |
aspectran/aspectran | shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java | HelpFormatter.appendOptionGroup | private void appendOptionGroup(StringBuilder sb, OptionGroup group) {
if (!group.isRequired()) {
sb.append(OPTIONAL_BRACKET_OPEN);
}
List<Option> optList = new ArrayList<>(group.getOptions());
if (optList.size() > 1 && getOptionComparator() != null) {
optList.sort... | java | private void appendOptionGroup(StringBuilder sb, OptionGroup group) {
if (!group.isRequired()) {
sb.append(OPTIONAL_BRACKET_OPEN);
}
List<Option> optList = new ArrayList<>(group.getOptions());
if (optList.size() > 1 && getOptionComparator() != null) {
optList.sort... | [
"private",
"void",
"appendOptionGroup",
"(",
"StringBuilder",
"sb",
",",
"OptionGroup",
"group",
")",
"{",
"if",
"(",
"!",
"group",
".",
"isRequired",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"OPTIONAL_BRACKET_OPEN",
")",
";",
"}",
"List",
"<",
"Opt... | Appends the usage clause for an OptionGroup to a StringBuilder.
The clause is wrapped in square brackets if the group is required.
The display of the options is handled by appendOption.
@param sb the StringBuilder to append to
@param group the group to append | [
"Appends",
"the",
"usage",
"clause",
"for",
"an",
"OptionGroup",
"to",
"a",
"StringBuilder",
".",
"The",
"clause",
"is",
"wrapped",
"in",
"square",
"brackets",
"if",
"the",
"group",
"is",
"required",
".",
"The",
"display",
"of",
"the",
"options",
"is",
"ha... | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java#L261-L280 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/BeanMethodActionRule.java | BeanMethodActionRule.newArgumentItemRule | public ItemRule newArgumentItemRule(String argumentName) {
ItemRule itemRule = new ItemRule();
itemRule.setName(argumentName);
addArgumentItemRule(itemRule);
return itemRule;
} | java | public ItemRule newArgumentItemRule(String argumentName) {
ItemRule itemRule = new ItemRule();
itemRule.setName(argumentName);
addArgumentItemRule(itemRule);
return itemRule;
} | [
"public",
"ItemRule",
"newArgumentItemRule",
"(",
"String",
"argumentName",
")",
"{",
"ItemRule",
"itemRule",
"=",
"new",
"ItemRule",
"(",
")",
";",
"itemRule",
".",
"setName",
"(",
"argumentName",
")",
";",
"addArgumentItemRule",
"(",
"itemRule",
")",
";",
"r... | Adds a new argument rule with the specified name and returns it.
@param argumentName the argument name
@return the argument item rule | [
"Adds",
"a",
"new",
"argument",
"rule",
"with",
"the",
"specified",
"name",
"and",
"returns",
"it",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/BeanMethodActionRule.java#L181-L186 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/BeanMethodActionRule.java | BeanMethodActionRule.addArgumentItemRule | public void addArgumentItemRule(ItemRule argumentItemRule) {
if (argumentItemRuleMap == null) {
argumentItemRuleMap = new ItemRuleMap();
}
argumentItemRuleMap.putItemRule(argumentItemRule);
} | java | public void addArgumentItemRule(ItemRule argumentItemRule) {
if (argumentItemRuleMap == null) {
argumentItemRuleMap = new ItemRuleMap();
}
argumentItemRuleMap.putItemRule(argumentItemRule);
} | [
"public",
"void",
"addArgumentItemRule",
"(",
"ItemRule",
"argumentItemRule",
")",
"{",
"if",
"(",
"argumentItemRuleMap",
"==",
"null",
")",
"{",
"argumentItemRuleMap",
"=",
"new",
"ItemRuleMap",
"(",
")",
";",
"}",
"argumentItemRuleMap",
".",
"putItemRule",
"(",
... | Adds the argument item rule.
@param argumentItemRule the new argument item rule | [
"Adds",
"the",
"argument",
"item",
"rule",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/BeanMethodActionRule.java#L193-L198 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/BeanMethodActionRule.java | BeanMethodActionRule.newInstance | public static BeanMethodActionRule newInstance(String id, String beanId, String methodName, Boolean hidden)
throws IllegalRuleException {
if (methodName == null) {
throw new IllegalRuleException("The 'action' element requires an 'method' attribute");
}
BeanMethodActionRu... | java | public static BeanMethodActionRule newInstance(String id, String beanId, String methodName, Boolean hidden)
throws IllegalRuleException {
if (methodName == null) {
throw new IllegalRuleException("The 'action' element requires an 'method' attribute");
}
BeanMethodActionRu... | [
"public",
"static",
"BeanMethodActionRule",
"newInstance",
"(",
"String",
"id",
",",
"String",
"beanId",
",",
"String",
"methodName",
",",
"Boolean",
"hidden",
")",
"throws",
"IllegalRuleException",
"{",
"if",
"(",
"methodName",
"==",
"null",
")",
"{",
"throw",
... | Returns a new instance of BeanActionRule.
@param id the action id
@param beanId the bean id
@param methodName the method name
@param hidden true if hiding the result of the action; false otherwise
@return the bean method action rule
@throws IllegalRuleException if an illegal rule is found | [
"Returns",
"a",
"new",
"instance",
"of",
"BeanActionRule",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/BeanMethodActionRule.java#L274-L286 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/request/ParameterMap.java | ParameterMap.setAll | public void setAll(Map<String, String> params) {
for (Map.Entry<String, String> entry : params.entrySet()) {
setParameter(entry.getKey(), entry.getValue());
}
} | java | public void setAll(Map<String, String> params) {
for (Map.Entry<String, String> entry : params.entrySet()) {
setParameter(entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"setAll",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"params",
".",
"entrySet",
"(",
")",
")",
"{",
"setParameter",
"(",
"en... | Set the given parameters under.
@param params the other parameter map | [
"Set",
"the",
"given",
"parameters",
"under",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/request/ParameterMap.java#L125-L129 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/ActivityDataMap.java | ActivityDataMap.getParameterWithoutCache | public Object getParameterWithoutCache(String name) {
if (activity.getRequestAdapter() != null) {
String[] values = activity.getRequestAdapter().getParameterValues(name);
if (values != null) {
if (values.length == 1) {
return values[0];
... | java | public Object getParameterWithoutCache(String name) {
if (activity.getRequestAdapter() != null) {
String[] values = activity.getRequestAdapter().getParameterValues(name);
if (values != null) {
if (values.length == 1) {
return values[0];
... | [
"public",
"Object",
"getParameterWithoutCache",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"activity",
".",
"getRequestAdapter",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"values",
"=",
"activity",
".",
"getRequestAdapter",
"(",
")",
".",
"get... | Returns the value of the request parameter from the request adapter
without storing it in the cache.
If the parameter does not exist, returns null.
@param name a {@code String} specifying the name of the parameter
@return an {@code Object} containing the value of the parameter,
or {@code null} if the parameter does no... | [
"Returns",
"the",
"value",
"of",
"the",
"request",
"parameter",
"from",
"the",
"request",
"adapter",
"without",
"storing",
"it",
"in",
"the",
"cache",
".",
"If",
"the",
"parameter",
"does",
"not",
"exist",
"returns",
"null",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/ActivityDataMap.java#L141-L153 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/ActivityDataMap.java | ActivityDataMap.getAttributeWithoutCache | public Object getAttributeWithoutCache(String name) {
if (activity.getRequestAdapter() != null) {
return activity.getRequestAdapter().getAttribute(name);
} else {
return null;
}
} | java | public Object getAttributeWithoutCache(String name) {
if (activity.getRequestAdapter() != null) {
return activity.getRequestAdapter().getAttribute(name);
} else {
return null;
}
} | [
"public",
"Object",
"getAttributeWithoutCache",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"activity",
".",
"getRequestAdapter",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"activity",
".",
"getRequestAdapter",
"(",
")",
".",
"getAttribute",
"(",
"name",
")... | Returns the value of the named attribute from the request adapter
without storing it in the cache.
If no attribute of the given name exists, returns null.
@param name a {@code String} specifying the name of the attribute
@return an {@code Object} containing the value of the attribute,
or {@code null} if the attribute ... | [
"Returns",
"the",
"value",
"of",
"the",
"named",
"attribute",
"from",
"the",
"request",
"adapter",
"without",
"storing",
"it",
"in",
"the",
"cache",
".",
"If",
"no",
"attribute",
"of",
"the",
"given",
"name",
"exists",
"returns",
"null",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/ActivityDataMap.java#L165-L171 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/ActivityDataMap.java | ActivityDataMap.getActionResultWithoutCache | public Object getActionResultWithoutCache(String name) {
if (activity.getProcessResult() != null) {
return activity.getProcessResult().getResultValue(name);
} else {
return null;
}
} | java | public Object getActionResultWithoutCache(String name) {
if (activity.getProcessResult() != null) {
return activity.getProcessResult().getResultValue(name);
} else {
return null;
}
} | [
"public",
"Object",
"getActionResultWithoutCache",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"activity",
".",
"getProcessResult",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"activity",
".",
"getProcessResult",
"(",
")",
".",
"getResultValue",
"(",
"name",
... | Returns the value of the named action's process result
without storing it in the cache.
If no process result of the given name exists, returns null.
@param name a {@code String} specifying the name of the action
@return an {@code Object} containing the value of the action result,
or {@code null} if the action result d... | [
"Returns",
"the",
"value",
"of",
"the",
"named",
"action",
"s",
"process",
"result",
"without",
"storing",
"it",
"in",
"the",
"cache",
".",
"If",
"no",
"process",
"result",
"of",
"the",
"given",
"name",
"exists",
"returns",
"null",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/ActivityDataMap.java#L182-L188 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/ActivityDataMap.java | ActivityDataMap.getSessionAttributeWithoutCache | public Object getSessionAttributeWithoutCache(String name) {
if (activity.getSessionAdapter() != null) {
return activity.getSessionAdapter().getAttribute(name);
} else {
return null;
}
} | java | public Object getSessionAttributeWithoutCache(String name) {
if (activity.getSessionAdapter() != null) {
return activity.getSessionAdapter().getAttribute(name);
} else {
return null;
}
} | [
"public",
"Object",
"getSessionAttributeWithoutCache",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"activity",
".",
"getSessionAdapter",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"activity",
".",
"getSessionAdapter",
"(",
")",
".",
"getAttribute",
"(",
"name... | Returns the value of the named attribute from the session adapter
without storing it in the cache.
If no attribute of the given name exists, returns null.
@param name a {@code String} specifying the name of the attribute
@return an {@code Object} containing the value of the attribute,
or {@code null} if the attribute ... | [
"Returns",
"the",
"value",
"of",
"the",
"named",
"attribute",
"from",
"the",
"session",
"adapter",
"without",
"storing",
"it",
"in",
"the",
"cache",
".",
"If",
"no",
"attribute",
"of",
"the",
"given",
"name",
"exists",
"returns",
"null",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/ActivityDataMap.java#L200-L206 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java | AbstractSessionCache.get | @Override
public Session get(String id) throws Exception {
Session session;
Exception ex = null;
while (true) {
session = doGet(id);
if (sessionDataStore == null) {
break; // can't load any session data so just return null or the session object
... | java | @Override
public Session get(String id) throws Exception {
Session session;
Exception ex = null;
while (true) {
session = doGet(id);
if (sessionDataStore == null) {
break; // can't load any session data so just return null or the session object
... | [
"@",
"Override",
"public",
"Session",
"get",
"(",
"String",
"id",
")",
"throws",
"Exception",
"{",
"Session",
"session",
";",
"Exception",
"ex",
"=",
"null",
";",
"while",
"(",
"true",
")",
"{",
"session",
"=",
"doGet",
"(",
"id",
")",
";",
"if",
"("... | Get a session object.
If the session object is not in this session store, try getting
the data for it from a SessionDataStore associated with the
session manager.
@param id the session id | [
"Get",
"a",
"session",
"object",
".",
"If",
"the",
"session",
"object",
"is",
"not",
"in",
"this",
"session",
"store",
"try",
"getting",
"the",
"data",
"for",
"it",
"from",
"a",
"SessionDataStore",
"associated",
"with",
"the",
"session",
"manager",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java#L147-L235 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java | AbstractSessionCache.loadSession | private Session loadSession(String id) throws Exception {
if (sessionDataStore == null) {
return null; // can't load it
}
try {
SessionData data = sessionDataStore.load(id);
if (data == null) { // session doesn't exist
return null;
... | java | private Session loadSession(String id) throws Exception {
if (sessionDataStore == null) {
return null; // can't load it
}
try {
SessionData data = sessionDataStore.load(id);
if (data == null) { // session doesn't exist
return null;
... | [
"private",
"Session",
"loadSession",
"(",
"String",
"id",
")",
"throws",
"Exception",
"{",
"if",
"(",
"sessionDataStore",
"==",
"null",
")",
"{",
"return",
"null",
";",
"// can't load it",
"}",
"try",
"{",
"SessionData",
"data",
"=",
"sessionDataStore",
".",
... | Load the info for the session from the session data store.
@param id the session id
@return a Session object filled with data or null if the session doesn't exist
@throws Exception if the session can not be loaded | [
"Load",
"the",
"info",
"for",
"the",
"session",
"from",
"the",
"session",
"data",
"store",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java#L244-L261 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java | AbstractSessionCache.put | @Override
public void put(String id, Session session) throws Exception {
if (id == null || session == null) {
throw new IllegalArgumentException("Put key=" + id + " session=" + (session == null ? "null" : session.getId()));
}
try (Lock ignored = session.lock()) {
if ... | java | @Override
public void put(String id, Session session) throws Exception {
if (id == null || session == null) {
throw new IllegalArgumentException("Put key=" + id + " session=" + (session == null ? "null" : session.getId()));
}
try (Lock ignored = session.lock()) {
if ... | [
"@",
"Override",
"public",
"void",
"put",
"(",
"String",
"id",
",",
"Session",
"session",
")",
"throws",
"Exception",
"{",
"if",
"(",
"id",
"==",
"null",
"||",
"session",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Put key=\... | Put the Session object back into the session store.
<p>This should be called when a request exists the session. Only when the last
simultaneous request exists the session will any action be taken.</p>
<p>If there is a SessionDataStore write the session data through to it.</p>
<p>If the SessionDataStore supports pass... | [
"Put",
"the",
"Session",
"object",
"back",
"into",
"the",
"session",
"store",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java#L276-L357 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java | AbstractSessionCache.exists | @Override
public boolean exists(String id) throws Exception {
// try the object store first
Session s = doGet(id);
if (s != null) {
try (Lock ignored = s.lock()) {
// wait for the lock and check the validity of the session
return s.isValid();
... | java | @Override
public boolean exists(String id) throws Exception {
// try the object store first
Session s = doGet(id);
if (s != null) {
try (Lock ignored = s.lock()) {
// wait for the lock and check the validity of the session
return s.isValid();
... | [
"@",
"Override",
"public",
"boolean",
"exists",
"(",
"String",
"id",
")",
"throws",
"Exception",
"{",
"// try the object store first",
"Session",
"s",
"=",
"doGet",
"(",
"id",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"try",
"(",
"Lock",
"ignored... | Check to see if a session corresponding to the id exists.
This method will first check with the object store. If it
doesn't exist in the object store (might be passivated etc),
it will check with the data store.
@throws Exception the Exception | [
"Check",
"to",
"see",
"if",
"a",
"session",
"corresponding",
"to",
"the",
"id",
"exists",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java#L368-L380 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java | AbstractSessionCache.delete | @Override
public Session delete(String id) throws Exception {
// get the session, if its not in memory, this will load it
Session session = get(id);
// Always delete it from the backing data store
if (sessionDataStore != null) {
boolean deleted = sessionDataStore.delete(... | java | @Override
public Session delete(String id) throws Exception {
// get the session, if its not in memory, this will load it
Session session = get(id);
// Always delete it from the backing data store
if (sessionDataStore != null) {
boolean deleted = sessionDataStore.delete(... | [
"@",
"Override",
"public",
"Session",
"delete",
"(",
"String",
"id",
")",
"throws",
"Exception",
"{",
"// get the session, if its not in memory, this will load it",
"Session",
"session",
"=",
"get",
"(",
"id",
")",
";",
"// Always delete it from the backing data store",
"... | Remove a session object from this store and from any backing store. | [
"Remove",
"a",
"session",
"object",
"from",
"this",
"store",
"and",
"from",
"any",
"backing",
"store",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java#L395-L415 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java | AbstractSessionCache.checkInactiveSession | public void checkInactiveSession(Session session) {
if (session == null) {
return;
}
if (log.isDebugEnabled()) {
log.debug("Checking for idle " + session.getId());
}
try (Lock ignored = session.lock()) {
if (getEvictionPolicy() > 0 && session.... | java | public void checkInactiveSession(Session session) {
if (session == null) {
return;
}
if (log.isDebugEnabled()) {
log.debug("Checking for idle " + session.getId());
}
try (Lock ignored = session.lock()) {
if (getEvictionPolicy() > 0 && session.... | [
"public",
"void",
"checkInactiveSession",
"(",
"Session",
"session",
")",
"{",
"if",
"(",
"session",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Checking for idle \... | Check a session for being inactive and
thus being able to be evicted, if eviction
is enabled.
@param session session to check | [
"Check",
"a",
"session",
"for",
"being",
"inactive",
"and",
"thus",
"being",
"able",
"to",
"be",
"evicted",
"if",
"eviction",
"is",
"enabled",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionCache.java#L453-L486 | train |
aspectran/aspectran | with-pebble/src/main/java/com/aspectran/pebble/PebbleEngineFactory.java | PebbleEngineFactory.createPebbleEngine | public PebbleEngine createPebbleEngine() {
PebbleEngine.Builder builder = new PebbleEngine.Builder();
builder.strictVariables(strictVariables);
if (defaultLocale != null) {
builder.defaultLocale(defaultLocale);
}
if (templateLoaders == null) {
if (template... | java | public PebbleEngine createPebbleEngine() {
PebbleEngine.Builder builder = new PebbleEngine.Builder();
builder.strictVariables(strictVariables);
if (defaultLocale != null) {
builder.defaultLocale(defaultLocale);
}
if (templateLoaders == null) {
if (template... | [
"public",
"PebbleEngine",
"createPebbleEngine",
"(",
")",
"{",
"PebbleEngine",
".",
"Builder",
"builder",
"=",
"new",
"PebbleEngine",
".",
"Builder",
"(",
")",
";",
"builder",
".",
"strictVariables",
"(",
"strictVariables",
")",
";",
"if",
"(",
"defaultLocale",
... | Creates a PebbleEngine instance.
@return a PebbleEngine object that can be used to create PebbleTemplate objects | [
"Creates",
"a",
"PebbleEngine",
"instance",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-pebble/src/main/java/com/aspectran/pebble/PebbleEngineFactory.java#L98-L116 | train |
aspectran/aspectran | with-pebble/src/main/java/com/aspectran/pebble/PebbleEngineFactory.java | PebbleEngineFactory.getAggregateTemplateLoader | protected Loader<?> getAggregateTemplateLoader(Loader<?>[] templateLoaders) {
int loaderCount = (templateLoaders == null) ? 0 : templateLoaders.length;
switch (loaderCount) {
case 0:
// Register default template loaders.
Loader<?> stringLoader = new StringLoad... | java | protected Loader<?> getAggregateTemplateLoader(Loader<?>[] templateLoaders) {
int loaderCount = (templateLoaders == null) ? 0 : templateLoaders.length;
switch (loaderCount) {
case 0:
// Register default template loaders.
Loader<?> stringLoader = new StringLoad... | [
"protected",
"Loader",
"<",
"?",
">",
"getAggregateTemplateLoader",
"(",
"Loader",
"<",
"?",
">",
"[",
"]",
"templateLoaders",
")",
"{",
"int",
"loaderCount",
"=",
"(",
"templateLoaders",
"==",
"null",
")",
"?",
"0",
":",
"templateLoaders",
".",
"length",
... | Return a Template Loader based on the given Template Loader list.
If more than one Template Loader has been registered, a DelegatingLoader needs to be created.
@param templateLoaders the final List of TemplateLoader instances
@return the aggregate TemplateLoader | [
"Return",
"a",
"Template",
"Loader",
"based",
"on",
"the",
"given",
"Template",
"Loader",
"list",
".",
"If",
"more",
"than",
"one",
"Template",
"Loader",
"has",
"been",
"registered",
"a",
"DelegatingLoader",
"needs",
"to",
"be",
"created",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-pebble/src/main/java/com/aspectran/pebble/PebbleEngineFactory.java#L125-L149 | train |
aspectran/aspectran | with-pebble/src/main/java/com/aspectran/pebble/PebbleEngineFactory.java | PebbleEngineFactory.getTemplateLoaderForPath | protected Loader<?> getTemplateLoaderForPath(String templateLoaderPath) {
if (templateLoaderPath.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
String basePackagePath = templateLoaderPath.substring(ResourceUtils.CLASSPATH_URL_PREFIX.length());
if (log.isDebugEnabled()) {
... | java | protected Loader<?> getTemplateLoaderForPath(String templateLoaderPath) {
if (templateLoaderPath.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
String basePackagePath = templateLoaderPath.substring(ResourceUtils.CLASSPATH_URL_PREFIX.length());
if (log.isDebugEnabled()) {
... | [
"protected",
"Loader",
"<",
"?",
">",
"getTemplateLoaderForPath",
"(",
"String",
"templateLoaderPath",
")",
"{",
"if",
"(",
"templateLoaderPath",
".",
"startsWith",
"(",
"ResourceUtils",
".",
"CLASSPATH_URL_PREFIX",
")",
")",
"{",
"String",
"basePackagePath",
"=",
... | Determine a Pebble Engine Template Loader for the given path.
@param templateLoaderPath the path to load templates from
@return an appropriate Template Loader | [
"Determine",
"a",
"Pebble",
"Engine",
"Template",
"Loader",
"for",
"the",
"given",
"path",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-pebble/src/main/java/com/aspectran/pebble/PebbleEngineFactory.java#L157-L185 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/SessionIdGenerator.java | SessionIdGenerator.newSessionId | public String newSessionId(long seedTerm) {
synchronized (random) {
long r0;
if (weakRandom) {
r0 = hashCode() ^ Runtime.getRuntime().freeMemory() ^ random.nextInt() ^ (seedTerm << 32);
} else {
r0 = random.nextLong();
}
... | java | public String newSessionId(long seedTerm) {
synchronized (random) {
long r0;
if (weakRandom) {
r0 = hashCode() ^ Runtime.getRuntime().freeMemory() ^ random.nextInt() ^ (seedTerm << 32);
} else {
r0 = random.nextLong();
}
... | [
"public",
"String",
"newSessionId",
"(",
"long",
"seedTerm",
")",
"{",
"synchronized",
"(",
"random",
")",
"{",
"long",
"r0",
";",
"if",
"(",
"weakRandom",
")",
"{",
"r0",
"=",
"hashCode",
"(",
")",
"^",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"... | Returns a new unique session id.
@param seedTerm the seed for RNG
@return a new unique session id | [
"Returns",
"a",
"new",
"unique",
"session",
"id",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/SessionIdGenerator.java#L54-L85 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/SessionIdGenerator.java | SessionIdGenerator.initRandom | private void initRandom() {
try {
random = new SecureRandom();
} catch (Exception e) {
log.warn("Could not generate SecureRandom for session-id randomness", e);
random = new Random();
weakRandom = true;
}
} | java | private void initRandom() {
try {
random = new SecureRandom();
} catch (Exception e) {
log.warn("Could not generate SecureRandom for session-id randomness", e);
random = new Random();
weakRandom = true;
}
} | [
"private",
"void",
"initRandom",
"(",
")",
"{",
"try",
"{",
"random",
"=",
"new",
"SecureRandom",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"\"Could not generate SecureRandom for session-id randomness\"",
",",
"e",
... | Set up a random number generator for the sessionids.
By preference, use a SecureRandom but allow to be injected. | [
"Set",
"up",
"a",
"random",
"number",
"generator",
"for",
"the",
"sessionids",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/SessionIdGenerator.java#L92-L100 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/apon/AponWriter.java | AponWriter.write | public void write(Parameters parameters) throws IOException {
if (parameters != null) {
for (Parameter pv : parameters.getParameterValueMap().values()) {
if (pv.isAssigned()) {
write(pv);
}
}
}
} | java | public void write(Parameters parameters) throws IOException {
if (parameters != null) {
for (Parameter pv : parameters.getParameterValueMap().values()) {
if (pv.isAssigned()) {
write(pv);
}
}
}
} | [
"public",
"void",
"write",
"(",
"Parameters",
"parameters",
")",
"throws",
"IOException",
"{",
"if",
"(",
"parameters",
"!=",
"null",
")",
"{",
"for",
"(",
"Parameter",
"pv",
":",
"parameters",
".",
"getParameterValueMap",
"(",
")",
".",
"values",
"(",
")"... | Write a Parameters object to the character-output stream.
@param parameters the Parameters object to be converted
@throws IOException if an I/O error occurs | [
"Write",
"a",
"Parameters",
"object",
"to",
"the",
"character",
"-",
"output",
"stream",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/apon/AponWriter.java#L98-L106 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/apon/AponWriter.java | AponWriter.comment | public void comment(String message) throws IOException {
if (message.indexOf(NEW_LINE_CHAR) != -1) {
String line;
int start = 0;
while ((line = readLine(message, start)) != null) {
writer.write(COMMENT_LINE_START);
writer.write(SPACE_CHAR);
... | java | public void comment(String message) throws IOException {
if (message.indexOf(NEW_LINE_CHAR) != -1) {
String line;
int start = 0;
while ((line = readLine(message, start)) != null) {
writer.write(COMMENT_LINE_START);
writer.write(SPACE_CHAR);
... | [
"public",
"void",
"comment",
"(",
"String",
"message",
")",
"throws",
"IOException",
"{",
"if",
"(",
"message",
".",
"indexOf",
"(",
"NEW_LINE_CHAR",
")",
"!=",
"-",
"1",
")",
"{",
"String",
"line",
";",
"int",
"start",
"=",
"0",
";",
"while",
"(",
"... | Writes a comment to the character-output stream.
@param message the comment to write to a character-output stream
@throws IOException if an I/O error occurs | [
"Writes",
"a",
"comment",
"to",
"the",
"character",
"-",
"output",
"stream",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/apon/AponWriter.java#L287-L313 | train |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/apon/AponWriter.java | AponWriter.stringify | public static String stringify(Parameters parameters, String indentString) {
if (parameters == null) {
return null;
}
try {
Writer writer = new StringWriter();
AponWriter aponWriter = new AponWriter(writer);
aponWriter.setIndentString(indentString)... | java | public static String stringify(Parameters parameters, String indentString) {
if (parameters == null) {
return null;
}
try {
Writer writer = new StringWriter();
AponWriter aponWriter = new AponWriter(writer);
aponWriter.setIndentString(indentString)... | [
"public",
"static",
"String",
"stringify",
"(",
"Parameters",
"parameters",
",",
"String",
"indentString",
")",
"{",
"if",
"(",
"parameters",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"Writer",
"writer",
"=",
"new",
"StringWriter",
"(... | Converts a Parameters object to an APON formatted string.
@param parameters the Parameters object to be converted
@param indentString the indentation string
@return a string that contains the APON text | [
"Converts",
"a",
"Parameters",
"object",
"to",
"an",
"APON",
"formatted",
"string",
"."
] | 2d758a2a28b71ee85b42823c12dc44674d7f2c70 | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/apon/AponWriter.java#L515-L529 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.