repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
HanSolo/Medusa | src/main/java/eu/hansolo/medusa/Gauge.java | Gauge.setInteractive | public void setInteractive(final boolean INTERACTIVE) {
if (null == interactive) {
_interactive = INTERACTIVE;
fireUpdateEvent(INTERACTIVITY_EVENT);
} else {
interactive.set(INTERACTIVE);
}
} | java | public void setInteractive(final boolean INTERACTIVE) {
if (null == interactive) {
_interactive = INTERACTIVE;
fireUpdateEvent(INTERACTIVITY_EVENT);
} else {
interactive.set(INTERACTIVE);
}
} | [
"public",
"void",
"setInteractive",
"(",
"final",
"boolean",
"INTERACTIVE",
")",
"{",
"if",
"(",
"null",
"==",
"interactive",
")",
"{",
"_interactive",
"=",
"INTERACTIVE",
";",
"fireUpdateEvent",
"(",
"INTERACTIVITY_EVENT",
")",
";",
"}",
"else",
"{",
"interac... | Defines if the gauge is in interactive mode. This is currently
implemented in the radial gauges that have a knob. If interactive == true
the knob can be pressed to trigger something.
@param INTERACTIVE | [
"Defines",
"if",
"the",
"gauge",
"is",
"in",
"interactive",
"mode",
".",
"This",
"is",
"currently",
"implemented",
"in",
"the",
"radial",
"gauges",
"that",
"have",
"a",
"knob",
".",
"If",
"interactive",
"==",
"true",
"the",
"knob",
"can",
"be",
"pressed",
... | 1321e4925dcde659028d4b296e49e316494c114c | https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Gauge.java#L5049-L5056 | train |
HanSolo/Medusa | src/main/java/eu/hansolo/medusa/Gauge.java | Gauge.setButtonTooltipText | public void setButtonTooltipText(final String TEXT) {
if (null == buttonTooltipText) {
_buttonTooltipText = TEXT;
fireUpdateEvent(REDRAW_EVENT);
} else {
buttonTooltipText.set(TEXT);
}
} | java | public void setButtonTooltipText(final String TEXT) {
if (null == buttonTooltipText) {
_buttonTooltipText = TEXT;
fireUpdateEvent(REDRAW_EVENT);
} else {
buttonTooltipText.set(TEXT);
}
} | [
"public",
"void",
"setButtonTooltipText",
"(",
"final",
"String",
"TEXT",
")",
"{",
"if",
"(",
"null",
"==",
"buttonTooltipText",
")",
"{",
"_buttonTooltipText",
"=",
"TEXT",
";",
"fireUpdateEvent",
"(",
"REDRAW_EVENT",
")",
";",
"}",
"else",
"{",
"buttonToolt... | Defines the text that will be shown in the button tooltip. The
knob in the radial gauges acts as button if interactive == true.
@param TEXT | [
"Defines",
"the",
"text",
"that",
"will",
"be",
"shown",
"in",
"the",
"button",
"tooltip",
".",
"The",
"knob",
"in",
"the",
"radial",
"gauges",
"acts",
"as",
"button",
"if",
"interactive",
"==",
"true",
"."
] | 1321e4925dcde659028d4b296e49e316494c114c | https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Gauge.java#L5081-L5088 | train |
HanSolo/Medusa | src/main/java/eu/hansolo/medusa/Gauge.java | Gauge.setAlertMessage | public void setAlertMessage(final String MESSAGE) {
if (null == alertMessage) {
_alertMessage = MESSAGE;
fireUpdateEvent(ALERT_EVENT);
} else {
alertMessage.set(MESSAGE);
}
} | java | public void setAlertMessage(final String MESSAGE) {
if (null == alertMessage) {
_alertMessage = MESSAGE;
fireUpdateEvent(ALERT_EVENT);
} else {
alertMessage.set(MESSAGE);
}
} | [
"public",
"void",
"setAlertMessage",
"(",
"final",
"String",
"MESSAGE",
")",
"{",
"if",
"(",
"null",
"==",
"alertMessage",
")",
"{",
"_alertMessage",
"=",
"MESSAGE",
";",
"fireUpdateEvent",
"(",
"ALERT_EVENT",
")",
";",
"}",
"else",
"{",
"alertMessage",
".",... | Defines the text that could be used in a tooltip as an
alert message.
@param MESSAGE | [
"Defines",
"the",
"text",
"that",
"could",
"be",
"used",
"in",
"a",
"tooltip",
"as",
"an",
"alert",
"message",
"."
] | 1321e4925dcde659028d4b296e49e316494c114c | https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Gauge.java#L5234-L5241 | train |
HanSolo/Medusa | src/main/java/eu/hansolo/medusa/Gauge.java | Gauge.stop | public void stop() {
setLedOn(false);
if (null != blinkFuture) { blinkFuture.cancel(true); }
if (null != blinkService) { blinkService.shutdownNow(); }
} | java | public void stop() {
setLedOn(false);
if (null != blinkFuture) { blinkFuture.cancel(true); }
if (null != blinkService) { blinkService.shutdownNow(); }
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"setLedOn",
"(",
"false",
")",
";",
"if",
"(",
"null",
"!=",
"blinkFuture",
")",
"{",
"blinkFuture",
".",
"cancel",
"(",
"true",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"blinkService",
")",
"{",
"blinkService"... | Calling this method will stop all threads. This is needed when using
JavaFX on mobile devices when the device goes to sleep mode. | [
"Calling",
"this",
"method",
"will",
"stop",
"all",
"threads",
".",
"This",
"is",
"needed",
"when",
"using",
"JavaFX",
"on",
"mobile",
"devices",
"when",
"the",
"device",
"goes",
"to",
"sleep",
"mode",
"."
] | 1321e4925dcde659028d4b296e49e316494c114c | https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Gauge.java#L5344-L5348 | train |
HanSolo/Medusa | src/main/java/eu/hansolo/medusa/Marker.java | Marker.setValue | public void setValue(final double VALUE) {
if (null == value) {
_value = VALUE;
} else {
value.set(VALUE);
}
fireMarkerEvent(VALUE_CHANGED_EVENT);
} | java | public void setValue(final double VALUE) {
if (null == value) {
_value = VALUE;
} else {
value.set(VALUE);
}
fireMarkerEvent(VALUE_CHANGED_EVENT);
} | [
"public",
"void",
"setValue",
"(",
"final",
"double",
"VALUE",
")",
"{",
"if",
"(",
"null",
"==",
"value",
")",
"{",
"_value",
"=",
"VALUE",
";",
"}",
"else",
"{",
"value",
".",
"set",
"(",
"VALUE",
")",
";",
"}",
"fireMarkerEvent",
"(",
"VALUE_CHANG... | Defines the value for the marker
@param VALUE | [
"Defines",
"the",
"value",
"for",
"the",
"marker"
] | 1321e4925dcde659028d4b296e49e316494c114c | https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Marker.java#L110-L117 | train |
HanSolo/Medusa | src/main/java/eu/hansolo/medusa/Marker.java | Marker.setText | public void setText(final String TEXT) {
if (null == text) {
_text = TEXT;
} else {
text.set(TEXT);
}
fireMarkerEvent(TEXT_CHANGED_EVENT);
} | java | public void setText(final String TEXT) {
if (null == text) {
_text = TEXT;
} else {
text.set(TEXT);
}
fireMarkerEvent(TEXT_CHANGED_EVENT);
} | [
"public",
"void",
"setText",
"(",
"final",
"String",
"TEXT",
")",
"{",
"if",
"(",
"null",
"==",
"text",
")",
"{",
"_text",
"=",
"TEXT",
";",
"}",
"else",
"{",
"text",
".",
"set",
"(",
"TEXT",
")",
";",
"}",
"fireMarkerEvent",
"(",
"TEXT_CHANGED_EVENT... | Defines a text for this marker. This text can be
used as a description and will be used in tooltips.
@param TEXT | [
"Defines",
"a",
"text",
"for",
"this",
"marker",
".",
"This",
"text",
"can",
"be",
"used",
"as",
"a",
"description",
"and",
"will",
"be",
"used",
"in",
"tooltips",
"."
] | 1321e4925dcde659028d4b296e49e316494c114c | https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Marker.java#L135-L142 | train |
HanSolo/Medusa | src/main/java/eu/hansolo/medusa/Marker.java | Marker.setColor | public void setColor(final Color COLOR) {
if (null == color) {
_color = COLOR;
} else {
color.set(COLOR);
}
fireMarkerEvent(COLOR_CHANGED_EVENT);
} | java | public void setColor(final Color COLOR) {
if (null == color) {
_color = COLOR;
} else {
color.set(COLOR);
}
fireMarkerEvent(COLOR_CHANGED_EVENT);
} | [
"public",
"void",
"setColor",
"(",
"final",
"Color",
"COLOR",
")",
"{",
"if",
"(",
"null",
"==",
"color",
")",
"{",
"_color",
"=",
"COLOR",
";",
"}",
"else",
"{",
"color",
".",
"set",
"(",
"COLOR",
")",
";",
"}",
"fireMarkerEvent",
"(",
"COLOR_CHANGE... | Defines the color that will be used to colorize the marker.
@param COLOR | [
"Defines",
"the",
"color",
"that",
"will",
"be",
"used",
"to",
"colorize",
"the",
"marker",
"."
] | 1321e4925dcde659028d4b296e49e316494c114c | https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Marker.java#L158-L165 | train |
HanSolo/Medusa | src/main/java/eu/hansolo/medusa/Marker.java | Marker.setMarkerType | public void setMarkerType(final MarkerType TYPE) {
if (null == markerType) {
_markerType = null == TYPE ? MarkerType.STANDARD : TYPE;
} else {
markerType.set(TYPE);
}
fireMarkerEvent(TYPE_CHANGED_EVENT);
} | java | public void setMarkerType(final MarkerType TYPE) {
if (null == markerType) {
_markerType = null == TYPE ? MarkerType.STANDARD : TYPE;
} else {
markerType.set(TYPE);
}
fireMarkerEvent(TYPE_CHANGED_EVENT);
} | [
"public",
"void",
"setMarkerType",
"(",
"final",
"MarkerType",
"TYPE",
")",
"{",
"if",
"(",
"null",
"==",
"markerType",
")",
"{",
"_markerType",
"=",
"null",
"==",
"TYPE",
"?",
"MarkerType",
".",
"STANDARD",
":",
"TYPE",
";",
"}",
"else",
"{",
"markerTyp... | Defines the shape that will be used to visualize the marker.
The values are STANDARD, DOT, TRAPEZOID.
@param TYPE | [
"Defines",
"the",
"shape",
"that",
"will",
"be",
"used",
"to",
"visualize",
"the",
"marker",
".",
"The",
"values",
"are",
"STANDARD",
"DOT",
"TRAPEZOID",
"."
] | 1321e4925dcde659028d4b296e49e316494c114c | https://github.com/HanSolo/Medusa/blob/1321e4925dcde659028d4b296e49e316494c114c/src/main/java/eu/hansolo/medusa/Marker.java#L182-L189 | train |
razorpay/razorpay-android-sample-app | app/src/main/java/com/razorpay/sampleapp/PaymentActivity.java | PaymentActivity.onPaymentSuccess | @SuppressWarnings("unused")
@Override
public void onPaymentSuccess(String razorpayPaymentID) {
try {
Toast.makeText(this, "Payment Successful: " + razorpayPaymentID, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e(TAG, "Exception in onPaymentSuccess", e);
... | java | @SuppressWarnings("unused")
@Override
public void onPaymentSuccess(String razorpayPaymentID) {
try {
Toast.makeText(this, "Payment Successful: " + razorpayPaymentID, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e(TAG, "Exception in onPaymentSuccess", e);
... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"@",
"Override",
"public",
"void",
"onPaymentSuccess",
"(",
"String",
"razorpayPaymentID",
")",
"{",
"try",
"{",
"Toast",
".",
"makeText",
"(",
"this",
",",
"\"Payment Successful: \"",
"+",
"razorpayPaymentID",
",",... | The name of the function has to be
onPaymentSuccess
Wrap your code in try catch, as shown, to ensure that this method runs correctly | [
"The",
"name",
"of",
"the",
"function",
"has",
"to",
"be",
"onPaymentSuccess",
"Wrap",
"your",
"code",
"in",
"try",
"catch",
"as",
"shown",
"to",
"ensure",
"that",
"this",
"method",
"runs",
"correctly"
] | d49c0da92e25dde71cc402867f37d51a1e02cf1a | https://github.com/razorpay/razorpay-android-sample-app/blob/d49c0da92e25dde71cc402867f37d51a1e02cf1a/app/src/main/java/com/razorpay/sampleapp/PaymentActivity.java#L77-L85 | train |
razorpay/razorpay-android-sample-app | app/src/main/java/com/razorpay/sampleapp/PaymentActivity.java | PaymentActivity.onPaymentError | @SuppressWarnings("unused")
@Override
public void onPaymentError(int code, String response) {
try {
Toast.makeText(this, "Payment failed: " + code + " " + response, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e(TAG, "Exception in onPaymentError", e);
}... | java | @SuppressWarnings("unused")
@Override
public void onPaymentError(int code, String response) {
try {
Toast.makeText(this, "Payment failed: " + code + " " + response, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e(TAG, "Exception in onPaymentError", e);
}... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"@",
"Override",
"public",
"void",
"onPaymentError",
"(",
"int",
"code",
",",
"String",
"response",
")",
"{",
"try",
"{",
"Toast",
".",
"makeText",
"(",
"this",
",",
"\"Payment failed: \"",
"+",
"code",
"+",
... | The name of the function has to be
onPaymentError
Wrap your code in try catch, as shown, to ensure that this method runs correctly | [
"The",
"name",
"of",
"the",
"function",
"has",
"to",
"be",
"onPaymentError",
"Wrap",
"your",
"code",
"in",
"try",
"catch",
"as",
"shown",
"to",
"ensure",
"that",
"this",
"method",
"runs",
"correctly"
] | d49c0da92e25dde71cc402867f37d51a1e02cf1a | https://github.com/razorpay/razorpay-android-sample-app/blob/d49c0da92e25dde71cc402867f37d51a1e02cf1a/app/src/main/java/com/razorpay/sampleapp/PaymentActivity.java#L92-L100 | train |
zserge/anvil | anvil/src/main/java/trikita/anvil/Anvil.java | Anvil.mount | public static <T extends View> T mount(T v, Renderable r) {
Mount m = new Mount(v, r);
mounts.put(v, m);
render(v);
return v;
} | java | public static <T extends View> T mount(T v, Renderable r) {
Mount m = new Mount(v, r);
mounts.put(v, m);
render(v);
return v;
} | [
"public",
"static",
"<",
"T",
"extends",
"View",
">",
"T",
"mount",
"(",
"T",
"v",
",",
"Renderable",
"r",
")",
"{",
"Mount",
"m",
"=",
"new",
"Mount",
"(",
"v",
",",
"r",
")",
";",
"mounts",
".",
"put",
"(",
"v",
",",
"m",
")",
";",
"render"... | Mounts a renderable function defining the layout into a View. If host is a
viewgroup it is assumed to be empty, so the Renderable would define what
its child views would be.
@param v a View into which the renderable r will be mounted
@param r a Renderable to mount into a View | [
"Mounts",
"a",
"renderable",
"function",
"defining",
"the",
"layout",
"into",
"a",
"View",
".",
"If",
"host",
"is",
"a",
"viewgroup",
"it",
"is",
"assumed",
"to",
"be",
"empty",
"so",
"the",
"Renderable",
"would",
"define",
"what",
"its",
"child",
"views",... | cc0c4a7cb129d7a570c678180ee660a80d652cc6 | https://github.com/zserge/anvil/blob/cc0c4a7cb129d7a570c678180ee660a80d652cc6/anvil/src/main/java/trikita/anvil/Anvil.java#L153-L158 | train |
zserge/anvil | anvil/src/main/java/trikita/anvil/Anvil.java | Anvil.currentView | @SuppressWarnings("unchecked")
public static <T extends View> T currentView() {
if (currentMount == null) {
return null;
}
return (T) currentMount.iterator.currentView();
} | java | @SuppressWarnings("unchecked")
public static <T extends View> T currentView() {
if (currentMount == null) {
return null;
}
return (T) currentMount.iterator.currentView();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"View",
">",
"T",
"currentView",
"(",
")",
"{",
"if",
"(",
"currentMount",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"(",
"T",
")",
"curren... | Returns currently rendered View. It allows to access the real view from
inside the Renderable.
@return currently rendered View | [
"Returns",
"currently",
"rendered",
"View",
".",
"It",
"allows",
"to",
"access",
"the",
"real",
"view",
"from",
"inside",
"the",
"Renderable",
"."
] | cc0c4a7cb129d7a570c678180ee660a80d652cc6 | https://github.com/zserge/anvil/blob/cc0c4a7cb129d7a570c678180ee660a80d652cc6/anvil/src/main/java/trikita/anvil/Anvil.java#L201-L207 | train |
jpmml/jpmml-sklearn | src/main/java/numpy/core/NDArrayUtil.java | NDArrayUtil.getContent | static
public List<?> getContent(NDArray array){
Object content = array.getContent();
return asJavaList(array, (List<?>)content);
} | java | static
public List<?> getContent(NDArray array){
Object content = array.getContent();
return asJavaList(array, (List<?>)content);
} | [
"static",
"public",
"List",
"<",
"?",
">",
"getContent",
"(",
"NDArray",
"array",
")",
"{",
"Object",
"content",
"=",
"array",
".",
"getContent",
"(",
")",
";",
"return",
"asJavaList",
"(",
"array",
",",
"(",
"List",
"<",
"?",
">",
")",
"content",
")... | Gets the payload of a one-dimensional array. | [
"Gets",
"the",
"payload",
"of",
"a",
"one",
"-",
"dimensional",
"array",
"."
] | 6cd8bbd44faa4344857c085defa71d49cb663406 | https://github.com/jpmml/jpmml-sklearn/blob/6cd8bbd44faa4344857c085defa71d49cb663406/src/main/java/numpy/core/NDArrayUtil.java#L59-L64 | train |
jpmml/jpmml-sklearn | src/main/java/numpy/core/NDArrayUtil.java | NDArrayUtil.getContent | static
public List<?> getContent(NDArray array, String key){
Map<String, ?> content = (Map<String, ?>)array.getContent();
return asJavaList(array, (List<?>)content.get(key));
} | java | static
public List<?> getContent(NDArray array, String key){
Map<String, ?> content = (Map<String, ?>)array.getContent();
return asJavaList(array, (List<?>)content.get(key));
} | [
"static",
"public",
"List",
"<",
"?",
">",
"getContent",
"(",
"NDArray",
"array",
",",
"String",
"key",
")",
"{",
"Map",
"<",
"String",
",",
"?",
">",
"content",
"=",
"(",
"Map",
"<",
"String",
",",
"?",
">",
")",
"array",
".",
"getContent",
"(",
... | Gets the payload of the specified dimension of a multi-dimensional array.
@param key The dimension. | [
"Gets",
"the",
"payload",
"of",
"the",
"specified",
"dimension",
"of",
"a",
"multi",
"-",
"dimensional",
"array",
"."
] | 6cd8bbd44faa4344857c085defa71d49cb663406 | https://github.com/jpmml/jpmml-sklearn/blob/6cd8bbd44faa4344857c085defa71d49cb663406/src/main/java/numpy/core/NDArrayUtil.java#L71-L76 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/SelendroidLauncher.java | SelendroidLauncher.launchServer | private void launchServer() {
try {
log.info("Configuring Android SDK");
if (config.getAndroidHome() != null) {
AndroidSdk.setAndroidHome(config.getAndroidHome());
}
if (config.getAndroidSdkVersion() != null) {
AndroidSdk.setAndroidSdkVersion(config.getAndroidSdkVersion());
... | java | private void launchServer() {
try {
log.info("Configuring Android SDK");
if (config.getAndroidHome() != null) {
AndroidSdk.setAndroidHome(config.getAndroidHome());
}
if (config.getAndroidSdkVersion() != null) {
AndroidSdk.setAndroidSdkVersion(config.getAndroidSdkVersion());
... | [
"private",
"void",
"launchServer",
"(",
")",
"{",
"try",
"{",
"log",
".",
"info",
"(",
"\"Configuring Android SDK\"",
")",
";",
"if",
"(",
"config",
".",
"getAndroidHome",
"(",
")",
"!=",
"null",
")",
"{",
"AndroidSdk",
".",
"setAndroidHome",
"(",
"config"... | Starts the Selendroid standalone server and exits immediately.
This method might return before the server is ready to receive requests. | [
"Starts",
"the",
"Selendroid",
"standalone",
"server",
"and",
"exits",
"immediately",
".",
"This",
"method",
"might",
"return",
"before",
"the",
"server",
"is",
"ready",
"to",
"receive",
"requests",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/SelendroidLauncher.java#L67-L110 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/SelendroidLauncher.java | SelendroidLauncher.launchSelendroid | public void launchSelendroid() {
launchServer();
if (config.isGrid()) {
// Longer timeout to allow for grid registration
HttpClientUtil.waitForServer(server.getPort(), 3, TimeUnit.MINUTES);
} else {
HttpClientUtil.waitForServer(server.getPort(), 20, TimeUnit.SECONDS);
}
} | java | public void launchSelendroid() {
launchServer();
if (config.isGrid()) {
// Longer timeout to allow for grid registration
HttpClientUtil.waitForServer(server.getPort(), 3, TimeUnit.MINUTES);
} else {
HttpClientUtil.waitForServer(server.getPort(), 20, TimeUnit.SECONDS);
}
} | [
"public",
"void",
"launchSelendroid",
"(",
")",
"{",
"launchServer",
"(",
")",
";",
"if",
"(",
"config",
".",
"isGrid",
"(",
")",
")",
"{",
"// Longer timeout to allow for grid registration",
"HttpClientUtil",
".",
"waitForServer",
"(",
"server",
".",
"getPort",
... | Starts the Selendroid standalone server and waits until it's ready to accept requests.
@throws io.selendroid.server.common.exceptions.SelendroidException if the server didn't come up | [
"Starts",
"the",
"Selendroid",
"standalone",
"server",
"and",
"waits",
"until",
"it",
"s",
"ready",
"to",
"accept",
"requests",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/SelendroidLauncher.java#L116-L124 | train |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/model/KnownElements.java | KnownElements.get | public AndroidElement get(String elementId) {
AndroidElement element = cache.get(elementId);
if (element instanceof AndroidNativeElement) {
if (!ViewHierarchyAnalyzer.getDefaultInstance().isViewChieldOfCurrentRootView(
((AndroidNativeElement) element).getView())) {
return null;
}
... | java | public AndroidElement get(String elementId) {
AndroidElement element = cache.get(elementId);
if (element instanceof AndroidNativeElement) {
if (!ViewHierarchyAnalyzer.getDefaultInstance().isViewChieldOfCurrentRootView(
((AndroidNativeElement) element).getView())) {
return null;
}
... | [
"public",
"AndroidElement",
"get",
"(",
"String",
"elementId",
")",
"{",
"AndroidElement",
"element",
"=",
"cache",
".",
"get",
"(",
"elementId",
")",
";",
"if",
"(",
"element",
"instanceof",
"AndroidNativeElement",
")",
"{",
"if",
"(",
"!",
"ViewHierarchyAnal... | Uses the generated Id to look up elements | [
"Uses",
"the",
"generated",
"Id",
"to",
"look",
"up",
"elements"
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/model/KnownElements.java#L44-L54 | train |
selendroid/selendroid | selendroid-server-common/src/main/java/io/selendroid/server/common/utils/CallLogUtil.java | CallLogUtil.getAllLogsOfDuration | public static List<CallLogEntry> getAllLogsOfDuration(List<CallLogEntry> logs, int duration, boolean greaterthan) {
List<CallLogEntry> list = new ArrayList<CallLogEntry>();
for(CallLogEntry log : logs) {
if(log.duration<duration ^ greaterthan) {
list.add(log);
}
}
return list;
} | java | public static List<CallLogEntry> getAllLogsOfDuration(List<CallLogEntry> logs, int duration, boolean greaterthan) {
List<CallLogEntry> list = new ArrayList<CallLogEntry>();
for(CallLogEntry log : logs) {
if(log.duration<duration ^ greaterthan) {
list.add(log);
}
}
return list;
} | [
"public",
"static",
"List",
"<",
"CallLogEntry",
">",
"getAllLogsOfDuration",
"(",
"List",
"<",
"CallLogEntry",
">",
"logs",
",",
"int",
"duration",
",",
"boolean",
"greaterthan",
")",
"{",
"List",
"<",
"CallLogEntry",
">",
"list",
"=",
"new",
"ArrayList",
"... | duration specifies call duration to test against.
@param duration
greaterthan set to true finds call durations greater than or equal to specified. false
finds those less than.
@param greaterthan
@return | [
"duration",
"specifies",
"call",
"duration",
"to",
"test",
"against",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server-common/src/main/java/io/selendroid/server/common/utils/CallLogUtil.java#L17-L25 | train |
selendroid/selendroid | selendroid-server-common/src/main/java/io/selendroid/server/common/utils/CallLogUtil.java | CallLogUtil.containsLogFromNumber | public static boolean containsLogFromNumber(List<CallLogEntry> logs, String number) {
for(CallLogEntry log : logs) {
if(log.number.equals(number)) {
return true;
}
}
return false;
} | java | public static boolean containsLogFromNumber(List<CallLogEntry> logs, String number) {
for(CallLogEntry log : logs) {
if(log.number.equals(number)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"containsLogFromNumber",
"(",
"List",
"<",
"CallLogEntry",
">",
"logs",
",",
"String",
"number",
")",
"{",
"for",
"(",
"CallLogEntry",
"log",
":",
"logs",
")",
"{",
"if",
"(",
"log",
".",
"number",
".",
"equals",
"(",
"numb... | returns true if call log of specified number exists | [
"returns",
"true",
"if",
"call",
"log",
"of",
"specified",
"number",
"exists"
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server-common/src/main/java/io/selendroid/server/common/utils/CallLogUtil.java#L30-L37 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/builder/SelendroidServerBuilder.java | SelendroidServerBuilder.getResourceAsStream | private InputStream getResourceAsStream(String resource) {
InputStream is = getClass().getResourceAsStream(resource);
// switch needed for testability
if (is == null) {
try {
is = new FileInputStream(new File(resource));
} catch (FileNotFoundException e) {
// do nothing
}
... | java | private InputStream getResourceAsStream(String resource) {
InputStream is = getClass().getResourceAsStream(resource);
// switch needed for testability
if (is == null) {
try {
is = new FileInputStream(new File(resource));
} catch (FileNotFoundException e) {
// do nothing
}
... | [
"private",
"InputStream",
"getResourceAsStream",
"(",
"String",
"resource",
")",
"{",
"InputStream",
"is",
"=",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"resource",
")",
";",
"// switch needed for testability",
"if",
"(",
"is",
"==",
"null",
")",
"... | Loads resources as stream and the main reason for having the method is because it can be use
while testing and in production for loading files from within jar file.
@param resource The resource to load.
@return The input stream of the resource.
@throws SelendroidException if resource was not found. | [
"Loads",
"resources",
"as",
"stream",
"and",
"the",
"main",
"reason",
"for",
"having",
"the",
"method",
"is",
"because",
"it",
"can",
"be",
"use",
"while",
"testing",
"and",
"in",
"production",
"for",
"loading",
"files",
"from",
"within",
"jar",
"file",
".... | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/builder/SelendroidServerBuilder.java#L361-L375 | train |
selendroid/selendroid | selendroid-client/src/main/java/io/selendroid/client/SelendroidDriver.java | SelendroidDriver.setSystemProperty | @Override
public void setSystemProperty(String propertyName, String value) {
if (Strings.isNullOrEmpty(propertyName)) {
throw new IllegalArgumentException("Property name can't be empty.");
}
execute(
"-selendroid-setAndroidOsSystemProperty",
ImmutableMap.of(
"propertyNam... | java | @Override
public void setSystemProperty(String propertyName, String value) {
if (Strings.isNullOrEmpty(propertyName)) {
throw new IllegalArgumentException("Property name can't be empty.");
}
execute(
"-selendroid-setAndroidOsSystemProperty",
ImmutableMap.of(
"propertyNam... | [
"@",
"Override",
"public",
"void",
"setSystemProperty",
"(",
"String",
"propertyName",
",",
"String",
"value",
")",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"propertyName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Property ... | Sets a Java System Property. | [
"Sets",
"a",
"Java",
"System",
"Property",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-client/src/main/java/io/selendroid/client/SelendroidDriver.java#L268-L279 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/server/grid/SelfRegisteringRemote.java | SelfRegisteringRemote.getNodeConfig | private JSONObject getNodeConfig() {
JSONObject res = new JSONObject();
try {
res.put("class", "org.openqa.grid.common.RegistrationRequest");
res.put("configuration", getConfiguration());
JSONArray caps = new JSONArray();
JSONArray devices = driver.getSupportedDevices();
for (int i... | java | private JSONObject getNodeConfig() {
JSONObject res = new JSONObject();
try {
res.put("class", "org.openqa.grid.common.RegistrationRequest");
res.put("configuration", getConfiguration());
JSONArray caps = new JSONArray();
JSONArray devices = driver.getSupportedDevices();
for (int i... | [
"private",
"JSONObject",
"getNodeConfig",
"(",
")",
"{",
"JSONObject",
"res",
"=",
"new",
"JSONObject",
"(",
")",
";",
"try",
"{",
"res",
".",
"put",
"(",
"\"class\"",
",",
"\"org.openqa.grid.common.RegistrationRequest\"",
")",
";",
"res",
".",
"put",
"(",
"... | Get the node configuration and capabilities for Grid registration
@return The configuration | [
"Get",
"the",
"node",
"configuration",
"and",
"capabilities",
"for",
"Grid",
"registration"
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/server/grid/SelfRegisteringRemote.java#L97-L115 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/server/grid/SelfRegisteringRemote.java | SelfRegisteringRemote.getConfiguration | private JSONObject getConfiguration() throws JSONException {
JSONObject configuration = new JSONObject();
configuration.put("port", config.getPort());
configuration.put("register", true);
if (config.getProxy() != null) {
configuration.put("proxy", config.getProxy());
} else {
configura... | java | private JSONObject getConfiguration() throws JSONException {
JSONObject configuration = new JSONObject();
configuration.put("port", config.getPort());
configuration.put("register", true);
if (config.getProxy() != null) {
configuration.put("proxy", config.getProxy());
} else {
configura... | [
"private",
"JSONObject",
"getConfiguration",
"(",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"configuration",
"=",
"new",
"JSONObject",
"(",
")",
";",
"configuration",
".",
"put",
"(",
"\"port\"",
",",
"config",
".",
"getPort",
"(",
")",
")",
";",
"c... | Extracts the configuration.
@return The configuration
@throws JSONException On JSON errors. | [
"Extracts",
"the",
"configuration",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/server/grid/SelfRegisteringRemote.java#L142-L177 | train |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/DefaultServerInstrumentation.java | DefaultServerInstrumentation.startServerImpl | protected void startServerImpl() {
SelendroidLogger.info("*** ServerInstrumentation#startServerImpl() ***");
if (serverThread != null && serverThread.isAlive()) {
return;
}
if (serverThread != null) {
stopServer();
}
serverThread = new HttpdThrea... | java | protected void startServerImpl() {
SelendroidLogger.info("*** ServerInstrumentation#startServerImpl() ***");
if (serverThread != null && serverThread.isAlive()) {
return;
}
if (serverThread != null) {
stopServer();
}
serverThread = new HttpdThrea... | [
"protected",
"void",
"startServerImpl",
"(",
")",
"{",
"SelendroidLogger",
".",
"info",
"(",
"\"*** ServerInstrumentation#startServerImpl() ***\"",
")",
";",
"if",
"(",
"serverThread",
"!=",
"null",
"&&",
"serverThread",
".",
"isAlive",
"(",
")",
")",
"{",
"return... | specific logic to a subclass | [
"specific",
"logic",
"to",
"a",
"subclass"
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/DefaultServerInstrumentation.java#L174-L186 | train |
selendroid/selendroid | selendroid-client/src/main/java/io/selendroid/client/TouchActionBuilder.java | TouchActionBuilder.pointerDown | public TouchActionBuilder pointerDown(WebElement element, int x, int y) {
Preconditions.checkState(!isDown);
Map<String, Object> params = getTouchParameters(element, x, y);
addAction(TouchActionName.POINTER_DOWN, params);
isDown = true;
return this;
} | java | public TouchActionBuilder pointerDown(WebElement element, int x, int y) {
Preconditions.checkState(!isDown);
Map<String, Object> params = getTouchParameters(element, x, y);
addAction(TouchActionName.POINTER_DOWN, params);
isDown = true;
return this;
} | [
"public",
"TouchActionBuilder",
"pointerDown",
"(",
"WebElement",
"element",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"isDown",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"getTouchPar... | Places pointer down at an offset from the top left corner of the specified WebElement
@param element WebElement to place pointer relative to
@param x x-offset from top left
@param y y-offset from top left
@return this | [
"Places",
"pointer",
"down",
"at",
"an",
"offset",
"from",
"the",
"top",
"left",
"corner",
"of",
"the",
"specified",
"WebElement"
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-client/src/main/java/io/selendroid/client/TouchActionBuilder.java#L86-L94 | train |
selendroid/selendroid | selendroid-client/src/main/java/io/selendroid/client/TouchActionBuilder.java | TouchActionBuilder.pointerMove | public TouchActionBuilder pointerMove(WebElement element, int x, int y) {
Preconditions.checkState(isDown);
Map<String, Object> params = getTouchParameters(element, x, y);
addAction(TouchActionName.POINTER_MOVE, params);
return this;
} | java | public TouchActionBuilder pointerMove(WebElement element, int x, int y) {
Preconditions.checkState(isDown);
Map<String, Object> params = getTouchParameters(element, x, y);
addAction(TouchActionName.POINTER_MOVE, params);
return this;
} | [
"public",
"TouchActionBuilder",
"pointerMove",
"(",
"WebElement",
"element",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"isDown",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"getTouchParameters... | Moves the pointer to a position offset from the top left corner of the specified WebElement
This is only possible if the pointer is currently down.
@param element WebElement to place pointer relative to
@param x x-offset from top left
@param y y-offset from top left
@return this | [
"Moves",
"the",
"pointer",
"to",
"a",
"position",
"offset",
"from",
"the",
"top",
"left",
"corner",
"of",
"the",
"specified",
"WebElement",
"This",
"is",
"only",
"possible",
"if",
"the",
"pointer",
"is",
"currently",
"down",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-client/src/main/java/io/selendroid/client/TouchActionBuilder.java#L137-L143 | train |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/android/AndroidWait.java | AndroidWait.sleep | protected void sleep() {
try {
Thread.sleep(sleepIntervalInMillis);
} catch (InterruptedException exception) {
Thread.currentThread().interrupt();
throw new SelendroidException(exception);
}
} | java | protected void sleep() {
try {
Thread.sleep(sleepIntervalInMillis);
} catch (InterruptedException exception) {
Thread.currentThread().interrupt();
throw new SelendroidException(exception);
}
} | [
"protected",
"void",
"sleep",
"(",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"sleepIntervalInMillis",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"exception",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",... | Sleeps for a few milliseconds. | [
"Sleeps",
"for",
"a",
"few",
"milliseconds",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/android/AndroidWait.java#L85-L92 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/SelendroidStandaloneDriver.java | SelendroidStandaloneDriver.addToAppsStore | public void addToAppsStore(File file) throws AndroidSdkException {
AndroidApp app = null;
try {
app = selendroidApkBuilder.resignApp(file);
} catch (Exception e) {
throw new SessionNotCreatedException(
"An error occurred while resigning the app '" + file.getName()
+ "'. "... | java | public void addToAppsStore(File file) throws AndroidSdkException {
AndroidApp app = null;
try {
app = selendroidApkBuilder.resignApp(file);
} catch (Exception e) {
throw new SessionNotCreatedException(
"An error occurred while resigning the app '" + file.getName()
+ "'. "... | [
"public",
"void",
"addToAppsStore",
"(",
"File",
"file",
")",
"throws",
"AndroidSdkException",
"{",
"AndroidApp",
"app",
"=",
"null",
";",
"try",
"{",
"app",
"=",
"selendroidApkBuilder",
".",
"resignApp",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"Exception"... | This function will sign an android app and add it to the App Store. The function is made public because it also be
invoked by the Folder Monitor each time a new application dropped into this folder.
@param file
- The file to be added to the app store
@throws AndroidSdkException | [
"This",
"function",
"will",
"sign",
"an",
"android",
"app",
"and",
"add",
"it",
"to",
"the",
"App",
"Store",
".",
"The",
"function",
"is",
"made",
"public",
"because",
"it",
"also",
"be",
"invoked",
"by",
"the",
"Folder",
"Monitor",
"each",
"time",
"a",
... | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/SelendroidStandaloneDriver.java#L130-L153 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/SelendroidStandaloneDriver.java | SelendroidStandaloneDriver.startFolderMonitor | private void startFolderMonitor() {
if (serverConfiguration.getAppFolderToMonitor() != null) {
try {
folderMonitor = new FolderMonitor(this, serverConfiguration);
folderMonitor.start();
} catch (IOException e) {
log.warning("Could not monitor the given folder: "
+ ser... | java | private void startFolderMonitor() {
if (serverConfiguration.getAppFolderToMonitor() != null) {
try {
folderMonitor = new FolderMonitor(this, serverConfiguration);
folderMonitor.start();
} catch (IOException e) {
log.warning("Could not monitor the given folder: "
+ ser... | [
"private",
"void",
"startFolderMonitor",
"(",
")",
"{",
"if",
"(",
"serverConfiguration",
".",
"getAppFolderToMonitor",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"folderMonitor",
"=",
"new",
"FolderMonitor",
"(",
"this",
",",
"serverConfiguration",
")",
";... | Applications folder. | [
"Applications",
"folder",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/SelendroidStandaloneDriver.java#L535-L545 | train |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/InstrumentationArguments.java | InstrumentationArguments.readFile | private String readFile(File file) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String line = null;
StringBuilder sb = new StringBuilder();
String separator = System.getProperty("line.separator");
while ((line = reader.readLine()) != null... | java | private String readFile(File file) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String line = null;
StringBuilder sb = new StringBuilder();
String separator = System.getProperty("line.separator");
while ((line = reader.readLine()) != null... | [
"private",
"String",
"readFile",
"(",
"File",
"file",
")",
"{",
"BufferedReader",
"reader",
"=",
"null",
";",
"try",
"{",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"file",
")",
")",
";",
"String",
"line",
"=",
"null",
";",
... | There's no nio on Android and it's not worth importing Apache commons | [
"There",
"s",
"no",
"nio",
"on",
"Android",
"and",
"it",
"s",
"not",
"worth",
"importing",
"Apache",
"commons"
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/InstrumentationArguments.java#L76-L107 | train |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/util/Intents.java | Intents.createStartActivityIntent | public static Intent createStartActivityIntent(Context context, String mainActivityName) {
Intent intent = new Intent();
intent.setClassName(context, mainActivityName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
| Intent.FLAG_ACTIVITY_SI... | java | public static Intent createStartActivityIntent(Context context, String mainActivityName) {
Intent intent = new Intent();
intent.setClassName(context, mainActivityName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
| Intent.FLAG_ACTIVITY_SI... | [
"public",
"static",
"Intent",
"createStartActivityIntent",
"(",
"Context",
"context",
",",
"String",
"mainActivityName",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
")",
";",
"intent",
".",
"setClassName",
"(",
"context",
",",
"mainActivityName",
")... | Create an intent to start an activity, for both ServerInstrumentation and LightweightInstrumentation | [
"Create",
"an",
"intent",
"to",
"start",
"an",
"activity",
"for",
"both",
"ServerInstrumentation",
"and",
"LightweightInstrumentation"
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/util/Intents.java#L14-L22 | train |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/util/Intents.java | Intents.createUriIntent | public static Intent createUriIntent(String intentAction, String intentUri) {
if (intentAction == null) {
intentAction = Intent.ACTION_VIEW;
}
return new Intent(intentAction, Uri.parse(intentUri))
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_... | java | public static Intent createUriIntent(String intentAction, String intentUri) {
if (intentAction == null) {
intentAction = Intent.ACTION_VIEW;
}
return new Intent(intentAction, Uri.parse(intentUri))
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_... | [
"public",
"static",
"Intent",
"createUriIntent",
"(",
"String",
"intentAction",
",",
"String",
"intentUri",
")",
"{",
"if",
"(",
"intentAction",
"==",
"null",
")",
"{",
"intentAction",
"=",
"Intent",
".",
"ACTION_VIEW",
";",
"}",
"return",
"new",
"Intent",
"... | Create an implicit intent based on the given URI. | [
"Create",
"an",
"implicit",
"intent",
"based",
"on",
"the",
"given",
"URI",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/util/Intents.java#L27-L34 | train |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/util/Intents.java | Intents.createStartServiceIntent | public static Intent createStartServiceIntent(
Context context, String serviceClassName, String intentAction) {
Intent intent = intentAction != null ? new Intent(intentAction) : new Intent();
return intent.setClassName(context, serviceClassName);
} | java | public static Intent createStartServiceIntent(
Context context, String serviceClassName, String intentAction) {
Intent intent = intentAction != null ? new Intent(intentAction) : new Intent();
return intent.setClassName(context, serviceClassName);
} | [
"public",
"static",
"Intent",
"createStartServiceIntent",
"(",
"Context",
"context",
",",
"String",
"serviceClassName",
",",
"String",
"intentAction",
")",
"{",
"Intent",
"intent",
"=",
"intentAction",
"!=",
"null",
"?",
"new",
"Intent",
"(",
"intentAction",
")",
... | Create an Intent to start a service using the given class name and action. | [
"Create",
"an",
"Intent",
"to",
"start",
"a",
"service",
"using",
"the",
"given",
"class",
"name",
"and",
"action",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/util/Intents.java#L39-L43 | train |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/model/SessionCookieManager.java | SessionCookieManager.getDomainsFromUrl | private List<String> getDomainsFromUrl(URL url) {
String host = url.getHost();
String[] paths = new String[] {};
if (url.getPath() != null) {
paths = url.getPath().split("/");
}
List<String> domains = new ArrayList<String>(paths.length + 1);
StringBuilder rela... | java | private List<String> getDomainsFromUrl(URL url) {
String host = url.getHost();
String[] paths = new String[] {};
if (url.getPath() != null) {
paths = url.getPath().split("/");
}
List<String> domains = new ArrayList<String>(paths.length + 1);
StringBuilder rela... | [
"private",
"List",
"<",
"String",
">",
"getDomainsFromUrl",
"(",
"URL",
"url",
")",
"{",
"String",
"host",
"=",
"url",
".",
"getHost",
"(",
")",
";",
"String",
"[",
"]",
"paths",
"=",
"new",
"String",
"[",
"]",
"{",
"}",
";",
"if",
"(",
"url",
".... | Gets the list of domains associated to a URL.
@param url
@return List of domains as strings | [
"Gets",
"the",
"list",
"of",
"domains",
"associated",
"to",
"a",
"URL",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/model/SessionCookieManager.java#L95-L111 | train |
selendroid/selendroid | selendroid-server-common/src/main/java/io/selendroid/server/common/SelendroidResponse.java | SelendroidResponse.forCatchAllError | public static SelendroidResponse forCatchAllError(String sessionId, Throwable e) {
try {
return new SelendroidResponse(sessionId, StatusCode.UNKNOWN_ERROR.getCode(), e, CATCH_ALL_ERROR_MESSAGE_PREFIX);
} catch (JSONException err) {
return new SelendroidResponse(sessionId, StatusCode.UNKNOWN_ERROR.ge... | java | public static SelendroidResponse forCatchAllError(String sessionId, Throwable e) {
try {
return new SelendroidResponse(sessionId, StatusCode.UNKNOWN_ERROR.getCode(), e, CATCH_ALL_ERROR_MESSAGE_PREFIX);
} catch (JSONException err) {
return new SelendroidResponse(sessionId, StatusCode.UNKNOWN_ERROR.ge... | [
"public",
"static",
"SelendroidResponse",
"forCatchAllError",
"(",
"String",
"sessionId",
",",
"Throwable",
"e",
")",
"{",
"try",
"{",
"return",
"new",
"SelendroidResponse",
"(",
"sessionId",
",",
"StatusCode",
".",
"UNKNOWN_ERROR",
".",
"getCode",
"(",
")",
","... | It is currently hard to detect whether a test failed because of a legitimate
error by a developer or because something is going wrong in selendroid
internals. This response marks error responses from the server that indicate
something has gone wrong in the internals of selendroid. | [
"It",
"is",
"currently",
"hard",
"to",
"detect",
"whether",
"a",
"test",
"failed",
"because",
"of",
"a",
"legitimate",
"error",
"by",
"a",
"developer",
"or",
"because",
"something",
"is",
"going",
"wrong",
"in",
"selendroid",
"internals",
".",
"This",
"respo... | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server-common/src/main/java/io/selendroid/server/common/SelendroidResponse.java#L76-L82 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/DeviceStore.java | DeviceStore.release | public void release(AndroidDevice device, AndroidApp aut) {
log.info("Releasing device " + device);
if (devicesInUse.contains(device)) {
if (aut != null) {
// stop the app anyway - better in case people do use snapshots
try {
device.kill(aut);
} catch (Exception e) {
... | java | public void release(AndroidDevice device, AndroidApp aut) {
log.info("Releasing device " + device);
if (devicesInUse.contains(device)) {
if (aut != null) {
// stop the app anyway - better in case people do use snapshots
try {
device.kill(aut);
} catch (Exception e) {
... | [
"public",
"void",
"release",
"(",
"AndroidDevice",
"device",
",",
"AndroidApp",
"aut",
")",
"{",
"log",
".",
"info",
"(",
"\"Releasing device \"",
"+",
"device",
")",
";",
"if",
"(",
"devicesInUse",
".",
"contains",
"(",
"device",
")",
")",
"{",
"if",
"(... | After a test session a device should be released. That means id will be removed from the list
of devices in use and in case of an emulator it will be stopped.
@param device The device to release
@see {@link #findAndroidDevice(SelendroidCapabilities)} | [
"After",
"a",
"test",
"session",
"a",
"device",
"should",
"be",
"released",
".",
"That",
"means",
"id",
"will",
"be",
"removed",
"from",
"the",
"list",
"of",
"devices",
"in",
"use",
"and",
"in",
"case",
"of",
"an",
"emulator",
"it",
"will",
"be",
"stop... | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/DeviceStore.java#L85-L117 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/DeviceStore.java | DeviceStore.addDeviceToStore | protected synchronized void addDeviceToStore(AndroidDevice device) throws AndroidDeviceException {
if (androidDevices.containsKey(device.getTargetPlatform())) {
List<AndroidDevice> platformDevices = androidDevices.get(device.getTargetPlatform());
if (!platformDevices.contains(device)) {
platform... | java | protected synchronized void addDeviceToStore(AndroidDevice device) throws AndroidDeviceException {
if (androidDevices.containsKey(device.getTargetPlatform())) {
List<AndroidDevice> platformDevices = androidDevices.get(device.getTargetPlatform());
if (!platformDevices.contains(device)) {
platform... | [
"protected",
"synchronized",
"void",
"addDeviceToStore",
"(",
"AndroidDevice",
"device",
")",
"throws",
"AndroidDeviceException",
"{",
"if",
"(",
"androidDevices",
".",
"containsKey",
"(",
"device",
".",
"getTargetPlatform",
"(",
")",
")",
")",
"{",
"List",
"<",
... | Internal method to add an actual device to the store.
@param device The device to add.
@throws AndroidDeviceException | [
"Internal",
"method",
"to",
"add",
"an",
"actual",
"device",
"to",
"the",
"store",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/DeviceStore.java#L186-L195 | train |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/android/WebViewKeySender.java | WebViewKeySender.send | @Override
public void send(final CharSequence text) {
final KeyCharacterMap characterMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
long timeout =
System.currentTimeMillis()
+ serverInstrumentation.getAndroidWait().getTimeoutInMillis();
SelendroidLogger.info("Using time... | java | @Override
public void send(final CharSequence text) {
final KeyCharacterMap characterMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
long timeout =
System.currentTimeMillis()
+ serverInstrumentation.getAndroidWait().getTimeoutInMillis();
SelendroidLogger.info("Using time... | [
"@",
"Override",
"public",
"void",
"send",
"(",
"final",
"CharSequence",
"text",
")",
"{",
"final",
"KeyCharacterMap",
"characterMap",
"=",
"KeyCharacterMap",
".",
"load",
"(",
"KeyCharacterMap",
".",
"VIRTUAL_KEYBOARD",
")",
";",
"long",
"timeout",
"=",
"System... | Sends key strokes to the given text to the element in focus within the webview.
Note: This assumes that the focus has been set before on the element at sake.
@param text | [
"Sends",
"key",
"strokes",
"to",
"the",
"given",
"text",
"to",
"the",
"element",
"in",
"focus",
"within",
"the",
"webview",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/android/WebViewKeySender.java#L28-L59 | train |
selendroid/selendroid | selendroid-common/src/main/java/io/selendroid/common/SelendroidCapabilities.java | SelendroidCapabilities.addBootstrapClass | public SelendroidCapabilities addBootstrapClass(String className) {
String currentClassNames = getBootstrapClassNames();
if (currentClassNames == null || currentClassNames.isEmpty()) {
setCapability(BOOTSTRAP_CLASS_NAMES, className);
} else {
setCapability(BOOTSTRAP_CLASS_NAMES, currentClassName... | java | public SelendroidCapabilities addBootstrapClass(String className) {
String currentClassNames = getBootstrapClassNames();
if (currentClassNames == null || currentClassNames.isEmpty()) {
setCapability(BOOTSTRAP_CLASS_NAMES, className);
} else {
setCapability(BOOTSTRAP_CLASS_NAMES, currentClassName... | [
"public",
"SelendroidCapabilities",
"addBootstrapClass",
"(",
"String",
"className",
")",
"{",
"String",
"currentClassNames",
"=",
"getBootstrapClassNames",
"(",
")",
";",
"if",
"(",
"currentClassNames",
"==",
"null",
"||",
"currentClassNames",
".",
"isEmpty",
"(",
... | Adds a class to run on app startup. Class names are stored as a string separated by commas. | [
"Adds",
"a",
"class",
"to",
"run",
"on",
"app",
"startup",
".",
"Class",
"names",
"are",
"stored",
"as",
"a",
"string",
"separated",
"by",
"commas",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-common/src/main/java/io/selendroid/common/SelendroidCapabilities.java#L286-L294 | train |
selendroid/selendroid | selendroid-common/src/main/java/io/selendroid/common/SelendroidCapabilities.java | SelendroidCapabilities.getDefaultVersion | private String getDefaultVersion(Set<String> keys, String appName) {
SortedSet<String> listOfApps = new TreeSet<String>();
for (String key : keys) {
if (key.split(":")[0].contentEquals(appName)) {
listOfApps.add(key);
}
}
return listOfApps.size() > 0 ? listOfApps.last() : null;
} | java | private String getDefaultVersion(Set<String> keys, String appName) {
SortedSet<String> listOfApps = new TreeSet<String>();
for (String key : keys) {
if (key.split(":")[0].contentEquals(appName)) {
listOfApps.add(key);
}
}
return listOfApps.size() > 0 ? listOfApps.last() : null;
} | [
"private",
"String",
"getDefaultVersion",
"(",
"Set",
"<",
"String",
">",
"keys",
",",
"String",
"appName",
")",
"{",
"SortedSet",
"<",
"String",
">",
"listOfApps",
"=",
"new",
"TreeSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"String",
"key",
... | the latest version of the app. | [
"the",
"latest",
"version",
"of",
"the",
"app",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-common/src/main/java/io/selendroid/common/SelendroidCapabilities.java#L475-L483 | train |
selendroid/selendroid | selendroid-common/src/main/java/io/selendroid/common/SelendroidCapabilities.java | SelendroidCapabilities.getBooleanCapability | private Boolean getBooleanCapability(String key) {
Object o = getRawCapabilities().get(key);
if (o == null) {
return null;
} else if (o instanceof Boolean) {
return (Boolean) o;
} else if (o instanceof String
&& ("true".equalsIgnoreCase((String) o)
|| "false".equalsIg... | java | private Boolean getBooleanCapability(String key) {
Object o = getRawCapabilities().get(key);
if (o == null) {
return null;
} else if (o instanceof Boolean) {
return (Boolean) o;
} else if (o instanceof String
&& ("true".equalsIgnoreCase((String) o)
|| "false".equalsIg... | [
"private",
"Boolean",
"getBooleanCapability",
"(",
"String",
"key",
")",
"{",
"Object",
"o",
"=",
"getRawCapabilities",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",... | throws exception if user didn't pass the capability as a boolean or String parsable as boolean | [
"throws",
"exception",
"if",
"user",
"didn",
"t",
"pass",
"the",
"capability",
"as",
"a",
"boolean",
"or",
"String",
"parsable",
"as",
"boolean"
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-common/src/main/java/io/selendroid/common/SelendroidCapabilities.java#L486-L501 | train |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/model/AndroidWebElement.java | AndroidWebElement.getLocation | public Point getLocation() {
JSONObject result =
(JSONObject) driver.executeAtom(AndroidAtoms.GET_TOP_LEFT_COORDINATES, null, this);
try {
return new Point(result.getInt("x"), result.getInt("y"));
} catch (JSONException e) {
throw new SelendroidException(e);
}
} | java | public Point getLocation() {
JSONObject result =
(JSONObject) driver.executeAtom(AndroidAtoms.GET_TOP_LEFT_COORDINATES, null, this);
try {
return new Point(result.getInt("x"), result.getInt("y"));
} catch (JSONException e) {
throw new SelendroidException(e);
}
} | [
"public",
"Point",
"getLocation",
"(",
")",
"{",
"JSONObject",
"result",
"=",
"(",
"JSONObject",
")",
"driver",
".",
"executeAtom",
"(",
"AndroidAtoms",
".",
"GET_TOP_LEFT_COORDINATES",
",",
"null",
",",
"this",
")",
";",
"try",
"{",
"return",
"new",
"Point"... | Where on the page is the top left-hand corner of the rendered element? it's part of
RenderedWebElement
@return A point, containing the location of the top left-hand corner of the element | [
"Where",
"on",
"the",
"page",
"is",
"the",
"top",
"left",
"-",
"hand",
"corner",
"of",
"the",
"rendered",
"element?",
"it",
"s",
"part",
"of",
"RenderedWebElement"
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/model/AndroidWebElement.java#L182-L191 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/android/impl/DefaultDeviceManager.java | DefaultDeviceManager.initializeAdbConnection | protected void initializeAdbConnection() {
// Get a device bridge instance. Initialize, create and restart.
try {
AndroidDebugBridge.init(false);
} catch (IllegalStateException e) {
if (!shouldKeepAdbAlive) {
log.log(
Level.WARNING,
"AndroidDebugBridge may have be... | java | protected void initializeAdbConnection() {
// Get a device bridge instance. Initialize, create and restart.
try {
AndroidDebugBridge.init(false);
} catch (IllegalStateException e) {
if (!shouldKeepAdbAlive) {
log.log(
Level.WARNING,
"AndroidDebugBridge may have be... | [
"protected",
"void",
"initializeAdbConnection",
"(",
")",
"{",
"// Get a device bridge instance. Initialize, create and restart.",
"try",
"{",
"AndroidDebugBridge",
".",
"init",
"(",
"false",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"if",
"... | Initializes the AndroidDebugBridge and registers the DefaultHardwareDeviceManager with the
AndroidDebugBridge device change listener. | [
"Initializes",
"the",
"AndroidDebugBridge",
"and",
"registers",
"the",
"DefaultHardwareDeviceManager",
"with",
"the",
"AndroidDebugBridge",
"device",
"change",
"listener",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/android/impl/DefaultDeviceManager.java#L51-L96 | train |
selendroid/selendroid | selendroid-standalone/src/main/java/io/selendroid/standalone/android/impl/DefaultDeviceManager.java | DefaultDeviceManager.shutdown | public void shutdown() {
log.info("Notifying device listener about shutdown");
for (HardwareDeviceListener listener : deviceListeners) {
for (AndroidDevice device : connectedDevices.values()) {
listener.onDeviceDisconnected(connectedDevices.get(device));
}
}
log.info("Removing Device... | java | public void shutdown() {
log.info("Notifying device listener about shutdown");
for (HardwareDeviceListener listener : deviceListeners) {
for (AndroidDevice device : connectedDevices.values()) {
listener.onDeviceDisconnected(connectedDevices.get(device));
}
}
log.info("Removing Device... | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"log",
".",
"info",
"(",
"\"Notifying device listener about shutdown\"",
")",
";",
"for",
"(",
"HardwareDeviceListener",
"listener",
":",
"deviceListeners",
")",
"{",
"for",
"(",
"AndroidDevice",
"device",
":",
"connect... | Shutdown the AndroidDebugBridge and clean up all connected devices. | [
"Shutdown",
"the",
"AndroidDebugBridge",
"and",
"clean",
"up",
"all",
"connected",
"devices",
"."
] | a32c1a96c973b80c14a588b1075f084201f7fe94 | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/android/impl/DefaultDeviceManager.java#L101-L116 | train |
lopspower/CircularProgressBar | circularprogressbar/src/main/java/com/mikhaellopez/circularprogressbar/CircularProgressBar.java | CircularProgressBar.onDraw | @Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawOval(rectF, backgroundPaint);
float realProgress = progress * DEFAULT_MAX_VALUE / progressMax;
float angle = (rightToLeft ? 360 : -360) * realProgress / 100;
canvas.drawArc(rectF, startAngle, an... | java | @Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawOval(rectF, backgroundPaint);
float realProgress = progress * DEFAULT_MAX_VALUE / progressMax;
float angle = (rightToLeft ? 360 : -360) * realProgress / 100;
canvas.drawArc(rectF, startAngle, an... | [
"@",
"Override",
"protected",
"void",
"onDraw",
"(",
"Canvas",
"canvas",
")",
"{",
"super",
".",
"onDraw",
"(",
"canvas",
")",
";",
"canvas",
".",
"drawOval",
"(",
"rectF",
",",
"backgroundPaint",
")",
";",
"float",
"realProgress",
"=",
"progress",
"*",
... | region Draw Method | [
"region",
"Draw",
"Method"
] | a805979677f76f6a441dfca2f85f3b01ae6a3e18 | https://github.com/lopspower/CircularProgressBar/blob/a805979677f76f6a441dfca2f85f3b01ae6a3e18/circularprogressbar/src/main/java/com/mikhaellopez/circularprogressbar/CircularProgressBar.java#L98-L105 | train |
lopspower/CircularProgressBar | circularprogressbar/src/main/java/com/mikhaellopez/circularprogressbar/CircularProgressBar.java | CircularProgressBar.onMeasure | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int height = getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec);
final int width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);
final int min = Math.min(width, height);
... | java | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int height = getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec);
final int width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);
final int min = Math.min(width, height);
... | [
"@",
"Override",
"protected",
"void",
"onMeasure",
"(",
"int",
"widthMeasureSpec",
",",
"int",
"heightMeasureSpec",
")",
"{",
"final",
"int",
"height",
"=",
"getDefaultSize",
"(",
"getSuggestedMinimumHeight",
"(",
")",
",",
"heightMeasureSpec",
")",
";",
"final",
... | region Mesure Method | [
"region",
"Mesure",
"Method"
] | a805979677f76f6a441dfca2f85f3b01ae6a3e18 | https://github.com/lopspower/CircularProgressBar/blob/a805979677f76f6a441dfca2f85f3b01ae6a3e18/circularprogressbar/src/main/java/com/mikhaellopez/circularprogressbar/CircularProgressBar.java#L114-L122 | train |
lopspower/CircularProgressBar | circularprogressbar/src/main/java/com/mikhaellopez/circularprogressbar/CircularProgressBar.java | CircularProgressBar.setProgressWithAnimation | public void setProgressWithAnimation(float progress, int duration) {
if (progressAnimator != null) {
progressAnimator.cancel();
}
progressAnimator = ValueAnimator.ofFloat(this.progress, progress);
progressAnimator.setDuration(duration);
progressAnimator.addUpdateListe... | java | public void setProgressWithAnimation(float progress, int duration) {
if (progressAnimator != null) {
progressAnimator.cancel();
}
progressAnimator = ValueAnimator.ofFloat(this.progress, progress);
progressAnimator.setDuration(duration);
progressAnimator.addUpdateListe... | [
"public",
"void",
"setProgressWithAnimation",
"(",
"float",
"progress",
",",
"int",
"duration",
")",
"{",
"if",
"(",
"progressAnimator",
"!=",
"null",
")",
"{",
"progressAnimator",
".",
"cancel",
"(",
")",
";",
"}",
"progressAnimator",
"=",
"ValueAnimator",
".... | Set the progress with an animation.
@param progress The progress it should animate to it.
@param duration The length of the animation, in milliseconds. | [
"Set",
"the",
"progress",
"with",
"an",
"animation",
"."
] | a805979677f76f6a441dfca2f85f3b01ae6a3e18 | https://github.com/lopspower/CircularProgressBar/blob/a805979677f76f6a441dfca2f85f3b01ae6a3e18/circularprogressbar/src/main/java/com/mikhaellopez/circularprogressbar/CircularProgressBar.java#L211-L229 | train |
lopspower/CircularProgressBar | circularprogressbar-example/src/main/java/com/mikhaellopez/circularprogressbarsample/MainActivity.java | MainActivity.adjustAlpha | private int adjustAlpha(int color, float factor) {
int alpha = Math.round(Color.alpha(color) * factor);
int red = Color.red(color);
int green = Color.green(color);
int blue = Color.blue(color);
return Color.argb(alpha, red, green, blue);
} | java | private int adjustAlpha(int color, float factor) {
int alpha = Math.round(Color.alpha(color) * factor);
int red = Color.red(color);
int green = Color.green(color);
int blue = Color.blue(color);
return Color.argb(alpha, red, green, blue);
} | [
"private",
"int",
"adjustAlpha",
"(",
"int",
"color",
",",
"float",
"factor",
")",
"{",
"int",
"alpha",
"=",
"Math",
".",
"round",
"(",
"Color",
".",
"alpha",
"(",
"color",
")",
"*",
"factor",
")",
";",
"int",
"red",
"=",
"Color",
".",
"red",
"(",
... | Transparent the given color by the factor
The more the factor closer to zero the more the color gets transparent
@param color The color to transparent
@param factor 1.0f to 0.0f
@return int - A transplanted color | [
"Transparent",
"the",
"given",
"color",
"by",
"the",
"factor",
"The",
"more",
"the",
"factor",
"closer",
"to",
"zero",
"the",
"more",
"the",
"color",
"gets",
"transparent"
] | a805979677f76f6a441dfca2f85f3b01ae6a3e18 | https://github.com/lopspower/CircularProgressBar/blob/a805979677f76f6a441dfca2f85f3b01ae6a3e18/circularprogressbar-example/src/main/java/com/mikhaellopez/circularprogressbarsample/MainActivity.java#L119-L125 | train |
hazelcast/hazelcast-kubernetes | src/main/java/com/hazelcast/kubernetes/KubernetesClient.java | KubernetesClient.callGet | private JsonObject callGet(final String urlString) {
return RetryUtils.retry(new Callable<JsonObject>() {
@Override
public JsonObject call() {
return Json
.parse(RestClient.create(urlString).withHeader("Authorization", String.format("Bearer %s", ap... | java | private JsonObject callGet(final String urlString) {
return RetryUtils.retry(new Callable<JsonObject>() {
@Override
public JsonObject call() {
return Json
.parse(RestClient.create(urlString).withHeader("Authorization", String.format("Bearer %s", ap... | [
"private",
"JsonObject",
"callGet",
"(",
"final",
"String",
"urlString",
")",
"{",
"return",
"RetryUtils",
".",
"retry",
"(",
"new",
"Callable",
"<",
"JsonObject",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"JsonObject",
"call",
"(",
")",
"{",
"return"... | Makes a REST call to Kubernetes API and returns the result JSON.
@param urlString Kubernetes API REST endpoint
@return parsed JSON
@throws KubernetesClientException if Kubernetes API didn't respond with 200 and a valid JSON content | [
"Makes",
"a",
"REST",
"call",
"to",
"Kubernetes",
"API",
"and",
"returns",
"the",
"result",
"JSON",
"."
] | b1144067addf56d1446a9e1007f5cb3290b86815 | https://github.com/hazelcast/hazelcast-kubernetes/blob/b1144067addf56d1446a9e1007f5cb3290b86815/src/main/java/com/hazelcast/kubernetes/KubernetesClient.java#L453-L464 | train |
hazelcast/hazelcast-kubernetes | src/main/java/com/hazelcast/kubernetes/RestClient.java | RestClient.buildSslSocketFactory | private SSLSocketFactory buildSslSocketFactory() {
try {
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(null, null);
keyStore.setCertificateEntry("ca", generateCertificate());
TrustManagerFactory tmf = TrustManagerFactory.getIn... | java | private SSLSocketFactory buildSslSocketFactory() {
try {
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(null, null);
keyStore.setCertificateEntry("ca", generateCertificate());
TrustManagerFactory tmf = TrustManagerFactory.getIn... | [
"private",
"SSLSocketFactory",
"buildSslSocketFactory",
"(",
")",
"{",
"try",
"{",
"KeyStore",
"keyStore",
"=",
"KeyStore",
".",
"getInstance",
"(",
"KeyStore",
".",
"getDefaultType",
"(",
")",
")",
";",
"keyStore",
".",
"load",
"(",
"null",
",",
"null",
")"... | Builds SSL Socket Factory with the public CA Certificate from Kubernetes Master. | [
"Builds",
"SSL",
"Socket",
"Factory",
"with",
"the",
"public",
"CA",
"Certificate",
"from",
"Kubernetes",
"Master",
"."
] | b1144067addf56d1446a9e1007f5cb3290b86815 | https://github.com/hazelcast/hazelcast-kubernetes/blob/b1144067addf56d1446a9e1007f5cb3290b86815/src/main/java/com/hazelcast/kubernetes/RestClient.java#L174-L190 | train |
hazelcast/hazelcast-kubernetes | src/main/java/com/hazelcast/kubernetes/RestClient.java | RestClient.generateCertificate | private Certificate generateCertificate()
throws IOException, CertificateException {
InputStream caInput = null;
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
caInput = new ByteArrayInputStream(caCertificate.getBytes("UTF-8"));
ret... | java | private Certificate generateCertificate()
throws IOException, CertificateException {
InputStream caInput = null;
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
caInput = new ByteArrayInputStream(caCertificate.getBytes("UTF-8"));
ret... | [
"private",
"Certificate",
"generateCertificate",
"(",
")",
"throws",
"IOException",
",",
"CertificateException",
"{",
"InputStream",
"caInput",
"=",
"null",
";",
"try",
"{",
"CertificateFactory",
"cf",
"=",
"CertificateFactory",
".",
"getInstance",
"(",
"\"X.509\"",
... | Generates CA Certificate from the default CA Cert file or from the externally provided "ca-certificate" property. | [
"Generates",
"CA",
"Certificate",
"from",
"the",
"default",
"CA",
"Cert",
"file",
"or",
"from",
"the",
"externally",
"provided",
"ca",
"-",
"certificate",
"property",
"."
] | b1144067addf56d1446a9e1007f5cb3290b86815 | https://github.com/hazelcast/hazelcast-kubernetes/blob/b1144067addf56d1446a9e1007f5cb3290b86815/src/main/java/com/hazelcast/kubernetes/RestClient.java#L195-L205 | train |
verhas/License3j | src/main/java/javax0/license3j/License.java | License.isOK | public boolean isOK(PublicKey key) {
try {
final var digester = MessageDigest.getInstance(get(DIGEST_KEY).getString());
final var ser = unsigned();
final var digestValue = digester.digest(ser);
final var cipher = Cipher.getInstance(key.getAlgorithm());
... | java | public boolean isOK(PublicKey key) {
try {
final var digester = MessageDigest.getInstance(get(DIGEST_KEY).getString());
final var ser = unsigned();
final var digestValue = digester.digest(ser);
final var cipher = Cipher.getInstance(key.getAlgorithm());
... | [
"public",
"boolean",
"isOK",
"(",
"PublicKey",
"key",
")",
"{",
"try",
"{",
"final",
"var",
"digester",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"get",
"(",
"DIGEST_KEY",
")",
".",
"getString",
"(",
")",
")",
";",
"final",
"var",
"ser",
"=",
"uns... | Returns true if the license is signed and the authenticity of the signature can be checked successfully
using the key.
@param key encryption key to check the authenticity of the license signature
@return {@code true} if the license was properly signed and is intact. In any other cases it returns
{@code false}. | [
"Returns",
"true",
"if",
"the",
"license",
"is",
"signed",
"and",
"the",
"authenticity",
"of",
"the",
"signature",
"can",
"be",
"checked",
"successfully",
"using",
"the",
"key",
"."
] | f44c6e81b3eb59ab591cc757792749d3556b4afb | https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/License.java#L135-L147 | train |
verhas/License3j | src/main/java/javax0/license3j/License.java | License.featuresSorted | private Feature[] featuresSorted(Set<String> excluded) {
return this.features.values().stream().filter(f -> !excluded.contains(f.name()))
.sorted(Comparator.comparing(Feature::name)).toArray(Feature[]::new);
} | java | private Feature[] featuresSorted(Set<String> excluded) {
return this.features.values().stream().filter(f -> !excluded.contains(f.name()))
.sorted(Comparator.comparing(Feature::name)).toArray(Feature[]::new);
} | [
"private",
"Feature",
"[",
"]",
"featuresSorted",
"(",
"Set",
"<",
"String",
">",
"excluded",
")",
"{",
"return",
"this",
".",
"features",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"f",
"->",
"!",
"excluded",
".",
"contain... | Get all the features in an array except the excluded ones in sorted order. The sorting is done on the name.
@param excluded the set of the names of the features that are not included to the result
@return the array of the features sorted. | [
"Get",
"all",
"the",
"features",
"in",
"an",
"array",
"except",
"the",
"excluded",
"ones",
"in",
"sorted",
"order",
".",
"The",
"sorting",
"is",
"done",
"on",
"the",
"name",
"."
] | f44c6e81b3eb59ab591cc757792749d3556b4afb | https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/License.java#L217-L220 | train |
verhas/License3j | src/main/java/javax0/license3j/Feature.java | Feature.serialized | public byte[] serialized() {
final var nameBuffer = name.getBytes(StandardCharsets.UTF_8);
final var typeLength = Integer.BYTES;
final var nameLength = Integer.BYTES + nameBuffer.length;
final var valueLength = type.fixedSize == VARIABLE_LENGTH ? Integer.BYTES + value.length : type.fixed... | java | public byte[] serialized() {
final var nameBuffer = name.getBytes(StandardCharsets.UTF_8);
final var typeLength = Integer.BYTES;
final var nameLength = Integer.BYTES + nameBuffer.length;
final var valueLength = type.fixedSize == VARIABLE_LENGTH ? Integer.BYTES + value.length : type.fixed... | [
"public",
"byte",
"[",
"]",
"serialized",
"(",
")",
"{",
"final",
"var",
"nameBuffer",
"=",
"name",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"UTF_8",
")",
";",
"final",
"var",
"typeLength",
"=",
"Integer",
".",
"BYTES",
";",
"final",
"var",
"nameLe... | Convert a feature to byte array. The bytes will have the following structure
<pre>
[4-byte type][4-byte name length][4-byte value length][name][value]
</pre>
<p>
or
<pre>
[4-byte type][4-byte name length][name][value]
</pre>
<p>
if the length of the value can be determined from the type (some types have fixed length ... | [
"Convert",
"a",
"feature",
"to",
"byte",
"array",
".",
"The",
"bytes",
"will",
"have",
"the",
"following",
"structure"
] | f44c6e81b3eb59ab591cc757792749d3556b4afb | https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/Feature.java#L141-L154 | train |
verhas/License3j | src/main/java/javax0/license3j/io/LicenseReader.java | LicenseReader.read | public License read(IOFormat format) throws IOException {
switch (format) {
case BINARY:
return License.Create.from(ByteArrayReader.readInput(is));
case BASE64:
return License.Create.from(Base64.getDecoder().decode(ByteArrayReader.readInput(is)));
... | java | public License read(IOFormat format) throws IOException {
switch (format) {
case BINARY:
return License.Create.from(ByteArrayReader.readInput(is));
case BASE64:
return License.Create.from(Base64.getDecoder().decode(ByteArrayReader.readInput(is)));
... | [
"public",
"License",
"read",
"(",
"IOFormat",
"format",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"format",
")",
"{",
"case",
"BINARY",
":",
"return",
"License",
".",
"Create",
".",
"from",
"(",
"ByteArrayReader",
".",
"readInput",
"(",
"is",
")",
... | Read the license from the input assuming that the format of the license on the input has the format specified by
the argument.
@param format the assumed format of the license, can be {@link IOFormat#STRING},
{@link IOFormat#BASE64} or {@link IOFormat#BINARY}
@return the license
@throws IOException if the input cannot ... | [
"Read",
"the",
"license",
"from",
"the",
"input",
"assuming",
"that",
"the",
"format",
"of",
"the",
"license",
"on",
"the",
"input",
"has",
"the",
"format",
"specified",
"by",
"the",
"argument",
"."
] | f44c6e81b3eb59ab591cc757792749d3556b4afb | https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/io/LicenseReader.java#L102-L112 | train |
verhas/License3j | src/main/java/javax0/license3j/io/KeyPairWriter.java | KeyPairWriter.write | public void write(LicenseKeyPair pair, IOFormat format) throws IOException {
switch (format) {
case BINARY:
osPrivate.write(pair.getPrivate());
osPublic.write(pair.getPublic());
return;
case BASE64:
osPrivate.write(Base64.ge... | java | public void write(LicenseKeyPair pair, IOFormat format) throws IOException {
switch (format) {
case BINARY:
osPrivate.write(pair.getPrivate());
osPublic.write(pair.getPublic());
return;
case BASE64:
osPrivate.write(Base64.ge... | [
"public",
"void",
"write",
"(",
"LicenseKeyPair",
"pair",
",",
"IOFormat",
"format",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"format",
")",
"{",
"case",
"BINARY",
":",
"osPrivate",
".",
"write",
"(",
"pair",
".",
"getPrivate",
"(",
")",
")",
";... | Write the key pair into the output files.
@param pair the key pair to write.
@param format that can be {@link IOFormat#BINARY} or {@link IOFormat#BASE64}. Using {@link IOFormat#STRING}
will throw exception as keys, as opposed to licenses, cannot be saved in string format.
@throws IOException when the underlying media ... | [
"Write",
"the",
"key",
"pair",
"into",
"the",
"output",
"files",
"."
] | f44c6e81b3eb59ab591cc757792749d3556b4afb | https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/io/KeyPairWriter.java#L41-L53 | train |
verhas/License3j | src/main/java/javax0/license3j/io/LicenseWriter.java | LicenseWriter.write | public void write(License license, IOFormat format) throws IOException {
switch (format) {
case BINARY:
os.write(license.serialized());
return;
case BASE64:
os.write(Base64.getEncoder().encode(license.serialized()));
return;... | java | public void write(License license, IOFormat format) throws IOException {
switch (format) {
case BINARY:
os.write(license.serialized());
return;
case BASE64:
os.write(Base64.getEncoder().encode(license.serialized()));
return;... | [
"public",
"void",
"write",
"(",
"License",
"license",
",",
"IOFormat",
"format",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"format",
")",
"{",
"case",
"BINARY",
":",
"os",
".",
"write",
"(",
"license",
".",
"serialized",
"(",
")",
")",
";",
"re... | Write the license into the output.
@param license the license itself
@param format the desired format of the license, can be {@link IOFormat#STRING},
{@link IOFormat#BASE64} or {@link IOFormat#BINARY}
@throws IOException if the output cannot be written | [
"Write",
"the",
"license",
"into",
"the",
"output",
"."
] | f44c6e81b3eb59ab591cc757792749d3556b4afb | https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/io/LicenseWriter.java#L35-L48 | train |
verhas/License3j | src/main/java/javax0/license3j/crypto/LicenseKeyPair.java | LicenseKeyPair.getPrivate | public byte[] getPrivate() {
keyNotNull(pair.getPrivate());
Key key = pair.getPrivate();
return getKeyBytes(key);
} | java | public byte[] getPrivate() {
keyNotNull(pair.getPrivate());
Key key = pair.getPrivate();
return getKeyBytes(key);
} | [
"public",
"byte",
"[",
"]",
"getPrivate",
"(",
")",
"{",
"keyNotNull",
"(",
"pair",
".",
"getPrivate",
"(",
")",
")",
";",
"Key",
"key",
"=",
"pair",
".",
"getPrivate",
"(",
")",
";",
"return",
"getKeyBytes",
"(",
"key",
")",
";",
"}"
] | Get the byte representation of the private key as it is returned by the underlying security library. This is
NOT the byte array that contains the algorithm at the start. This is the key in raw format.
@return the key as bytes | [
"Get",
"the",
"byte",
"representation",
"of",
"the",
"private",
"key",
"as",
"it",
"is",
"returned",
"by",
"the",
"underlying",
"security",
"library",
".",
"This",
"is",
"NOT",
"the",
"byte",
"array",
"that",
"contains",
"the",
"algorithm",
"at",
"the",
"s... | f44c6e81b3eb59ab591cc757792749d3556b4afb | https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/crypto/LicenseKeyPair.java#L56-L60 | train |
verhas/License3j | src/main/java/javax0/license3j/crypto/LicenseKeyPair.java | LicenseKeyPair.getPublic | public byte[] getPublic() {
keyNotNull(pair.getPublic());
Key key = pair.getPublic();
return getKeyBytes(key);
} | java | public byte[] getPublic() {
keyNotNull(pair.getPublic());
Key key = pair.getPublic();
return getKeyBytes(key);
} | [
"public",
"byte",
"[",
"]",
"getPublic",
"(",
")",
"{",
"keyNotNull",
"(",
"pair",
".",
"getPublic",
"(",
")",
")",
";",
"Key",
"key",
"=",
"pair",
".",
"getPublic",
"(",
")",
";",
"return",
"getKeyBytes",
"(",
"key",
")",
";",
"}"
] | Get the byte representation of the public key as it is returned by the underlying security library. This is
NOT the byte array that contains the algorithm at the start. This is the key in raw format.
@return the key as bytes | [
"Get",
"the",
"byte",
"representation",
"of",
"the",
"public",
"key",
"as",
"it",
"is",
"returned",
"by",
"the",
"underlying",
"security",
"library",
".",
"This",
"is",
"NOT",
"the",
"byte",
"array",
"that",
"contains",
"the",
"algorithm",
"at",
"the",
"st... | f44c6e81b3eb59ab591cc757792749d3556b4afb | https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/crypto/LicenseKeyPair.java#L68-L72 | train |
verhas/License3j | src/main/java/javax0/license3j/HardwareBinder.java | HardwareBinder.getMachineIdString | public String getMachineIdString() throws NoSuchAlgorithmException,
SocketException, UnknownHostException {
return calculator.getMachineIdString(useNetwork, useHostName, useArchitecture);
} | java | public String getMachineIdString() throws NoSuchAlgorithmException,
SocketException, UnknownHostException {
return calculator.getMachineIdString(useNetwork, useHostName, useArchitecture);
} | [
"public",
"String",
"getMachineIdString",
"(",
")",
"throws",
"NoSuchAlgorithmException",
",",
"SocketException",
",",
"UnknownHostException",
"{",
"return",
"calculator",
".",
"getMachineIdString",
"(",
"useNetwork",
",",
"useHostName",
",",
"useArchitecture",
")",
";"... | Get the machine id as an UUID string.
@return the UUID as a string
@throws UnknownHostException in case some error
@throws SocketException in case some error
@throws NoSuchAlgorithmException in case some error | [
"Get",
"the",
"machine",
"id",
"as",
"an",
"UUID",
"string",
"."
] | f44c6e81b3eb59ab591cc757792749d3556b4afb | https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/HardwareBinder.java#L181-L184 | train |
verhas/License3j | src/main/java/javax0/license3j/HardwareBinder.java | HardwareBinder.assertUUID | public boolean assertUUID(final UUID uuid)
throws NoSuchAlgorithmException, SocketException,
UnknownHostException {
return calculator.assertUUID(uuid, useNetwork, useHostName, useArchitecture);
} | java | public boolean assertUUID(final UUID uuid)
throws NoSuchAlgorithmException, SocketException,
UnknownHostException {
return calculator.assertUUID(uuid, useNetwork, useHostName, useArchitecture);
} | [
"public",
"boolean",
"assertUUID",
"(",
"final",
"UUID",
"uuid",
")",
"throws",
"NoSuchAlgorithmException",
",",
"SocketException",
",",
"UnknownHostException",
"{",
"return",
"calculator",
".",
"assertUUID",
"(",
"uuid",
",",
"useNetwork",
",",
"useHostName",
",",
... | Asserts that the current machine has the UUID.
@param uuid expected
@return true if the argument passed is the uuid of the current machine.
@throws UnknownHostException in case some error
@throws SocketException in case some error
@throws NoSuchAlgorithmException in case some error | [
"Asserts",
"that",
"the",
"current",
"machine",
"has",
"the",
"UUID",
"."
] | f44c6e81b3eb59ab591cc757792749d3556b4afb | https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/HardwareBinder.java#L195-L199 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java | MemcachedNodesManager.createSessionId | @Nonnull
public String createSessionId( @Nonnull final String sessionId ) {
return isEncodeNodeIdInSessionId() ? _sessionIdFormat.createSessionId(sessionId, _nodeIdService.getMemcachedNodeId() ) : sessionId;
} | java | @Nonnull
public String createSessionId( @Nonnull final String sessionId ) {
return isEncodeNodeIdInSessionId() ? _sessionIdFormat.createSessionId(sessionId, _nodeIdService.getMemcachedNodeId() ) : sessionId;
} | [
"@",
"Nonnull",
"public",
"String",
"createSessionId",
"(",
"@",
"Nonnull",
"final",
"String",
"sessionId",
")",
"{",
"return",
"isEncodeNodeIdInSessionId",
"(",
")",
"?",
"_sessionIdFormat",
".",
"createSessionId",
"(",
"sessionId",
",",
"_nodeIdService",
".",
"g... | Creates a new sessionId based on the given one, usually by appending a randomly selected memcached node id.
If the memcachedNodes were configured using a single node without nodeId, the sessionId is returned unchanged. | [
"Creates",
"a",
"new",
"sessionId",
"based",
"on",
"the",
"given",
"one",
"usually",
"by",
"appending",
"a",
"randomly",
"selected",
"memcached",
"node",
"id",
".",
"If",
"the",
"memcachedNodes",
"were",
"configured",
"using",
"a",
"single",
"node",
"without",... | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java#L402-L405 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java | MemcachedNodesManager.setNodeAvailable | public void setNodeAvailable(@Nullable final String nodeId, final boolean available) {
if ( _nodeIdService != null ) {
_nodeIdService.setNodeAvailable(nodeId, available);
}
} | java | public void setNodeAvailable(@Nullable final String nodeId, final boolean available) {
if ( _nodeIdService != null ) {
_nodeIdService.setNodeAvailable(nodeId, available);
}
} | [
"public",
"void",
"setNodeAvailable",
"(",
"@",
"Nullable",
"final",
"String",
"nodeId",
",",
"final",
"boolean",
"available",
")",
"{",
"if",
"(",
"_nodeIdService",
"!=",
"null",
")",
"{",
"_nodeIdService",
".",
"setNodeAvailable",
"(",
"nodeId",
",",
"availa... | Mark the given nodeId as available as specified.
@param nodeId the nodeId to update
@param available specifies if the node was abailable or not | [
"Mark",
"the",
"given",
"nodeId",
"as",
"available",
"as",
"specified",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java#L412-L416 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java | MemcachedNodesManager.isValidForMemcached | public boolean isValidForMemcached(final String sessionId) {
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( sessionId );
if ( nodeId == null ) {
LOG.debug( "The sessionId does not contain a nodeId so that the memcached node could not be i... | java | public boolean isValidForMemcached(final String sessionId) {
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( sessionId );
if ( nodeId == null ) {
LOG.debug( "The sessionId does not contain a nodeId so that the memcached node could not be i... | [
"public",
"boolean",
"isValidForMemcached",
"(",
"final",
"String",
"sessionId",
")",
"{",
"if",
"(",
"isEncodeNodeIdInSessionId",
"(",
")",
")",
"{",
"final",
"String",
"nodeId",
"=",
"_sessionIdFormat",
".",
"extractMemcachedId",
"(",
"sessionId",
")",
";",
"i... | Can be used to determine if the given sessionId can be used to interact with memcached.
@see #canHitMemcached(String) | [
"Can",
"be",
"used",
"to",
"determine",
"if",
"the",
"given",
"sessionId",
"can",
"be",
"used",
"to",
"interact",
"with",
"memcached",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java#L431-L440 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java | MemcachedNodesManager.canHitMemcached | public boolean canHitMemcached(final String sessionId) {
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( sessionId );
if ( nodeId == null ) {
LOG.debug( "The sessionId does not contain a nodeId so that the memcached node could not be ident... | java | public boolean canHitMemcached(final String sessionId) {
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( sessionId );
if ( nodeId == null ) {
LOG.debug( "The sessionId does not contain a nodeId so that the memcached node could not be ident... | [
"public",
"boolean",
"canHitMemcached",
"(",
"final",
"String",
"sessionId",
")",
"{",
"if",
"(",
"isEncodeNodeIdInSessionId",
"(",
")",
")",
"{",
"final",
"String",
"nodeId",
"=",
"_sessionIdFormat",
".",
"extractMemcachedId",
"(",
"sessionId",
")",
";",
"if",
... | Can be used to determine if the given sessionId can be used to interact with memcached.
This also checks if the related memcached is available.
@see #isValidForMemcached(String) | [
"Can",
"be",
"used",
"to",
"determine",
"if",
"the",
"given",
"sessionId",
"can",
"be",
"used",
"to",
"interact",
"with",
"memcached",
".",
"This",
"also",
"checks",
"if",
"the",
"related",
"memcached",
"is",
"available",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java#L447-L460 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java | MemcachedNodesManager.setNodeAvailableForSessionId | public String setNodeAvailableForSessionId(final String sessionId, final boolean available) {
if ( _nodeIdService != null && isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId(sessionId);
if ( nodeId != null ) {
_nodeIdService.setNodeAvailable(nodeId, available);
r... | java | public String setNodeAvailableForSessionId(final String sessionId, final boolean available) {
if ( _nodeIdService != null && isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId(sessionId);
if ( nodeId != null ) {
_nodeIdService.setNodeAvailable(nodeId, available);
r... | [
"public",
"String",
"setNodeAvailableForSessionId",
"(",
"final",
"String",
"sessionId",
",",
"final",
"boolean",
"available",
")",
"{",
"if",
"(",
"_nodeIdService",
"!=",
"null",
"&&",
"isEncodeNodeIdInSessionId",
"(",
")",
")",
"{",
"final",
"String",
"nodeId",
... | Mark the memcached node encoded in the given sessionId as available or not. If nodeIds shall
not be encoded in the sessionId or if the given sessionId does not contain a nodeId no
action will be taken.
@param sessionId the sessionId that may contain a node id.
@param available specifies if the possibly referenced node... | [
"Mark",
"the",
"memcached",
"node",
"encoded",
"in",
"the",
"given",
"sessionId",
"as",
"available",
"or",
"not",
".",
"If",
"nodeIds",
"shall",
"not",
"be",
"encoded",
"in",
"the",
"sessionId",
"or",
"if",
"the",
"given",
"sessionId",
"does",
"not",
"cont... | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java#L482-L494 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java | MemcachedNodesManager.changeSessionIdForTomcatFailover | public String changeSessionIdForTomcatFailover( @Nonnull final String sessionId, final String jvmRoute ) {
final String newSessionId = jvmRoute != null && !jvmRoute.trim().isEmpty()
? _sessionIdFormat.changeJvmRoute( sessionId, jvmRoute )
: _sessionIdFormat.stripJvmRoute(sessionI... | java | public String changeSessionIdForTomcatFailover( @Nonnull final String sessionId, final String jvmRoute ) {
final String newSessionId = jvmRoute != null && !jvmRoute.trim().isEmpty()
? _sessionIdFormat.changeJvmRoute( sessionId, jvmRoute )
: _sessionIdFormat.stripJvmRoute(sessionI... | [
"public",
"String",
"changeSessionIdForTomcatFailover",
"(",
"@",
"Nonnull",
"final",
"String",
"sessionId",
",",
"final",
"String",
"jvmRoute",
")",
"{",
"final",
"String",
"newSessionId",
"=",
"jvmRoute",
"!=",
"null",
"&&",
"!",
"jvmRoute",
".",
"trim",
"(",
... | Changes the sessionId by setting the given jvmRoute and replacing the memcachedNodeId if it's currently
set to a failoverNodeId.
@param sessionId the current session id
@param jvmRoute the new jvmRoute to set.
@return the session id with maybe new jvmRoute and/or new memcachedId. | [
"Changes",
"the",
"sessionId",
"by",
"setting",
"the",
"given",
"jvmRoute",
"and",
"replacing",
"the",
"memcachedNodeId",
"if",
"it",
"s",
"currently",
"set",
"to",
"a",
"failoverNodeId",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java#L520-L534 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java | MemcachedNodesManager.getCouchbaseBucketURIs | public List<URI> getCouchbaseBucketURIs() {
if(!isCouchbaseBucketConfig())
throw new IllegalStateException("This is not a couchbase bucket configuration.");
final List<URI> result = new ArrayList<URI>(_address2Ids.size());
final Matcher matcher = COUCHBASE_BUCKET_NODE_PATTERN.matcher... | java | public List<URI> getCouchbaseBucketURIs() {
if(!isCouchbaseBucketConfig())
throw new IllegalStateException("This is not a couchbase bucket configuration.");
final List<URI> result = new ArrayList<URI>(_address2Ids.size());
final Matcher matcher = COUCHBASE_BUCKET_NODE_PATTERN.matcher... | [
"public",
"List",
"<",
"URI",
">",
"getCouchbaseBucketURIs",
"(",
")",
"{",
"if",
"(",
"!",
"isCouchbaseBucketConfig",
"(",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"This is not a couchbase bucket configuration.\"",
")",
";",
"final",
"List",
"<",
... | Returns a list of couchbase REST interface uris if the current configuration is
a couchbase bucket configuration.
@see #isCouchbaseBucketConfig() | [
"Returns",
"a",
"list",
"of",
"couchbase",
"REST",
"interface",
"uris",
"if",
"the",
"current",
"configuration",
"is",
"a",
"couchbase",
"bucket",
"configuration",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java#L557-L570 | train |
magro/memcached-session-manager | tomcat6/src/main/java/de/javakaffee/web/msm/MemcachedBackupSessionManager.java | MemcachedBackupSessionManager.setMaxActiveSessions | public void setMaxActiveSessions( final int max ) {
final int oldMaxActiveSessions = _maxActiveSessions;
_maxActiveSessions = max;
support.firePropertyChange( "maxActiveSessions",
Integer.valueOf( oldMaxActiveSessions ),
Integer.valueOf( _maxActiveSessions ) );
... | java | public void setMaxActiveSessions( final int max ) {
final int oldMaxActiveSessions = _maxActiveSessions;
_maxActiveSessions = max;
support.firePropertyChange( "maxActiveSessions",
Integer.valueOf( oldMaxActiveSessions ),
Integer.valueOf( _maxActiveSessions ) );
... | [
"public",
"void",
"setMaxActiveSessions",
"(",
"final",
"int",
"max",
")",
"{",
"final",
"int",
"oldMaxActiveSessions",
"=",
"_maxActiveSessions",
";",
"_maxActiveSessions",
"=",
"max",
";",
"support",
".",
"firePropertyChange",
"(",
"\"maxActiveSessions\"",
",",
"I... | Set the maximum number of active Sessions allowed, or -1 for no limit.
@param max
The new maximum number of sessions | [
"Set",
"the",
"maximum",
"number",
"of",
"active",
"Sessions",
"allowed",
"or",
"-",
"1",
"for",
"no",
"limit",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/tomcat6/src/main/java/de/javakaffee/web/msm/MemcachedBackupSessionManager.java#L288-L294 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/ReadOnlyRequestsCache.java | ReadOnlyRequestsCache.modifyingRequest | public void modifyingRequest( final String requestId ) {
if ( _log.isDebugEnabled() ) {
_log.debug( "Registering modifying request: " + requestId );
}
incrementOrPut( _blacklist, requestId );
_readOnlyRequests.remove( requestId );
} | java | public void modifyingRequest( final String requestId ) {
if ( _log.isDebugEnabled() ) {
_log.debug( "Registering modifying request: " + requestId );
}
incrementOrPut( _blacklist, requestId );
_readOnlyRequests.remove( requestId );
} | [
"public",
"void",
"modifyingRequest",
"(",
"final",
"String",
"requestId",
")",
"{",
"if",
"(",
"_log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"_log",
".",
"debug",
"(",
"\"Registering modifying request: \"",
"+",
"requestId",
")",
";",
"}",
"incrementOrPu... | Registers the given requestURI as a modifying request, which can be seen as a blacklist for
readonly requests. There's a limit on number and time for modifying requests beeing stored.
@param requestId the request uri to track. | [
"Registers",
"the",
"given",
"requestURI",
"as",
"a",
"modifying",
"request",
"which",
"can",
"be",
"seen",
"as",
"a",
"blacklist",
"for",
"readonly",
"requests",
".",
"There",
"s",
"a",
"limit",
"on",
"number",
"and",
"time",
"for",
"modifying",
"requests",... | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/ReadOnlyRequestsCache.java#L83-L89 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/ReadOnlyRequestsCache.java | ReadOnlyRequestsCache.isReadOnlyRequest | public boolean isReadOnlyRequest( final String requestId ) {
if ( _log.isDebugEnabled() ) {
_log.debug( "Asked for readonly request: " + requestId + " ("+ _readOnlyRequests.containsKey( requestId ) +")" );
}
// TODO: add some threshold
return _readOnlyRequests.containsKey( re... | java | public boolean isReadOnlyRequest( final String requestId ) {
if ( _log.isDebugEnabled() ) {
_log.debug( "Asked for readonly request: " + requestId + " ("+ _readOnlyRequests.containsKey( requestId ) +")" );
}
// TODO: add some threshold
return _readOnlyRequests.containsKey( re... | [
"public",
"boolean",
"isReadOnlyRequest",
"(",
"final",
"String",
"requestId",
")",
"{",
"if",
"(",
"_log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"_log",
".",
"debug",
"(",
"\"Asked for readonly request: \"",
"+",
"requestId",
"+",
"\" (\"",
"+",
"_readOn... | Determines, if the given requestURI is a readOnly request and not blacklisted as a modifying request.
@param requestId the request uri to check
@return <code>true</code> if the given request uri can be regarded as read only. | [
"Determines",
"if",
"the",
"given",
"requestURI",
"is",
"a",
"readOnly",
"request",
"and",
"not",
"blacklisted",
"as",
"a",
"modifying",
"request",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/ReadOnlyRequestsCache.java#L96-L102 | train |
magro/memcached-session-manager | flexjson-serializer/src/main/java/de/javakaffee/web/msm/serializer/json/JSONTranscoder.java | JSONTranscoder.deserializeAttributes | @Override
public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in) {
final InputStreamReader inputStream = new InputStreamReader( new ByteArrayInputStream( in ) );
if (LOG.isDebugEnabled()) {
LOG.debug("deserialize the stream");
}
try {
return deserializer.deserializeInto(inp... | java | @Override
public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in) {
final InputStreamReader inputStream = new InputStreamReader( new ByteArrayInputStream( in ) );
if (LOG.isDebugEnabled()) {
LOG.debug("deserialize the stream");
}
try {
return deserializer.deserializeInto(inp... | [
"@",
"Override",
"public",
"ConcurrentMap",
"<",
"String",
",",
"Object",
">",
"deserializeAttributes",
"(",
"final",
"byte",
"[",
"]",
"in",
")",
"{",
"final",
"InputStreamReader",
"inputStream",
"=",
"new",
"InputStreamReader",
"(",
"new",
"ByteArrayInputStream"... | Return the deserialized map
@param in bytes to deserialize
@return map of deserialized objects | [
"Return",
"the",
"deserialized",
"map"
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/flexjson-serializer/src/main/java/de/javakaffee/web/msm/serializer/json/JSONTranscoder.java#L68-L80 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/LockingStrategy.java | LockingStrategy.onBackupWithoutLoadedSession | protected void onBackupWithoutLoadedSession( @Nonnull final String sessionId, @Nonnull final String requestId,
@Nonnull final BackupSessionService backupSessionService ) {
if ( !_sessionIdFormat.isValid( sessionId ) ) {
return;
}
try {
final long start = Sy... | java | protected void onBackupWithoutLoadedSession( @Nonnull final String sessionId, @Nonnull final String requestId,
@Nonnull final BackupSessionService backupSessionService ) {
if ( !_sessionIdFormat.isValid( sessionId ) ) {
return;
}
try {
final long start = Sy... | [
"protected",
"void",
"onBackupWithoutLoadedSession",
"(",
"@",
"Nonnull",
"final",
"String",
"sessionId",
",",
"@",
"Nonnull",
"final",
"String",
"requestId",
",",
"@",
"Nonnull",
"final",
"BackupSessionService",
"backupSessionService",
")",
"{",
"if",
"(",
"!",
"... | Is invoked for the backup of a non-sticky session that was not accessed for the current request. | [
"Is",
"invoked",
"for",
"the",
"backup",
"of",
"a",
"non",
"-",
"sticky",
"session",
"that",
"was",
"not",
"accessed",
"for",
"the",
"current",
"request",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/LockingStrategy.java#L219-L266 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/LockingStrategy.java | LockingStrategy.onAfterBackupSession | protected void onAfterBackupSession( @Nonnull final MemcachedBackupSession session, final boolean backupWasForced,
@Nonnull final Future<BackupResult> result, @Nonnull final String requestId,
@Nonnull final BackupSessionService backupSessionService ) {
if ( !_sessionIdFormat.isValid( se... | java | protected void onAfterBackupSession( @Nonnull final MemcachedBackupSession session, final boolean backupWasForced,
@Nonnull final Future<BackupResult> result, @Nonnull final String requestId,
@Nonnull final BackupSessionService backupSessionService ) {
if ( !_sessionIdFormat.isValid( se... | [
"protected",
"void",
"onAfterBackupSession",
"(",
"@",
"Nonnull",
"final",
"MemcachedBackupSession",
"session",
",",
"final",
"boolean",
"backupWasForced",
",",
"@",
"Nonnull",
"final",
"Future",
"<",
"BackupResult",
">",
"result",
",",
"@",
"Nonnull",
"final",
"S... | Is invoked after the backup of the session is initiated, it's represented by the provided backupResult. The
requestId is identifying the request. | [
"Is",
"invoked",
"after",
"the",
"backup",
"of",
"the",
"session",
"is",
"initiated",
"it",
"s",
"represented",
"by",
"the",
"provided",
"backupResult",
".",
"The",
"requestId",
"is",
"identifying",
"the",
"request",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/LockingStrategy.java#L272-L324 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/LockingStrategy.java | LockingStrategy.onAfterDeleteFromMemcached | protected void onAfterDeleteFromMemcached( @Nonnull final String sessionId ) {
final long start = System.currentTimeMillis();
final String validityInfoKey = _sessionIdFormat.createValidityInfoKeyName( sessionId );
_storage.delete( validityInfoKey );
if (_storeSecondaryBackup) {
... | java | protected void onAfterDeleteFromMemcached( @Nonnull final String sessionId ) {
final long start = System.currentTimeMillis();
final String validityInfoKey = _sessionIdFormat.createValidityInfoKeyName( sessionId );
_storage.delete( validityInfoKey );
if (_storeSecondaryBackup) {
... | [
"protected",
"void",
"onAfterDeleteFromMemcached",
"(",
"@",
"Nonnull",
"final",
"String",
"sessionId",
")",
"{",
"final",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"final",
"String",
"validityInfoKey",
"=",
"_sessionIdFormat",
".",
... | Invoked after a non-sticky session is removed from memcached. | [
"Invoked",
"after",
"a",
"non",
"-",
"sticky",
"session",
"is",
"removed",
"from",
"memcached",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/LockingStrategy.java#L377-L393 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedSessionService.java | MemcachedSessionService.startInternal | void startInternal() throws LifecycleException {
_log.info( getClass().getSimpleName() + " starts initialization... (configured" +
" nodes definition " + _memcachedNodes + ", failover nodes " + _failoverNodes + ")" );
_statistics = Statistics.create( _enableStatistics );
_memca... | java | void startInternal() throws LifecycleException {
_log.info( getClass().getSimpleName() + " starts initialization... (configured" +
" nodes definition " + _memcachedNodes + ", failover nodes " + _failoverNodes + ")" );
_statistics = Statistics.create( _enableStatistics );
_memca... | [
"void",
"startInternal",
"(",
")",
"throws",
"LifecycleException",
"{",
"_log",
".",
"info",
"(",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\" starts initialization... (configured\"",
"+",
"\" nodes definition \"",
"+",
"_memcachedNodes",
"+",
"\",... | Initialize this manager. | [
"Initialize",
"this",
"manager",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedSessionService.java#L431-L467 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedSessionService.java | MemcachedSessionService.backupSession | public Future<BackupResult> backupSession( final String sessionId, final boolean sessionIdChanged, final String requestId ) {
if ( !_enabled.get() ) {
return new SimpleFuture<BackupResult>( BackupResult.SKIPPED );
}
final MemcachedBackupSession msmSession = _manager.getSessionIntern... | java | public Future<BackupResult> backupSession( final String sessionId, final boolean sessionIdChanged, final String requestId ) {
if ( !_enabled.get() ) {
return new SimpleFuture<BackupResult>( BackupResult.SKIPPED );
}
final MemcachedBackupSession msmSession = _manager.getSessionIntern... | [
"public",
"Future",
"<",
"BackupResult",
">",
"backupSession",
"(",
"final",
"String",
"sessionId",
",",
"final",
"boolean",
"sessionIdChanged",
",",
"final",
"String",
"requestId",
")",
"{",
"if",
"(",
"!",
"_enabled",
".",
"get",
"(",
")",
")",
"{",
"ret... | Backup the session for the provided session id in memcached if the session was modified or
if the session needs to be relocated. In non-sticky session-mode the session should not be
loaded from memcached for just storing it again but only metadata should be updated.
@param sessionId
the if of the session to backup
@pa... | [
"Backup",
"the",
"session",
"for",
"the",
"provided",
"session",
"id",
"in",
"memcached",
"if",
"the",
"session",
"was",
"modified",
"or",
"if",
"the",
"session",
"needs",
"to",
"be",
"relocated",
".",
"In",
"non",
"-",
"sticky",
"session",
"-",
"mode",
... | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedSessionService.java#L1058-L1105 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/SessionIdFormat.java | SessionIdFormat.createSessionId | @Nonnull
public String createSessionId(@Nonnull final String sessionId, @Nullable final String memcachedId) {
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Creating new session id with orig id '" + sessionId + "' and memcached id '" + memcachedId + "'." );
}
if ( memcachedId == null ... | java | @Nonnull
public String createSessionId(@Nonnull final String sessionId, @Nullable final String memcachedId) {
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Creating new session id with orig id '" + sessionId + "' and memcached id '" + memcachedId + "'." );
}
if ( memcachedId == null ... | [
"@",
"Nonnull",
"public",
"String",
"createSessionId",
"(",
"@",
"Nonnull",
"final",
"String",
"sessionId",
",",
"@",
"Nullable",
"final",
"String",
"memcachedId",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
... | Create a session id including the provided memcachedId.
@param sessionId
the original session id, it might contain the jvm route
@param memcachedId
the memcached id to encode in the session id, may be <code>null</code>.
@return the sessionId which now contains the memcachedId if one was provided, otherwise
the session... | [
"Create",
"a",
"session",
"id",
"including",
"the",
"provided",
"memcachedId",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/SessionIdFormat.java#L71-L85 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/SessionIdFormat.java | SessionIdFormat.extractMemcachedId | @CheckForNull
public String extractMemcachedId( @Nonnull final String sessionId ) {
final int idxDash = sessionId.indexOf( '-' );
if ( idxDash < 0 ) {
return null;
}
final int idxDot = sessionId.indexOf( '.' );
if ( idxDot < 0 ) {
return sessionId.subs... | java | @CheckForNull
public String extractMemcachedId( @Nonnull final String sessionId ) {
final int idxDash = sessionId.indexOf( '-' );
if ( idxDash < 0 ) {
return null;
}
final int idxDot = sessionId.indexOf( '.' );
if ( idxDot < 0 ) {
return sessionId.subs... | [
"@",
"CheckForNull",
"public",
"String",
"extractMemcachedId",
"(",
"@",
"Nonnull",
"final",
"String",
"sessionId",
")",
"{",
"final",
"int",
"idxDash",
"=",
"sessionId",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"idxDash",
"<",
"0",
")",
"{",
... | Extract the memcached id from the given session id.
@param sessionId
the session id including the memcached id and eventually the
jvmRoute.
@return the memcached id or null if the session id didn't contain any
memcached id. | [
"Extract",
"the",
"memcached",
"id",
"from",
"the",
"given",
"session",
"id",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/SessionIdFormat.java#L158-L172 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/SessionIdFormat.java | SessionIdFormat.extractJvmRoute | @CheckForNull
public String extractJvmRoute( @Nonnull final String sessionId ) {
final int idxDot = sessionId.indexOf( '.' );
return idxDot < 0 ? null : sessionId.substring( idxDot + 1 );
} | java | @CheckForNull
public String extractJvmRoute( @Nonnull final String sessionId ) {
final int idxDot = sessionId.indexOf( '.' );
return idxDot < 0 ? null : sessionId.substring( idxDot + 1 );
} | [
"@",
"CheckForNull",
"public",
"String",
"extractJvmRoute",
"(",
"@",
"Nonnull",
"final",
"String",
"sessionId",
")",
"{",
"final",
"int",
"idxDot",
"=",
"sessionId",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"return",
"idxDot",
"<",
"0",
"?",
"null",
":"... | Extract the jvm route from the given session id if existing.
@param sessionId
the session id possibly including the memcached id and eventually the
jvmRoute.
@return the jvm route or null if the session id didn't contain any. | [
"Extract",
"the",
"jvm",
"route",
"from",
"the",
"given",
"session",
"id",
"if",
"existing",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/SessionIdFormat.java#L182-L186 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/SessionIdFormat.java | SessionIdFormat.stripJvmRoute | @Nonnull
public String stripJvmRoute( @Nonnull final String sessionId ) {
final int idxDot = sessionId.indexOf( '.' );
return idxDot < 0 ? sessionId : sessionId.substring( 0, idxDot );
} | java | @Nonnull
public String stripJvmRoute( @Nonnull final String sessionId ) {
final int idxDot = sessionId.indexOf( '.' );
return idxDot < 0 ? sessionId : sessionId.substring( 0, idxDot );
} | [
"@",
"Nonnull",
"public",
"String",
"stripJvmRoute",
"(",
"@",
"Nonnull",
"final",
"String",
"sessionId",
")",
"{",
"final",
"int",
"idxDot",
"=",
"sessionId",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"return",
"idxDot",
"<",
"0",
"?",
"sessionId",
":",
... | Remove the jvm route from the given session id if existing.
@param sessionId
the session id possibly including the memcached id and eventually the
jvmRoute.
@return the session id without the jvm route. | [
"Remove",
"the",
"jvm",
"route",
"from",
"the",
"given",
"session",
"id",
"if",
"existing",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/SessionIdFormat.java#L196-L200 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/DummyMemcachedSessionService.java | DummyMemcachedSessionService.backupSession | public Future<BackupResult> backupSession( final String sessionId, final boolean sessionIdChanged, final String requestId ) {
final MemcachedBackupSession session = _manager.getSessionInternal( sessionId );
if ( session == null ) {
if(_log.isDebugEnabled())
_log.deb... | java | public Future<BackupResult> backupSession( final String sessionId, final boolean sessionIdChanged, final String requestId ) {
final MemcachedBackupSession session = _manager.getSessionInternal( sessionId );
if ( session == null ) {
if(_log.isDebugEnabled())
_log.deb... | [
"public",
"Future",
"<",
"BackupResult",
">",
"backupSession",
"(",
"final",
"String",
"sessionId",
",",
"final",
"boolean",
"sessionIdChanged",
",",
"final",
"String",
"requestId",
")",
"{",
"final",
"MemcachedBackupSession",
"session",
"=",
"_manager",
".",
"get... | Store the provided session in memcached if the session was modified
or if the session needs to be relocated.
@param session
the session to save
@param sessionRelocationRequired
specifies, if the session id was changed due to a memcached failover or tomcat failover.
@return the {@link BackupResultStatus} | [
"Store",
"the",
"provided",
"session",
"in",
"memcached",
"if",
"the",
"session",
"was",
"modified",
"or",
"if",
"the",
"session",
"needs",
"to",
"be",
"relocated",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/DummyMemcachedSessionService.java#L96-L116 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSession.java | MemcachedBackupSession.filterAttribute | private boolean filterAttribute( final String name ) {
if ( this.manager == null ) {
throw new IllegalStateException( "There's no manager set." );
}
final Pattern pattern = ((SessionManager)manager).getMemcachedSessionService().getSessionAttributePattern();
if ( pattern == nu... | java | private boolean filterAttribute( final String name ) {
if ( this.manager == null ) {
throw new IllegalStateException( "There's no manager set." );
}
final Pattern pattern = ((SessionManager)manager).getMemcachedSessionService().getSessionAttributePattern();
if ( pattern == nu... | [
"private",
"boolean",
"filterAttribute",
"(",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"this",
".",
"manager",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"There's no manager set.\"",
")",
";",
"}",
"final",
"Pattern",
"patte... | Check whether the given attribute name matches our name pattern and shall be stored in memcached.
@return true if the name matches | [
"Check",
"whether",
"the",
"given",
"attribute",
"name",
"matches",
"our",
"name",
"pattern",
"and",
"shall",
"be",
"stored",
"in",
"memcached",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSession.java#L258-L267 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSession.java | MemcachedBackupSession.getMemcachedExpirationTime | int getMemcachedExpirationTime() {
if ( !_sticky ) {
throw new IllegalStateException( "The memcached expiration time cannot be determined in non-sticky mode." );
}
if ( _lastMemcachedExpirationTime == 0 ) {
return 0;
}
final long timeIdleInMillis = _lastB... | java | int getMemcachedExpirationTime() {
if ( !_sticky ) {
throw new IllegalStateException( "The memcached expiration time cannot be determined in non-sticky mode." );
}
if ( _lastMemcachedExpirationTime == 0 ) {
return 0;
}
final long timeIdleInMillis = _lastB... | [
"int",
"getMemcachedExpirationTime",
"(",
")",
"{",
"if",
"(",
"!",
"_sticky",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The memcached expiration time cannot be determined in non-sticky mode.\"",
")",
";",
"}",
"if",
"(",
"_lastMemcachedExpirationTime",
"... | Gets the time in seconds when this session will expire in memcached.
If the session was stored in memcached with expiration 0 this method will just
return 0.
@return the time in seconds | [
"Gets",
"the",
"time",
"in",
"seconds",
"when",
"this",
"session",
"will",
"expire",
"in",
"memcached",
".",
"If",
"the",
"session",
"was",
"stored",
"in",
"memcached",
"with",
"expiration",
"0",
"this",
"method",
"will",
"just",
"return",
"0",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSession.java#L312-L330 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSession.java | MemcachedBackupSession.getAttributesFiltered | public ConcurrentMap<String, Object> getAttributesFiltered() {
if ( this.manager == null ) {
throw new IllegalStateException( "There's no manager set." );
}
final Pattern pattern = ((SessionManager)manager).getMemcachedSessionService().getSessionAttributePattern();
final Conc... | java | public ConcurrentMap<String, Object> getAttributesFiltered() {
if ( this.manager == null ) {
throw new IllegalStateException( "There's no manager set." );
}
final Pattern pattern = ((SessionManager)manager).getMemcachedSessionService().getSessionAttributePattern();
final Conc... | [
"public",
"ConcurrentMap",
"<",
"String",
",",
"Object",
">",
"getAttributesFiltered",
"(",
")",
"{",
"if",
"(",
"this",
".",
"manager",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"There's no manager set.\"",
")",
";",
"}",
"final"... | Filter map of attributes using our name pattern.
@return the filtered attribute map that only includes attributes that shall be stored in memcached. | [
"Filter",
"map",
"of",
"attributes",
"using",
"our",
"name",
"pattern",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSession.java#L591-L607 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/LRUCache.java | LRUCache.put | public V put( final K key, final V value ) {
synchronized ( _map ) {
final ManagedItem<V> previous = _map.put( key, new ManagedItem<V>( value, System.currentTimeMillis() ) );
while ( _map.size() > _size ) {
_map.remove( _map.keySet().iterator().next() );
}
... | java | public V put( final K key, final V value ) {
synchronized ( _map ) {
final ManagedItem<V> previous = _map.put( key, new ManagedItem<V>( value, System.currentTimeMillis() ) );
while ( _map.size() > _size ) {
_map.remove( _map.keySet().iterator().next() );
}
... | [
"public",
"V",
"put",
"(",
"final",
"K",
"key",
",",
"final",
"V",
"value",
")",
"{",
"synchronized",
"(",
"_map",
")",
"{",
"final",
"ManagedItem",
"<",
"V",
">",
"previous",
"=",
"_map",
".",
"put",
"(",
"key",
",",
"new",
"ManagedItem",
"<",
"V"... | Put the key and value.
@param key
the key
@param value
the value
@return the previously associated value or <code>null</code>. | [
"Put",
"the",
"key",
"and",
"value",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/LRUCache.java#L89-L99 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/LRUCache.java | LRUCache.get | public V get( final K key ) {
synchronized ( _map ) {
final ManagedItem<V> item = _map.get( key );
if ( item == null ) {
return null;
}
if ( _ttl > -1 && System.currentTimeMillis() - item._insertionTime > _ttl ) {
_map.remove( key )... | java | public V get( final K key ) {
synchronized ( _map ) {
final ManagedItem<V> item = _map.get( key );
if ( item == null ) {
return null;
}
if ( _ttl > -1 && System.currentTimeMillis() - item._insertionTime > _ttl ) {
_map.remove( key )... | [
"public",
"V",
"get",
"(",
"final",
"K",
"key",
")",
"{",
"synchronized",
"(",
"_map",
")",
"{",
"final",
"ManagedItem",
"<",
"V",
">",
"item",
"=",
"_map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"return",
... | Returns the value that was stored to the given key.
@param key
the key
@return the stored value or <code>null</code> | [
"Returns",
"the",
"value",
"that",
"was",
"stored",
"to",
"the",
"given",
"key",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/LRUCache.java#L158-L170 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/LRUCache.java | LRUCache.getKeys | public List<K> getKeys() {
synchronized ( _map ) {
return new java.util.ArrayList<K>( _map.keySet() );
}
} | java | public List<K> getKeys() {
synchronized ( _map ) {
return new java.util.ArrayList<K>( _map.keySet() );
}
} | [
"public",
"List",
"<",
"K",
">",
"getKeys",
"(",
")",
"{",
"synchronized",
"(",
"_map",
")",
"{",
"return",
"new",
"java",
".",
"util",
".",
"ArrayList",
"<",
"K",
">",
"(",
"_map",
".",
"keySet",
"(",
")",
")",
";",
"}",
"}"
] | The list of all keys, whose order is the order in which its entries were last accessed,
from least-recently accessed to most-recently.
@return a new list. | [
"The",
"list",
"of",
"all",
"keys",
"whose",
"order",
"is",
"the",
"order",
"in",
"which",
"its",
"entries",
"were",
"last",
"accessed",
"from",
"least",
"-",
"recently",
"accessed",
"to",
"most",
"-",
"recently",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/LRUCache.java#L191-L195 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/LRUCache.java | LRUCache.getKeysSortedByValue | public List<K> getKeysSortedByValue( final Comparator<V> comparator ) {
synchronized ( _map ) {
@SuppressWarnings( "unchecked" )
final
Entry<K, ManagedItem<V>>[] a = _map.entrySet().toArray( new Map.Entry[_map.size()] );
final Comparator<Entry<K, ManagedItem<V>>> ... | java | public List<K> getKeysSortedByValue( final Comparator<V> comparator ) {
synchronized ( _map ) {
@SuppressWarnings( "unchecked" )
final
Entry<K, ManagedItem<V>>[] a = _map.entrySet().toArray( new Map.Entry[_map.size()] );
final Comparator<Entry<K, ManagedItem<V>>> ... | [
"public",
"List",
"<",
"K",
">",
"getKeysSortedByValue",
"(",
"final",
"Comparator",
"<",
"V",
">",
"comparator",
")",
"{",
"synchronized",
"(",
"_map",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"Entry",
"<",
"K",
",",
"Managed... | The keys sorted by the given value comparator.
@return the underlying set, see {@link LinkedHashMap#keySet()}. | [
"The",
"keys",
"sorted",
"by",
"the",
"given",
"value",
"comparator",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/LRUCache.java#L202-L218 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/NodeAvailabilityCache.java | NodeAvailabilityCache.isNodeAvailable | public boolean isNodeAvailable( @Nonnull final K key ) {
final ManagedItem<Boolean> item = _map.get( key );
if ( item == null ) {
return updateIsNodeAvailable( key );
} else if ( isExpired( item ) ) {
_map.remove( key );
return updateIsNodeAvailable( key );
... | java | public boolean isNodeAvailable( @Nonnull final K key ) {
final ManagedItem<Boolean> item = _map.get( key );
if ( item == null ) {
return updateIsNodeAvailable( key );
} else if ( isExpired( item ) ) {
_map.remove( key );
return updateIsNodeAvailable( key );
... | [
"public",
"boolean",
"isNodeAvailable",
"(",
"@",
"Nonnull",
"final",
"K",
"key",
")",
"{",
"final",
"ManagedItem",
"<",
"Boolean",
">",
"item",
"=",
"_map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"return",
"upda... | Determines, if the node is available. If it's not cached, it's loaded
from the cache loader.
@param key
the key to check
@return <code>true</code> if the node is marked as available. | [
"Determines",
"if",
"the",
"node",
"is",
"available",
".",
"If",
"it",
"s",
"not",
"cached",
"it",
"s",
"loaded",
"from",
"the",
"cache",
"loader",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/NodeAvailabilityCache.java#L115-L125 | train |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/NodeAvailabilityCache.java | NodeAvailabilityCache.getUnavailableNodes | public Set<K> getUnavailableNodes() {
final Set<K> result = new HashSet<K>();
for ( final Map.Entry<K, ManagedItem<Boolean>> entry : _map.entrySet() ) {
if ( !entry.getValue()._value.booleanValue() && !isExpired( entry.getValue() ) ) {
result.add( entry.getKey() );
... | java | public Set<K> getUnavailableNodes() {
final Set<K> result = new HashSet<K>();
for ( final Map.Entry<K, ManagedItem<Boolean>> entry : _map.entrySet() ) {
if ( !entry.getValue()._value.booleanValue() && !isExpired( entry.getValue() ) ) {
result.add( entry.getKey() );
... | [
"public",
"Set",
"<",
"K",
">",
"getUnavailableNodes",
"(",
")",
"{",
"final",
"Set",
"<",
"K",
">",
"result",
"=",
"new",
"HashSet",
"<",
"K",
">",
"(",
")",
";",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"K",
",",
"ManagedItem",
"<",
"Bool... | A set of nodes that are stored as unavailable.
@return a set of unavailable nodes, never <code>null</code>. | [
"A",
"set",
"of",
"nodes",
"that",
"are",
"stored",
"as",
"unavailable",
"."
] | 716e147c9840ab10298c4d2b9edd0662058331e6 | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/NodeAvailabilityCache.java#L156-L164 | train |
aerogear/aerogear-unifiedpush-server | jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/util/HealthCheck.java | HealthCheck.health | @GET
@Path("/health")
@Produces(MediaType.APPLICATION_JSON)
public HealthStatus health() throws ExecutionException, InterruptedException {
final HealthStatus status = new HealthStatus();
final Future<HealthDetails> dbStatus = healthDBService.dbStatus();
final Future<List<HealthDetai... | java | @GET
@Path("/health")
@Produces(MediaType.APPLICATION_JSON)
public HealthStatus health() throws ExecutionException, InterruptedException {
final HealthStatus status = new HealthStatus();
final Future<HealthDetails> dbStatus = healthDBService.dbStatus();
final Future<List<HealthDetai... | [
"@",
"GET",
"@",
"Path",
"(",
"\"/health\"",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"public",
"HealthStatus",
"health",
"(",
")",
"throws",
"ExecutionException",
",",
"InterruptedException",
"{",
"final",
"HealthStatus",
"status",
... | Get health status
@return {@link HealthStatus} with details
@throws ExecutionException The computation of health status threw an exception
@throws InterruptedException The thread, which compute health status, was interrupted | [
"Get",
"health",
"status"
] | c7b798f085449117d84345d8c378b27165cad32b | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/util/HealthCheck.java#L60-L73 | train |
aerogear/aerogear-unifiedpush-server | service/src/main/java/org/jboss/aerogear/unifiedpush/service/impl/SearchManager.java | SearchManager.extractUsername | @Produces
@LoggedIn
public String extractUsername() {
final KeycloakPrincipal principal = (KeycloakPrincipal) httpServletRequest.getUserPrincipal();
if (principal != null) {
logger.debug("Running with Keycloak context");
KeycloakSecurityContext kcSecurityContext = princi... | java | @Produces
@LoggedIn
public String extractUsername() {
final KeycloakPrincipal principal = (KeycloakPrincipal) httpServletRequest.getUserPrincipal();
if (principal != null) {
logger.debug("Running with Keycloak context");
KeycloakSecurityContext kcSecurityContext = princi... | [
"@",
"Produces",
"@",
"LoggedIn",
"public",
"String",
"extractUsername",
"(",
")",
"{",
"final",
"KeycloakPrincipal",
"principal",
"=",
"(",
"KeycloakPrincipal",
")",
"httpServletRequest",
".",
"getUserPrincipal",
"(",
")",
";",
"if",
"(",
"principal",
"!=",
"nu... | Extract the username to be used in multiple queries
@return current logged in user | [
"Extract",
"the",
"username",
"to",
"be",
"used",
"in",
"multiple",
"queries"
] | c7b798f085449117d84345d8c378b27165cad32b | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/service/src/main/java/org/jboss/aerogear/unifiedpush/service/impl/SearchManager.java#L75-L95 | train |
aerogear/aerogear-unifiedpush-server | jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/util/HttpRequestUtil.java | HttpRequestUtil.extractAeroGearSenderInformation | public static String extractAeroGearSenderInformation(final HttpServletRequest request) {
String client = request.getHeader("aerogear-sender");
if (hasValue(client)) {
return client;
}
// if there was no usage of our custom header, we simply return the user-agent value
... | java | public static String extractAeroGearSenderInformation(final HttpServletRequest request) {
String client = request.getHeader("aerogear-sender");
if (hasValue(client)) {
return client;
}
// if there was no usage of our custom header, we simply return the user-agent value
... | [
"public",
"static",
"String",
"extractAeroGearSenderInformation",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"String",
"client",
"=",
"request",
".",
"getHeader",
"(",
"\"aerogear-sender\"",
")",
";",
"if",
"(",
"hasValue",
"(",
"client",
")",
")",
... | Reads the "aerogear-sender" header to check if an AeroGear Sender client was used. If the header value is NULL
the value of the standard "user-agent" header is returned
@param request to inspect
@return value of header | [
"Reads",
"the",
"aerogear",
"-",
"sender",
"header",
"to",
"check",
"if",
"an",
"AeroGear",
"Sender",
"client",
"was",
"used",
".",
"If",
"the",
"header",
"value",
"is",
"NULL",
"the",
"value",
"of",
"the",
"standard",
"user",
"-",
"agent",
"header",
"is... | c7b798f085449117d84345d8c378b27165cad32b | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/util/HttpRequestUtil.java#L66-L73 | train |
aerogear/aerogear-unifiedpush-server | jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/applications/AndroidVariantEndpoint.java | AndroidVariantEndpoint.updateAndroidVariant | @PUT
@Path("/{androidID}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updateAndroidVariant(
@PathParam("pushAppID") String id,
@PathParam("androidID") String androidID,
AndroidVariant updatedAndroidApplication) {
... | java | @PUT
@Path("/{androidID}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updateAndroidVariant(
@PathParam("pushAppID") String id,
@PathParam("androidID") String androidID,
AndroidVariant updatedAndroidApplication) {
... | [
"@",
"PUT",
"@",
"Path",
"(",
"\"/{androidID}\"",
")",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"public",
"Response",
"updateAndroidVariant",
"(",
"@",
"PathParam",
"(",
"... | Update Android Variant
@param id id of {@link PushApplication}
@param androidID id of {@link AndroidVariant}
@param updatedAndroidApplication new info of {@link AndroidVariant}
@return updated {@link AndroidVariant}
@statuscode 200 The Android Variant updated s... | [
"Update",
"Android",
"Variant"
] | c7b798f085449117d84345d8c378b27165cad32b | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/applications/AndroidVariantEndpoint.java#L119-L155 | train |
aerogear/aerogear-unifiedpush-server | model/api/src/main/java/org/jboss/aerogear/unifiedpush/api/validation/DeviceTokenValidator.java | DeviceTokenValidator.isValidDeviceTokenForVariant | public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) {
switch (type) {
case IOS:
return IOS_DEVICE_TOKEN.matcher(deviceToken).matches();
case ANDROID:
return ANDROID_DEVICE_TOKEN.matcher(deviceToken).matches(... | java | public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) {
switch (type) {
case IOS:
return IOS_DEVICE_TOKEN.matcher(deviceToken).matches();
case ANDROID:
return ANDROID_DEVICE_TOKEN.matcher(deviceToken).matches(... | [
"public",
"static",
"boolean",
"isValidDeviceTokenForVariant",
"(",
"final",
"String",
"deviceToken",
",",
"final",
"VariantType",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"IOS",
":",
"return",
"IOS_DEVICE_TOKEN",
".",
"matcher",
"(",
"deviceTo... | Helper to run quick up-front validations.
@param deviceToken the submitted device token
@param type type of the variant
@return true if the token is valid | [
"Helper",
"to",
"run",
"quick",
"up",
"-",
"front",
"validations",
"."
] | c7b798f085449117d84345d8c378b27165cad32b | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/model/api/src/main/java/org/jboss/aerogear/unifiedpush/api/validation/DeviceTokenValidator.java#L70-L80 | train |
aerogear/aerogear-unifiedpush-server | push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/token/TokenLoader.java | TokenLoader.tryToDispatchTokens | private boolean tryToDispatchTokens(MessageHolderWithTokens msg) {
try {
dispatchTokensEvent.fire(msg);
return true;
} catch (MessageDeliveryException e) {
Throwable cause = e.getCause();
if (isQueueFullException(cause)) {
return false;
... | java | private boolean tryToDispatchTokens(MessageHolderWithTokens msg) {
try {
dispatchTokensEvent.fire(msg);
return true;
} catch (MessageDeliveryException e) {
Throwable cause = e.getCause();
if (isQueueFullException(cause)) {
return false;
... | [
"private",
"boolean",
"tryToDispatchTokens",
"(",
"MessageHolderWithTokens",
"msg",
")",
"{",
"try",
"{",
"dispatchTokensEvent",
".",
"fire",
"(",
"msg",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"MessageDeliveryException",
"e",
")",
"{",
"Throwable",
... | Tries to dispatch tokens; returns true if tokens were successfully queued.
Detects when queue is full and in that case returns false.
@return returns true if tokens were successfully queued; returns false if queue was full | [
"Tries",
"to",
"dispatch",
"tokens",
";",
"returns",
"true",
"if",
"tokens",
"were",
"successfully",
"queued",
".",
"Detects",
"when",
"queue",
"is",
"full",
"and",
"in",
"that",
"case",
"returns",
"false",
"."
] | c7b798f085449117d84345d8c378b27165cad32b | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/token/TokenLoader.java#L236-L247 | train |
aerogear/aerogear-unifiedpush-server | service/src/main/java/org/jboss/aerogear/unifiedpush/service/util/FCMTopicManager.java | FCMTopicManager.delete | private int delete(String urlS) throws IOException {
URL url = new URL(urlS);
HttpURLConnection conn = prepareAuthorizedConnection(url);
conn.setRequestMethod("DELETE");
conn.connect();
return conn.getResponseCode();
} | java | private int delete(String urlS) throws IOException {
URL url = new URL(urlS);
HttpURLConnection conn = prepareAuthorizedConnection(url);
conn.setRequestMethod("DELETE");
conn.connect();
return conn.getResponseCode();
} | [
"private",
"int",
"delete",
"(",
"String",
"urlS",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"urlS",
")",
";",
"HttpURLConnection",
"conn",
"=",
"prepareAuthorizedConnection",
"(",
"url",
")",
";",
"conn",
".",
"setRequestMetho... | Sends DELETE HTTP request to provided URL. Request is authorized using Google API key.
@param urlS target URL string | [
"Sends",
"DELETE",
"HTTP",
"request",
"to",
"provided",
"URL",
".",
"Request",
"is",
"authorized",
"using",
"Google",
"API",
"key",
"."
] | c7b798f085449117d84345d8c378b27165cad32b | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/service/src/main/java/org/jboss/aerogear/unifiedpush/service/util/FCMTopicManager.java#L108-L114 | train |
aerogear/aerogear-unifiedpush-server | service/src/main/java/org/jboss/aerogear/unifiedpush/service/util/FCMTopicManager.java | FCMTopicManager.get | private String get(String urlS) throws IOException {
URL url = new URL(urlS);
HttpURLConnection conn = prepareAuthorizedConnection(url);
conn.setRequestMethod("GET");
// Read response
StringBuilder result = new StringBuilder();
try (BufferedReader rd = new BufferedReader(... | java | private String get(String urlS) throws IOException {
URL url = new URL(urlS);
HttpURLConnection conn = prepareAuthorizedConnection(url);
conn.setRequestMethod("GET");
// Read response
StringBuilder result = new StringBuilder();
try (BufferedReader rd = new BufferedReader(... | [
"private",
"String",
"get",
"(",
"String",
"urlS",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"urlS",
")",
";",
"HttpURLConnection",
"conn",
"=",
"prepareAuthorizedConnection",
"(",
"url",
")",
";",
"conn",
".",
"setRequestMetho... | Sends GET HTTP request to provided URL. Request is authorized using Google API key.
@param urlS target URL string | [
"Sends",
"GET",
"HTTP",
"request",
"to",
"provided",
"URL",
".",
"Request",
"is",
"authorized",
"using",
"Google",
"API",
"key",
"."
] | c7b798f085449117d84345d8c378b27165cad32b | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/service/src/main/java/org/jboss/aerogear/unifiedpush/service/util/FCMTopicManager.java#L121-L134 | train |
aerogear/aerogear-unifiedpush-server | push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/token/TokenLoaderUtils.java | TokenLoaderUtils.isCategoryOnlyCriteria | public static boolean isCategoryOnlyCriteria(final Criteria criteria) {
return isEmpty(criteria.getAliases()) && // we are not subscribing to alias topic (yet)
isEmpty(criteria.getDeviceTypes()) && // we are not subscribing to device type topic (yet)
!isEmpty(criteria.get... | java | public static boolean isCategoryOnlyCriteria(final Criteria criteria) {
return isEmpty(criteria.getAliases()) && // we are not subscribing to alias topic (yet)
isEmpty(criteria.getDeviceTypes()) && // we are not subscribing to device type topic (yet)
!isEmpty(criteria.get... | [
"public",
"static",
"boolean",
"isCategoryOnlyCriteria",
"(",
"final",
"Criteria",
"criteria",
")",
"{",
"return",
"isEmpty",
"(",
"criteria",
".",
"getAliases",
"(",
")",
")",
"&&",
"// we are not subscribing to alias topic (yet)",
"isEmpty",
"(",
"criteria",
".",
... | Helper method to check if only categories are applied. Useful in FCM land, where we use topics | [
"Helper",
"method",
"to",
"check",
"if",
"only",
"categories",
"are",
"applied",
".",
"Useful",
"in",
"FCM",
"land",
"where",
"we",
"use",
"topics"
] | c7b798f085449117d84345d8c378b27165cad32b | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/token/TokenLoaderUtils.java#L61-L66 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.