id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,100 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java | PacketParserUtils.parseStreamError | public static StreamError parseStreamError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth();
List<ExtensionElement> extensions = new ArrayList<>();
Map<String, String> descript... | java | public static StreamError parseStreamError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth();
List<ExtensionElement> extensions = new ArrayList<>();
Map<String, String> descript... | [
"public",
"static",
"StreamError",
"parseStreamError",
"(",
"XmlPullParser",
"parser",
",",
"XmlEnvironment",
"outerXmlEnvironment",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
",",
"SmackParsingException",
"{",
"final",
"int",
"initialDepth",
"=",
"parse... | Parses stream error packets.
@param parser the XML parser.
@param outerXmlEnvironment the outer XML environment (optional).
@return an stream error packet.
@throws IOException
@throws XmlPullParserException
@throws SmackParsingException | [
"Parses",
"stream",
"error",
"packets",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L821-L863 |
27,101 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java | PacketParserUtils.parseError | public static StanzaError.Builder parseError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth();
Map<String, String> descriptiveTexts = null;
XmlEnvironment stanzaErrorXmlEnviron... | java | public static StanzaError.Builder parseError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth();
Map<String, String> descriptiveTexts = null;
XmlEnvironment stanzaErrorXmlEnviron... | [
"public",
"static",
"StanzaError",
".",
"Builder",
"parseError",
"(",
"XmlPullParser",
"parser",
",",
"XmlEnvironment",
"outerXmlEnvironment",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
",",
"SmackParsingException",
"{",
"final",
"int",
"initialDepth",
... | Parses error sub-packets.
@param parser the XML parser.
@param outerXmlEnvironment the outer XML environment (optional).
@return an error sub-packet.
@throws IOException
@throws XmlPullParserException
@throws SmackParsingException | [
"Parses",
"error",
"sub",
"-",
"packets",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L879-L922 |
27,102 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java | PacketParserUtils.parseExtensionElement | public static ExtensionElement parseExtensionElement(String elementName, String namespace,
XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser);
// See if a provider is regis... | java | public static ExtensionElement parseExtensionElement(String elementName, String namespace,
XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser);
// See if a provider is regis... | [
"public",
"static",
"ExtensionElement",
"parseExtensionElement",
"(",
"String",
"elementName",
",",
"String",
"namespace",
",",
"XmlPullParser",
"parser",
",",
"XmlEnvironment",
"outerXmlEnvironment",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
",",
"Smac... | Parses an extension element.
@param elementName the XML element name of the extension element.
@param namespace the XML namespace of the stanza extension.
@param parser the XML parser, positioned at the starting element of the extension.
@param outerXmlEnvironment the outer XML environment (optional).
@return an exte... | [
"Parses",
"an",
"extension",
"element",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L937-L948 |
27,103 | igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java | MessageEventManager.fireMessageEventRequestListeners | private void fireMessageEventRequestListeners(
Jid from,
String packetID,
String methodName) {
try {
Method method =
MessageEventRequestListener.class.getDeclaredMethod(
methodName,
new Class<?>[] { Jid.class, String.cla... | java | private void fireMessageEventRequestListeners(
Jid from,
String packetID,
String methodName) {
try {
Method method =
MessageEventRequestListener.class.getDeclaredMethod(
methodName,
new Class<?>[] { Jid.class, String.cla... | [
"private",
"void",
"fireMessageEventRequestListeners",
"(",
"Jid",
"from",
",",
"String",
"packetID",
",",
"String",
"methodName",
")",
"{",
"try",
"{",
"Method",
"method",
"=",
"MessageEventRequestListener",
".",
"class",
".",
"getDeclaredMethod",
"(",
"methodName"... | Fires message event request listeners. | [
"Fires",
"message",
"event",
"request",
"listeners",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java#L170-L185 |
27,104 | igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java | MessageEventManager.fireMessageEventNotificationListeners | private void fireMessageEventNotificationListeners(
Jid from,
String packetID,
String methodName) {
try {
Method method =
MessageEventNotificationListener.class.getDeclaredMethod(
methodName,
new Class<?>[] { Jid.class, ... | java | private void fireMessageEventNotificationListeners(
Jid from,
String packetID,
String methodName) {
try {
Method method =
MessageEventNotificationListener.class.getDeclaredMethod(
methodName,
new Class<?>[] { Jid.class, ... | [
"private",
"void",
"fireMessageEventNotificationListeners",
"(",
"Jid",
"from",
",",
"String",
"packetID",
",",
"String",
"methodName",
")",
"{",
"try",
"{",
"Method",
"method",
"=",
"MessageEventNotificationListener",
".",
"class",
".",
"getDeclaredMethod",
"(",
"m... | Fires message event notification listeners. | [
"Fires",
"message",
"event",
"notification",
"listeners",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java#L190-L205 |
27,105 | igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java | MessageEventManager.sendDeliveredNotification | public void sendDeliveredNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
... | java | public void sendDeliveredNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
... | [
"public",
"void",
"sendDeliveredNotification",
"(",
"Jid",
"to",
",",
"String",
"packetID",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// Create the message to send",
"Message",
"msg",
"=",
"new",
"Message",
"(",
"to",
")",
";",
"// C... | Sends the notification that the message was delivered to the sender of the original message.
@param to the recipient of the notification.
@param packetID the id of the message to send.
@throws NotConnectedException
@throws InterruptedException | [
"Sends",
"the",
"notification",
"that",
"the",
"message",
"was",
"delivered",
"to",
"the",
"sender",
"of",
"the",
"original",
"message",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java#L215-L225 |
27,106 | igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java | MessageEventManager.sendDisplayedNotification | public void sendDisplayedNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
... | java | public void sendDisplayedNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
... | [
"public",
"void",
"sendDisplayedNotification",
"(",
"Jid",
"to",
",",
"String",
"packetID",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// Create the message to send",
"Message",
"msg",
"=",
"new",
"Message",
"(",
"to",
")",
";",
"// C... | Sends the notification that the message was displayed to the sender of the original message.
@param to the recipient of the notification.
@param packetID the id of the message to send.
@throws NotConnectedException
@throws InterruptedException | [
"Sends",
"the",
"notification",
"that",
"the",
"message",
"was",
"displayed",
"to",
"the",
"sender",
"of",
"the",
"original",
"message",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java#L235-L245 |
27,107 | igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java | MessageEventManager.sendComposingNotification | public void sendComposingNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
... | java | public void sendComposingNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
... | [
"public",
"void",
"sendComposingNotification",
"(",
"Jid",
"to",
",",
"String",
"packetID",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// Create the message to send",
"Message",
"msg",
"=",
"new",
"Message",
"(",
"to",
")",
";",
"// C... | Sends the notification that the receiver of the message is composing a reply.
@param to the recipient of the notification.
@param packetID the id of the message to send.
@throws NotConnectedException
@throws InterruptedException | [
"Sends",
"the",
"notification",
"that",
"the",
"receiver",
"of",
"the",
"message",
"is",
"composing",
"a",
"reply",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java#L255-L265 |
27,108 | igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java | MessageEventManager.sendCancelledNotification | public void sendCancelledNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
... | java | public void sendCancelledNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
... | [
"public",
"void",
"sendCancelledNotification",
"(",
"Jid",
"to",
",",
"String",
"packetID",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// Create the message to send",
"Message",
"msg",
"=",
"new",
"Message",
"(",
"to",
")",
";",
"// C... | Sends the notification that the receiver of the message has cancelled composing a reply.
@param to the recipient of the notification.
@param packetID the id of the message to send.
@throws NotConnectedException
@throws InterruptedException | [
"Sends",
"the",
"notification",
"that",
"the",
"receiver",
"of",
"the",
"message",
"has",
"cancelled",
"composing",
"a",
"reply",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java#L275-L285 |
27,109 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java | StreamNegotiator.createInitiationAccept | protected static StreamInitiation createInitiationAccept(
StreamInitiation streamInitiationOffer, String[] namespaces) {
StreamInitiation response = new StreamInitiation();
response.setTo(streamInitiationOffer.getFrom());
response.setFrom(streamInitiationOffer.getTo());
respo... | java | protected static StreamInitiation createInitiationAccept(
StreamInitiation streamInitiationOffer, String[] namespaces) {
StreamInitiation response = new StreamInitiation();
response.setTo(streamInitiationOffer.getFrom());
response.setFrom(streamInitiationOffer.getTo());
respo... | [
"protected",
"static",
"StreamInitiation",
"createInitiationAccept",
"(",
"StreamInitiation",
"streamInitiationOffer",
",",
"String",
"[",
"]",
"namespaces",
")",
"{",
"StreamInitiation",
"response",
"=",
"new",
"StreamInitiation",
"(",
")",
";",
"response",
".",
"set... | Creates the initiation acceptance stanza to forward to the stream
initiator.
@param streamInitiationOffer The offer from the stream initiator to connect for a stream.
@param namespaces The namespace that relates to the accepted means of transfer.
@return The response to be forwarded to the initiator. | [
"Creates",
"the",
"initiation",
"acceptance",
"stanza",
"to",
"forward",
"to",
"the",
"stream",
"initiator",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java#L75-L93 |
27,110 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java | AccountManager.getInstance | public static synchronized AccountManager getInstance(XMPPConnection connection) {
AccountManager accountManager = INSTANCES.get(connection);
if (accountManager == null) {
accountManager = new AccountManager(connection);
INSTANCES.put(connection, accountManager);
}
... | java | public static synchronized AccountManager getInstance(XMPPConnection connection) {
AccountManager accountManager = INSTANCES.get(connection);
if (accountManager == null) {
accountManager = new AccountManager(connection);
INSTANCES.put(connection, accountManager);
}
... | [
"public",
"static",
"synchronized",
"AccountManager",
"getInstance",
"(",
"XMPPConnection",
"connection",
")",
"{",
"AccountManager",
"accountManager",
"=",
"INSTANCES",
".",
"get",
"(",
"connection",
")",
";",
"if",
"(",
"accountManager",
"==",
"null",
")",
"{",
... | Returns the AccountManager instance associated with a given XMPPConnection.
@param connection the connection used to look for the proper ServiceDiscoveryManager.
@return the AccountManager associated with a given XMPPConnection. | [
"Returns",
"the",
"AccountManager",
"instance",
"associated",
"with",
"a",
"given",
"XMPPConnection",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java#L59-L66 |
27,111 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java | AccountManager.supportsAccountCreation | public boolean supportsAccountCreation() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// TODO: Replace this body with isSupported() and possible deprecate this method.
// Check if we already know that the server supports creating new accounts
if ... | java | public boolean supportsAccountCreation() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// TODO: Replace this body with isSupported() and possible deprecate this method.
// Check if we already know that the server supports creating new accounts
if ... | [
"public",
"boolean",
"supportsAccountCreation",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// TODO: Replace this body with isSupported() and possible deprecate this method.",
"// Check if we alr... | Returns true if the server supports creating new accounts. Many servers require
that you not be currently authenticated when creating new accounts, so the safest
behavior is to only create new accounts before having logged in to a server.
@return true if the server support creating new accounts.
@throws XMPPErrorExcep... | [
"Returns",
"true",
"if",
"the",
"server",
"supports",
"creating",
"new",
"accounts",
".",
"Many",
"servers",
"require",
"that",
"you",
"not",
"be",
"currently",
"authenticated",
"when",
"creating",
"new",
"accounts",
"so",
"the",
"safest",
"behavior",
"is",
"t... | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java#L139-L154 |
27,112 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java | AccountManager.createAccount | public void createAccount(Localpart username, String password) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// Create a map for all the required attributes, but give them blank values.
Map<String, String> attributes = new HashMap<>();
for (String... | java | public void createAccount(Localpart username, String password) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// Create a map for all the required attributes, but give them blank values.
Map<String, String> attributes = new HashMap<>();
for (String... | [
"public",
"void",
"createAccount",
"(",
"Localpart",
"username",
",",
"String",
"password",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// Create a map for all the required attributes, but giv... | Creates a new account using the specified username and password. The server may
require a number of extra account attributes such as an email address and phone
number. In that case, Smack will attempt to automatically set all required
attributes with blank values, which may or may not be accepted by the server.
Therefo... | [
"Creates",
"a",
"new",
"account",
"using",
"the",
"specified",
"username",
"and",
"password",
".",
"The",
"server",
"may",
"require",
"a",
"number",
"of",
"extra",
"account",
"attributes",
"such",
"as",
"an",
"email",
"address",
"and",
"phone",
"number",
"."... | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java#L248-L255 |
27,113 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java | AccountManager.changePassword | public void changePassword(String newPassword) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (!connection().isSecureConnection() && !allowSensitiveOperationOverInsecureConnection) {
throw new IllegalStateException("Changing password over insecure co... | java | public void changePassword(String newPassword) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (!connection().isSecureConnection() && !allowSensitiveOperationOverInsecureConnection) {
throw new IllegalStateException("Changing password over insecure co... | [
"public",
"void",
"changePassword",
"(",
"String",
"newPassword",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"connection",
"(",
")",
".",
"isSecureConnection",
"(",
... | Changes the password of the currently logged-in account. This operation can only
be performed after a successful login operation has been completed. Not all servers
support changing passwords; an XMPPException will be thrown when that is the case.
@param newPassword new password.
@throws IllegalStateException if not ... | [
"Changes",
"the",
"password",
"of",
"the",
"currently",
"logged",
"-",
"in",
"account",
".",
"This",
"operation",
"can",
"only",
"be",
"performed",
"after",
"a",
"successful",
"login",
"operation",
"has",
"been",
"completed",
".",
"Not",
"all",
"servers",
"s... | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java#L304-L315 |
27,114 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java | AccountManager.deleteAccount | public void deleteAccount() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Map<String, String> attributes = new HashMap<>();
// To delete an account, we add a single attribute, "remove", that is blank.
attributes.put("remove", "");
Registrat... | java | public void deleteAccount() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Map<String, String> attributes = new HashMap<>();
// To delete an account, we add a single attribute, "remove", that is blank.
attributes.put("remove", "");
Registrat... | [
"public",
"void",
"deleteAccount",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
"=",
"new",
"HashMap",
"<>",
"(",
")",
... | Deletes the currently logged-in account from the server. This operation can only
be performed after a successful login operation has been completed. Not all servers
support deleting accounts; an XMPPException will be thrown when that is the case.
@throws IllegalStateException if not currently logged-in to the server.
... | [
"Deletes",
"the",
"currently",
"logged",
"-",
"in",
"account",
"from",
"the",
"server",
".",
"This",
"operation",
"can",
"only",
"be",
"performed",
"after",
"a",
"successful",
"login",
"operation",
"has",
"been",
"completed",
".",
"Not",
"all",
"servers",
"s... | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java#L328-L336 |
27,115 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java | PingManager.maybeSchedulePingServerTask | private synchronized void maybeSchedulePingServerTask(int delta) {
maybeStopPingServerTask();
if (pingInterval > 0) {
int nextPingIn = pingInterval - delta;
LOGGER.fine("Scheduling ServerPingTask in " + nextPingIn + " seconds (pingInterval="
+ pingInte... | java | private synchronized void maybeSchedulePingServerTask(int delta) {
maybeStopPingServerTask();
if (pingInterval > 0) {
int nextPingIn = pingInterval - delta;
LOGGER.fine("Scheduling ServerPingTask in " + nextPingIn + " seconds (pingInterval="
+ pingInte... | [
"private",
"synchronized",
"void",
"maybeSchedulePingServerTask",
"(",
"int",
"delta",
")",
"{",
"maybeStopPingServerTask",
"(",
")",
";",
"if",
"(",
"pingInterval",
">",
"0",
")",
"{",
"int",
"nextPingIn",
"=",
"pingInterval",
"-",
"delta",
";",
"LOGGER",
"."... | Cancels any existing periodic ping task if there is one and schedules a new ping task if
pingInterval is greater then zero.
@param delta the delta to the last received stanza in seconds | [
"Cancels",
"any",
"existing",
"periodic",
"ping",
"task",
"if",
"there",
"is",
"one",
"and",
"schedules",
"a",
"new",
"ping",
"task",
"if",
"pingInterval",
"is",
"greater",
"then",
"zero",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java#L386-L394 |
27,116 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java | EntityCapsManager.addDiscoverInfoByNode | static void addDiscoverInfoByNode(String nodeVer, DiscoverInfo info) {
CAPS_CACHE.put(nodeVer, info);
if (persistentCache != null)
persistentCache.addDiscoverInfoByNodePersistent(nodeVer, info);
} | java | static void addDiscoverInfoByNode(String nodeVer, DiscoverInfo info) {
CAPS_CACHE.put(nodeVer, info);
if (persistentCache != null)
persistentCache.addDiscoverInfoByNodePersistent(nodeVer, info);
} | [
"static",
"void",
"addDiscoverInfoByNode",
"(",
"String",
"nodeVer",
",",
"DiscoverInfo",
"info",
")",
"{",
"CAPS_CACHE",
".",
"put",
"(",
"nodeVer",
",",
"info",
")",
";",
"if",
"(",
"persistentCache",
"!=",
"null",
")",
"persistentCache",
".",
"addDiscoverIn... | Add DiscoverInfo to the database.
@param nodeVer
The node and verification String (e.g.
"http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w=").
@param info
DiscoverInfo for the specified node. | [
"Add",
"DiscoverInfo",
"to",
"the",
"database",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java#L183-L188 |
27,117 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java | EntityCapsManager.getDiscoveryInfoByNodeVer | public static DiscoverInfo getDiscoveryInfoByNodeVer(String nodeVer) {
DiscoverInfo info = CAPS_CACHE.lookup(nodeVer);
// If it was not in CAPS_CACHE, try to retrieve the information from persistentCache
if (info == null && persistentCache != null) {
info = persistentCache.lookup(no... | java | public static DiscoverInfo getDiscoveryInfoByNodeVer(String nodeVer) {
DiscoverInfo info = CAPS_CACHE.lookup(nodeVer);
// If it was not in CAPS_CACHE, try to retrieve the information from persistentCache
if (info == null && persistentCache != null) {
info = persistentCache.lookup(no... | [
"public",
"static",
"DiscoverInfo",
"getDiscoveryInfoByNodeVer",
"(",
"String",
"nodeVer",
")",
"{",
"DiscoverInfo",
"info",
"=",
"CAPS_CACHE",
".",
"lookup",
"(",
"nodeVer",
")",
";",
"// If it was not in CAPS_CACHE, try to retrieve the information from persistentCache",
"if... | Retrieve DiscoverInfo for a specific node.
@param nodeVer
The node name (e.g.
"http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w=").
@return The corresponding DiscoverInfo or null if none is known. | [
"Retrieve",
"DiscoverInfo",
"for",
"a",
"specific",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java#L236-L253 |
27,118 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java | EntityCapsManager.areEntityCapsSupported | public boolean areEntityCapsSupported(Jid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return sdm.supportsFeature(jid, NAMESPACE);
} | java | public boolean areEntityCapsSupported(Jid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return sdm.supportsFeature(jid, NAMESPACE);
} | [
"public",
"boolean",
"areEntityCapsSupported",
"(",
"Jid",
"jid",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"return",
"sdm",
".",
"supportsFeature",
"(",
"jid",
",",
"NAMESPACE",
")... | Returns true if Entity Caps are supported by a given JID.
@param jid
@return true if the entity supports Entity Capabilities.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Returns",
"true",
"if",
"Entity",
"Caps",
"are",
"supported",
"by",
"a",
"given",
"JID",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java#L493-L495 |
27,119 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java | EntityCapsManager.updateLocalEntityCaps | private void updateLocalEntityCaps() {
XMPPConnection connection = connection();
DiscoverInfo discoverInfo = new DiscoverInfo();
discoverInfo.setType(IQ.Type.result);
sdm.addDiscoverInfoTo(discoverInfo);
// getLocalNodeVer() will return a result only after currentCapsVersion is... | java | private void updateLocalEntityCaps() {
XMPPConnection connection = connection();
DiscoverInfo discoverInfo = new DiscoverInfo();
discoverInfo.setType(IQ.Type.result);
sdm.addDiscoverInfoTo(discoverInfo);
// getLocalNodeVer() will return a result only after currentCapsVersion is... | [
"private",
"void",
"updateLocalEntityCaps",
"(",
")",
"{",
"XMPPConnection",
"connection",
"=",
"connection",
"(",
")",
";",
"DiscoverInfo",
"discoverInfo",
"=",
"new",
"DiscoverInfo",
"(",
")",
";",
"discoverInfo",
".",
"setType",
"(",
"IQ",
".",
"Type",
".",... | Updates the local user Entity Caps information with the data provided
If we are connected and there was already a presence send, another
presence is send to inform others about your new Entity Caps node string. | [
"Updates",
"the",
"local",
"user",
"Entity",
"Caps",
"information",
"with",
"the",
"data",
"provided"
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java#L517-L570 |
27,120 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java | EntityCapsManager.verifyDiscoverInfoVersion | public static boolean verifyDiscoverInfoVersion(String ver, String hash, DiscoverInfo info) {
// step 3.3 check for duplicate identities
if (info.containsDuplicateIdentities())
return false;
// step 3.4 check for duplicate features
if (info.containsDuplicateFeatures())
... | java | public static boolean verifyDiscoverInfoVersion(String ver, String hash, DiscoverInfo info) {
// step 3.3 check for duplicate identities
if (info.containsDuplicateIdentities())
return false;
// step 3.4 check for duplicate features
if (info.containsDuplicateFeatures())
... | [
"public",
"static",
"boolean",
"verifyDiscoverInfoVersion",
"(",
"String",
"ver",
",",
"String",
"hash",
",",
"DiscoverInfo",
"info",
")",
"{",
"// step 3.3 check for duplicate identities",
"if",
"(",
"info",
".",
"containsDuplicateIdentities",
"(",
")",
")",
"return"... | Verify DiscoverInfo and Caps Node as defined in XEP-0115 5.4 Processing
Method.
@see <a href="http://xmpp.org/extensions/xep-0115.html#ver-proc">XEP-0115
5.4 Processing Method</a>
@param ver
@param hash
@param info
@return true if it's valid and should be cache, false if not | [
"Verify",
"DiscoverInfo",
"and",
"Caps",
"Node",
"as",
"defined",
"in",
"XEP",
"-",
"0115",
"5",
".",
"4",
"Processing",
"Method",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java#L584-L603 |
27,121 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoKeyUtil.java | OmemoKeyUtil.preKeyPublicKeysForBundle | public HashMap<Integer, byte[]> preKeyPublicKeysForBundle(TreeMap<Integer, T_PreKey> preKeyHashMap) {
HashMap<Integer, byte[]> out = new HashMap<>();
for (Map.Entry<Integer, T_PreKey> e : preKeyHashMap.entrySet()) {
out.put(e.getKey(), preKeyForBundle(e.getValue()));
}
return... | java | public HashMap<Integer, byte[]> preKeyPublicKeysForBundle(TreeMap<Integer, T_PreKey> preKeyHashMap) {
HashMap<Integer, byte[]> out = new HashMap<>();
for (Map.Entry<Integer, T_PreKey> e : preKeyHashMap.entrySet()) {
out.put(e.getKey(), preKeyForBundle(e.getValue()));
}
return... | [
"public",
"HashMap",
"<",
"Integer",
",",
"byte",
"[",
"]",
">",
"preKeyPublicKeysForBundle",
"(",
"TreeMap",
"<",
"Integer",
",",
"T_PreKey",
">",
"preKeyHashMap",
")",
"{",
"HashMap",
"<",
"Integer",
",",
"byte",
"[",
"]",
">",
"out",
"=",
"new",
"Hash... | Prepare a whole bunche of preKeys for transport.
@param preKeyHashMap HashMap of preKeys
@return HashMap of byte arrays but with the same keyIds as key | [
"Prepare",
"a",
"whole",
"bunche",
"of",
"preKeys",
"for",
"transport",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoKeyUtil.java#L328-L334 |
27,122 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoKeyUtil.java | OmemoKeyUtil.addInBounds | public static int addInBounds(int value, int added) {
int avail = Integer.MAX_VALUE - value;
if (avail < added) {
return added - avail;
} else {
return value + added;
}
} | java | public static int addInBounds(int value, int added) {
int avail = Integer.MAX_VALUE - value;
if (avail < added) {
return added - avail;
} else {
return value + added;
}
} | [
"public",
"static",
"int",
"addInBounds",
"(",
"int",
"value",
",",
"int",
"added",
")",
"{",
"int",
"avail",
"=",
"Integer",
".",
"MAX_VALUE",
"-",
"value",
";",
"if",
"(",
"avail",
"<",
"added",
")",
"{",
"return",
"added",
"-",
"avail",
";",
"}",
... | Add integers modulo MAX_VALUE.
@param value base integer
@param added value that is added to the base value
@return (value plus added) modulo Integer.MAX_VALUE | [
"Add",
"integers",
"modulo",
"MAX_VALUE",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoKeyUtil.java#L383-L390 |
27,123 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/disco/packet/DiscoverItems.java | DiscoverItems.addItems | public void addItems(Collection<Item> itemsToAdd) {
if (itemsToAdd == null) return;
for (Item i : itemsToAdd) {
addItem(i);
}
} | java | public void addItems(Collection<Item> itemsToAdd) {
if (itemsToAdd == null) return;
for (Item i : itemsToAdd) {
addItem(i);
}
} | [
"public",
"void",
"addItems",
"(",
"Collection",
"<",
"Item",
">",
"itemsToAdd",
")",
"{",
"if",
"(",
"itemsToAdd",
"==",
"null",
")",
"return",
";",
"for",
"(",
"Item",
"i",
":",
"itemsToAdd",
")",
"{",
"addItem",
"(",
"i",
")",
";",
"}",
"}"
] | Adds a collection of items to the discovered information. Does nothing if itemsToAdd is null
@param itemsToAdd | [
"Adds",
"a",
"collection",
"of",
"items",
"to",
"the",
"discovered",
"information",
".",
"Does",
"nothing",
"if",
"itemsToAdd",
"is",
"null"
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/packet/DiscoverItems.java#L64-L69 |
27,124 | igniterealtime/Smack | smack-im/src/main/java/org/jivesoftware/smack/chat/Chat.java | Chat.sendMessage | public void sendMessage(Message message) throws NotConnectedException, InterruptedException {
// Force the recipient, message type, and thread ID since the user elected
// to send the message through this chat object.
message.setTo(participant);
message.setType(Message.Type.chat);
... | java | public void sendMessage(Message message) throws NotConnectedException, InterruptedException {
// Force the recipient, message type, and thread ID since the user elected
// to send the message through this chat object.
message.setTo(participant);
message.setType(Message.Type.chat);
... | [
"public",
"void",
"sendMessage",
"(",
"Message",
"message",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// Force the recipient, message type, and thread ID since the user elected",
"// to send the message through this chat object.",
"message",
".",
"set... | Sends a message to the other chat participant. The thread ID, recipient,
and message type of the message will automatically set to those of this chat.
@param message the message to send.
@throws NotConnectedException
@throws InterruptedException | [
"Sends",
"a",
"message",
"to",
"the",
"other",
"chat",
"participant",
".",
"The",
"thread",
"ID",
"recipient",
"and",
"message",
"type",
"of",
"the",
"message",
"will",
"automatically",
"set",
"to",
"those",
"of",
"this",
"chat",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/chat/Chat.java#L114-L121 |
27,125 | igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/CarbonManager.java | CarbonManager.getInstanceFor | public static synchronized CarbonManager getInstanceFor(XMPPConnection connection) {
CarbonManager carbonManager = INSTANCES.get(connection);
if (carbonManager == null) {
carbonManager = new CarbonManager(connection);
INSTANCES.put(connection, carbonManager);
}
... | java | public static synchronized CarbonManager getInstanceFor(XMPPConnection connection) {
CarbonManager carbonManager = INSTANCES.get(connection);
if (carbonManager == null) {
carbonManager = new CarbonManager(connection);
INSTANCES.put(connection, carbonManager);
}
... | [
"public",
"static",
"synchronized",
"CarbonManager",
"getInstanceFor",
"(",
"XMPPConnection",
"connection",
")",
"{",
"CarbonManager",
"carbonManager",
"=",
"INSTANCES",
".",
"get",
"(",
"connection",
")",
";",
"if",
"(",
"carbonManager",
"==",
"null",
")",
"{",
... | Obtain the CarbonManager responsible for a connection.
@param connection the connection object.
@return a CarbonManager instance | [
"Obtain",
"the",
"CarbonManager",
"responsible",
"for",
"a",
"connection",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/CarbonManager.java#L179-L188 |
27,126 | igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/CarbonManager.java | CarbonManager.setCarbonsEnabled | public synchronized void setCarbonsEnabled(final boolean new_state) throws NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException {
if (enabled_state == new_state)
return;
IQ setIQ = carbonsEnabledIQ(new_state);
connection().createS... | java | public synchronized void setCarbonsEnabled(final boolean new_state) throws NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException {
if (enabled_state == new_state)
return;
IQ setIQ = carbonsEnabledIQ(new_state);
connection().createS... | [
"public",
"synchronized",
"void",
"setCarbonsEnabled",
"(",
"final",
"boolean",
"new_state",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"enabled_state",
"==",
"new_state",
"... | Notify server to change the carbons state. This method blocks
some time until the server replies to the IQ and returns true on
success.
You should first check for support using isSupportedByServer().
@param new_state whether carbons should be enabled or disabled
@throws XMPPErrorException
@throws NoResponseException
... | [
"Notify",
"server",
"to",
"change",
"the",
"carbons",
"state",
".",
"This",
"method",
"blocks",
"some",
"time",
"until",
"the",
"server",
"replies",
"to",
"the",
"IQ",
"and",
"returns",
"true",
"on",
"success",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/CarbonManager.java#L311-L320 |
27,127 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java | AMPManager.isServiceEnabled | public static boolean isServiceEnabled(XMPPConnection connection) {
connection.getXMPPServiceDomain();
return ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(AMPExtension.NAMESPACE);
} | java | public static boolean isServiceEnabled(XMPPConnection connection) {
connection.getXMPPServiceDomain();
return ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(AMPExtension.NAMESPACE);
} | [
"public",
"static",
"boolean",
"isServiceEnabled",
"(",
"XMPPConnection",
"connection",
")",
"{",
"connection",
".",
"getXMPPServiceDomain",
"(",
")",
";",
"return",
"ServiceDiscoveryManager",
".",
"getInstanceFor",
"(",
"connection",
")",
".",
"includesFeature",
"(",... | Returns true if the AMP support is enabled for the given connection.
@param connection the connection to look for AMP support
@return a boolean indicating if the AMP support is enabled for the given connection | [
"Returns",
"true",
"if",
"the",
"AMP",
"support",
"is",
"enabled",
"for",
"the",
"given",
"connection",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java#L78-L81 |
27,128 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java | AMPManager.isActionSupported | public static boolean isActionSupported(XMPPConnection connection, AMPExtension.Action action) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
String featureName = AMPExtension.NAMESPACE + "?action=" + action.toString();
return isFeatureSupportedByServer(con... | java | public static boolean isActionSupported(XMPPConnection connection, AMPExtension.Action action) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
String featureName = AMPExtension.NAMESPACE + "?action=" + action.toString();
return isFeatureSupportedByServer(con... | [
"public",
"static",
"boolean",
"isActionSupported",
"(",
"XMPPConnection",
"connection",
",",
"AMPExtension",
".",
"Action",
"action",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"String"... | Check if server supports specified action.
@param connection active xmpp connection
@param action action to check
@return true if this action is supported.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Check",
"if",
"server",
"supports",
"specified",
"action",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java#L93-L96 |
27,129 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java | AMPManager.isConditionSupported | public static boolean isConditionSupported(XMPPConnection connection, String conditionName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
String featureName = AMPExtension.NAMESPACE + "?condition=" + conditionName;
return isFeatureSupportedByServer(connect... | java | public static boolean isConditionSupported(XMPPConnection connection, String conditionName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
String featureName = AMPExtension.NAMESPACE + "?condition=" + conditionName;
return isFeatureSupportedByServer(connect... | [
"public",
"static",
"boolean",
"isConditionSupported",
"(",
"XMPPConnection",
"connection",
",",
"String",
"conditionName",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"String",
"featureNam... | Check if server supports specified condition.
@param connection active xmpp connection
@param conditionName name of condition to check
@return true if this condition is supported.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
@see AMPDeliverCondition
@... | [
"Check",
"if",
"server",
"supports",
"specified",
"condition",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java#L111-L114 |
27,130 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/subprocess/kernel/SubProcessKernel.java | SubProcessKernel.getTotalCommandBytes | private int getTotalCommandBytes(SubProcessCommandLineArgs commands) {
int size = 0;
for (SubProcessCommandLineArgs.Command c : commands.getParameters()) {
size += c.value.length();
}
return size;
} | java | private int getTotalCommandBytes(SubProcessCommandLineArgs commands) {
int size = 0;
for (SubProcessCommandLineArgs.Command c : commands.getParameters()) {
size += c.value.length();
}
return size;
} | [
"private",
"int",
"getTotalCommandBytes",
"(",
"SubProcessCommandLineArgs",
"commands",
")",
"{",
"int",
"size",
"=",
"0",
";",
"for",
"(",
"SubProcessCommandLineArgs",
".",
"Command",
"c",
":",
"commands",
".",
"getParameters",
"(",
")",
")",
"{",
"size",
"+=... | Add up the total bytes used by the process.
@param commands
@return | [
"Add",
"up",
"the",
"total",
"bytes",
"used",
"by",
"the",
"process",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/subprocess/kernel/SubProcessKernel.java#L137-L143 |
27,131 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/subprocess/kernel/SubProcessKernel.java | SubProcessKernel.collectProcessResultsBytes | private byte[] collectProcessResultsBytes(Process process, ProcessBuilder builder,
SubProcessIOFiles outPutFiles) throws Exception {
Byte[] results;
try {
LOG.debug(String.format("Executing process %s", createLogEntryFromInputs(builder.command())));
// If process exit value is not 0 then s... | java | private byte[] collectProcessResultsBytes(Process process, ProcessBuilder builder,
SubProcessIOFiles outPutFiles) throws Exception {
Byte[] results;
try {
LOG.debug(String.format("Executing process %s", createLogEntryFromInputs(builder.command())));
// If process exit value is not 0 then s... | [
"private",
"byte",
"[",
"]",
"collectProcessResultsBytes",
"(",
"Process",
"process",
",",
"ProcessBuilder",
"builder",
",",
"SubProcessIOFiles",
"outPutFiles",
")",
"throws",
"Exception",
"{",
"Byte",
"[",
"]",
"results",
";",
"try",
"{",
"LOG",
".",
"debug",
... | Used when the reault file contains binary data.
@param process
@param builder
@param outPutFiles
@return Binary results
@throws Exception if process has non 0 value or no logs found then throw exception | [
"Used",
"when",
"the",
"reault",
"file",
"contains",
"binary",
"data",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/subprocess/kernel/SubProcessKernel.java#L226-L258 |
27,132 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/subprocess/kernel/SubProcessKernel.java | SubProcessKernel.appendExecutablePath | private ProcessBuilder appendExecutablePath(ProcessBuilder builder) {
String executable = builder.command().get(0);
if (executable == null) {
throw new IllegalArgumentException(
"No executable provided to the Process Builder... we will do... nothing... ");
}
builder.command().set(0,
... | java | private ProcessBuilder appendExecutablePath(ProcessBuilder builder) {
String executable = builder.command().get(0);
if (executable == null) {
throw new IllegalArgumentException(
"No executable provided to the Process Builder... we will do... nothing... ");
}
builder.command().set(0,
... | [
"private",
"ProcessBuilder",
"appendExecutablePath",
"(",
"ProcessBuilder",
"builder",
")",
"{",
"String",
"executable",
"=",
"builder",
".",
"command",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"executable",
"==",
"null",
")",
"{",
"throw",
"ne... | Pass the Path of the binary to the SubProcess in Command position 0 | [
"Pass",
"the",
"Path",
"of",
"the",
"binary",
"to",
"the",
"SubProcess",
"in",
"Command",
"position",
"0"
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/subprocess/kernel/SubProcessKernel.java#L301-L310 |
27,133 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/GameStats.java | GameStats.configureSessionWindowWrite | protected static Map<String, WriteWindowedToBigQuery.FieldInfo<Double>>
configureSessionWindowWrite() {
Map<String, WriteWindowedToBigQuery.FieldInfo<Double>> tableConfigure = new HashMap<>();
tableConfigure.put(
"window_start",
new WriteWindowedToBigQuery.FieldInfo<>(
"STRING... | java | protected static Map<String, WriteWindowedToBigQuery.FieldInfo<Double>>
configureSessionWindowWrite() {
Map<String, WriteWindowedToBigQuery.FieldInfo<Double>> tableConfigure = new HashMap<>();
tableConfigure.put(
"window_start",
new WriteWindowedToBigQuery.FieldInfo<>(
"STRING... | [
"protected",
"static",
"Map",
"<",
"String",
",",
"WriteWindowedToBigQuery",
".",
"FieldInfo",
"<",
"Double",
">",
">",
"configureSessionWindowWrite",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"WriteWindowedToBigQuery",
".",
"FieldInfo",
"<",
"Double",
">",
">",... | Create a map of information that describes how to write pipeline output to BigQuery. This map
is used to write information about mean user session time. | [
"Create",
"a",
"map",
"of",
"information",
"that",
"describes",
"how",
"to",
"write",
"pipeline",
"output",
"to",
"BigQuery",
".",
"This",
"map",
"is",
"used",
"to",
"write",
"information",
"about",
"mean",
"user",
"session",
"time",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/GameStats.java#L212-L227 |
27,134 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/subprocess/utils/FileUtils.java | FileUtils.createDirectoriesOnWorker | public static void createDirectoriesOnWorker(SubProcessConfiguration configuration)
throws IOException {
try {
Path path = Paths.get(configuration.getWorkerPath());
if (!path.toFile().exists()) {
Files.createDirectories(path);
LOG.info(String.format("Created Folder %s ", path.to... | java | public static void createDirectoriesOnWorker(SubProcessConfiguration configuration)
throws IOException {
try {
Path path = Paths.get(configuration.getWorkerPath());
if (!path.toFile().exists()) {
Files.createDirectories(path);
LOG.info(String.format("Created Folder %s ", path.to... | [
"public",
"static",
"void",
"createDirectoriesOnWorker",
"(",
"SubProcessConfiguration",
"configuration",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Path",
"path",
"=",
"Paths",
".",
"get",
"(",
"configuration",
".",
"getWorkerPath",
"(",
")",
")",
";",
"if... | Create directories needed based on configuration.
@param configuration
@throws IOException | [
"Create",
"directories",
"needed",
"based",
"on",
"configuration",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/subprocess/utils/FileUtils.java#L134-L150 |
27,135 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/InjectorUtils.java | InjectorUtils.getClient | public static Pubsub getClient(final HttpTransport httpTransport,
final JsonFactory jsonFactory)
throws IOException {
checkNotNull(httpTransport);
checkNotNull(jsonFactory);
GoogleCredential credential =
GoogleCredential.getApplicationDefault(httpT... | java | public static Pubsub getClient(final HttpTransport httpTransport,
final JsonFactory jsonFactory)
throws IOException {
checkNotNull(httpTransport);
checkNotNull(jsonFactory);
GoogleCredential credential =
GoogleCredential.getApplicationDefault(httpT... | [
"public",
"static",
"Pubsub",
"getClient",
"(",
"final",
"HttpTransport",
"httpTransport",
",",
"final",
"JsonFactory",
"jsonFactory",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"httpTransport",
")",
";",
"checkNotNull",
"(",
"jsonFactory",
")",
";",
... | Builds a new Pubsub client and returns it. | [
"Builds",
"a",
"new",
"Pubsub",
"client",
"and",
"returns",
"it",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/InjectorUtils.java#L41-L64 |
27,136 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/InjectorUtils.java | InjectorUtils.createTopic | public static void createTopic(Pubsub client, String fullTopicName)
throws IOException {
System.out.println("fullTopicName " + fullTopicName);
try {
client.projects().topics().get(fullTopicName).execute();
} catch (GoogleJsonResponseException e) {
if (e.getStatusCode() == HttpStatusCodes... | java | public static void createTopic(Pubsub client, String fullTopicName)
throws IOException {
System.out.println("fullTopicName " + fullTopicName);
try {
client.projects().topics().get(fullTopicName).execute();
} catch (GoogleJsonResponseException e) {
if (e.getStatusCode() == HttpStatusCodes... | [
"public",
"static",
"void",
"createTopic",
"(",
"Pubsub",
"client",
",",
"String",
"fullTopicName",
")",
"throws",
"IOException",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"fullTopicName \"",
"+",
"fullTopicName",
")",
";",
"try",
"{",
"client",
".",
... | Create a topic if it doesn't exist. | [
"Create",
"a",
"topic",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/InjectorUtils.java#L87-L100 |
27,137 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/StatefulTeamScore.java | StatefulTeamScore.configureCompleteWindowedTableWrite | private static Map<String, FieldInfo<KV<String, Integer>>> configureCompleteWindowedTableWrite() {
Map<String, WriteWindowedToBigQuery.FieldInfo<KV<String, Integer>>> tableConfigure =
new HashMap<>();
tableConfigure.put(
"team", new WriteWindowedToBigQuery.FieldInfo<>("STRING", (c, w) -> c.elem... | java | private static Map<String, FieldInfo<KV<String, Integer>>> configureCompleteWindowedTableWrite() {
Map<String, WriteWindowedToBigQuery.FieldInfo<KV<String, Integer>>> tableConfigure =
new HashMap<>();
tableConfigure.put(
"team", new WriteWindowedToBigQuery.FieldInfo<>("STRING", (c, w) -> c.elem... | [
"private",
"static",
"Map",
"<",
"String",
",",
"FieldInfo",
"<",
"KV",
"<",
"String",
",",
"Integer",
">",
">",
">",
"configureCompleteWindowedTableWrite",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"WriteWindowedToBigQuery",
".",
"FieldInfo",
"<",
"KV",
"<"... | Create a map of information that describes how to write pipeline output to BigQuery. This map
is used to write team score sums. | [
"Create",
"a",
"map",
"of",
"information",
"that",
"describes",
"how",
"to",
"write",
"pipeline",
"output",
"to",
"BigQuery",
".",
"This",
"map",
"is",
"used",
"to",
"write",
"team",
"score",
"sums",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/StatefulTeamScore.java#L97-L111 |
27,138 | spotify/scio | scio-core/src/main/java/com/spotify/scio/util/RemoteFileUtil.java | RemoteFileUtil.delete | public void delete(URI src) {
Path dst = null;
try {
dst = paths.get(src);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
try {
Files.deleteIfExists(dst);
paths.invalidate(src);
} catch (IOException e) {
String msg = String.format("Failed to delet... | java | public void delete(URI src) {
Path dst = null;
try {
dst = paths.get(src);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
try {
Files.deleteIfExists(dst);
paths.invalidate(src);
} catch (IOException e) {
String msg = String.format("Failed to delet... | [
"public",
"void",
"delete",
"(",
"URI",
"src",
")",
"{",
"Path",
"dst",
"=",
"null",
";",
"try",
"{",
"dst",
"=",
"paths",
".",
"get",
"(",
"src",
")",
";",
"}",
"catch",
"(",
"ExecutionException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
... | Delete a single downloaded local file. | [
"Delete",
"a",
"single",
"downloaded",
"local",
"file",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-core/src/main/java/com/spotify/scio/util/RemoteFileUtil.java#L117-L131 |
27,139 | spotify/scio | scio-core/src/main/java/com/spotify/scio/util/RemoteFileUtil.java | RemoteFileUtil.delete | public void delete(List<URI> srcs) {
for (URI src : srcs) {
delete(src);
}
paths.invalidateAll(srcs);
} | java | public void delete(List<URI> srcs) {
for (URI src : srcs) {
delete(src);
}
paths.invalidateAll(srcs);
} | [
"public",
"void",
"delete",
"(",
"List",
"<",
"URI",
">",
"srcs",
")",
"{",
"for",
"(",
"URI",
"src",
":",
"srcs",
")",
"{",
"delete",
"(",
"src",
")",
";",
"}",
"paths",
".",
"invalidateAll",
"(",
"srcs",
")",
";",
"}"
] | Delete a batch of downloaded local files. | [
"Delete",
"a",
"batch",
"of",
"downloaded",
"local",
"files",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-core/src/main/java/com/spotify/scio/util/RemoteFileUtil.java#L136-L141 |
27,140 | spotify/scio | scio-core/src/main/java/com/spotify/scio/util/RemoteFileUtil.java | RemoteFileUtil.copyToLocal | private static void copyToLocal(Metadata src, Path dst) throws IOException {
FileChannel dstCh = FileChannel.open(
dst, StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW);
ReadableByteChannel srcCh = FileSystems.open(src.resourceId());
long srcSize = src.sizeBytes();
long copied = 0;
d... | java | private static void copyToLocal(Metadata src, Path dst) throws IOException {
FileChannel dstCh = FileChannel.open(
dst, StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW);
ReadableByteChannel srcCh = FileSystems.open(src.resourceId());
long srcSize = src.sizeBytes();
long copied = 0;
d... | [
"private",
"static",
"void",
"copyToLocal",
"(",
"Metadata",
"src",
",",
"Path",
"dst",
")",
"throws",
"IOException",
"{",
"FileChannel",
"dstCh",
"=",
"FileChannel",
".",
"open",
"(",
"dst",
",",
"StandardOpenOption",
".",
"WRITE",
",",
"StandardOpenOption",
... | Copy a single file from remote source to local destination | [
"Copy",
"a",
"single",
"file",
"from",
"remote",
"source",
"to",
"local",
"destination"
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-core/src/main/java/com/spotify/scio/util/RemoteFileUtil.java#L219-L231 |
27,141 | spotify/scio | scio-core/src/main/java/com/spotify/scio/util/RemoteFileUtil.java | RemoteFileUtil.copyToRemote | private static void copyToRemote(Path src, URI dst) throws IOException {
ResourceId dstId = FileSystems.matchNewResource(dst.toString(), false);
WritableByteChannel dstCh = FileSystems.create(dstId, MimeTypes.BINARY);
FileChannel srcCh = FileChannel.open(src, StandardOpenOption.READ);
long srcSize = src... | java | private static void copyToRemote(Path src, URI dst) throws IOException {
ResourceId dstId = FileSystems.matchNewResource(dst.toString(), false);
WritableByteChannel dstCh = FileSystems.create(dstId, MimeTypes.BINARY);
FileChannel srcCh = FileChannel.open(src, StandardOpenOption.READ);
long srcSize = src... | [
"private",
"static",
"void",
"copyToRemote",
"(",
"Path",
"src",
",",
"URI",
"dst",
")",
"throws",
"IOException",
"{",
"ResourceId",
"dstId",
"=",
"FileSystems",
".",
"matchNewResource",
"(",
"dst",
".",
"toString",
"(",
")",
",",
"false",
")",
";",
"Writa... | Copy a single file from local source to remote destination | [
"Copy",
"a",
"single",
"file",
"from",
"local",
"source",
"to",
"remote",
"destination"
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-core/src/main/java/com/spotify/scio/util/RemoteFileUtil.java#L234-L246 |
27,142 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/cookbook/JoinExamples.java | JoinExamples.joinEvents | static PCollection<String> joinEvents(PCollection<TableRow> eventsTable,
PCollection<TableRow> countryCodes) throws Exception {
final TupleTag<String> eventInfoTag = new TupleTag<>();
final TupleTag<String> countryInfoTag = new TupleTag<>();
// transform both input collections to tuple collections, ... | java | static PCollection<String> joinEvents(PCollection<TableRow> eventsTable,
PCollection<TableRow> countryCodes) throws Exception {
final TupleTag<String> eventInfoTag = new TupleTag<>();
final TupleTag<String> countryInfoTag = new TupleTag<>();
// transform both input collections to tuple collections, ... | [
"static",
"PCollection",
"<",
"String",
">",
"joinEvents",
"(",
"PCollection",
"<",
"TableRow",
">",
"eventsTable",
",",
"PCollection",
"<",
"TableRow",
">",
"countryCodes",
")",
"throws",
"Exception",
"{",
"final",
"TupleTag",
"<",
"String",
">",
"eventInfoTag"... | Join two collections, using country code as the key. | [
"Join",
"two",
"collections",
"using",
"country",
"code",
"as",
"the",
"key",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/cookbook/JoinExamples.java#L68-L117 |
27,143 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/LeaderBoard.java | LeaderBoard.configureWindowedTableWrite | protected static Map<String, WriteWindowedToBigQuery.FieldInfo<KV<String, Integer>>>
configureWindowedTableWrite() {
Map<String, WriteWindowedToBigQuery.FieldInfo<KV<String, Integer>>> tableConfigure =
new HashMap<>();
tableConfigure.put(
"team", new WriteWindowedToBigQuery.FieldInfo<>("S... | java | protected static Map<String, WriteWindowedToBigQuery.FieldInfo<KV<String, Integer>>>
configureWindowedTableWrite() {
Map<String, WriteWindowedToBigQuery.FieldInfo<KV<String, Integer>>> tableConfigure =
new HashMap<>();
tableConfigure.put(
"team", new WriteWindowedToBigQuery.FieldInfo<>("S... | [
"protected",
"static",
"Map",
"<",
"String",
",",
"WriteWindowedToBigQuery",
".",
"FieldInfo",
"<",
"KV",
"<",
"String",
",",
"Integer",
">",
">",
">",
"configureWindowedTableWrite",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"WriteWindowedToBigQuery",
".",
"Fi... | Create a map of information that describes how to write pipeline output to BigQuery. This map
is used to write team score sums and includes event timing information. | [
"Create",
"a",
"map",
"of",
"information",
"that",
"describes",
"how",
"to",
"write",
"pipeline",
"output",
"to",
"BigQuery",
".",
"This",
"map",
"is",
"used",
"to",
"write",
"team",
"score",
"sums",
"and",
"includes",
"event",
"timing",
"information",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/LeaderBoard.java#L131-L158 |
27,144 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/LeaderBoard.java | LeaderBoard.configureGlobalWindowBigQueryWrite | protected static Map<String, WriteToBigQuery.FieldInfo<KV<String, Integer>>>
configureGlobalWindowBigQueryWrite() {
Map<String, WriteToBigQuery.FieldInfo<KV<String, Integer>>> tableConfigure =
configureBigQueryWrite();
tableConfigure.put(
"processing_time",
new WriteToBigQuery.Fie... | java | protected static Map<String, WriteToBigQuery.FieldInfo<KV<String, Integer>>>
configureGlobalWindowBigQueryWrite() {
Map<String, WriteToBigQuery.FieldInfo<KV<String, Integer>>> tableConfigure =
configureBigQueryWrite();
tableConfigure.put(
"processing_time",
new WriteToBigQuery.Fie... | [
"protected",
"static",
"Map",
"<",
"String",
",",
"WriteToBigQuery",
".",
"FieldInfo",
"<",
"KV",
"<",
"String",
",",
"Integer",
">",
">",
">",
"configureGlobalWindowBigQueryWrite",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"WriteToBigQuery",
".",
"FieldInfo",... | Create a map of information that describes how to write pipeline output to BigQuery. This map
is used to write user score sums. | [
"Create",
"a",
"map",
"of",
"information",
"that",
"describes",
"how",
"to",
"write",
"pipeline",
"output",
"to",
"BigQuery",
".",
"This",
"map",
"is",
"used",
"to",
"write",
"user",
"score",
"sums",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/LeaderBoard.java#L181-L191 |
27,145 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/snippets/Snippets.java | Snippets.formatCoGbkResults | public static String formatCoGbkResults(
String name, Iterable<String> emails, Iterable<String> phones) {
List<String> emailsList = new ArrayList<>();
for (String elem : emails) {
emailsList.add("'" + elem + "'");
}
Collections.sort(emailsList);
String emailsStr = "[" + String.join(", "... | java | public static String formatCoGbkResults(
String name, Iterable<String> emails, Iterable<String> phones) {
List<String> emailsList = new ArrayList<>();
for (String elem : emails) {
emailsList.add("'" + elem + "'");
}
Collections.sort(emailsList);
String emailsStr = "[" + String.join(", "... | [
"public",
"static",
"String",
"formatCoGbkResults",
"(",
"String",
"name",
",",
"Iterable",
"<",
"String",
">",
"emails",
",",
"Iterable",
"<",
"String",
">",
"phones",
")",
"{",
"List",
"<",
"String",
">",
"emailsList",
"=",
"new",
"ArrayList",
"<>",
"(",... | Helper function to format results in coGroupByKeyTuple. | [
"Helper",
"function",
"to",
"format",
"results",
"in",
"coGroupByKeyTuple",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/snippets/Snippets.java#L365-L383 |
27,146 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/snippets/Snippets.java | Snippets.coGroupByKeyTuple | public static PCollection<String> coGroupByKeyTuple(
TupleTag<String> emailsTag,
TupleTag<String> phonesTag,
PCollection<KV<String, String>> emails,
PCollection<KV<String, String>> phones) {
// [START CoGroupByKeyTuple]
PCollection<KV<String, CoGbkResult>> results =
KeyedPCollec... | java | public static PCollection<String> coGroupByKeyTuple(
TupleTag<String> emailsTag,
TupleTag<String> phonesTag,
PCollection<KV<String, String>> emails,
PCollection<KV<String, String>> phones) {
// [START CoGroupByKeyTuple]
PCollection<KV<String, CoGbkResult>> results =
KeyedPCollec... | [
"public",
"static",
"PCollection",
"<",
"String",
">",
"coGroupByKeyTuple",
"(",
"TupleTag",
"<",
"String",
">",
"emailsTag",
",",
"TupleTag",
"<",
"String",
">",
"phonesTag",
",",
"PCollection",
"<",
"KV",
"<",
"String",
",",
"String",
">",
">",
"emails",
... | Using a CoGroupByKey transform. | [
"Using",
"a",
"CoGroupByKey",
"transform",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/snippets/Snippets.java#L386-L414 |
27,147 | spotify/scio | scio-bigtable/src/main/java/com/spotify/scio/bigtable/BigtableUtil.java | BigtableUtil.getClusterSizes | public static Map<String, Integer> getClusterSizes(
final String projectId,
final String instanceId
) throws IOException, GeneralSecurityException {
try (BigtableClusterUtilities clusterUtil = BigtableClusterUtilities
.forInstance(projectId, instanceId)) {
return Collections.unmodifiable... | java | public static Map<String, Integer> getClusterSizes(
final String projectId,
final String instanceId
) throws IOException, GeneralSecurityException {
try (BigtableClusterUtilities clusterUtil = BigtableClusterUtilities
.forInstance(projectId, instanceId)) {
return Collections.unmodifiable... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Integer",
">",
"getClusterSizes",
"(",
"final",
"String",
"projectId",
",",
"final",
"String",
"instanceId",
")",
"throws",
"IOException",
",",
"GeneralSecurityException",
"{",
"try",
"(",
"BigtableClusterUtilities",
... | Get size of all clusters for specified Bigtable instance.
@param projectId GCP projectId
@param instanceId Bigtable instanceId
@return map of clusterId to its number of nodes
@throws IOException If setting up channel pool fails
@throws GeneralSecurityException If security-related exceptions occurs | [
"Get",
"size",
"of",
"all",
"clusters",
"for",
"specified",
"Bigtable",
"instance",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-bigtable/src/main/java/com/spotify/scio/bigtable/BigtableUtil.java#L121-L133 |
27,148 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/common/ExampleUtils.java | ExampleUtils.setupBigQueryTable | public void setupBigQueryTable() throws IOException {
ExampleBigQueryTableOptions bigQueryTableOptions =
options.as(ExampleBigQueryTableOptions.class);
if (bigQueryTableOptions.getBigQueryDataset() != null
&& bigQueryTableOptions.getBigQueryTable() != null
&& bigQueryTableOptions.getBigQ... | java | public void setupBigQueryTable() throws IOException {
ExampleBigQueryTableOptions bigQueryTableOptions =
options.as(ExampleBigQueryTableOptions.class);
if (bigQueryTableOptions.getBigQueryDataset() != null
&& bigQueryTableOptions.getBigQueryTable() != null
&& bigQueryTableOptions.getBigQ... | [
"public",
"void",
"setupBigQueryTable",
"(",
")",
"throws",
"IOException",
"{",
"ExampleBigQueryTableOptions",
"bigQueryTableOptions",
"=",
"options",
".",
"as",
"(",
"ExampleBigQueryTableOptions",
".",
"class",
")",
";",
"if",
"(",
"bigQueryTableOptions",
".",
"getBi... | Sets up the BigQuery table with the given schema.
<p>If the table already exists, the schema has to match the given one. Otherwise, the example
will throw a RuntimeException. If the table doesn't exist, a new table with the given schema
will be created.
@throws IOException if there is a problem setting up the BigQuer... | [
"Sets",
"up",
"the",
"BigQuery",
"table",
"with",
"the",
"given",
"schema",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/common/ExampleUtils.java#L153-L169 |
27,149 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/common/ExampleUtils.java | ExampleUtils.tearDown | private void tearDown() {
pendingMessages.add("*************************Tear Down*************************");
ExamplePubsubTopicAndSubscriptionOptions pubsubOptions =
options.as(ExamplePubsubTopicAndSubscriptionOptions.class);
if (!pubsubOptions.getPubsubTopic().isEmpty()) {
try {
dele... | java | private void tearDown() {
pendingMessages.add("*************************Tear Down*************************");
ExamplePubsubTopicAndSubscriptionOptions pubsubOptions =
options.as(ExamplePubsubTopicAndSubscriptionOptions.class);
if (!pubsubOptions.getPubsubTopic().isEmpty()) {
try {
dele... | [
"private",
"void",
"tearDown",
"(",
")",
"{",
"pendingMessages",
".",
"add",
"(",
"\"*************************Tear Down*************************\"",
")",
";",
"ExamplePubsubTopicAndSubscriptionOptions",
"pubsubOptions",
"=",
"options",
".",
"as",
"(",
"ExamplePubsubTopicAndSu... | Tears down external resources that can be deleted upon the example's completion. | [
"Tears",
"down",
"external",
"resources",
"that",
"can",
"be",
"deleted",
"upon",
"the",
"example",
"s",
"completion",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/common/ExampleUtils.java#L174-L212 |
27,150 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/common/ExampleUtils.java | ExampleUtils.waitToFinish | public void waitToFinish(PipelineResult result) {
pipelinesToCancel.add(result);
if (!options.as(ExampleOptions.class).getKeepJobsRunning()) {
addShutdownHook(pipelinesToCancel);
}
try {
result.waitUntilFinish();
} catch (UnsupportedOperationException e) {
// Do nothing if the give... | java | public void waitToFinish(PipelineResult result) {
pipelinesToCancel.add(result);
if (!options.as(ExampleOptions.class).getKeepJobsRunning()) {
addShutdownHook(pipelinesToCancel);
}
try {
result.waitUntilFinish();
} catch (UnsupportedOperationException e) {
// Do nothing if the give... | [
"public",
"void",
"waitToFinish",
"(",
"PipelineResult",
"result",
")",
"{",
"pipelinesToCancel",
".",
"add",
"(",
"result",
")",
";",
"if",
"(",
"!",
"options",
".",
"as",
"(",
"ExampleOptions",
".",
"class",
")",
".",
"getKeepJobsRunning",
"(",
")",
")",... | Waits for the pipeline to finish and cancels it before the program exists. | [
"Waits",
"for",
"the",
"pipeline",
"to",
"finish",
"and",
"cancels",
"it",
"before",
"the",
"program",
"exists",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/common/ExampleUtils.java#L331-L346 |
27,151 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/StreamingWordExtract.java | StreamingWordExtract.main | public static void main(String[] args) throws IOException {
StreamingWordExtractOptions options = PipelineOptionsFactory.fromArgs(args)
.withValidation()
.as(StreamingWordExtractOptions.class);
options.setStreaming(true);
options.setBigQuerySchema(StringToRowConverter.getSchema());
Exam... | java | public static void main(String[] args) throws IOException {
StreamingWordExtractOptions options = PipelineOptionsFactory.fromArgs(args)
.withValidation()
.as(StreamingWordExtractOptions.class);
options.setStreaming(true);
options.setBigQuerySchema(StringToRowConverter.getSchema());
Exam... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"StreamingWordExtractOptions",
"options",
"=",
"PipelineOptionsFactory",
".",
"fromArgs",
"(",
"args",
")",
".",
"withValidation",
"(",
")",
".",
"as",
"(",... | Sets up and starts streaming pipeline.
@throws IOException if there is a problem setting up resources | [
"Sets",
"up",
"and",
"starts",
"streaming",
"pipeline",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/StreamingWordExtract.java#L116-L145 |
27,152 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/subprocess/kernel/SubProcessIOFiles.java | SubProcessIOFiles.close | @Override
public void close() throws IOException {
if (Files.exists(outFile)) {
Files.delete(outFile);
}
if (Files.exists(errFile)) {
Files.delete(errFile);
}
if (Files.exists(resultFile)) {
Files.delete(resultFile);
}
} | java | @Override
public void close() throws IOException {
if (Files.exists(outFile)) {
Files.delete(outFile);
}
if (Files.exists(errFile)) {
Files.delete(errFile);
}
if (Files.exists(resultFile)) {
Files.delete(resultFile);
}
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Files",
".",
"exists",
"(",
"outFile",
")",
")",
"{",
"Files",
".",
"delete",
"(",
"outFile",
")",
";",
"}",
"if",
"(",
"Files",
".",
"exists",
"(",
"er... | Clean up the files that have been created on the local worker file system.
Without this expect both performance issues and eventual failure | [
"Clean",
"up",
"the",
"files",
"that",
"have",
"been",
"created",
"on",
"the",
"local",
"worker",
"file",
"system",
".",
"Without",
"this",
"expect",
"both",
"performance",
"issues",
"and",
"eventual",
"failure"
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/subprocess/kernel/SubProcessIOFiles.java#L90-L104 |
27,153 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/subprocess/kernel/SubProcessIOFiles.java | SubProcessIOFiles.copyOutPutFilesToBucket | public void copyOutPutFilesToBucket(SubProcessConfiguration configuration, String params) {
if (Files.exists(outFile) || Files.exists(errFile)) {
try {
outFileLocation = FileUtils.copyFileFromWorkerToGCS(configuration, outFile);
} catch (Exception ex) {
LOG.error("Error uploading log fil... | java | public void copyOutPutFilesToBucket(SubProcessConfiguration configuration, String params) {
if (Files.exists(outFile) || Files.exists(errFile)) {
try {
outFileLocation = FileUtils.copyFileFromWorkerToGCS(configuration, outFile);
} catch (Exception ex) {
LOG.error("Error uploading log fil... | [
"public",
"void",
"copyOutPutFilesToBucket",
"(",
"SubProcessConfiguration",
"configuration",
",",
"String",
"params",
")",
"{",
"if",
"(",
"Files",
".",
"exists",
"(",
"outFile",
")",
"||",
"Files",
".",
"exists",
"(",
"errFile",
")",
")",
"{",
"try",
"{",
... | Will copy the output files to the GCS path setup via the configuration.
@param configuration
@param params | [
"Will",
"copy",
"the",
"output",
"files",
"to",
"the",
"GCS",
"path",
"setup",
"via",
"the",
"configuration",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/subprocess/kernel/SubProcessIOFiles.java#L111-L130 |
27,154 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/utils/WriteToBigQuery.java | WriteToBigQuery.getSchema | protected TableSchema getSchema() {
List<TableFieldSchema> fields = new ArrayList<>();
for (Map.Entry<String, FieldInfo<InputT>> entry : fieldInfo.entrySet()) {
String key = entry.getKey();
FieldInfo<InputT> fcnInfo = entry.getValue();
String bqType = fcnInfo.getFieldType();
fields.add(n... | java | protected TableSchema getSchema() {
List<TableFieldSchema> fields = new ArrayList<>();
for (Map.Entry<String, FieldInfo<InputT>> entry : fieldInfo.entrySet()) {
String key = entry.getKey();
FieldInfo<InputT> fcnInfo = entry.getValue();
String bqType = fcnInfo.getFieldType();
fields.add(n... | [
"protected",
"TableSchema",
"getSchema",
"(",
")",
"{",
"List",
"<",
"TableFieldSchema",
">",
"fields",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"FieldInfo",
"<",
"InputT",
">",
">",
"entry",
":... | Build the output table schema. | [
"Build",
"the",
"output",
"table",
"schema",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/utils/WriteToBigQuery.java#L113-L122 |
27,155 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/utils/WriteToBigQuery.java | WriteToBigQuery.getTable | static TableReference getTable(String projectId, String datasetId, String tableName) {
TableReference table = new TableReference();
table.setDatasetId(datasetId);
table.setProjectId(projectId);
table.setTableId(tableName);
return table;
} | java | static TableReference getTable(String projectId, String datasetId, String tableName) {
TableReference table = new TableReference();
table.setDatasetId(datasetId);
table.setProjectId(projectId);
table.setTableId(tableName);
return table;
} | [
"static",
"TableReference",
"getTable",
"(",
"String",
"projectId",
",",
"String",
"datasetId",
",",
"String",
"tableName",
")",
"{",
"TableReference",
"table",
"=",
"new",
"TableReference",
"(",
")",
";",
"table",
".",
"setDatasetId",
"(",
"datasetId",
")",
"... | Utility to construct an output table reference. | [
"Utility",
"to",
"construct",
"an",
"output",
"table",
"reference",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/utils/WriteToBigQuery.java#L138-L144 |
27,156 | spotify/scio | scio-core/src/main/java/com/spotify/scio/transforms/AsyncLookupDoFn.java | AsyncLookupDoFn.flush | private void flush(Consumer<Result> outputFn) {
Result r = results.poll();
while (r != null) {
outputFn.accept(r);
resultCount++;
r = results.poll();
}
} | java | private void flush(Consumer<Result> outputFn) {
Result r = results.poll();
while (r != null) {
outputFn.accept(r);
resultCount++;
r = results.poll();
}
} | [
"private",
"void",
"flush",
"(",
"Consumer",
"<",
"Result",
">",
"outputFn",
")",
"{",
"Result",
"r",
"=",
"results",
".",
"poll",
"(",
")",
";",
"while",
"(",
"r",
"!=",
"null",
")",
"{",
"outputFn",
".",
"accept",
"(",
"r",
")",
";",
"resultCount... | Flush pending errors and results | [
"Flush",
"pending",
"errors",
"and",
"results"
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-core/src/main/java/com/spotify/scio/transforms/AsyncLookupDoFn.java#L193-L200 |
27,157 | spotify/scio | scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java | PatchedBigQueryTableRowIterator.open | public void open() throws IOException, InterruptedException {
if (queryConfig != null) {
ref = executeQueryAndWaitForCompletion();
}
// Get table schema.
schema = getTable(ref).getSchema();
} | java | public void open() throws IOException, InterruptedException {
if (queryConfig != null) {
ref = executeQueryAndWaitForCompletion();
}
// Get table schema.
schema = getTable(ref).getSchema();
} | [
"public",
"void",
"open",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"queryConfig",
"!=",
"null",
")",
"{",
"ref",
"=",
"executeQueryAndWaitForCompletion",
"(",
")",
";",
"}",
"// Get table schema.",
"schema",
"=",
"getTable"... | Opens the table for read.
@throws IOException on failure | [
"Opens",
"the",
"table",
"for",
"read",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java#L138-L144 |
27,158 | spotify/scio | scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java | PatchedBigQueryTableRowIterator.getTypedCellValue | @Nullable private Object getTypedCellValue(TableFieldSchema fieldSchema, Object v) {
if (Data.isNull(v)) {
return null;
}
if (Objects.equals(fieldSchema.getMode(), "REPEATED")) {
TableFieldSchema elementSchema = fieldSchema.clone().setMode("REQUIRED");
@SuppressWarnings("unchecked")
... | java | @Nullable private Object getTypedCellValue(TableFieldSchema fieldSchema, Object v) {
if (Data.isNull(v)) {
return null;
}
if (Objects.equals(fieldSchema.getMode(), "REPEATED")) {
TableFieldSchema elementSchema = fieldSchema.clone().setMode("REQUIRED");
@SuppressWarnings("unchecked")
... | [
"@",
"Nullable",
"private",
"Object",
"getTypedCellValue",
"(",
"TableFieldSchema",
"fieldSchema",
",",
"Object",
"v",
")",
"{",
"if",
"(",
"Data",
".",
"isNull",
"(",
"v",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"Objects",
".",
"equals",
... | Adjusts a field returned from the BigQuery API to match what we will receive when running
BigQuery's export-to-GCS and parallel read, which is the efficient parallel implementation
used for batch jobs executed on the Beam Runners that perform initial splitting.
<p>The following is the relationship between BigQuery sch... | [
"Adjusts",
"a",
"field",
"returned",
"from",
"the",
"BigQuery",
"API",
"to",
"match",
"what",
"we",
"will",
"receive",
"when",
"running",
"BigQuery",
"s",
"export",
"-",
"to",
"-",
"GCS",
"and",
"parallel",
"read",
"which",
"is",
"the",
"efficient",
"paral... | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java#L214-L251 |
27,159 | spotify/scio | scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java | PatchedBigQueryTableRowIterator.getTable | private Table getTable(TableReference ref) throws IOException, InterruptedException {
Bigquery.Tables.Get get =
client.tables().get(ref.getProjectId(), ref.getDatasetId(), ref.getTableId());
return executeWithBackOff(
get,
String.format(
"Error opening BigQuery table %s of d... | java | private Table getTable(TableReference ref) throws IOException, InterruptedException {
Bigquery.Tables.Get get =
client.tables().get(ref.getProjectId(), ref.getDatasetId(), ref.getTableId());
return executeWithBackOff(
get,
String.format(
"Error opening BigQuery table %s of d... | [
"private",
"Table",
"getTable",
"(",
"TableReference",
"ref",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"Bigquery",
".",
"Tables",
".",
"Get",
"get",
"=",
"client",
".",
"tables",
"(",
")",
".",
"get",
"(",
"ref",
".",
"getProjectId",
... | Get the BiqQuery table. | [
"Get",
"the",
"BiqQuery",
"table",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java#L328-L338 |
27,160 | spotify/scio | scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java | PatchedBigQueryTableRowIterator.deleteTable | private void deleteTable(String datasetId, String tableId)
throws IOException, InterruptedException {
executeWithBackOff(
client.tables().delete(projectId, datasetId, tableId),
String.format(
"Error when trying to delete the temporary table %s in dataset %s of project %s. "
... | java | private void deleteTable(String datasetId, String tableId)
throws IOException, InterruptedException {
executeWithBackOff(
client.tables().delete(projectId, datasetId, tableId),
String.format(
"Error when trying to delete the temporary table %s in dataset %s of project %s. "
... | [
"private",
"void",
"deleteTable",
"(",
"String",
"datasetId",
",",
"String",
"tableId",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"executeWithBackOff",
"(",
"client",
".",
"tables",
"(",
")",
".",
"delete",
"(",
"projectId",
",",
"datasetId... | Delete the given table that is available in the given dataset. | [
"Delete",
"the",
"given",
"table",
"that",
"is",
"available",
"in",
"the",
"given",
"dataset",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java#L360-L368 |
27,161 | spotify/scio | scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java | PatchedBigQueryTableRowIterator.deleteDataset | private void deleteDataset(String datasetId) throws IOException, InterruptedException {
executeWithBackOff(
client.datasets().delete(projectId, datasetId),
String.format(
"Error when trying to delete the temporary dataset %s in project %s. "
+ "Manual deletion may be required... | java | private void deleteDataset(String datasetId) throws IOException, InterruptedException {
executeWithBackOff(
client.datasets().delete(projectId, datasetId),
String.format(
"Error when trying to delete the temporary dataset %s in project %s. "
+ "Manual deletion may be required... | [
"private",
"void",
"deleteDataset",
"(",
"String",
"datasetId",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"executeWithBackOff",
"(",
"client",
".",
"datasets",
"(",
")",
".",
"delete",
"(",
"projectId",
",",
"datasetId",
")",
",",
"String",... | Delete the given dataset. This will fail if the given dataset has any tables. | [
"Delete",
"the",
"given",
"dataset",
".",
"This",
"will",
"fail",
"if",
"the",
"given",
"dataset",
"has",
"any",
"tables",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java#L371-L378 |
27,162 | spotify/scio | scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java | PatchedBigQueryTableRowIterator.executeWithBackOff | public static <T> T executeWithBackOff(AbstractGoogleClientRequest<T> client, String error)
throws IOException, InterruptedException {
Sleeper sleeper = Sleeper.DEFAULT;
BackOff backOff =
BackOffAdapter.toGcpBackOff(
FluentBackoff.DEFAULT
.withMaxRetries(MAX_RETRIES).wi... | java | public static <T> T executeWithBackOff(AbstractGoogleClientRequest<T> client, String error)
throws IOException, InterruptedException {
Sleeper sleeper = Sleeper.DEFAULT;
BackOff backOff =
BackOffAdapter.toGcpBackOff(
FluentBackoff.DEFAULT
.withMaxRetries(MAX_RETRIES).wi... | [
"public",
"static",
"<",
"T",
">",
"T",
"executeWithBackOff",
"(",
"AbstractGoogleClientRequest",
"<",
"T",
">",
"client",
",",
"String",
"error",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"Sleeper",
"sleeper",
"=",
"Sleeper",
".",
"DEFAULT... | formatter parameter. | [
"formatter",
"parameter",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java#L460-L484 |
27,163 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java | Injector.randomElement | private static String randomElement(ArrayList<String> list) {
int index = random.nextInt(list.size());
return list.get(index);
} | java | private static String randomElement(ArrayList<String> list) {
int index = random.nextInt(list.size());
return list.get(index);
} | [
"private",
"static",
"String",
"randomElement",
"(",
"ArrayList",
"<",
"String",
">",
"list",
")",
"{",
"int",
"index",
"=",
"random",
".",
"nextInt",
"(",
"list",
".",
"size",
"(",
")",
")",
";",
"return",
"list",
".",
"get",
"(",
"index",
")",
";",... | Utility to grab a random element from an array of Strings. | [
"Utility",
"to",
"grab",
"a",
"random",
"element",
"from",
"an",
"array",
"of",
"Strings",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java#L217-L220 |
27,164 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java | Injector.randomTeam | private static TeamInfo randomTeam(ArrayList<TeamInfo> list) {
int index = random.nextInt(list.size());
TeamInfo team = list.get(index);
// If the selected team is expired, remove it and return a new team.
long currTime = System.currentTimeMillis();
if ((team.getEndTimeInMillis() < currTime) || team... | java | private static TeamInfo randomTeam(ArrayList<TeamInfo> list) {
int index = random.nextInt(list.size());
TeamInfo team = list.get(index);
// If the selected team is expired, remove it and return a new team.
long currTime = System.currentTimeMillis();
if ((team.getEndTimeInMillis() < currTime) || team... | [
"private",
"static",
"TeamInfo",
"randomTeam",
"(",
"ArrayList",
"<",
"TeamInfo",
">",
"list",
")",
"{",
"int",
"index",
"=",
"random",
".",
"nextInt",
"(",
"list",
".",
"size",
"(",
")",
")",
";",
"TeamInfo",
"team",
"=",
"list",
".",
"get",
"(",
"i... | Get and return a random team. If the selected team is too old w.r.t its expiration, remove
it, replacing it with a new team. | [
"Get",
"and",
"return",
"a",
"random",
"team",
".",
"If",
"the",
"selected",
"team",
"is",
"too",
"old",
"w",
".",
"r",
".",
"t",
"its",
"expiration",
"remove",
"it",
"replacing",
"it",
"with",
"a",
"new",
"team",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java#L226-L242 |
27,165 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java | Injector.addLiveTeam | private static synchronized TeamInfo addLiveTeam() {
String teamName = randomElement(COLORS) + randomElement(ANIMALS);
String robot = null;
// Decide if we want to add a robot to the team.
if (random.nextInt(ROBOT_PROBABILITY) == 0) {
robot = "Robot-" + random.nextInt(NUM_ROBOTS);
}
// Cre... | java | private static synchronized TeamInfo addLiveTeam() {
String teamName = randomElement(COLORS) + randomElement(ANIMALS);
String robot = null;
// Decide if we want to add a robot to the team.
if (random.nextInt(ROBOT_PROBABILITY) == 0) {
robot = "Robot-" + random.nextInt(NUM_ROBOTS);
}
// Cre... | [
"private",
"static",
"synchronized",
"TeamInfo",
"addLiveTeam",
"(",
")",
"{",
"String",
"teamName",
"=",
"randomElement",
"(",
"COLORS",
")",
"+",
"randomElement",
"(",
"ANIMALS",
")",
";",
"String",
"robot",
"=",
"null",
";",
"// Decide if we want to add a robot... | Create and add a team. Possibly add a robot to the team. | [
"Create",
"and",
"add",
"a",
"team",
".",
"Possibly",
"add",
"a",
"robot",
"to",
"the",
"team",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java#L247-L259 |
27,166 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java | Injector.removeTeam | private static synchronized void removeTeam(int teamIndex) {
TeamInfo removedTeam = liveTeams.remove(teamIndex);
System.out.println("[-" + removedTeam + "]");
} | java | private static synchronized void removeTeam(int teamIndex) {
TeamInfo removedTeam = liveTeams.remove(teamIndex);
System.out.println("[-" + removedTeam + "]");
} | [
"private",
"static",
"synchronized",
"void",
"removeTeam",
"(",
"int",
"teamIndex",
")",
"{",
"TeamInfo",
"removedTeam",
"=",
"liveTeams",
".",
"remove",
"(",
"teamIndex",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"[-\"",
"+",
"removedTeam",
"+"... | Remove a specific team. | [
"Remove",
"a",
"specific",
"team",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java#L264-L267 |
27,167 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java | Injector.generateEvent | private static String generateEvent(Long currTime, int delayInMillis) {
TeamInfo team = randomTeam(liveTeams);
String teamName = team.getTeamName();
String user;
final int parseErrorRate = 900000;
String robot = team.getRobot();
// If the team has an associated robot team member...
if (robo... | java | private static String generateEvent(Long currTime, int delayInMillis) {
TeamInfo team = randomTeam(liveTeams);
String teamName = team.getTeamName();
String user;
final int parseErrorRate = 900000;
String robot = team.getRobot();
// If the team has an associated robot team member...
if (robo... | [
"private",
"static",
"String",
"generateEvent",
"(",
"Long",
"currTime",
",",
"int",
"delayInMillis",
")",
"{",
"TeamInfo",
"team",
"=",
"randomTeam",
"(",
"liveTeams",
")",
";",
"String",
"teamName",
"=",
"team",
".",
"getTeamName",
"(",
")",
";",
"String",... | Generate a user gaming event. | [
"Generate",
"a",
"user",
"gaming",
"event",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java#L270-L297 |
27,168 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java | Injector.addTimeInfoToEvent | private static String addTimeInfoToEvent(String message, Long currTime, int delayInMillis) {
String eventTimeString =
Long.toString((currTime - delayInMillis) / 1000 * 1000);
// Add a (redundant) 'human-readable' date string to make the data semantics more clear.
String dateString = GameConstants.DA... | java | private static String addTimeInfoToEvent(String message, Long currTime, int delayInMillis) {
String eventTimeString =
Long.toString((currTime - delayInMillis) / 1000 * 1000);
// Add a (redundant) 'human-readable' date string to make the data semantics more clear.
String dateString = GameConstants.DA... | [
"private",
"static",
"String",
"addTimeInfoToEvent",
"(",
"String",
"message",
",",
"Long",
"currTime",
",",
"int",
"delayInMillis",
")",
"{",
"String",
"eventTimeString",
"=",
"Long",
".",
"toString",
"(",
"(",
"currTime",
"-",
"delayInMillis",
")",
"/",
"100... | Add time info to a generated gaming event. | [
"Add",
"time",
"info",
"to",
"a",
"generated",
"gaming",
"event",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java#L302-L309 |
27,169 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java | Injector.publishData | public static void publishData(int numMessages, int delayInMillis)
throws IOException {
List<PubsubMessage> pubsubMessages = new ArrayList<>();
for (int i = 0; i < Math.max(1, numMessages); i++) {
Long currTime = System.currentTimeMillis();
String message = generateEvent(currTime, delayInMill... | java | public static void publishData(int numMessages, int delayInMillis)
throws IOException {
List<PubsubMessage> pubsubMessages = new ArrayList<>();
for (int i = 0; i < Math.max(1, numMessages); i++) {
Long currTime = System.currentTimeMillis();
String message = generateEvent(currTime, delayInMill... | [
"public",
"static",
"void",
"publishData",
"(",
"int",
"numMessages",
",",
"int",
"delayInMillis",
")",
"throws",
"IOException",
"{",
"List",
"<",
"PubsubMessage",
">",
"pubsubMessages",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
... | Publish 'numMessages' arbitrary events from live users with the provided delay, to a
PubSub topic. | [
"Publish",
"numMessages",
"arbitrary",
"events",
"from",
"live",
"users",
"with",
"the",
"provided",
"delay",
"to",
"a",
"PubSub",
"topic",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java#L315-L337 |
27,170 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java | Injector.publishDataToFile | public static void publishDataToFile(String fileName, int numMessages, int delayInMillis)
throws IOException {
PrintWriter out = new PrintWriter(new OutputStreamWriter(
new BufferedOutputStream(new FileOutputStream(fileName, true)), "UTF-8"));
try {
for (int i = 0; i < Math.max(1, numMessag... | java | public static void publishDataToFile(String fileName, int numMessages, int delayInMillis)
throws IOException {
PrintWriter out = new PrintWriter(new OutputStreamWriter(
new BufferedOutputStream(new FileOutputStream(fileName, true)), "UTF-8"));
try {
for (int i = 0; i < Math.max(1, numMessag... | [
"public",
"static",
"void",
"publishDataToFile",
"(",
"String",
"fileName",
",",
"int",
"numMessages",
",",
"int",
"delayInMillis",
")",
"throws",
"IOException",
"{",
"PrintWriter",
"out",
"=",
"new",
"PrintWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"new",
... | Publish generated events to a file. | [
"Publish",
"generated",
"events",
"to",
"a",
"file",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/Injector.java#L342-L360 |
27,171 | spotify/scio | scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java | DeletionInfo.isDeleted | public boolean isDeleted(Cell cell)
{
// We do rely on this test: if topLevel.markedForDeleteAt is MIN_VALUE, we should not
// consider the column deleted even if timestamp=MIN_VALUE, otherwise this break QueryFilter.isRelevant
if (isLive())
return false;
if (cell.timestamp() <= topLevel.marked... | java | public boolean isDeleted(Cell cell)
{
// We do rely on this test: if topLevel.markedForDeleteAt is MIN_VALUE, we should not
// consider the column deleted even if timestamp=MIN_VALUE, otherwise this break QueryFilter.isRelevant
if (isLive())
return false;
if (cell.timestamp() <= topLevel.marked... | [
"public",
"boolean",
"isDeleted",
"(",
"Cell",
"cell",
")",
"{",
"// We do rely on this test: if topLevel.markedForDeleteAt is MIN_VALUE, we should not",
"// consider the column deleted even if timestamp=MIN_VALUE, otherwise this break QueryFilter.isRelevant",
"if",
"(",
"isLive",
"(",
"... | Return whether a given cell is deleted by the container having this deletion info.
@param cell the cell to check.
@return true if the cell is deleted, false otherwise | [
"Return",
"whether",
"a",
"given",
"cell",
"is",
"deleted",
"by",
"the",
"container",
"having",
"this",
"deletion",
"info",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java#L131-L146 |
27,172 | spotify/scio | scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java | DeletionInfo.diff | public DeletionInfo diff(DeletionInfo superset)
{
RangeTombstoneList rangeDiff = superset.ranges == null || superset.ranges.isEmpty()
? null
: ranges == null ? superset.ranges : ranges.diff(superset.ranges);
return topLevel.markedForDeleteAt != superset.topLevel.markedForDeleteAt || r... | java | public DeletionInfo diff(DeletionInfo superset)
{
RangeTombstoneList rangeDiff = superset.ranges == null || superset.ranges.isEmpty()
? null
: ranges == null ? superset.ranges : ranges.diff(superset.ranges);
return topLevel.markedForDeleteAt != superset.topLevel.markedForDeleteAt || r... | [
"public",
"DeletionInfo",
"diff",
"(",
"DeletionInfo",
"superset",
")",
"{",
"RangeTombstoneList",
"rangeDiff",
"=",
"superset",
".",
"ranges",
"==",
"null",
"||",
"superset",
".",
"ranges",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"ranges",
"==",
"null",... | Evaluates difference between this deletion info and superset for read repair
@return the difference between the two, or LIVE if no difference | [
"Evaluates",
"difference",
"between",
"this",
"deletion",
"info",
"and",
"superset",
"for",
"read",
"repair"
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java#L187-L196 |
27,173 | spotify/scio | scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java | DeletionInfo.updateDigest | public void updateDigest(MessageDigest digest)
{
if (topLevel.markedForDeleteAt != Long.MIN_VALUE)
digest.update(ByteBufferUtil.bytes(topLevel.markedForDeleteAt));
if (ranges != null)
ranges.updateDigest(digest);
} | java | public void updateDigest(MessageDigest digest)
{
if (topLevel.markedForDeleteAt != Long.MIN_VALUE)
digest.update(ByteBufferUtil.bytes(topLevel.markedForDeleteAt));
if (ranges != null)
ranges.updateDigest(digest);
} | [
"public",
"void",
"updateDigest",
"(",
"MessageDigest",
"digest",
")",
"{",
"if",
"(",
"topLevel",
".",
"markedForDeleteAt",
"!=",
"Long",
".",
"MIN_VALUE",
")",
"digest",
".",
"update",
"(",
"ByteBufferUtil",
".",
"bytes",
"(",
"topLevel",
".",
"markedForDele... | Digests deletion info. Used to trigger read repair on mismatch. | [
"Digests",
"deletion",
"info",
".",
"Used",
"to",
"trigger",
"read",
"repair",
"on",
"mismatch",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java#L202-L209 |
27,174 | spotify/scio | scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java | DeletionInfo.add | public DeletionInfo add(DeletionInfo newInfo)
{
add(newInfo.topLevel);
if (ranges == null)
ranges = newInfo.ranges == null ? null : newInfo.ranges.copy();
else if (newInfo.ranges != null)
ranges.addAll(newInfo.ranges);
return this;
} | java | public DeletionInfo add(DeletionInfo newInfo)
{
add(newInfo.topLevel);
if (ranges == null)
ranges = newInfo.ranges == null ? null : newInfo.ranges.copy();
else if (newInfo.ranges != null)
ranges.addAll(newInfo.ranges);
return this;
} | [
"public",
"DeletionInfo",
"add",
"(",
"DeletionInfo",
"newInfo",
")",
"{",
"add",
"(",
"newInfo",
".",
"topLevel",
")",
";",
"if",
"(",
"ranges",
"==",
"null",
")",
"ranges",
"=",
"newInfo",
".",
"ranges",
"==",
"null",
"?",
"null",
":",
"newInfo",
"."... | Combines another DeletionInfo with this one and returns the result. Whichever top-level tombstone
has the higher markedForDeleteAt timestamp will be kept, along with its localDeletionTime. The
range tombstones will be combined.
@return this object. | [
"Combines",
"another",
"DeletionInfo",
"with",
"this",
"one",
"and",
"returns",
"the",
"result",
".",
"Whichever",
"top",
"-",
"level",
"tombstone",
"has",
"the",
"higher",
"markedForDeleteAt",
"timestamp",
"will",
"be",
"kept",
"along",
"with",
"its",
"localDel... | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java#L250-L260 |
27,175 | spotify/scio | scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java | DeletionInfo.minTimestamp | public long minTimestamp()
{
return ranges == null
? topLevel.markedForDeleteAt
: Math.min(topLevel.markedForDeleteAt, ranges.minMarkedAt());
} | java | public long minTimestamp()
{
return ranges == null
? topLevel.markedForDeleteAt
: Math.min(topLevel.markedForDeleteAt, ranges.minMarkedAt());
} | [
"public",
"long",
"minTimestamp",
"(",
")",
"{",
"return",
"ranges",
"==",
"null",
"?",
"topLevel",
".",
"markedForDeleteAt",
":",
"Math",
".",
"min",
"(",
"topLevel",
".",
"markedForDeleteAt",
",",
"ranges",
".",
"minMarkedAt",
"(",
")",
")",
";",
"}"
] | Returns the minimum timestamp in any of the range tombstones or the top-level tombstone. | [
"Returns",
"the",
"minimum",
"timestamp",
"in",
"any",
"of",
"the",
"range",
"tombstones",
"or",
"the",
"top",
"-",
"level",
"tombstone",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java#L265-L270 |
27,176 | spotify/scio | scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java | DeletionInfo.maxTimestamp | public long maxTimestamp()
{
return ranges == null
? topLevel.markedForDeleteAt
: Math.max(topLevel.markedForDeleteAt, ranges.maxMarkedAt());
} | java | public long maxTimestamp()
{
return ranges == null
? topLevel.markedForDeleteAt
: Math.max(topLevel.markedForDeleteAt, ranges.maxMarkedAt());
} | [
"public",
"long",
"maxTimestamp",
"(",
")",
"{",
"return",
"ranges",
"==",
"null",
"?",
"topLevel",
".",
"markedForDeleteAt",
":",
"Math",
".",
"max",
"(",
"topLevel",
".",
"markedForDeleteAt",
",",
"ranges",
".",
"maxMarkedAt",
"(",
")",
")",
";",
"}"
] | Returns the maximum timestamp in any of the range tombstones or the top-level tombstone. | [
"Returns",
"the",
"maximum",
"timestamp",
"in",
"any",
"of",
"the",
"range",
"tombstones",
"or",
"the",
"top",
"-",
"level",
"tombstone",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/db/DeletionInfo.java#L275-L280 |
27,177 | spotify/scio | scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/hadoop/cql3/CqlBulkRecordWriterUtil.java | CqlBulkRecordWriterUtil.newWriter | public static CqlBulkRecordWriter newWriter(Configuration conf,
String host,
int port,
String username,
String password,
... | java | public static CqlBulkRecordWriter newWriter(Configuration conf,
String host,
int port,
String username,
String password,
... | [
"public",
"static",
"CqlBulkRecordWriter",
"newWriter",
"(",
"Configuration",
"conf",
",",
"String",
"host",
",",
"int",
"port",
",",
"String",
"username",
",",
"String",
"password",
",",
"String",
"keyspace",
",",
"String",
"table",
",",
"String",
"partitioner"... | Workaround to expose package private constructor. | [
"Workaround",
"to",
"expose",
"package",
"private",
"constructor",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-cassandra/cassandra2/src/main/java/org/apache/cassandra/hadoop/cql3/CqlBulkRecordWriterUtil.java#L29-L62 |
27,178 | spotify/scio | scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/RetryHttpInitializerWrapper.java | RetryHttpInitializerWrapper.initialize | @Override
public final void initialize(final HttpRequest request) {
request.setReadTimeout(2 * ONEMINITUES); // 2 minutes read timeout
final HttpUnsuccessfulResponseHandler backoffHandler =
new HttpBackOffUnsuccessfulResponseHandler(
new ExponentialBackOff())
... | java | @Override
public final void initialize(final HttpRequest request) {
request.setReadTimeout(2 * ONEMINITUES); // 2 minutes read timeout
final HttpUnsuccessfulResponseHandler backoffHandler =
new HttpBackOffUnsuccessfulResponseHandler(
new ExponentialBackOff())
... | [
"@",
"Override",
"public",
"final",
"void",
"initialize",
"(",
"final",
"HttpRequest",
"request",
")",
"{",
"request",
".",
"setReadTimeout",
"(",
"2",
"*",
"ONEMINITUES",
")",
";",
"// 2 minutes read timeout",
"final",
"HttpUnsuccessfulResponseHandler",
"backoffHandl... | Initializes the given request. | [
"Initializes",
"the",
"given",
"request",
"."
] | ed9a44428251b0c6834aad231b463d8eda418471 | https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/game/injector/RetryHttpInitializerWrapper.java#L89-L114 |
27,179 | line/line-bot-sdk-java | line-bot-api-client/src/main/java/com/linecorp/bot/client/LineMessagingClientBuilder.java | LineMessagingClientBuilder.okHttpClientBuilder | public LineMessagingClientBuilder okHttpClientBuilder(
@NonNull final OkHttpClient.Builder okHttpClientBuilder,
final boolean addAuthenticationHeader) {
this.okHttpClientBuilder = okHttpClientBuilder;
this.addAuthenticationHeader = addAuthenticationHeader;
return this;
... | java | public LineMessagingClientBuilder okHttpClientBuilder(
@NonNull final OkHttpClient.Builder okHttpClientBuilder,
final boolean addAuthenticationHeader) {
this.okHttpClientBuilder = okHttpClientBuilder;
this.addAuthenticationHeader = addAuthenticationHeader;
return this;
... | [
"public",
"LineMessagingClientBuilder",
"okHttpClientBuilder",
"(",
"@",
"NonNull",
"final",
"OkHttpClient",
".",
"Builder",
"okHttpClientBuilder",
",",
"final",
"boolean",
"addAuthenticationHeader",
")",
"{",
"this",
".",
"okHttpClientBuilder",
"=",
"okHttpClientBuilder",
... | Set customized OkHttpClient.Builder.
<p>In case of you need your own customized {@link OkHttpClient},
this builder allows specify {@link OkHttpClient.Builder} instance.
<p>To use this method, please add dependency to 'com.squareup.retrofit2:retrofit'.
@param addAuthenticationHeader If true, all default okhttp interc... | [
"Set",
"customized",
"OkHttpClient",
".",
"Builder",
"."
] | d6d30b19d5b90c2d3269eb9d6f88fe76fb6fcb55 | https://github.com/line/line-bot-sdk-java/blob/d6d30b19d5b90c2d3269eb9d6f88fe76fb6fcb55/line-bot-api-client/src/main/java/com/linecorp/bot/client/LineMessagingClientBuilder.java#L153-L160 |
27,180 | line/line-bot-sdk-java | line-bot-model/src/main/java/com/linecorp/bot/model/event/beacon/BeaconContentUtil.java | BeaconContentUtil.parseBytesOrNull | static byte[] parseBytesOrNull(final String deviceMessageAsHex) {
if (deviceMessageAsHex == null) {
return null;
}
final int length = deviceMessageAsHex.length();
final int resultSize = length / 2;
if (length % 2 != 0) {
throw new IllegalArgumentExceptio... | java | static byte[] parseBytesOrNull(final String deviceMessageAsHex) {
if (deviceMessageAsHex == null) {
return null;
}
final int length = deviceMessageAsHex.length();
final int resultSize = length / 2;
if (length % 2 != 0) {
throw new IllegalArgumentExceptio... | [
"static",
"byte",
"[",
"]",
"parseBytesOrNull",
"(",
"final",
"String",
"deviceMessageAsHex",
")",
"{",
"if",
"(",
"deviceMessageAsHex",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"length",
"=",
"deviceMessageAsHex",
".",
"length",
"... | Parse hext presentation to byte array.
@return byte array or null if input is null.
@throws IllegalArgumentException occurred when arguments is not null and illegal hex string. | [
"Parse",
"hext",
"presentation",
"to",
"byte",
"array",
"."
] | d6d30b19d5b90c2d3269eb9d6f88fe76fb6fcb55 | https://github.com/line/line-bot-sdk-java/blob/d6d30b19d5b90c2d3269eb9d6f88fe76fb6fcb55/line-bot-model/src/main/java/com/linecorp/bot/model/event/beacon/BeaconContentUtil.java#L34-L54 |
27,181 | line/line-bot-sdk-java | line-bot-cli/src/main/java/com/linecorp/bot/cli/Application.java | Application.main | public static void main(final String... args) throws Exception {
try (ConfigurableApplicationContext context = SpringApplication.run(Application.class, args)) {
log.info("Arguments: {}", Arrays.asList(args));
try {
context.getBean(Application.class).run(context);
... | java | public static void main(final String... args) throws Exception {
try (ConfigurableApplicationContext context = SpringApplication.run(Application.class, args)) {
log.info("Arguments: {}", Arrays.asList(args));
try {
context.getBean(Application.class).run(context);
... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"...",
"args",
")",
"throws",
"Exception",
"{",
"try",
"(",
"ConfigurableApplicationContext",
"context",
"=",
"SpringApplication",
".",
"run",
"(",
"Application",
".",
"class",
",",
"args",
")",
")",
... | Entry point of line-bot-cli. | [
"Entry",
"point",
"of",
"line",
"-",
"bot",
"-",
"cli",
"."
] | d6d30b19d5b90c2d3269eb9d6f88fe76fb6fcb55 | https://github.com/line/line-bot-sdk-java/blob/d6d30b19d5b90c2d3269eb9d6f88fe76fb6fcb55/line-bot-cli/src/main/java/com/linecorp/bot/cli/Application.java#L35-L45 |
27,182 | ksoichiro/Android-ObservableScrollView | samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/FlexibleSpaceWithImageWithViewPagerTabActivity.java | FlexibleSpaceWithImageWithViewPagerTabActivity.onScrollChanged | public void onScrollChanged(int scrollY, Scrollable s) {
FlexibleSpaceWithImageBaseFragment fragment =
(FlexibleSpaceWithImageBaseFragment) mPagerAdapter.getItemAt(mPager.getCurrentItem());
if (fragment == null) {
return;
}
View view = fragment.getView();
... | java | public void onScrollChanged(int scrollY, Scrollable s) {
FlexibleSpaceWithImageBaseFragment fragment =
(FlexibleSpaceWithImageBaseFragment) mPagerAdapter.getItemAt(mPager.getCurrentItem());
if (fragment == null) {
return;
}
View view = fragment.getView();
... | [
"public",
"void",
"onScrollChanged",
"(",
"int",
"scrollY",
",",
"Scrollable",
"s",
")",
"{",
"FlexibleSpaceWithImageBaseFragment",
"fragment",
"=",
"(",
"FlexibleSpaceWithImageBaseFragment",
")",
"mPagerAdapter",
".",
"getItemAt",
"(",
"mPager",
".",
"getCurrentItem",
... | Called by children Fragments when their scrollY are changed.
They all call this method even when they are inactive
but this Activity should listen only the active child,
so each Fragments will pass themselves for Activity to check if they are active.
@param scrollY scroll position of Scrollable
@param s caller S... | [
"Called",
"by",
"children",
"Fragments",
"when",
"their",
"scrollY",
"are",
"changed",
".",
"They",
"all",
"call",
"this",
"method",
"even",
"when",
"they",
"are",
"inactive",
"but",
"this",
"Activity",
"should",
"listen",
"only",
"the",
"active",
"child",
"... | 47a5fb2db5e93d923a8c6772cde48bbb7d932345 | https://github.com/ksoichiro/Android-ObservableScrollView/blob/47a5fb2db5e93d923a8c6772cde48bbb7d932345/samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/FlexibleSpaceWithImageWithViewPagerTabActivity.java#L104-L126 |
27,183 | ksoichiro/Android-ObservableScrollView | library/src/main/java/com/github/ksoichiro/android/observablescrollview/ScrollUtils.java | ScrollUtils.cmykFromRgb | public static float[] cmykFromRgb(int rgbColor) {
int red = (0xff0000 & rgbColor) >> 16;
int green = (0xff00 & rgbColor) >> 8;
int blue = (0xff & rgbColor);
float black = Math.min(1.0f - red / 255.0f, Math.min(1.0f - green / 255.0f, 1.0f - blue / 255.0f));
float cyan = 1.0f;
... | java | public static float[] cmykFromRgb(int rgbColor) {
int red = (0xff0000 & rgbColor) >> 16;
int green = (0xff00 & rgbColor) >> 8;
int blue = (0xff & rgbColor);
float black = Math.min(1.0f - red / 255.0f, Math.min(1.0f - green / 255.0f, 1.0f - blue / 255.0f));
float cyan = 1.0f;
... | [
"public",
"static",
"float",
"[",
"]",
"cmykFromRgb",
"(",
"int",
"rgbColor",
")",
"{",
"int",
"red",
"=",
"(",
"0xff0000",
"&",
"rgbColor",
")",
">>",
"16",
";",
"int",
"green",
"=",
"(",
"0xff00",
"&",
"rgbColor",
")",
">>",
"8",
";",
"int",
"blu... | Convert RGB color to CMYK color.
@param rgbColor Target color.
@return CMYK array. | [
"Convert",
"RGB",
"color",
"to",
"CMYK",
"color",
"."
] | 47a5fb2db5e93d923a8c6772cde48bbb7d932345 | https://github.com/ksoichiro/Android-ObservableScrollView/blob/47a5fb2db5e93d923a8c6772cde48bbb7d932345/library/src/main/java/com/github/ksoichiro/android/observablescrollview/ScrollUtils.java#L109-L124 |
27,184 | ksoichiro/Android-ObservableScrollView | library/src/main/java/com/github/ksoichiro/android/observablescrollview/ScrollUtils.java | ScrollUtils.rgbFromCmyk | public static int rgbFromCmyk(float[] cmyk) {
float cyan = cmyk[0];
float magenta = cmyk[1];
float yellow = cmyk[2];
float black = cmyk[3];
int red = (int) ((1.0f - Math.min(1.0f, cyan * (1.0f - black) + black)) * 255);
int green = (int) ((1.0f - Math.min(1.0f, magenta * ... | java | public static int rgbFromCmyk(float[] cmyk) {
float cyan = cmyk[0];
float magenta = cmyk[1];
float yellow = cmyk[2];
float black = cmyk[3];
int red = (int) ((1.0f - Math.min(1.0f, cyan * (1.0f - black) + black)) * 255);
int green = (int) ((1.0f - Math.min(1.0f, magenta * ... | [
"public",
"static",
"int",
"rgbFromCmyk",
"(",
"float",
"[",
"]",
"cmyk",
")",
"{",
"float",
"cyan",
"=",
"cmyk",
"[",
"0",
"]",
";",
"float",
"magenta",
"=",
"cmyk",
"[",
"1",
"]",
";",
"float",
"yellow",
"=",
"cmyk",
"[",
"2",
"]",
";",
"float"... | Convert CYMK color to RGB color.
This method doesn't check if cmyk is not null or have 4 elements in array.
@param cmyk Target CYMK color. Each value should be between 0.0f to 1.0f,
and should be set in this order: cyan, magenta, yellow, black.
@return ARGB color. Alpha is fixed value (255). | [
"Convert",
"CYMK",
"color",
"to",
"RGB",
"color",
".",
"This",
"method",
"doesn",
"t",
"check",
"if",
"cmyk",
"is",
"not",
"null",
"or",
"have",
"4",
"elements",
"in",
"array",
"."
] | 47a5fb2db5e93d923a8c6772cde48bbb7d932345 | https://github.com/ksoichiro/Android-ObservableScrollView/blob/47a5fb2db5e93d923a8c6772cde48bbb7d932345/library/src/main/java/com/github/ksoichiro/android/observablescrollview/ScrollUtils.java#L134-L143 |
27,185 | ksoichiro/Android-ObservableScrollView | samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/FragmentTransitionActivity.java | FragmentTransitionActivity.initFragment | private void initFragment() {
FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentByTag(FragmentTransitionDefaultFragment.FRAGMENT_TAG) == null) {
FragmentTransaction ft = fm.beginTransaction();
ft.add(R.id.fragment, new FragmentTransitionDefaultFragment(), Fragm... | java | private void initFragment() {
FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentByTag(FragmentTransitionDefaultFragment.FRAGMENT_TAG) == null) {
FragmentTransaction ft = fm.beginTransaction();
ft.add(R.id.fragment, new FragmentTransitionDefaultFragment(), Fragm... | [
"private",
"void",
"initFragment",
"(",
")",
"{",
"FragmentManager",
"fm",
"=",
"getSupportFragmentManager",
"(",
")",
";",
"if",
"(",
"fm",
".",
"findFragmentByTag",
"(",
"FragmentTransitionDefaultFragment",
".",
"FRAGMENT_TAG",
")",
"==",
"null",
")",
"{",
"Fr... | Fragment should be added programmatically.
Using fragment tag in XML causes IllegalStateException on rotation of screen
or restoring states of activity. | [
"Fragment",
"should",
"be",
"added",
"programmatically",
".",
"Using",
"fragment",
"tag",
"in",
"XML",
"causes",
"IllegalStateException",
"on",
"rotation",
"of",
"screen",
"or",
"restoring",
"states",
"of",
"activity",
"."
] | 47a5fb2db5e93d923a8c6772cde48bbb7d932345 | https://github.com/ksoichiro/Android-ObservableScrollView/blob/47a5fb2db5e93d923a8c6772cde48bbb7d932345/samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/FragmentTransitionActivity.java#L46-L54 |
27,186 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/Enforcer.java | Enforcer.getRolesForUser | public List<String> getRolesForUser(String name) {
try {
return model.model.get("g").get("g").rm.getRoles(name);
} catch (Error e) {
if (!e.getMessage().equals("error: name does not exist")) {
throw e;
}
}
return null;
} | java | public List<String> getRolesForUser(String name) {
try {
return model.model.get("g").get("g").rm.getRoles(name);
} catch (Error e) {
if (!e.getMessage().equals("error: name does not exist")) {
throw e;
}
}
return null;
} | [
"public",
"List",
"<",
"String",
">",
"getRolesForUser",
"(",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"model",
".",
"model",
".",
"get",
"(",
"\"g\"",
")",
".",
"get",
"(",
"\"g\"",
")",
".",
"rm",
".",
"getRoles",
"(",
"name",
")",
";",
... | getRolesForUser gets the roles that a user has.
@param name the user.
@return the roles that the user has. | [
"getRolesForUser",
"gets",
"the",
"roles",
"that",
"a",
"user",
"has",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L116-L125 |
27,187 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/Enforcer.java | Enforcer.getUsersForRole | public List<String> getUsersForRole(String name) {
try {
return model.model.get("g").get("g").rm.getUsers(name);
} catch (Error e) {
if (!e.getMessage().equals("error: name does not exist")) {
throw e;
}
}
return null;
} | java | public List<String> getUsersForRole(String name) {
try {
return model.model.get("g").get("g").rm.getUsers(name);
} catch (Error e) {
if (!e.getMessage().equals("error: name does not exist")) {
throw e;
}
}
return null;
} | [
"public",
"List",
"<",
"String",
">",
"getUsersForRole",
"(",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"model",
".",
"model",
".",
"get",
"(",
"\"g\"",
")",
".",
"get",
"(",
"\"g\"",
")",
".",
"rm",
".",
"getUsers",
"(",
"name",
")",
";",
... | getUsersForRole gets the users that has a role.
@param name the role.
@return the users that has the role. | [
"getUsersForRole",
"gets",
"the",
"users",
"that",
"has",
"a",
"role",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L133-L142 |
27,188 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/Enforcer.java | Enforcer.hasRoleForUser | public boolean hasRoleForUser(String name, String role) {
List<String> roles = getRolesForUser(name);
boolean hasRole = false;
for (String r : roles) {
if (r.equals(role)) {
hasRole = true;
break;
}
}
return hasRole;
} | java | public boolean hasRoleForUser(String name, String role) {
List<String> roles = getRolesForUser(name);
boolean hasRole = false;
for (String r : roles) {
if (r.equals(role)) {
hasRole = true;
break;
}
}
return hasRole;
} | [
"public",
"boolean",
"hasRoleForUser",
"(",
"String",
"name",
",",
"String",
"role",
")",
"{",
"List",
"<",
"String",
">",
"roles",
"=",
"getRolesForUser",
"(",
"name",
")",
";",
"boolean",
"hasRole",
"=",
"false",
";",
"for",
"(",
"String",
"r",
":",
... | hasRoleForUser determines whether a user has a role.
@param name the user.
@param role the role.
@return whether the user has the role. | [
"hasRoleForUser",
"determines",
"whether",
"a",
"user",
"has",
"a",
"role",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L151-L163 |
27,189 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/Enforcer.java | Enforcer.getPermissionsForUserInDomain | public List<List<String>> getPermissionsForUserInDomain(String user, String domain) {
return getFilteredPolicy(0, user, domain);
} | java | public List<List<String>> getPermissionsForUserInDomain(String user, String domain) {
return getFilteredPolicy(0, user, domain);
} | [
"public",
"List",
"<",
"List",
"<",
"String",
">",
">",
"getPermissionsForUserInDomain",
"(",
"String",
"user",
",",
"String",
"domain",
")",
"{",
"return",
"getFilteredPolicy",
"(",
"0",
",",
"user",
",",
"domain",
")",
";",
"}"
] | getPermissionsForUserInDomain gets permissions for a user or role inside a domain.
@param user the user.
@param domain the domain.
@return the permissions, a permission is usually like (obj, act). It is actually the rule without the subject. | [
"getPermissionsForUserInDomain",
"gets",
"permissions",
"for",
"a",
"user",
"or",
"role",
"inside",
"a",
"domain",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L374-L376 |
27,190 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java | DefaultRoleManager.getRoles | @Override
public List<String> getRoles(String name, String... domain) {
if (domain.length == 1) {
name = domain[0] + "::" + name;
} else if (domain.length > 1) {
throw new Error("error: domain should be 1 parameter");
}
if (!hasRole(name)) {
throw... | java | @Override
public List<String> getRoles(String name, String... domain) {
if (domain.length == 1) {
name = domain[0] + "::" + name;
} else if (domain.length > 1) {
throw new Error("error: domain should be 1 parameter");
}
if (!hasRole(name)) {
throw... | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"getRoles",
"(",
"String",
"name",
",",
"String",
"...",
"domain",
")",
"{",
"if",
"(",
"domain",
".",
"length",
"==",
"1",
")",
"{",
"name",
"=",
"domain",
"[",
"0",
"]",
"+",
"\"::\"",
"+",
... | getRoles gets the roles that a subject inherits.
domain is a prefix to the roles. | [
"getRoles",
"gets",
"the",
"roles",
"that",
"a",
"subject",
"inherits",
".",
"domain",
"is",
"a",
"prefix",
"to",
"the",
"roles",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java#L132-L151 |
27,191 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java | DefaultRoleManager.getUsers | @Override
public List<String> getUsers(String name) {
if (!hasRole(name)) {
throw new Error("error: name does not exist");
}
List<String> names = new ArrayList<>();
for (Role role : allRoles.values()) {
if (role.hasDirectRole(name)) {
names.ad... | java | @Override
public List<String> getUsers(String name) {
if (!hasRole(name)) {
throw new Error("error: name does not exist");
}
List<String> names = new ArrayList<>();
for (Role role : allRoles.values()) {
if (role.hasDirectRole(name)) {
names.ad... | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"getUsers",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"hasRole",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"error: name does not exist\"",
")",
";",
"}",
"List",
"<",
"Stri... | getUsers gets the users that inherits a subject.
domain is an unreferenced parameter here, may be used in other implementations. | [
"getUsers",
"gets",
"the",
"users",
"that",
"inherits",
"a",
"subject",
".",
"domain",
"is",
"an",
"unreferenced",
"parameter",
"here",
"may",
"be",
"used",
"in",
"other",
"implementations",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java#L157-L170 |
27,192 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java | DefaultRoleManager.printRoles | @Override
public void printRoles() {
for (Role role : allRoles.values()) {
Util.logPrint(role.toString());
}
} | java | @Override
public void printRoles() {
for (Role role : allRoles.values()) {
Util.logPrint(role.toString());
}
} | [
"@",
"Override",
"public",
"void",
"printRoles",
"(",
")",
"{",
"for",
"(",
"Role",
"role",
":",
"allRoles",
".",
"values",
"(",
")",
")",
"{",
"Util",
".",
"logPrint",
"(",
"role",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] | printRoles prints all the roles to log. | [
"printRoles",
"prints",
"all",
"the",
"roles",
"to",
"log",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java#L175-L180 |
27,193 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/model/Policy.java | Policy.buildRoleLinks | public void buildRoleLinks(RoleManager rm) {
if (model.containsKey("g")) {
for (Assertion ast : model.get("g").values()) {
ast.buildRoleLinks(rm);
}
}
} | java | public void buildRoleLinks(RoleManager rm) {
if (model.containsKey("g")) {
for (Assertion ast : model.get("g").values()) {
ast.buildRoleLinks(rm);
}
}
} | [
"public",
"void",
"buildRoleLinks",
"(",
"RoleManager",
"rm",
")",
"{",
"if",
"(",
"model",
".",
"containsKey",
"(",
"\"g\"",
")",
")",
"{",
"for",
"(",
"Assertion",
"ast",
":",
"model",
".",
"get",
"(",
"\"g\"",
")",
".",
"values",
"(",
")",
")",
... | buildRoleLinks initializes the roles in RBAC.
@param rm the role manager. | [
"buildRoleLinks",
"initializes",
"the",
"roles",
"in",
"RBAC",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/model/Policy.java#L32-L38 |
27,194 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/model/Policy.java | Policy.printPolicy | public void printPolicy() {
Util.logPrint("Policy:");
if (model.containsKey("p")) {
for (Map.Entry<String, Assertion> entry : model.get("p").entrySet()) {
String key = entry.getKey();
Assertion ast = entry.getValue();
Util.logPrint(key + ": " +... | java | public void printPolicy() {
Util.logPrint("Policy:");
if (model.containsKey("p")) {
for (Map.Entry<String, Assertion> entry : model.get("p").entrySet()) {
String key = entry.getKey();
Assertion ast = entry.getValue();
Util.logPrint(key + ": " +... | [
"public",
"void",
"printPolicy",
"(",
")",
"{",
"Util",
".",
"logPrint",
"(",
"\"Policy:\"",
")",
";",
"if",
"(",
"model",
".",
"containsKey",
"(",
"\"p\"",
")",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Assertion",
">",
"entry"... | printPolicy prints the policy to log. | [
"printPolicy",
"prints",
"the",
"policy",
"to",
"log",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/model/Policy.java#L43-L60 |
27,195 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/model/Policy.java | Policy.clearPolicy | public void clearPolicy() {
if (model.containsKey("p")) {
for (Assertion ast : model.get("p").values()) {
ast.policy = new ArrayList<>();
}
}
if (model.containsKey("g")) {
for (Assertion ast : model.get("g").values()) {
ast.pol... | java | public void clearPolicy() {
if (model.containsKey("p")) {
for (Assertion ast : model.get("p").values()) {
ast.policy = new ArrayList<>();
}
}
if (model.containsKey("g")) {
for (Assertion ast : model.get("g").values()) {
ast.pol... | [
"public",
"void",
"clearPolicy",
"(",
")",
"{",
"if",
"(",
"model",
".",
"containsKey",
"(",
"\"p\"",
")",
")",
"{",
"for",
"(",
"Assertion",
"ast",
":",
"model",
".",
"get",
"(",
"\"p\"",
")",
".",
"values",
"(",
")",
")",
"{",
"ast",
".",
"poli... | clearPolicy clears all current policy. | [
"clearPolicy",
"clears",
"all",
"current",
"policy",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/model/Policy.java#L65-L77 |
27,196 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/model/Policy.java | Policy.getPolicy | public List<List<String>> getPolicy(String sec, String ptype) {
return model.get(sec).get(ptype).policy;
} | java | public List<List<String>> getPolicy(String sec, String ptype) {
return model.get(sec).get(ptype).policy;
} | [
"public",
"List",
"<",
"List",
"<",
"String",
">",
">",
"getPolicy",
"(",
"String",
"sec",
",",
"String",
"ptype",
")",
"{",
"return",
"model",
".",
"get",
"(",
"sec",
")",
".",
"get",
"(",
"ptype",
")",
".",
"policy",
";",
"}"
] | getPolicy gets all rules in a policy.
@param sec the section, "p" or "g".
@param ptype the policy type, "p", "p2", .. or "g", "g2", ..
@return the policy rules of section sec and policy type ptype. | [
"getPolicy",
"gets",
"all",
"rules",
"in",
"a",
"policy",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/model/Policy.java#L86-L88 |
27,197 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/model/Policy.java | Policy.getFilteredPolicy | public List<List<String>> getFilteredPolicy(String sec, String ptype, int fieldIndex, String... fieldValues) {
List<List<String>> res = new ArrayList<>();
for (List<String> rule : model.get(sec).get(ptype).policy) {
boolean matched = true;
for (int i = 0; i < fieldValues.length;... | java | public List<List<String>> getFilteredPolicy(String sec, String ptype, int fieldIndex, String... fieldValues) {
List<List<String>> res = new ArrayList<>();
for (List<String> rule : model.get(sec).get(ptype).policy) {
boolean matched = true;
for (int i = 0; i < fieldValues.length;... | [
"public",
"List",
"<",
"List",
"<",
"String",
">",
">",
"getFilteredPolicy",
"(",
"String",
"sec",
",",
"String",
"ptype",
",",
"int",
"fieldIndex",
",",
"String",
"...",
"fieldValues",
")",
"{",
"List",
"<",
"List",
"<",
"String",
">>",
"res",
"=",
"n... | getFilteredPolicy gets rules based on field filters from a policy.
@param sec the section, "p" or "g".
@param ptype the policy type, "p", "p2", .. or "g", "g2", ..
@param fieldIndex the policy rule's start index to be matched.
@param fieldValues the field values to be matched, value ""
means not to match this field.
@... | [
"getFilteredPolicy",
"gets",
"rules",
"based",
"on",
"field",
"filters",
"from",
"a",
"policy",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/model/Policy.java#L100-L119 |
27,198 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/model/Policy.java | Policy.hasPolicy | public boolean hasPolicy(String sec, String ptype, List<String> rule) {
for (List<String> r : model.get(sec).get(ptype).policy) {
if (Util.arrayEquals(rule, r)) {
return true;
}
}
return false;
} | java | public boolean hasPolicy(String sec, String ptype, List<String> rule) {
for (List<String> r : model.get(sec).get(ptype).policy) {
if (Util.arrayEquals(rule, r)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"hasPolicy",
"(",
"String",
"sec",
",",
"String",
"ptype",
",",
"List",
"<",
"String",
">",
"rule",
")",
"{",
"for",
"(",
"List",
"<",
"String",
">",
"r",
":",
"model",
".",
"get",
"(",
"sec",
")",
".",
"get",
"(",
"ptype",
"... | hasPolicy determines whether a model has the specified policy rule.
@param sec the section, "p" or "g".
@param ptype the policy type, "p", "p2", .. or "g", "g2", ..
@param rule the policy rule.
@return whether the rule exists. | [
"hasPolicy",
"determines",
"whether",
"a",
"model",
"has",
"the",
"specified",
"policy",
"rule",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/model/Policy.java#L129-L137 |
27,199 | casbin/jcasbin | src/main/java/org/casbin/jcasbin/model/Policy.java | Policy.addPolicy | public boolean addPolicy(String sec, String ptype, List<String> rule) {
if (!hasPolicy(sec, ptype, rule)) {
model.get(sec).get(ptype).policy.add(rule);
return true;
}
return false;
} | java | public boolean addPolicy(String sec, String ptype, List<String> rule) {
if (!hasPolicy(sec, ptype, rule)) {
model.get(sec).get(ptype).policy.add(rule);
return true;
}
return false;
} | [
"public",
"boolean",
"addPolicy",
"(",
"String",
"sec",
",",
"String",
"ptype",
",",
"List",
"<",
"String",
">",
"rule",
")",
"{",
"if",
"(",
"!",
"hasPolicy",
"(",
"sec",
",",
"ptype",
",",
"rule",
")",
")",
"{",
"model",
".",
"get",
"(",
"sec",
... | addPolicy adds a policy rule to the model.
@param sec the section, "p" or "g".
@param ptype the policy type, "p", "p2", .. or "g", "g2", ..
@param rule the policy rule.
@return succeeds or not. | [
"addPolicy",
"adds",
"a",
"policy",
"rule",
"to",
"the",
"model",
"."
] | b46d7a756b6c39cdb17e0600607e5fcdc66edd11 | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/model/Policy.java#L147-L153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.