id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
---|---|---|---|---|---|---|---|---|---|---|---|
7,000 |
baasbox/Android-SDK
|
library/src/main/java/com/baasbox/android/BaasUser.java
|
BaasUser.save
|
public RequestToken save(int flags, BaasHandler<BaasUser> handler) {
BaasBox box = BaasBox.getDefaultChecked();
SaveUser task = new SaveUser(box, this, flags, handler);
return box.submitAsync(task);
}
|
java
|
public RequestToken save(int flags, BaasHandler<BaasUser> handler) {
BaasBox box = BaasBox.getDefaultChecked();
SaveUser task = new SaveUser(box, this, flags, handler);
return box.submitAsync(task);
}
|
[
"public",
"RequestToken",
"save",
"(",
"int",
"flags",
",",
"BaasHandler",
"<",
"BaasUser",
">",
"handler",
")",
"{",
"BaasBox",
"box",
"=",
"BaasBox",
".",
"getDefaultChecked",
"(",
")",
";",
"SaveUser",
"task",
"=",
"new",
"SaveUser",
"(",
"box",
",",
"this",
",",
"flags",
",",
"handler",
")",
";",
"return",
"box",
".",
"submitAsync",
"(",
"task",
")",
";",
"}"
] |
Asynchronously saves the updates made to the current user.
@param flags {@link RequestOptions}
@param handler an handler to be invoked when the request completes
@return a {@link com.baasbox.android.RequestToken} to handle the async request
|
[
"Asynchronously",
"saves",
"the",
"updates",
"made",
"to",
"the",
"current",
"user",
"."
] |
6bb2203246b885b2ad63a7bfaf37c83caf15e0d8
|
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasUser.java#L904-L908
|
7,001 |
baasbox/Android-SDK
|
library/src/main/java/com/baasbox/android/BaasUser.java
|
BaasUser.saveSync
|
public BaasResult<BaasUser> saveSync() {
BaasBox box = BaasBox.getDefaultChecked();
SaveUser task = new SaveUser(box, this, RequestOptions.DEFAULT, null);
return box.submitSync(task);
}
|
java
|
public BaasResult<BaasUser> saveSync() {
BaasBox box = BaasBox.getDefaultChecked();
SaveUser task = new SaveUser(box, this, RequestOptions.DEFAULT, null);
return box.submitSync(task);
}
|
[
"public",
"BaasResult",
"<",
"BaasUser",
">",
"saveSync",
"(",
")",
"{",
"BaasBox",
"box",
"=",
"BaasBox",
".",
"getDefaultChecked",
"(",
")",
";",
"SaveUser",
"task",
"=",
"new",
"SaveUser",
"(",
"box",
",",
"this",
",",
"RequestOptions",
".",
"DEFAULT",
",",
"null",
")",
";",
"return",
"box",
".",
"submitSync",
"(",
"task",
")",
";",
"}"
] |
Synchronously saves the updates made to the current user.
@return the result of the request
|
[
"Synchronously",
"saves",
"the",
"updates",
"made",
"to",
"the",
"current",
"user",
"."
] |
6bb2203246b885b2ad63a7bfaf37c83caf15e0d8
|
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasUser.java#L915-L919
|
7,002 |
baasbox/Android-SDK
|
library/src/main/java/com/baasbox/android/BaasUser.java
|
BaasUser.signup
|
public RequestToken signup(int flags, BaasHandler<BaasUser> handler) {
return signupWithStrategy(flags,DefaultSignupStrategy.INSTANCE,handler);
}
|
java
|
public RequestToken signup(int flags, BaasHandler<BaasUser> handler) {
return signupWithStrategy(flags,DefaultSignupStrategy.INSTANCE,handler);
}
|
[
"public",
"RequestToken",
"signup",
"(",
"int",
"flags",
",",
"BaasHandler",
"<",
"BaasUser",
">",
"handler",
")",
"{",
"return",
"signupWithStrategy",
"(",
"flags",
",",
"DefaultSignupStrategy",
".",
"INSTANCE",
",",
"handler",
")",
";",
"}"
] |
Asynchronously signups this user to baasbox
using provided password and priority
@param flags {@link RequestOptions}
@param handler an handler to be invoked when the request completes
@return a {@link com.baasbox.android.RequestToken} to manage the asynchronous request
|
[
"Asynchronously",
"signups",
"this",
"user",
"to",
"baasbox",
"using",
"provided",
"password",
"and",
"priority"
] |
6bb2203246b885b2ad63a7bfaf37c83caf15e0d8
|
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasUser.java#L963-L965
|
7,003 |
baasbox/Android-SDK
|
library/src/main/java/com/baasbox/android/BaasUser.java
|
BaasUser.unfollow
|
public RequestToken unfollow(int flags, BaasHandler<BaasUser> handler) {
BaasBox box = BaasBox.getDefaultChecked();
Follow follow = new Follow(box, false, this, flags, handler);
return box.submitAsync(follow);
}
|
java
|
public RequestToken unfollow(int flags, BaasHandler<BaasUser> handler) {
BaasBox box = BaasBox.getDefaultChecked();
Follow follow = new Follow(box, false, this, flags, handler);
return box.submitAsync(follow);
}
|
[
"public",
"RequestToken",
"unfollow",
"(",
"int",
"flags",
",",
"BaasHandler",
"<",
"BaasUser",
">",
"handler",
")",
"{",
"BaasBox",
"box",
"=",
"BaasBox",
".",
"getDefaultChecked",
"(",
")",
";",
"Follow",
"follow",
"=",
"new",
"Follow",
"(",
"box",
",",
"false",
",",
"this",
",",
"flags",
",",
"handler",
")",
";",
"return",
"box",
".",
"submitAsync",
"(",
"follow",
")",
";",
"}"
] |
Asynchronously requests to unfollow the user
@param flags {@link RequestOptions}
@param handler an handler to be invoked when the request completes
@return a {@link com.baasbox.android.RequestToken} to manage the request
|
[
"Asynchronously",
"requests",
"to",
"unfollow",
"the",
"user"
] |
6bb2203246b885b2ad63a7bfaf37c83caf15e0d8
|
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasUser.java#L1030-L1034
|
7,004 |
danieldk/dictomaton
|
src/main/java/eu/danieldk/dictomaton/CompactIntArray.java
|
CompactIntArray.get
|
public int get(int index) {
if (d_bitsPerElem == 0)
return 0;
int startIdx = (index * d_bitsPerElem) / INT_SIZE;
int startBit = (index * d_bitsPerElem) % INT_SIZE;
int result = (d_data[startIdx] >>> startBit) & MASK[d_bitsPerElem];
if ((startBit + d_bitsPerElem) > INT_SIZE) {
int done = INT_SIZE - startBit;
result |= (d_data[startIdx + 1] & MASK[d_bitsPerElem - done]) << done;
}
return result;
}
|
java
|
public int get(int index) {
if (d_bitsPerElem == 0)
return 0;
int startIdx = (index * d_bitsPerElem) / INT_SIZE;
int startBit = (index * d_bitsPerElem) % INT_SIZE;
int result = (d_data[startIdx] >>> startBit) & MASK[d_bitsPerElem];
if ((startBit + d_bitsPerElem) > INT_SIZE) {
int done = INT_SIZE - startBit;
result |= (d_data[startIdx + 1] & MASK[d_bitsPerElem - done]) << done;
}
return result;
}
|
[
"public",
"int",
"get",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"d_bitsPerElem",
"==",
"0",
")",
"return",
"0",
";",
"int",
"startIdx",
"=",
"(",
"index",
"*",
"d_bitsPerElem",
")",
"/",
"INT_SIZE",
";",
"int",
"startBit",
"=",
"(",
"index",
"*",
"d_bitsPerElem",
")",
"%",
"INT_SIZE",
";",
"int",
"result",
"=",
"(",
"d_data",
"[",
"startIdx",
"]",
">>>",
"startBit",
")",
"&",
"MASK",
"[",
"d_bitsPerElem",
"]",
";",
"if",
"(",
"(",
"startBit",
"+",
"d_bitsPerElem",
")",
">",
"INT_SIZE",
")",
"{",
"int",
"done",
"=",
"INT_SIZE",
"-",
"startBit",
";",
"result",
"|=",
"(",
"d_data",
"[",
"startIdx",
"+",
"1",
"]",
"&",
"MASK",
"[",
"d_bitsPerElem",
"-",
"done",
"]",
")",
"<<",
"done",
";",
"}",
"return",
"result",
";",
"}"
] |
Get the integer at the given index.
@param index The index.
@return An integer.
|
[
"Get",
"the",
"integer",
"at",
"the",
"given",
"index",
"."
] |
c0a3ae2d407ebd88023ea2d0f02a4882b0492df0
|
https://github.com/danieldk/dictomaton/blob/c0a3ae2d407ebd88023ea2d0f02a4882b0492df0/src/main/java/eu/danieldk/dictomaton/CompactIntArray.java#L90-L105
|
7,005 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/GetServiceStatusResult.java
|
GetServiceStatusResult.withMessages
|
public GetServiceStatusResult withMessages(Message... values) {
List<Message> list = getMessages();
for (Message value : values) {
list.add(value);
}
return this;
}
|
java
|
public GetServiceStatusResult withMessages(Message... values) {
List<Message> list = getMessages();
for (Message value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"GetServiceStatusResult",
"withMessages",
"(",
"Message",
"...",
"values",
")",
"{",
"List",
"<",
"Message",
">",
"list",
"=",
"getMessages",
"(",
")",
";",
"for",
"(",
"Message",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for Messages, return this.
@param messages
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"Messages",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/GetServiceStatusResult.java#L224-L230
|
7,006 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsXmlWriter.java
|
MwsXmlWriter.appendValue
|
private void appendValue(Object value) {
if (value instanceof Boolean) {
closeTag();
append(value.toString());
} else if (value instanceof Number) {
closeTag();
append(value.toString());
} else if (value instanceof String) {
closeTag();
escape((String) value);
} else if (value instanceof MwsObject) {
((MwsObject) value).writeFragmentTo(this);
} else if (value instanceof Node) {
closeTag();
append(MwsUtl.toXmlString((Node) value));
} else if (value instanceof Enum) {
closeTag();
append(((Enum<?>) value).toString());
} else if (value instanceof XMLGregorianCalendar) {
closeTag();
append(((XMLGregorianCalendar) value).toXMLFormat());
} else {
throw new IllegalArgumentException();
}
}
|
java
|
private void appendValue(Object value) {
if (value instanceof Boolean) {
closeTag();
append(value.toString());
} else if (value instanceof Number) {
closeTag();
append(value.toString());
} else if (value instanceof String) {
closeTag();
escape((String) value);
} else if (value instanceof MwsObject) {
((MwsObject) value).writeFragmentTo(this);
} else if (value instanceof Node) {
closeTag();
append(MwsUtl.toXmlString((Node) value));
} else if (value instanceof Enum) {
closeTag();
append(((Enum<?>) value).toString());
} else if (value instanceof XMLGregorianCalendar) {
closeTag();
append(((XMLGregorianCalendar) value).toXMLFormat());
} else {
throw new IllegalArgumentException();
}
}
|
[
"private",
"void",
"appendValue",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Boolean",
")",
"{",
"closeTag",
"(",
")",
";",
"append",
"(",
"value",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Number",
")",
"{",
"closeTag",
"(",
")",
";",
"append",
"(",
"value",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"String",
")",
"{",
"closeTag",
"(",
")",
";",
"escape",
"(",
"(",
"String",
")",
"value",
")",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"MwsObject",
")",
"{",
"(",
"(",
"MwsObject",
")",
"value",
")",
".",
"writeFragmentTo",
"(",
"this",
")",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Node",
")",
"{",
"closeTag",
"(",
")",
";",
"append",
"(",
"MwsUtl",
".",
"toXmlString",
"(",
"(",
"Node",
")",
"value",
")",
")",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Enum",
")",
"{",
"closeTag",
"(",
")",
";",
"append",
"(",
"(",
"(",
"Enum",
"<",
"?",
">",
")",
"value",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"XMLGregorianCalendar",
")",
"{",
"closeTag",
"(",
")",
";",
"append",
"(",
"(",
"(",
"XMLGregorianCalendar",
")",
"value",
")",
".",
"toXMLFormat",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"}"
] |
Append a value to output.
@param value
|
[
"Append",
"a",
"value",
"to",
"output",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsXmlWriter.java#L49-L73
|
7,007 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsXmlWriter.java
|
MwsXmlWriter.append
|
protected void append(String v) {
try {
writer.write(v);
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
java
|
protected void append(String v) {
try {
writer.write(v);
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
[
"protected",
"void",
"append",
"(",
"String",
"v",
")",
"{",
"try",
"{",
"writer",
".",
"write",
"(",
"v",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"MwsUtl",
".",
"wrap",
"(",
"e",
")",
";",
"}",
"}"
] |
Append a string to the output.
@param v
|
[
"Append",
"a",
"string",
"to",
"the",
"output",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsXmlWriter.java#L137-L143
|
7,008 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsXmlWriter.java
|
MwsXmlWriter.append
|
protected void append(String v, int start, int end) {
try {
writer.write(v, start, end - start);
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
java
|
protected void append(String v, int start, int end) {
try {
writer.write(v, start, end - start);
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
[
"protected",
"void",
"append",
"(",
"String",
"v",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"try",
"{",
"writer",
".",
"write",
"(",
"v",
",",
"start",
",",
"end",
"-",
"start",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"MwsUtl",
".",
"wrap",
"(",
"e",
")",
";",
"}",
"}"
] |
Append range of a string to the output.
@param v
@param start
@param end
|
[
"Append",
"range",
"of",
"a",
"string",
"to",
"the",
"output",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsXmlWriter.java#L152-L158
|
7,009 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsAQCall.java
|
MwsAQCall.addRequiredParametersToRequest
|
private void addRequiredParametersToRequest(HttpPost request) {
parameters.put("Action", operationName);
parameters.put("Version", serviceEndpoint.version);
parameters.put("Timestamp", MwsUtl.getFormattedTimestamp());
parameters.put("AWSAccessKeyId", connection.getAwsAccessKeyId());
String signature = MwsUtl.signParameters(serviceEndpoint.uri,
connection.getSignatureVersion(),
connection.getSignatureMethod(), parameters,
connection.getAwsSecretKeyId());
parameters.put("Signature", signature);
List<NameValuePair> parameterList = new ArrayList<NameValuePair>();
for (Entry<String, String> entry : parameters.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (!(key == null || key.equals("") || value == null || value
.equals(""))) {
parameterList.add(new BasicNameValuePair(key, value));
}
}
try {
request.setEntity(new UrlEncodedFormEntity(parameterList, "UTF-8"));
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
java
|
private void addRequiredParametersToRequest(HttpPost request) {
parameters.put("Action", operationName);
parameters.put("Version", serviceEndpoint.version);
parameters.put("Timestamp", MwsUtl.getFormattedTimestamp());
parameters.put("AWSAccessKeyId", connection.getAwsAccessKeyId());
String signature = MwsUtl.signParameters(serviceEndpoint.uri,
connection.getSignatureVersion(),
connection.getSignatureMethod(), parameters,
connection.getAwsSecretKeyId());
parameters.put("Signature", signature);
List<NameValuePair> parameterList = new ArrayList<NameValuePair>();
for (Entry<String, String> entry : parameters.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (!(key == null || key.equals("") || value == null || value
.equals(""))) {
parameterList.add(new BasicNameValuePair(key, value));
}
}
try {
request.setEntity(new UrlEncodedFormEntity(parameterList, "UTF-8"));
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
[
"private",
"void",
"addRequiredParametersToRequest",
"(",
"HttpPost",
"request",
")",
"{",
"parameters",
".",
"put",
"(",
"\"Action\"",
",",
"operationName",
")",
";",
"parameters",
".",
"put",
"(",
"\"Version\"",
",",
"serviceEndpoint",
".",
"version",
")",
";",
"parameters",
".",
"put",
"(",
"\"Timestamp\"",
",",
"MwsUtl",
".",
"getFormattedTimestamp",
"(",
")",
")",
";",
"parameters",
".",
"put",
"(",
"\"AWSAccessKeyId\"",
",",
"connection",
".",
"getAwsAccessKeyId",
"(",
")",
")",
";",
"String",
"signature",
"=",
"MwsUtl",
".",
"signParameters",
"(",
"serviceEndpoint",
".",
"uri",
",",
"connection",
".",
"getSignatureVersion",
"(",
")",
",",
"connection",
".",
"getSignatureMethod",
"(",
")",
",",
"parameters",
",",
"connection",
".",
"getAwsSecretKeyId",
"(",
")",
")",
";",
"parameters",
".",
"put",
"(",
"\"Signature\"",
",",
"signature",
")",
";",
"List",
"<",
"NameValuePair",
">",
"parameterList",
"=",
"new",
"ArrayList",
"<",
"NameValuePair",
">",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"parameters",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"String",
"value",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"!",
"(",
"key",
"==",
"null",
"||",
"key",
".",
"equals",
"(",
"\"\"",
")",
"||",
"value",
"==",
"null",
"||",
"value",
".",
"equals",
"(",
"\"\"",
")",
")",
")",
"{",
"parameterList",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"key",
",",
"value",
")",
")",
";",
"}",
"}",
"try",
"{",
"request",
".",
"setEntity",
"(",
"new",
"UrlEncodedFormEntity",
"(",
"parameterList",
",",
"\"UTF-8\"",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"MwsUtl",
".",
"wrap",
"(",
"e",
")",
";",
"}",
"}"
] |
Add authentication related and version parameter and set request body
with all of the parameters
@param request
|
[
"Add",
"authentication",
"related",
"and",
"version",
"parameter",
"and",
"set",
"request",
"body",
"with",
"all",
"of",
"the",
"parameters"
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L70-L94
|
7,010 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsAQCall.java
|
MwsAQCall.getResponseBody
|
private String getResponseBody(HttpResponse postResponse) {
InputStream input = null;
try {
input = postResponse.getEntity().getContent();
Reader reader = new InputStreamReader(input,
MwsUtl.DEFAULT_ENCODING);
StringBuilder b = new StringBuilder();
char[] c = new char[1024];
int len;
while (0 < (len = reader.read(c))) {
b.append(c, 0, len);
}
return b.toString();
} catch (Exception e) {
throw MwsUtl.wrap(e);
} finally {
MwsUtl.close(input);
}
}
|
java
|
private String getResponseBody(HttpResponse postResponse) {
InputStream input = null;
try {
input = postResponse.getEntity().getContent();
Reader reader = new InputStreamReader(input,
MwsUtl.DEFAULT_ENCODING);
StringBuilder b = new StringBuilder();
char[] c = new char[1024];
int len;
while (0 < (len = reader.read(c))) {
b.append(c, 0, len);
}
return b.toString();
} catch (Exception e) {
throw MwsUtl.wrap(e);
} finally {
MwsUtl.close(input);
}
}
|
[
"private",
"String",
"getResponseBody",
"(",
"HttpResponse",
"postResponse",
")",
"{",
"InputStream",
"input",
"=",
"null",
";",
"try",
"{",
"input",
"=",
"postResponse",
".",
"getEntity",
"(",
")",
".",
"getContent",
"(",
")",
";",
"Reader",
"reader",
"=",
"new",
"InputStreamReader",
"(",
"input",
",",
"MwsUtl",
".",
"DEFAULT_ENCODING",
")",
";",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"[",
"]",
"c",
"=",
"new",
"char",
"[",
"1024",
"]",
";",
"int",
"len",
";",
"while",
"(",
"0",
"<",
"(",
"len",
"=",
"reader",
".",
"read",
"(",
"c",
")",
")",
")",
"{",
"b",
".",
"append",
"(",
"c",
",",
"0",
",",
"len",
")",
";",
"}",
"return",
"b",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"MwsUtl",
".",
"wrap",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"MwsUtl",
".",
"close",
"(",
"input",
")",
";",
"}",
"}"
] |
Read stream into string
@param postResponse
The response to get the body from.
@return The response body.
|
[
"Read",
"stream",
"into",
"string"
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L104-L122
|
7,011 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsAQCall.java
|
MwsAQCall.getResponseHeaderMetadata
|
private MwsResponseHeaderMetadata getResponseHeaderMetadata(HttpResponse response) {
Header requestIdHeader = response.getFirstHeader("x-mws-request-id");
String requestId = requestIdHeader == null ? null : requestIdHeader.getValue();
Header timestampHeader = response.getFirstHeader("x-mws-timestamp");
String timestamp = timestampHeader == null ? null : timestampHeader.getValue();
Header contextHeader = response.getFirstHeader("x-mws-response-context");
String contextString = contextHeader==null ? "" : contextHeader.getValue();
List<String> context = Collections.unmodifiableList(Arrays.asList(contextString.split(",")));
Double quotaMax;
try {
Header quotaMaxHeader = response.getFirstHeader("x-mws-quota-max");
quotaMax = quotaMaxHeader == null ? null : Double.valueOf(quotaMaxHeader.getValue());
} catch (NumberFormatException ex) {
quotaMax = null;
}
Double quotaRemaining;
try {
Header quotaRemainingHeader = response.getFirstHeader("x-mws-quota-remaining");
quotaRemaining = quotaRemainingHeader == null ? null : Double.valueOf(quotaRemainingHeader.getValue());
} catch (NumberFormatException ex) {
quotaRemaining = null;
}
Date quotaResetDate;
try {
Header quotaResetHeader = response.getFirstHeader("x-mws-quota-resetsOn");
quotaResetDate = quotaResetHeader == null ? null : MwsUtl.parseTimestamp(quotaResetHeader.getValue());
} catch (java.text.ParseException ex) {
quotaResetDate = null;
}
return new MwsResponseHeaderMetadata(requestId, context, timestamp, quotaMax, quotaRemaining, quotaResetDate);
}
|
java
|
private MwsResponseHeaderMetadata getResponseHeaderMetadata(HttpResponse response) {
Header requestIdHeader = response.getFirstHeader("x-mws-request-id");
String requestId = requestIdHeader == null ? null : requestIdHeader.getValue();
Header timestampHeader = response.getFirstHeader("x-mws-timestamp");
String timestamp = timestampHeader == null ? null : timestampHeader.getValue();
Header contextHeader = response.getFirstHeader("x-mws-response-context");
String contextString = contextHeader==null ? "" : contextHeader.getValue();
List<String> context = Collections.unmodifiableList(Arrays.asList(contextString.split(",")));
Double quotaMax;
try {
Header quotaMaxHeader = response.getFirstHeader("x-mws-quota-max");
quotaMax = quotaMaxHeader == null ? null : Double.valueOf(quotaMaxHeader.getValue());
} catch (NumberFormatException ex) {
quotaMax = null;
}
Double quotaRemaining;
try {
Header quotaRemainingHeader = response.getFirstHeader("x-mws-quota-remaining");
quotaRemaining = quotaRemainingHeader == null ? null : Double.valueOf(quotaRemainingHeader.getValue());
} catch (NumberFormatException ex) {
quotaRemaining = null;
}
Date quotaResetDate;
try {
Header quotaResetHeader = response.getFirstHeader("x-mws-quota-resetsOn");
quotaResetDate = quotaResetHeader == null ? null : MwsUtl.parseTimestamp(quotaResetHeader.getValue());
} catch (java.text.ParseException ex) {
quotaResetDate = null;
}
return new MwsResponseHeaderMetadata(requestId, context, timestamp, quotaMax, quotaRemaining, quotaResetDate);
}
|
[
"private",
"MwsResponseHeaderMetadata",
"getResponseHeaderMetadata",
"(",
"HttpResponse",
"response",
")",
"{",
"Header",
"requestIdHeader",
"=",
"response",
".",
"getFirstHeader",
"(",
"\"x-mws-request-id\"",
")",
";",
"String",
"requestId",
"=",
"requestIdHeader",
"==",
"null",
"?",
"null",
":",
"requestIdHeader",
".",
"getValue",
"(",
")",
";",
"Header",
"timestampHeader",
"=",
"response",
".",
"getFirstHeader",
"(",
"\"x-mws-timestamp\"",
")",
";",
"String",
"timestamp",
"=",
"timestampHeader",
"==",
"null",
"?",
"null",
":",
"timestampHeader",
".",
"getValue",
"(",
")",
";",
"Header",
"contextHeader",
"=",
"response",
".",
"getFirstHeader",
"(",
"\"x-mws-response-context\"",
")",
";",
"String",
"contextString",
"=",
"contextHeader",
"==",
"null",
"?",
"\"\"",
":",
"contextHeader",
".",
"getValue",
"(",
")",
";",
"List",
"<",
"String",
">",
"context",
"=",
"Collections",
".",
"unmodifiableList",
"(",
"Arrays",
".",
"asList",
"(",
"contextString",
".",
"split",
"(",
"\",\"",
")",
")",
")",
";",
"Double",
"quotaMax",
";",
"try",
"{",
"Header",
"quotaMaxHeader",
"=",
"response",
".",
"getFirstHeader",
"(",
"\"x-mws-quota-max\"",
")",
";",
"quotaMax",
"=",
"quotaMaxHeader",
"==",
"null",
"?",
"null",
":",
"Double",
".",
"valueOf",
"(",
"quotaMaxHeader",
".",
"getValue",
"(",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"quotaMax",
"=",
"null",
";",
"}",
"Double",
"quotaRemaining",
";",
"try",
"{",
"Header",
"quotaRemainingHeader",
"=",
"response",
".",
"getFirstHeader",
"(",
"\"x-mws-quota-remaining\"",
")",
";",
"quotaRemaining",
"=",
"quotaRemainingHeader",
"==",
"null",
"?",
"null",
":",
"Double",
".",
"valueOf",
"(",
"quotaRemainingHeader",
".",
"getValue",
"(",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"quotaRemaining",
"=",
"null",
";",
"}",
"Date",
"quotaResetDate",
";",
"try",
"{",
"Header",
"quotaResetHeader",
"=",
"response",
".",
"getFirstHeader",
"(",
"\"x-mws-quota-resetsOn\"",
")",
";",
"quotaResetDate",
"=",
"quotaResetHeader",
"==",
"null",
"?",
"null",
":",
"MwsUtl",
".",
"parseTimestamp",
"(",
"quotaResetHeader",
".",
"getValue",
"(",
")",
")",
";",
"}",
"catch",
"(",
"java",
".",
"text",
".",
"ParseException",
"ex",
")",
"{",
"quotaResetDate",
"=",
"null",
";",
"}",
"return",
"new",
"MwsResponseHeaderMetadata",
"(",
"requestId",
",",
"context",
",",
"timestamp",
",",
"quotaMax",
",",
"quotaRemaining",
",",
"quotaResetDate",
")",
";",
"}"
] |
Get the metadata from the response headers.
@param response
@return The metadata.
|
[
"Get",
"the",
"metadata",
"from",
"the",
"response",
"headers",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L131-L167
|
7,012 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsAQCall.java
|
MwsAQCall.pauseIfRetryNeeded
|
private boolean pauseIfRetryNeeded(int retries) {
if (retries >= connection.getMaxErrorRetry()) {
return false;
}
long delay = (long) (Math.random() * Math.pow(4, retries) * 125);
try {
Thread.sleep(delay);
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
return true;
}
|
java
|
private boolean pauseIfRetryNeeded(int retries) {
if (retries >= connection.getMaxErrorRetry()) {
return false;
}
long delay = (long) (Math.random() * Math.pow(4, retries) * 125);
try {
Thread.sleep(delay);
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
return true;
}
|
[
"private",
"boolean",
"pauseIfRetryNeeded",
"(",
"int",
"retries",
")",
"{",
"if",
"(",
"retries",
">=",
"connection",
".",
"getMaxErrorRetry",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"long",
"delay",
"=",
"(",
"long",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"Math",
".",
"pow",
"(",
"4",
",",
"retries",
")",
"*",
"125",
")",
";",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"delay",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"MwsUtl",
".",
"wrap",
"(",
"e",
")",
";",
"}",
"return",
"true",
";",
"}"
] |
Random exponential back-off sleep on failed request.
If retry needed sleeps and then return true.
Sleep is random so that retry requests do not form spikes.
@param retries
current retry, 0 for first retry
@return true if should retry.
|
[
"Random",
"exponential",
"back",
"-",
"off",
"sleep",
"on",
"failed",
"request",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L181-L192
|
7,013 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsAQCall.java
|
MwsAQCall.createRequest
|
private HttpPost createRequest() {
HttpPost request = new HttpPost(serviceEndpoint.uri);
try {
request.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
request.addHeader("X-Amazon-User-Agent", connection.getUserAgent());
for(Map.Entry<String, String> header : connection.getRequestHeaders().entrySet()) {
request.addHeader(header.getKey(), header.getValue());
}
addRequiredParametersToRequest(request);
} catch (Exception e) {
request.releaseConnection();
throw MwsUtl.wrap(e);
}
return request;
}
|
java
|
private HttpPost createRequest() {
HttpPost request = new HttpPost(serviceEndpoint.uri);
try {
request.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
request.addHeader("X-Amazon-User-Agent", connection.getUserAgent());
for(Map.Entry<String, String> header : connection.getRequestHeaders().entrySet()) {
request.addHeader(header.getKey(), header.getValue());
}
addRequiredParametersToRequest(request);
} catch (Exception e) {
request.releaseConnection();
throw MwsUtl.wrap(e);
}
return request;
}
|
[
"private",
"HttpPost",
"createRequest",
"(",
")",
"{",
"HttpPost",
"request",
"=",
"new",
"HttpPost",
"(",
"serviceEndpoint",
".",
"uri",
")",
";",
"try",
"{",
"request",
".",
"addHeader",
"(",
"\"Content-Type\"",
",",
"\"application/x-www-form-urlencoded; charset=utf-8\"",
")",
";",
"request",
".",
"addHeader",
"(",
"\"X-Amazon-User-Agent\"",
",",
"connection",
".",
"getUserAgent",
"(",
")",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"header",
":",
"connection",
".",
"getRequestHeaders",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"request",
".",
"addHeader",
"(",
"header",
".",
"getKey",
"(",
")",
",",
"header",
".",
"getValue",
"(",
")",
")",
";",
"}",
"addRequiredParametersToRequest",
"(",
"request",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"request",
".",
"releaseConnection",
"(",
")",
";",
"throw",
"MwsUtl",
".",
"wrap",
"(",
"e",
")",
";",
"}",
"return",
"request",
";",
"}"
] |
Create a HttpPost request for this call and add required headers and parameters to it.
@return The Post Request.
|
[
"Create",
"a",
"HttpPost",
"request",
"for",
"this",
"call",
"and",
"add",
"required",
"headers",
"and",
"parameters",
"to",
"it",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L230-L244
|
7,014 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsAQCall.java
|
MwsAQCall.executeRequest
|
private HttpResponse executeRequest(HttpPost request) throws Exception {
try {
HttpClient httpClient = connection.getHttpClient();
HttpContext httpContext = connection.getHttpContext();
HttpResponse response = httpClient.execute(request, httpContext);
return response;
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
java
|
private HttpResponse executeRequest(HttpPost request) throws Exception {
try {
HttpClient httpClient = connection.getHttpClient();
HttpContext httpContext = connection.getHttpContext();
HttpResponse response = httpClient.execute(request, httpContext);
return response;
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
[
"private",
"HttpResponse",
"executeRequest",
"(",
"HttpPost",
"request",
")",
"throws",
"Exception",
"{",
"try",
"{",
"HttpClient",
"httpClient",
"=",
"connection",
".",
"getHttpClient",
"(",
")",
";",
"HttpContext",
"httpContext",
"=",
"connection",
".",
"getHttpContext",
"(",
")",
";",
"HttpResponse",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"request",
",",
"httpContext",
")",
";",
"return",
"response",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"MwsUtl",
".",
"wrap",
"(",
"e",
")",
";",
"}",
"}"
] |
Execute a request on this calls connection and context.
@param request
@return The response to executing the request.
|
[
"Execute",
"a",
"request",
"on",
"this",
"calls",
"connection",
"and",
"context",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L253-L262
|
7,015 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsAQCall.java
|
MwsAQCall.execute
|
@Override
public MwsResponse execute() {
HttpPost request = createRequest();
try {
HttpResponse hr = executeRequest(request);
StatusLine statusLine = hr.getStatusLine();
int status = statusLine.getStatusCode();
String message = statusLine.getReasonPhrase();
rhmd = getResponseHeaderMetadata(hr);
String body = getResponseBody(hr);
MwsResponse response = new MwsResponse(status,message,rhmd,body);
return response;
} catch (Exception e) {
throw MwsUtl.wrap(e);
} finally {
request.releaseConnection();
}
}
|
java
|
@Override
public MwsResponse execute() {
HttpPost request = createRequest();
try {
HttpResponse hr = executeRequest(request);
StatusLine statusLine = hr.getStatusLine();
int status = statusLine.getStatusCode();
String message = statusLine.getReasonPhrase();
rhmd = getResponseHeaderMetadata(hr);
String body = getResponseBody(hr);
MwsResponse response = new MwsResponse(status,message,rhmd,body);
return response;
} catch (Exception e) {
throw MwsUtl.wrap(e);
} finally {
request.releaseConnection();
}
}
|
[
"@",
"Override",
"public",
"MwsResponse",
"execute",
"(",
")",
"{",
"HttpPost",
"request",
"=",
"createRequest",
"(",
")",
";",
"try",
"{",
"HttpResponse",
"hr",
"=",
"executeRequest",
"(",
"request",
")",
";",
"StatusLine",
"statusLine",
"=",
"hr",
".",
"getStatusLine",
"(",
")",
";",
"int",
"status",
"=",
"statusLine",
".",
"getStatusCode",
"(",
")",
";",
"String",
"message",
"=",
"statusLine",
".",
"getReasonPhrase",
"(",
")",
";",
"rhmd",
"=",
"getResponseHeaderMetadata",
"(",
"hr",
")",
";",
"String",
"body",
"=",
"getResponseBody",
"(",
"hr",
")",
";",
"MwsResponse",
"response",
"=",
"new",
"MwsResponse",
"(",
"status",
",",
"message",
",",
"rhmd",
",",
"body",
")",
";",
"return",
"response",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"MwsUtl",
".",
"wrap",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"request",
".",
"releaseConnection",
"(",
")",
";",
"}",
"}"
] |
Perform a synchronous call with no retry or error handling.
@return
|
[
"Perform",
"a",
"synchronous",
"call",
"with",
"no",
"retry",
"or",
"error",
"handling",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L269-L286
|
7,016 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.calculateStringToSignV0
|
private static String calculateStringToSignV0(Map<String, String> parameters) {
StringBuilder data = new StringBuilder();
data.append(parameters.get("Action")).append(parameters.get("Timestamp"));
return data.toString();
}
|
java
|
private static String calculateStringToSignV0(Map<String, String> parameters) {
StringBuilder data = new StringBuilder();
data.append(parameters.get("Action")).append(parameters.get("Timestamp"));
return data.toString();
}
|
[
"private",
"static",
"String",
"calculateStringToSignV0",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"StringBuilder",
"data",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"data",
".",
"append",
"(",
"parameters",
".",
"get",
"(",
"\"Action\"",
")",
")",
".",
"append",
"(",
"parameters",
".",
"get",
"(",
"\"Timestamp\"",
")",
")",
";",
"return",
"data",
".",
"toString",
"(",
")",
";",
"}"
] |
Calculate String to Sign for SignatureVersion 0
@param parameters
request parameters
@return String to Sign
|
[
"Calculate",
"String",
"to",
"Sign",
"for",
"SignatureVersion",
"0"
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L128-L132
|
7,017 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.calculateStringToSignV1
|
private static String calculateStringToSignV1(Map<String, String> parameters) {
StringBuilder data = new StringBuilder();
Map<String, String> sorted = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
sorted.putAll(parameters);
Iterator<Entry<String, String>> pairs = sorted.entrySet().iterator();
while (pairs.hasNext()) {
Map.Entry<String, String> pair = pairs.next();
data.append(pair.getKey());
data.append(pair.getValue());
}
return data.toString();
}
|
java
|
private static String calculateStringToSignV1(Map<String, String> parameters) {
StringBuilder data = new StringBuilder();
Map<String, String> sorted = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
sorted.putAll(parameters);
Iterator<Entry<String, String>> pairs = sorted.entrySet().iterator();
while (pairs.hasNext()) {
Map.Entry<String, String> pair = pairs.next();
data.append(pair.getKey());
data.append(pair.getValue());
}
return data.toString();
}
|
[
"private",
"static",
"String",
"calculateStringToSignV1",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"StringBuilder",
"data",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"sorted",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"String",
">",
"(",
"String",
".",
"CASE_INSENSITIVE_ORDER",
")",
";",
"sorted",
".",
"putAll",
"(",
"parameters",
")",
";",
"Iterator",
"<",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"pairs",
"=",
"sorted",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"pairs",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"pair",
"=",
"pairs",
".",
"next",
"(",
")",
";",
"data",
".",
"append",
"(",
"pair",
".",
"getKey",
"(",
")",
")",
";",
"data",
".",
"append",
"(",
"pair",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"data",
".",
"toString",
"(",
")",
";",
"}"
] |
Calculate String to Sign for SignatureVersion 1
@param parameters
request parameters
@return String to Sign
|
[
"Calculate",
"String",
"to",
"Sign",
"for",
"SignatureVersion",
"1"
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L141-L152
|
7,018 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.calculateStringToSignV2
|
static String calculateStringToSignV2(URI serviceUri, Map<String, String> parameters) {
StringBuilder data = new StringBuilder();
data.append("POST");
data.append("\n");
data.append(serviceUri.getHost().toLowerCase());
if (!usesStandardPort(serviceUri)) {
data.append(":");
data.append(serviceUri.getPort());
}
data.append("\n");
String uri = serviceUri.getPath();
data.append(MwsUtl.urlEncode(uri, true));
data.append("\n");
Map<String, String> sorted = new TreeMap<String, String>();
sorted.putAll(parameters);
Iterator<Map.Entry<String, String>> pairs = sorted.entrySet().iterator();
while (pairs.hasNext()) {
Map.Entry<String, String> pair = pairs.next();
String key = pair.getKey();
data.append(MwsUtl.urlEncode(key, false));
data.append("=");
String value = pair.getValue();
data.append(MwsUtl.urlEncode(value, false));
if (pairs.hasNext()) {
data.append("&");
}
}
return data.toString();
}
|
java
|
static String calculateStringToSignV2(URI serviceUri, Map<String, String> parameters) {
StringBuilder data = new StringBuilder();
data.append("POST");
data.append("\n");
data.append(serviceUri.getHost().toLowerCase());
if (!usesStandardPort(serviceUri)) {
data.append(":");
data.append(serviceUri.getPort());
}
data.append("\n");
String uri = serviceUri.getPath();
data.append(MwsUtl.urlEncode(uri, true));
data.append("\n");
Map<String, String> sorted = new TreeMap<String, String>();
sorted.putAll(parameters);
Iterator<Map.Entry<String, String>> pairs = sorted.entrySet().iterator();
while (pairs.hasNext()) {
Map.Entry<String, String> pair = pairs.next();
String key = pair.getKey();
data.append(MwsUtl.urlEncode(key, false));
data.append("=");
String value = pair.getValue();
data.append(MwsUtl.urlEncode(value, false));
if (pairs.hasNext()) {
data.append("&");
}
}
return data.toString();
}
|
[
"static",
"String",
"calculateStringToSignV2",
"(",
"URI",
"serviceUri",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"StringBuilder",
"data",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"data",
".",
"append",
"(",
"\"POST\"",
")",
";",
"data",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"data",
".",
"append",
"(",
"serviceUri",
".",
"getHost",
"(",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"!",
"usesStandardPort",
"(",
"serviceUri",
")",
")",
"{",
"data",
".",
"append",
"(",
"\":\"",
")",
";",
"data",
".",
"append",
"(",
"serviceUri",
".",
"getPort",
"(",
")",
")",
";",
"}",
"data",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"String",
"uri",
"=",
"serviceUri",
".",
"getPath",
"(",
")",
";",
"data",
".",
"append",
"(",
"MwsUtl",
".",
"urlEncode",
"(",
"uri",
",",
"true",
")",
")",
";",
"data",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"sorted",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"sorted",
".",
"putAll",
"(",
"parameters",
")",
";",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"pairs",
"=",
"sorted",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"pairs",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"pair",
"=",
"pairs",
".",
"next",
"(",
")",
";",
"String",
"key",
"=",
"pair",
".",
"getKey",
"(",
")",
";",
"data",
".",
"append",
"(",
"MwsUtl",
".",
"urlEncode",
"(",
"key",
",",
"false",
")",
")",
";",
"data",
".",
"append",
"(",
"\"=\"",
")",
";",
"String",
"value",
"=",
"pair",
".",
"getValue",
"(",
")",
";",
"data",
".",
"append",
"(",
"MwsUtl",
".",
"urlEncode",
"(",
"value",
",",
"false",
")",
")",
";",
"if",
"(",
"pairs",
".",
"hasNext",
"(",
")",
")",
"{",
"data",
".",
"append",
"(",
"\"&\"",
")",
";",
"}",
"}",
"return",
"data",
".",
"toString",
"(",
")",
";",
"}"
] |
Calculate String to Sign for SignatureVersion 2
@param serviceUri
@param parameters
request parameters
@return String to Sign
|
[
"Calculate",
"String",
"to",
"Sign",
"for",
"SignatureVersion",
"2"
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L163-L191
|
7,019 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.cleanWS
|
private static String cleanWS(String s) {
s = replaceAll(s, OuterWhiteSpacesPtn, "");
s = replaceAll(s, WhiteSpacesPtn, " ");
return s;
}
|
java
|
private static String cleanWS(String s) {
s = replaceAll(s, OuterWhiteSpacesPtn, "");
s = replaceAll(s, WhiteSpacesPtn, " ");
return s;
}
|
[
"private",
"static",
"String",
"cleanWS",
"(",
"String",
"s",
")",
"{",
"s",
"=",
"replaceAll",
"(",
"s",
",",
"OuterWhiteSpacesPtn",
",",
"\"\"",
")",
";",
"s",
"=",
"replaceAll",
"(",
"s",
",",
"WhiteSpacesPtn",
",",
"\" \"",
")",
";",
"return",
"s",
";",
"}"
] |
Clean white space. Remove leading and trailing, and replace internal runs
with a single space character.
@param s
@return The clean string.
|
[
"Clean",
"white",
"space",
".",
"Remove",
"leading",
"and",
"trailing",
"and",
"replace",
"internal",
"runs",
"with",
"a",
"single",
"space",
"character",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L201-L205
|
7,020 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.urlEncode
|
protected static String urlEncode(String value, boolean path) {
try {
value = URLEncoder.encode(value, DEFAULT_ENCODING);
} catch (Exception e) {
throw wrap(e);
}
value = replaceAll(value, plusPtn, "%20");
value = replaceAll(value, asteriskPtn, "%2A");
value = replaceAll(value, pct7EPtn, "~");
if (path) {
value = replaceAll(value, pct2FPtn, "/");
}
return value;
}
|
java
|
protected static String urlEncode(String value, boolean path) {
try {
value = URLEncoder.encode(value, DEFAULT_ENCODING);
} catch (Exception e) {
throw wrap(e);
}
value = replaceAll(value, plusPtn, "%20");
value = replaceAll(value, asteriskPtn, "%2A");
value = replaceAll(value, pct7EPtn, "~");
if (path) {
value = replaceAll(value, pct2FPtn, "/");
}
return value;
}
|
[
"protected",
"static",
"String",
"urlEncode",
"(",
"String",
"value",
",",
"boolean",
"path",
")",
"{",
"try",
"{",
"value",
"=",
"URLEncoder",
".",
"encode",
"(",
"value",
",",
"DEFAULT_ENCODING",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"wrap",
"(",
"e",
")",
";",
"}",
"value",
"=",
"replaceAll",
"(",
"value",
",",
"plusPtn",
",",
"\"%20\"",
")",
";",
"value",
"=",
"replaceAll",
"(",
"value",
",",
"asteriskPtn",
",",
"\"%2A\"",
")",
";",
"value",
"=",
"replaceAll",
"(",
"value",
",",
"pct7EPtn",
",",
"\"~\"",
")",
";",
"if",
"(",
"path",
")",
"{",
"value",
"=",
"replaceAll",
"(",
"value",
",",
"pct2FPtn",
",",
"\"/\"",
")",
";",
"}",
"return",
"value",
";",
"}"
] |
URL encode a value.
@param value
@param path
true if is a path and '/' should not be encoded.
@return The encoded string.
|
[
"URL",
"encode",
"a",
"value",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L282-L295
|
7,021 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.getFormattedTimestamp
|
static String getFormattedTimestamp() {
DateFormat df = dateFormatPool.getAndSet(null);
if (df == null) {
df = createISODateFormat();
}
String timestamp = df.format(new Date());
dateFormatPool.set(df);
return timestamp;
}
|
java
|
static String getFormattedTimestamp() {
DateFormat df = dateFormatPool.getAndSet(null);
if (df == null) {
df = createISODateFormat();
}
String timestamp = df.format(new Date());
dateFormatPool.set(df);
return timestamp;
}
|
[
"static",
"String",
"getFormattedTimestamp",
"(",
")",
"{",
"DateFormat",
"df",
"=",
"dateFormatPool",
".",
"getAndSet",
"(",
"null",
")",
";",
"if",
"(",
"df",
"==",
"null",
")",
"{",
"df",
"=",
"createISODateFormat",
"(",
")",
";",
"}",
"String",
"timestamp",
"=",
"df",
".",
"format",
"(",
"new",
"Date",
"(",
")",
")",
";",
"dateFormatPool",
".",
"set",
"(",
"df",
")",
";",
"return",
"timestamp",
";",
"}"
] |
Get a ISO 8601 formatted timestamp of now.
@return The time stamp.
|
[
"Get",
"a",
"ISO",
"8601",
"formatted",
"timestamp",
"of",
"now",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L349-L357
|
7,022 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.parseTimestamp
|
static Date parseTimestamp(String timestamp) throws ParseException {
DateFormat df = dateFormatPool.getAndSet(null);
if (df == null) {
df = createISODateFormat();
}
Date date = df.parse(timestamp);
dateFormatPool.set(df);
return date;
}
|
java
|
static Date parseTimestamp(String timestamp) throws ParseException {
DateFormat df = dateFormatPool.getAndSet(null);
if (df == null) {
df = createISODateFormat();
}
Date date = df.parse(timestamp);
dateFormatPool.set(df);
return date;
}
|
[
"static",
"Date",
"parseTimestamp",
"(",
"String",
"timestamp",
")",
"throws",
"ParseException",
"{",
"DateFormat",
"df",
"=",
"dateFormatPool",
".",
"getAndSet",
"(",
"null",
")",
";",
"if",
"(",
"df",
"==",
"null",
")",
"{",
"df",
"=",
"createISODateFormat",
"(",
")",
";",
"}",
"Date",
"date",
"=",
"df",
".",
"parse",
"(",
"timestamp",
")",
";",
"dateFormatPool",
".",
"set",
"(",
"df",
")",
";",
"return",
"date",
";",
"}"
] |
Parse an ISO 8601 formatted timestamp
@return the parsed date
|
[
"Parse",
"an",
"ISO",
"8601",
"formatted",
"timestamp"
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L364-L372
|
7,023 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.newInstance
|
static <T> T newInstance(Class<T> cls) {
try {
return cls.newInstance();
} catch (Exception e) {
throw wrap(e);
}
}
|
java
|
static <T> T newInstance(Class<T> cls) {
try {
return cls.newInstance();
} catch (Exception e) {
throw wrap(e);
}
}
|
[
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Class",
"<",
"T",
">",
"cls",
")",
"{",
"try",
"{",
"return",
"cls",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"wrap",
"(",
"e",
")",
";",
"}",
"}"
] |
Create a new instance of a class, wrap exceptions.
@param cls
@return The new instance.
|
[
"Create",
"a",
"new",
"instance",
"of",
"a",
"class",
"wrap",
"exceptions",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L390-L396
|
7,024 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.toXmlString
|
static String toXmlString(Node node) {
try {
Transformer transformer = getTF().newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT, "no");
StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(sw);
DOMSource source = new DOMSource(node);
transformer.transform(source, result);
return sw.toString();
} catch (Exception e) {
throw wrap(e);
}
}
|
java
|
static String toXmlString(Node node) {
try {
Transformer transformer = getTF().newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT, "no");
StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(sw);
DOMSource source = new DOMSource(node);
transformer.transform(source, result);
return sw.toString();
} catch (Exception e) {
throw wrap(e);
}
}
|
[
"static",
"String",
"toXmlString",
"(",
"Node",
"node",
")",
"{",
"try",
"{",
"Transformer",
"transformer",
"=",
"getTF",
"(",
")",
".",
"newTransformer",
"(",
")",
";",
"transformer",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"OMIT_XML_DECLARATION",
",",
"\"yes\"",
")",
";",
"transformer",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"ENCODING",
",",
"\"UTF-8\"",
")",
";",
"transformer",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"INDENT",
",",
"\"no\"",
")",
";",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"StreamResult",
"result",
"=",
"new",
"StreamResult",
"(",
"sw",
")",
";",
"DOMSource",
"source",
"=",
"new",
"DOMSource",
"(",
"node",
")",
";",
"transformer",
".",
"transform",
"(",
"source",
",",
"result",
")",
";",
"return",
"sw",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"wrap",
"(",
"e",
")",
";",
"}",
"}"
] |
Get xml string for contents of node.
@param node
@return The node as xml.
|
[
"Get",
"xml",
"string",
"for",
"contents",
"of",
"node",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L462-L476
|
7,025 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.close
|
public static void close(Closeable a) {
try {
if (a != null) {
a.close();
}
} catch (Exception e) {
throw wrap(e);
}
}
|
java
|
public static void close(Closeable a) {
try {
if (a != null) {
a.close();
}
} catch (Exception e) {
throw wrap(e);
}
}
|
[
"public",
"static",
"void",
"close",
"(",
"Closeable",
"a",
")",
"{",
"try",
"{",
"if",
"(",
"a",
"!=",
"null",
")",
"{",
"a",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"wrap",
"(",
"e",
")",
";",
"}",
"}"
] |
Close a Closeable if it is not null.
@param a
The Closeable or null.
|
[
"Close",
"a",
"Closeable",
"if",
"it",
"is",
"not",
"null",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L514-L522
|
7,026 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.escapeAppVersion
|
public static String escapeAppVersion(String s) {
s = cleanWS(s);
s = replaceAll(s, BackSlashPtn, EscBackSlash);
s = replaceAll(s, LParenPtn, EscLParen);
return s;
}
|
java
|
public static String escapeAppVersion(String s) {
s = cleanWS(s);
s = replaceAll(s, BackSlashPtn, EscBackSlash);
s = replaceAll(s, LParenPtn, EscLParen);
return s;
}
|
[
"public",
"static",
"String",
"escapeAppVersion",
"(",
"String",
"s",
")",
"{",
"s",
"=",
"cleanWS",
"(",
"s",
")",
";",
"s",
"=",
"replaceAll",
"(",
"s",
",",
"BackSlashPtn",
",",
"EscBackSlash",
")",
";",
"s",
"=",
"replaceAll",
"(",
"s",
",",
"LParenPtn",
",",
"EscLParen",
")",
";",
"return",
"s",
";",
"}"
] |
Escape an application version string.
@param s
@return The escaped app version.
|
[
"Escape",
"an",
"application",
"version",
"string",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L548-L553
|
7,027 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.getTF
|
public static TransformerFactory getTF() {
TransformerFactory tf = threadTF.get();
if (tf == null) {
tf = TransformerFactory.newInstance();
threadTF.set(tf);
}
return tf;
}
|
java
|
public static TransformerFactory getTF() {
TransformerFactory tf = threadTF.get();
if (tf == null) {
tf = TransformerFactory.newInstance();
threadTF.set(tf);
}
return tf;
}
|
[
"public",
"static",
"TransformerFactory",
"getTF",
"(",
")",
"{",
"TransformerFactory",
"tf",
"=",
"threadTF",
".",
"get",
"(",
")",
";",
"if",
"(",
"tf",
"==",
"null",
")",
"{",
"tf",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
";",
"threadTF",
".",
"set",
"(",
"tf",
")",
";",
"}",
"return",
"tf",
";",
"}"
] |
Get a thread local transformer factory.
@return The factory.
|
[
"Get",
"a",
"thread",
"local",
"transformer",
"factory",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L617-L624
|
7,028 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsUtl.java
|
MwsUtl.wrap
|
public static RuntimeException wrap(Throwable e) {
if (e instanceof RuntimeException) {
return (RuntimeException) e;
}
return new RuntimeException(e);
}
|
java
|
public static RuntimeException wrap(Throwable e) {
if (e instanceof RuntimeException) {
return (RuntimeException) e;
}
return new RuntimeException(e);
}
|
[
"public",
"static",
"RuntimeException",
"wrap",
"(",
"Throwable",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"RuntimeException",
")",
"{",
"return",
"(",
"RuntimeException",
")",
"e",
";",
"}",
"return",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}"
] |
Wrap Checked exceptions in runtime exception.
@param e
@return e, wrapped in a runtime exception if necessary.
|
[
"Wrap",
"Checked",
"exceptions",
"in",
"runtime",
"exception",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L633-L638
|
7,029 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsConnection.java
|
MwsConnection.freeze
|
synchronized void freeze() {
if (frozen) {
return;
}
if (userAgent == null) {
setDefaultUserAgent();
}
serviceMap = new HashMap<String, ServiceEndpoint>();
if (log.isDebugEnabled()) {
StringBuilder buf = new StringBuilder();
buf.append("Creating MwsConnection {");
buf.append("applicationName:");
buf.append(applicationName);
buf.append(",applicationVersion:");
buf.append(applicationVersion);
buf.append(",awsAccessKeyId:");
buf.append(awsAccessKeyId);
buf.append(",uri:");
buf.append(endpoint.toString());
buf.append(",userAgent:");
buf.append(userAgent);
buf.append(",connectionTimeout:");
buf.append(connectionTimeout);
if (proxyHost != null && proxyPort != 0) {
buf.append(",proxyUsername:");
buf.append(proxyUsername);
buf.append(",proxyHost:");
buf.append(proxyHost);
buf.append(",proxyPort:");
buf.append(proxyPort);
}
buf.append("}");
log.debug(buf);
}
BasicHttpParams httpParams = new BasicHttpParams();
httpParams.setParameter(CoreProtocolPNames.USER_AGENT, userAgent);
HttpConnectionParams
.setConnectionTimeout(httpParams, connectionTimeout);
HttpConnectionParams.setSoTimeout(httpParams, socketTimeout);
HttpConnectionParams.setStaleCheckingEnabled(httpParams, true);
HttpConnectionParams.setTcpNoDelay(httpParams, true);
connectionManager = getConnectionManager();
httpClient = new DefaultHttpClient(connectionManager, httpParams);
httpContext = new BasicHttpContext();
if (proxyHost != null && proxyPort != 0) {
String scheme = MwsUtl.usesHttps(endpoint) ? "https" : "http";
HttpHost hostConfiguration = new HttpHost(proxyHost, proxyPort, scheme);
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, hostConfiguration);
if (proxyUsername != null && proxyPassword != null) {
Credentials credentials = new UsernamePasswordCredentials(proxyUsername, proxyPassword);
CredentialsProvider cprovider = new BasicCredentialsProvider();
cprovider.setCredentials(new AuthScope(proxyHost, proxyPort), credentials);
httpContext.setAttribute(ClientContext.CREDS_PROVIDER, cprovider);
}
}
headers = Collections.unmodifiableMap(headers);
frozen = true;
}
|
java
|
synchronized void freeze() {
if (frozen) {
return;
}
if (userAgent == null) {
setDefaultUserAgent();
}
serviceMap = new HashMap<String, ServiceEndpoint>();
if (log.isDebugEnabled()) {
StringBuilder buf = new StringBuilder();
buf.append("Creating MwsConnection {");
buf.append("applicationName:");
buf.append(applicationName);
buf.append(",applicationVersion:");
buf.append(applicationVersion);
buf.append(",awsAccessKeyId:");
buf.append(awsAccessKeyId);
buf.append(",uri:");
buf.append(endpoint.toString());
buf.append(",userAgent:");
buf.append(userAgent);
buf.append(",connectionTimeout:");
buf.append(connectionTimeout);
if (proxyHost != null && proxyPort != 0) {
buf.append(",proxyUsername:");
buf.append(proxyUsername);
buf.append(",proxyHost:");
buf.append(proxyHost);
buf.append(",proxyPort:");
buf.append(proxyPort);
}
buf.append("}");
log.debug(buf);
}
BasicHttpParams httpParams = new BasicHttpParams();
httpParams.setParameter(CoreProtocolPNames.USER_AGENT, userAgent);
HttpConnectionParams
.setConnectionTimeout(httpParams, connectionTimeout);
HttpConnectionParams.setSoTimeout(httpParams, socketTimeout);
HttpConnectionParams.setStaleCheckingEnabled(httpParams, true);
HttpConnectionParams.setTcpNoDelay(httpParams, true);
connectionManager = getConnectionManager();
httpClient = new DefaultHttpClient(connectionManager, httpParams);
httpContext = new BasicHttpContext();
if (proxyHost != null && proxyPort != 0) {
String scheme = MwsUtl.usesHttps(endpoint) ? "https" : "http";
HttpHost hostConfiguration = new HttpHost(proxyHost, proxyPort, scheme);
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, hostConfiguration);
if (proxyUsername != null && proxyPassword != null) {
Credentials credentials = new UsernamePasswordCredentials(proxyUsername, proxyPassword);
CredentialsProvider cprovider = new BasicCredentialsProvider();
cprovider.setCredentials(new AuthScope(proxyHost, proxyPort), credentials);
httpContext.setAttribute(ClientContext.CREDS_PROVIDER, cprovider);
}
}
headers = Collections.unmodifiableMap(headers);
frozen = true;
}
|
[
"synchronized",
"void",
"freeze",
"(",
")",
"{",
"if",
"(",
"frozen",
")",
"{",
"return",
";",
"}",
"if",
"(",
"userAgent",
"==",
"null",
")",
"{",
"setDefaultUserAgent",
"(",
")",
";",
"}",
"serviceMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"ServiceEndpoint",
">",
"(",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"Creating MwsConnection {\"",
")",
";",
"buf",
".",
"append",
"(",
"\"applicationName:\"",
")",
";",
"buf",
".",
"append",
"(",
"applicationName",
")",
";",
"buf",
".",
"append",
"(",
"\",applicationVersion:\"",
")",
";",
"buf",
".",
"append",
"(",
"applicationVersion",
")",
";",
"buf",
".",
"append",
"(",
"\",awsAccessKeyId:\"",
")",
";",
"buf",
".",
"append",
"(",
"awsAccessKeyId",
")",
";",
"buf",
".",
"append",
"(",
"\",uri:\"",
")",
";",
"buf",
".",
"append",
"(",
"endpoint",
".",
"toString",
"(",
")",
")",
";",
"buf",
".",
"append",
"(",
"\",userAgent:\"",
")",
";",
"buf",
".",
"append",
"(",
"userAgent",
")",
";",
"buf",
".",
"append",
"(",
"\",connectionTimeout:\"",
")",
";",
"buf",
".",
"append",
"(",
"connectionTimeout",
")",
";",
"if",
"(",
"proxyHost",
"!=",
"null",
"&&",
"proxyPort",
"!=",
"0",
")",
"{",
"buf",
".",
"append",
"(",
"\",proxyUsername:\"",
")",
";",
"buf",
".",
"append",
"(",
"proxyUsername",
")",
";",
"buf",
".",
"append",
"(",
"\",proxyHost:\"",
")",
";",
"buf",
".",
"append",
"(",
"proxyHost",
")",
";",
"buf",
".",
"append",
"(",
"\",proxyPort:\"",
")",
";",
"buf",
".",
"append",
"(",
"proxyPort",
")",
";",
"}",
"buf",
".",
"append",
"(",
"\"}\"",
")",
";",
"log",
".",
"debug",
"(",
"buf",
")",
";",
"}",
"BasicHttpParams",
"httpParams",
"=",
"new",
"BasicHttpParams",
"(",
")",
";",
"httpParams",
".",
"setParameter",
"(",
"CoreProtocolPNames",
".",
"USER_AGENT",
",",
"userAgent",
")",
";",
"HttpConnectionParams",
".",
"setConnectionTimeout",
"(",
"httpParams",
",",
"connectionTimeout",
")",
";",
"HttpConnectionParams",
".",
"setSoTimeout",
"(",
"httpParams",
",",
"socketTimeout",
")",
";",
"HttpConnectionParams",
".",
"setStaleCheckingEnabled",
"(",
"httpParams",
",",
"true",
")",
";",
"HttpConnectionParams",
".",
"setTcpNoDelay",
"(",
"httpParams",
",",
"true",
")",
";",
"connectionManager",
"=",
"getConnectionManager",
"(",
")",
";",
"httpClient",
"=",
"new",
"DefaultHttpClient",
"(",
"connectionManager",
",",
"httpParams",
")",
";",
"httpContext",
"=",
"new",
"BasicHttpContext",
"(",
")",
";",
"if",
"(",
"proxyHost",
"!=",
"null",
"&&",
"proxyPort",
"!=",
"0",
")",
"{",
"String",
"scheme",
"=",
"MwsUtl",
".",
"usesHttps",
"(",
"endpoint",
")",
"?",
"\"https\"",
":",
"\"http\"",
";",
"HttpHost",
"hostConfiguration",
"=",
"new",
"HttpHost",
"(",
"proxyHost",
",",
"proxyPort",
",",
"scheme",
")",
";",
"httpClient",
".",
"getParams",
"(",
")",
".",
"setParameter",
"(",
"ConnRoutePNames",
".",
"DEFAULT_PROXY",
",",
"hostConfiguration",
")",
";",
"if",
"(",
"proxyUsername",
"!=",
"null",
"&&",
"proxyPassword",
"!=",
"null",
")",
"{",
"Credentials",
"credentials",
"=",
"new",
"UsernamePasswordCredentials",
"(",
"proxyUsername",
",",
"proxyPassword",
")",
";",
"CredentialsProvider",
"cprovider",
"=",
"new",
"BasicCredentialsProvider",
"(",
")",
";",
"cprovider",
".",
"setCredentials",
"(",
"new",
"AuthScope",
"(",
"proxyHost",
",",
"proxyPort",
")",
",",
"credentials",
")",
";",
"httpContext",
".",
"setAttribute",
"(",
"ClientContext",
".",
"CREDS_PROVIDER",
",",
"cprovider",
")",
";",
"}",
"}",
"headers",
"=",
"Collections",
".",
"unmodifiableMap",
"(",
"headers",
")",
";",
"frozen",
"=",
"true",
";",
"}"
] |
Initialize the connection.
|
[
"Initialize",
"the",
"connection",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsConnection.java#L209-L269
|
7,030 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsConnection.java
|
MwsConnection.getSharedES
|
private ExecutorService getSharedES() {
synchronized (this.getClass()) {
if (sharedES != null) {
return sharedES;
}
sharedES = new ThreadPoolExecutor(maxAsyncThreads / 10,
maxAsyncThreads, 60L, TimeUnit.SECONDS,
new ArrayBlockingQueue<Runnable>(maxAsyncQueueSize),
new ThreadFactory() {
private final AtomicInteger threadNumber = new AtomicInteger(
1);
@Override
public Thread newThread(Runnable task) {
Thread thread = new Thread(task, "MWSClient-"
+ threadNumber.getAndIncrement());
thread.setDaemon(true);
thread.setPriority(Thread.NORM_PRIORITY);
return thread;
}
}, new RejectedExecutionHandler() {
@Override
public void rejectedExecution(Runnable task,
ThreadPoolExecutor executor) {
if (!executor.isShutdown()) {
log.warn("MWSClient async queue full, running on calling thread.");
task.run();
} else {
throw new RejectedExecutionException();
}
}
});
return sharedES;
}
}
|
java
|
private ExecutorService getSharedES() {
synchronized (this.getClass()) {
if (sharedES != null) {
return sharedES;
}
sharedES = new ThreadPoolExecutor(maxAsyncThreads / 10,
maxAsyncThreads, 60L, TimeUnit.SECONDS,
new ArrayBlockingQueue<Runnable>(maxAsyncQueueSize),
new ThreadFactory() {
private final AtomicInteger threadNumber = new AtomicInteger(
1);
@Override
public Thread newThread(Runnable task) {
Thread thread = new Thread(task, "MWSClient-"
+ threadNumber.getAndIncrement());
thread.setDaemon(true);
thread.setPriority(Thread.NORM_PRIORITY);
return thread;
}
}, new RejectedExecutionHandler() {
@Override
public void rejectedExecution(Runnable task,
ThreadPoolExecutor executor) {
if (!executor.isShutdown()) {
log.warn("MWSClient async queue full, running on calling thread.");
task.run();
} else {
throw new RejectedExecutionException();
}
}
});
return sharedES;
}
}
|
[
"private",
"ExecutorService",
"getSharedES",
"(",
")",
"{",
"synchronized",
"(",
"this",
".",
"getClass",
"(",
")",
")",
"{",
"if",
"(",
"sharedES",
"!=",
"null",
")",
"{",
"return",
"sharedES",
";",
"}",
"sharedES",
"=",
"new",
"ThreadPoolExecutor",
"(",
"maxAsyncThreads",
"/",
"10",
",",
"maxAsyncThreads",
",",
"60L",
",",
"TimeUnit",
".",
"SECONDS",
",",
"new",
"ArrayBlockingQueue",
"<",
"Runnable",
">",
"(",
"maxAsyncQueueSize",
")",
",",
"new",
"ThreadFactory",
"(",
")",
"{",
"private",
"final",
"AtomicInteger",
"threadNumber",
"=",
"new",
"AtomicInteger",
"(",
"1",
")",
";",
"@",
"Override",
"public",
"Thread",
"newThread",
"(",
"Runnable",
"task",
")",
"{",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"task",
",",
"\"MWSClient-\"",
"+",
"threadNumber",
".",
"getAndIncrement",
"(",
")",
")",
";",
"thread",
".",
"setDaemon",
"(",
"true",
")",
";",
"thread",
".",
"setPriority",
"(",
"Thread",
".",
"NORM_PRIORITY",
")",
";",
"return",
"thread",
";",
"}",
"}",
",",
"new",
"RejectedExecutionHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"rejectedExecution",
"(",
"Runnable",
"task",
",",
"ThreadPoolExecutor",
"executor",
")",
"{",
"if",
"(",
"!",
"executor",
".",
"isShutdown",
"(",
")",
")",
"{",
"log",
".",
"warn",
"(",
"\"MWSClient async queue full, running on calling thread.\"",
")",
";",
"task",
".",
"run",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"RejectedExecutionException",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"return",
"sharedES",
";",
"}",
"}"
] |
Get the shared executor service that is used by async calls if no
executor is supplied.
@return The shared executor service.
|
[
"Get",
"the",
"shared",
"executor",
"service",
"that",
"is",
"used",
"by",
"async",
"calls",
"if",
"no",
"executor",
"is",
"supplied",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsConnection.java#L298-L331
|
7,031 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsConnection.java
|
MwsConnection.setDefaultUserAgent
|
private void setDefaultUserAgent() {
setUserAgent(
MwsUtl.escapeAppName(applicationName),
MwsUtl.escapeAppVersion(applicationVersion),
MwsUtl.escapeAttributeValue("Java/"
+ System.getProperty("java.version") + "/"
+ System.getProperty("java.class.version") + "/"
+ System.getProperty("java.vendor")),
MwsUtl.escapeAttributeName("Platform"),
MwsUtl.escapeAttributeValue("" + System.getProperty("os.name")
+ "/" + System.getProperty("os.arch") + "/"
+ System.getProperty("os.version")),
MwsUtl.escapeAttributeName("MWSClientVersion"),
MwsUtl.escapeAttributeValue(libraryVersion));
}
|
java
|
private void setDefaultUserAgent() {
setUserAgent(
MwsUtl.escapeAppName(applicationName),
MwsUtl.escapeAppVersion(applicationVersion),
MwsUtl.escapeAttributeValue("Java/"
+ System.getProperty("java.version") + "/"
+ System.getProperty("java.class.version") + "/"
+ System.getProperty("java.vendor")),
MwsUtl.escapeAttributeName("Platform"),
MwsUtl.escapeAttributeValue("" + System.getProperty("os.name")
+ "/" + System.getProperty("os.arch") + "/"
+ System.getProperty("os.version")),
MwsUtl.escapeAttributeName("MWSClientVersion"),
MwsUtl.escapeAttributeValue(libraryVersion));
}
|
[
"private",
"void",
"setDefaultUserAgent",
"(",
")",
"{",
"setUserAgent",
"(",
"MwsUtl",
".",
"escapeAppName",
"(",
"applicationName",
")",
",",
"MwsUtl",
".",
"escapeAppVersion",
"(",
"applicationVersion",
")",
",",
"MwsUtl",
".",
"escapeAttributeValue",
"(",
"\"Java/\"",
"+",
"System",
".",
"getProperty",
"(",
"\"java.version\"",
")",
"+",
"\"/\"",
"+",
"System",
".",
"getProperty",
"(",
"\"java.class.version\"",
")",
"+",
"\"/\"",
"+",
"System",
".",
"getProperty",
"(",
"\"java.vendor\"",
")",
")",
",",
"MwsUtl",
".",
"escapeAttributeName",
"(",
"\"Platform\"",
")",
",",
"MwsUtl",
".",
"escapeAttributeValue",
"(",
"\"\"",
"+",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
"+",
"\"/\"",
"+",
"System",
".",
"getProperty",
"(",
"\"os.arch\"",
")",
"+",
"\"/\"",
"+",
"System",
".",
"getProperty",
"(",
"\"os.version\"",
")",
")",
",",
"MwsUtl",
".",
"escapeAttributeName",
"(",
"\"MWSClientVersion\"",
")",
",",
"MwsUtl",
".",
"escapeAttributeValue",
"(",
"libraryVersion",
")",
")",
";",
"}"
] |
Set the default user agent string. Called when connection first opened if
user agent is not set explicitly.
|
[
"Set",
"the",
"default",
"user",
"agent",
"string",
".",
"Called",
"when",
"connection",
"first",
"opened",
"if",
"user",
"agent",
"is",
"not",
"set",
"explicitly",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsConnection.java#L337-L353
|
7,032 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsConnection.java
|
MwsConnection.getServiceEndpoint
|
ServiceEndpoint getServiceEndpoint(String servicePath) {
synchronized (serviceMap) {
ServiceEndpoint sep = serviceMap.get(servicePath);
if (sep == null) {
sep = new ServiceEndpoint(endpoint, servicePath);
serviceMap.put(servicePath, sep);
}
return sep;
}
}
|
java
|
ServiceEndpoint getServiceEndpoint(String servicePath) {
synchronized (serviceMap) {
ServiceEndpoint sep = serviceMap.get(servicePath);
if (sep == null) {
sep = new ServiceEndpoint(endpoint, servicePath);
serviceMap.put(servicePath, sep);
}
return sep;
}
}
|
[
"ServiceEndpoint",
"getServiceEndpoint",
"(",
"String",
"servicePath",
")",
"{",
"synchronized",
"(",
"serviceMap",
")",
"{",
"ServiceEndpoint",
"sep",
"=",
"serviceMap",
".",
"get",
"(",
"servicePath",
")",
";",
"if",
"(",
"sep",
"==",
"null",
")",
"{",
"sep",
"=",
"new",
"ServiceEndpoint",
"(",
"endpoint",
",",
"servicePath",
")",
";",
"serviceMap",
".",
"put",
"(",
"servicePath",
",",
"sep",
")",
";",
"}",
"return",
"sep",
";",
"}",
"}"
] |
Get a MwsServiceUri for the servicePath.
@param servicePath
The service name and version as name/version, no leading or
trailing slash.
@return The service endpoint instance.
|
[
"Get",
"a",
"MwsServiceUri",
"for",
"the",
"servicePath",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsConnection.java#L394-L403
|
7,033 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsConnection.java
|
MwsConnection.call
|
@SuppressWarnings("unchecked")
public <T extends MwsObject> T call(MwsRequestType type,
MwsObject requestData) {
MwsReader responseReader = null;
try {
String servicePath = type.getServicePath();
String operationName = type.getOperationName();
MwsCall mc = newCall(servicePath, operationName);
requestData.writeFragmentTo(mc);
responseReader = mc.invoke();
MwsResponseHeaderMetadata rhmd = mc.getResponseHeaderMetadata();
MwsObject response = MwsUtl.newInstance(type.getResponseClass());
type.setRHMD(response, rhmd);
response.readFragmentFrom(responseReader);
return (T) response;
} catch (Exception e) {
throw type.wrapException(e);
} finally {
MwsUtl.close(responseReader);
}
}
|
java
|
@SuppressWarnings("unchecked")
public <T extends MwsObject> T call(MwsRequestType type,
MwsObject requestData) {
MwsReader responseReader = null;
try {
String servicePath = type.getServicePath();
String operationName = type.getOperationName();
MwsCall mc = newCall(servicePath, operationName);
requestData.writeFragmentTo(mc);
responseReader = mc.invoke();
MwsResponseHeaderMetadata rhmd = mc.getResponseHeaderMetadata();
MwsObject response = MwsUtl.newInstance(type.getResponseClass());
type.setRHMD(response, rhmd);
response.readFragmentFrom(responseReader);
return (T) response;
} catch (Exception e) {
throw type.wrapException(e);
} finally {
MwsUtl.close(responseReader);
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"MwsObject",
">",
"T",
"call",
"(",
"MwsRequestType",
"type",
",",
"MwsObject",
"requestData",
")",
"{",
"MwsReader",
"responseReader",
"=",
"null",
";",
"try",
"{",
"String",
"servicePath",
"=",
"type",
".",
"getServicePath",
"(",
")",
";",
"String",
"operationName",
"=",
"type",
".",
"getOperationName",
"(",
")",
";",
"MwsCall",
"mc",
"=",
"newCall",
"(",
"servicePath",
",",
"operationName",
")",
";",
"requestData",
".",
"writeFragmentTo",
"(",
"mc",
")",
";",
"responseReader",
"=",
"mc",
".",
"invoke",
"(",
")",
";",
"MwsResponseHeaderMetadata",
"rhmd",
"=",
"mc",
".",
"getResponseHeaderMetadata",
"(",
")",
";",
"MwsObject",
"response",
"=",
"MwsUtl",
".",
"newInstance",
"(",
"type",
".",
"getResponseClass",
"(",
")",
")",
";",
"type",
".",
"setRHMD",
"(",
"response",
",",
"rhmd",
")",
";",
"response",
".",
"readFragmentFrom",
"(",
"responseReader",
")",
";",
"return",
"(",
"T",
")",
"response",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"type",
".",
"wrapException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"MwsUtl",
".",
"close",
"(",
"responseReader",
")",
";",
"}",
"}"
] |
Call an operation and return the response data.
@param requestData
The request data.
@return The response data.
|
[
"Call",
"an",
"operation",
"and",
"return",
"the",
"response",
"data",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsConnection.java#L413-L433
|
7,034 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsConnection.java
|
MwsConnection.callAsync
|
public <T extends MwsObject> Future<T> callAsync(final MwsRequestType type,
final MwsObject requestData) {
return getExecutorService().submit(new Callable<T>() {
@Override
public T call() {
return MwsConnection.this.call(type, requestData);
}
});
}
|
java
|
public <T extends MwsObject> Future<T> callAsync(final MwsRequestType type,
final MwsObject requestData) {
return getExecutorService().submit(new Callable<T>() {
@Override
public T call() {
return MwsConnection.this.call(type, requestData);
}
});
}
|
[
"public",
"<",
"T",
"extends",
"MwsObject",
">",
"Future",
"<",
"T",
">",
"callAsync",
"(",
"final",
"MwsRequestType",
"type",
",",
"final",
"MwsObject",
"requestData",
")",
"{",
"return",
"getExecutorService",
"(",
")",
".",
"submit",
"(",
"new",
"Callable",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"T",
"call",
"(",
")",
"{",
"return",
"MwsConnection",
".",
"this",
".",
"call",
"(",
"type",
",",
"requestData",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Call a request async, return a future on the response data.
@param requestData
@return A future on the response data.
|
[
"Call",
"a",
"request",
"async",
"return",
"a",
"future",
"on",
"the",
"response",
"data",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsConnection.java#L442-L450
|
7,035 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsConnection.java
|
MwsConnection.setEndpoint
|
public synchronized void setEndpoint(URI endpoint) {
checkUpdatable();
int port = endpoint.getPort();
if (port==80||port==443) {
if (MwsUtl.usesStandardPort(endpoint)) {
try {
//some versions of apache http client cause signature errors when
//standard port is explicitly used, so remove that case.
endpoint = new URI(endpoint.getScheme(), endpoint.getHost(),
endpoint.getPath(), endpoint.getFragment());
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
}
this.endpoint = endpoint;
}
|
java
|
public synchronized void setEndpoint(URI endpoint) {
checkUpdatable();
int port = endpoint.getPort();
if (port==80||port==443) {
if (MwsUtl.usesStandardPort(endpoint)) {
try {
//some versions of apache http client cause signature errors when
//standard port is explicitly used, so remove that case.
endpoint = new URI(endpoint.getScheme(), endpoint.getHost(),
endpoint.getPath(), endpoint.getFragment());
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
}
this.endpoint = endpoint;
}
|
[
"public",
"synchronized",
"void",
"setEndpoint",
"(",
"URI",
"endpoint",
")",
"{",
"checkUpdatable",
"(",
")",
";",
"int",
"port",
"=",
"endpoint",
".",
"getPort",
"(",
")",
";",
"if",
"(",
"port",
"==",
"80",
"||",
"port",
"==",
"443",
")",
"{",
"if",
"(",
"MwsUtl",
".",
"usesStandardPort",
"(",
"endpoint",
")",
")",
"{",
"try",
"{",
"//some versions of apache http client cause signature errors when",
"//standard port is explicitly used, so remove that case.",
"endpoint",
"=",
"new",
"URI",
"(",
"endpoint",
".",
"getScheme",
"(",
")",
",",
"endpoint",
".",
"getHost",
"(",
")",
",",
"endpoint",
".",
"getPath",
"(",
")",
",",
"endpoint",
".",
"getFragment",
"(",
")",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"this",
".",
"endpoint",
"=",
"endpoint",
";",
"}"
] |
Sets service endpoint property.
@param endpoint
The service end point URI.
|
[
"Sets",
"service",
"endpoint",
"property",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsConnection.java#L750-L766
|
7,036 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsConnection.java
|
MwsConnection.setUserAgent
|
public synchronized void setUserAgent(String applicationName,
String applicationVersion, String programmingLanguage,
String... additionalNameValuePairs) {
checkUpdatable();
StringBuilder b = new StringBuilder();
b.append(applicationName);
b.append("/");
b.append(applicationVersion);
b.append(" (Language=");
b.append(programmingLanguage);
int i = 0;
while (i < additionalNameValuePairs.length) {
String name = additionalNameValuePairs[i];
String value = additionalNameValuePairs[i + 1];
b.append("; ");
b.append(name);
b.append("=");
b.append(value);
i += 2;
}
b.append(")");
this.userAgent = b.toString();
}
|
java
|
public synchronized void setUserAgent(String applicationName,
String applicationVersion, String programmingLanguage,
String... additionalNameValuePairs) {
checkUpdatable();
StringBuilder b = new StringBuilder();
b.append(applicationName);
b.append("/");
b.append(applicationVersion);
b.append(" (Language=");
b.append(programmingLanguage);
int i = 0;
while (i < additionalNameValuePairs.length) {
String name = additionalNameValuePairs[i];
String value = additionalNameValuePairs[i + 1];
b.append("; ");
b.append(name);
b.append("=");
b.append(value);
i += 2;
}
b.append(")");
this.userAgent = b.toString();
}
|
[
"public",
"synchronized",
"void",
"setUserAgent",
"(",
"String",
"applicationName",
",",
"String",
"applicationVersion",
",",
"String",
"programmingLanguage",
",",
"String",
"...",
"additionalNameValuePairs",
")",
"{",
"checkUpdatable",
"(",
")",
";",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"b",
".",
"append",
"(",
"applicationName",
")",
";",
"b",
".",
"append",
"(",
"\"/\"",
")",
";",
"b",
".",
"append",
"(",
"applicationVersion",
")",
";",
"b",
".",
"append",
"(",
"\" (Language=\"",
")",
";",
"b",
".",
"append",
"(",
"programmingLanguage",
")",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"additionalNameValuePairs",
".",
"length",
")",
"{",
"String",
"name",
"=",
"additionalNameValuePairs",
"[",
"i",
"]",
";",
"String",
"value",
"=",
"additionalNameValuePairs",
"[",
"i",
"+",
"1",
"]",
";",
"b",
".",
"append",
"(",
"\"; \"",
")",
";",
"b",
".",
"append",
"(",
"name",
")",
";",
"b",
".",
"append",
"(",
"\"=\"",
")",
";",
"b",
".",
"append",
"(",
"value",
")",
";",
"i",
"+=",
"2",
";",
"}",
"b",
".",
"append",
"(",
"\")\"",
")",
";",
"this",
".",
"userAgent",
"=",
"b",
".",
"toString",
"(",
")",
";",
"}"
] |
Sets UserAgent property
@param applicationName
@param applicationVersion
@param programmingLanguage
@param additionalNameValuePairs
|
[
"Sets",
"UserAgent",
"property"
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsConnection.java#L943-L965
|
7,037 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/GetOrderRequest.java
|
GetOrderRequest.withAmazonOrderId
|
public GetOrderRequest withAmazonOrderId(String... values) {
List<String> list = getAmazonOrderId();
for (String value : values) {
list.add(value);
}
return this;
}
|
java
|
public GetOrderRequest withAmazonOrderId(String... values) {
List<String> list = getAmazonOrderId();
for (String value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"GetOrderRequest",
"withAmazonOrderId",
"(",
"String",
"...",
"values",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"getAmazonOrderId",
"(",
")",
";",
"for",
"(",
"String",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for AmazonOrderId, return this.
@param amazonOrderId
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"AmazonOrderId",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/GetOrderRequest.java#L134-L140
|
7,038 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/Order.java
|
Order.withPaymentExecutionDetail
|
public Order withPaymentExecutionDetail(PaymentExecutionDetailItem... values) {
List<PaymentExecutionDetailItem> list = getPaymentExecutionDetail();
for (PaymentExecutionDetailItem value : values) {
list.add(value);
}
return this;
}
|
java
|
public Order withPaymentExecutionDetail(PaymentExecutionDetailItem... values) {
List<PaymentExecutionDetailItem> list = getPaymentExecutionDetail();
for (PaymentExecutionDetailItem value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"Order",
"withPaymentExecutionDetail",
"(",
"PaymentExecutionDetailItem",
"...",
"values",
")",
"{",
"List",
"<",
"PaymentExecutionDetailItem",
">",
"list",
"=",
"getPaymentExecutionDetail",
"(",
")",
";",
"for",
"(",
"PaymentExecutionDetailItem",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for PaymentExecutionDetail, return this.
@param paymentExecutionDetail
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"PaymentExecutionDetail",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/Order.java#L703-L709
|
7,039 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/MarketplaceWebServiceOrdersConfig.java
|
MarketplaceWebServiceOrdersConfig.setServiceURL
|
public void setServiceURL(String serviceUrl) {
try {
URI fullURI = URI.create(serviceUrl);
URI partialURI = new URI(fullURI.getScheme(), null, fullURI.getHost(),
fullURI.getPort(), null, null, null);
cc.setEndpoint(partialURI);
String path = fullURI.getPath();
if (path != null) {
path = path.substring(path.startsWith("/") ? 1 : 0);
path = path.substring(0, path.length() - (path.endsWith("/") ? 1 : 0));
}
if (path == null || path.isEmpty()) {
this.servicePath = DEFAULT_SERVICE_PATH;
} else {
this.servicePath = path;
}
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
java
|
public void setServiceURL(String serviceUrl) {
try {
URI fullURI = URI.create(serviceUrl);
URI partialURI = new URI(fullURI.getScheme(), null, fullURI.getHost(),
fullURI.getPort(), null, null, null);
cc.setEndpoint(partialURI);
String path = fullURI.getPath();
if (path != null) {
path = path.substring(path.startsWith("/") ? 1 : 0);
path = path.substring(0, path.length() - (path.endsWith("/") ? 1 : 0));
}
if (path == null || path.isEmpty()) {
this.servicePath = DEFAULT_SERVICE_PATH;
} else {
this.servicePath = path;
}
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
[
"public",
"void",
"setServiceURL",
"(",
"String",
"serviceUrl",
")",
"{",
"try",
"{",
"URI",
"fullURI",
"=",
"URI",
".",
"create",
"(",
"serviceUrl",
")",
";",
"URI",
"partialURI",
"=",
"new",
"URI",
"(",
"fullURI",
".",
"getScheme",
"(",
")",
",",
"null",
",",
"fullURI",
".",
"getHost",
"(",
")",
",",
"fullURI",
".",
"getPort",
"(",
")",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"cc",
".",
"setEndpoint",
"(",
"partialURI",
")",
";",
"String",
"path",
"=",
"fullURI",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"path",
"!=",
"null",
")",
"{",
"path",
"=",
"path",
".",
"substring",
"(",
"path",
".",
"startsWith",
"(",
"\"/\"",
")",
"?",
"1",
":",
"0",
")",
";",
"path",
"=",
"path",
".",
"substring",
"(",
"0",
",",
"path",
".",
"length",
"(",
")",
"-",
"(",
"path",
".",
"endsWith",
"(",
"\"/\"",
")",
"?",
"1",
":",
"0",
")",
")",
";",
"}",
"if",
"(",
"path",
"==",
"null",
"||",
"path",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"servicePath",
"=",
"DEFAULT_SERVICE_PATH",
";",
"}",
"else",
"{",
"this",
".",
"servicePath",
"=",
"path",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"MwsUtl",
".",
"wrap",
"(",
"e",
")",
";",
"}",
"}"
] |
Set the service URL to make requests against.
This can either be just the host name or can include the full path to the service.
@param serviceUrl URL to make requests against
|
[
"Set",
"the",
"service",
"URL",
"to",
"make",
"requests",
"against",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/MarketplaceWebServiceOrdersConfig.java#L265-L284
|
7,040 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsJsonWriter.java
|
MwsJsonWriter.append
|
protected void append(String value) {
try {
writer.write(value);
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
java
|
protected void append(String value) {
try {
writer.write(value);
} catch (Exception e) {
throw MwsUtl.wrap(e);
}
}
|
[
"protected",
"void",
"append",
"(",
"String",
"value",
")",
"{",
"try",
"{",
"writer",
".",
"write",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"MwsUtl",
".",
"wrap",
"(",
"e",
")",
";",
"}",
"}"
] |
Append string to the output.
@param value
|
[
"Append",
"string",
"to",
"the",
"output",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsJsonWriter.java#L66-L72
|
7,041 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/OrderItem.java
|
OrderItem.withPromotionIds
|
public OrderItem withPromotionIds(String... values) {
List<String> list = getPromotionIds();
for (String value : values) {
list.add(value);
}
return this;
}
|
java
|
public OrderItem withPromotionIds(String... values) {
List<String> list = getPromotionIds();
for (String value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"OrderItem",
"withPromotionIds",
"(",
"String",
"...",
"values",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"getPromotionIds",
"(",
")",
";",
"for",
"(",
"String",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for PromotionIds, return this.
@param promotionIds
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"PromotionIds",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/OrderItem.java#L727-L733
|
7,042 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsXmlReader.java
|
MwsXmlReader.getElementText
|
private String getElementText(Element element) {
Node node = element.getFirstChild();
if (node == null || node.getNodeType() != Node.TEXT_NODE) {
return null;
}
return node.getNodeValue().trim();
}
|
java
|
private String getElementText(Element element) {
Node node = element.getFirstChild();
if (node == null || node.getNodeType() != Node.TEXT_NODE) {
return null;
}
return node.getNodeValue().trim();
}
|
[
"private",
"String",
"getElementText",
"(",
"Element",
"element",
")",
"{",
"Node",
"node",
"=",
"element",
".",
"getFirstChild",
"(",
")",
";",
"if",
"(",
"node",
"==",
"null",
"||",
"node",
".",
"getNodeType",
"(",
")",
"!=",
"Node",
".",
"TEXT_NODE",
")",
"{",
"return",
"null",
";",
"}",
"return",
"node",
".",
"getNodeValue",
"(",
")",
".",
"trim",
"(",
")",
";",
"}"
] |
Read begin tag, text, end tag.
@param name
@return The trimmed text content or null.
|
[
"Read",
"begin",
"tag",
"text",
"end",
"tag",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsXmlReader.java#L91-L97
|
7,043 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsXmlReader.java
|
MwsXmlReader.parseElement
|
@SuppressWarnings("unchecked")
private <T> T parseElement(Element element, Class<T> cls) {
T value;
if (element == null) {
value = null;
} else if (MwsObject.class.isAssignableFrom(cls)) {
value = MwsUtl.newInstance(cls);
Element holdElement = currentElement;
Node holdChild = currentChild;
setCurrentElement(element);
((MwsObject) value).readFragmentFrom(this);
currentElement = holdElement;
currentChild = holdChild;
} else if (cls == Object.class) {
value = (T)element;
} else {
String v = getElementText(element);
value = parseString(v, cls);
}
return value;
}
|
java
|
@SuppressWarnings("unchecked")
private <T> T parseElement(Element element, Class<T> cls) {
T value;
if (element == null) {
value = null;
} else if (MwsObject.class.isAssignableFrom(cls)) {
value = MwsUtl.newInstance(cls);
Element holdElement = currentElement;
Node holdChild = currentChild;
setCurrentElement(element);
((MwsObject) value).readFragmentFrom(this);
currentElement = holdElement;
currentChild = holdChild;
} else if (cls == Object.class) {
value = (T)element;
} else {
String v = getElementText(element);
value = parseString(v, cls);
}
return value;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"parseElement",
"(",
"Element",
"element",
",",
"Class",
"<",
"T",
">",
"cls",
")",
"{",
"T",
"value",
";",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"value",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"MwsObject",
".",
"class",
".",
"isAssignableFrom",
"(",
"cls",
")",
")",
"{",
"value",
"=",
"MwsUtl",
".",
"newInstance",
"(",
"cls",
")",
";",
"Element",
"holdElement",
"=",
"currentElement",
";",
"Node",
"holdChild",
"=",
"currentChild",
";",
"setCurrentElement",
"(",
"element",
")",
";",
"(",
"(",
"MwsObject",
")",
"value",
")",
".",
"readFragmentFrom",
"(",
"this",
")",
";",
"currentElement",
"=",
"holdElement",
";",
"currentChild",
"=",
"holdChild",
";",
"}",
"else",
"if",
"(",
"cls",
"==",
"Object",
".",
"class",
")",
"{",
"value",
"=",
"(",
"T",
")",
"element",
";",
"}",
"else",
"{",
"String",
"v",
"=",
"getElementText",
"(",
"element",
")",
";",
"value",
"=",
"parseString",
"(",
"v",
",",
"cls",
")",
";",
"}",
"return",
"value",
";",
"}"
] |
Read an element into a new instance of a class.
@param element
The element, if null returns null.
@param cls
The class to create an instance of.
@return The new instance.
|
[
"Read",
"an",
"element",
"into",
"a",
"new",
"instance",
"of",
"a",
"class",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsXmlReader.java#L110-L130
|
7,044 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/client/MwsXmlReader.java
|
MwsXmlReader.parseString
|
@SuppressWarnings("unchecked")
private <T> T parseString(String v, Class<T> cls) {
Object value;
if (v == null || v.length() == 0) {
value = null;
} else if (cls == String.class) {
value = v;
} else if (cls == Boolean.class || cls == boolean.class) {
if (v.equalsIgnoreCase("true")) {
value = Boolean.TRUE;
} else if (v.equalsIgnoreCase("false")) {
value = Boolean.FALSE;
} else {
throw new IllegalStateException(
"Expected true/false, found text '" + v + "'.");
}
} else if (cls == Integer.class || cls == int.class) {
value = Integer.valueOf(v);
} else if (cls == Long.class || cls == long.class) {
value = Long.valueOf(v);
} else if (cls == Float.class || cls == float.class) {
value = Float.valueOf(v);
} else if (cls == Double.class || cls == double.class) {
value = Double.valueOf(v);
} else if (cls == BigDecimal.class) {
value = new BigDecimal(v);
} else if (XMLGregorianCalendar.class == cls) {
value = MwsUtl.getDTF().newXMLGregorianCalendar(v);
} else if (Enum.class.isAssignableFrom(cls)) {
value = MwsUtl.getEnumValue(cls, v);
} else {
throw new IllegalArgumentException(String.format("Unable to parse String %s to Class %s", v, cls));
}
return (T) value;
}
|
java
|
@SuppressWarnings("unchecked")
private <T> T parseString(String v, Class<T> cls) {
Object value;
if (v == null || v.length() == 0) {
value = null;
} else if (cls == String.class) {
value = v;
} else if (cls == Boolean.class || cls == boolean.class) {
if (v.equalsIgnoreCase("true")) {
value = Boolean.TRUE;
} else if (v.equalsIgnoreCase("false")) {
value = Boolean.FALSE;
} else {
throw new IllegalStateException(
"Expected true/false, found text '" + v + "'.");
}
} else if (cls == Integer.class || cls == int.class) {
value = Integer.valueOf(v);
} else if (cls == Long.class || cls == long.class) {
value = Long.valueOf(v);
} else if (cls == Float.class || cls == float.class) {
value = Float.valueOf(v);
} else if (cls == Double.class || cls == double.class) {
value = Double.valueOf(v);
} else if (cls == BigDecimal.class) {
value = new BigDecimal(v);
} else if (XMLGregorianCalendar.class == cls) {
value = MwsUtl.getDTF().newXMLGregorianCalendar(v);
} else if (Enum.class.isAssignableFrom(cls)) {
value = MwsUtl.getEnumValue(cls, v);
} else {
throw new IllegalArgumentException(String.format("Unable to parse String %s to Class %s", v, cls));
}
return (T) value;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"parseString",
"(",
"String",
"v",
",",
"Class",
"<",
"T",
">",
"cls",
")",
"{",
"Object",
"value",
";",
"if",
"(",
"v",
"==",
"null",
"||",
"v",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"value",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"cls",
"==",
"String",
".",
"class",
")",
"{",
"value",
"=",
"v",
";",
"}",
"else",
"if",
"(",
"cls",
"==",
"Boolean",
".",
"class",
"||",
"cls",
"==",
"boolean",
".",
"class",
")",
"{",
"if",
"(",
"v",
".",
"equalsIgnoreCase",
"(",
"\"true\"",
")",
")",
"{",
"value",
"=",
"Boolean",
".",
"TRUE",
";",
"}",
"else",
"if",
"(",
"v",
".",
"equalsIgnoreCase",
"(",
"\"false\"",
")",
")",
"{",
"value",
"=",
"Boolean",
".",
"FALSE",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Expected true/false, found text '\"",
"+",
"v",
"+",
"\"'.\"",
")",
";",
"}",
"}",
"else",
"if",
"(",
"cls",
"==",
"Integer",
".",
"class",
"||",
"cls",
"==",
"int",
".",
"class",
")",
"{",
"value",
"=",
"Integer",
".",
"valueOf",
"(",
"v",
")",
";",
"}",
"else",
"if",
"(",
"cls",
"==",
"Long",
".",
"class",
"||",
"cls",
"==",
"long",
".",
"class",
")",
"{",
"value",
"=",
"Long",
".",
"valueOf",
"(",
"v",
")",
";",
"}",
"else",
"if",
"(",
"cls",
"==",
"Float",
".",
"class",
"||",
"cls",
"==",
"float",
".",
"class",
")",
"{",
"value",
"=",
"Float",
".",
"valueOf",
"(",
"v",
")",
";",
"}",
"else",
"if",
"(",
"cls",
"==",
"Double",
".",
"class",
"||",
"cls",
"==",
"double",
".",
"class",
")",
"{",
"value",
"=",
"Double",
".",
"valueOf",
"(",
"v",
")",
";",
"}",
"else",
"if",
"(",
"cls",
"==",
"BigDecimal",
".",
"class",
")",
"{",
"value",
"=",
"new",
"BigDecimal",
"(",
"v",
")",
";",
"}",
"else",
"if",
"(",
"XMLGregorianCalendar",
".",
"class",
"==",
"cls",
")",
"{",
"value",
"=",
"MwsUtl",
".",
"getDTF",
"(",
")",
".",
"newXMLGregorianCalendar",
"(",
"v",
")",
";",
"}",
"else",
"if",
"(",
"Enum",
".",
"class",
".",
"isAssignableFrom",
"(",
"cls",
")",
")",
"{",
"value",
"=",
"MwsUtl",
".",
"getEnumValue",
"(",
"cls",
",",
"v",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Unable to parse String %s to Class %s\"",
",",
"v",
",",
"cls",
")",
")",
";",
"}",
"return",
"(",
"T",
")",
"value",
";",
"}"
] |
Parse a string to a value of the given class.
@param v
The string to parse.
@param cls
The class to parse it to.
@return The parsed value may be null.
|
[
"Parse",
"a",
"string",
"to",
"a",
"value",
"of",
"the",
"given",
"class",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsXmlReader.java#L142-L176
|
7,045 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersRequest.java
|
ListOrdersRequest.withOrderStatus
|
public ListOrdersRequest withOrderStatus(String... values) {
List<String> list = getOrderStatus();
for (String value : values) {
list.add(value);
}
return this;
}
|
java
|
public ListOrdersRequest withOrderStatus(String... values) {
List<String> list = getOrderStatus();
for (String value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"ListOrdersRequest",
"withOrderStatus",
"(",
"String",
"...",
"values",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"getOrderStatus",
"(",
")",
";",
"for",
"(",
"String",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for OrderStatus, return this.
@param orderStatus
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"OrderStatus",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersRequest.java#L333-L339
|
7,046 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersRequest.java
|
ListOrdersRequest.withMarketplaceId
|
public ListOrdersRequest withMarketplaceId(String... values) {
List<String> list = getMarketplaceId();
for (String value : values) {
list.add(value);
}
return this;
}
|
java
|
public ListOrdersRequest withMarketplaceId(String... values) {
List<String> list = getMarketplaceId();
for (String value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"ListOrdersRequest",
"withMarketplaceId",
"(",
"String",
"...",
"values",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"getMarketplaceId",
"(",
")",
";",
"for",
"(",
"String",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for MarketplaceId, return this.
@param marketplaceId
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"MarketplaceId",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersRequest.java#L387-L393
|
7,047 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersRequest.java
|
ListOrdersRequest.withFulfillmentChannel
|
public ListOrdersRequest withFulfillmentChannel(String... values) {
List<String> list = getFulfillmentChannel();
for (String value : values) {
list.add(value);
}
return this;
}
|
java
|
public ListOrdersRequest withFulfillmentChannel(String... values) {
List<String> list = getFulfillmentChannel();
for (String value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"ListOrdersRequest",
"withFulfillmentChannel",
"(",
"String",
"...",
"values",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"getFulfillmentChannel",
"(",
")",
";",
"for",
"(",
"String",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for FulfillmentChannel, return this.
@param fulfillmentChannel
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"FulfillmentChannel",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersRequest.java#L441-L447
|
7,048 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersRequest.java
|
ListOrdersRequest.withPaymentMethod
|
public ListOrdersRequest withPaymentMethod(String... values) {
List<String> list = getPaymentMethod();
for (String value : values) {
list.add(value);
}
return this;
}
|
java
|
public ListOrdersRequest withPaymentMethod(String... values) {
List<String> list = getPaymentMethod();
for (String value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"ListOrdersRequest",
"withPaymentMethod",
"(",
"String",
"...",
"values",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"getPaymentMethod",
"(",
")",
";",
"for",
"(",
"String",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for PaymentMethod, return this.
@param paymentMethod
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"PaymentMethod",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersRequest.java#L495-L501
|
7,049 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersRequest.java
|
ListOrdersRequest.withTFMShipmentStatus
|
public ListOrdersRequest withTFMShipmentStatus(String... values) {
List<String> list = getTFMShipmentStatus();
for (String value : values) {
list.add(value);
}
return this;
}
|
java
|
public ListOrdersRequest withTFMShipmentStatus(String... values) {
List<String> list = getTFMShipmentStatus();
for (String value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"ListOrdersRequest",
"withTFMShipmentStatus",
"(",
"String",
"...",
"values",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"getTFMShipmentStatus",
"(",
")",
";",
"for",
"(",
"String",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for TFMShipmentStatus, return this.
@param tfmShipmentStatus
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"TFMShipmentStatus",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersRequest.java#L672-L678
|
7,050 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersResult.java
|
ListOrdersResult.withOrders
|
public ListOrdersResult withOrders(Order... values) {
List<Order> list = getOrders();
for (Order value : values) {
list.add(value);
}
return this;
}
|
java
|
public ListOrdersResult withOrders(Order... values) {
List<Order> list = getOrders();
for (Order value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"ListOrdersResult",
"withOrders",
"(",
"Order",
"...",
"values",
")",
"{",
"List",
"<",
"Order",
">",
"list",
"=",
"getOrders",
"(",
")",
";",
"for",
"(",
"Order",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for Orders, return this.
@param orders
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"Orders",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersResult.java#L224-L230
|
7,051 |
integration-technology/amazon-mws-orders
|
src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrderItemsResult.java
|
ListOrderItemsResult.withOrderItems
|
public ListOrderItemsResult withOrderItems(OrderItem... values) {
List<OrderItem> list = getOrderItems();
for (OrderItem value : values) {
list.add(value);
}
return this;
}
|
java
|
public ListOrderItemsResult withOrderItems(OrderItem... values) {
List<OrderItem> list = getOrderItems();
for (OrderItem value : values) {
list.add(value);
}
return this;
}
|
[
"public",
"ListOrderItemsResult",
"withOrderItems",
"(",
"OrderItem",
"...",
"values",
")",
"{",
"List",
"<",
"OrderItem",
">",
"list",
"=",
"getOrderItems",
"(",
")",
";",
"for",
"(",
"OrderItem",
"value",
":",
"values",
")",
"{",
"list",
".",
"add",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add values for OrderItems, return this.
@param orderItems
New values to add.
@return This instance.
|
[
"Add",
"values",
"for",
"OrderItems",
"return",
"this",
"."
] |
042e8cd5b10588a30150222bf9c91faf4f130b3c
|
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/model/ListOrderItemsResult.java#L178-L184
|
7,052 |
GwtMaterialDesign/gwt-material-themes
|
src/main/java/gwt/material/design/themes/client/ThemeLoader.java
|
ThemeLoader.unload
|
public static void unload() {
if(elements != null) {
for (Element style : elements) {
style.removeFromParent();
}
elements.clear();
}
}
|
java
|
public static void unload() {
if(elements != null) {
for (Element style : elements) {
style.removeFromParent();
}
elements.clear();
}
}
|
[
"public",
"static",
"void",
"unload",
"(",
")",
"{",
"if",
"(",
"elements",
"!=",
"null",
")",
"{",
"for",
"(",
"Element",
"style",
":",
"elements",
")",
"{",
"style",
".",
"removeFromParent",
"(",
")",
";",
"}",
"elements",
".",
"clear",
"(",
")",
";",
"}",
"}"
] |
Unload the current loaded theme.
|
[
"Unload",
"the",
"current",
"loaded",
"theme",
"."
] |
318beb635e69b24bf3840b20f8611cf061576592
|
https://github.com/GwtMaterialDesign/gwt-material-themes/blob/318beb635e69b24bf3840b20f8611cf061576592/src/main/java/gwt/material/design/themes/client/ThemeLoader.java#L97-L104
|
7,053 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/variant/VariantSet.java
|
VariantSet.hasSameDefaultVariant
|
public boolean hasSameDefaultVariant(VariantSet obj) {
return (this.defaultVariant == null && obj.defaultVariant == null)
|| (this.defaultVariant != null && this.defaultVariant.equals(obj.defaultVariant));
}
|
java
|
public boolean hasSameDefaultVariant(VariantSet obj) {
return (this.defaultVariant == null && obj.defaultVariant == null)
|| (this.defaultVariant != null && this.defaultVariant.equals(obj.defaultVariant));
}
|
[
"public",
"boolean",
"hasSameDefaultVariant",
"(",
"VariantSet",
"obj",
")",
"{",
"return",
"(",
"this",
".",
"defaultVariant",
"==",
"null",
"&&",
"obj",
".",
"defaultVariant",
"==",
"null",
")",
"||",
"(",
"this",
".",
"defaultVariant",
"!=",
"null",
"&&",
"this",
".",
"defaultVariant",
".",
"equals",
"(",
"obj",
".",
"defaultVariant",
")",
")",
";",
"}"
] |
Returns true of the variantSet passed in parameter has the same default
value
@param obj
the variantSet to test
@return true of the variantSet passed in parameter has the same default
value
|
[
"Returns",
"true",
"of",
"the",
"variantSet",
"passed",
"in",
"parameter",
"has",
"the",
"same",
"default",
"value"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/variant/VariantSet.java#L136-L140
|
7,054 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
|
AbstractCachedGenerator.getTempFilePath
|
protected String getTempFilePath(GeneratorContext context, CacheMode cacheMode) {
return getTempDirectory() + cacheMode + URL_SEPARATOR + getResourceCacheKey(context.getPath(), context);
}
|
java
|
protected String getTempFilePath(GeneratorContext context, CacheMode cacheMode) {
return getTempDirectory() + cacheMode + URL_SEPARATOR + getResourceCacheKey(context.getPath(), context);
}
|
[
"protected",
"String",
"getTempFilePath",
"(",
"GeneratorContext",
"context",
",",
"CacheMode",
"cacheMode",
")",
"{",
"return",
"getTempDirectory",
"(",
")",
"+",
"cacheMode",
"+",
"URL_SEPARATOR",
"+",
"getResourceCacheKey",
"(",
"context",
".",
"getPath",
"(",
")",
",",
"context",
")",
";",
"}"
] |
Returns the file path of the temporary resource
@param context
the generator context
@param cacheMode
the cache mode
@return the file path of the temporary resource
|
[
"Returns",
"the",
"file",
"path",
"of",
"the",
"temporary",
"resource"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L216-L219
|
7,055 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
|
AbstractCachedGenerator.getResourceCacheKey
|
protected String getResourceCacheKey(String path, GeneratorContext context) {
StringBuilder strbCacheKey = new StringBuilder(path);
if (StringUtils.isNotEmpty(context.getBracketsParam())) {
strbCacheKey.append("_").append(context.getBracketsParam());
}
if (StringUtils.isNotEmpty(context.getParenthesesParam())) {
strbCacheKey.append("_").append(context.getParenthesesParam());
}
String cacheKey = strbCacheKey.toString();
Locale locale = context.getLocale();
if (locale != null) {
cacheKey = LocaleUtils.toBundleName(strbCacheKey.toString(), locale);
}
cacheKey = cacheKey.replaceAll("[^\\w\\.\\-]", "_");
return cacheKey;
}
|
java
|
protected String getResourceCacheKey(String path, GeneratorContext context) {
StringBuilder strbCacheKey = new StringBuilder(path);
if (StringUtils.isNotEmpty(context.getBracketsParam())) {
strbCacheKey.append("_").append(context.getBracketsParam());
}
if (StringUtils.isNotEmpty(context.getParenthesesParam())) {
strbCacheKey.append("_").append(context.getParenthesesParam());
}
String cacheKey = strbCacheKey.toString();
Locale locale = context.getLocale();
if (locale != null) {
cacheKey = LocaleUtils.toBundleName(strbCacheKey.toString(), locale);
}
cacheKey = cacheKey.replaceAll("[^\\w\\.\\-]", "_");
return cacheKey;
}
|
[
"protected",
"String",
"getResourceCacheKey",
"(",
"String",
"path",
",",
"GeneratorContext",
"context",
")",
"{",
"StringBuilder",
"strbCacheKey",
"=",
"new",
"StringBuilder",
"(",
"path",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"context",
".",
"getBracketsParam",
"(",
")",
")",
")",
"{",
"strbCacheKey",
".",
"append",
"(",
"\"_\"",
")",
".",
"append",
"(",
"context",
".",
"getBracketsParam",
"(",
")",
")",
";",
"}",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"context",
".",
"getParenthesesParam",
"(",
")",
")",
")",
"{",
"strbCacheKey",
".",
"append",
"(",
"\"_\"",
")",
".",
"append",
"(",
"context",
".",
"getParenthesesParam",
"(",
")",
")",
";",
"}",
"String",
"cacheKey",
"=",
"strbCacheKey",
".",
"toString",
"(",
")",
";",
"Locale",
"locale",
"=",
"context",
".",
"getLocale",
"(",
")",
";",
"if",
"(",
"locale",
"!=",
"null",
")",
"{",
"cacheKey",
"=",
"LocaleUtils",
".",
"toBundleName",
"(",
"strbCacheKey",
".",
"toString",
"(",
")",
",",
"locale",
")",
";",
"}",
"cacheKey",
"=",
"cacheKey",
".",
"replaceAll",
"(",
"\"[^\\\\w\\\\.\\\\-]\"",
",",
"\"_\"",
")",
";",
"return",
"cacheKey",
";",
"}"
] |
Returns the cache key for linked resources map
@param path
the resource path
@param context
the generator context
@return the cache key for linked resource map
|
[
"Returns",
"the",
"cache",
"key",
"for",
"linked",
"resources",
"map"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L328-L349
|
7,056 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
|
AbstractCachedGenerator.checkResourcesModified
|
protected boolean checkResourcesModified(GeneratorContext context, List<FilePathMapping> fMappings) {
boolean resourceModified = false;
for (Iterator<FilePathMapping> iter = fMappings.iterator(); iter.hasNext() && !resourceModified;) {
FilePathMapping fMapping = iter.next();
resourceModified = fMapping.getLastModified() != rsHandler.getLastModified(fMapping.getPath());
}
return resourceModified;
}
|
java
|
protected boolean checkResourcesModified(GeneratorContext context, List<FilePathMapping> fMappings) {
boolean resourceModified = false;
for (Iterator<FilePathMapping> iter = fMappings.iterator(); iter.hasNext() && !resourceModified;) {
FilePathMapping fMapping = iter.next();
resourceModified = fMapping.getLastModified() != rsHandler.getLastModified(fMapping.getPath());
}
return resourceModified;
}
|
[
"protected",
"boolean",
"checkResourcesModified",
"(",
"GeneratorContext",
"context",
",",
"List",
"<",
"FilePathMapping",
">",
"fMappings",
")",
"{",
"boolean",
"resourceModified",
"=",
"false",
";",
"for",
"(",
"Iterator",
"<",
"FilePathMapping",
">",
"iter",
"=",
"fMappings",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
"&&",
"!",
"resourceModified",
";",
")",
"{",
"FilePathMapping",
"fMapping",
"=",
"iter",
".",
"next",
"(",
")",
";",
"resourceModified",
"=",
"fMapping",
".",
"getLastModified",
"(",
")",
"!=",
"rsHandler",
".",
"getLastModified",
"(",
"fMapping",
".",
"getPath",
"(",
")",
")",
";",
"}",
"return",
"resourceModified",
";",
"}"
] |
Checks if the resources have been modified
@param context
the generator context
@param fMappings
the list of resources to check
@return true if the resources have been modified
|
[
"Checks",
"if",
"the",
"resources",
"have",
"been",
"modified"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L435-L443
|
7,057 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
|
AbstractCachedGenerator.retrieveFromCache
|
protected Reader retrieveFromCache(String path, GeneratorContext context, CacheMode cacheMode) {
Reader rd = null;
String filePath = getTempFilePath(context, cacheMode);
FileInputStream fis = null;
File file = new File(filePath);
if (file.exists()) {
try {
fis = new FileInputStream(file);
} catch (FileNotFoundException e) {
throw new BundlingProcessException("An error occured while creating temporary resource for " + filePath,
e);
}
FileChannel inchannel = fis.getChannel();
rd = Channels.newReader(inchannel, context.getConfig().getResourceCharset().newDecoder(), -1);
context.setRetrievedFromCache(true);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(getName() + " resource '" + path + "' retrieved from cache");
}
}
return rd;
}
|
java
|
protected Reader retrieveFromCache(String path, GeneratorContext context, CacheMode cacheMode) {
Reader rd = null;
String filePath = getTempFilePath(context, cacheMode);
FileInputStream fis = null;
File file = new File(filePath);
if (file.exists()) {
try {
fis = new FileInputStream(file);
} catch (FileNotFoundException e) {
throw new BundlingProcessException("An error occured while creating temporary resource for " + filePath,
e);
}
FileChannel inchannel = fis.getChannel();
rd = Channels.newReader(inchannel, context.getConfig().getResourceCharset().newDecoder(), -1);
context.setRetrievedFromCache(true);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(getName() + " resource '" + path + "' retrieved from cache");
}
}
return rd;
}
|
[
"protected",
"Reader",
"retrieveFromCache",
"(",
"String",
"path",
",",
"GeneratorContext",
"context",
",",
"CacheMode",
"cacheMode",
")",
"{",
"Reader",
"rd",
"=",
"null",
";",
"String",
"filePath",
"=",
"getTempFilePath",
"(",
"context",
",",
"cacheMode",
")",
";",
"FileInputStream",
"fis",
"=",
"null",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"filePath",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"fis",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"throw",
"new",
"BundlingProcessException",
"(",
"\"An error occured while creating temporary resource for \"",
"+",
"filePath",
",",
"e",
")",
";",
"}",
"FileChannel",
"inchannel",
"=",
"fis",
".",
"getChannel",
"(",
")",
";",
"rd",
"=",
"Channels",
".",
"newReader",
"(",
"inchannel",
",",
"context",
".",
"getConfig",
"(",
")",
".",
"getResourceCharset",
"(",
")",
".",
"newDecoder",
"(",
")",
",",
"-",
"1",
")",
";",
"context",
".",
"setRetrievedFromCache",
"(",
"true",
")",
";",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"getName",
"(",
")",
"+",
"\" resource '\"",
"+",
"path",
"+",
"\"' retrieved from cache\"",
")",
";",
"}",
"}",
"return",
"rd",
";",
"}"
] |
Retrieves the resource from cache if it exists
@param path
the resource path
@param context
the generator context
@param cacheMode
the cache mode
@return the reader to the resource
|
[
"Retrieves",
"the",
"resource",
"from",
"cache",
"if",
"it",
"exists"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L456-L478
|
7,058 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
|
AbstractCachedGenerator.createTempResource
|
protected Reader createTempResource(GeneratorContext context, CacheMode cacheMode, Reader rd) {
String filePath = getTempFilePath(context, cacheMode);
Writer wr = null;
FileOutputStream fos = null;
try {
File f = new File(filePath);
if (!f.getParentFile().exists()) {
f.getParentFile().mkdirs();
}
String content = IOUtils.toString(rd);
fos = new FileOutputStream(f);
FileChannel channel = fos.getChannel();
wr = Channels.newWriter(channel, config.getResourceCharset().newEncoder(), -1);
wr.write(content);
rd = new StringReader(content);
} catch (IOException e) {
throw new BundlingProcessException("Unable to create temporary resource for '" + context.getPath() + "'",
e);
} finally {
IOUtils.close(wr);
IOUtils.close(fos);
}
return rd;
}
|
java
|
protected Reader createTempResource(GeneratorContext context, CacheMode cacheMode, Reader rd) {
String filePath = getTempFilePath(context, cacheMode);
Writer wr = null;
FileOutputStream fos = null;
try {
File f = new File(filePath);
if (!f.getParentFile().exists()) {
f.getParentFile().mkdirs();
}
String content = IOUtils.toString(rd);
fos = new FileOutputStream(f);
FileChannel channel = fos.getChannel();
wr = Channels.newWriter(channel, config.getResourceCharset().newEncoder(), -1);
wr.write(content);
rd = new StringReader(content);
} catch (IOException e) {
throw new BundlingProcessException("Unable to create temporary resource for '" + context.getPath() + "'",
e);
} finally {
IOUtils.close(wr);
IOUtils.close(fos);
}
return rd;
}
|
[
"protected",
"Reader",
"createTempResource",
"(",
"GeneratorContext",
"context",
",",
"CacheMode",
"cacheMode",
",",
"Reader",
"rd",
")",
"{",
"String",
"filePath",
"=",
"getTempFilePath",
"(",
"context",
",",
"cacheMode",
")",
";",
"Writer",
"wr",
"=",
"null",
";",
"FileOutputStream",
"fos",
"=",
"null",
";",
"try",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"filePath",
")",
";",
"if",
"(",
"!",
"f",
".",
"getParentFile",
"(",
")",
".",
"exists",
"(",
")",
")",
"{",
"f",
".",
"getParentFile",
"(",
")",
".",
"mkdirs",
"(",
")",
";",
"}",
"String",
"content",
"=",
"IOUtils",
".",
"toString",
"(",
"rd",
")",
";",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"f",
")",
";",
"FileChannel",
"channel",
"=",
"fos",
".",
"getChannel",
"(",
")",
";",
"wr",
"=",
"Channels",
".",
"newWriter",
"(",
"channel",
",",
"config",
".",
"getResourceCharset",
"(",
")",
".",
"newEncoder",
"(",
")",
",",
"-",
"1",
")",
";",
"wr",
".",
"write",
"(",
"content",
")",
";",
"rd",
"=",
"new",
"StringReader",
"(",
"content",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"BundlingProcessException",
"(",
"\"Unable to create temporary resource for '\"",
"+",
"context",
".",
"getPath",
"(",
")",
"+",
"\"'\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"IOUtils",
".",
"close",
"(",
"wr",
")",
";",
"IOUtils",
".",
"close",
"(",
"fos",
")",
";",
"}",
"return",
"rd",
";",
"}"
] |
Creates the temporary resource
@param context
the context
@param cacheMode
the cache mode
@param rd
the reader of the compiled resource
@return the reader
|
[
"Creates",
"the",
"temporary",
"resource"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L491-L516
|
7,059 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
|
AbstractCachedGenerator.resetCache
|
protected void resetCache() {
cacheProperties.clear();
linkedResourceMap.clear();
cacheProperties.put(JawrConfig.JAWR_CHARSET_NAME, config.getResourceCharset().name());
}
|
java
|
protected void resetCache() {
cacheProperties.clear();
linkedResourceMap.clear();
cacheProperties.put(JawrConfig.JAWR_CHARSET_NAME, config.getResourceCharset().name());
}
|
[
"protected",
"void",
"resetCache",
"(",
")",
"{",
"cacheProperties",
".",
"clear",
"(",
")",
";",
"linkedResourceMap",
".",
"clear",
"(",
")",
";",
"cacheProperties",
".",
"put",
"(",
"JawrConfig",
".",
"JAWR_CHARSET_NAME",
",",
"config",
".",
"getResourceCharset",
"(",
")",
".",
"name",
"(",
")",
")",
";",
"}"
] |
Resets the cache
|
[
"Resets",
"the",
"cache"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L521-L525
|
7,060 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
|
AbstractCachedGenerator.isCacheValid
|
protected boolean isCacheValid() {
return StringUtils.equals(cacheProperties.getProperty(JawrConfig.JAWR_CHARSET_NAME),
config.getResourceCharset().name());
}
|
java
|
protected boolean isCacheValid() {
return StringUtils.equals(cacheProperties.getProperty(JawrConfig.JAWR_CHARSET_NAME),
config.getResourceCharset().name());
}
|
[
"protected",
"boolean",
"isCacheValid",
"(",
")",
"{",
"return",
"StringUtils",
".",
"equals",
"(",
"cacheProperties",
".",
"getProperty",
"(",
"JawrConfig",
".",
"JAWR_CHARSET_NAME",
")",
",",
"config",
".",
"getResourceCharset",
"(",
")",
".",
"name",
"(",
")",
")",
";",
"}"
] |
Returns true if the cache is valid
@return true if the cache is valid
|
[
"Returns",
"true",
"if",
"the",
"cache",
"is",
"valid"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L532-L537
|
7,061 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
|
AbstractCachedGenerator.serializeCacheMapping
|
protected synchronized void serializeCacheMapping() {
for (Map.Entry<String, List<FilePathMapping>> entry : linkedResourceMap.entrySet()) {
StringBuilder strb = new StringBuilder();
Iterator<FilePathMapping> iter = entry.getValue().iterator();
if (iter.hasNext()) {
for (; iter.hasNext();) {
FilePathMapping fMapping = iter.next();
strb.append(fMapping.getPath()).append(MAPPING_TIMESTAMP_SEPARATOR)
.append(fMapping.getLastModified());
if (iter.hasNext()) {
strb.append(SEMICOLON);
}
}
cacheProperties.put(JAWR_MAPPING_PREFIX + entry.getKey(), strb.toString());
}
}
File f = new File(getCacheFilePath());
if (!f.getParentFile().exists()) {
f.getParentFile().mkdirs();
}
FileWriter fw = null;
try {
fw = new FileWriter(f);
cacheProperties.store(fw, "Cache properties of " + getName() + " generator");
} catch (IOException e) {
throw new BundlingProcessException("Unable to save cache file mapping ", e);
} finally {
IOUtils.close(fw);
}
}
|
java
|
protected synchronized void serializeCacheMapping() {
for (Map.Entry<String, List<FilePathMapping>> entry : linkedResourceMap.entrySet()) {
StringBuilder strb = new StringBuilder();
Iterator<FilePathMapping> iter = entry.getValue().iterator();
if (iter.hasNext()) {
for (; iter.hasNext();) {
FilePathMapping fMapping = iter.next();
strb.append(fMapping.getPath()).append(MAPPING_TIMESTAMP_SEPARATOR)
.append(fMapping.getLastModified());
if (iter.hasNext()) {
strb.append(SEMICOLON);
}
}
cacheProperties.put(JAWR_MAPPING_PREFIX + entry.getKey(), strb.toString());
}
}
File f = new File(getCacheFilePath());
if (!f.getParentFile().exists()) {
f.getParentFile().mkdirs();
}
FileWriter fw = null;
try {
fw = new FileWriter(f);
cacheProperties.store(fw, "Cache properties of " + getName() + " generator");
} catch (IOException e) {
throw new BundlingProcessException("Unable to save cache file mapping ", e);
} finally {
IOUtils.close(fw);
}
}
|
[
"protected",
"synchronized",
"void",
"serializeCacheMapping",
"(",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"List",
"<",
"FilePathMapping",
">",
">",
"entry",
":",
"linkedResourceMap",
".",
"entrySet",
"(",
")",
")",
"{",
"StringBuilder",
"strb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Iterator",
"<",
"FilePathMapping",
">",
"iter",
"=",
"entry",
".",
"getValue",
"(",
")",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"for",
"(",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"FilePathMapping",
"fMapping",
"=",
"iter",
".",
"next",
"(",
")",
";",
"strb",
".",
"append",
"(",
"fMapping",
".",
"getPath",
"(",
")",
")",
".",
"append",
"(",
"MAPPING_TIMESTAMP_SEPARATOR",
")",
".",
"append",
"(",
"fMapping",
".",
"getLastModified",
"(",
")",
")",
";",
"if",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"strb",
".",
"append",
"(",
"SEMICOLON",
")",
";",
"}",
"}",
"cacheProperties",
".",
"put",
"(",
"JAWR_MAPPING_PREFIX",
"+",
"entry",
".",
"getKey",
"(",
")",
",",
"strb",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"File",
"f",
"=",
"new",
"File",
"(",
"getCacheFilePath",
"(",
")",
")",
";",
"if",
"(",
"!",
"f",
".",
"getParentFile",
"(",
")",
".",
"exists",
"(",
")",
")",
"{",
"f",
".",
"getParentFile",
"(",
")",
".",
"mkdirs",
"(",
")",
";",
"}",
"FileWriter",
"fw",
"=",
"null",
";",
"try",
"{",
"fw",
"=",
"new",
"FileWriter",
"(",
"f",
")",
";",
"cacheProperties",
".",
"store",
"(",
"fw",
",",
"\"Cache properties of \"",
"+",
"getName",
"(",
")",
"+",
"\" generator\"",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"BundlingProcessException",
"(",
"\"Unable to save cache file mapping \"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"IOUtils",
".",
"close",
"(",
"fw",
")",
";",
"}",
"}"
] |
Serialize the cache file mapping
|
[
"Serialize",
"the",
"cache",
"file",
"mapping"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L542-L574
|
7,062 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
|
AbstractCachedGenerator.loadCacheMapping
|
protected void loadCacheMapping() {
File f = new File(getCacheFilePath());
if (f.exists()) {
try(InputStream is = new FileInputStream(f); BufferedReader rd = new BufferedReader(new FileReader(f))) {
cacheProperties.load(is);
for (Enumeration<?> properyNames = cacheProperties.propertyNames(); properyNames.hasMoreElements();) {
String propName = (String) properyNames.nextElement();
if (propName.startsWith(JAWR_MAPPING_PREFIX)) {
String value = cacheProperties.getProperty(propName);
String resourceMapping = propName.substring(JAWR_MAPPING_PREFIX.length());
String[] mappings = value.split(SEMICOLON);
List<FilePathMapping> fMappings = new CopyOnWriteArrayList<>();
// TODO check the use of mappingModified
boolean mappingModified = true;
for (String fmapping : mappings) {
String[] mapping = fmapping.split(MAPPING_TIMESTAMP_SEPARATOR);
long lastModified = Long.parseLong(mapping[1]);
String filePath = mapping[0];
if (rsHandler.getLastModified(filePath) != lastModified) {
mappingModified = false;
break;
}
FilePathMapping fmap = new FilePathMapping(filePath, lastModified);
fMappings.add(fmap);
}
if (mappingModified) {
linkedResourceMap.put(resourceMapping, fMappings);
}
}
}
} catch (IOException e) {
throw new BundlingProcessException("Unable to initialize " + getName() + " Generator cache", e);
}
}
}
|
java
|
protected void loadCacheMapping() {
File f = new File(getCacheFilePath());
if (f.exists()) {
try(InputStream is = new FileInputStream(f); BufferedReader rd = new BufferedReader(new FileReader(f))) {
cacheProperties.load(is);
for (Enumeration<?> properyNames = cacheProperties.propertyNames(); properyNames.hasMoreElements();) {
String propName = (String) properyNames.nextElement();
if (propName.startsWith(JAWR_MAPPING_PREFIX)) {
String value = cacheProperties.getProperty(propName);
String resourceMapping = propName.substring(JAWR_MAPPING_PREFIX.length());
String[] mappings = value.split(SEMICOLON);
List<FilePathMapping> fMappings = new CopyOnWriteArrayList<>();
// TODO check the use of mappingModified
boolean mappingModified = true;
for (String fmapping : mappings) {
String[] mapping = fmapping.split(MAPPING_TIMESTAMP_SEPARATOR);
long lastModified = Long.parseLong(mapping[1]);
String filePath = mapping[0];
if (rsHandler.getLastModified(filePath) != lastModified) {
mappingModified = false;
break;
}
FilePathMapping fmap = new FilePathMapping(filePath, lastModified);
fMappings.add(fmap);
}
if (mappingModified) {
linkedResourceMap.put(resourceMapping, fMappings);
}
}
}
} catch (IOException e) {
throw new BundlingProcessException("Unable to initialize " + getName() + " Generator cache", e);
}
}
}
|
[
"protected",
"void",
"loadCacheMapping",
"(",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"getCacheFilePath",
"(",
")",
")",
";",
"if",
"(",
"f",
".",
"exists",
"(",
")",
")",
"{",
"try",
"(",
"InputStream",
"is",
"=",
"new",
"FileInputStream",
"(",
"f",
")",
";",
"BufferedReader",
"rd",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"f",
")",
")",
")",
"{",
"cacheProperties",
".",
"load",
"(",
"is",
")",
";",
"for",
"(",
"Enumeration",
"<",
"?",
">",
"properyNames",
"=",
"cacheProperties",
".",
"propertyNames",
"(",
")",
";",
"properyNames",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"String",
"propName",
"=",
"(",
"String",
")",
"properyNames",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"propName",
".",
"startsWith",
"(",
"JAWR_MAPPING_PREFIX",
")",
")",
"{",
"String",
"value",
"=",
"cacheProperties",
".",
"getProperty",
"(",
"propName",
")",
";",
"String",
"resourceMapping",
"=",
"propName",
".",
"substring",
"(",
"JAWR_MAPPING_PREFIX",
".",
"length",
"(",
")",
")",
";",
"String",
"[",
"]",
"mappings",
"=",
"value",
".",
"split",
"(",
"SEMICOLON",
")",
";",
"List",
"<",
"FilePathMapping",
">",
"fMappings",
"=",
"new",
"CopyOnWriteArrayList",
"<>",
"(",
")",
";",
"// TODO check the use of mappingModified",
"boolean",
"mappingModified",
"=",
"true",
";",
"for",
"(",
"String",
"fmapping",
":",
"mappings",
")",
"{",
"String",
"[",
"]",
"mapping",
"=",
"fmapping",
".",
"split",
"(",
"MAPPING_TIMESTAMP_SEPARATOR",
")",
";",
"long",
"lastModified",
"=",
"Long",
".",
"parseLong",
"(",
"mapping",
"[",
"1",
"]",
")",
";",
"String",
"filePath",
"=",
"mapping",
"[",
"0",
"]",
";",
"if",
"(",
"rsHandler",
".",
"getLastModified",
"(",
"filePath",
")",
"!=",
"lastModified",
")",
"{",
"mappingModified",
"=",
"false",
";",
"break",
";",
"}",
"FilePathMapping",
"fmap",
"=",
"new",
"FilePathMapping",
"(",
"filePath",
",",
"lastModified",
")",
";",
"fMappings",
".",
"add",
"(",
"fmap",
")",
";",
"}",
"if",
"(",
"mappingModified",
")",
"{",
"linkedResourceMap",
".",
"put",
"(",
"resourceMapping",
",",
"fMappings",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"BundlingProcessException",
"(",
"\"Unable to initialize \"",
"+",
"getName",
"(",
")",
"+",
"\" Generator cache\"",
",",
"e",
")",
";",
"}",
"}",
"}"
] |
Loads the less file mapping
|
[
"Loads",
"the",
"less",
"file",
"mapping"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L597-L636
|
7,063 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/global/processor/AbstractGlobalProcessorChainFactory.java
|
AbstractGlobalProcessorChainFactory.addOrCreateChain
|
private AbstractChainedGlobalProcessor<T> addOrCreateChain(AbstractChainedGlobalProcessor<T> chain, String key) {
AbstractChainedGlobalProcessor<T> toAdd;
if (customPostprocessors.get(key) == null) {
toAdd = buildProcessorByKey(key);
} else {
toAdd = (AbstractChainedGlobalProcessor<T>) customPostprocessors.get(key);
}
if (toAdd instanceof BundlingProcessLifeCycleListener && !listeners.contains(toAdd)) {
listeners.add((BundlingProcessLifeCycleListener) toAdd);
}
AbstractChainedGlobalProcessor<T> newChainResult = null;
if (chain == null) {
newChainResult = toAdd;
} else {
chain.addNextProcessor(toAdd);
newChainResult = chain;
}
return newChainResult;
}
|
java
|
private AbstractChainedGlobalProcessor<T> addOrCreateChain(AbstractChainedGlobalProcessor<T> chain, String key) {
AbstractChainedGlobalProcessor<T> toAdd;
if (customPostprocessors.get(key) == null) {
toAdd = buildProcessorByKey(key);
} else {
toAdd = (AbstractChainedGlobalProcessor<T>) customPostprocessors.get(key);
}
if (toAdd instanceof BundlingProcessLifeCycleListener && !listeners.contains(toAdd)) {
listeners.add((BundlingProcessLifeCycleListener) toAdd);
}
AbstractChainedGlobalProcessor<T> newChainResult = null;
if (chain == null) {
newChainResult = toAdd;
} else {
chain.addNextProcessor(toAdd);
newChainResult = chain;
}
return newChainResult;
}
|
[
"private",
"AbstractChainedGlobalProcessor",
"<",
"T",
">",
"addOrCreateChain",
"(",
"AbstractChainedGlobalProcessor",
"<",
"T",
">",
"chain",
",",
"String",
"key",
")",
"{",
"AbstractChainedGlobalProcessor",
"<",
"T",
">",
"toAdd",
";",
"if",
"(",
"customPostprocessors",
".",
"get",
"(",
"key",
")",
"==",
"null",
")",
"{",
"toAdd",
"=",
"buildProcessorByKey",
"(",
"key",
")",
";",
"}",
"else",
"{",
"toAdd",
"=",
"(",
"AbstractChainedGlobalProcessor",
"<",
"T",
">",
")",
"customPostprocessors",
".",
"get",
"(",
"key",
")",
";",
"}",
"if",
"(",
"toAdd",
"instanceof",
"BundlingProcessLifeCycleListener",
"&&",
"!",
"listeners",
".",
"contains",
"(",
"toAdd",
")",
")",
"{",
"listeners",
".",
"add",
"(",
"(",
"BundlingProcessLifeCycleListener",
")",
"toAdd",
")",
";",
"}",
"AbstractChainedGlobalProcessor",
"<",
"T",
">",
"newChainResult",
"=",
"null",
";",
"if",
"(",
"chain",
"==",
"null",
")",
"{",
"newChainResult",
"=",
"toAdd",
";",
"}",
"else",
"{",
"chain",
".",
"addNextProcessor",
"(",
"toAdd",
")",
";",
"newChainResult",
"=",
"chain",
";",
"}",
"return",
"newChainResult",
";",
"}"
] |
Creates an AbstractChainedGlobalProcessor. If the supplied chain is null,
the new chain is returned. Otherwise it is added to the existing chain.
@param chain
the chained post processor
@param key
the id of the post processor
@return the chained post processor, with the new post processor.
|
[
"Creates",
"an",
"AbstractChainedGlobalProcessor",
".",
"If",
"the",
"supplied",
"chain",
"is",
"null",
"the",
"new",
"chain",
"is",
"returned",
".",
"Otherwise",
"it",
"is",
"added",
"to",
"the",
"existing",
"chain",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/global/processor/AbstractGlobalProcessorChainFactory.java#L109-L132
|
7,064 |
j-a-w-r/jawr-main-repo
|
jawr-wicket/jawr-wicket-extension/src/main/java/net/jawr/web/wicket/JawrWicketApplicationInitializer.java
|
JawrWicketApplicationInitializer.initApplication
|
public static void initApplication(Application app){
// Add the Jawr tag handler to the MarkupParserFactory
MarkupFactory factory = new MarkupFactory(){
public MarkupParser newMarkupParser(final MarkupResourceStream resource)
{
MarkupParser parser = new MarkupParser(new XmlPullParser(), resource);
parser.add(new JawrWicketLinkTagHandler());
return parser;
}
};
app.getMarkupSettings().setMarkupFactory(factory);
// Add the Jawr link resolver
app.getPageSettings().addComponentResolver(new JawrWicketLinkResolver());
}
|
java
|
public static void initApplication(Application app){
// Add the Jawr tag handler to the MarkupParserFactory
MarkupFactory factory = new MarkupFactory(){
public MarkupParser newMarkupParser(final MarkupResourceStream resource)
{
MarkupParser parser = new MarkupParser(new XmlPullParser(), resource);
parser.add(new JawrWicketLinkTagHandler());
return parser;
}
};
app.getMarkupSettings().setMarkupFactory(factory);
// Add the Jawr link resolver
app.getPageSettings().addComponentResolver(new JawrWicketLinkResolver());
}
|
[
"public",
"static",
"void",
"initApplication",
"(",
"Application",
"app",
")",
"{",
"// Add the Jawr tag handler to the MarkupParserFactory ",
"MarkupFactory",
"factory",
"=",
"new",
"MarkupFactory",
"(",
")",
"{",
"public",
"MarkupParser",
"newMarkupParser",
"(",
"final",
"MarkupResourceStream",
"resource",
")",
"{",
"MarkupParser",
"parser",
"=",
"new",
"MarkupParser",
"(",
"new",
"XmlPullParser",
"(",
")",
",",
"resource",
")",
";",
"parser",
".",
"add",
"(",
"new",
"JawrWicketLinkTagHandler",
"(",
")",
")",
";",
"return",
"parser",
";",
"}",
"}",
";",
"app",
".",
"getMarkupSettings",
"(",
")",
".",
"setMarkupFactory",
"(",
"factory",
")",
";",
"// Add the Jawr link resolver",
"app",
".",
"getPageSettings",
"(",
")",
".",
"addComponentResolver",
"(",
"new",
"JawrWicketLinkResolver",
"(",
")",
")",
";",
"}"
] |
Initialize the wicket application
@param app the aplpication to initialize
|
[
"Initialize",
"the",
"wicket",
"application"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr-wicket/jawr-wicket-extension/src/main/java/net/jawr/web/wicket/JawrWicketApplicationInitializer.java#L34-L51
|
7,065 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/validator/CommonsValidatorGenerator.java
|
CommonsValidatorGenerator.buildFormJavascript
|
private StringBuffer buildFormJavascript(
ValidatorResources validatorResources, String formName,
Locale locale, String messageNS, boolean stopOnErrors) {
Form form = validatorResources.getForm(locale, formName);
return createDynamicJavascript(validatorResources, form, messageNS,
stopOnErrors);
}
|
java
|
private StringBuffer buildFormJavascript(
ValidatorResources validatorResources, String formName,
Locale locale, String messageNS, boolean stopOnErrors) {
Form form = validatorResources.getForm(locale, formName);
return createDynamicJavascript(validatorResources, form, messageNS,
stopOnErrors);
}
|
[
"private",
"StringBuffer",
"buildFormJavascript",
"(",
"ValidatorResources",
"validatorResources",
",",
"String",
"formName",
",",
"Locale",
"locale",
",",
"String",
"messageNS",
",",
"boolean",
"stopOnErrors",
")",
"{",
"Form",
"form",
"=",
"validatorResources",
".",
"getForm",
"(",
"locale",
",",
"formName",
")",
";",
"return",
"createDynamicJavascript",
"(",
"validatorResources",
",",
"form",
",",
"messageNS",
",",
"stopOnErrors",
")",
";",
"}"
] |
Creates a validator for a specific form.
@param validatorResources
@param formName
@param locale
@return
|
[
"Creates",
"a",
"validator",
"for",
"a",
"specific",
"form",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/validator/CommonsValidatorGenerator.java#L140-L146
|
7,066 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/validator/CommonsValidatorGenerator.java
|
CommonsValidatorGenerator.getJavascriptBegin
|
protected String getJavascriptBegin(String jsFormName, String methods) {
StringBuffer sb = new StringBuffer();
String name = jsFormName.replace('/', '_'); // remove any '/' characters
name = jsFormName.substring(0, 1).toUpperCase()
+ jsFormName.substring(1, jsFormName.length());
sb.append("\n var bCancel = false; \n\n");
sb.append(" function validate" + name + "(form) { \n");
sb.append(" if (bCancel) { \n");
sb.append(" return true; \n");
sb.append(" } else { \n");
// Always return true if there aren't any Javascript validation methods
if ((methods == null) || (methods.length() == 0)) {
sb.append(" return true; \n");
} else {
sb.append(" var formValidationResult; \n");
sb.append(" formValidationResult = " + methods + "; \n");
if (methods.indexOf("&&") >= 0) {
sb.append(" return (formValidationResult); \n");
} else {
// Making Sure that Bitwise operator works:
sb.append(" return (formValidationResult == 1); \n");
}
}
sb.append(" } \n");
sb.append(" } \n\n");
return sb.toString();
}
|
java
|
protected String getJavascriptBegin(String jsFormName, String methods) {
StringBuffer sb = new StringBuffer();
String name = jsFormName.replace('/', '_'); // remove any '/' characters
name = jsFormName.substring(0, 1).toUpperCase()
+ jsFormName.substring(1, jsFormName.length());
sb.append("\n var bCancel = false; \n\n");
sb.append(" function validate" + name + "(form) { \n");
sb.append(" if (bCancel) { \n");
sb.append(" return true; \n");
sb.append(" } else { \n");
// Always return true if there aren't any Javascript validation methods
if ((methods == null) || (methods.length() == 0)) {
sb.append(" return true; \n");
} else {
sb.append(" var formValidationResult; \n");
sb.append(" formValidationResult = " + methods + "; \n");
if (methods.indexOf("&&") >= 0) {
sb.append(" return (formValidationResult); \n");
} else {
// Making Sure that Bitwise operator works:
sb.append(" return (formValidationResult == 1); \n");
}
}
sb.append(" } \n");
sb.append(" } \n\n");
return sb.toString();
}
|
[
"protected",
"String",
"getJavascriptBegin",
"(",
"String",
"jsFormName",
",",
"String",
"methods",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"name",
"=",
"jsFormName",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"// remove any '/' characters",
"name",
"=",
"jsFormName",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
")",
"+",
"jsFormName",
".",
"substring",
"(",
"1",
",",
"jsFormName",
".",
"length",
"(",
")",
")",
";",
"sb",
".",
"append",
"(",
"\"\\n var bCancel = false; \\n\\n\"",
")",
";",
"sb",
".",
"append",
"(",
"\" function validate\"",
"+",
"name",
"+",
"\"(form) { \\n\"",
")",
";",
"sb",
".",
"append",
"(",
"\" if (bCancel) { \\n\"",
")",
";",
"sb",
".",
"append",
"(",
"\" return true; \\n\"",
")",
";",
"sb",
".",
"append",
"(",
"\" } else { \\n\"",
")",
";",
"// Always return true if there aren't any Javascript validation methods",
"if",
"(",
"(",
"methods",
"==",
"null",
")",
"||",
"(",
"methods",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"sb",
".",
"append",
"(",
"\" return true; \\n\"",
")",
";",
"}",
"else",
"{",
"sb",
".",
"append",
"(",
"\" var formValidationResult; \\n\"",
")",
";",
"sb",
".",
"append",
"(",
"\" formValidationResult = \"",
"+",
"methods",
"+",
"\"; \\n\"",
")",
";",
"if",
"(",
"methods",
".",
"indexOf",
"(",
"\"&&\"",
")",
">=",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"\" return (formValidationResult); \\n\"",
")",
";",
"}",
"else",
"{",
"// Making Sure that Bitwise operator works:",
"sb",
".",
"append",
"(",
"\" return (formValidationResult == 1); \\n\"",
")",
";",
"}",
"}",
"sb",
".",
"append",
"(",
"\" } \\n\"",
")",
";",
"sb",
".",
"append",
"(",
"\" } \\n\\n\"",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns the opening script element and some initial javascript.
|
[
"Returns",
"the",
"opening",
"script",
"element",
"and",
"some",
"initial",
"javascript",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/validator/CommonsValidatorGenerator.java#L282-L312
|
7,067 |
j-a-w-r/jawr-main-repo
|
jawr-dwr3.x/jawr-dwr3.x-webapp-sample/src/main/java/org/getahead/dwrdemo/gidemo/Corporation.java
|
Corporation.change
|
public void change()
{
float newChange = (random.nextFloat() * 4) - 2;
newChange = Math.round(newChange * 100.0F) / 100.0F;
if (last.floatValue() + newChange < 9)
{
newChange = -newChange;
}
change = new BigDecimal(newChange);
change = change.setScale(2, BigDecimal.ROUND_UP);
last = last.add(change);
if (last.compareTo(max) > 0)
{
max = last;
}
if (last.compareTo(min) < 0)
{
min = last;
}
time = new Date();
}
|
java
|
public void change()
{
float newChange = (random.nextFloat() * 4) - 2;
newChange = Math.round(newChange * 100.0F) / 100.0F;
if (last.floatValue() + newChange < 9)
{
newChange = -newChange;
}
change = new BigDecimal(newChange);
change = change.setScale(2, BigDecimal.ROUND_UP);
last = last.add(change);
if (last.compareTo(max) > 0)
{
max = last;
}
if (last.compareTo(min) < 0)
{
min = last;
}
time = new Date();
}
|
[
"public",
"void",
"change",
"(",
")",
"{",
"float",
"newChange",
"=",
"(",
"random",
".",
"nextFloat",
"(",
")",
"*",
"4",
")",
"-",
"2",
";",
"newChange",
"=",
"Math",
".",
"round",
"(",
"newChange",
"*",
"100.0F",
")",
"/",
"100.0F",
";",
"if",
"(",
"last",
".",
"floatValue",
"(",
")",
"+",
"newChange",
"<",
"9",
")",
"{",
"newChange",
"=",
"-",
"newChange",
";",
"}",
"change",
"=",
"new",
"BigDecimal",
"(",
"newChange",
")",
";",
"change",
"=",
"change",
".",
"setScale",
"(",
"2",
",",
"BigDecimal",
".",
"ROUND_UP",
")",
";",
"last",
"=",
"last",
".",
"add",
"(",
"change",
")",
";",
"if",
"(",
"last",
".",
"compareTo",
"(",
"max",
")",
">",
"0",
")",
"{",
"max",
"=",
"last",
";",
"}",
"if",
"(",
"last",
".",
"compareTo",
"(",
"min",
")",
"<",
"0",
")",
"{",
"min",
"=",
"last",
";",
"}",
"time",
"=",
"new",
"Date",
"(",
")",
";",
"}"
] |
Alter the stock price
|
[
"Alter",
"the",
"stock",
"price"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr-dwr3.x/jawr-dwr3.x-webapp-sample/src/main/java/org/getahead/dwrdemo/gidemo/Corporation.java#L125-L151
|
7,068 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java
|
JmxUtils.initJMXBean
|
public static void initJMXBean(JawrApplicationConfigManager appConfigMgr, ServletContext servletContext,
String resourceType, String mBeanPrefix) {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
if (mbs != null) {
ObjectName jawrConfigMgrObjName = JmxUtils.getMBeanObjectName(servletContext, resourceType,
mBeanPrefix);
// register the jawrApplicationConfigManager if it's not already
// done
ObjectName appJawrMgrObjectName = JmxUtils.getAppJawrConfigMBeanObjectName(servletContext, mBeanPrefix);
if (!mbs.isRegistered(appJawrMgrObjectName)) {
mbs.registerMBean(appConfigMgr, appJawrMgrObjectName);
}
if (mbs.isRegistered(jawrConfigMgrObjName)) {
LOGGER.warn("The MBean '" + jawrConfigMgrObjName.getCanonicalName()
+ "' already exists. It will be unregisterd and registered with the new JawrConfigManagerMBean.");
mbs.unregisterMBean(jawrConfigMgrObjName);
}
JawrConfigManagerMBean configMgr = appConfigMgr.getConfigMgr(resourceType);
mbs.registerMBean(configMgr, jawrConfigMgrObjName);
}
} catch (InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException
| InstanceNotFoundException e) {
LOGGER.error("Unable to instanciate the Jawr MBean for resource type '" + resourceType + "'", e);
}
}
|
java
|
public static void initJMXBean(JawrApplicationConfigManager appConfigMgr, ServletContext servletContext,
String resourceType, String mBeanPrefix) {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
if (mbs != null) {
ObjectName jawrConfigMgrObjName = JmxUtils.getMBeanObjectName(servletContext, resourceType,
mBeanPrefix);
// register the jawrApplicationConfigManager if it's not already
// done
ObjectName appJawrMgrObjectName = JmxUtils.getAppJawrConfigMBeanObjectName(servletContext, mBeanPrefix);
if (!mbs.isRegistered(appJawrMgrObjectName)) {
mbs.registerMBean(appConfigMgr, appJawrMgrObjectName);
}
if (mbs.isRegistered(jawrConfigMgrObjName)) {
LOGGER.warn("The MBean '" + jawrConfigMgrObjName.getCanonicalName()
+ "' already exists. It will be unregisterd and registered with the new JawrConfigManagerMBean.");
mbs.unregisterMBean(jawrConfigMgrObjName);
}
JawrConfigManagerMBean configMgr = appConfigMgr.getConfigMgr(resourceType);
mbs.registerMBean(configMgr, jawrConfigMgrObjName);
}
} catch (InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException
| InstanceNotFoundException e) {
LOGGER.error("Unable to instanciate the Jawr MBean for resource type '" + resourceType + "'", e);
}
}
|
[
"public",
"static",
"void",
"initJMXBean",
"(",
"JawrApplicationConfigManager",
"appConfigMgr",
",",
"ServletContext",
"servletContext",
",",
"String",
"resourceType",
",",
"String",
"mBeanPrefix",
")",
"{",
"try",
"{",
"MBeanServer",
"mbs",
"=",
"ManagementFactory",
".",
"getPlatformMBeanServer",
"(",
")",
";",
"if",
"(",
"mbs",
"!=",
"null",
")",
"{",
"ObjectName",
"jawrConfigMgrObjName",
"=",
"JmxUtils",
".",
"getMBeanObjectName",
"(",
"servletContext",
",",
"resourceType",
",",
"mBeanPrefix",
")",
";",
"// register the jawrApplicationConfigManager if it's not already",
"// done",
"ObjectName",
"appJawrMgrObjectName",
"=",
"JmxUtils",
".",
"getAppJawrConfigMBeanObjectName",
"(",
"servletContext",
",",
"mBeanPrefix",
")",
";",
"if",
"(",
"!",
"mbs",
".",
"isRegistered",
"(",
"appJawrMgrObjectName",
")",
")",
"{",
"mbs",
".",
"registerMBean",
"(",
"appConfigMgr",
",",
"appJawrMgrObjectName",
")",
";",
"}",
"if",
"(",
"mbs",
".",
"isRegistered",
"(",
"jawrConfigMgrObjName",
")",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"The MBean '\"",
"+",
"jawrConfigMgrObjName",
".",
"getCanonicalName",
"(",
")",
"+",
"\"' already exists. It will be unregisterd and registered with the new JawrConfigManagerMBean.\"",
")",
";",
"mbs",
".",
"unregisterMBean",
"(",
"jawrConfigMgrObjName",
")",
";",
"}",
"JawrConfigManagerMBean",
"configMgr",
"=",
"appConfigMgr",
".",
"getConfigMgr",
"(",
"resourceType",
")",
";",
"mbs",
".",
"registerMBean",
"(",
"configMgr",
",",
"jawrConfigMgrObjName",
")",
";",
"}",
"}",
"catch",
"(",
"InstanceAlreadyExistsException",
"|",
"MBeanRegistrationException",
"|",
"NotCompliantMBeanException",
"|",
"InstanceNotFoundException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Unable to instanciate the Jawr MBean for resource type '\"",
"+",
"resourceType",
"+",
"\"'\"",
",",
"e",
")",
";",
"}",
"}"
] |
Initialize the JMX Bean
@param appConfigMgr
The application config manager
@param servletContext
the servlet context
@param resourceType
the resource type
@param mBeanPrefix
|
[
"Initialize",
"the",
"JMX",
"Bean"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java#L73-L106
|
7,069 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java
|
JmxUtils.unregisterJMXBean
|
public static void unregisterJMXBean(ServletContext servletContext, String resourceType, String mBeanPrefix) {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
if (mbs != null) {
ObjectName jawrConfigMgrObjName = JmxUtils.getMBeanObjectName(servletContext, resourceType,
mBeanPrefix);
// register the jawrApplicationConfigManager if it's not already
// done
ObjectName appJawrMgrObjectName = JmxUtils.getAppJawrConfigMBeanObjectName(servletContext, mBeanPrefix);
if (mbs.isRegistered(appJawrMgrObjectName)) {
mbs.unregisterMBean(appJawrMgrObjectName);
}
if (mbs.isRegistered(jawrConfigMgrObjName)) {
mbs.unregisterMBean(jawrConfigMgrObjName);
}
}
} catch (InstanceNotFoundException | MBeanRegistrationException e) {
LOGGER.error("Unable to unregister the Jawr MBean for resource type '" + resourceType + "'", e);
}
}
|
java
|
public static void unregisterJMXBean(ServletContext servletContext, String resourceType, String mBeanPrefix) {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
if (mbs != null) {
ObjectName jawrConfigMgrObjName = JmxUtils.getMBeanObjectName(servletContext, resourceType,
mBeanPrefix);
// register the jawrApplicationConfigManager if it's not already
// done
ObjectName appJawrMgrObjectName = JmxUtils.getAppJawrConfigMBeanObjectName(servletContext, mBeanPrefix);
if (mbs.isRegistered(appJawrMgrObjectName)) {
mbs.unregisterMBean(appJawrMgrObjectName);
}
if (mbs.isRegistered(jawrConfigMgrObjName)) {
mbs.unregisterMBean(jawrConfigMgrObjName);
}
}
} catch (InstanceNotFoundException | MBeanRegistrationException e) {
LOGGER.error("Unable to unregister the Jawr MBean for resource type '" + resourceType + "'", e);
}
}
|
[
"public",
"static",
"void",
"unregisterJMXBean",
"(",
"ServletContext",
"servletContext",
",",
"String",
"resourceType",
",",
"String",
"mBeanPrefix",
")",
"{",
"try",
"{",
"MBeanServer",
"mbs",
"=",
"ManagementFactory",
".",
"getPlatformMBeanServer",
"(",
")",
";",
"if",
"(",
"mbs",
"!=",
"null",
")",
"{",
"ObjectName",
"jawrConfigMgrObjName",
"=",
"JmxUtils",
".",
"getMBeanObjectName",
"(",
"servletContext",
",",
"resourceType",
",",
"mBeanPrefix",
")",
";",
"// register the jawrApplicationConfigManager if it's not already",
"// done",
"ObjectName",
"appJawrMgrObjectName",
"=",
"JmxUtils",
".",
"getAppJawrConfigMBeanObjectName",
"(",
"servletContext",
",",
"mBeanPrefix",
")",
";",
"if",
"(",
"mbs",
".",
"isRegistered",
"(",
"appJawrMgrObjectName",
")",
")",
"{",
"mbs",
".",
"unregisterMBean",
"(",
"appJawrMgrObjectName",
")",
";",
"}",
"if",
"(",
"mbs",
".",
"isRegistered",
"(",
"jawrConfigMgrObjName",
")",
")",
"{",
"mbs",
".",
"unregisterMBean",
"(",
"jawrConfigMgrObjName",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"InstanceNotFoundException",
"|",
"MBeanRegistrationException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Unable to unregister the Jawr MBean for resource type '\"",
"+",
"resourceType",
"+",
"\"'\"",
",",
"e",
")",
";",
"}",
"}"
] |
Unregister the JMX Bean
@param servletContext
the servlet context
@param resourceType
the resource type
@param mBeanPrefix
the mBeanPrefix
|
[
"Unregister",
"the",
"JMX",
"Bean"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java#L118-L144
|
7,070 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java
|
JmxUtils.getAppJawrConfigMBeanObjectName
|
public static ObjectName getAppJawrConfigMBeanObjectName(ServletContext servletContext, String mBeanPrefix) {
return getMBeanObjectName(getContextPath(servletContext), JAWR_APP_CONFIG_MANAGER_TYPE, mBeanPrefix, null);
}
|
java
|
public static ObjectName getAppJawrConfigMBeanObjectName(ServletContext servletContext, String mBeanPrefix) {
return getMBeanObjectName(getContextPath(servletContext), JAWR_APP_CONFIG_MANAGER_TYPE, mBeanPrefix, null);
}
|
[
"public",
"static",
"ObjectName",
"getAppJawrConfigMBeanObjectName",
"(",
"ServletContext",
"servletContext",
",",
"String",
"mBeanPrefix",
")",
"{",
"return",
"getMBeanObjectName",
"(",
"getContextPath",
"(",
"servletContext",
")",
",",
"JAWR_APP_CONFIG_MANAGER_TYPE",
",",
"mBeanPrefix",
",",
"null",
")",
";",
"}"
] |
Returns the object name for the Jawr Application configuration Manager
MBean
@param servletContext
the servelt context
@param mBeanPrefix
the MBean prefix
@return the object name for the Jawr configuration Manager MBean
|
[
"Returns",
"the",
"object",
"name",
"for",
"the",
"Jawr",
"Application",
"configuration",
"Manager",
"MBean"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java#L201-L204
|
7,071 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java
|
JmxUtils.getMBeanObjectName
|
private static ObjectName getMBeanObjectName(final String contextPath, final String objectType,
final String mBeanPrefix, final String resourceType) {
String curCtxPath = contextPath;
if (StringUtils.isEmpty(curCtxPath)) {
curCtxPath = ServletContextUtils.getContextPath(null);
}
if (curCtxPath.charAt(0) == ('/')) {
curCtxPath = curCtxPath.substring(1);
}
String prefix = mBeanPrefix;
if (prefix == null) {
prefix = DEFAULT_PREFIX;
}
StringBuilder objectNameStr = new StringBuilder(
"net.jawr.web.jmx:type=" + objectType + ",prefix=" + prefix + ",webappContext=" + curCtxPath);
if (resourceType != null) {
objectNameStr.append(",name=").append(resourceType).append("MBean");
}
return getObjectName(objectNameStr.toString());
}
|
java
|
private static ObjectName getMBeanObjectName(final String contextPath, final String objectType,
final String mBeanPrefix, final String resourceType) {
String curCtxPath = contextPath;
if (StringUtils.isEmpty(curCtxPath)) {
curCtxPath = ServletContextUtils.getContextPath(null);
}
if (curCtxPath.charAt(0) == ('/')) {
curCtxPath = curCtxPath.substring(1);
}
String prefix = mBeanPrefix;
if (prefix == null) {
prefix = DEFAULT_PREFIX;
}
StringBuilder objectNameStr = new StringBuilder(
"net.jawr.web.jmx:type=" + objectType + ",prefix=" + prefix + ",webappContext=" + curCtxPath);
if (resourceType != null) {
objectNameStr.append(",name=").append(resourceType).append("MBean");
}
return getObjectName(objectNameStr.toString());
}
|
[
"private",
"static",
"ObjectName",
"getMBeanObjectName",
"(",
"final",
"String",
"contextPath",
",",
"final",
"String",
"objectType",
",",
"final",
"String",
"mBeanPrefix",
",",
"final",
"String",
"resourceType",
")",
"{",
"String",
"curCtxPath",
"=",
"contextPath",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"curCtxPath",
")",
")",
"{",
"curCtxPath",
"=",
"ServletContextUtils",
".",
"getContextPath",
"(",
"null",
")",
";",
"}",
"if",
"(",
"curCtxPath",
".",
"charAt",
"(",
"0",
")",
"==",
"(",
"'",
"'",
")",
")",
"{",
"curCtxPath",
"=",
"curCtxPath",
".",
"substring",
"(",
"1",
")",
";",
"}",
"String",
"prefix",
"=",
"mBeanPrefix",
";",
"if",
"(",
"prefix",
"==",
"null",
")",
"{",
"prefix",
"=",
"DEFAULT_PREFIX",
";",
"}",
"StringBuilder",
"objectNameStr",
"=",
"new",
"StringBuilder",
"(",
"\"net.jawr.web.jmx:type=\"",
"+",
"objectType",
"+",
"\",prefix=\"",
"+",
"prefix",
"+",
"\",webappContext=\"",
"+",
"curCtxPath",
")",
";",
"if",
"(",
"resourceType",
"!=",
"null",
")",
"{",
"objectNameStr",
".",
"append",
"(",
"\",name=\"",
")",
".",
"append",
"(",
"resourceType",
")",
".",
"append",
"(",
"\"MBean\"",
")",
";",
"}",
"return",
"getObjectName",
"(",
"objectNameStr",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Returns the object name for the Jawr MBean
@param contextPath
the context path
@param objectType
the type of the MBean object
@param mBeanPrefix
the MBean prefix
@param resourceType
the resource type
@return the object name for the Jawr MBean
@throws Exception
if an exception occurs
|
[
"Returns",
"the",
"object",
"name",
"for",
"the",
"Jawr",
"MBean"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java#L221-L244
|
7,072 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java
|
JmxUtils.getObjectName
|
private static ObjectName getObjectName(String name) {
ObjectName mBeanName = null;
try {
mBeanName = new ObjectName(name);
} catch (MalformedObjectNameException | NullPointerException e) {
throw new JmxConfigException(e);
}
return mBeanName;
}
|
java
|
private static ObjectName getObjectName(String name) {
ObjectName mBeanName = null;
try {
mBeanName = new ObjectName(name);
} catch (MalformedObjectNameException | NullPointerException e) {
throw new JmxConfigException(e);
}
return mBeanName;
}
|
[
"private",
"static",
"ObjectName",
"getObjectName",
"(",
"String",
"name",
")",
"{",
"ObjectName",
"mBeanName",
"=",
"null",
";",
"try",
"{",
"mBeanName",
"=",
"new",
"ObjectName",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"MalformedObjectNameException",
"|",
"NullPointerException",
"e",
")",
"{",
"throw",
"new",
"JmxConfigException",
"(",
"e",
")",
";",
"}",
"return",
"mBeanName",
";",
"}"
] |
Create an object name from the name passed in parameter
@param name
the name
@return the objectName
|
[
"Create",
"an",
"object",
"name",
"from",
"the",
"name",
"passed",
"in",
"parameter"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java#L253-L263
|
7,073 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/minification/JSMin.java
|
JSMin.write
|
private void write(int c) throws IOException {
if (!firstCharacterWritten) {
if (c != '\n') {
out.write(c);
firstCharacterWritten = true;
}
} else {
out.write(c);
}
}
|
java
|
private void write(int c) throws IOException {
if (!firstCharacterWritten) {
if (c != '\n') {
out.write(c);
firstCharacterWritten = true;
}
} else {
out.write(c);
}
}
|
[
"private",
"void",
"write",
"(",
"int",
"c",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"firstCharacterWritten",
")",
"{",
"if",
"(",
"c",
"!=",
"'",
"'",
")",
"{",
"out",
".",
"write",
"(",
"c",
")",
";",
"firstCharacterWritten",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"out",
".",
"write",
"(",
"c",
")",
";",
"}",
"}"
] |
Writes the character on the output stream
@param c
the character to write
@throws IOException
if an IOException occurs
|
[
"Writes",
"the",
"character",
"on",
"the",
"output",
"stream"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/minification/JSMin.java#L308-L317
|
7,074 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.buildResourceBundlesHandler
|
public ResourceBundlesHandler buildResourceBundlesHandler()
throws DuplicateBundlePathException, BundleDependencyException {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Building resources handler... ");
}
// Ensure state is correct
if (null == jawrConfig) {
throw new IllegalStateException(
"Must set the JawrConfig for this factory before invoking buildResourceBundlesHandler(). ");
}
if (null == resourceReaderHandler) {
throw new IllegalStateException(
"Must set the resourceHandler for this factory before invoking buildResourceBundlesHandler(). ");
}
if (useSingleResourceFactory && null == singleFileBundleName) {
throw new IllegalStateException(
"Must set the singleFileBundleName when useSingleResourceFactory is set to true. Please check the documentation. ");
}
initCustomPostProcessors();
// List of bundles
List<JoinableResourceBundle> resourceBundles = new ArrayList<>();
if (isProcessingBundleFromCacheMapping()) {
initResourceBundlesFromFullMapping(resourceBundles);
} else {
initResourceBundles(resourceBundles);
}
// Build the postprocessor for bundles
ResourceBundlePostProcessor processor = null;
if (null == this.globalPostProcessorKeys) {
processor = this.chainFactory.buildDefaultProcessorChain();
} else {
processor = this.chainFactory.buildPostProcessorChain(globalPostProcessorKeys);
}
// Build the postprocessor to use on resources before adding them to the
// bundle.
ResourceBundlePostProcessor unitProcessor = null;
if (null == this.unitPostProcessorKeys) {
unitProcessor = this.chainFactory.buildDefaultUnitProcessorChain();
} else {
unitProcessor = this.chainFactory.buildPostProcessorChain(unitPostProcessorKeys);
}
// Build the postprocessor for bundles
ResourceBundlePostProcessor compositeBundleProcessor = null;
if (null == this.globalCompositePostProcessorKeys) {
compositeBundleProcessor = this.chainFactory.buildDefaultCompositeProcessorChain();
} else {
compositeBundleProcessor = this.chainFactory.buildPostProcessorChain(globalCompositePostProcessorKeys);
}
// Build the postprocessor to use on resources before adding them to the
// bundle.
ResourceBundlePostProcessor compositeUnitProcessor = null;
if (null == this.unitCompositePostProcessorKeys) {
compositeUnitProcessor = this.chainFactory.buildDefaultUnitCompositeProcessorChain();
} else {
compositeUnitProcessor = this.chainFactory.buildPostProcessorChain(unitCompositePostProcessorKeys);
}
// Build the resource type global preprocessor to use on resources.
// Initialize custom preprocessors before using the factory to build the
// preprocessing chains
if (null != customGlobalPreprocessors)
resourceTypePreprocessorChainFactory.setCustomGlobalProcessors(customGlobalPreprocessors);
GlobalProcessor<GlobalPreprocessingContext> resourceTypePreprocessor = null;
if (null == this.resourceTypePreprocessorKeys)
resourceTypePreprocessor = this.resourceTypePreprocessorChainFactory.buildDefaultProcessorChain();
else
resourceTypePreprocessor = this.resourceTypePreprocessorChainFactory
.buildProcessorChain(resourceTypePreprocessorKeys);
// Build the resource type global postprocessor to use on resources.
// Initialize custom postprocessors before using the factory to build
// the postprocessing chains
if (null != customGlobalPostprocessors)
resourceTypePostprocessorChainFactory.setCustomGlobalProcessors(customGlobalPostprocessors);
GlobalProcessor<GlobalPostProcessingContext> resourceTypePostprocessor = null;
if (null == this.resourceTypePostprocessorKeys)
resourceTypePostprocessor = this.resourceTypePostprocessorChainFactory.buildDefaultProcessorChain();
else
resourceTypePostprocessor = this.resourceTypePostprocessorChainFactory
.buildProcessorChain(resourceTypePostprocessorKeys);
// Build the handler
ResourceBundlesHandler collector = new ResourceBundlesHandlerImpl(resourceBundles, resourceReaderHandler,
resourceBundleHandler, jawrConfig, processor, unitProcessor, compositeBundleProcessor,
compositeUnitProcessor, resourceTypePreprocessor, resourceTypePostprocessor);
// Initialize life cycle listeners
collector.setBundlingProcessLifeCycleListeners(getBundlingProcessLifeCycleListeners());
// Use the cached proxy if specified when debug mode is off.
if (useCacheManager && !jawrConfig.isDebugModeOn())
collector = new CachedResourceBundlesHandler(collector);
collector.initAllBundles();
return collector;
}
|
java
|
public ResourceBundlesHandler buildResourceBundlesHandler()
throws DuplicateBundlePathException, BundleDependencyException {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Building resources handler... ");
}
// Ensure state is correct
if (null == jawrConfig) {
throw new IllegalStateException(
"Must set the JawrConfig for this factory before invoking buildResourceBundlesHandler(). ");
}
if (null == resourceReaderHandler) {
throw new IllegalStateException(
"Must set the resourceHandler for this factory before invoking buildResourceBundlesHandler(). ");
}
if (useSingleResourceFactory && null == singleFileBundleName) {
throw new IllegalStateException(
"Must set the singleFileBundleName when useSingleResourceFactory is set to true. Please check the documentation. ");
}
initCustomPostProcessors();
// List of bundles
List<JoinableResourceBundle> resourceBundles = new ArrayList<>();
if (isProcessingBundleFromCacheMapping()) {
initResourceBundlesFromFullMapping(resourceBundles);
} else {
initResourceBundles(resourceBundles);
}
// Build the postprocessor for bundles
ResourceBundlePostProcessor processor = null;
if (null == this.globalPostProcessorKeys) {
processor = this.chainFactory.buildDefaultProcessorChain();
} else {
processor = this.chainFactory.buildPostProcessorChain(globalPostProcessorKeys);
}
// Build the postprocessor to use on resources before adding them to the
// bundle.
ResourceBundlePostProcessor unitProcessor = null;
if (null == this.unitPostProcessorKeys) {
unitProcessor = this.chainFactory.buildDefaultUnitProcessorChain();
} else {
unitProcessor = this.chainFactory.buildPostProcessorChain(unitPostProcessorKeys);
}
// Build the postprocessor for bundles
ResourceBundlePostProcessor compositeBundleProcessor = null;
if (null == this.globalCompositePostProcessorKeys) {
compositeBundleProcessor = this.chainFactory.buildDefaultCompositeProcessorChain();
} else {
compositeBundleProcessor = this.chainFactory.buildPostProcessorChain(globalCompositePostProcessorKeys);
}
// Build the postprocessor to use on resources before adding them to the
// bundle.
ResourceBundlePostProcessor compositeUnitProcessor = null;
if (null == this.unitCompositePostProcessorKeys) {
compositeUnitProcessor = this.chainFactory.buildDefaultUnitCompositeProcessorChain();
} else {
compositeUnitProcessor = this.chainFactory.buildPostProcessorChain(unitCompositePostProcessorKeys);
}
// Build the resource type global preprocessor to use on resources.
// Initialize custom preprocessors before using the factory to build the
// preprocessing chains
if (null != customGlobalPreprocessors)
resourceTypePreprocessorChainFactory.setCustomGlobalProcessors(customGlobalPreprocessors);
GlobalProcessor<GlobalPreprocessingContext> resourceTypePreprocessor = null;
if (null == this.resourceTypePreprocessorKeys)
resourceTypePreprocessor = this.resourceTypePreprocessorChainFactory.buildDefaultProcessorChain();
else
resourceTypePreprocessor = this.resourceTypePreprocessorChainFactory
.buildProcessorChain(resourceTypePreprocessorKeys);
// Build the resource type global postprocessor to use on resources.
// Initialize custom postprocessors before using the factory to build
// the postprocessing chains
if (null != customGlobalPostprocessors)
resourceTypePostprocessorChainFactory.setCustomGlobalProcessors(customGlobalPostprocessors);
GlobalProcessor<GlobalPostProcessingContext> resourceTypePostprocessor = null;
if (null == this.resourceTypePostprocessorKeys)
resourceTypePostprocessor = this.resourceTypePostprocessorChainFactory.buildDefaultProcessorChain();
else
resourceTypePostprocessor = this.resourceTypePostprocessorChainFactory
.buildProcessorChain(resourceTypePostprocessorKeys);
// Build the handler
ResourceBundlesHandler collector = new ResourceBundlesHandlerImpl(resourceBundles, resourceReaderHandler,
resourceBundleHandler, jawrConfig, processor, unitProcessor, compositeBundleProcessor,
compositeUnitProcessor, resourceTypePreprocessor, resourceTypePostprocessor);
// Initialize life cycle listeners
collector.setBundlingProcessLifeCycleListeners(getBundlingProcessLifeCycleListeners());
// Use the cached proxy if specified when debug mode is off.
if (useCacheManager && !jawrConfig.isDebugModeOn())
collector = new CachedResourceBundlesHandler(collector);
collector.initAllBundles();
return collector;
}
|
[
"public",
"ResourceBundlesHandler",
"buildResourceBundlesHandler",
"(",
")",
"throws",
"DuplicateBundlePathException",
",",
"BundleDependencyException",
"{",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Building resources handler... \"",
")",
";",
"}",
"// Ensure state is correct",
"if",
"(",
"null",
"==",
"jawrConfig",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Must set the JawrConfig for this factory before invoking buildResourceBundlesHandler(). \"",
")",
";",
"}",
"if",
"(",
"null",
"==",
"resourceReaderHandler",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Must set the resourceHandler for this factory before invoking buildResourceBundlesHandler(). \"",
")",
";",
"}",
"if",
"(",
"useSingleResourceFactory",
"&&",
"null",
"==",
"singleFileBundleName",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Must set the singleFileBundleName when useSingleResourceFactory is set to true. Please check the documentation. \"",
")",
";",
"}",
"initCustomPostProcessors",
"(",
")",
";",
"// List of bundles",
"List",
"<",
"JoinableResourceBundle",
">",
"resourceBundles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"isProcessingBundleFromCacheMapping",
"(",
")",
")",
"{",
"initResourceBundlesFromFullMapping",
"(",
"resourceBundles",
")",
";",
"}",
"else",
"{",
"initResourceBundles",
"(",
"resourceBundles",
")",
";",
"}",
"// Build the postprocessor for bundles",
"ResourceBundlePostProcessor",
"processor",
"=",
"null",
";",
"if",
"(",
"null",
"==",
"this",
".",
"globalPostProcessorKeys",
")",
"{",
"processor",
"=",
"this",
".",
"chainFactory",
".",
"buildDefaultProcessorChain",
"(",
")",
";",
"}",
"else",
"{",
"processor",
"=",
"this",
".",
"chainFactory",
".",
"buildPostProcessorChain",
"(",
"globalPostProcessorKeys",
")",
";",
"}",
"// Build the postprocessor to use on resources before adding them to the",
"// bundle.",
"ResourceBundlePostProcessor",
"unitProcessor",
"=",
"null",
";",
"if",
"(",
"null",
"==",
"this",
".",
"unitPostProcessorKeys",
")",
"{",
"unitProcessor",
"=",
"this",
".",
"chainFactory",
".",
"buildDefaultUnitProcessorChain",
"(",
")",
";",
"}",
"else",
"{",
"unitProcessor",
"=",
"this",
".",
"chainFactory",
".",
"buildPostProcessorChain",
"(",
"unitPostProcessorKeys",
")",
";",
"}",
"// Build the postprocessor for bundles",
"ResourceBundlePostProcessor",
"compositeBundleProcessor",
"=",
"null",
";",
"if",
"(",
"null",
"==",
"this",
".",
"globalCompositePostProcessorKeys",
")",
"{",
"compositeBundleProcessor",
"=",
"this",
".",
"chainFactory",
".",
"buildDefaultCompositeProcessorChain",
"(",
")",
";",
"}",
"else",
"{",
"compositeBundleProcessor",
"=",
"this",
".",
"chainFactory",
".",
"buildPostProcessorChain",
"(",
"globalCompositePostProcessorKeys",
")",
";",
"}",
"// Build the postprocessor to use on resources before adding them to the",
"// bundle.",
"ResourceBundlePostProcessor",
"compositeUnitProcessor",
"=",
"null",
";",
"if",
"(",
"null",
"==",
"this",
".",
"unitCompositePostProcessorKeys",
")",
"{",
"compositeUnitProcessor",
"=",
"this",
".",
"chainFactory",
".",
"buildDefaultUnitCompositeProcessorChain",
"(",
")",
";",
"}",
"else",
"{",
"compositeUnitProcessor",
"=",
"this",
".",
"chainFactory",
".",
"buildPostProcessorChain",
"(",
"unitCompositePostProcessorKeys",
")",
";",
"}",
"// Build the resource type global preprocessor to use on resources.",
"// Initialize custom preprocessors before using the factory to build the",
"// preprocessing chains",
"if",
"(",
"null",
"!=",
"customGlobalPreprocessors",
")",
"resourceTypePreprocessorChainFactory",
".",
"setCustomGlobalProcessors",
"(",
"customGlobalPreprocessors",
")",
";",
"GlobalProcessor",
"<",
"GlobalPreprocessingContext",
">",
"resourceTypePreprocessor",
"=",
"null",
";",
"if",
"(",
"null",
"==",
"this",
".",
"resourceTypePreprocessorKeys",
")",
"resourceTypePreprocessor",
"=",
"this",
".",
"resourceTypePreprocessorChainFactory",
".",
"buildDefaultProcessorChain",
"(",
")",
";",
"else",
"resourceTypePreprocessor",
"=",
"this",
".",
"resourceTypePreprocessorChainFactory",
".",
"buildProcessorChain",
"(",
"resourceTypePreprocessorKeys",
")",
";",
"// Build the resource type global postprocessor to use on resources.",
"// Initialize custom postprocessors before using the factory to build",
"// the postprocessing chains",
"if",
"(",
"null",
"!=",
"customGlobalPostprocessors",
")",
"resourceTypePostprocessorChainFactory",
".",
"setCustomGlobalProcessors",
"(",
"customGlobalPostprocessors",
")",
";",
"GlobalProcessor",
"<",
"GlobalPostProcessingContext",
">",
"resourceTypePostprocessor",
"=",
"null",
";",
"if",
"(",
"null",
"==",
"this",
".",
"resourceTypePostprocessorKeys",
")",
"resourceTypePostprocessor",
"=",
"this",
".",
"resourceTypePostprocessorChainFactory",
".",
"buildDefaultProcessorChain",
"(",
")",
";",
"else",
"resourceTypePostprocessor",
"=",
"this",
".",
"resourceTypePostprocessorChainFactory",
".",
"buildProcessorChain",
"(",
"resourceTypePostprocessorKeys",
")",
";",
"// Build the handler",
"ResourceBundlesHandler",
"collector",
"=",
"new",
"ResourceBundlesHandlerImpl",
"(",
"resourceBundles",
",",
"resourceReaderHandler",
",",
"resourceBundleHandler",
",",
"jawrConfig",
",",
"processor",
",",
"unitProcessor",
",",
"compositeBundleProcessor",
",",
"compositeUnitProcessor",
",",
"resourceTypePreprocessor",
",",
"resourceTypePostprocessor",
")",
";",
"// Initialize life cycle listeners",
"collector",
".",
"setBundlingProcessLifeCycleListeners",
"(",
"getBundlingProcessLifeCycleListeners",
"(",
")",
")",
";",
"// Use the cached proxy if specified when debug mode is off.",
"if",
"(",
"useCacheManager",
"&&",
"!",
"jawrConfig",
".",
"isDebugModeOn",
"(",
")",
")",
"collector",
"=",
"new",
"CachedResourceBundlesHandler",
"(",
"collector",
")",
";",
"collector",
".",
"initAllBundles",
"(",
")",
";",
"return",
"collector",
";",
"}"
] |
Build a ResourceBundlesHandler. Must be invoked after setting at least
the ResourceHandler.
@return the resource bundles handler
@throws DuplicateBundlePathException
if two bundles are defined with the same path
@throws BundleDependencyException
if an error exists in the dependency definition
|
[
"Build",
"a",
"ResourceBundlesHandler",
".",
"Must",
"be",
"invoked",
"after",
"setting",
"at",
"least",
"the",
"ResourceHandler",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L181-L289
|
7,075 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.isProcessingBundleFromCacheMapping
|
protected boolean isProcessingBundleFromCacheMapping() {
boolean processBundleFromCacheMapping = false;
if (jawrConfig.getUseBundleMapping() && resourceBundleHandler.isExistingMappingFile()) {
Properties cachedMappingProperties = resourceBundleHandler.getJawrBundleMapping();
String storedHashcode = cachedMappingProperties.getProperty(JawrConstant.JAWR_CONFIG_HASHCODE);
String currentHashcode = null;
try {
currentHashcode = CheckSumUtils.getMD5Checksum(jawrConfig.getConfigProperties().toString());
} catch (IOException e) {
throw new BundlingProcessException("Unable to calculate checksum for current Jawr config");
}
if (currentHashcode.equals(storedHashcode)) {
processBundleFromCacheMapping = true;
}
}
return processBundleFromCacheMapping;
}
|
java
|
protected boolean isProcessingBundleFromCacheMapping() {
boolean processBundleFromCacheMapping = false;
if (jawrConfig.getUseBundleMapping() && resourceBundleHandler.isExistingMappingFile()) {
Properties cachedMappingProperties = resourceBundleHandler.getJawrBundleMapping();
String storedHashcode = cachedMappingProperties.getProperty(JawrConstant.JAWR_CONFIG_HASHCODE);
String currentHashcode = null;
try {
currentHashcode = CheckSumUtils.getMD5Checksum(jawrConfig.getConfigProperties().toString());
} catch (IOException e) {
throw new BundlingProcessException("Unable to calculate checksum for current Jawr config");
}
if (currentHashcode.equals(storedHashcode)) {
processBundleFromCacheMapping = true;
}
}
return processBundleFromCacheMapping;
}
|
[
"protected",
"boolean",
"isProcessingBundleFromCacheMapping",
"(",
")",
"{",
"boolean",
"processBundleFromCacheMapping",
"=",
"false",
";",
"if",
"(",
"jawrConfig",
".",
"getUseBundleMapping",
"(",
")",
"&&",
"resourceBundleHandler",
".",
"isExistingMappingFile",
"(",
")",
")",
"{",
"Properties",
"cachedMappingProperties",
"=",
"resourceBundleHandler",
".",
"getJawrBundleMapping",
"(",
")",
";",
"String",
"storedHashcode",
"=",
"cachedMappingProperties",
".",
"getProperty",
"(",
"JawrConstant",
".",
"JAWR_CONFIG_HASHCODE",
")",
";",
"String",
"currentHashcode",
"=",
"null",
";",
"try",
"{",
"currentHashcode",
"=",
"CheckSumUtils",
".",
"getMD5Checksum",
"(",
"jawrConfig",
".",
"getConfigProperties",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"BundlingProcessException",
"(",
"\"Unable to calculate checksum for current Jawr config\"",
")",
";",
"}",
"if",
"(",
"currentHashcode",
".",
"equals",
"(",
"storedHashcode",
")",
")",
"{",
"processBundleFromCacheMapping",
"=",
"true",
";",
"}",
"}",
"return",
"processBundleFromCacheMapping",
";",
"}"
] |
Returns true if the bundle should be processed using cache mapping
information
@return true if the bundle should be processed using cache mapping
information
|
[
"Returns",
"true",
"if",
"the",
"bundle",
"should",
"be",
"processed",
"using",
"cache",
"mapping",
"information"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L298-L314
|
7,076 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.getBundlingProcessLifeCycleListeners
|
protected List<BundlingProcessLifeCycleListener> getBundlingProcessLifeCycleListeners() {
List<BundlingProcessLifeCycleListener> lifeCycleListeners = new ArrayList<>();
List<BundlingProcessLifeCycleListener> generatorLifeCycleListeners = jawrConfig.getGeneratorRegistry()
.getBundlingProcessLifeCycleListeners();
lifeCycleListeners.addAll(generatorLifeCycleListeners);
lifeCycleListeners.addAll(this.resourceTypePreprocessorChainFactory.getBundlingProcessLifeCycleListeners());
lifeCycleListeners.addAll(this.chainFactory.getBundlingProcessLifeCycleListeners());
lifeCycleListeners.addAll(this.resourceTypePostprocessorChainFactory.getBundlingProcessLifeCycleListeners());
return lifeCycleListeners;
}
|
java
|
protected List<BundlingProcessLifeCycleListener> getBundlingProcessLifeCycleListeners() {
List<BundlingProcessLifeCycleListener> lifeCycleListeners = new ArrayList<>();
List<BundlingProcessLifeCycleListener> generatorLifeCycleListeners = jawrConfig.getGeneratorRegistry()
.getBundlingProcessLifeCycleListeners();
lifeCycleListeners.addAll(generatorLifeCycleListeners);
lifeCycleListeners.addAll(this.resourceTypePreprocessorChainFactory.getBundlingProcessLifeCycleListeners());
lifeCycleListeners.addAll(this.chainFactory.getBundlingProcessLifeCycleListeners());
lifeCycleListeners.addAll(this.resourceTypePostprocessorChainFactory.getBundlingProcessLifeCycleListeners());
return lifeCycleListeners;
}
|
[
"protected",
"List",
"<",
"BundlingProcessLifeCycleListener",
">",
"getBundlingProcessLifeCycleListeners",
"(",
")",
"{",
"List",
"<",
"BundlingProcessLifeCycleListener",
">",
"lifeCycleListeners",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"BundlingProcessLifeCycleListener",
">",
"generatorLifeCycleListeners",
"=",
"jawrConfig",
".",
"getGeneratorRegistry",
"(",
")",
".",
"getBundlingProcessLifeCycleListeners",
"(",
")",
";",
"lifeCycleListeners",
".",
"addAll",
"(",
"generatorLifeCycleListeners",
")",
";",
"lifeCycleListeners",
".",
"addAll",
"(",
"this",
".",
"resourceTypePreprocessorChainFactory",
".",
"getBundlingProcessLifeCycleListeners",
"(",
")",
")",
";",
"lifeCycleListeners",
".",
"addAll",
"(",
"this",
".",
"chainFactory",
".",
"getBundlingProcessLifeCycleListeners",
"(",
")",
")",
";",
"lifeCycleListeners",
".",
"addAll",
"(",
"this",
".",
"resourceTypePostprocessorChainFactory",
".",
"getBundlingProcessLifeCycleListeners",
"(",
")",
")",
";",
"return",
"lifeCycleListeners",
";",
"}"
] |
Returns the life cycle listeners
@return the life cycle listeners
|
[
"Returns",
"the",
"life",
"cycle",
"listeners"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L321-L330
|
7,077 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.initResourceBundlesFromFullMapping
|
private void initResourceBundlesFromFullMapping(List<JoinableResourceBundle> resourceBundles) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Building bundles from the full bundle mapping. Only modified bundles will be processed.");
}
Properties mappingProperties = resourceBundleHandler.getJawrBundleMapping();
FullMappingPropertiesBasedBundlesHandlerFactory factory = new FullMappingPropertiesBasedBundlesHandlerFactory(
resourceType, resourceReaderHandler, jawrConfig.getGeneratorRegistry(), chainFactory);
resourceBundles.addAll(factory.getResourceBundles(mappingProperties));
}
|
java
|
private void initResourceBundlesFromFullMapping(List<JoinableResourceBundle> resourceBundles) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Building bundles from the full bundle mapping. Only modified bundles will be processed.");
}
Properties mappingProperties = resourceBundleHandler.getJawrBundleMapping();
FullMappingPropertiesBasedBundlesHandlerFactory factory = new FullMappingPropertiesBasedBundlesHandlerFactory(
resourceType, resourceReaderHandler, jawrConfig.getGeneratorRegistry(), chainFactory);
resourceBundles.addAll(factory.getResourceBundles(mappingProperties));
}
|
[
"private",
"void",
"initResourceBundlesFromFullMapping",
"(",
"List",
"<",
"JoinableResourceBundle",
">",
"resourceBundles",
")",
"{",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Building bundles from the full bundle mapping. Only modified bundles will be processed.\"",
")",
";",
"}",
"Properties",
"mappingProperties",
"=",
"resourceBundleHandler",
".",
"getJawrBundleMapping",
"(",
")",
";",
"FullMappingPropertiesBasedBundlesHandlerFactory",
"factory",
"=",
"new",
"FullMappingPropertiesBasedBundlesHandlerFactory",
"(",
"resourceType",
",",
"resourceReaderHandler",
",",
"jawrConfig",
".",
"getGeneratorRegistry",
"(",
")",
",",
"chainFactory",
")",
";",
"resourceBundles",
".",
"addAll",
"(",
"factory",
".",
"getResourceBundles",
"(",
"mappingProperties",
")",
")",
";",
"}"
] |
Initialize the resource bundles from the mapping file
|
[
"Initialize",
"the",
"resource",
"bundles",
"from",
"the",
"mapping",
"file"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L346-L356
|
7,078 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.initResourceBundles
|
private void initResourceBundles(List<JoinableResourceBundle> resourceBundles)
throws DuplicateBundlePathException, BundleDependencyException {
// Create custom defined bundles
bundleDefinitionsWithDependencies = new HashSet<>();
if (null != bundleDefinitions) {
if (LOGGER.isInfoEnabled())
LOGGER.info("Adding custom bundle definitions. ");
for (ResourceBundleDefinition def : bundleDefinitions) {
// If this is a composite bundle
if (def.isComposite()) {
resourceBundles.add(buildCompositeResourcebundle(def));
} else
resourceBundles.add(buildResourcebundle(def));
}
}
// Normalize the base Dir if needed
if (!jawrConfig.getGeneratorRegistry().isPathGenerated(baseDir)) {
this.baseDir = PathNormalizer.asDirPath(baseDir);
}
// Use the dirmapper if specified
if (useDirMapperFactory) {
if (LOGGER.isInfoEnabled())
LOGGER.info("Using ResourceBundleDirMapper. ");
ResourceBundleDirMapper dirFactory = new ResourceBundleDirMapper(baseDir, resourceReaderHandler,
resourceBundles, fileExtension, excludedDirMapperDirs);
Map<String, String> mappings = dirFactory.getBundleMapping();
for (Entry<String, String> entry : mappings.entrySet()) {
resourceBundles.add(buildDirMappedResourceBundle(entry.getKey(), entry.getValue()));
}
}
if (this.scanForOrphans) {
// Add all orphan bundles
OrphanResourceBundlesMapper orphanFactory = new OrphanResourceBundlesMapper(baseDir, resourceReaderHandler,
jawrConfig.getGeneratorRegistry(), resourceBundles, fileExtension);
List<String> orphans = orphanFactory.getOrphansList();
// Orphans may be added separately or as one single resource bundle.
if (useSingleResourceFactory) {
// Add extension to the filename
if (!singleFileBundleName.endsWith(fileExtension))
singleFileBundleName += fileExtension;
if (LOGGER.isInfoEnabled())
LOGGER.info("Building bundle of orphan resources with the name: " + singleFileBundleName);
resourceBundles.add(buildOrphansResourceBundle(singleFileBundleName, orphans));
} else {
if (LOGGER.isInfoEnabled())
LOGGER.info("Creating mappings for orphan resources. ");
for (Iterator<String> it = orphans.iterator(); it.hasNext();) {
resourceBundles.add(buildOrphanResourceBundle(it.next()));
}
}
} else if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Skipping orphan file auto processing. ");
if ("".equals(jawrConfig.getServletMapping()))
LOGGER.debug("Note that there is no specified mapping for Jawr "
+ "(it has been seet to serve *.js or *.css requests). "
+ "The orphan files will become unreachable through the server.");
}
// Initialize bundle dependencies
for (ResourceBundleDefinition definition : bundleDefinitionsWithDependencies) {
JoinableResourceBundle bundle = getBundleFromName(definition.getBundleName(), resourceBundles);
if (bundle != null) {
bundle.setDependencies(getBundleDependencies(definition, resourceBundles));
}
}
}
|
java
|
private void initResourceBundles(List<JoinableResourceBundle> resourceBundles)
throws DuplicateBundlePathException, BundleDependencyException {
// Create custom defined bundles
bundleDefinitionsWithDependencies = new HashSet<>();
if (null != bundleDefinitions) {
if (LOGGER.isInfoEnabled())
LOGGER.info("Adding custom bundle definitions. ");
for (ResourceBundleDefinition def : bundleDefinitions) {
// If this is a composite bundle
if (def.isComposite()) {
resourceBundles.add(buildCompositeResourcebundle(def));
} else
resourceBundles.add(buildResourcebundle(def));
}
}
// Normalize the base Dir if needed
if (!jawrConfig.getGeneratorRegistry().isPathGenerated(baseDir)) {
this.baseDir = PathNormalizer.asDirPath(baseDir);
}
// Use the dirmapper if specified
if (useDirMapperFactory) {
if (LOGGER.isInfoEnabled())
LOGGER.info("Using ResourceBundleDirMapper. ");
ResourceBundleDirMapper dirFactory = new ResourceBundleDirMapper(baseDir, resourceReaderHandler,
resourceBundles, fileExtension, excludedDirMapperDirs);
Map<String, String> mappings = dirFactory.getBundleMapping();
for (Entry<String, String> entry : mappings.entrySet()) {
resourceBundles.add(buildDirMappedResourceBundle(entry.getKey(), entry.getValue()));
}
}
if (this.scanForOrphans) {
// Add all orphan bundles
OrphanResourceBundlesMapper orphanFactory = new OrphanResourceBundlesMapper(baseDir, resourceReaderHandler,
jawrConfig.getGeneratorRegistry(), resourceBundles, fileExtension);
List<String> orphans = orphanFactory.getOrphansList();
// Orphans may be added separately or as one single resource bundle.
if (useSingleResourceFactory) {
// Add extension to the filename
if (!singleFileBundleName.endsWith(fileExtension))
singleFileBundleName += fileExtension;
if (LOGGER.isInfoEnabled())
LOGGER.info("Building bundle of orphan resources with the name: " + singleFileBundleName);
resourceBundles.add(buildOrphansResourceBundle(singleFileBundleName, orphans));
} else {
if (LOGGER.isInfoEnabled())
LOGGER.info("Creating mappings for orphan resources. ");
for (Iterator<String> it = orphans.iterator(); it.hasNext();) {
resourceBundles.add(buildOrphanResourceBundle(it.next()));
}
}
} else if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Skipping orphan file auto processing. ");
if ("".equals(jawrConfig.getServletMapping()))
LOGGER.debug("Note that there is no specified mapping for Jawr "
+ "(it has been seet to serve *.js or *.css requests). "
+ "The orphan files will become unreachable through the server.");
}
// Initialize bundle dependencies
for (ResourceBundleDefinition definition : bundleDefinitionsWithDependencies) {
JoinableResourceBundle bundle = getBundleFromName(definition.getBundleName(), resourceBundles);
if (bundle != null) {
bundle.setDependencies(getBundleDependencies(definition, resourceBundles));
}
}
}
|
[
"private",
"void",
"initResourceBundles",
"(",
"List",
"<",
"JoinableResourceBundle",
">",
"resourceBundles",
")",
"throws",
"DuplicateBundlePathException",
",",
"BundleDependencyException",
"{",
"// Create custom defined bundles",
"bundleDefinitionsWithDependencies",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"bundleDefinitions",
")",
"{",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
"(",
")",
")",
"LOGGER",
".",
"info",
"(",
"\"Adding custom bundle definitions. \"",
")",
";",
"for",
"(",
"ResourceBundleDefinition",
"def",
":",
"bundleDefinitions",
")",
"{",
"// If this is a composite bundle",
"if",
"(",
"def",
".",
"isComposite",
"(",
")",
")",
"{",
"resourceBundles",
".",
"add",
"(",
"buildCompositeResourcebundle",
"(",
"def",
")",
")",
";",
"}",
"else",
"resourceBundles",
".",
"add",
"(",
"buildResourcebundle",
"(",
"def",
")",
")",
";",
"}",
"}",
"// Normalize the base Dir if needed",
"if",
"(",
"!",
"jawrConfig",
".",
"getGeneratorRegistry",
"(",
")",
".",
"isPathGenerated",
"(",
"baseDir",
")",
")",
"{",
"this",
".",
"baseDir",
"=",
"PathNormalizer",
".",
"asDirPath",
"(",
"baseDir",
")",
";",
"}",
"// Use the dirmapper if specified",
"if",
"(",
"useDirMapperFactory",
")",
"{",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
"(",
")",
")",
"LOGGER",
".",
"info",
"(",
"\"Using ResourceBundleDirMapper. \"",
")",
";",
"ResourceBundleDirMapper",
"dirFactory",
"=",
"new",
"ResourceBundleDirMapper",
"(",
"baseDir",
",",
"resourceReaderHandler",
",",
"resourceBundles",
",",
"fileExtension",
",",
"excludedDirMapperDirs",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"mappings",
"=",
"dirFactory",
".",
"getBundleMapping",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"mappings",
".",
"entrySet",
"(",
")",
")",
"{",
"resourceBundles",
".",
"add",
"(",
"buildDirMappedResourceBundle",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
"}",
"if",
"(",
"this",
".",
"scanForOrphans",
")",
"{",
"// Add all orphan bundles",
"OrphanResourceBundlesMapper",
"orphanFactory",
"=",
"new",
"OrphanResourceBundlesMapper",
"(",
"baseDir",
",",
"resourceReaderHandler",
",",
"jawrConfig",
".",
"getGeneratorRegistry",
"(",
")",
",",
"resourceBundles",
",",
"fileExtension",
")",
";",
"List",
"<",
"String",
">",
"orphans",
"=",
"orphanFactory",
".",
"getOrphansList",
"(",
")",
";",
"// Orphans may be added separately or as one single resource bundle.",
"if",
"(",
"useSingleResourceFactory",
")",
"{",
"// Add extension to the filename",
"if",
"(",
"!",
"singleFileBundleName",
".",
"endsWith",
"(",
"fileExtension",
")",
")",
"singleFileBundleName",
"+=",
"fileExtension",
";",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
"(",
")",
")",
"LOGGER",
".",
"info",
"(",
"\"Building bundle of orphan resources with the name: \"",
"+",
"singleFileBundleName",
")",
";",
"resourceBundles",
".",
"add",
"(",
"buildOrphansResourceBundle",
"(",
"singleFileBundleName",
",",
"orphans",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
"(",
")",
")",
"LOGGER",
".",
"info",
"(",
"\"Creating mappings for orphan resources. \"",
")",
";",
"for",
"(",
"Iterator",
"<",
"String",
">",
"it",
"=",
"orphans",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"resourceBundles",
".",
"add",
"(",
"buildOrphanResourceBundle",
"(",
"it",
".",
"next",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Skipping orphan file auto processing. \"",
")",
";",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"jawrConfig",
".",
"getServletMapping",
"(",
")",
")",
")",
"LOGGER",
".",
"debug",
"(",
"\"Note that there is no specified mapping for Jawr \"",
"+",
"\"(it has been seet to serve *.js or *.css requests). \"",
"+",
"\"The orphan files will become unreachable through the server.\"",
")",
";",
"}",
"// Initialize bundle dependencies",
"for",
"(",
"ResourceBundleDefinition",
"definition",
":",
"bundleDefinitionsWithDependencies",
")",
"{",
"JoinableResourceBundle",
"bundle",
"=",
"getBundleFromName",
"(",
"definition",
".",
"getBundleName",
"(",
")",
",",
"resourceBundles",
")",
";",
"if",
"(",
"bundle",
"!=",
"null",
")",
"{",
"bundle",
".",
"setDependencies",
"(",
"getBundleDependencies",
"(",
"definition",
",",
"resourceBundles",
")",
")",
";",
"}",
"}",
"}"
] |
Initialize the resource bundles
@param resourceBundles
the resource bundles
@throws DuplicateBundlePathException
if two bundles are defined with the same path
@throws BundleDependencyException
if an error exists in the dependency definition
|
[
"Initialize",
"the",
"resource",
"bundles"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L368-L442
|
7,079 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.getBundleFromName
|
private JoinableResourceBundle getBundleFromName(String name, List<JoinableResourceBundle> bundles) {
JoinableResourceBundle bundle = null;
for (JoinableResourceBundle aBundle : bundles) {
if (aBundle.getName().equals(name)) {
bundle = aBundle;
break;
}
}
return bundle;
}
|
java
|
private JoinableResourceBundle getBundleFromName(String name, List<JoinableResourceBundle> bundles) {
JoinableResourceBundle bundle = null;
for (JoinableResourceBundle aBundle : bundles) {
if (aBundle.getName().equals(name)) {
bundle = aBundle;
break;
}
}
return bundle;
}
|
[
"private",
"JoinableResourceBundle",
"getBundleFromName",
"(",
"String",
"name",
",",
"List",
"<",
"JoinableResourceBundle",
">",
"bundles",
")",
"{",
"JoinableResourceBundle",
"bundle",
"=",
"null",
";",
"for",
"(",
"JoinableResourceBundle",
"aBundle",
":",
"bundles",
")",
"{",
"if",
"(",
"aBundle",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"bundle",
"=",
"aBundle",
";",
"break",
";",
"}",
"}",
"return",
"bundle",
";",
"}"
] |
Returns a bundle from its name
@param name
the bundle name
@param bundles
the list of bundle
@return a bundle from its name
|
[
"Returns",
"a",
"bundle",
"from",
"its",
"name"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L453-L464
|
7,080 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.buildResourcebundle
|
private JoinableResourceBundle buildResourcebundle(ResourceBundleDefinition definition)
throws BundleDependencyException {
if (LOGGER.isDebugEnabled())
LOGGER.debug("Init bundle with id:" + definition.getBundleId());
validateBundleId(definition);
DebugInclusion inclusion = DebugInclusion.ALWAYS;
if (definition.isDebugOnly()) {
inclusion = DebugInclusion.ONLY;
}
if (definition.isDebugNever()) {
inclusion = DebugInclusion.NEVER;
}
InclusionPattern include = new InclusionPattern(definition.isGlobal(), definition.getInclusionOrder(),
inclusion);
JoinableResourceBundleImpl newBundle = new JoinableResourceBundleImpl(definition.getBundleId(),
definition.getBundleName(), definition.getBundlePrefix(), fileExtension, include,
definition.getMappings(), resourceReaderHandler, jawrConfig.getGeneratorRegistry());
if (null != definition.getBundlePostProcessorKeys())
newBundle.setBundlePostProcessor(
chainFactory.buildPostProcessorChain(definition.getBundlePostProcessorKeys()));
if (null != definition.getUnitaryPostProcessorKeys())
newBundle.setUnitaryPostProcessor(
chainFactory.buildPostProcessorChain(definition.getUnitaryPostProcessorKeys()));
if (null != definition.getIeConditionalExpression())
newBundle.setExplorerConditionalExpression(definition.getIeConditionalExpression());
// if (null != definition.getVariants())
// newBundle.setVariants(definition.getVariants());
if (null != definition.getAlternateProductionURL())
newBundle.setAlternateProductionURL(definition.getAlternateProductionURL());
if (null != definition.getDebugURL())
newBundle.setDebugURL(definition.getDebugURL());
if (null != definition.getDependencies() && !definition.getDependencies().isEmpty()) {
bundleDefinitionsWithDependencies.add(definition);
}
return newBundle;
}
|
java
|
private JoinableResourceBundle buildResourcebundle(ResourceBundleDefinition definition)
throws BundleDependencyException {
if (LOGGER.isDebugEnabled())
LOGGER.debug("Init bundle with id:" + definition.getBundleId());
validateBundleId(definition);
DebugInclusion inclusion = DebugInclusion.ALWAYS;
if (definition.isDebugOnly()) {
inclusion = DebugInclusion.ONLY;
}
if (definition.isDebugNever()) {
inclusion = DebugInclusion.NEVER;
}
InclusionPattern include = new InclusionPattern(definition.isGlobal(), definition.getInclusionOrder(),
inclusion);
JoinableResourceBundleImpl newBundle = new JoinableResourceBundleImpl(definition.getBundleId(),
definition.getBundleName(), definition.getBundlePrefix(), fileExtension, include,
definition.getMappings(), resourceReaderHandler, jawrConfig.getGeneratorRegistry());
if (null != definition.getBundlePostProcessorKeys())
newBundle.setBundlePostProcessor(
chainFactory.buildPostProcessorChain(definition.getBundlePostProcessorKeys()));
if (null != definition.getUnitaryPostProcessorKeys())
newBundle.setUnitaryPostProcessor(
chainFactory.buildPostProcessorChain(definition.getUnitaryPostProcessorKeys()));
if (null != definition.getIeConditionalExpression())
newBundle.setExplorerConditionalExpression(definition.getIeConditionalExpression());
// if (null != definition.getVariants())
// newBundle.setVariants(definition.getVariants());
if (null != definition.getAlternateProductionURL())
newBundle.setAlternateProductionURL(definition.getAlternateProductionURL());
if (null != definition.getDebugURL())
newBundle.setDebugURL(definition.getDebugURL());
if (null != definition.getDependencies() && !definition.getDependencies().isEmpty()) {
bundleDefinitionsWithDependencies.add(definition);
}
return newBundle;
}
|
[
"private",
"JoinableResourceBundle",
"buildResourcebundle",
"(",
"ResourceBundleDefinition",
"definition",
")",
"throws",
"BundleDependencyException",
"{",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"LOGGER",
".",
"debug",
"(",
"\"Init bundle with id:\"",
"+",
"definition",
".",
"getBundleId",
"(",
")",
")",
";",
"validateBundleId",
"(",
"definition",
")",
";",
"DebugInclusion",
"inclusion",
"=",
"DebugInclusion",
".",
"ALWAYS",
";",
"if",
"(",
"definition",
".",
"isDebugOnly",
"(",
")",
")",
"{",
"inclusion",
"=",
"DebugInclusion",
".",
"ONLY",
";",
"}",
"if",
"(",
"definition",
".",
"isDebugNever",
"(",
")",
")",
"{",
"inclusion",
"=",
"DebugInclusion",
".",
"NEVER",
";",
"}",
"InclusionPattern",
"include",
"=",
"new",
"InclusionPattern",
"(",
"definition",
".",
"isGlobal",
"(",
")",
",",
"definition",
".",
"getInclusionOrder",
"(",
")",
",",
"inclusion",
")",
";",
"JoinableResourceBundleImpl",
"newBundle",
"=",
"new",
"JoinableResourceBundleImpl",
"(",
"definition",
".",
"getBundleId",
"(",
")",
",",
"definition",
".",
"getBundleName",
"(",
")",
",",
"definition",
".",
"getBundlePrefix",
"(",
")",
",",
"fileExtension",
",",
"include",
",",
"definition",
".",
"getMappings",
"(",
")",
",",
"resourceReaderHandler",
",",
"jawrConfig",
".",
"getGeneratorRegistry",
"(",
")",
")",
";",
"if",
"(",
"null",
"!=",
"definition",
".",
"getBundlePostProcessorKeys",
"(",
")",
")",
"newBundle",
".",
"setBundlePostProcessor",
"(",
"chainFactory",
".",
"buildPostProcessorChain",
"(",
"definition",
".",
"getBundlePostProcessorKeys",
"(",
")",
")",
")",
";",
"if",
"(",
"null",
"!=",
"definition",
".",
"getUnitaryPostProcessorKeys",
"(",
")",
")",
"newBundle",
".",
"setUnitaryPostProcessor",
"(",
"chainFactory",
".",
"buildPostProcessorChain",
"(",
"definition",
".",
"getUnitaryPostProcessorKeys",
"(",
")",
")",
")",
";",
"if",
"(",
"null",
"!=",
"definition",
".",
"getIeConditionalExpression",
"(",
")",
")",
"newBundle",
".",
"setExplorerConditionalExpression",
"(",
"definition",
".",
"getIeConditionalExpression",
"(",
")",
")",
";",
"// if (null != definition.getVariants())",
"// newBundle.setVariants(definition.getVariants());",
"if",
"(",
"null",
"!=",
"definition",
".",
"getAlternateProductionURL",
"(",
")",
")",
"newBundle",
".",
"setAlternateProductionURL",
"(",
"definition",
".",
"getAlternateProductionURL",
"(",
")",
")",
";",
"if",
"(",
"null",
"!=",
"definition",
".",
"getDebugURL",
"(",
")",
")",
"newBundle",
".",
"setDebugURL",
"(",
"definition",
".",
"getDebugURL",
"(",
")",
")",
";",
"if",
"(",
"null",
"!=",
"definition",
".",
"getDependencies",
"(",
")",
"&&",
"!",
"definition",
".",
"getDependencies",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"bundleDefinitionsWithDependencies",
".",
"add",
"(",
"definition",
")",
";",
"}",
"return",
"newBundle",
";",
"}"
] |
Build a JoinableResourceBundle using a ResourceBundleDefinition
@param definition
the resource bundle definition
@return a JoinableResourceBundle
@throws BundleDependencyException
if an error exists in the dependency definition
|
[
"Build",
"a",
"JoinableResourceBundle",
"using",
"a",
"ResourceBundleDefinition"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L548-L594
|
7,081 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.validateBundleId
|
private void validateBundleId(ResourceBundleDefinition definition) {
String bundleId = definition.getBundleId();
if (bundleId != null) {
if (!bundleId.endsWith(fileExtension)) {
throw new BundlingProcessException("The extension of the bundle " + definition.getBundleName() + " - "
+ bundleId + " doesn't match the allowed extension : '" + fileExtension
+ "'. Please update your bundle definition.");
} else if (bundleId.startsWith(JawrConstant.WEB_INF_DIR_PREFIX)
|| bundleId.startsWith(JawrConstant.META_INF_DIR_PREFIX)) {
throw new BundlingProcessException("For the bundle " + definition.getBundleName() + ", the bundle id '"
+ bundleId
+ "' is not allowed because it starts with \"/WEB-INF/\". Please update your bundle definition.");
}
}
}
|
java
|
private void validateBundleId(ResourceBundleDefinition definition) {
String bundleId = definition.getBundleId();
if (bundleId != null) {
if (!bundleId.endsWith(fileExtension)) {
throw new BundlingProcessException("The extension of the bundle " + definition.getBundleName() + " - "
+ bundleId + " doesn't match the allowed extension : '" + fileExtension
+ "'. Please update your bundle definition.");
} else if (bundleId.startsWith(JawrConstant.WEB_INF_DIR_PREFIX)
|| bundleId.startsWith(JawrConstant.META_INF_DIR_PREFIX)) {
throw new BundlingProcessException("For the bundle " + definition.getBundleName() + ", the bundle id '"
+ bundleId
+ "' is not allowed because it starts with \"/WEB-INF/\". Please update your bundle definition.");
}
}
}
|
[
"private",
"void",
"validateBundleId",
"(",
"ResourceBundleDefinition",
"definition",
")",
"{",
"String",
"bundleId",
"=",
"definition",
".",
"getBundleId",
"(",
")",
";",
"if",
"(",
"bundleId",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"bundleId",
".",
"endsWith",
"(",
"fileExtension",
")",
")",
"{",
"throw",
"new",
"BundlingProcessException",
"(",
"\"The extension of the bundle \"",
"+",
"definition",
".",
"getBundleName",
"(",
")",
"+",
"\" - \"",
"+",
"bundleId",
"+",
"\" doesn't match the allowed extension : '\"",
"+",
"fileExtension",
"+",
"\"'. Please update your bundle definition.\"",
")",
";",
"}",
"else",
"if",
"(",
"bundleId",
".",
"startsWith",
"(",
"JawrConstant",
".",
"WEB_INF_DIR_PREFIX",
")",
"||",
"bundleId",
".",
"startsWith",
"(",
"JawrConstant",
".",
"META_INF_DIR_PREFIX",
")",
")",
"{",
"throw",
"new",
"BundlingProcessException",
"(",
"\"For the bundle \"",
"+",
"definition",
".",
"getBundleName",
"(",
")",
"+",
"\", the bundle id '\"",
"+",
"bundleId",
"+",
"\"' is not allowed because it starts with \\\"/WEB-INF/\\\". Please update your bundle definition.\"",
")",
";",
"}",
"}",
"}"
] |
Validates the bundle ID
@param definition
the bundle ID
@throws a
BundlingProcessException if the bundle ID is not valid
|
[
"Validates",
"the",
"bundle",
"ID"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L604-L618
|
7,082 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.getBundleDependencies
|
private List<JoinableResourceBundle> getBundleDependencies(ResourceBundleDefinition definition,
List<JoinableResourceBundle> bundles) throws BundleDependencyException {
List<JoinableResourceBundle> dependencies = new ArrayList<>();
List<String> processedBundles = new ArrayList<>();
if (definition.isGlobal() && definition.getDependencies() != null && !definition.getDependencies().isEmpty()) {
throw new BundleDependencyException(definition.getBundleName(),
"The dependencies property is not allowed for global bundles. Please use the order property "
+ "to define the import order.");
}
initBundleDependencies(definition.getBundleName(), definition, dependencies, processedBundles, bundles);
return dependencies;
}
|
java
|
private List<JoinableResourceBundle> getBundleDependencies(ResourceBundleDefinition definition,
List<JoinableResourceBundle> bundles) throws BundleDependencyException {
List<JoinableResourceBundle> dependencies = new ArrayList<>();
List<String> processedBundles = new ArrayList<>();
if (definition.isGlobal() && definition.getDependencies() != null && !definition.getDependencies().isEmpty()) {
throw new BundleDependencyException(definition.getBundleName(),
"The dependencies property is not allowed for global bundles. Please use the order property "
+ "to define the import order.");
}
initBundleDependencies(definition.getBundleName(), definition, dependencies, processedBundles, bundles);
return dependencies;
}
|
[
"private",
"List",
"<",
"JoinableResourceBundle",
">",
"getBundleDependencies",
"(",
"ResourceBundleDefinition",
"definition",
",",
"List",
"<",
"JoinableResourceBundle",
">",
"bundles",
")",
"throws",
"BundleDependencyException",
"{",
"List",
"<",
"JoinableResourceBundle",
">",
"dependencies",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"String",
">",
"processedBundles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"definition",
".",
"isGlobal",
"(",
")",
"&&",
"definition",
".",
"getDependencies",
"(",
")",
"!=",
"null",
"&&",
"!",
"definition",
".",
"getDependencies",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"BundleDependencyException",
"(",
"definition",
".",
"getBundleName",
"(",
")",
",",
"\"The dependencies property is not allowed for global bundles. Please use the order property \"",
"+",
"\"to define the import order.\"",
")",
";",
"}",
"initBundleDependencies",
"(",
"definition",
".",
"getBundleName",
"(",
")",
",",
"definition",
",",
"dependencies",
",",
"processedBundles",
",",
"bundles",
")",
";",
"return",
"dependencies",
";",
"}"
] |
Returns the bundle dependencies from the resource bundle definition
@param definition
the resource definition
@param bundles
the list of bundles
@throws BundleDependencyException
if an error exists in the dependency definition
|
[
"Returns",
"the",
"bundle",
"dependencies",
"from",
"the",
"resource",
"bundle",
"definition"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L631-L643
|
7,083 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.initBundleDependencies
|
private void initBundleDependencies(String rootBundleDefinition, ResourceBundleDefinition definition,
List<JoinableResourceBundle> bundleDependencies, List<String> processedBundles,
List<JoinableResourceBundle> bundles) throws BundleDependencyException {
List<String> bundleDefDependencies = definition.getDependencies();
if (definition.isGlobal()) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("The global bundle '" + definition.getBundleName() + "' belongs to the dependencies of '"
+ rootBundleDefinition + "'."
+ "As it's a global bundle, it will not be defined as part of the dependencies.");
}
return;
}
if (bundleDefDependencies != null && !bundleDefDependencies.isEmpty()) {
if (processedBundles.contains(definition.getBundleName())) {
throw new BundleDependencyException(rootBundleDefinition,
"There is a circular dependency. The bundle in conflict is '" + definition.getBundleName()
+ "'");
} else {
processedBundles.add(definition.getBundleName());
for (String dependency : bundleDefDependencies) {
for (ResourceBundleDefinition dependencyBundle : bundleDefinitions) {
String dependencyBundleName = dependencyBundle.getBundleName();
if (dependencyBundleName.equals(dependency)) {
if (!bundleListContains(bundleDependencies, dependencyBundleName)) {
if (!processedBundles.contains(dependencyBundleName)) {
initBundleDependencies(rootBundleDefinition, dependencyBundle, bundleDependencies,
processedBundles, bundles);
bundleDependencies.add(getBundleFromName(dependencyBundleName, bundles));
} else {
throw new BundleDependencyException(rootBundleDefinition,
"There is a circular dependency. The bundle in conflict is '"
+ dependencyBundleName + "'");
}
} else {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("The bundle '" + dependencyBundle.getBundleId()
+ "' occurs multiple time in the dependencies hierarchy of the bundle '"
+ rootBundleDefinition + "'.");
}
}
}
}
}
}
}
}
|
java
|
private void initBundleDependencies(String rootBundleDefinition, ResourceBundleDefinition definition,
List<JoinableResourceBundle> bundleDependencies, List<String> processedBundles,
List<JoinableResourceBundle> bundles) throws BundleDependencyException {
List<String> bundleDefDependencies = definition.getDependencies();
if (definition.isGlobal()) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("The global bundle '" + definition.getBundleName() + "' belongs to the dependencies of '"
+ rootBundleDefinition + "'."
+ "As it's a global bundle, it will not be defined as part of the dependencies.");
}
return;
}
if (bundleDefDependencies != null && !bundleDefDependencies.isEmpty()) {
if (processedBundles.contains(definition.getBundleName())) {
throw new BundleDependencyException(rootBundleDefinition,
"There is a circular dependency. The bundle in conflict is '" + definition.getBundleName()
+ "'");
} else {
processedBundles.add(definition.getBundleName());
for (String dependency : bundleDefDependencies) {
for (ResourceBundleDefinition dependencyBundle : bundleDefinitions) {
String dependencyBundleName = dependencyBundle.getBundleName();
if (dependencyBundleName.equals(dependency)) {
if (!bundleListContains(bundleDependencies, dependencyBundleName)) {
if (!processedBundles.contains(dependencyBundleName)) {
initBundleDependencies(rootBundleDefinition, dependencyBundle, bundleDependencies,
processedBundles, bundles);
bundleDependencies.add(getBundleFromName(dependencyBundleName, bundles));
} else {
throw new BundleDependencyException(rootBundleDefinition,
"There is a circular dependency. The bundle in conflict is '"
+ dependencyBundleName + "'");
}
} else {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("The bundle '" + dependencyBundle.getBundleId()
+ "' occurs multiple time in the dependencies hierarchy of the bundle '"
+ rootBundleDefinition + "'.");
}
}
}
}
}
}
}
}
|
[
"private",
"void",
"initBundleDependencies",
"(",
"String",
"rootBundleDefinition",
",",
"ResourceBundleDefinition",
"definition",
",",
"List",
"<",
"JoinableResourceBundle",
">",
"bundleDependencies",
",",
"List",
"<",
"String",
">",
"processedBundles",
",",
"List",
"<",
"JoinableResourceBundle",
">",
"bundles",
")",
"throws",
"BundleDependencyException",
"{",
"List",
"<",
"String",
">",
"bundleDefDependencies",
"=",
"definition",
".",
"getDependencies",
"(",
")",
";",
"if",
"(",
"definition",
".",
"isGlobal",
"(",
")",
")",
"{",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"The global bundle '\"",
"+",
"definition",
".",
"getBundleName",
"(",
")",
"+",
"\"' belongs to the dependencies of '\"",
"+",
"rootBundleDefinition",
"+",
"\"'.\"",
"+",
"\"As it's a global bundle, it will not be defined as part of the dependencies.\"",
")",
";",
"}",
"return",
";",
"}",
"if",
"(",
"bundleDefDependencies",
"!=",
"null",
"&&",
"!",
"bundleDefDependencies",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"processedBundles",
".",
"contains",
"(",
"definition",
".",
"getBundleName",
"(",
")",
")",
")",
"{",
"throw",
"new",
"BundleDependencyException",
"(",
"rootBundleDefinition",
",",
"\"There is a circular dependency. The bundle in conflict is '\"",
"+",
"definition",
".",
"getBundleName",
"(",
")",
"+",
"\"'\"",
")",
";",
"}",
"else",
"{",
"processedBundles",
".",
"add",
"(",
"definition",
".",
"getBundleName",
"(",
")",
")",
";",
"for",
"(",
"String",
"dependency",
":",
"bundleDefDependencies",
")",
"{",
"for",
"(",
"ResourceBundleDefinition",
"dependencyBundle",
":",
"bundleDefinitions",
")",
"{",
"String",
"dependencyBundleName",
"=",
"dependencyBundle",
".",
"getBundleName",
"(",
")",
";",
"if",
"(",
"dependencyBundleName",
".",
"equals",
"(",
"dependency",
")",
")",
"{",
"if",
"(",
"!",
"bundleListContains",
"(",
"bundleDependencies",
",",
"dependencyBundleName",
")",
")",
"{",
"if",
"(",
"!",
"processedBundles",
".",
"contains",
"(",
"dependencyBundleName",
")",
")",
"{",
"initBundleDependencies",
"(",
"rootBundleDefinition",
",",
"dependencyBundle",
",",
"bundleDependencies",
",",
"processedBundles",
",",
"bundles",
")",
";",
"bundleDependencies",
".",
"add",
"(",
"getBundleFromName",
"(",
"dependencyBundleName",
",",
"bundles",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"BundleDependencyException",
"(",
"rootBundleDefinition",
",",
"\"There is a circular dependency. The bundle in conflict is '\"",
"+",
"dependencyBundleName",
"+",
"\"'\"",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"The bundle '\"",
"+",
"dependencyBundle",
".",
"getBundleId",
"(",
")",
"+",
"\"' occurs multiple time in the dependencies hierarchy of the bundle '\"",
"+",
"rootBundleDefinition",
"+",
"\"'.\"",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}"
] |
Initialize the bundle dependencies
@param rootBundleDefinition
the name of the bundle, whose is initalized
@param definition
the current resource bundle definition
@param bundleDependencies
the bundle dependencies
@param processedBundles
the list of bundles already processed during the dependency
resolution
@param bundles
the list of reference bundles
@throws BundleDependencyException
if an error exists in the dependency definition
|
[
"Initialize",
"the",
"bundle",
"dependencies"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L663-L714
|
7,084 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.bundleListContains
|
private boolean bundleListContains(List<JoinableResourceBundle> bundles, String bundleName) {
boolean contains = false;
for (JoinableResourceBundle bundle : bundles) {
if (bundle.getName().equals(bundleName)) {
contains = true;
break;
}
}
return contains;
}
|
java
|
private boolean bundleListContains(List<JoinableResourceBundle> bundles, String bundleName) {
boolean contains = false;
for (JoinableResourceBundle bundle : bundles) {
if (bundle.getName().equals(bundleName)) {
contains = true;
break;
}
}
return contains;
}
|
[
"private",
"boolean",
"bundleListContains",
"(",
"List",
"<",
"JoinableResourceBundle",
">",
"bundles",
",",
"String",
"bundleName",
")",
"{",
"boolean",
"contains",
"=",
"false",
";",
"for",
"(",
"JoinableResourceBundle",
"bundle",
":",
"bundles",
")",
"{",
"if",
"(",
"bundle",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"bundleName",
")",
")",
"{",
"contains",
"=",
"true",
";",
"break",
";",
"}",
"}",
"return",
"contains",
";",
"}"
] |
Checks if the bundle name exists in the bundle list
@param bundles
the bundle list
@param bundleName
the bundle name
@return true if the bundle name exists in the bundle list
|
[
"Checks",
"if",
"the",
"bundle",
"name",
"exists",
"in",
"the",
"bundle",
"list"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L725-L734
|
7,085 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.buildDirMappedResourceBundle
|
private JoinableResourceBundle buildDirMappedResourceBundle(String bundleId, String pathMapping) {
List<String> path = Collections.singletonList(pathMapping);
JoinableResourceBundle newBundle = new JoinableResourceBundleImpl(bundleId,
generateBundleNameFromBundleId(bundleId), null, fileExtension, new InclusionPattern(), path,
resourceReaderHandler, jawrConfig.getGeneratorRegistry());
return newBundle;
}
|
java
|
private JoinableResourceBundle buildDirMappedResourceBundle(String bundleId, String pathMapping) {
List<String> path = Collections.singletonList(pathMapping);
JoinableResourceBundle newBundle = new JoinableResourceBundleImpl(bundleId,
generateBundleNameFromBundleId(bundleId), null, fileExtension, new InclusionPattern(), path,
resourceReaderHandler, jawrConfig.getGeneratorRegistry());
return newBundle;
}
|
[
"private",
"JoinableResourceBundle",
"buildDirMappedResourceBundle",
"(",
"String",
"bundleId",
",",
"String",
"pathMapping",
")",
"{",
"List",
"<",
"String",
">",
"path",
"=",
"Collections",
".",
"singletonList",
"(",
"pathMapping",
")",
";",
"JoinableResourceBundle",
"newBundle",
"=",
"new",
"JoinableResourceBundleImpl",
"(",
"bundleId",
",",
"generateBundleNameFromBundleId",
"(",
"bundleId",
")",
",",
"null",
",",
"fileExtension",
",",
"new",
"InclusionPattern",
"(",
")",
",",
"path",
",",
"resourceReaderHandler",
",",
"jawrConfig",
".",
"getGeneratorRegistry",
"(",
")",
")",
";",
"return",
"newBundle",
";",
"}"
] |
Build a bundle based on a mapping returned by the
ResourceBundleDirMapperFactory.
@param bundleId
the bundle Id
@param pathMapping
the path mapping
@return a bundle based on a mapping returned by the
ResourceBundleDirMapperFactory
|
[
"Build",
"a",
"bundle",
"based",
"on",
"a",
"mapping",
"returned",
"by",
"the",
"ResourceBundleDirMapperFactory",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L747-L753
|
7,086 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.generateBundleNameFromBundleId
|
private String generateBundleNameFromBundleId(String bundleId) {
String bundleName = bundleId;
if (bundleName.startsWith("/")) {
bundleName = bundleName.substring(1);
}
int idxExtension = FileNameUtils.indexOfExtension(bundleName);
if (idxExtension != -1) {
bundleName = bundleName.substring(0, idxExtension);
}
return bundleName.replaceAll("(/|\\.|:)", "_");
}
|
java
|
private String generateBundleNameFromBundleId(String bundleId) {
String bundleName = bundleId;
if (bundleName.startsWith("/")) {
bundleName = bundleName.substring(1);
}
int idxExtension = FileNameUtils.indexOfExtension(bundleName);
if (idxExtension != -1) {
bundleName = bundleName.substring(0, idxExtension);
}
return bundleName.replaceAll("(/|\\.|:)", "_");
}
|
[
"private",
"String",
"generateBundleNameFromBundleId",
"(",
"String",
"bundleId",
")",
"{",
"String",
"bundleName",
"=",
"bundleId",
";",
"if",
"(",
"bundleName",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"bundleName",
"=",
"bundleName",
".",
"substring",
"(",
"1",
")",
";",
"}",
"int",
"idxExtension",
"=",
"FileNameUtils",
".",
"indexOfExtension",
"(",
"bundleName",
")",
";",
"if",
"(",
"idxExtension",
"!=",
"-",
"1",
")",
"{",
"bundleName",
"=",
"bundleName",
".",
"substring",
"(",
"0",
",",
"idxExtension",
")",
";",
"}",
"return",
"bundleName",
".",
"replaceAll",
"(",
"\"(/|\\\\.|:)\"",
",",
"\"_\"",
")",
";",
"}"
] |
Generates the bundle ID from the bundle name
@param bundleId
the bundle name
@return the generated bundle ID
|
[
"Generates",
"the",
"bundle",
"ID",
"from",
"the",
"bundle",
"name"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L762-L772
|
7,087 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.buildOrphansResourceBundle
|
private JoinableResourceBundle buildOrphansResourceBundle(String bundleId, List<String> orphanPaths) {
JoinableResourceBundle newBundle = new JoinableResourceBundleImpl(bundleId,
generateBundleNameFromBundleId(bundleId), null, fileExtension, new InclusionPattern(), orphanPaths,
resourceReaderHandler, jawrConfig.getGeneratorRegistry());
return newBundle;
}
|
java
|
private JoinableResourceBundle buildOrphansResourceBundle(String bundleId, List<String> orphanPaths) {
JoinableResourceBundle newBundle = new JoinableResourceBundleImpl(bundleId,
generateBundleNameFromBundleId(bundleId), null, fileExtension, new InclusionPattern(), orphanPaths,
resourceReaderHandler, jawrConfig.getGeneratorRegistry());
return newBundle;
}
|
[
"private",
"JoinableResourceBundle",
"buildOrphansResourceBundle",
"(",
"String",
"bundleId",
",",
"List",
"<",
"String",
">",
"orphanPaths",
")",
"{",
"JoinableResourceBundle",
"newBundle",
"=",
"new",
"JoinableResourceBundleImpl",
"(",
"bundleId",
",",
"generateBundleNameFromBundleId",
"(",
"bundleId",
")",
",",
"null",
",",
"fileExtension",
",",
"new",
"InclusionPattern",
"(",
")",
",",
"orphanPaths",
",",
"resourceReaderHandler",
",",
"jawrConfig",
".",
"getGeneratorRegistry",
"(",
")",
")",
";",
"return",
"newBundle",
";",
"}"
] |
Builds a single bundle containing all the paths specified. Useful to make
a single bundle out of every resource that is orphan after processing
config definitions.
@param bundleId
the bundle Id
@param orphanPaths
the orphan paths
@return a single bundle containing all the paths specified
|
[
"Builds",
"a",
"single",
"bundle",
"containing",
"all",
"the",
"paths",
"specified",
".",
"Useful",
"to",
"make",
"a",
"single",
"bundle",
"out",
"of",
"every",
"resource",
"that",
"is",
"orphan",
"after",
"processing",
"config",
"definitions",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L785-L790
|
7,088 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.buildOrphanResourceBundle
|
private JoinableResourceBundle buildOrphanResourceBundle(String orphanPath) {
String mapping = orphanPath;
List<String> paths = Collections.singletonList(mapping);
JoinableResourceBundle newBundle = new JoinableResourceBundleImpl(orphanPath,
generateBundleNameFromBundleId(orphanPath), null, fileExtension, new InclusionPattern(), paths,
resourceReaderHandler, jawrConfig.getGeneratorRegistry());
return newBundle;
}
|
java
|
private JoinableResourceBundle buildOrphanResourceBundle(String orphanPath) {
String mapping = orphanPath;
List<String> paths = Collections.singletonList(mapping);
JoinableResourceBundle newBundle = new JoinableResourceBundleImpl(orphanPath,
generateBundleNameFromBundleId(orphanPath), null, fileExtension, new InclusionPattern(), paths,
resourceReaderHandler, jawrConfig.getGeneratorRegistry());
return newBundle;
}
|
[
"private",
"JoinableResourceBundle",
"buildOrphanResourceBundle",
"(",
"String",
"orphanPath",
")",
"{",
"String",
"mapping",
"=",
"orphanPath",
";",
"List",
"<",
"String",
">",
"paths",
"=",
"Collections",
".",
"singletonList",
"(",
"mapping",
")",
";",
"JoinableResourceBundle",
"newBundle",
"=",
"new",
"JoinableResourceBundleImpl",
"(",
"orphanPath",
",",
"generateBundleNameFromBundleId",
"(",
"orphanPath",
")",
",",
"null",
",",
"fileExtension",
",",
"new",
"InclusionPattern",
"(",
")",
",",
"paths",
",",
"resourceReaderHandler",
",",
"jawrConfig",
".",
"getGeneratorRegistry",
"(",
")",
")",
";",
"return",
"newBundle",
";",
"}"
] |
Build a non-global, single-file resource bundle for orphans.
@param orphanPath
the path
@return a non-global, single-file resource bundle for orphans.
|
[
"Build",
"a",
"non",
"-",
"global",
"single",
"-",
"file",
"resource",
"bundle",
"for",
"orphans",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L799-L807
|
7,089 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
|
BundlesHandlerFactory.setExludedDirMapperDirs
|
public void setExludedDirMapperDirs(Set<String> exludedDirMapperDirs) {
if (null != exludedDirMapperDirs)
this.excludedDirMapperDirs = PathNormalizer.normalizePaths(exludedDirMapperDirs);
}
|
java
|
public void setExludedDirMapperDirs(Set<String> exludedDirMapperDirs) {
if (null != exludedDirMapperDirs)
this.excludedDirMapperDirs = PathNormalizer.normalizePaths(exludedDirMapperDirs);
}
|
[
"public",
"void",
"setExludedDirMapperDirs",
"(",
"Set",
"<",
"String",
">",
"exludedDirMapperDirs",
")",
"{",
"if",
"(",
"null",
"!=",
"exludedDirMapperDirs",
")",
"this",
".",
"excludedDirMapperDirs",
"=",
"PathNormalizer",
".",
"normalizePaths",
"(",
"exludedDirMapperDirs",
")",
";",
"}"
] |
Sets the paths to exclude when using the dirMapper.
@param exludedDirMapperDirs
the excluded directories
|
[
"Sets",
"the",
"paths",
"to",
"exclude",
"when",
"using",
"the",
"dirMapper",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L979-L982
|
7,090 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/util/js/rhino/RhinoTopLevel.java
|
RhinoTopLevel.bindings
|
@SuppressWarnings("static-access")
public static Object bindings(Context cx, Scriptable thisObj, Object[] args,
Function funObj) {
if (args.length == 1) {
Object arg = args[0];
if (arg instanceof Wrapper) {
arg = ((Wrapper)arg).unwrap();
}
if (arg instanceof ExternalScriptable) {
ScriptContext ctx = ((ExternalScriptable)arg).getContext();
Bindings bind = ctx.getBindings(ScriptContext.ENGINE_SCOPE);
return Context.javaToJS(bind,
ScriptableObject.getTopLevelScope(thisObj));
}
}
return cx.getUndefinedValue();
}
|
java
|
@SuppressWarnings("static-access")
public static Object bindings(Context cx, Scriptable thisObj, Object[] args,
Function funObj) {
if (args.length == 1) {
Object arg = args[0];
if (arg instanceof Wrapper) {
arg = ((Wrapper)arg).unwrap();
}
if (arg instanceof ExternalScriptable) {
ScriptContext ctx = ((ExternalScriptable)arg).getContext();
Bindings bind = ctx.getBindings(ScriptContext.ENGINE_SCOPE);
return Context.javaToJS(bind,
ScriptableObject.getTopLevelScope(thisObj));
}
}
return cx.getUndefinedValue();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"static-access\"",
")",
"public",
"static",
"Object",
"bindings",
"(",
"Context",
"cx",
",",
"Scriptable",
"thisObj",
",",
"Object",
"[",
"]",
"args",
",",
"Function",
"funObj",
")",
"{",
"if",
"(",
"args",
".",
"length",
"==",
"1",
")",
"{",
"Object",
"arg",
"=",
"args",
"[",
"0",
"]",
";",
"if",
"(",
"arg",
"instanceof",
"Wrapper",
")",
"{",
"arg",
"=",
"(",
"(",
"Wrapper",
")",
"arg",
")",
".",
"unwrap",
"(",
")",
";",
"}",
"if",
"(",
"arg",
"instanceof",
"ExternalScriptable",
")",
"{",
"ScriptContext",
"ctx",
"=",
"(",
"(",
"ExternalScriptable",
")",
"arg",
")",
".",
"getContext",
"(",
")",
";",
"Bindings",
"bind",
"=",
"ctx",
".",
"getBindings",
"(",
"ScriptContext",
".",
"ENGINE_SCOPE",
")",
";",
"return",
"Context",
".",
"javaToJS",
"(",
"bind",
",",
"ScriptableObject",
".",
"getTopLevelScope",
"(",
"thisObj",
")",
")",
";",
"}",
"}",
"return",
"cx",
".",
"getUndefinedValue",
"(",
")",
";",
"}"
] |
The bindings function takes a JavaScript scope object
of type ExternalScriptable and returns the underlying Bindings
instance.
var page = scope(pageBindings);
with (page) {
// code that uses page scope
}
var b = bindings(page);
// operate on bindings here.
|
[
"The",
"bindings",
"function",
"takes",
"a",
"JavaScript",
"scope",
"object",
"of",
"type",
"ExternalScriptable",
"and",
"returns",
"the",
"underlying",
"Bindings",
"instance",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/util/js/rhino/RhinoTopLevel.java#L88-L104
|
7,091 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/util/io/TeeOutputStream.java
|
TeeOutputStream.write
|
@Override
public synchronized void write(byte[] b, int off, int len) throws IOException {
super.write(b, off, len);
this.branch.write(b, off, len);
}
|
java
|
@Override
public synchronized void write(byte[] b, int off, int len) throws IOException {
super.write(b, off, len);
this.branch.write(b, off, len);
}
|
[
"@",
"Override",
"public",
"synchronized",
"void",
"write",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"super",
".",
"write",
"(",
"b",
",",
"off",
",",
"len",
")",
";",
"this",
".",
"branch",
".",
"write",
"(",
"b",
",",
"off",
",",
"len",
")",
";",
"}"
] |
Write the specified bytes to both streams.
@param b the bytes to write
@param off The start offset
@param len The number of bytes to write
@throws IOException if an I/O error occurs
|
[
"Write",
"the",
"specified",
"bytes",
"to",
"both",
"streams",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/util/io/TeeOutputStream.java#L62-L66
|
7,092 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/ResourceGeneratorReaderProxyFactory.java
|
ResourceGeneratorReaderProxyFactory.getResourceReaderProxy
|
public static ResourceReader getResourceReaderProxy(ResourceGenerator generator,
ResourceReaderHandler rsReaderHandler, JawrConfig config) {
ResourceReader proxy = null;
// Defines the interfaces to be implemented by the ResourceReader
int nbExtraInterface = 0;
Class<?>[] extraInterfaces = new Class<?>[2];
boolean isResourceGenerator = generator instanceof ResourceGenerator;
boolean isStreamResourceGenerator = generator instanceof StreamResourceGenerator;
if (isResourceGenerator) {
extraInterfaces[nbExtraInterface++] = TextResourceReader.class;
}
if (isStreamResourceGenerator) {
extraInterfaces[nbExtraInterface++] = StreamResourceReader.class;
}
Class<?>[] generatorInterfaces = getGeneratorInterfaces(generator);
Class<?>[] implementedInterfaces = new Class[generatorInterfaces.length + nbExtraInterface];
System.arraycopy(generatorInterfaces, 0, implementedInterfaces, 0, generatorInterfaces.length);
System.arraycopy(extraInterfaces, 0, implementedInterfaces, generatorInterfaces.length, nbExtraInterface);
// Creates the proxy
InvocationHandler handler = new ResourceGeneratorReaderWrapperInvocationHandler(generator, rsReaderHandler,
config);
proxy = (ResourceReader) Proxy.newProxyInstance(ResourceGeneratorReaderProxyFactory.class.getClassLoader(),
implementedInterfaces, handler);
return proxy;
}
|
java
|
public static ResourceReader getResourceReaderProxy(ResourceGenerator generator,
ResourceReaderHandler rsReaderHandler, JawrConfig config) {
ResourceReader proxy = null;
// Defines the interfaces to be implemented by the ResourceReader
int nbExtraInterface = 0;
Class<?>[] extraInterfaces = new Class<?>[2];
boolean isResourceGenerator = generator instanceof ResourceGenerator;
boolean isStreamResourceGenerator = generator instanceof StreamResourceGenerator;
if (isResourceGenerator) {
extraInterfaces[nbExtraInterface++] = TextResourceReader.class;
}
if (isStreamResourceGenerator) {
extraInterfaces[nbExtraInterface++] = StreamResourceReader.class;
}
Class<?>[] generatorInterfaces = getGeneratorInterfaces(generator);
Class<?>[] implementedInterfaces = new Class[generatorInterfaces.length + nbExtraInterface];
System.arraycopy(generatorInterfaces, 0, implementedInterfaces, 0, generatorInterfaces.length);
System.arraycopy(extraInterfaces, 0, implementedInterfaces, generatorInterfaces.length, nbExtraInterface);
// Creates the proxy
InvocationHandler handler = new ResourceGeneratorReaderWrapperInvocationHandler(generator, rsReaderHandler,
config);
proxy = (ResourceReader) Proxy.newProxyInstance(ResourceGeneratorReaderProxyFactory.class.getClassLoader(),
implementedInterfaces, handler);
return proxy;
}
|
[
"public",
"static",
"ResourceReader",
"getResourceReaderProxy",
"(",
"ResourceGenerator",
"generator",
",",
"ResourceReaderHandler",
"rsReaderHandler",
",",
"JawrConfig",
"config",
")",
"{",
"ResourceReader",
"proxy",
"=",
"null",
";",
"// Defines the interfaces to be implemented by the ResourceReader",
"int",
"nbExtraInterface",
"=",
"0",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"extraInterfaces",
"=",
"new",
"Class",
"<",
"?",
">",
"[",
"2",
"]",
";",
"boolean",
"isResourceGenerator",
"=",
"generator",
"instanceof",
"ResourceGenerator",
";",
"boolean",
"isStreamResourceGenerator",
"=",
"generator",
"instanceof",
"StreamResourceGenerator",
";",
"if",
"(",
"isResourceGenerator",
")",
"{",
"extraInterfaces",
"[",
"nbExtraInterface",
"++",
"]",
"=",
"TextResourceReader",
".",
"class",
";",
"}",
"if",
"(",
"isStreamResourceGenerator",
")",
"{",
"extraInterfaces",
"[",
"nbExtraInterface",
"++",
"]",
"=",
"StreamResourceReader",
".",
"class",
";",
"}",
"Class",
"<",
"?",
">",
"[",
"]",
"generatorInterfaces",
"=",
"getGeneratorInterfaces",
"(",
"generator",
")",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"implementedInterfaces",
"=",
"new",
"Class",
"[",
"generatorInterfaces",
".",
"length",
"+",
"nbExtraInterface",
"]",
";",
"System",
".",
"arraycopy",
"(",
"generatorInterfaces",
",",
"0",
",",
"implementedInterfaces",
",",
"0",
",",
"generatorInterfaces",
".",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"extraInterfaces",
",",
"0",
",",
"implementedInterfaces",
",",
"generatorInterfaces",
".",
"length",
",",
"nbExtraInterface",
")",
";",
"// Creates the proxy",
"InvocationHandler",
"handler",
"=",
"new",
"ResourceGeneratorReaderWrapperInvocationHandler",
"(",
"generator",
",",
"rsReaderHandler",
",",
"config",
")",
";",
"proxy",
"=",
"(",
"ResourceReader",
")",
"Proxy",
".",
"newProxyInstance",
"(",
"ResourceGeneratorReaderProxyFactory",
".",
"class",
".",
"getClassLoader",
"(",
")",
",",
"implementedInterfaces",
",",
"handler",
")",
";",
"return",
"proxy",
";",
"}"
] |
Creates a Resource reader from a resource generator.
@param generator
the resource generator, which can be a text or an image
resource generator.
@param rsReaderHandler
the resourceReaderHandler
@param config
the jawr config
@return the Resource reader
|
[
"Creates",
"a",
"Resource",
"reader",
"from",
"a",
"resource",
"generator",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/ResourceGeneratorReaderProxyFactory.java#L50-L80
|
7,093 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/ResourceGeneratorReaderProxyFactory.java
|
ResourceGeneratorReaderProxyFactory.getGeneratorInterfaces
|
private static Class<?>[] getGeneratorInterfaces(ResourceGenerator generator) {
Set<Class<?>> interfaces = new HashSet<>();
addInterfaces(generator, interfaces);
return (Class[]) interfaces.toArray(new Class[] {});
}
|
java
|
private static Class<?>[] getGeneratorInterfaces(ResourceGenerator generator) {
Set<Class<?>> interfaces = new HashSet<>();
addInterfaces(generator, interfaces);
return (Class[]) interfaces.toArray(new Class[] {});
}
|
[
"private",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"getGeneratorInterfaces",
"(",
"ResourceGenerator",
"generator",
")",
"{",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"interfaces",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"addInterfaces",
"(",
"generator",
",",
"interfaces",
")",
";",
"return",
"(",
"Class",
"[",
"]",
")",
"interfaces",
".",
"toArray",
"(",
"new",
"Class",
"[",
"]",
"{",
"}",
")",
";",
"}"
] |
Returns the array of interfaces implemented by the ResourceGenerator
@param generator
the generator
@return the array of interfaces implemented by the ResourceGenerator
|
[
"Returns",
"the",
"array",
"of",
"interfaces",
"implemented",
"by",
"the",
"ResourceGenerator"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/ResourceGeneratorReaderProxyFactory.java#L89-L94
|
7,094 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/ResourceGeneratorReaderProxyFactory.java
|
ResourceGeneratorReaderProxyFactory.addInterfaces
|
private static void addInterfaces(Object obj, Set<Class<?>> interfaces) {
Class<?>[] generatorInterfaces = null;
Class<?> superClass = null;
if (obj instanceof Class) {
generatorInterfaces = ((Class<?>) obj).getInterfaces();
superClass = ((Class<?>) obj).getSuperclass();
} else {
generatorInterfaces = obj.getClass().getInterfaces();
superClass = obj.getClass().getSuperclass();
}
for (Class<?> generatorInterface : generatorInterfaces) {
interfaces.add(generatorInterface);
addInterfaces(generatorInterface, interfaces);
}
if (superClass != null && superClass != Object.class) {
addInterfaces(superClass, interfaces);
}
}
|
java
|
private static void addInterfaces(Object obj, Set<Class<?>> interfaces) {
Class<?>[] generatorInterfaces = null;
Class<?> superClass = null;
if (obj instanceof Class) {
generatorInterfaces = ((Class<?>) obj).getInterfaces();
superClass = ((Class<?>) obj).getSuperclass();
} else {
generatorInterfaces = obj.getClass().getInterfaces();
superClass = obj.getClass().getSuperclass();
}
for (Class<?> generatorInterface : generatorInterfaces) {
interfaces.add(generatorInterface);
addInterfaces(generatorInterface, interfaces);
}
if (superClass != null && superClass != Object.class) {
addInterfaces(superClass, interfaces);
}
}
|
[
"private",
"static",
"void",
"addInterfaces",
"(",
"Object",
"obj",
",",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"interfaces",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"generatorInterfaces",
"=",
"null",
";",
"Class",
"<",
"?",
">",
"superClass",
"=",
"null",
";",
"if",
"(",
"obj",
"instanceof",
"Class",
")",
"{",
"generatorInterfaces",
"=",
"(",
"(",
"Class",
"<",
"?",
">",
")",
"obj",
")",
".",
"getInterfaces",
"(",
")",
";",
"superClass",
"=",
"(",
"(",
"Class",
"<",
"?",
">",
")",
"obj",
")",
".",
"getSuperclass",
"(",
")",
";",
"}",
"else",
"{",
"generatorInterfaces",
"=",
"obj",
".",
"getClass",
"(",
")",
".",
"getInterfaces",
"(",
")",
";",
"superClass",
"=",
"obj",
".",
"getClass",
"(",
")",
".",
"getSuperclass",
"(",
")",
";",
"}",
"for",
"(",
"Class",
"<",
"?",
">",
"generatorInterface",
":",
"generatorInterfaces",
")",
"{",
"interfaces",
".",
"add",
"(",
"generatorInterface",
")",
";",
"addInterfaces",
"(",
"generatorInterface",
",",
"interfaces",
")",
";",
"}",
"if",
"(",
"superClass",
"!=",
"null",
"&&",
"superClass",
"!=",
"Object",
".",
"class",
")",
"{",
"addInterfaces",
"(",
"superClass",
",",
"interfaces",
")",
";",
"}",
"}"
] |
Adds all the interfaces of the object passed in parameter in the set of
interfaces.
@param obj
the object
@param interfaces
the set of interfaces to update
|
[
"Adds",
"all",
"the",
"interfaces",
"of",
"the",
"object",
"passed",
"in",
"parameter",
"in",
"the",
"set",
"of",
"interfaces",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/ResourceGeneratorReaderProxyFactory.java#L105-L124
|
7,095 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/css/less/LessCssGenerator.java
|
LessCssGenerator.compile
|
public String compile(JoinableResourceBundle bundle, String content, String path, GeneratorContext context) {
JawrLessSource source = new JawrLessSource(bundle, content, path, rsHandler);
try {
CompilationResult result = compiler.compile(source, lessConfig);
addLinkedResources(path, context, source.getLinkedResources());
return result.getCss();
} catch (Less4jException e) {
throw new BundlingProcessException("Unable to generate content for resource path : '" + path + "'", e);
}
}
|
java
|
public String compile(JoinableResourceBundle bundle, String content, String path, GeneratorContext context) {
JawrLessSource source = new JawrLessSource(bundle, content, path, rsHandler);
try {
CompilationResult result = compiler.compile(source, lessConfig);
addLinkedResources(path, context, source.getLinkedResources());
return result.getCss();
} catch (Less4jException e) {
throw new BundlingProcessException("Unable to generate content for resource path : '" + path + "'", e);
}
}
|
[
"public",
"String",
"compile",
"(",
"JoinableResourceBundle",
"bundle",
",",
"String",
"content",
",",
"String",
"path",
",",
"GeneratorContext",
"context",
")",
"{",
"JawrLessSource",
"source",
"=",
"new",
"JawrLessSource",
"(",
"bundle",
",",
"content",
",",
"path",
",",
"rsHandler",
")",
";",
"try",
"{",
"CompilationResult",
"result",
"=",
"compiler",
".",
"compile",
"(",
"source",
",",
"lessConfig",
")",
";",
"addLinkedResources",
"(",
"path",
",",
"context",
",",
"source",
".",
"getLinkedResources",
"(",
")",
")",
";",
"return",
"result",
".",
"getCss",
"(",
")",
";",
"}",
"catch",
"(",
"Less4jException",
"e",
")",
"{",
"throw",
"new",
"BundlingProcessException",
"(",
"\"Unable to generate content for resource path : '\"",
"+",
"path",
"+",
"\"'\"",
",",
"e",
")",
";",
"}",
"}"
] |
Compile the LESS source to a CSS source
@param bundle
the bundle
@param content
the resource content to compile
@param path
the compiled resource path
@param context
the generator context
@return the compiled CSS content
|
[
"Compile",
"the",
"LESS",
"source",
"to",
"a",
"CSS",
"source"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/css/less/LessCssGenerator.java#L135-L146
|
7,096 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/resolver/WebJarsLocatorPathResolver.java
|
WebJarsLocatorPathResolver.getResourceNames
|
public Set<String> getResourceNames(String folder) {
String path = super.getResourcePath(folder);
Set<String> assets = locator.listAssets(path);
Set<String> resourceNames = new HashSet<>();
for (String asset : assets) {
int idx = asset.indexOf(path);
if (idx != -1) {
String name = asset.substring(idx + path.length());
idx = name.indexOf(JawrConstant.URL_SEPARATOR);
if (idx != -1) {
name = name.substring(0, idx + 1);
}
resourceNames.add(name);
}
}
return resourceNames;
}
|
java
|
public Set<String> getResourceNames(String folder) {
String path = super.getResourcePath(folder);
Set<String> assets = locator.listAssets(path);
Set<String> resourceNames = new HashSet<>();
for (String asset : assets) {
int idx = asset.indexOf(path);
if (idx != -1) {
String name = asset.substring(idx + path.length());
idx = name.indexOf(JawrConstant.URL_SEPARATOR);
if (idx != -1) {
name = name.substring(0, idx + 1);
}
resourceNames.add(name);
}
}
return resourceNames;
}
|
[
"public",
"Set",
"<",
"String",
">",
"getResourceNames",
"(",
"String",
"folder",
")",
"{",
"String",
"path",
"=",
"super",
".",
"getResourcePath",
"(",
"folder",
")",
";",
"Set",
"<",
"String",
">",
"assets",
"=",
"locator",
".",
"listAssets",
"(",
"path",
")",
";",
"Set",
"<",
"String",
">",
"resourceNames",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"asset",
":",
"assets",
")",
"{",
"int",
"idx",
"=",
"asset",
".",
"indexOf",
"(",
"path",
")",
";",
"if",
"(",
"idx",
"!=",
"-",
"1",
")",
"{",
"String",
"name",
"=",
"asset",
".",
"substring",
"(",
"idx",
"+",
"path",
".",
"length",
"(",
")",
")",
";",
"idx",
"=",
"name",
".",
"indexOf",
"(",
"JawrConstant",
".",
"URL_SEPARATOR",
")",
";",
"if",
"(",
"idx",
"!=",
"-",
"1",
")",
"{",
"name",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"idx",
"+",
"1",
")",
";",
"}",
"resourceNames",
".",
"add",
"(",
"name",
")",
";",
"}",
"}",
"return",
"resourceNames",
";",
"}"
] |
List assets within a folder.
@param folder
the root path to the folder.
@return a set of folder paths that match.
|
[
"List",
"assets",
"within",
"a",
"folder",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/resolver/WebJarsLocatorPathResolver.java#L138-L154
|
7,097 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerGeneratorImpl.java
|
ClientSideHandlerGeneratorImpl.getHeaderSection
|
protected StringBuffer getHeaderSection(HttpServletRequest request) {
StringBuffer sb = new StringBuffer(mainScriptTemplate.toString());
sb.append("JAWR.app_context_path='").append(request.getContextPath()).append("';\n");
return sb;
}
|
java
|
protected StringBuffer getHeaderSection(HttpServletRequest request) {
StringBuffer sb = new StringBuffer(mainScriptTemplate.toString());
sb.append("JAWR.app_context_path='").append(request.getContextPath()).append("';\n");
return sb;
}
|
[
"protected",
"StringBuffer",
"getHeaderSection",
"(",
"HttpServletRequest",
"request",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"mainScriptTemplate",
".",
"toString",
"(",
")",
")",
";",
"sb",
".",
"append",
"(",
"\"JAWR.app_context_path='\"",
")",
".",
"append",
"(",
"request",
".",
"getContextPath",
"(",
")",
")",
".",
"append",
"(",
"\"';\\n\"",
")",
";",
"return",
"sb",
";",
"}"
] |
Returns the header section for the client side handler
@param request
the HTTP request
@return the header section for the client side handler
|
[
"Returns",
"the",
"header",
"section",
"for",
"the",
"client",
"side",
"handler"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerGeneratorImpl.java#L184-L188
|
7,098 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerGeneratorImpl.java
|
ClientSideHandlerGeneratorImpl.getPathPrefix
|
private String getPathPrefix(HttpServletRequest request, JawrConfig config) {
if (request.isSecure()) {
if (null != config.getContextPathSslOverride()) {
return config.getContextPathSslOverride();
}
} else {
if (null != config.getContextPathOverride()) {
return config.getContextPathOverride();
}
}
String mapping = null == config.getServletMapping() ? "" : config.getServletMapping();
String path = PathNormalizer.joinPaths(request.getContextPath(), mapping);
path = path.endsWith("/") ? path : path + '/';
return path;
}
|
java
|
private String getPathPrefix(HttpServletRequest request, JawrConfig config) {
if (request.isSecure()) {
if (null != config.getContextPathSslOverride()) {
return config.getContextPathSslOverride();
}
} else {
if (null != config.getContextPathOverride()) {
return config.getContextPathOverride();
}
}
String mapping = null == config.getServletMapping() ? "" : config.getServletMapping();
String path = PathNormalizer.joinPaths(request.getContextPath(), mapping);
path = path.endsWith("/") ? path : path + '/';
return path;
}
|
[
"private",
"String",
"getPathPrefix",
"(",
"HttpServletRequest",
"request",
",",
"JawrConfig",
"config",
")",
"{",
"if",
"(",
"request",
".",
"isSecure",
"(",
")",
")",
"{",
"if",
"(",
"null",
"!=",
"config",
".",
"getContextPathSslOverride",
"(",
")",
")",
"{",
"return",
"config",
".",
"getContextPathSslOverride",
"(",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"null",
"!=",
"config",
".",
"getContextPathOverride",
"(",
")",
")",
"{",
"return",
"config",
".",
"getContextPathOverride",
"(",
")",
";",
"}",
"}",
"String",
"mapping",
"=",
"null",
"==",
"config",
".",
"getServletMapping",
"(",
")",
"?",
"\"\"",
":",
"config",
".",
"getServletMapping",
"(",
")",
";",
"String",
"path",
"=",
"PathNormalizer",
".",
"joinPaths",
"(",
"request",
".",
"getContextPath",
"(",
")",
",",
"mapping",
")",
";",
"path",
"=",
"path",
".",
"endsWith",
"(",
"\"/\"",
")",
"?",
"path",
":",
"path",
"+",
"'",
"'",
";",
"return",
"path",
";",
"}"
] |
Determines which prefix should be used for the links, according to the
context path override if present, or using the context path and possibly
the jawr mapping.
@param request
the request
@return the path prefix
|
[
"Determines",
"which",
"prefix",
"should",
"be",
"used",
"for",
"the",
"links",
"according",
"to",
"the",
"context",
"path",
"override",
"if",
"present",
"or",
"using",
"the",
"context",
"path",
"and",
"possibly",
"the",
"jawr",
"mapping",
"."
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerGeneratorImpl.java#L217-L233
|
7,099 |
j-a-w-r/jawr-main-repo
|
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerGeneratorImpl.java
|
ClientSideHandlerGeneratorImpl.addAllBundles
|
private void addAllBundles(List<JoinableResourceBundle> bundles, Map<String, String> variants, StringBuffer buf,
boolean useGzip) {
for (Iterator<JoinableResourceBundle> it = bundles.iterator(); it.hasNext();) {
JoinableResourceBundle bundle = it.next();
appendBundle(bundle, variants, buf, useGzip);
if (it.hasNext())
buf.append(",");
}
}
|
java
|
private void addAllBundles(List<JoinableResourceBundle> bundles, Map<String, String> variants, StringBuffer buf,
boolean useGzip) {
for (Iterator<JoinableResourceBundle> it = bundles.iterator(); it.hasNext();) {
JoinableResourceBundle bundle = it.next();
appendBundle(bundle, variants, buf, useGzip);
if (it.hasNext())
buf.append(",");
}
}
|
[
"private",
"void",
"addAllBundles",
"(",
"List",
"<",
"JoinableResourceBundle",
">",
"bundles",
",",
"Map",
"<",
"String",
",",
"String",
">",
"variants",
",",
"StringBuffer",
"buf",
",",
"boolean",
"useGzip",
")",
"{",
"for",
"(",
"Iterator",
"<",
"JoinableResourceBundle",
">",
"it",
"=",
"bundles",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"JoinableResourceBundle",
"bundle",
"=",
"it",
".",
"next",
"(",
")",
";",
"appendBundle",
"(",
"bundle",
",",
"variants",
",",
"buf",
",",
"useGzip",
")",
";",
"if",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"buf",
".",
"append",
"(",
"\",\"",
")",
";",
"}",
"}"
] |
Adds a javascript Resourcebundle representation for each member of a List
containing JoinableResourceBundles
@param bundles
the bundles
@param variants
the variant map
@param buf
the buffer
@param useGzip
the flag indicating if we use gzip compression or not.
|
[
"Adds",
"a",
"javascript",
"Resourcebundle",
"representation",
"for",
"each",
"member",
"of",
"a",
"List",
"containing",
"JoinableResourceBundles"
] |
5381f6acf461cd2502593c67a77bd6ef9eab848d
|
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerGeneratorImpl.java#L248-L257
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.