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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
9,500
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/local/session/LocalQueueBrowserEnumeration.java
|
LocalQueueBrowserEnumeration.fetchNext
|
private AbstractMessage fetchNext() throws JMSException
{
if (nextMessage != null)
return nextMessage; // Already fetched
nextMessage = localQueue.browse(cursor, parsedSelector); // Lookup next candidate
if (nextMessage == null)
close(); // Auto-close enumeration at end of queue
return nextMessage;
}
|
java
|
private AbstractMessage fetchNext() throws JMSException
{
if (nextMessage != null)
return nextMessage; // Already fetched
nextMessage = localQueue.browse(cursor, parsedSelector); // Lookup next candidate
if (nextMessage == null)
close(); // Auto-close enumeration at end of queue
return nextMessage;
}
|
[
"private",
"AbstractMessage",
"fetchNext",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"nextMessage",
"!=",
"null",
")",
"return",
"nextMessage",
";",
"// Already fetched",
"nextMessage",
"=",
"localQueue",
".",
"browse",
"(",
"cursor",
",",
"parsedSelector",
")",
";",
"// Lookup next candidate",
"if",
"(",
"nextMessage",
"==",
"null",
")",
"close",
"(",
")",
";",
"// Auto-close enumeration at end of queue",
"return",
"nextMessage",
";",
"}"
] |
Fetch the next browsable message in the associated queue
@return a message or null
@throws JMSException on queue browsing error
|
[
"Fetch",
"the",
"next",
"browsable",
"message",
"in",
"the",
"associated",
"queue"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/session/LocalQueueBrowserEnumeration.java#L63-L71
|
9,501
|
Domo42/saga-lib
|
saga-lib/src/main/java/com/codebullets/sagalib/FunctionKeyReader.java
|
FunctionKeyReader.readKey
|
@Override
@Nullable
public KEY readKey(final MESSAGE message, final LookupContext context) {
return extractFunction.key(message, context);
}
|
java
|
@Override
@Nullable
public KEY readKey(final MESSAGE message, final LookupContext context) {
return extractFunction.key(message, context);
}
|
[
"@",
"Override",
"@",
"Nullable",
"public",
"KEY",
"readKey",
"(",
"final",
"MESSAGE",
"message",
",",
"final",
"LookupContext",
"context",
")",
"{",
"return",
"extractFunction",
".",
"key",
"(",
"message",
",",
"context",
")",
";",
"}"
] |
Read the saga instance key from the provided message.
|
[
"Read",
"the",
"saga",
"instance",
"key",
"from",
"the",
"provided",
"message",
"."
] |
c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef
|
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/FunctionKeyReader.java#L46-L50
|
9,502
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/common/message/MessageTools.java
|
MessageTools.makeInternalCopy
|
public static AbstractMessage makeInternalCopy( Message srcMessage ) throws JMSException
{
// Internal type copy
if (srcMessage instanceof AbstractMessage)
{
AbstractMessage msg = (AbstractMessage)srcMessage;
if (msg.isInternalCopy())
return msg;
AbstractMessage dup = duplicate(srcMessage);
dup.setInternalCopy(true);
return dup;
}
AbstractMessage dup = duplicate(srcMessage);
dup.setInternalCopy(true);
return dup;
}
|
java
|
public static AbstractMessage makeInternalCopy( Message srcMessage ) throws JMSException
{
// Internal type copy
if (srcMessage instanceof AbstractMessage)
{
AbstractMessage msg = (AbstractMessage)srcMessage;
if (msg.isInternalCopy())
return msg;
AbstractMessage dup = duplicate(srcMessage);
dup.setInternalCopy(true);
return dup;
}
AbstractMessage dup = duplicate(srcMessage);
dup.setInternalCopy(true);
return dup;
}
|
[
"public",
"static",
"AbstractMessage",
"makeInternalCopy",
"(",
"Message",
"srcMessage",
")",
"throws",
"JMSException",
"{",
"// Internal type copy",
"if",
"(",
"srcMessage",
"instanceof",
"AbstractMessage",
")",
"{",
"AbstractMessage",
"msg",
"=",
"(",
"AbstractMessage",
")",
"srcMessage",
";",
"if",
"(",
"msg",
".",
"isInternalCopy",
"(",
")",
")",
"return",
"msg",
";",
"AbstractMessage",
"dup",
"=",
"duplicate",
"(",
"srcMessage",
")",
";",
"dup",
".",
"setInternalCopy",
"(",
"true",
")",
";",
"return",
"dup",
";",
"}",
"AbstractMessage",
"dup",
"=",
"duplicate",
"(",
"srcMessage",
")",
";",
"dup",
".",
"setInternalCopy",
"(",
"true",
")",
";",
"return",
"dup",
";",
"}"
] |
Create an internal copy of the message if necessary
|
[
"Create",
"an",
"internal",
"copy",
"of",
"the",
"message",
"if",
"necessary"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/MessageTools.java#L46-L63
|
9,503
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/common/message/MessageTools.java
|
MessageTools.normalize
|
public static AbstractMessage normalize( Message srcMessage ) throws JMSException
{
// Already a native message ?
if (srcMessage instanceof AbstractMessage)
return (AbstractMessage)srcMessage;
return duplicate(srcMessage);
}
|
java
|
public static AbstractMessage normalize( Message srcMessage ) throws JMSException
{
// Already a native message ?
if (srcMessage instanceof AbstractMessage)
return (AbstractMessage)srcMessage;
return duplicate(srcMessage);
}
|
[
"public",
"static",
"AbstractMessage",
"normalize",
"(",
"Message",
"srcMessage",
")",
"throws",
"JMSException",
"{",
"// Already a native message ?",
"if",
"(",
"srcMessage",
"instanceof",
"AbstractMessage",
")",
"return",
"(",
"AbstractMessage",
")",
"srcMessage",
";",
"return",
"duplicate",
"(",
"srcMessage",
")",
";",
"}"
] |
Convert the message to native type if necessary
|
[
"Convert",
"the",
"message",
"to",
"native",
"type",
"if",
"necessary"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/MessageTools.java#L68-L75
|
9,504
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/common/message/MessageTools.java
|
MessageTools.duplicate
|
public static AbstractMessage duplicate( Message srcMessage ) throws JMSException
{
AbstractMessage msgCopy;
// Internal type copy
if (srcMessage instanceof AbstractMessage)
msgCopy = ((AbstractMessage)srcMessage).copy();
else
if (srcMessage instanceof TextMessage)
msgCopy = duplicateTextMessage((TextMessage)srcMessage);
else
if (srcMessage instanceof ObjectMessage)
msgCopy = duplicateObjectMessage((ObjectMessage)srcMessage);
else
if (srcMessage instanceof BytesMessage)
msgCopy = duplicateBytesMessage((BytesMessage)srcMessage);
else
if (srcMessage instanceof MapMessage)
msgCopy = duplicateMapMessage((MapMessage)srcMessage);
else
if (srcMessage instanceof StreamMessage)
msgCopy = duplicateStreamMessage((StreamMessage)srcMessage);
else
msgCopy = duplicateMessage(srcMessage);
return msgCopy;
}
|
java
|
public static AbstractMessage duplicate( Message srcMessage ) throws JMSException
{
AbstractMessage msgCopy;
// Internal type copy
if (srcMessage instanceof AbstractMessage)
msgCopy = ((AbstractMessage)srcMessage).copy();
else
if (srcMessage instanceof TextMessage)
msgCopy = duplicateTextMessage((TextMessage)srcMessage);
else
if (srcMessage instanceof ObjectMessage)
msgCopy = duplicateObjectMessage((ObjectMessage)srcMessage);
else
if (srcMessage instanceof BytesMessage)
msgCopy = duplicateBytesMessage((BytesMessage)srcMessage);
else
if (srcMessage instanceof MapMessage)
msgCopy = duplicateMapMessage((MapMessage)srcMessage);
else
if (srcMessage instanceof StreamMessage)
msgCopy = duplicateStreamMessage((StreamMessage)srcMessage);
else
msgCopy = duplicateMessage(srcMessage);
return msgCopy;
}
|
[
"public",
"static",
"AbstractMessage",
"duplicate",
"(",
"Message",
"srcMessage",
")",
"throws",
"JMSException",
"{",
"AbstractMessage",
"msgCopy",
";",
"// Internal type copy",
"if",
"(",
"srcMessage",
"instanceof",
"AbstractMessage",
")",
"msgCopy",
"=",
"(",
"(",
"AbstractMessage",
")",
"srcMessage",
")",
".",
"copy",
"(",
")",
";",
"else",
"if",
"(",
"srcMessage",
"instanceof",
"TextMessage",
")",
"msgCopy",
"=",
"duplicateTextMessage",
"(",
"(",
"TextMessage",
")",
"srcMessage",
")",
";",
"else",
"if",
"(",
"srcMessage",
"instanceof",
"ObjectMessage",
")",
"msgCopy",
"=",
"duplicateObjectMessage",
"(",
"(",
"ObjectMessage",
")",
"srcMessage",
")",
";",
"else",
"if",
"(",
"srcMessage",
"instanceof",
"BytesMessage",
")",
"msgCopy",
"=",
"duplicateBytesMessage",
"(",
"(",
"BytesMessage",
")",
"srcMessage",
")",
";",
"else",
"if",
"(",
"srcMessage",
"instanceof",
"MapMessage",
")",
"msgCopy",
"=",
"duplicateMapMessage",
"(",
"(",
"MapMessage",
")",
"srcMessage",
")",
";",
"else",
"if",
"(",
"srcMessage",
"instanceof",
"StreamMessage",
")",
"msgCopy",
"=",
"duplicateStreamMessage",
"(",
"(",
"StreamMessage",
")",
"srcMessage",
")",
";",
"else",
"msgCopy",
"=",
"duplicateMessage",
"(",
"srcMessage",
")",
";",
"return",
"msgCopy",
";",
"}"
] |
Create an independant copy of the given message
|
[
"Create",
"an",
"independant",
"copy",
"of",
"the",
"given",
"message"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/MessageTools.java#L80-L106
|
9,505
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.fastadd
|
private void fastadd(int wo, int off) {
this.buffer.add(off - this.sizeinwords);
this.buffer.add(wo);
this.sizeinwords = off + 1;
}
|
java
|
private void fastadd(int wo, int off) {
this.buffer.add(off - this.sizeinwords);
this.buffer.add(wo);
this.sizeinwords = off + 1;
}
|
[
"private",
"void",
"fastadd",
"(",
"int",
"wo",
",",
"int",
"off",
")",
"{",
"this",
".",
"buffer",
".",
"add",
"(",
"off",
"-",
"this",
".",
"sizeinwords",
")",
";",
"this",
".",
"buffer",
".",
"add",
"(",
"wo",
")",
";",
"this",
".",
"sizeinwords",
"=",
"off",
"+",
"1",
";",
"}"
] |
same as add but without updating the cardinality counter, strictly for
internal use.
@param wo
the wo
@param off
the off
|
[
"same",
"as",
"add",
"but",
"without",
"updating",
"the",
"cardinality",
"counter",
"strictly",
"for",
"internal",
"use",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L64-L68
|
9,506
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.iterator
|
@Override
public Iterator<Integer> iterator() {
final IntIterator under = this.getIntIterator();
return new Iterator<Integer>() {
@Override
public boolean hasNext() {
return under.hasNext();
}
@Override
public Integer next() {
return new Integer(under.next());
}
@Override
public void remove() {
throw new UnsupportedOperationException(
"bitsets do not support remove");
}
};
}
|
java
|
@Override
public Iterator<Integer> iterator() {
final IntIterator under = this.getIntIterator();
return new Iterator<Integer>() {
@Override
public boolean hasNext() {
return under.hasNext();
}
@Override
public Integer next() {
return new Integer(under.next());
}
@Override
public void remove() {
throw new UnsupportedOperationException(
"bitsets do not support remove");
}
};
}
|
[
"@",
"Override",
"public",
"Iterator",
"<",
"Integer",
">",
"iterator",
"(",
")",
"{",
"final",
"IntIterator",
"under",
"=",
"this",
".",
"getIntIterator",
"(",
")",
";",
"return",
"new",
"Iterator",
"<",
"Integer",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"return",
"under",
".",
"hasNext",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Integer",
"next",
"(",
")",
"{",
"return",
"new",
"Integer",
"(",
"under",
".",
"next",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"remove",
"(",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"bitsets do not support remove\"",
")",
";",
"}",
"}",
";",
"}"
] |
Allow you to iterate over the set bits.
@return Iterator over the set bits
|
[
"Allow",
"you",
"to",
"iterate",
"over",
"the",
"set",
"bits",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L178-L199
|
9,507
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.getIntIterator
|
public IntIterator getIntIterator() {
return new IntIterator() {
int wordindex;
int i = 0;
IntArray buf;
int currentword;
public IntIterator init(IntArray b) {
this.buf = b;
this.wordindex = this.buf.get(this.i);
this.currentword = this.buf.get(this.i + 1);
return this;
}
@Override
public boolean hasNext() {
return this.currentword != 0;
}
@Override
public int next() {
final int offset = Integer
.numberOfTrailingZeros(this.currentword);
this.currentword ^= 1 << offset;
final int answer = this.wordindex * WORDSIZE + offset;
if (this.currentword == 0) {
this.i += 2;
if (this.i < this.buf.size()) {
this.currentword = this.buf.get(this.i + 1);
this.wordindex += this.buf.get(this.i) + 1;
}
}
return answer;
}
}.init(this.buffer);
}
|
java
|
public IntIterator getIntIterator() {
return new IntIterator() {
int wordindex;
int i = 0;
IntArray buf;
int currentword;
public IntIterator init(IntArray b) {
this.buf = b;
this.wordindex = this.buf.get(this.i);
this.currentword = this.buf.get(this.i + 1);
return this;
}
@Override
public boolean hasNext() {
return this.currentword != 0;
}
@Override
public int next() {
final int offset = Integer
.numberOfTrailingZeros(this.currentword);
this.currentword ^= 1 << offset;
final int answer = this.wordindex * WORDSIZE + offset;
if (this.currentword == 0) {
this.i += 2;
if (this.i < this.buf.size()) {
this.currentword = this.buf.get(this.i + 1);
this.wordindex += this.buf.get(this.i) + 1;
}
}
return answer;
}
}.init(this.buffer);
}
|
[
"public",
"IntIterator",
"getIntIterator",
"(",
")",
"{",
"return",
"new",
"IntIterator",
"(",
")",
"{",
"int",
"wordindex",
";",
"int",
"i",
"=",
"0",
";",
"IntArray",
"buf",
";",
"int",
"currentword",
";",
"public",
"IntIterator",
"init",
"(",
"IntArray",
"b",
")",
"{",
"this",
".",
"buf",
"=",
"b",
";",
"this",
".",
"wordindex",
"=",
"this",
".",
"buf",
".",
"get",
"(",
"this",
".",
"i",
")",
";",
"this",
".",
"currentword",
"=",
"this",
".",
"buf",
".",
"get",
"(",
"this",
".",
"i",
"+",
"1",
")",
";",
"return",
"this",
";",
"}",
"@",
"Override",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"return",
"this",
".",
"currentword",
"!=",
"0",
";",
"}",
"@",
"Override",
"public",
"int",
"next",
"(",
")",
"{",
"final",
"int",
"offset",
"=",
"Integer",
".",
"numberOfTrailingZeros",
"(",
"this",
".",
"currentword",
")",
";",
"this",
".",
"currentword",
"^=",
"1",
"<<",
"offset",
";",
"final",
"int",
"answer",
"=",
"this",
".",
"wordindex",
"*",
"WORDSIZE",
"+",
"offset",
";",
"if",
"(",
"this",
".",
"currentword",
"==",
"0",
")",
"{",
"this",
".",
"i",
"+=",
"2",
";",
"if",
"(",
"this",
".",
"i",
"<",
"this",
".",
"buf",
".",
"size",
"(",
")",
")",
"{",
"this",
".",
"currentword",
"=",
"this",
".",
"buf",
".",
"get",
"(",
"this",
".",
"i",
"+",
"1",
")",
";",
"this",
".",
"wordindex",
"+=",
"this",
".",
"buf",
".",
"get",
"(",
"this",
".",
"i",
")",
"+",
"1",
";",
"}",
"}",
"return",
"answer",
";",
"}",
"}",
".",
"init",
"(",
"this",
".",
"buffer",
")",
";",
"}"
] |
Build a fast iterator over the set bits.
@return the iterator over the set bits
|
[
"Build",
"a",
"fast",
"iterator",
"over",
"the",
"set",
"bits",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L206-L242
|
9,508
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.and
|
public SparseBitmap and(SparseBitmap o) {
SparseBitmap a = new SparseBitmap();
and2by2(a, this, o);
return a;
}
|
java
|
public SparseBitmap and(SparseBitmap o) {
SparseBitmap a = new SparseBitmap();
and2by2(a, this, o);
return a;
}
|
[
"public",
"SparseBitmap",
"and",
"(",
"SparseBitmap",
"o",
")",
"{",
"SparseBitmap",
"a",
"=",
"new",
"SparseBitmap",
"(",
")",
";",
"and2by2",
"(",
"a",
",",
"this",
",",
"o",
")",
";",
"return",
"a",
";",
"}"
] |
Compute the bit-wise logical and with another bitmap.
@param o
another bitmap
@return the result of the bit-wise logical and
|
[
"Compute",
"the",
"bit",
"-",
"wise",
"logical",
"and",
"with",
"another",
"bitmap",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L251-L255
|
9,509
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.and2by2
|
public static void and2by2(BitmapContainer container, SparseBitmap bitmap1,
SparseBitmap bitmap2) {
int it1 = 0;
int it2 = 0;
int p1 = bitmap1.buffer.get(it1), p2 = bitmap2.buffer.get(it2);
int buff;
while (true) {
if (p1 < p2) {
if (it1 + 2 >= bitmap1.buffer.size())
break;
it1 += 2;
p1 += bitmap1.buffer.get(it1) + 1;
} else if (p1 > p2) {
if (it2 + 2 >= bitmap2.buffer.size())
break;
it2 += 2;
p2 += bitmap2.buffer.get(it2) + 1;
} else {
if ((buff = bitmap1.buffer.get(it1 + 1)
& bitmap2.buffer.get(it2 + 1)) != 0) {
container.add(buff, p1);
}
if ((it1 + 2 >= bitmap1.buffer.size())
|| (it2 + 2 >= bitmap2.buffer.size()))
break;
it1 += 2;
it2 += 2;
p1 += bitmap1.buffer.get(it1) + 1;
p2 += bitmap2.buffer.get(it2) + 1;
}
}
}
|
java
|
public static void and2by2(BitmapContainer container, SparseBitmap bitmap1,
SparseBitmap bitmap2) {
int it1 = 0;
int it2 = 0;
int p1 = bitmap1.buffer.get(it1), p2 = bitmap2.buffer.get(it2);
int buff;
while (true) {
if (p1 < p2) {
if (it1 + 2 >= bitmap1.buffer.size())
break;
it1 += 2;
p1 += bitmap1.buffer.get(it1) + 1;
} else if (p1 > p2) {
if (it2 + 2 >= bitmap2.buffer.size())
break;
it2 += 2;
p2 += bitmap2.buffer.get(it2) + 1;
} else {
if ((buff = bitmap1.buffer.get(it1 + 1)
& bitmap2.buffer.get(it2 + 1)) != 0) {
container.add(buff, p1);
}
if ((it1 + 2 >= bitmap1.buffer.size())
|| (it2 + 2 >= bitmap2.buffer.size()))
break;
it1 += 2;
it2 += 2;
p1 += bitmap1.buffer.get(it1) + 1;
p2 += bitmap2.buffer.get(it2) + 1;
}
}
}
|
[
"public",
"static",
"void",
"and2by2",
"(",
"BitmapContainer",
"container",
",",
"SparseBitmap",
"bitmap1",
",",
"SparseBitmap",
"bitmap2",
")",
"{",
"int",
"it1",
"=",
"0",
";",
"int",
"it2",
"=",
"0",
";",
"int",
"p1",
"=",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
")",
",",
"p2",
"=",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
")",
";",
"int",
"buff",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"p1",
"<",
"p2",
")",
"{",
"if",
"(",
"it1",
"+",
"2",
">=",
"bitmap1",
".",
"buffer",
".",
"size",
"(",
")",
")",
"break",
";",
"it1",
"+=",
"2",
";",
"p1",
"+=",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
")",
"+",
"1",
";",
"}",
"else",
"if",
"(",
"p1",
">",
"p2",
")",
"{",
"if",
"(",
"it2",
"+",
"2",
">=",
"bitmap2",
".",
"buffer",
".",
"size",
"(",
")",
")",
"break",
";",
"it2",
"+=",
"2",
";",
"p2",
"+=",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
")",
"+",
"1",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"buff",
"=",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
"+",
"1",
")",
"&",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
"+",
"1",
")",
")",
"!=",
"0",
")",
"{",
"container",
".",
"add",
"(",
"buff",
",",
"p1",
")",
";",
"}",
"if",
"(",
"(",
"it1",
"+",
"2",
">=",
"bitmap1",
".",
"buffer",
".",
"size",
"(",
")",
")",
"||",
"(",
"it2",
"+",
"2",
">=",
"bitmap2",
".",
"buffer",
".",
"size",
"(",
")",
")",
")",
"break",
";",
"it1",
"+=",
"2",
";",
"it2",
"+=",
"2",
";",
"p1",
"+=",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
")",
"+",
"1",
";",
"p2",
"+=",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
")",
"+",
"1",
";",
"}",
"}",
"}"
] |
Computes the bit-wise logical exclusive and of two bitmaps.
@param container
where the data will be stored
@param bitmap1
the first bitmap
@param bitmap2
the second bitmap
|
[
"Computes",
"the",
"bit",
"-",
"wise",
"logical",
"exclusive",
"and",
"of",
"two",
"bitmaps",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L267-L300
|
9,510
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.or
|
public SparseBitmap or(SparseBitmap o) {
SparseBitmap a = new SparseBitmap();
or2by2(a, this, o);
return a;
}
|
java
|
public SparseBitmap or(SparseBitmap o) {
SparseBitmap a = new SparseBitmap();
or2by2(a, this, o);
return a;
}
|
[
"public",
"SparseBitmap",
"or",
"(",
"SparseBitmap",
"o",
")",
"{",
"SparseBitmap",
"a",
"=",
"new",
"SparseBitmap",
"(",
")",
";",
"or2by2",
"(",
"a",
",",
"this",
",",
"o",
")",
";",
"return",
"a",
";",
"}"
] |
Computes the bit-wise logical or with another bitmap.
@param o
another bitmap
@return the result of the bit-wise logical or
|
[
"Computes",
"the",
"bit",
"-",
"wise",
"logical",
"or",
"with",
"another",
"bitmap",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L737-L741
|
9,511
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.or2by2
|
public static void or2by2(BitmapContainer container, SparseBitmap bitmap1,
SparseBitmap bitmap2) {
int it1 = 0;
int it2 = 0;
int p1 = bitmap1.buffer.get(it1);
int p2 = bitmap2.buffer.get(it2);
if ((it1 < bitmap1.buffer.size()) && (it2 < bitmap2.buffer.size()))
while (true) {
if (p1 < p2) {
container.add(bitmap1.buffer.get(it1 + 1), p1);
it1 += 2;
if (it1 >= bitmap1.buffer.size())
break;
p1 += bitmap1.buffer.get(it1) + 1;
} else if (p1 > p2) {
container.add(bitmap2.buffer.get(it2 + 1), p2);
it2 += 2;
if (it2 >= bitmap2.buffer.size())
break;
p2 += bitmap2.buffer.get(it2) + 1;
} else {
container.add(
bitmap1.buffer.get(it1 + 1)
| bitmap2.buffer.get(it2 + 1), p1);
it1 += 2;
it2 += 2;
if (it1 < bitmap1.buffer.size())
p1 += bitmap1.buffer.get(it1) + 1;
if (it2 < bitmap2.buffer.size())
p2 += bitmap2.buffer.get(it2) + 1;
if ((it1 >= bitmap1.buffer.size())
|| (it2 >= bitmap2.buffer.size()))
break;
}
}
if (it1 < bitmap1.buffer.size()) {
while (true) {
container.add(bitmap1.buffer.get(it1 + 1), p1);
it1 += 2;
if (it1 == bitmap1.buffer.size())
break;
p1 += bitmap1.buffer.get(it1) + 1;
}
}
if (it2 < bitmap2.buffer.size()) {
while (true) {
container.add(bitmap2.buffer.get(it2 + 1), p2);
it2 += 2;
if (it2 == bitmap2.buffer.size())
break;
p2 += bitmap2.buffer.get(it2) + 1;
}
}
}
|
java
|
public static void or2by2(BitmapContainer container, SparseBitmap bitmap1,
SparseBitmap bitmap2) {
int it1 = 0;
int it2 = 0;
int p1 = bitmap1.buffer.get(it1);
int p2 = bitmap2.buffer.get(it2);
if ((it1 < bitmap1.buffer.size()) && (it2 < bitmap2.buffer.size()))
while (true) {
if (p1 < p2) {
container.add(bitmap1.buffer.get(it1 + 1), p1);
it1 += 2;
if (it1 >= bitmap1.buffer.size())
break;
p1 += bitmap1.buffer.get(it1) + 1;
} else if (p1 > p2) {
container.add(bitmap2.buffer.get(it2 + 1), p2);
it2 += 2;
if (it2 >= bitmap2.buffer.size())
break;
p2 += bitmap2.buffer.get(it2) + 1;
} else {
container.add(
bitmap1.buffer.get(it1 + 1)
| bitmap2.buffer.get(it2 + 1), p1);
it1 += 2;
it2 += 2;
if (it1 < bitmap1.buffer.size())
p1 += bitmap1.buffer.get(it1) + 1;
if (it2 < bitmap2.buffer.size())
p2 += bitmap2.buffer.get(it2) + 1;
if ((it1 >= bitmap1.buffer.size())
|| (it2 >= bitmap2.buffer.size()))
break;
}
}
if (it1 < bitmap1.buffer.size()) {
while (true) {
container.add(bitmap1.buffer.get(it1 + 1), p1);
it1 += 2;
if (it1 == bitmap1.buffer.size())
break;
p1 += bitmap1.buffer.get(it1) + 1;
}
}
if (it2 < bitmap2.buffer.size()) {
while (true) {
container.add(bitmap2.buffer.get(it2 + 1), p2);
it2 += 2;
if (it2 == bitmap2.buffer.size())
break;
p2 += bitmap2.buffer.get(it2) + 1;
}
}
}
|
[
"public",
"static",
"void",
"or2by2",
"(",
"BitmapContainer",
"container",
",",
"SparseBitmap",
"bitmap1",
",",
"SparseBitmap",
"bitmap2",
")",
"{",
"int",
"it1",
"=",
"0",
";",
"int",
"it2",
"=",
"0",
";",
"int",
"p1",
"=",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
")",
";",
"int",
"p2",
"=",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
")",
";",
"if",
"(",
"(",
"it1",
"<",
"bitmap1",
".",
"buffer",
".",
"size",
"(",
")",
")",
"&&",
"(",
"it2",
"<",
"bitmap2",
".",
"buffer",
".",
"size",
"(",
")",
")",
")",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"p1",
"<",
"p2",
")",
"{",
"container",
".",
"add",
"(",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
"+",
"1",
")",
",",
"p1",
")",
";",
"it1",
"+=",
"2",
";",
"if",
"(",
"it1",
">=",
"bitmap1",
".",
"buffer",
".",
"size",
"(",
")",
")",
"break",
";",
"p1",
"+=",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
")",
"+",
"1",
";",
"}",
"else",
"if",
"(",
"p1",
">",
"p2",
")",
"{",
"container",
".",
"add",
"(",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
"+",
"1",
")",
",",
"p2",
")",
";",
"it2",
"+=",
"2",
";",
"if",
"(",
"it2",
">=",
"bitmap2",
".",
"buffer",
".",
"size",
"(",
")",
")",
"break",
";",
"p2",
"+=",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
")",
"+",
"1",
";",
"}",
"else",
"{",
"container",
".",
"add",
"(",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
"+",
"1",
")",
"|",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
"+",
"1",
")",
",",
"p1",
")",
";",
"it1",
"+=",
"2",
";",
"it2",
"+=",
"2",
";",
"if",
"(",
"it1",
"<",
"bitmap1",
".",
"buffer",
".",
"size",
"(",
")",
")",
"p1",
"+=",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
")",
"+",
"1",
";",
"if",
"(",
"it2",
"<",
"bitmap2",
".",
"buffer",
".",
"size",
"(",
")",
")",
"p2",
"+=",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
")",
"+",
"1",
";",
"if",
"(",
"(",
"it1",
">=",
"bitmap1",
".",
"buffer",
".",
"size",
"(",
")",
")",
"||",
"(",
"it2",
">=",
"bitmap2",
".",
"buffer",
".",
"size",
"(",
")",
")",
")",
"break",
";",
"}",
"}",
"if",
"(",
"it1",
"<",
"bitmap1",
".",
"buffer",
".",
"size",
"(",
")",
")",
"{",
"while",
"(",
"true",
")",
"{",
"container",
".",
"add",
"(",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
"+",
"1",
")",
",",
"p1",
")",
";",
"it1",
"+=",
"2",
";",
"if",
"(",
"it1",
"==",
"bitmap1",
".",
"buffer",
".",
"size",
"(",
")",
")",
"break",
";",
"p1",
"+=",
"bitmap1",
".",
"buffer",
".",
"get",
"(",
"it1",
")",
"+",
"1",
";",
"}",
"}",
"if",
"(",
"it2",
"<",
"bitmap2",
".",
"buffer",
".",
"size",
"(",
")",
")",
"{",
"while",
"(",
"true",
")",
"{",
"container",
".",
"add",
"(",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
"+",
"1",
")",
",",
"p2",
")",
";",
"it2",
"+=",
"2",
";",
"if",
"(",
"it2",
"==",
"bitmap2",
".",
"buffer",
".",
"size",
"(",
")",
")",
"break",
";",
"p2",
"+=",
"bitmap2",
".",
"buffer",
".",
"get",
"(",
"it2",
")",
"+",
"1",
";",
"}",
"}",
"}"
] |
Computes the bit-wise logical or of two bitmaps.
@param container
where the data will be stored
@param bitmap1
the first bitmap
@param bitmap2
the second bitmap
|
[
"Computes",
"the",
"bit",
"-",
"wise",
"logical",
"or",
"of",
"two",
"bitmaps",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L753-L807
|
9,512
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.xor
|
public SparseBitmap xor(SparseBitmap o) {
SparseBitmap a = new SparseBitmap();
xor2by2(a, this, o);
return a;
}
|
java
|
public SparseBitmap xor(SparseBitmap o) {
SparseBitmap a = new SparseBitmap();
xor2by2(a, this, o);
return a;
}
|
[
"public",
"SparseBitmap",
"xor",
"(",
"SparseBitmap",
"o",
")",
"{",
"SparseBitmap",
"a",
"=",
"new",
"SparseBitmap",
"(",
")",
";",
"xor2by2",
"(",
"a",
",",
"this",
",",
"o",
")",
";",
"return",
"a",
";",
"}"
] |
Computes the bit-wise logical exclusive or with another bitmap.
@param o
another bitmap
@return the result of the bti-wise logical exclusive or
|
[
"Computes",
"the",
"bit",
"-",
"wise",
"logical",
"exclusive",
"or",
"with",
"another",
"bitmap",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L816-L820
|
9,513
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.and
|
public static SparseBitmap and(SparseBitmap... bitmaps) {
if (bitmaps.length == 0)
return new SparseBitmap();
else if (bitmaps.length == 1)
return bitmaps[0];
else if (bitmaps.length == 2)
return bitmaps[0].and(bitmaps[1]);
// for "and" a priority queue is not needed, but
// overhead ought to be small
PriorityQueue<SparseBitmap> pq = new PriorityQueue<SparseBitmap>(
bitmaps.length, smallfirst);
for (SparseBitmap x : bitmaps)
pq.add(x);
while (pq.size() > 1) {
SparseBitmap x1 = pq.poll();
SparseBitmap x2 = pq.poll();
pq.add(x1.and(x2));
}
return pq.poll();
}
|
java
|
public static SparseBitmap and(SparseBitmap... bitmaps) {
if (bitmaps.length == 0)
return new SparseBitmap();
else if (bitmaps.length == 1)
return bitmaps[0];
else if (bitmaps.length == 2)
return bitmaps[0].and(bitmaps[1]);
// for "and" a priority queue is not needed, but
// overhead ought to be small
PriorityQueue<SparseBitmap> pq = new PriorityQueue<SparseBitmap>(
bitmaps.length, smallfirst);
for (SparseBitmap x : bitmaps)
pq.add(x);
while (pq.size() > 1) {
SparseBitmap x1 = pq.poll();
SparseBitmap x2 = pq.poll();
pq.add(x1.and(x2));
}
return pq.poll();
}
|
[
"public",
"static",
"SparseBitmap",
"and",
"(",
"SparseBitmap",
"...",
"bitmaps",
")",
"{",
"if",
"(",
"bitmaps",
".",
"length",
"==",
"0",
")",
"return",
"new",
"SparseBitmap",
"(",
")",
";",
"else",
"if",
"(",
"bitmaps",
".",
"length",
"==",
"1",
")",
"return",
"bitmaps",
"[",
"0",
"]",
";",
"else",
"if",
"(",
"bitmaps",
".",
"length",
"==",
"2",
")",
"return",
"bitmaps",
"[",
"0",
"]",
".",
"and",
"(",
"bitmaps",
"[",
"1",
"]",
")",
";",
"// for \"and\" a priority queue is not needed, but",
"// overhead ought to be small",
"PriorityQueue",
"<",
"SparseBitmap",
">",
"pq",
"=",
"new",
"PriorityQueue",
"<",
"SparseBitmap",
">",
"(",
"bitmaps",
".",
"length",
",",
"smallfirst",
")",
";",
"for",
"(",
"SparseBitmap",
"x",
":",
"bitmaps",
")",
"pq",
".",
"(",
"x",
")",
";",
"while",
"(",
"pq",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"SparseBitmap",
"x1",
"=",
"pq",
".",
"poll",
"(",
")",
";",
"SparseBitmap",
"x2",
"=",
"pq",
".",
"poll",
"(",
")",
";",
"pq",
".",
"add",
"(",
"x1",
".",
"and",
"(",
"x2",
")",
")",
";",
"}",
"return",
"pq",
".",
"poll",
"(",
")",
";",
"}"
] |
Computes the bit-wise and aggregate over several bitmaps.
@param bitmaps
the bitmaps to aggregate
@return the resulting bitmap
|
[
"Computes",
"the",
"bit",
"-",
"wise",
"and",
"aggregate",
"over",
"several",
"bitmaps",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L906-L925
|
9,514
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.getSkippableIterator
|
public SkippableIterator getSkippableIterator() {
return new SkippableIterator() {
int pos = 0;
int p = 0;
public SkippableIterator init() {
this.p = SparseBitmap.this.buffer.get(0);
return this;
}
@Override
public void advance() {
this.pos += 2;
if (this.pos < SparseBitmap.this.buffer.size())
this.p += SparseBitmap.this.buffer.get(this.pos) + 1;
}
@Override
public void advanceUntil(int min) {
advance();
while (hasValue() && (getCurrentWordOffset() < min)) {
advance();
}
}
@Override
public int getCurrentWord() {
return SparseBitmap.this.buffer.get(this.pos + 1);
}
@Override
public int getCurrentWordOffset() {
return this.p;
}
@Override
public boolean hasValue() {
return this.pos < SparseBitmap.this.buffer.size();
}
}.init();
}
|
java
|
public SkippableIterator getSkippableIterator() {
return new SkippableIterator() {
int pos = 0;
int p = 0;
public SkippableIterator init() {
this.p = SparseBitmap.this.buffer.get(0);
return this;
}
@Override
public void advance() {
this.pos += 2;
if (this.pos < SparseBitmap.this.buffer.size())
this.p += SparseBitmap.this.buffer.get(this.pos) + 1;
}
@Override
public void advanceUntil(int min) {
advance();
while (hasValue() && (getCurrentWordOffset() < min)) {
advance();
}
}
@Override
public int getCurrentWord() {
return SparseBitmap.this.buffer.get(this.pos + 1);
}
@Override
public int getCurrentWordOffset() {
return this.p;
}
@Override
public boolean hasValue() {
return this.pos < SparseBitmap.this.buffer.size();
}
}.init();
}
|
[
"public",
"SkippableIterator",
"getSkippableIterator",
"(",
")",
"{",
"return",
"new",
"SkippableIterator",
"(",
")",
"{",
"int",
"pos",
"=",
"0",
";",
"int",
"p",
"=",
"0",
";",
"public",
"SkippableIterator",
"init",
"(",
")",
"{",
"this",
".",
"p",
"=",
"SparseBitmap",
".",
"this",
".",
"buffer",
".",
"get",
"(",
"0",
")",
";",
"return",
"this",
";",
"}",
"@",
"Override",
"public",
"void",
"advance",
"(",
")",
"{",
"this",
".",
"pos",
"+=",
"2",
";",
"if",
"(",
"this",
".",
"pos",
"<",
"SparseBitmap",
".",
"this",
".",
"buffer",
".",
"size",
"(",
")",
")",
"this",
".",
"p",
"+=",
"SparseBitmap",
".",
"this",
".",
"buffer",
".",
"get",
"(",
"this",
".",
"pos",
")",
"+",
"1",
";",
"}",
"@",
"Override",
"public",
"void",
"advanceUntil",
"(",
"int",
"min",
")",
"{",
"advance",
"(",
")",
";",
"while",
"(",
"hasValue",
"(",
")",
"&&",
"(",
"getCurrentWordOffset",
"(",
")",
"<",
"min",
")",
")",
"{",
"advance",
"(",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"int",
"getCurrentWord",
"(",
")",
"{",
"return",
"SparseBitmap",
".",
"this",
".",
"buffer",
".",
"get",
"(",
"this",
".",
"pos",
"+",
"1",
")",
";",
"}",
"@",
"Override",
"public",
"int",
"getCurrentWordOffset",
"(",
")",
"{",
"return",
"this",
".",
"p",
";",
"}",
"@",
"Override",
"public",
"boolean",
"hasValue",
"(",
")",
"{",
"return",
"this",
".",
"pos",
"<",
"SparseBitmap",
".",
"this",
".",
"buffer",
".",
"size",
"(",
")",
";",
"}",
"}",
".",
"init",
"(",
")",
";",
"}"
] |
Gets the skippable iterator.
@return the skippable iterator
|
[
"Gets",
"the",
"skippable",
"iterator",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L1028-L1069
|
9,515
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.match
|
public static boolean match(SkippableIterator o1, SkippableIterator o2) {
while (o1.getCurrentWordOffset() != o2.getCurrentWordOffset()) {
if (o1.getCurrentWordOffset() < o2.getCurrentWordOffset()) {
o1.advanceUntil(o2.getCurrentWordOffset());
if (!o1.hasValue())
return false;
}
if (o1.getCurrentWordOffset() > o2.getCurrentWordOffset()) {
o2.advanceUntil(o1.getCurrentWordOffset());
if (!o2.hasValue())
return false;
}
}
return true;
}
|
java
|
public static boolean match(SkippableIterator o1, SkippableIterator o2) {
while (o1.getCurrentWordOffset() != o2.getCurrentWordOffset()) {
if (o1.getCurrentWordOffset() < o2.getCurrentWordOffset()) {
o1.advanceUntil(o2.getCurrentWordOffset());
if (!o1.hasValue())
return false;
}
if (o1.getCurrentWordOffset() > o2.getCurrentWordOffset()) {
o2.advanceUntil(o1.getCurrentWordOffset());
if (!o2.hasValue())
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"match",
"(",
"SkippableIterator",
"o1",
",",
"SkippableIterator",
"o2",
")",
"{",
"while",
"(",
"o1",
".",
"getCurrentWordOffset",
"(",
")",
"!=",
"o2",
".",
"getCurrentWordOffset",
"(",
")",
")",
"{",
"if",
"(",
"o1",
".",
"getCurrentWordOffset",
"(",
")",
"<",
"o2",
".",
"getCurrentWordOffset",
"(",
")",
")",
"{",
"o1",
".",
"advanceUntil",
"(",
"o2",
".",
"getCurrentWordOffset",
"(",
")",
")",
";",
"if",
"(",
"!",
"o1",
".",
"hasValue",
"(",
")",
")",
"return",
"false",
";",
"}",
"if",
"(",
"o1",
".",
"getCurrentWordOffset",
"(",
")",
">",
"o2",
".",
"getCurrentWordOffset",
"(",
")",
")",
"{",
"o2",
".",
"advanceUntil",
"(",
"o1",
".",
"getCurrentWordOffset",
"(",
")",
")",
";",
"if",
"(",
"!",
"o2",
".",
"hasValue",
"(",
")",
")",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Synchronize two iterators
@param o1
the first iterator
@param o2
the second iterator
@return true, if successful
|
[
"Synchronize",
"two",
"iterators"
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L1080-L1094
|
9,516
|
lemire/sparsebitmap
|
src/main/java/sparsebitmap/SparseBitmap.java
|
SparseBitmap.cardinality
|
public int cardinality() {
int answer = 0;
for (int k = 0; k < this.buffer.size(); k += 2) {
answer += Integer.bitCount(this.buffer.get(k + 1));
}
return answer;
}
|
java
|
public int cardinality() {
int answer = 0;
for (int k = 0; k < this.buffer.size(); k += 2) {
answer += Integer.bitCount(this.buffer.get(k + 1));
}
return answer;
}
|
[
"public",
"int",
"cardinality",
"(",
")",
"{",
"int",
"answer",
"=",
"0",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"this",
".",
"buffer",
".",
"size",
"(",
")",
";",
"k",
"+=",
"2",
")",
"{",
"answer",
"+=",
"Integer",
".",
"bitCount",
"(",
"this",
".",
"buffer",
".",
"get",
"(",
"k",
"+",
"1",
")",
")",
";",
"}",
"return",
"answer",
";",
"}"
] |
Compute the cardinality.
@return the cardinality
|
[
"Compute",
"the",
"cardinality",
"."
] |
f362e0811c32f68adfe4b748d513c46857898ec9
|
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L1150-L1156
|
9,517
|
Domo42/saga-lib
|
saga-lib/src/main/java/com/codebullets/sagalib/processing/invocation/ModulesInvoker.java
|
ModulesInvoker.finish
|
Collection<Exception> finish() {
return Lists.reverse(finishers).stream()
.flatMap(f -> f.get().map(Stream::of).orElse(Stream.empty()))
.collect(Collectors.toList());
}
|
java
|
Collection<Exception> finish() {
return Lists.reverse(finishers).stream()
.flatMap(f -> f.get().map(Stream::of).orElse(Stream.empty()))
.collect(Collectors.toList());
}
|
[
"Collection",
"<",
"Exception",
">",
"finish",
"(",
")",
"{",
"return",
"Lists",
".",
"reverse",
"(",
"finishers",
")",
".",
"stream",
"(",
")",
".",
"flatMap",
"(",
"f",
"->",
"f",
".",
"get",
"(",
")",
".",
"map",
"(",
"Stream",
"::",
"of",
")",
".",
"orElse",
"(",
"Stream",
".",
"empty",
"(",
")",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"}"
] |
Call finishers on all started modules.
|
[
"Call",
"finishers",
"on",
"all",
"started",
"modules",
"."
] |
c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef
|
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/invocation/ModulesInvoker.java#L86-L90
|
9,518
|
Domo42/saga-lib
|
saga-lib/src/main/java/com/codebullets/sagalib/processing/invocation/ModulesInvoker.java
|
ModulesInvoker.error
|
public Collection<Exception> error(final Object message, final Throwable error) {
return Lists.reverse(errorHandlers).stream()
.flatMap(f -> f.apply(message, error).map(Stream::of).orElse(Stream.empty()))
.collect(Collectors.toList());
}
|
java
|
public Collection<Exception> error(final Object message, final Throwable error) {
return Lists.reverse(errorHandlers).stream()
.flatMap(f -> f.apply(message, error).map(Stream::of).orElse(Stream.empty()))
.collect(Collectors.toList());
}
|
[
"public",
"Collection",
"<",
"Exception",
">",
"error",
"(",
"final",
"Object",
"message",
",",
"final",
"Throwable",
"error",
")",
"{",
"return",
"Lists",
".",
"reverse",
"(",
"errorHandlers",
")",
".",
"stream",
"(",
")",
".",
"flatMap",
"(",
"f",
"->",
"f",
".",
"apply",
"(",
"message",
",",
"error",
")",
".",
"map",
"(",
"Stream",
"::",
"of",
")",
".",
"orElse",
"(",
"Stream",
".",
"empty",
"(",
")",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"}"
] |
Execute error method on started modules.
@return Returns possible errors triggered during error handing itself
|
[
"Execute",
"error",
"method",
"on",
"started",
"modules",
"."
] |
c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef
|
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/invocation/ModulesInvoker.java#L96-L100
|
9,519
|
Domo42/saga-lib
|
saga-lib/src/main/java/com/codebullets/sagalib/processing/invocation/ModulesInvoker.java
|
ModulesInvoker.tryExecute
|
private static Optional<Exception> tryExecute(final Runnable runnable, final SagaModule module) {
Exception executionException;
try {
runnable.run();
executionException = null;
} catch (Exception ex) {
executionException = ex;
LOG.error("Error executing function on module {}", module, ex);
}
return Optional.ofNullable(executionException);
}
|
java
|
private static Optional<Exception> tryExecute(final Runnable runnable, final SagaModule module) {
Exception executionException;
try {
runnable.run();
executionException = null;
} catch (Exception ex) {
executionException = ex;
LOG.error("Error executing function on module {}", module, ex);
}
return Optional.ofNullable(executionException);
}
|
[
"private",
"static",
"Optional",
"<",
"Exception",
">",
"tryExecute",
"(",
"final",
"Runnable",
"runnable",
",",
"final",
"SagaModule",
"module",
")",
"{",
"Exception",
"executionException",
";",
"try",
"{",
"runnable",
".",
"run",
"(",
")",
";",
"executionException",
"=",
"null",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"executionException",
"=",
"ex",
";",
"LOG",
".",
"error",
"(",
"\"Error executing function on module {}\"",
",",
"module",
",",
"ex",
")",
";",
"}",
"return",
"Optional",
".",
"ofNullable",
"(",
"executionException",
")",
";",
"}"
] |
Executes the provided runnable without throwing possible exceptions.
@return Returns the exception encountered during execution.
|
[
"Executes",
"the",
"provided",
"runnable",
"without",
"throwing",
"possible",
"exceptions",
"."
] |
c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef
|
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/invocation/ModulesInvoker.java#L114-L126
|
9,520
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/management/destination/AbstractDestinationDescriptor.java
|
AbstractDestinationDescriptor.fillSettings
|
protected void fillSettings( Settings settings )
{
settings.setStringProperty("name", name);
settings.setIntProperty("persistentStore.initialBlockCount", initialBlockCount);
settings.setIntProperty("persistentStore.maxBlockCount", maxBlockCount);
settings.setIntProperty("persistentStore.autoExtendAmount", autoExtendAmount);
settings.setIntProperty("persistentStore.blockSize", blockSize);
if (rawDataFolder != null)
settings.setStringProperty("persistentStore.dataFolder", rawDataFolder);
settings.setIntProperty("memoryStore.maxMessages", maxNonPersistentMessages);
settings.setBooleanProperty("persistentStore.useJournal", useJournal);
if (rawJournalFolder != null)
settings.setStringProperty("persistentStore.journal.dataFolder", rawJournalFolder);
settings.setLongProperty("persistentStore.journal.maxFileSize", maxJournalSize);
settings.setIntProperty("persistentStore.journal.maxWriteBatchSize", maxWriteBatchSize);
settings.setIntProperty("persistentStore.journal.maxUnflushedJournalSize", maxUnflushedJournalSize);
settings.setIntProperty("persistentStore.journal.maxUncommittedStoreSize", maxUncommittedStoreSize);
settings.setIntProperty("persistentStore.journal.outputBufferSize", journalOutputBuffer);
settings.setBooleanProperty("persistentStore.journal.preAllocateFiles", preAllocateFiles);
settings.setIntProperty("persistentStore.syncMethod", storageSyncMethod);
settings.setBooleanProperty("temporary", temporary);
settings.setBooleanProperty("memoryStore.overflowToPersistent", overflowToPersistent);
}
|
java
|
protected void fillSettings( Settings settings )
{
settings.setStringProperty("name", name);
settings.setIntProperty("persistentStore.initialBlockCount", initialBlockCount);
settings.setIntProperty("persistentStore.maxBlockCount", maxBlockCount);
settings.setIntProperty("persistentStore.autoExtendAmount", autoExtendAmount);
settings.setIntProperty("persistentStore.blockSize", blockSize);
if (rawDataFolder != null)
settings.setStringProperty("persistentStore.dataFolder", rawDataFolder);
settings.setIntProperty("memoryStore.maxMessages", maxNonPersistentMessages);
settings.setBooleanProperty("persistentStore.useJournal", useJournal);
if (rawJournalFolder != null)
settings.setStringProperty("persistentStore.journal.dataFolder", rawJournalFolder);
settings.setLongProperty("persistentStore.journal.maxFileSize", maxJournalSize);
settings.setIntProperty("persistentStore.journal.maxWriteBatchSize", maxWriteBatchSize);
settings.setIntProperty("persistentStore.journal.maxUnflushedJournalSize", maxUnflushedJournalSize);
settings.setIntProperty("persistentStore.journal.maxUncommittedStoreSize", maxUncommittedStoreSize);
settings.setIntProperty("persistentStore.journal.outputBufferSize", journalOutputBuffer);
settings.setBooleanProperty("persistentStore.journal.preAllocateFiles", preAllocateFiles);
settings.setIntProperty("persistentStore.syncMethod", storageSyncMethod);
settings.setBooleanProperty("temporary", temporary);
settings.setBooleanProperty("memoryStore.overflowToPersistent", overflowToPersistent);
}
|
[
"protected",
"void",
"fillSettings",
"(",
"Settings",
"settings",
")",
"{",
"settings",
".",
"setStringProperty",
"(",
"\"name\"",
",",
"name",
")",
";",
"settings",
".",
"setIntProperty",
"(",
"\"persistentStore.initialBlockCount\"",
",",
"initialBlockCount",
")",
";",
"settings",
".",
"setIntProperty",
"(",
"\"persistentStore.maxBlockCount\"",
",",
"maxBlockCount",
")",
";",
"settings",
".",
"setIntProperty",
"(",
"\"persistentStore.autoExtendAmount\"",
",",
"autoExtendAmount",
")",
";",
"settings",
".",
"setIntProperty",
"(",
"\"persistentStore.blockSize\"",
",",
"blockSize",
")",
";",
"if",
"(",
"rawDataFolder",
"!=",
"null",
")",
"settings",
".",
"setStringProperty",
"(",
"\"persistentStore.dataFolder\"",
",",
"rawDataFolder",
")",
";",
"settings",
".",
"setIntProperty",
"(",
"\"memoryStore.maxMessages\"",
",",
"maxNonPersistentMessages",
")",
";",
"settings",
".",
"setBooleanProperty",
"(",
"\"persistentStore.useJournal\"",
",",
"useJournal",
")",
";",
"if",
"(",
"rawJournalFolder",
"!=",
"null",
")",
"settings",
".",
"setStringProperty",
"(",
"\"persistentStore.journal.dataFolder\"",
",",
"rawJournalFolder",
")",
";",
"settings",
".",
"setLongProperty",
"(",
"\"persistentStore.journal.maxFileSize\"",
",",
"maxJournalSize",
")",
";",
"settings",
".",
"setIntProperty",
"(",
"\"persistentStore.journal.maxWriteBatchSize\"",
",",
"maxWriteBatchSize",
")",
";",
"settings",
".",
"setIntProperty",
"(",
"\"persistentStore.journal.maxUnflushedJournalSize\"",
",",
"maxUnflushedJournalSize",
")",
";",
"settings",
".",
"setIntProperty",
"(",
"\"persistentStore.journal.maxUncommittedStoreSize\"",
",",
"maxUncommittedStoreSize",
")",
";",
"settings",
".",
"setIntProperty",
"(",
"\"persistentStore.journal.outputBufferSize\"",
",",
"journalOutputBuffer",
")",
";",
"settings",
".",
"setBooleanProperty",
"(",
"\"persistentStore.journal.preAllocateFiles\"",
",",
"preAllocateFiles",
")",
";",
"settings",
".",
"setIntProperty",
"(",
"\"persistentStore.syncMethod\"",
",",
"storageSyncMethod",
")",
";",
"settings",
".",
"setBooleanProperty",
"(",
"\"temporary\"",
",",
"temporary",
")",
";",
"settings",
".",
"setBooleanProperty",
"(",
"\"memoryStore.overflowToPersistent\"",
",",
"overflowToPersistent",
")",
";",
"}"
] |
Append nodes to the XML definition
|
[
"Append",
"nodes",
"to",
"the",
"XML",
"definition"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/management/destination/AbstractDestinationDescriptor.java#L140-L162
|
9,521
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/local/destination/AbstractLocalDestination.java
|
AbstractLocalDestination.registerConsumer
|
public void registerConsumer( LocalMessageConsumer consumer )
{
consumersLock.writeLock().lock();
try
{
localConsumers.add(consumer);
}
finally
{
consumersLock.writeLock().unlock();
}
}
|
java
|
public void registerConsumer( LocalMessageConsumer consumer )
{
consumersLock.writeLock().lock();
try
{
localConsumers.add(consumer);
}
finally
{
consumersLock.writeLock().unlock();
}
}
|
[
"public",
"void",
"registerConsumer",
"(",
"LocalMessageConsumer",
"consumer",
")",
"{",
"consumersLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"localConsumers",
".",
"add",
"(",
"consumer",
")",
";",
"}",
"finally",
"{",
"consumersLock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Register a message consumer on this queue
|
[
"Register",
"a",
"message",
"consumer",
"on",
"this",
"queue"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/AbstractLocalDestination.java#L82-L93
|
9,522
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/local/destination/AbstractLocalDestination.java
|
AbstractLocalDestination.unregisterConsumer
|
public void unregisterConsumer( LocalMessageConsumer consumer )
{
consumersLock.writeLock().lock();
try
{
localConsumers.remove(consumer);
}
finally
{
consumersLock.writeLock().unlock();
}
}
|
java
|
public void unregisterConsumer( LocalMessageConsumer consumer )
{
consumersLock.writeLock().lock();
try
{
localConsumers.remove(consumer);
}
finally
{
consumersLock.writeLock().unlock();
}
}
|
[
"public",
"void",
"unregisterConsumer",
"(",
"LocalMessageConsumer",
"consumer",
")",
"{",
"consumersLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"localConsumers",
".",
"remove",
"(",
"consumer",
")",
";",
"}",
"finally",
"{",
"consumersLock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Unregister a message listener
|
[
"Unregister",
"a",
"message",
"listener"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/AbstractLocalDestination.java#L98-L109
|
9,523
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/management/DescriptorTools.java
|
DescriptorTools.getDescriptorFiles
|
public static File[] getDescriptorFiles( File definitionDir , final String prefix , final String suffix )
{
return definitionDir.listFiles(new FileFilter() {
/*
* (non-Javadoc)
* @see java.io.FileFilter#accept(java.io.File)
*/
@Override
public boolean accept(File pathname)
{
if (!pathname.isFile() || !pathname.canRead())
return false;
String name = pathname.getName();
return name.toLowerCase().endsWith(suffix) && name.startsWith(prefix);
}
});
}
|
java
|
public static File[] getDescriptorFiles( File definitionDir , final String prefix , final String suffix )
{
return definitionDir.listFiles(new FileFilter() {
/*
* (non-Javadoc)
* @see java.io.FileFilter#accept(java.io.File)
*/
@Override
public boolean accept(File pathname)
{
if (!pathname.isFile() || !pathname.canRead())
return false;
String name = pathname.getName();
return name.toLowerCase().endsWith(suffix) && name.startsWith(prefix);
}
});
}
|
[
"public",
"static",
"File",
"[",
"]",
"getDescriptorFiles",
"(",
"File",
"definitionDir",
",",
"final",
"String",
"prefix",
",",
"final",
"String",
"suffix",
")",
"{",
"return",
"definitionDir",
".",
"listFiles",
"(",
"new",
"FileFilter",
"(",
")",
"{",
"/*\n * (non-Javadoc)\n * @see java.io.FileFilter#accept(java.io.File)\n */",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"pathname",
")",
"{",
"if",
"(",
"!",
"pathname",
".",
"isFile",
"(",
")",
"||",
"!",
"pathname",
".",
"canRead",
"(",
")",
")",
"return",
"false",
";",
"String",
"name",
"=",
"pathname",
".",
"getName",
"(",
")",
";",
"return",
"name",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"suffix",
")",
"&&",
"name",
".",
"startsWith",
"(",
"prefix",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Find all descriptor files with the given prefix in a target folder
@param definitionDir the target folder
@param prefix the descriptor filename prefix
@return an array of descriptor files
|
[
"Find",
"all",
"descriptor",
"files",
"with",
"the",
"given",
"prefix",
"in",
"a",
"target",
"folder"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/management/DescriptorTools.java#L34-L51
|
9,524
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/utils/JavaTools.java
|
JavaTools.getShortClassName
|
public static String getShortClassName( Class<?> clazz )
{
String className = clazz.getName();
int idx = className.lastIndexOf('.');
return (idx == -1 ? className : className.substring(idx+1));
}
|
java
|
public static String getShortClassName( Class<?> clazz )
{
String className = clazz.getName();
int idx = className.lastIndexOf('.');
return (idx == -1 ? className : className.substring(idx+1));
}
|
[
"public",
"static",
"String",
"getShortClassName",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"String",
"className",
"=",
"clazz",
".",
"getName",
"(",
")",
";",
"int",
"idx",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"return",
"(",
"idx",
"==",
"-",
"1",
"?",
"className",
":",
"className",
".",
"substring",
"(",
"idx",
"+",
"1",
")",
")",
";",
"}"
] |
Get the short name of the given class
|
[
"Get",
"the",
"short",
"name",
"of",
"the",
"given",
"class"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/JavaTools.java#L28-L33
|
9,525
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/utils/JavaTools.java
|
JavaTools.getCallerMethodName
|
public static String getCallerMethodName( int offset )
{
StackTraceElement[] stack = new Exception().getStackTrace();
return stack[offset+1].getMethodName();
}
|
java
|
public static String getCallerMethodName( int offset )
{
StackTraceElement[] stack = new Exception().getStackTrace();
return stack[offset+1].getMethodName();
}
|
[
"public",
"static",
"String",
"getCallerMethodName",
"(",
"int",
"offset",
")",
"{",
"StackTraceElement",
"[",
"]",
"stack",
"=",
"new",
"Exception",
"(",
")",
".",
"getStackTrace",
"(",
")",
";",
"return",
"stack",
"[",
"offset",
"+",
"1",
"]",
".",
"getMethodName",
"(",
")",
";",
"}"
] |
Get the name of the caller method
|
[
"Get",
"the",
"name",
"of",
"the",
"caller",
"method"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/JavaTools.java#L38-L42
|
9,526
|
timewalker74/ffmq
|
server/src/main/java/net/timewalker/ffmq4/jmx/rmi/JMXOverRMIServerSocketFactory.java
|
JMXOverRMIServerSocketFactory.close
|
public void close()
{
if (!manageSockets)
throw new IllegalStateException("Cannot close an un-managed socket factory");
synchronized (createdSockets)
{
Iterator<ServerSocket> sockets = createdSockets.iterator();
while (sockets.hasNext())
{
ServerSocket socket = sockets.next();
try
{
socket.close();
}
catch (Exception e)
{
log.error("Could not close server socket",e);
}
}
createdSockets.clear();
}
}
|
java
|
public void close()
{
if (!manageSockets)
throw new IllegalStateException("Cannot close an un-managed socket factory");
synchronized (createdSockets)
{
Iterator<ServerSocket> sockets = createdSockets.iterator();
while (sockets.hasNext())
{
ServerSocket socket = sockets.next();
try
{
socket.close();
}
catch (Exception e)
{
log.error("Could not close server socket",e);
}
}
createdSockets.clear();
}
}
|
[
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"!",
"manageSockets",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot close an un-managed socket factory\"",
")",
";",
"synchronized",
"(",
"createdSockets",
")",
"{",
"Iterator",
"<",
"ServerSocket",
">",
"sockets",
"=",
"createdSockets",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"sockets",
".",
"hasNext",
"(",
")",
")",
"{",
"ServerSocket",
"socket",
"=",
"sockets",
".",
"next",
"(",
")",
";",
"try",
"{",
"socket",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Could not close server socket\"",
",",
"e",
")",
";",
"}",
"}",
"createdSockets",
".",
"clear",
"(",
")",
";",
"}",
"}"
] |
Cleanup sockets created by this factory
|
[
"Cleanup",
"sockets",
"created",
"by",
"this",
"factory"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/server/src/main/java/net/timewalker/ffmq4/jmx/rmi/JMXOverRMIServerSocketFactory.java#L97-L119
|
9,527
|
Domo42/saga-lib
|
saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java
|
SagaKeyReaderExtractor.tryGetKeyReader
|
private KeyReader tryGetKeyReader(final Class<? extends Saga> sagaClazz, final Object message) {
KeyReader reader;
try {
Optional<KeyReader> cachedReader = knownReaders.get(
SagaMessageKey.forMessage(sagaClazz, message),
() -> {
KeyReader foundReader = findReader(sagaClazz, message);
return Optional.fromNullable(foundReader);
});
reader = cachedReader.orNull();
} catch (Exception ex) {
LOG.error("Error searching for reader to extract saga key. sagatype = {}, message = {}", sagaClazz, message, ex);
reader = null;
}
return reader;
}
|
java
|
private KeyReader tryGetKeyReader(final Class<? extends Saga> sagaClazz, final Object message) {
KeyReader reader;
try {
Optional<KeyReader> cachedReader = knownReaders.get(
SagaMessageKey.forMessage(sagaClazz, message),
() -> {
KeyReader foundReader = findReader(sagaClazz, message);
return Optional.fromNullable(foundReader);
});
reader = cachedReader.orNull();
} catch (Exception ex) {
LOG.error("Error searching for reader to extract saga key. sagatype = {}, message = {}", sagaClazz, message, ex);
reader = null;
}
return reader;
}
|
[
"private",
"KeyReader",
"tryGetKeyReader",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Saga",
">",
"sagaClazz",
",",
"final",
"Object",
"message",
")",
"{",
"KeyReader",
"reader",
";",
"try",
"{",
"Optional",
"<",
"KeyReader",
">",
"cachedReader",
"=",
"knownReaders",
".",
"get",
"(",
"SagaMessageKey",
".",
"forMessage",
"(",
"sagaClazz",
",",
"message",
")",
",",
"(",
")",
"->",
"{",
"KeyReader",
"foundReader",
"=",
"findReader",
"(",
"sagaClazz",
",",
"message",
")",
";",
"return",
"Optional",
".",
"fromNullable",
"(",
"foundReader",
")",
";",
"}",
")",
";",
"reader",
"=",
"cachedReader",
".",
"orNull",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Error searching for reader to extract saga key. sagatype = {}, message = {}\"",
",",
"sagaClazz",
",",
"message",
",",
"ex",
")",
";",
"reader",
"=",
"null",
";",
"}",
"return",
"reader",
";",
"}"
] |
Does not throw an exception when accessing the loading cache for key readers.
|
[
"Does",
"not",
"throw",
"an",
"exception",
"when",
"accessing",
"the",
"loading",
"cache",
"for",
"key",
"readers",
"."
] |
c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef
|
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java#L71-L88
|
9,528
|
Domo42/saga-lib
|
saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java
|
SagaKeyReaderExtractor.findReaderMatchingExactType
|
private KeyReader findReaderMatchingExactType(final Iterable<KeyReader> readers, final Class<?> messageType) {
KeyReader messageKeyReader = null;
for (KeyReader reader : readers) {
if (reader.getMessageClass().equals(messageType)) {
messageKeyReader = reader;
break;
}
}
return messageKeyReader;
}
|
java
|
private KeyReader findReaderMatchingExactType(final Iterable<KeyReader> readers, final Class<?> messageType) {
KeyReader messageKeyReader = null;
for (KeyReader reader : readers) {
if (reader.getMessageClass().equals(messageType)) {
messageKeyReader = reader;
break;
}
}
return messageKeyReader;
}
|
[
"private",
"KeyReader",
"findReaderMatchingExactType",
"(",
"final",
"Iterable",
"<",
"KeyReader",
">",
"readers",
",",
"final",
"Class",
"<",
"?",
">",
"messageType",
")",
"{",
"KeyReader",
"messageKeyReader",
"=",
"null",
";",
"for",
"(",
"KeyReader",
"reader",
":",
"readers",
")",
"{",
"if",
"(",
"reader",
".",
"getMessageClass",
"(",
")",
".",
"equals",
"(",
"messageType",
")",
")",
"{",
"messageKeyReader",
"=",
"reader",
";",
"break",
";",
"}",
"}",
"return",
"messageKeyReader",
";",
"}"
] |
Search for reader based on message class.
|
[
"Search",
"for",
"reader",
"based",
"on",
"message",
"class",
"."
] |
c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef
|
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java#L111-L122
|
9,529
|
Domo42/saga-lib
|
saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java
|
SagaKeyReaderExtractor.findReader
|
private Collection<KeyReader> findReader(final Class<? extends Saga> sagaClazz, final Class<?> messageClazz) {
Saga saga = sagaProviderFactory.createProvider(sagaClazz).get();
Collection<KeyReader> readers = saga.keyReaders();
if (readers == null) {
// return empty list in case saga returns null for any reason
readers = new ArrayList<>();
}
return readers;
}
|
java
|
private Collection<KeyReader> findReader(final Class<? extends Saga> sagaClazz, final Class<?> messageClazz) {
Saga saga = sagaProviderFactory.createProvider(sagaClazz).get();
Collection<KeyReader> readers = saga.keyReaders();
if (readers == null) {
// return empty list in case saga returns null for any reason
readers = new ArrayList<>();
}
return readers;
}
|
[
"private",
"Collection",
"<",
"KeyReader",
">",
"findReader",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Saga",
">",
"sagaClazz",
",",
"final",
"Class",
"<",
"?",
">",
"messageClazz",
")",
"{",
"Saga",
"saga",
"=",
"sagaProviderFactory",
".",
"createProvider",
"(",
"sagaClazz",
")",
".",
"get",
"(",
")",
";",
"Collection",
"<",
"KeyReader",
">",
"readers",
"=",
"saga",
".",
"keyReaders",
"(",
")",
";",
"if",
"(",
"readers",
"==",
"null",
")",
"{",
"// return empty list in case saga returns null for any reason",
"readers",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"return",
"readers",
";",
"}"
] |
Search for a reader based on saga type.
|
[
"Search",
"for",
"a",
"reader",
"based",
"on",
"saga",
"type",
"."
] |
c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef
|
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java#L127-L136
|
9,530
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/common/destination/DestinationTools.java
|
DestinationTools.checkQueueName
|
public static void checkQueueName( String queueName ) throws JMSException
{
if (queueName == null)
throw new FFMQException("Queue name is not set","INVALID_DESTINATION_NAME");
if (queueName.length() > FFMQConstants.MAX_QUEUE_NAME_SIZE)
throw new FFMQException("Queue name '"+queueName+"' is too long ("+queueName.length()+" > "+FFMQConstants.MAX_QUEUE_NAME_SIZE+")","INVALID_DESTINATION_NAME");
checkDestinationName(queueName);
}
|
java
|
public static void checkQueueName( String queueName ) throws JMSException
{
if (queueName == null)
throw new FFMQException("Queue name is not set","INVALID_DESTINATION_NAME");
if (queueName.length() > FFMQConstants.MAX_QUEUE_NAME_SIZE)
throw new FFMQException("Queue name '"+queueName+"' is too long ("+queueName.length()+" > "+FFMQConstants.MAX_QUEUE_NAME_SIZE+")","INVALID_DESTINATION_NAME");
checkDestinationName(queueName);
}
|
[
"public",
"static",
"void",
"checkQueueName",
"(",
"String",
"queueName",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"queueName",
"==",
"null",
")",
"throw",
"new",
"FFMQException",
"(",
"\"Queue name is not set\"",
",",
"\"INVALID_DESTINATION_NAME\"",
")",
";",
"if",
"(",
"queueName",
".",
"length",
"(",
")",
">",
"FFMQConstants",
".",
"MAX_QUEUE_NAME_SIZE",
")",
"throw",
"new",
"FFMQException",
"(",
"\"Queue name '\"",
"+",
"queueName",
"+",
"\"' is too long (\"",
"+",
"queueName",
".",
"length",
"(",
")",
"+",
"\" > \"",
"+",
"FFMQConstants",
".",
"MAX_QUEUE_NAME_SIZE",
"+",
"\")\"",
",",
"\"INVALID_DESTINATION_NAME\"",
")",
";",
"checkDestinationName",
"(",
"queueName",
")",
";",
"}"
] |
Check the validity of a queue name
|
[
"Check",
"the",
"validity",
"of",
"a",
"queue",
"name"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/destination/DestinationTools.java#L112-L119
|
9,531
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/common/destination/DestinationTools.java
|
DestinationTools.checkTopicName
|
public static void checkTopicName( String topicName ) throws JMSException
{
if (topicName == null)
throw new FFMQException("Topic name is not set","INVALID_DESTINATION_NAME");
if (topicName.length() > FFMQConstants.MAX_TOPIC_NAME_SIZE)
throw new FFMQException("Topic name '"+topicName+"' is too long ("+topicName.length()+" > "+FFMQConstants.MAX_TOPIC_NAME_SIZE+")","INVALID_DESTINATION_NAME");
checkDestinationName(topicName);
}
|
java
|
public static void checkTopicName( String topicName ) throws JMSException
{
if (topicName == null)
throw new FFMQException("Topic name is not set","INVALID_DESTINATION_NAME");
if (topicName.length() > FFMQConstants.MAX_TOPIC_NAME_SIZE)
throw new FFMQException("Topic name '"+topicName+"' is too long ("+topicName.length()+" > "+FFMQConstants.MAX_TOPIC_NAME_SIZE+")","INVALID_DESTINATION_NAME");
checkDestinationName(topicName);
}
|
[
"public",
"static",
"void",
"checkTopicName",
"(",
"String",
"topicName",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"topicName",
"==",
"null",
")",
"throw",
"new",
"FFMQException",
"(",
"\"Topic name is not set\"",
",",
"\"INVALID_DESTINATION_NAME\"",
")",
";",
"if",
"(",
"topicName",
".",
"length",
"(",
")",
">",
"FFMQConstants",
".",
"MAX_TOPIC_NAME_SIZE",
")",
"throw",
"new",
"FFMQException",
"(",
"\"Topic name '\"",
"+",
"topicName",
"+",
"\"' is too long (\"",
"+",
"topicName",
".",
"length",
"(",
")",
"+",
"\" > \"",
"+",
"FFMQConstants",
".",
"MAX_TOPIC_NAME_SIZE",
"+",
"\")\"",
",",
"\"INVALID_DESTINATION_NAME\"",
")",
";",
"checkDestinationName",
"(",
"topicName",
")",
";",
"}"
] |
Check the validity of a topic name
|
[
"Check",
"the",
"validity",
"of",
"a",
"topic",
"name"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/destination/DestinationTools.java#L124-L131
|
9,532
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/AbstractJournalOperation.java
|
AbstractJournalOperation.writeTo
|
protected void writeTo( JournalFile journalFile ) throws JournalException
{
journalFile.writeByte(type);
journalFile.writeLong(transactionId);
}
|
java
|
protected void writeTo( JournalFile journalFile ) throws JournalException
{
journalFile.writeByte(type);
journalFile.writeLong(transactionId);
}
|
[
"protected",
"void",
"writeTo",
"(",
"JournalFile",
"journalFile",
")",
"throws",
"JournalException",
"{",
"journalFile",
".",
"writeByte",
"(",
"type",
")",
";",
"journalFile",
".",
"writeLong",
"(",
"transactionId",
")",
";",
"}"
] |
Write the operation to the given journal file
@param journalFile teh journal file
|
[
"Write",
"the",
"operation",
"to",
"the",
"given",
"journal",
"file"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/AbstractJournalOperation.java#L75-L79
|
9,533
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/utils/xml/XMLDescriptorReader.java
|
XMLDescriptorReader.read
|
public AbstractDescriptor read( File descriptorFile , Class<? extends AbstractXMLDescriptorHandler> handlerClass ) throws JMSException
{
if (!descriptorFile.canRead())
throw new FFMQException("Can't read descriptor file : "+descriptorFile.getAbsolutePath(),"FS_ERROR");
log.debug("Parsing descriptor : "+descriptorFile.getAbsolutePath());
AbstractXMLDescriptorHandler handler;
try
{
// Create an handler instance
handler = handlerClass.newInstance();
// Parse the descriptor file
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
FileInputStream in = new FileInputStream(descriptorFile);
parser.parse(in,handler);
in.close();
}
catch (Exception e)
{
throw new FFMQException("Cannot parse descriptor file : "+descriptorFile.getAbsolutePath(),"PARSE_ERROR",e);
}
AbstractDescriptor descriptor = handler.getDescriptor();
descriptor.setDescriptorFile(descriptorFile);
return descriptor;
}
|
java
|
public AbstractDescriptor read( File descriptorFile , Class<? extends AbstractXMLDescriptorHandler> handlerClass ) throws JMSException
{
if (!descriptorFile.canRead())
throw new FFMQException("Can't read descriptor file : "+descriptorFile.getAbsolutePath(),"FS_ERROR");
log.debug("Parsing descriptor : "+descriptorFile.getAbsolutePath());
AbstractXMLDescriptorHandler handler;
try
{
// Create an handler instance
handler = handlerClass.newInstance();
// Parse the descriptor file
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
FileInputStream in = new FileInputStream(descriptorFile);
parser.parse(in,handler);
in.close();
}
catch (Exception e)
{
throw new FFMQException("Cannot parse descriptor file : "+descriptorFile.getAbsolutePath(),"PARSE_ERROR",e);
}
AbstractDescriptor descriptor = handler.getDescriptor();
descriptor.setDescriptorFile(descriptorFile);
return descriptor;
}
|
[
"public",
"AbstractDescriptor",
"read",
"(",
"File",
"descriptorFile",
",",
"Class",
"<",
"?",
"extends",
"AbstractXMLDescriptorHandler",
">",
"handlerClass",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"!",
"descriptorFile",
".",
"canRead",
"(",
")",
")",
"throw",
"new",
"FFMQException",
"(",
"\"Can't read descriptor file : \"",
"+",
"descriptorFile",
".",
"getAbsolutePath",
"(",
")",
",",
"\"FS_ERROR\"",
")",
";",
"log",
".",
"debug",
"(",
"\"Parsing descriptor : \"",
"+",
"descriptorFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"AbstractXMLDescriptorHandler",
"handler",
";",
"try",
"{",
"// Create an handler instance",
"handler",
"=",
"handlerClass",
".",
"newInstance",
"(",
")",
";",
"// Parse the descriptor file",
"SAXParserFactory",
"factory",
"=",
"SAXParserFactory",
".",
"newInstance",
"(",
")",
";",
"SAXParser",
"parser",
"=",
"factory",
".",
"newSAXParser",
"(",
")",
";",
"FileInputStream",
"in",
"=",
"new",
"FileInputStream",
"(",
"descriptorFile",
")",
";",
"parser",
".",
"parse",
"(",
"in",
",",
"handler",
")",
";",
"in",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"FFMQException",
"(",
"\"Cannot parse descriptor file : \"",
"+",
"descriptorFile",
".",
"getAbsolutePath",
"(",
")",
",",
"\"PARSE_ERROR\"",
",",
"e",
")",
";",
"}",
"AbstractDescriptor",
"descriptor",
"=",
"handler",
".",
"getDescriptor",
"(",
")",
";",
"descriptor",
".",
"setDescriptorFile",
"(",
"descriptorFile",
")",
";",
"return",
"descriptor",
";",
"}"
] |
Read and parse an XML descriptor file
|
[
"Read",
"and",
"parse",
"an",
"XML",
"descriptor",
"file"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/xml/XMLDescriptorReader.java#L51-L80
|
9,534
|
Domo42/saga-lib
|
saga-lib/src/main/java/com/codebullets/sagalib/processing/invocation/ReflectionInvoker.java
|
ReflectionInvoker.tryGetMethod
|
private InvocationMethod tryGetMethod(final InvokerKey key) {
InvocationMethod invocationMethod = null;
try {
invocationMethod = invocationMethods.get(key);
} catch (Exception ex) {
LOG.warn("Error fetching method to invoke method {}", key, ex);
}
return invocationMethod;
}
|
java
|
private InvocationMethod tryGetMethod(final InvokerKey key) {
InvocationMethod invocationMethod = null;
try {
invocationMethod = invocationMethods.get(key);
} catch (Exception ex) {
LOG.warn("Error fetching method to invoke method {}", key, ex);
}
return invocationMethod;
}
|
[
"private",
"InvocationMethod",
"tryGetMethod",
"(",
"final",
"InvokerKey",
"key",
")",
"{",
"InvocationMethod",
"invocationMethod",
"=",
"null",
";",
"try",
"{",
"invocationMethod",
"=",
"invocationMethods",
".",
"get",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Error fetching method to invoke method {}\"",
",",
"key",
",",
"ex",
")",
";",
"}",
"return",
"invocationMethod",
";",
"}"
] |
Finds the method to invoke without causing an exception.
|
[
"Finds",
"the",
"method",
"to",
"invoke",
"without",
"causing",
"an",
"exception",
"."
] |
c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef
|
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/invocation/ReflectionInvoker.java#L82-L91
|
9,535
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/remote/session/RemoteMessageConsumer.java
|
RemoteMessageConsumer.remoteInit
|
protected void remoteInit() throws JMSException
{
CreateConsumerQuery query = new CreateConsumerQuery();
query.setConsumerId(id);
query.setSessionId(session.getId());
query.setDestination(destination);
query.setMessageSelector(messageSelector);
query.setNoLocal(noLocal);
transportEndpoint.blockingRequest(query);
}
|
java
|
protected void remoteInit() throws JMSException
{
CreateConsumerQuery query = new CreateConsumerQuery();
query.setConsumerId(id);
query.setSessionId(session.getId());
query.setDestination(destination);
query.setMessageSelector(messageSelector);
query.setNoLocal(noLocal);
transportEndpoint.blockingRequest(query);
}
|
[
"protected",
"void",
"remoteInit",
"(",
")",
"throws",
"JMSException",
"{",
"CreateConsumerQuery",
"query",
"=",
"new",
"CreateConsumerQuery",
"(",
")",
";",
"query",
".",
"setConsumerId",
"(",
"id",
")",
";",
"query",
".",
"setSessionId",
"(",
"session",
".",
"getId",
"(",
")",
")",
";",
"query",
".",
"setDestination",
"(",
"destination",
")",
";",
"query",
".",
"setMessageSelector",
"(",
"messageSelector",
")",
";",
"query",
".",
"setNoLocal",
"(",
"noLocal",
")",
";",
"transportEndpoint",
".",
"blockingRequest",
"(",
"query",
")",
";",
"}"
] |
Initialize the remote endpoint for this consumer
|
[
"Initialize",
"the",
"remote",
"endpoint",
"for",
"this",
"consumer"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/remote/session/RemoteMessageConsumer.java#L86-L95
|
9,536
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/remote/session/RemoteMessageConsumer.java
|
RemoteMessageConsumer.prefetchFromDestination
|
private void prefetchFromDestination() throws JMSException
{
// Lazy test, do not synchronize here but on response (see addToPrefetchQueue())
if (closed)
return;
if (traceEnabled)
log.trace("#"+id+" Prefetching more from destination "+destination);
// Ask for more
PrefetchQuery query = new PrefetchQuery();
query.setSessionId(session.getId());
query.setConsumerId(id);
transportEndpoint.nonBlockingRequest(query);
}
|
java
|
private void prefetchFromDestination() throws JMSException
{
// Lazy test, do not synchronize here but on response (see addToPrefetchQueue())
if (closed)
return;
if (traceEnabled)
log.trace("#"+id+" Prefetching more from destination "+destination);
// Ask for more
PrefetchQuery query = new PrefetchQuery();
query.setSessionId(session.getId());
query.setConsumerId(id);
transportEndpoint.nonBlockingRequest(query);
}
|
[
"private",
"void",
"prefetchFromDestination",
"(",
")",
"throws",
"JMSException",
"{",
"// Lazy test, do not synchronize here but on response (see addToPrefetchQueue())",
"if",
"(",
"closed",
")",
"return",
";",
"if",
"(",
"traceEnabled",
")",
"log",
".",
"trace",
"(",
"\"#\"",
"+",
"id",
"+",
"\" Prefetching more from destination \"",
"+",
"destination",
")",
";",
"// Ask for more",
"PrefetchQuery",
"query",
"=",
"new",
"PrefetchQuery",
"(",
")",
";",
"query",
".",
"setSessionId",
"(",
"session",
".",
"getId",
"(",
")",
")",
";",
"query",
".",
"setConsumerId",
"(",
"id",
")",
";",
"transportEndpoint",
".",
"nonBlockingRequest",
"(",
"query",
")",
";",
"}"
] |
Prefetch messages from destination
@throws JMSException
|
[
"Prefetch",
"messages",
"from",
"destination"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/remote/session/RemoteMessageConsumer.java#L277-L291
|
9,537
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/utils/SystemTools.java
|
SystemTools.replaceSystemProperties
|
public static String replaceSystemProperties( String value )
{
// Dumb case
if (value == null || value.length() == 0)
return value;
StringBuilder sb = new StringBuilder();
int pos = 0;
int start;
while ((start = value.indexOf("${",pos)) != -1)
{
if (start > pos)
sb.append(value.substring(pos,start));
int end = value.indexOf('}',start+2);
if (end == -1)
{
pos = start;
break;
}
String varName = value.substring(start+2,end);
String varValue = System.getProperty(varName,"${"+varName+"}");
sb.append(varValue);
pos = end+1;
}
// Append remaining
if (pos < value.length())
sb.append(value.substring(pos));
return sb.toString();
}
|
java
|
public static String replaceSystemProperties( String value )
{
// Dumb case
if (value == null || value.length() == 0)
return value;
StringBuilder sb = new StringBuilder();
int pos = 0;
int start;
while ((start = value.indexOf("${",pos)) != -1)
{
if (start > pos)
sb.append(value.substring(pos,start));
int end = value.indexOf('}',start+2);
if (end == -1)
{
pos = start;
break;
}
String varName = value.substring(start+2,end);
String varValue = System.getProperty(varName,"${"+varName+"}");
sb.append(varValue);
pos = end+1;
}
// Append remaining
if (pos < value.length())
sb.append(value.substring(pos));
return sb.toString();
}
|
[
"public",
"static",
"String",
"replaceSystemProperties",
"(",
"String",
"value",
")",
"{",
"// Dumb case",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"value",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"pos",
"=",
"0",
";",
"int",
"start",
";",
"while",
"(",
"(",
"start",
"=",
"value",
".",
"indexOf",
"(",
"\"${\"",
",",
"pos",
")",
")",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"start",
">",
"pos",
")",
"sb",
".",
"append",
"(",
"value",
".",
"substring",
"(",
"pos",
",",
"start",
")",
")",
";",
"int",
"end",
"=",
"value",
".",
"indexOf",
"(",
"'",
"'",
",",
"start",
"+",
"2",
")",
";",
"if",
"(",
"end",
"==",
"-",
"1",
")",
"{",
"pos",
"=",
"start",
";",
"break",
";",
"}",
"String",
"varName",
"=",
"value",
".",
"substring",
"(",
"start",
"+",
"2",
",",
"end",
")",
";",
"String",
"varValue",
"=",
"System",
".",
"getProperty",
"(",
"varName",
",",
"\"${\"",
"+",
"varName",
"+",
"\"}\"",
")",
";",
"sb",
".",
"append",
"(",
"varValue",
")",
";",
"pos",
"=",
"end",
"+",
"1",
";",
"}",
"// Append remaining",
"if",
"(",
"pos",
"<",
"value",
".",
"length",
"(",
")",
")",
"sb",
".",
"append",
"(",
"value",
".",
"substring",
"(",
"pos",
")",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Replace system properties in the given string value
@param value a string value
@return the expanded value
|
[
"Replace",
"system",
"properties",
"in",
"the",
"given",
"string",
"value"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/SystemTools.java#L31-L66
|
9,538
|
sbtourist/Journal.IO
|
src/main/java/journal/io/api/JournalBuilder.java
|
JournalBuilder.setArchived
|
public JournalBuilder setArchived(File to) {
if (!to.exists()) {
throw new IllegalArgumentException("<" + to + "> does not exist");
}
if (!to.isDirectory()) {
throw new IllegalArgumentException("<" + to + "> is not a directory");
}
this.directoryArchive = to;
return this;
}
|
java
|
public JournalBuilder setArchived(File to) {
if (!to.exists()) {
throw new IllegalArgumentException("<" + to + "> does not exist");
}
if (!to.isDirectory()) {
throw new IllegalArgumentException("<" + to + "> is not a directory");
}
this.directoryArchive = to;
return this;
}
|
[
"public",
"JournalBuilder",
"setArchived",
"(",
"File",
"to",
")",
"{",
"if",
"(",
"!",
"to",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"<\"",
"+",
"to",
"+",
"\"> does not exist\"",
")",
";",
"}",
"if",
"(",
"!",
"to",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"<\"",
"+",
"to",
"+",
"\"> is not a directory\"",
")",
";",
"}",
"this",
".",
"directoryArchive",
"=",
"to",
";",
"return",
"this",
";",
"}"
] |
Set the directory used to archive cleaned up log files, also enabling
archiving.
|
[
"Set",
"the",
"directory",
"used",
"to",
"archive",
"cleaned",
"up",
"log",
"files",
"also",
"enabling",
"archiving",
"."
] |
90cb13c822d5ecf6bcd3194c1bc2a11cec827626
|
https://github.com/sbtourist/Journal.IO/blob/90cb13c822d5ecf6bcd3194c1bc2a11cec827626/src/main/java/journal/io/api/JournalBuilder.java#L60-L69
|
9,539
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/transport/PacketTransportFactory.java
|
PacketTransportFactory.createPacketTransport
|
public PacketTransport createPacketTransport( String id , URI transportURI , Settings settings ) throws PacketTransportException
{
String protocol = transportURI.getScheme();
if (protocol == null)
protocol = PacketTransportType.TCP; // Default protocol
if (protocol.equals(PacketTransportType.TCP) ||
protocol.equals(PacketTransportType.TCPS))
{
return new TcpPacketTransport(id,transportURI,settings);
}
if (protocol.equals(PacketTransportType.TCPNIO))
{
return new NIOTcpPacketTransport(id,ClientEnvironment.getMultiplexer(),transportURI,settings);
}
throw new PacketTransportException("Unsupported transport protocol : "+protocol);
}
|
java
|
public PacketTransport createPacketTransport( String id , URI transportURI , Settings settings ) throws PacketTransportException
{
String protocol = transportURI.getScheme();
if (protocol == null)
protocol = PacketTransportType.TCP; // Default protocol
if (protocol.equals(PacketTransportType.TCP) ||
protocol.equals(PacketTransportType.TCPS))
{
return new TcpPacketTransport(id,transportURI,settings);
}
if (protocol.equals(PacketTransportType.TCPNIO))
{
return new NIOTcpPacketTransport(id,ClientEnvironment.getMultiplexer(),transportURI,settings);
}
throw new PacketTransportException("Unsupported transport protocol : "+protocol);
}
|
[
"public",
"PacketTransport",
"createPacketTransport",
"(",
"String",
"id",
",",
"URI",
"transportURI",
",",
"Settings",
"settings",
")",
"throws",
"PacketTransportException",
"{",
"String",
"protocol",
"=",
"transportURI",
".",
"getScheme",
"(",
")",
";",
"if",
"(",
"protocol",
"==",
"null",
")",
"protocol",
"=",
"PacketTransportType",
".",
"TCP",
";",
"// Default protocol",
"if",
"(",
"protocol",
".",
"equals",
"(",
"PacketTransportType",
".",
"TCP",
")",
"||",
"protocol",
".",
"equals",
"(",
"PacketTransportType",
".",
"TCPS",
")",
")",
"{",
"return",
"new",
"TcpPacketTransport",
"(",
"id",
",",
"transportURI",
",",
"settings",
")",
";",
"}",
"if",
"(",
"protocol",
".",
"equals",
"(",
"PacketTransportType",
".",
"TCPNIO",
")",
")",
"{",
"return",
"new",
"NIOTcpPacketTransport",
"(",
"id",
",",
"ClientEnvironment",
".",
"getMultiplexer",
"(",
")",
",",
"transportURI",
",",
"settings",
")",
";",
"}",
"throw",
"new",
"PacketTransportException",
"(",
"\"Unsupported transport protocol : \"",
"+",
"protocol",
")",
";",
"}"
] |
Create a packet transport instance to handle the given URI
|
[
"Create",
"a",
"packet",
"transport",
"instance",
"to",
"handle",
"the",
"given",
"URI"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/transport/PacketTransportFactory.java#L57-L75
|
9,540
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/utils/pool/ObjectPool.java
|
ObjectPool.borrow
|
public synchronized T borrow() throws JMSException
{
if (closed)
throw new ObjectPoolException("Object pool is closed");
// Object immediately available ?
int availableCount = available.size();
if (availableCount > 0)
return available.remove(availableCount-1);
// Can we create one more ?
if (all.size() < maxSize)
return extendPool();
// Pool is exhausted
switch (exhaustionPolicy)
{
case WHEN_EXHAUSTED_FAIL : throw new ObjectPoolException("Pool is exhausted (maxSize="+maxSize+")");
case WHEN_EXHAUSTED_BLOCK : return waitForAvailability();
case WHEN_EXHAUSTED_WAIT : return waitForAvailability(waitTimeout,true);
case WHEN_EXHAUSTED_RETURN_NULL : return null;
case WHEN_EXHAUSTED_WAIT_RETURN_NULL : return waitForAvailability(waitTimeout,false);
default:
throw new ObjectPoolException("Invalid exhaustion policy : "+exhaustionPolicy);
}
}
|
java
|
public synchronized T borrow() throws JMSException
{
if (closed)
throw new ObjectPoolException("Object pool is closed");
// Object immediately available ?
int availableCount = available.size();
if (availableCount > 0)
return available.remove(availableCount-1);
// Can we create one more ?
if (all.size() < maxSize)
return extendPool();
// Pool is exhausted
switch (exhaustionPolicy)
{
case WHEN_EXHAUSTED_FAIL : throw new ObjectPoolException("Pool is exhausted (maxSize="+maxSize+")");
case WHEN_EXHAUSTED_BLOCK : return waitForAvailability();
case WHEN_EXHAUSTED_WAIT : return waitForAvailability(waitTimeout,true);
case WHEN_EXHAUSTED_RETURN_NULL : return null;
case WHEN_EXHAUSTED_WAIT_RETURN_NULL : return waitForAvailability(waitTimeout,false);
default:
throw new ObjectPoolException("Invalid exhaustion policy : "+exhaustionPolicy);
}
}
|
[
"public",
"synchronized",
"T",
"borrow",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"closed",
")",
"throw",
"new",
"ObjectPoolException",
"(",
"\"Object pool is closed\"",
")",
";",
"// Object immediately available ?",
"int",
"availableCount",
"=",
"available",
".",
"size",
"(",
")",
";",
"if",
"(",
"availableCount",
">",
"0",
")",
"return",
"available",
".",
"remove",
"(",
"availableCount",
"-",
"1",
")",
";",
"// Can we create one more ?",
"if",
"(",
"all",
".",
"size",
"(",
")",
"<",
"maxSize",
")",
"return",
"extendPool",
"(",
")",
";",
"// Pool is exhausted",
"switch",
"(",
"exhaustionPolicy",
")",
"{",
"case",
"WHEN_EXHAUSTED_FAIL",
":",
"throw",
"new",
"ObjectPoolException",
"(",
"\"Pool is exhausted (maxSize=\"",
"+",
"maxSize",
"+",
"\")\"",
")",
";",
"case",
"WHEN_EXHAUSTED_BLOCK",
":",
"return",
"waitForAvailability",
"(",
")",
";",
"case",
"WHEN_EXHAUSTED_WAIT",
":",
"return",
"waitForAvailability",
"(",
"waitTimeout",
",",
"true",
")",
";",
"case",
"WHEN_EXHAUSTED_RETURN_NULL",
":",
"return",
"null",
";",
"case",
"WHEN_EXHAUSTED_WAIT_RETURN_NULL",
":",
"return",
"waitForAvailability",
"(",
"waitTimeout",
",",
"false",
")",
";",
"default",
":",
"throw",
"new",
"ObjectPoolException",
"(",
"\"Invalid exhaustion policy : \"",
"+",
"exhaustionPolicy",
")",
";",
"}",
"}"
] |
Borrow an object from the pool
@return a pooled object
|
[
"Borrow",
"an",
"object",
"from",
"the",
"pool"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/pool/ObjectPool.java#L113-L139
|
9,541
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/utils/pool/ObjectPool.java
|
ObjectPool.release
|
public synchronized void release( T poolObject )
{
if (closed)
return;
// Someone's waiting ?
if (pendingWaits > 0)
{
available.add(poolObject);
notifyAll();
}
else
{
// Pool is too large, destroy object
if (available.size() >= maxIdle)
{
all.remove(poolObject);
internalDestroyPoolObject(poolObject);
}
else
available.add(poolObject); // Recycle object
}
}
|
java
|
public synchronized void release( T poolObject )
{
if (closed)
return;
// Someone's waiting ?
if (pendingWaits > 0)
{
available.add(poolObject);
notifyAll();
}
else
{
// Pool is too large, destroy object
if (available.size() >= maxIdle)
{
all.remove(poolObject);
internalDestroyPoolObject(poolObject);
}
else
available.add(poolObject); // Recycle object
}
}
|
[
"public",
"synchronized",
"void",
"release",
"(",
"T",
"poolObject",
")",
"{",
"if",
"(",
"closed",
")",
"return",
";",
"// Someone's waiting ?",
"if",
"(",
"pendingWaits",
">",
"0",
")",
"{",
"available",
".",
"add",
"(",
"poolObject",
")",
";",
"notifyAll",
"(",
")",
";",
"}",
"else",
"{",
"// Pool is too large, destroy object",
"if",
"(",
"available",
".",
"size",
"(",
")",
">=",
"maxIdle",
")",
"{",
"all",
".",
"remove",
"(",
"poolObject",
")",
";",
"internalDestroyPoolObject",
"(",
"poolObject",
")",
";",
"}",
"else",
"available",
".",
"add",
"(",
"poolObject",
")",
";",
"// Recycle object",
"}",
"}"
] |
Return an object to the pool
@param poolObject a pooled object to be returned
|
[
"Return",
"an",
"object",
"to",
"the",
"pool"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/pool/ObjectPool.java#L225-L247
|
9,542
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/utils/pool/ObjectPool.java
|
ObjectPool.close
|
public void close()
{
synchronized (closeLock)
{
if (closed)
return;
closed = true;
}
synchronized (this)
{
Iterator<T> allObjects = all.iterator();
while (allObjects.hasNext())
{
T poolObject = allObjects.next();
internalDestroyPoolObject(poolObject);
}
all.clear();
available.clear();
// Unlock all waiting threads
notifyAll();
}
}
|
java
|
public void close()
{
synchronized (closeLock)
{
if (closed)
return;
closed = true;
}
synchronized (this)
{
Iterator<T> allObjects = all.iterator();
while (allObjects.hasNext())
{
T poolObject = allObjects.next();
internalDestroyPoolObject(poolObject);
}
all.clear();
available.clear();
// Unlock all waiting threads
notifyAll();
}
}
|
[
"public",
"void",
"close",
"(",
")",
"{",
"synchronized",
"(",
"closeLock",
")",
"{",
"if",
"(",
"closed",
")",
"return",
";",
"closed",
"=",
"true",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"Iterator",
"<",
"T",
">",
"allObjects",
"=",
"all",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"allObjects",
".",
"hasNext",
"(",
")",
")",
"{",
"T",
"poolObject",
"=",
"allObjects",
".",
"next",
"(",
")",
";",
"internalDestroyPoolObject",
"(",
"poolObject",
")",
";",
"}",
"all",
".",
"clear",
"(",
")",
";",
"available",
".",
"clear",
"(",
")",
";",
"// Unlock all waiting threads",
"notifyAll",
"(",
")",
";",
"}",
"}"
] |
Close the pool, destroying all objects
|
[
"Close",
"the",
"pool",
"destroying",
"all",
"objects"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/pool/ObjectPool.java#L283-L307
|
9,543
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/common/session/AbstractMessageConsumer.java
|
AbstractMessageConsumer.wakeUpMessageListener
|
public final void wakeUpMessageListener()
{
try
{
while (!closed)
{
synchronized (session.deliveryLock) // [JMS spec]
{
AbstractMessage message = receiveFromDestination(0,true);
if (message == null)
break;
// Make sure the message is properly deserialized
message.ensureDeserializationLevel(MessageSerializationLevel.FULL);
// Make sure the message's session is set
message.setSession(session);
// Call the message listener
boolean listenerFailed = false;
try
{
messageListener.onMessage(message);
}
catch (Throwable e)
{
listenerFailed = true;
if (shouldLogListenersFailures())
log.error("Message listener failed",e);
}
// Auto acknowledge message
if (autoAcknowledge)
{
if (listenerFailed)
session.recover();
else
session.acknowledge();
}
}
}
}
catch (JMSException e)
{
ErrorTools.log(e, log);
}
}
|
java
|
public final void wakeUpMessageListener()
{
try
{
while (!closed)
{
synchronized (session.deliveryLock) // [JMS spec]
{
AbstractMessage message = receiveFromDestination(0,true);
if (message == null)
break;
// Make sure the message is properly deserialized
message.ensureDeserializationLevel(MessageSerializationLevel.FULL);
// Make sure the message's session is set
message.setSession(session);
// Call the message listener
boolean listenerFailed = false;
try
{
messageListener.onMessage(message);
}
catch (Throwable e)
{
listenerFailed = true;
if (shouldLogListenersFailures())
log.error("Message listener failed",e);
}
// Auto acknowledge message
if (autoAcknowledge)
{
if (listenerFailed)
session.recover();
else
session.acknowledge();
}
}
}
}
catch (JMSException e)
{
ErrorTools.log(e, log);
}
}
|
[
"public",
"final",
"void",
"wakeUpMessageListener",
"(",
")",
"{",
"try",
"{",
"while",
"(",
"!",
"closed",
")",
"{",
"synchronized",
"(",
"session",
".",
"deliveryLock",
")",
"// [JMS spec]",
"{",
"AbstractMessage",
"message",
"=",
"receiveFromDestination",
"(",
"0",
",",
"true",
")",
";",
"if",
"(",
"message",
"==",
"null",
")",
"break",
";",
"// Make sure the message is properly deserialized",
"message",
".",
"ensureDeserializationLevel",
"(",
"MessageSerializationLevel",
".",
"FULL",
")",
";",
"// Make sure the message's session is set",
"message",
".",
"setSession",
"(",
"session",
")",
";",
"// Call the message listener",
"boolean",
"listenerFailed",
"=",
"false",
";",
"try",
"{",
"messageListener",
".",
"onMessage",
"(",
"message",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"listenerFailed",
"=",
"true",
";",
"if",
"(",
"shouldLogListenersFailures",
"(",
")",
")",
"log",
".",
"error",
"(",
"\"Message listener failed\"",
",",
"e",
")",
";",
"}",
"// Auto acknowledge message",
"if",
"(",
"autoAcknowledge",
")",
"{",
"if",
"(",
"listenerFailed",
")",
"session",
".",
"recover",
"(",
")",
";",
"else",
"session",
".",
"acknowledge",
"(",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"JMSException",
"e",
")",
"{",
"ErrorTools",
".",
"log",
"(",
"e",
",",
"log",
")",
";",
"}",
"}"
] |
Wake up the consumer message listener
|
[
"Wake",
"up",
"the",
"consumer",
"message",
"listener"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/session/AbstractMessageConsumer.java#L188-L234
|
9,544
|
Domo42/saga-lib
|
saga-lib/src/main/java/com/codebullets/sagalib/KeyReaders.java
|
KeyReaders.forMessage
|
public static <MESSAGE, KEY> KeyReader<MESSAGE, KEY> forMessage(
final Class<MESSAGE> messageClass,
final KeyExtractFunction<MESSAGE, KEY> extractFunction) {
return FunctionKeyReader.create(messageClass, extractFunction);
}
|
java
|
public static <MESSAGE, KEY> KeyReader<MESSAGE, KEY> forMessage(
final Class<MESSAGE> messageClass,
final KeyExtractFunction<MESSAGE, KEY> extractFunction) {
return FunctionKeyReader.create(messageClass, extractFunction);
}
|
[
"public",
"static",
"<",
"MESSAGE",
",",
"KEY",
">",
"KeyReader",
"<",
"MESSAGE",
",",
"KEY",
">",
"forMessage",
"(",
"final",
"Class",
"<",
"MESSAGE",
">",
"messageClass",
",",
"final",
"KeyExtractFunction",
"<",
"MESSAGE",
",",
"KEY",
">",
"extractFunction",
")",
"{",
"return",
"FunctionKeyReader",
".",
"create",
"(",
"messageClass",
",",
"extractFunction",
")",
";",
"}"
] |
Create a new key reader for a specific message class.
@param messageClass The class of the message for which a key reader is to be created.
@param extractFunction The function to use to extract a saga instance key from a message.
@param <MESSAGE> The type of the message this reader is for.
@param <KEY> The type of the key to be extracted.
@return Returns a new key reader instance.
|
[
"Create",
"a",
"new",
"key",
"reader",
"for",
"a",
"specific",
"message",
"class",
"."
] |
c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef
|
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/KeyReaders.java#L32-L36
|
9,545
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/local/session/LocalSession.java
|
LocalSession.dispatch
|
public final void dispatch( AbstractMessage message ) throws JMSException
{
// Security
LocalConnection conn = (LocalConnection)getConnection();
if (conn.isSecurityEnabled())
{
Destination destination = message.getJMSDestination();
if (destination instanceof Queue)
{
String queueName = ((Queue)destination).getQueueName();
if (conn.isRegisteredTemporaryQueue(queueName))
{
// OK, temporary destination
}
else
if (queueName.equals(FFMQConstants.ADM_REQUEST_QUEUE))
{
conn.checkPermission(Resource.SERVER, Action.REMOTE_ADMIN);
}
else
if (queueName.equals(FFMQConstants.ADM_REPLY_QUEUE))
{
// Only the internal admin thread can produce on this queue
if (conn.getSecurityContext() != null)
throw new FFMQException("Access denied to administration queue "+queueName,"ACCESS_DENIED");
}
else
{
// Standard queue
conn.checkPermission(destination,Action.PRODUCE);
}
}
else
if (destination instanceof Topic)
{
String topicName = ((Topic)destination).getTopicName();
if (conn.isRegisteredTemporaryTopic(topicName))
{
// OK, temporary destination
}
else
{
// Standard topic
conn.checkPermission(destination,Action.PRODUCE);
}
}
else
throw new InvalidDestinationException("Unsupported destination : "+destination);
}
if (debugEnabled)
log.debug(this+" [PUT] in "+message.getJMSDestination()+" - "+message);
externalAccessLock.readLock().lock();
try
{
checkNotClosed();
pendingPuts.add(message);
if (!transacted)
commitUpdates(false, null, true); // FIXME Async commit ?
}
finally
{
externalAccessLock.readLock().unlock();
}
}
|
java
|
public final void dispatch( AbstractMessage message ) throws JMSException
{
// Security
LocalConnection conn = (LocalConnection)getConnection();
if (conn.isSecurityEnabled())
{
Destination destination = message.getJMSDestination();
if (destination instanceof Queue)
{
String queueName = ((Queue)destination).getQueueName();
if (conn.isRegisteredTemporaryQueue(queueName))
{
// OK, temporary destination
}
else
if (queueName.equals(FFMQConstants.ADM_REQUEST_QUEUE))
{
conn.checkPermission(Resource.SERVER, Action.REMOTE_ADMIN);
}
else
if (queueName.equals(FFMQConstants.ADM_REPLY_QUEUE))
{
// Only the internal admin thread can produce on this queue
if (conn.getSecurityContext() != null)
throw new FFMQException("Access denied to administration queue "+queueName,"ACCESS_DENIED");
}
else
{
// Standard queue
conn.checkPermission(destination,Action.PRODUCE);
}
}
else
if (destination instanceof Topic)
{
String topicName = ((Topic)destination).getTopicName();
if (conn.isRegisteredTemporaryTopic(topicName))
{
// OK, temporary destination
}
else
{
// Standard topic
conn.checkPermission(destination,Action.PRODUCE);
}
}
else
throw new InvalidDestinationException("Unsupported destination : "+destination);
}
if (debugEnabled)
log.debug(this+" [PUT] in "+message.getJMSDestination()+" - "+message);
externalAccessLock.readLock().lock();
try
{
checkNotClosed();
pendingPuts.add(message);
if (!transacted)
commitUpdates(false, null, true); // FIXME Async commit ?
}
finally
{
externalAccessLock.readLock().unlock();
}
}
|
[
"public",
"final",
"void",
"dispatch",
"(",
"AbstractMessage",
"message",
")",
"throws",
"JMSException",
"{",
"// Security",
"LocalConnection",
"conn",
"=",
"(",
"LocalConnection",
")",
"getConnection",
"(",
")",
";",
"if",
"(",
"conn",
".",
"isSecurityEnabled",
"(",
")",
")",
"{",
"Destination",
"destination",
"=",
"message",
".",
"getJMSDestination",
"(",
")",
";",
"if",
"(",
"destination",
"instanceof",
"Queue",
")",
"{",
"String",
"queueName",
"=",
"(",
"(",
"Queue",
")",
"destination",
")",
".",
"getQueueName",
"(",
")",
";",
"if",
"(",
"conn",
".",
"isRegisteredTemporaryQueue",
"(",
"queueName",
")",
")",
"{",
"// OK, temporary destination",
"}",
"else",
"if",
"(",
"queueName",
".",
"equals",
"(",
"FFMQConstants",
".",
"ADM_REQUEST_QUEUE",
")",
")",
"{",
"conn",
".",
"checkPermission",
"(",
"Resource",
".",
"SERVER",
",",
"Action",
".",
"REMOTE_ADMIN",
")",
";",
"}",
"else",
"if",
"(",
"queueName",
".",
"equals",
"(",
"FFMQConstants",
".",
"ADM_REPLY_QUEUE",
")",
")",
"{",
"// Only the internal admin thread can produce on this queue",
"if",
"(",
"conn",
".",
"getSecurityContext",
"(",
")",
"!=",
"null",
")",
"throw",
"new",
"FFMQException",
"(",
"\"Access denied to administration queue \"",
"+",
"queueName",
",",
"\"ACCESS_DENIED\"",
")",
";",
"}",
"else",
"{",
"// Standard queue",
"conn",
".",
"checkPermission",
"(",
"destination",
",",
"Action",
".",
"PRODUCE",
")",
";",
"}",
"}",
"else",
"if",
"(",
"destination",
"instanceof",
"Topic",
")",
"{",
"String",
"topicName",
"=",
"(",
"(",
"Topic",
")",
"destination",
")",
".",
"getTopicName",
"(",
")",
";",
"if",
"(",
"conn",
".",
"isRegisteredTemporaryTopic",
"(",
"topicName",
")",
")",
"{",
"// OK, temporary destination",
"}",
"else",
"{",
"// Standard topic",
"conn",
".",
"checkPermission",
"(",
"destination",
",",
"Action",
".",
"PRODUCE",
")",
";",
"}",
"}",
"else",
"throw",
"new",
"InvalidDestinationException",
"(",
"\"Unsupported destination : \"",
"+",
"destination",
")",
";",
"}",
"if",
"(",
"debugEnabled",
")",
"log",
".",
"debug",
"(",
"this",
"+",
"\" [PUT] in \"",
"+",
"message",
".",
"getJMSDestination",
"(",
")",
"+",
"\" - \"",
"+",
"message",
")",
";",
"externalAccessLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"checkNotClosed",
"(",
")",
";",
"pendingPuts",
".",
"add",
"(",
"message",
")",
";",
"if",
"(",
"!",
"transacted",
")",
"commitUpdates",
"(",
"false",
",",
"null",
",",
"true",
")",
";",
"// FIXME Async commit ?",
"}",
"finally",
"{",
"externalAccessLock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Called from producers when sending a message
@param message message to dispatch
@throws JMSException
|
[
"Called",
"from",
"producers",
"when",
"sending",
"a",
"message"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/session/LocalSession.java#L122-L189
|
9,546
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/local/session/LocalSession.java
|
LocalSession.rollbackUndelivered
|
public final void rollbackUndelivered( List<String> undeliveredMessageIDs ) throws JMSException
{
externalAccessLock.readLock().lock();
try
{
checkNotClosed();
rollbackUpdates(false,true, undeliveredMessageIDs);
}
finally
{
externalAccessLock.readLock().unlock();
}
}
|
java
|
public final void rollbackUndelivered( List<String> undeliveredMessageIDs ) throws JMSException
{
externalAccessLock.readLock().lock();
try
{
checkNotClosed();
rollbackUpdates(false,true, undeliveredMessageIDs);
}
finally
{
externalAccessLock.readLock().unlock();
}
}
|
[
"public",
"final",
"void",
"rollbackUndelivered",
"(",
"List",
"<",
"String",
">",
"undeliveredMessageIDs",
")",
"throws",
"JMSException",
"{",
"externalAccessLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"checkNotClosed",
"(",
")",
";",
"rollbackUpdates",
"(",
"false",
",",
"true",
",",
"undeliveredMessageIDs",
")",
";",
"}",
"finally",
"{",
"externalAccessLock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Rollback undelivered get operations in this session
@param undeliveredMessageIDs
@throws JMSException
|
[
"Rollback",
"undelivered",
"get",
"operations",
"in",
"this",
"session"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/session/LocalSession.java#L261-L273
|
9,547
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/local/session/LocalSession.java
|
LocalSession.createConsumer
|
public MessageConsumer createConsumer(IntegerID consumerId,Destination destination, String messageSelector, boolean noLocal) throws JMSException
{
externalAccessLock.readLock().lock();
try
{
checkNotClosed();
LocalMessageConsumer consumer = new LocalMessageConsumer(engine,this,destination,messageSelector,noLocal,consumerId,null);
registerConsumer(consumer);
consumer.initDestination();
return consumer;
}
finally
{
externalAccessLock.readLock().unlock();
}
}
|
java
|
public MessageConsumer createConsumer(IntegerID consumerId,Destination destination, String messageSelector, boolean noLocal) throws JMSException
{
externalAccessLock.readLock().lock();
try
{
checkNotClosed();
LocalMessageConsumer consumer = new LocalMessageConsumer(engine,this,destination,messageSelector,noLocal,consumerId,null);
registerConsumer(consumer);
consumer.initDestination();
return consumer;
}
finally
{
externalAccessLock.readLock().unlock();
}
}
|
[
"public",
"MessageConsumer",
"createConsumer",
"(",
"IntegerID",
"consumerId",
",",
"Destination",
"destination",
",",
"String",
"messageSelector",
",",
"boolean",
"noLocal",
")",
"throws",
"JMSException",
"{",
"externalAccessLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"checkNotClosed",
"(",
")",
";",
"LocalMessageConsumer",
"consumer",
"=",
"new",
"LocalMessageConsumer",
"(",
"engine",
",",
"this",
",",
"destination",
",",
"messageSelector",
",",
"noLocal",
",",
"consumerId",
",",
"null",
")",
";",
"registerConsumer",
"(",
"consumer",
")",
";",
"consumer",
".",
"initDestination",
"(",
")",
";",
"return",
"consumer",
";",
"}",
"finally",
"{",
"externalAccessLock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Create a consumer with the given id
|
[
"Create",
"a",
"consumer",
"with",
"the",
"given",
"id"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/session/LocalSession.java#L670-L685
|
9,548
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/local/session/LocalSession.java
|
LocalSession.deleteQueue
|
protected final void deleteQueue( String queueName ) throws JMSException
{
transactionSet.removeUpdatesForQueue(queueName);
engine.deleteQueue(queueName);
}
|
java
|
protected final void deleteQueue( String queueName ) throws JMSException
{
transactionSet.removeUpdatesForQueue(queueName);
engine.deleteQueue(queueName);
}
|
[
"protected",
"final",
"void",
"deleteQueue",
"(",
"String",
"queueName",
")",
"throws",
"JMSException",
"{",
"transactionSet",
".",
"removeUpdatesForQueue",
"(",
"queueName",
")",
";",
"engine",
".",
"deleteQueue",
"(",
"queueName",
")",
";",
"}"
] |
Delete a queue
@param queueName
@throws JMSException
|
[
"Delete",
"a",
"queue"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/session/LocalSession.java#L876-L880
|
9,549
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/local/connection/ClientIDRegistry.java
|
ClientIDRegistry.register
|
public synchronized void register( String clientID ) throws InvalidClientIDException
{
if (!clientIDs.add(clientID))
{
log.error("Client ID already exists : "+clientID);
throw new InvalidClientIDException("Client ID already exists : "+clientID);
}
log.debug("Registered clientID : "+clientID);
}
|
java
|
public synchronized void register( String clientID ) throws InvalidClientIDException
{
if (!clientIDs.add(clientID))
{
log.error("Client ID already exists : "+clientID);
throw new InvalidClientIDException("Client ID already exists : "+clientID);
}
log.debug("Registered clientID : "+clientID);
}
|
[
"public",
"synchronized",
"void",
"register",
"(",
"String",
"clientID",
")",
"throws",
"InvalidClientIDException",
"{",
"if",
"(",
"!",
"clientIDs",
".",
"add",
"(",
"clientID",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"Client ID already exists : \"",
"+",
"clientID",
")",
";",
"throw",
"new",
"InvalidClientIDException",
"(",
"\"Client ID already exists : \"",
"+",
"clientID",
")",
";",
"}",
"log",
".",
"debug",
"(",
"\"Registered clientID : \"",
"+",
"clientID",
")",
";",
"}"
] |
Register a new client ID
|
[
"Register",
"a",
"new",
"client",
"ID"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/connection/ClientIDRegistry.java#L64-L72
|
9,550
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalFile.java
|
JournalFile.sync
|
protected void sync() throws JournalException
{
try
{
flushBuffer();
switch (storageSyncMethod)
{
case StorageSyncMethod.FD_SYNC : output.getFD().sync(); break;
case StorageSyncMethod.CHANNEL_FORCE_NO_META : channel.force(false); break;
default:
throw new JournalException("Unsupported sync method : "+storageSyncMethod);
}
}
catch (IOException e)
{
log.error("["+baseName+"] Cannot create sync journal file : "+file.getAbsolutePath(),e);
throw new JournalException("Could not sync journal file : "+file.getAbsolutePath(),e);
}
}
|
java
|
protected void sync() throws JournalException
{
try
{
flushBuffer();
switch (storageSyncMethod)
{
case StorageSyncMethod.FD_SYNC : output.getFD().sync(); break;
case StorageSyncMethod.CHANNEL_FORCE_NO_META : channel.force(false); break;
default:
throw new JournalException("Unsupported sync method : "+storageSyncMethod);
}
}
catch (IOException e)
{
log.error("["+baseName+"] Cannot create sync journal file : "+file.getAbsolutePath(),e);
throw new JournalException("Could not sync journal file : "+file.getAbsolutePath(),e);
}
}
|
[
"protected",
"void",
"sync",
"(",
")",
"throws",
"JournalException",
"{",
"try",
"{",
"flushBuffer",
"(",
")",
";",
"switch",
"(",
"storageSyncMethod",
")",
"{",
"case",
"StorageSyncMethod",
".",
"FD_SYNC",
":",
"output",
".",
"getFD",
"(",
")",
".",
"sync",
"(",
")",
";",
"break",
";",
"case",
"StorageSyncMethod",
".",
"CHANNEL_FORCE_NO_META",
":",
"channel",
".",
"force",
"(",
"false",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"JournalException",
"(",
"\"Unsupported sync method : \"",
"+",
"storageSyncMethod",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"[\"",
"+",
"baseName",
"+",
"\"] Cannot create sync journal file : \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
",",
"e",
")",
";",
"throw",
"new",
"JournalException",
"(",
"\"Could not sync journal file : \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] |
Force file content sync to disk
@throws JournalException
|
[
"Force",
"file",
"content",
"sync",
"to",
"disk"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalFile.java#L139-L158
|
9,551
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalFile.java
|
JournalFile.closeAndDelete
|
public void closeAndDelete() throws JournalException
{
close();
if (!file.delete())
if (file.exists())
throw new JournalException("Cannot delete journal file : "+file.getAbsolutePath());
}
|
java
|
public void closeAndDelete() throws JournalException
{
close();
if (!file.delete())
if (file.exists())
throw new JournalException("Cannot delete journal file : "+file.getAbsolutePath());
}
|
[
"public",
"void",
"closeAndDelete",
"(",
")",
"throws",
"JournalException",
"{",
"close",
"(",
")",
";",
"if",
"(",
"!",
"file",
".",
"delete",
"(",
")",
")",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"JournalException",
"(",
"\"Cannot delete journal file : \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}"
] |
Close and delete the journal file
|
[
"Close",
"and",
"delete",
"the",
"journal",
"file"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalFile.java#L312-L318
|
9,552
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalFile.java
|
JournalFile.closeAndRecycle
|
public File closeAndRecycle() throws JournalException
{
File recycledFile = new File(file.getAbsolutePath()+RECYCLED_SUFFIX);
if (!file.renameTo(recycledFile))
throw new JournalException("Cannot rename journal file "+file.getAbsolutePath()+" to "+recycledFile.getAbsolutePath());
try
{
fillWithZeroes(recycledFile.length(), writeBuffer.length);
}
catch (IOException e)
{
throw new JournalException("Cannot clear journal file : "+recycledFile.getAbsolutePath(),e);
}
sync();
close();
return recycledFile;
}
|
java
|
public File closeAndRecycle() throws JournalException
{
File recycledFile = new File(file.getAbsolutePath()+RECYCLED_SUFFIX);
if (!file.renameTo(recycledFile))
throw new JournalException("Cannot rename journal file "+file.getAbsolutePath()+" to "+recycledFile.getAbsolutePath());
try
{
fillWithZeroes(recycledFile.length(), writeBuffer.length);
}
catch (IOException e)
{
throw new JournalException("Cannot clear journal file : "+recycledFile.getAbsolutePath(),e);
}
sync();
close();
return recycledFile;
}
|
[
"public",
"File",
"closeAndRecycle",
"(",
")",
"throws",
"JournalException",
"{",
"File",
"recycledFile",
"=",
"new",
"File",
"(",
"file",
".",
"getAbsolutePath",
"(",
")",
"+",
"RECYCLED_SUFFIX",
")",
";",
"if",
"(",
"!",
"file",
".",
"renameTo",
"(",
"recycledFile",
")",
")",
"throw",
"new",
"JournalException",
"(",
"\"Cannot rename journal file \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" to \"",
"+",
"recycledFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"try",
"{",
"fillWithZeroes",
"(",
"recycledFile",
".",
"length",
"(",
")",
",",
"writeBuffer",
".",
"length",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"JournalException",
"(",
"\"Cannot clear journal file : \"",
"+",
"recycledFile",
".",
"getAbsolutePath",
"(",
")",
",",
"e",
")",
";",
"}",
"sync",
"(",
")",
";",
"close",
"(",
")",
";",
"return",
"recycledFile",
";",
"}"
] |
Close and recycle the journal file
|
[
"Close",
"and",
"recycle",
"the",
"journal",
"file"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalFile.java#L323-L342
|
9,553
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/client/ClientEnvironment.java
|
ClientEnvironment.getMultiplexer
|
public static synchronized NIOTcpMultiplexer getMultiplexer() throws PacketTransportException
{
if (multiplexer == null)
multiplexer = new NIOTcpMultiplexer(getSettings(),true);
return multiplexer;
}
|
java
|
public static synchronized NIOTcpMultiplexer getMultiplexer() throws PacketTransportException
{
if (multiplexer == null)
multiplexer = new NIOTcpMultiplexer(getSettings(),true);
return multiplexer;
}
|
[
"public",
"static",
"synchronized",
"NIOTcpMultiplexer",
"getMultiplexer",
"(",
")",
"throws",
"PacketTransportException",
"{",
"if",
"(",
"multiplexer",
"==",
"null",
")",
"multiplexer",
"=",
"new",
"NIOTcpMultiplexer",
"(",
"getSettings",
"(",
")",
",",
"true",
")",
";",
"return",
"multiplexer",
";",
"}"
] |
Get the multiplexer singleton instance
@return the multiplexer singleton instance
|
[
"Get",
"the",
"multiplexer",
"singleton",
"instance"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/client/ClientEnvironment.java#L94-L99
|
9,554
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/client/ClientEnvironment.java
|
ClientEnvironment.getAsyncTaskManager
|
public static synchronized AsyncTaskManager getAsyncTaskManager() throws JMSException
{
if (asyncTaskManager == null)
{
int threadPoolMinSize = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MINSIZE,0);
int threadPoolMaxIdle = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXIDLE,5);
int threadPoolMaxSize = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXSIZE,10);
asyncTaskManager = new AsyncTaskManager("AsyncTaskManager-client-delivery",
threadPoolMinSize,
threadPoolMaxIdle,
threadPoolMaxSize);
}
return asyncTaskManager;
}
|
java
|
public static synchronized AsyncTaskManager getAsyncTaskManager() throws JMSException
{
if (asyncTaskManager == null)
{
int threadPoolMinSize = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MINSIZE,0);
int threadPoolMaxIdle = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXIDLE,5);
int threadPoolMaxSize = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXSIZE,10);
asyncTaskManager = new AsyncTaskManager("AsyncTaskManager-client-delivery",
threadPoolMinSize,
threadPoolMaxIdle,
threadPoolMaxSize);
}
return asyncTaskManager;
}
|
[
"public",
"static",
"synchronized",
"AsyncTaskManager",
"getAsyncTaskManager",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"asyncTaskManager",
"==",
"null",
")",
"{",
"int",
"threadPoolMinSize",
"=",
"getSettings",
"(",
")",
".",
"getIntProperty",
"(",
"FFMQCoreSettings",
".",
"ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MINSIZE",
",",
"0",
")",
";",
"int",
"threadPoolMaxIdle",
"=",
"getSettings",
"(",
")",
".",
"getIntProperty",
"(",
"FFMQCoreSettings",
".",
"ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXIDLE",
",",
"5",
")",
";",
"int",
"threadPoolMaxSize",
"=",
"getSettings",
"(",
")",
".",
"getIntProperty",
"(",
"FFMQCoreSettings",
".",
"ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXSIZE",
",",
"10",
")",
";",
"asyncTaskManager",
"=",
"new",
"AsyncTaskManager",
"(",
"\"AsyncTaskManager-client-delivery\"",
",",
"threadPoolMinSize",
",",
"threadPoolMaxIdle",
",",
"threadPoolMaxSize",
")",
";",
"}",
"return",
"asyncTaskManager",
";",
"}"
] |
Get the async. task manager singleton instance
@return the manager instance
@throws JMSException
|
[
"Get",
"the",
"async",
".",
"task",
"manager",
"singleton",
"instance"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/client/ClientEnvironment.java#L106-L119
|
9,555
|
timewalker74/ffmq
|
core/src/main/java/net/timewalker/ffmq4/local/destination/LocalTopic.java
|
LocalTopic.unsubscribe
|
public void unsubscribe( String clientID , String subscriptionName ) throws JMSException
{
String subscriberID = clientID+"-"+subscriptionName;
subscriptionsLock.writeLock().lock();
try
{
LocalTopicSubscription subscription = subscriptionMap.get(subscriberID);
if (subscription == null)
return;
if (isConsumerRegistered(subscriberID))
throw new FFMQException("Subscription "+subscriptionName+" is still in use","SUBSCRIPTION_STILL_IN_USE");
subscriptionMap.remove(subscriberID);
removeSubscription(subscription);
}
finally
{
subscriptionsLock.writeLock().unlock();
}
}
|
java
|
public void unsubscribe( String clientID , String subscriptionName ) throws JMSException
{
String subscriberID = clientID+"-"+subscriptionName;
subscriptionsLock.writeLock().lock();
try
{
LocalTopicSubscription subscription = subscriptionMap.get(subscriberID);
if (subscription == null)
return;
if (isConsumerRegistered(subscriberID))
throw new FFMQException("Subscription "+subscriptionName+" is still in use","SUBSCRIPTION_STILL_IN_USE");
subscriptionMap.remove(subscriberID);
removeSubscription(subscription);
}
finally
{
subscriptionsLock.writeLock().unlock();
}
}
|
[
"public",
"void",
"unsubscribe",
"(",
"String",
"clientID",
",",
"String",
"subscriptionName",
")",
"throws",
"JMSException",
"{",
"String",
"subscriberID",
"=",
"clientID",
"+",
"\"-\"",
"+",
"subscriptionName",
";",
"subscriptionsLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"LocalTopicSubscription",
"subscription",
"=",
"subscriptionMap",
".",
"get",
"(",
"subscriberID",
")",
";",
"if",
"(",
"subscription",
"==",
"null",
")",
"return",
";",
"if",
"(",
"isConsumerRegistered",
"(",
"subscriberID",
")",
")",
"throw",
"new",
"FFMQException",
"(",
"\"Subscription \"",
"+",
"subscriptionName",
"+",
"\" is still in use\"",
",",
"\"SUBSCRIPTION_STILL_IN_USE\"",
")",
";",
"subscriptionMap",
".",
"remove",
"(",
"subscriberID",
")",
";",
"removeSubscription",
"(",
"subscription",
")",
";",
"}",
"finally",
"{",
"subscriptionsLock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Unsubscribe all durable consumers for a given client ID and subscription name
|
[
"Unsubscribe",
"all",
"durable",
"consumers",
"for",
"a",
"given",
"client",
"ID",
"and",
"subscription",
"name"
] |
638773ee29a4a5f9c6119ed74ad14ac9c46382b3
|
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/LocalTopic.java#L239-L260
|
9,556
|
upwork/java-upwork
|
src/com/Upwork/api/UpworkRestClient.java
|
UpworkRestClient.getJSONObject
|
public static JSONObject getJSONObject(HttpPost request, Integer method, HashMap<String, String> params) throws JSONException {
switch (method) {
case METHOD_PUT:
case METHOD_DELETE:
case METHOD_POST:
return doPostRequest(request, params);
default:
throw new RuntimeException("Wrong http method requested");
}
}
|
java
|
public static JSONObject getJSONObject(HttpPost request, Integer method, HashMap<String, String> params) throws JSONException {
switch (method) {
case METHOD_PUT:
case METHOD_DELETE:
case METHOD_POST:
return doPostRequest(request, params);
default:
throw new RuntimeException("Wrong http method requested");
}
}
|
[
"public",
"static",
"JSONObject",
"getJSONObject",
"(",
"HttpPost",
"request",
",",
"Integer",
"method",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"switch",
"(",
"method",
")",
"{",
"case",
"METHOD_PUT",
":",
"case",
"METHOD_DELETE",
":",
"case",
"METHOD_POST",
":",
"return",
"doPostRequest",
"(",
"request",
",",
"params",
")",
";",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Wrong http method requested\"",
")",
";",
"}",
"}"
] |
Get JSON response for POST
@param request Request object for POST
@param method HTTP method
@param params POST parameters
@throws JSONException
@return {@link JSONObject}
|
[
"Get",
"JSON",
"response",
"for",
"POST"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/UpworkRestClient.java#L105-L114
|
9,557
|
upwork/java-upwork
|
src/com/Upwork/api/UpworkRestClient.java
|
UpworkRestClient.doPostRequest
|
private static JSONObject doPostRequest(HttpPost httpPost, HashMap<String, String> params) throws JSONException {
JSONObject json = null;
HttpClient postClient = HttpClientBuilder.create().build();
HttpResponse response;
try {
response = postClient.execute(httpPost);
if(response.getStatusLine().getStatusCode() == 200) {
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
String result = convertStreamToString(instream);
instream.close();
json = new JSONObject(result);
}
} else {
json = UpworkRestClient.genError(response);
}
} catch (ClientProtocolException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: ClientProtocolException");
} catch (IOException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: IOException");
} catch (JSONException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: JSONException");
} catch (Exception e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: Exception " + e.toString());
} finally {
httpPost.abort();
}
return json;
}
|
java
|
private static JSONObject doPostRequest(HttpPost httpPost, HashMap<String, String> params) throws JSONException {
JSONObject json = null;
HttpClient postClient = HttpClientBuilder.create().build();
HttpResponse response;
try {
response = postClient.execute(httpPost);
if(response.getStatusLine().getStatusCode() == 200) {
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
String result = convertStreamToString(instream);
instream.close();
json = new JSONObject(result);
}
} else {
json = UpworkRestClient.genError(response);
}
} catch (ClientProtocolException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: ClientProtocolException");
} catch (IOException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: IOException");
} catch (JSONException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: JSONException");
} catch (Exception e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: Exception " + e.toString());
} finally {
httpPost.abort();
}
return json;
}
|
[
"private",
"static",
"JSONObject",
"doPostRequest",
"(",
"HttpPost",
"httpPost",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"json",
"=",
"null",
";",
"HttpClient",
"postClient",
"=",
"HttpClientBuilder",
".",
"create",
"(",
")",
".",
"build",
"(",
")",
";",
"HttpResponse",
"response",
";",
"try",
"{",
"response",
"=",
"postClient",
".",
"execute",
"(",
"httpPost",
")",
";",
"if",
"(",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
"==",
"200",
")",
"{",
"HttpEntity",
"entity",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"if",
"(",
"entity",
"!=",
"null",
")",
"{",
"InputStream",
"instream",
"=",
"entity",
".",
"getContent",
"(",
")",
";",
"String",
"result",
"=",
"convertStreamToString",
"(",
"instream",
")",
";",
"instream",
".",
"close",
"(",
")",
";",
"json",
"=",
"new",
"JSONObject",
"(",
"result",
")",
";",
"}",
"}",
"else",
"{",
"json",
"=",
"UpworkRestClient",
".",
"genError",
"(",
"response",
")",
";",
"}",
"}",
"catch",
"(",
"ClientProtocolException",
"e",
")",
"{",
"json",
"=",
"UpworkRestClient",
".",
"genError",
"(",
"HTTP_RESPONSE_503",
",",
"\"Exception: ClientProtocolException\"",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"json",
"=",
"UpworkRestClient",
".",
"genError",
"(",
"HTTP_RESPONSE_503",
",",
"\"Exception: IOException\"",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"json",
"=",
"UpworkRestClient",
".",
"genError",
"(",
"HTTP_RESPONSE_503",
",",
"\"Exception: JSONException\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"json",
"=",
"UpworkRestClient",
".",
"genError",
"(",
"HTTP_RESPONSE_503",
",",
"\"Exception: Exception \"",
"+",
"e",
".",
"toString",
"(",
")",
")",
";",
"}",
"finally",
"{",
"httpPost",
".",
"abort",
"(",
")",
";",
"}",
"return",
"json",
";",
"}"
] |
Execute POST request
@param url Request object for POST
@param method HTTP method
@param params POST parameters
@throws JSONException
@return {@link JSONObject}
|
[
"Execute",
"POST",
"request"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/UpworkRestClient.java#L125-L159
|
9,558
|
upwork/java-upwork
|
src/com/Upwork/api/UpworkRestClient.java
|
UpworkRestClient.doGetRequest
|
private static JSONObject doGetRequest(HttpGet httpGet) throws JSONException {
JSONObject json = null;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpResponse response;
try {
response = httpClient.execute(httpGet);
if(response.getStatusLine().getStatusCode() == 200) {
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
String result = convertStreamToString(instream);
instream.close();
json = new JSONObject(result);
}
} else {
json = UpworkRestClient.genError(response);
}
} catch (ClientProtocolException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: ClientProtocolException");
} catch (IOException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: IOException");
} catch (JSONException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: JSONException");
} catch (Exception e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: Exception " + e.toString());
} finally {
httpGet.abort();
}
return json;
}
|
java
|
private static JSONObject doGetRequest(HttpGet httpGet) throws JSONException {
JSONObject json = null;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpResponse response;
try {
response = httpClient.execute(httpGet);
if(response.getStatusLine().getStatusCode() == 200) {
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
String result = convertStreamToString(instream);
instream.close();
json = new JSONObject(result);
}
} else {
json = UpworkRestClient.genError(response);
}
} catch (ClientProtocolException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: ClientProtocolException");
} catch (IOException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: IOException");
} catch (JSONException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: JSONException");
} catch (Exception e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: Exception " + e.toString());
} finally {
httpGet.abort();
}
return json;
}
|
[
"private",
"static",
"JSONObject",
"doGetRequest",
"(",
"HttpGet",
"httpGet",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"json",
"=",
"null",
";",
"HttpClient",
"httpClient",
"=",
"HttpClientBuilder",
".",
"create",
"(",
")",
".",
"build",
"(",
")",
";",
"HttpResponse",
"response",
";",
"try",
"{",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"httpGet",
")",
";",
"if",
"(",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
"==",
"200",
")",
"{",
"HttpEntity",
"entity",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"if",
"(",
"entity",
"!=",
"null",
")",
"{",
"InputStream",
"instream",
"=",
"entity",
".",
"getContent",
"(",
")",
";",
"String",
"result",
"=",
"convertStreamToString",
"(",
"instream",
")",
";",
"instream",
".",
"close",
"(",
")",
";",
"json",
"=",
"new",
"JSONObject",
"(",
"result",
")",
";",
"}",
"}",
"else",
"{",
"json",
"=",
"UpworkRestClient",
".",
"genError",
"(",
"response",
")",
";",
"}",
"}",
"catch",
"(",
"ClientProtocolException",
"e",
")",
"{",
"json",
"=",
"UpworkRestClient",
".",
"genError",
"(",
"HTTP_RESPONSE_503",
",",
"\"Exception: ClientProtocolException\"",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"json",
"=",
"UpworkRestClient",
".",
"genError",
"(",
"HTTP_RESPONSE_503",
",",
"\"Exception: IOException\"",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"json",
"=",
"UpworkRestClient",
".",
"genError",
"(",
"HTTP_RESPONSE_503",
",",
"\"Exception: JSONException\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"json",
"=",
"UpworkRestClient",
".",
"genError",
"(",
"HTTP_RESPONSE_503",
",",
"\"Exception: Exception \"",
"+",
"e",
".",
"toString",
"(",
")",
")",
";",
"}",
"finally",
"{",
"httpGet",
".",
"abort",
"(",
")",
";",
"}",
"return",
"json",
";",
"}"
] |
Execute GET request
@param url Request object for GET
@param method HTTP method
@param params POST parameters
@throws JSONException
@return {@link JSONObject}
|
[
"Execute",
"GET",
"request"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/UpworkRestClient.java#L170-L203
|
9,559
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Hr/Freelancers/Offers.java
|
Offers.actions
|
public JSONObject actions(String reference, HashMap<String, String> params) throws JSONException {
return oClient.post("/offers/v1/contractors/offers/" + reference, params);
}
|
java
|
public JSONObject actions(String reference, HashMap<String, String> params) throws JSONException {
return oClient.post("/offers/v1/contractors/offers/" + reference, params);
}
|
[
"public",
"JSONObject",
"actions",
"(",
"String",
"reference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/offers/v1/contractors/offers/\"",
"+",
"reference",
",",
"params",
")",
";",
"}"
] |
Run a specific action
@param reference Offer reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Run",
"a",
"specific",
"action"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Freelancers/Offers.java#L76-L78
|
9,560
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Reports/Finance/Accounts.java
|
Accounts.getOwned
|
public JSONObject getOwned(String freelancerReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/financial_account_owner/" + freelancerReference, params);
}
|
java
|
public JSONObject getOwned(String freelancerReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/financial_account_owner/" + freelancerReference, params);
}
|
[
"public",
"JSONObject",
"getOwned",
"(",
"String",
"freelancerReference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/finreports/v2/financial_account_owner/\"",
"+",
"freelancerReference",
",",
"params",
")",
";",
"}"
] |
Generate Financial Reports for an owned Account
@param freelancerReference Freelancer's reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Generate",
"Financial",
"Reports",
"for",
"an",
"owned",
"Account"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Finance/Accounts.java#L54-L56
|
9,561
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Hr/Interviews.java
|
Interviews.invite
|
public JSONObject invite(String jobKey, HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v1/jobs/" + jobKey + "/candidates", params);
}
|
java
|
public JSONObject invite(String jobKey, HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v1/jobs/" + jobKey + "/candidates", params);
}
|
[
"public",
"JSONObject",
"invite",
"(",
"String",
"jobKey",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/hr/v1/jobs/\"",
"+",
"jobKey",
"+",
"\"/candidates\"",
",",
"params",
")",
";",
"}"
] |
Invite to Interview
@param jobKey Job key
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Invite",
"to",
"Interview"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Interviews.java#L54-L56
|
9,562
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Hr/Milestones.java
|
Milestones.create
|
public JSONObject create(HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v3/fp/milestones", params);
}
|
java
|
public JSONObject create(HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v3/fp/milestones", params);
}
|
[
"public",
"JSONObject",
"create",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/hr/v3/fp/milestones\"",
",",
"params",
")",
";",
"}"
] |
Create a new Milestone
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Create",
"a",
"new",
"Milestone"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Milestones.java#L75-L77
|
9,563
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Payments.java
|
Payments.submitBonus
|
public JSONObject submitBonus(String teamReference, HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v2/teams/" + teamReference + "/adjustments", params);
}
|
java
|
public JSONObject submitBonus(String teamReference, HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v2/teams/" + teamReference + "/adjustments", params);
}
|
[
"public",
"JSONObject",
"submitBonus",
"(",
"String",
"teamReference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/hr/v2/teams/\"",
"+",
"teamReference",
"+",
"\"/adjustments\"",
",",
"params",
")",
";",
"}"
] |
Submit a Custom Payment
@param teamReference Team reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Submit",
"a",
"Custom",
"Payment"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Payments.java#L54-L56
|
9,564
|
upwork/java-upwork
|
example-android/app/src/main/java/com/upwork/example_upworkapi/MyActivity.java
|
MyActivity.onNewIntent
|
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// Verify OAuth callback
Uri uri = intent.getData();
if (uri != null && uri.getScheme().equals(OAUTH_CALLBACK_SCHEME)) {
String verifier = uri.getQueryParameter(OAuth.OAUTH_VERIFIER);
new UpworkRetrieveAccessTokenTask().execute(verifier);
}
}
|
java
|
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// Verify OAuth callback
Uri uri = intent.getData();
if (uri != null && uri.getScheme().equals(OAUTH_CALLBACK_SCHEME)) {
String verifier = uri.getQueryParameter(OAuth.OAUTH_VERIFIER);
new UpworkRetrieveAccessTokenTask().execute(verifier);
}
}
|
[
"@",
"Override",
"public",
"void",
"onNewIntent",
"(",
"Intent",
"intent",
")",
"{",
"super",
".",
"onNewIntent",
"(",
"intent",
")",
";",
"// Verify OAuth callback",
"Uri",
"uri",
"=",
"intent",
".",
"getData",
"(",
")",
";",
"if",
"(",
"uri",
"!=",
"null",
"&&",
"uri",
".",
"getScheme",
"(",
")",
".",
"equals",
"(",
"OAUTH_CALLBACK_SCHEME",
")",
")",
"{",
"String",
"verifier",
"=",
"uri",
".",
"getQueryParameter",
"(",
"OAuth",
".",
"OAUTH_VERIFIER",
")",
";",
"new",
"UpworkRetrieveAccessTokenTask",
"(",
")",
".",
"execute",
"(",
"verifier",
")",
";",
"}",
"}"
] |
Callback once we are done with the authorization of this app
@param intent
|
[
"Callback",
"once",
"we",
"are",
"done",
"with",
"the",
"authorization",
"of",
"this",
"app"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/example-android/app/src/main/java/com/upwork/example_upworkapi/MyActivity.java#L117-L128
|
9,565
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Snapshot.java
|
Snapshot.getByContract
|
public JSONObject getByContract(String contractId, String ts) throws JSONException {
return oClient.get("/team/v3/snapshots/contracts/" + contractId + "/" + ts);
}
|
java
|
public JSONObject getByContract(String contractId, String ts) throws JSONException {
return oClient.get("/team/v3/snapshots/contracts/" + contractId + "/" + ts);
}
|
[
"public",
"JSONObject",
"getByContract",
"(",
"String",
"contractId",
",",
"String",
"ts",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/team/v3/snapshots/contracts/\"",
"+",
"contractId",
"+",
"\"/\"",
"+",
"ts",
")",
";",
"}"
] |
Get snapshot info by specific contract
@param contractId Contract ID
@param ts Timestamp
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"snapshot",
"info",
"by",
"specific",
"contract"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Snapshot.java#L54-L56
|
9,566
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Snapshot.java
|
Snapshot.updateByContract
|
public JSONObject updateByContract(String contractId, String ts, HashMap<String, String> params) throws JSONException {
return oClient.put("/team/v3/snapshots/contracts/" + contractId + "/" + ts, params);
}
|
java
|
public JSONObject updateByContract(String contractId, String ts, HashMap<String, String> params) throws JSONException {
return oClient.put("/team/v3/snapshots/contracts/" + contractId + "/" + ts, params);
}
|
[
"public",
"JSONObject",
"updateByContract",
"(",
"String",
"contractId",
",",
"String",
"ts",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"put",
"(",
"\"/team/v3/snapshots/contracts/\"",
"+",
"contractId",
"+",
"\"/\"",
"+",
"ts",
",",
"params",
")",
";",
"}"
] |
Update snapshot by specific contract
@param contractId Contract ID
@param ts Timestamp
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Update",
"snapshot",
"by",
"specific",
"contract"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Snapshot.java#L67-L69
|
9,567
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Snapshot.java
|
Snapshot.deleteByContract
|
public JSONObject deleteByContract(String contractId, String ts) throws JSONException {
return oClient.delete("/team/v3/snapshots/contracts/" + contractId + "/" + ts);
}
|
java
|
public JSONObject deleteByContract(String contractId, String ts) throws JSONException {
return oClient.delete("/team/v3/snapshots/contracts/" + contractId + "/" + ts);
}
|
[
"public",
"JSONObject",
"deleteByContract",
"(",
"String",
"contractId",
",",
"String",
"ts",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"delete",
"(",
"\"/team/v3/snapshots/contracts/\"",
"+",
"contractId",
"+",
"\"/\"",
"+",
"ts",
")",
";",
"}"
] |
Delete snapshot by specific contract
@param contractId Contract ID
@param ts Timestamp
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Delete",
"snapshot",
"by",
"specific",
"contract"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Snapshot.java#L79-L81
|
9,568
|
cathive/fx-guice
|
src/main/java/com/cathive/fx/guice/controllerlookup/ControllerLookup.java
|
ControllerLookup.lookup
|
@SuppressWarnings("unchecked")
public <T> T lookup(final String id) {
for (final IdentifiableController controller : identifiables) {
if(controller.getId().equals(id)) {
return (T) controller;
}
}
throw new IllegalArgumentException("Could not find a controller with the ID '" + id + "'");
}
|
java
|
@SuppressWarnings("unchecked")
public <T> T lookup(final String id) {
for (final IdentifiableController controller : identifiables) {
if(controller.getId().equals(id)) {
return (T) controller;
}
}
throw new IllegalArgumentException("Could not find a controller with the ID '" + id + "'");
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"lookup",
"(",
"final",
"String",
"id",
")",
"{",
"for",
"(",
"final",
"IdentifiableController",
"controller",
":",
"identifiables",
")",
"{",
"if",
"(",
"controller",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"id",
")",
")",
"{",
"return",
"(",
"T",
")",
"controller",
";",
"}",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Could not find a controller with the ID '\"",
"+",
"id",
"+",
"\"'\"",
")",
";",
"}"
] |
Returns a controller instance with the given ID.
@param id
The string ID of the controller as returned by
{@link IdentifiableController#getId()}
@return
The controller with the given ID that has just been
looked up.
@throws IllegalArgumentException
thrown if a controller cannot be found with the given ID.
|
[
"Returns",
"a",
"controller",
"instance",
"with",
"the",
"given",
"ID",
"."
] |
08c1538802cdc830b726dd1813d356bac1ad2dfa
|
https://github.com/cathive/fx-guice/blob/08c1538802cdc830b726dd1813d356bac1ad2dfa/src/main/java/com/cathive/fx/guice/controllerlookup/ControllerLookup.java#L52-L60
|
9,569
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Workdiary.java
|
Workdiary.getByContract
|
public JSONObject getByContract(String contract, String date, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v3/workdiaries/contracts/" + contract + "/" + date, params);
}
|
java
|
public JSONObject getByContract(String contract, String date, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v3/workdiaries/contracts/" + contract + "/" + date, params);
}
|
[
"public",
"JSONObject",
"getByContract",
"(",
"String",
"contract",
",",
"String",
"date",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/team/v3/workdiaries/contracts/\"",
"+",
"contract",
"+",
"\"/\"",
"+",
"date",
",",
"params",
")",
";",
"}"
] |
Get Work Diary by Contract
@param contract Contract ID
@param date Date
@param params (Optional) Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"Work",
"Diary",
"by",
"Contract"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Workdiary.java#L68-L70
|
9,570
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Activities/Team.java
|
Team._getByType
|
private JSONObject _getByType(String company, String team, String code) throws JSONException {
String url = "";
if (code != null) {
url = "/" + code;
}
return oClient.get("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks" + url);
}
|
java
|
private JSONObject _getByType(String company, String team, String code) throws JSONException {
String url = "";
if (code != null) {
url = "/" + code;
}
return oClient.get("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks" + url);
}
|
[
"private",
"JSONObject",
"_getByType",
"(",
"String",
"company",
",",
"String",
"team",
",",
"String",
"code",
")",
"throws",
"JSONException",
"{",
"String",
"url",
"=",
"\"\"",
";",
"if",
"(",
"code",
"!=",
"null",
")",
"{",
"url",
"=",
"\"/\"",
"+",
"code",
";",
"}",
"return",
"oClient",
".",
"get",
"(",
"\"/otask/v1/tasks/companies/\"",
"+",
"company",
"+",
"\"/teams/\"",
"+",
"team",
"+",
"\"/tasks\"",
"+",
"url",
")",
";",
"}"
] |
Get by type
@param company Company ID
@param team Team ID
@param code (Optional) Code(s)
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"by",
"type"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Activities/Team.java#L55-L62
|
9,571
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Hr/Submissions.java
|
Submissions.requestApproval
|
public JSONObject requestApproval(HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v3/fp/submissions", params);
}
|
java
|
public JSONObject requestApproval(HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v3/fp/submissions", params);
}
|
[
"public",
"JSONObject",
"requestApproval",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/hr/v3/fp/submissions\"",
",",
"params",
")",
";",
"}"
] |
Freelancer submits work for the client to approve
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Freelancer",
"submits",
"work",
"for",
"the",
"client",
"to",
"approve"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Submissions.java#L53-L55
|
9,572
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Hr/Submissions.java
|
Submissions.approve
|
public JSONObject approve(String submissionId, HashMap<String, String> params) throws JSONException {
return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/approve", params);
}
|
java
|
public JSONObject approve(String submissionId, HashMap<String, String> params) throws JSONException {
return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/approve", params);
}
|
[
"public",
"JSONObject",
"approve",
"(",
"String",
"submissionId",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"put",
"(",
"\"/hr/v3/fp/submissions/\"",
"+",
"submissionId",
"+",
"\"/approve\"",
",",
"params",
")",
";",
"}"
] |
Approve an existing Submission
@param submissionId Submission ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Approve",
"an",
"existing",
"Submission"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Submissions.java#L65-L67
|
9,573
|
upwork/java-upwork
|
src/com/Upwork/api/OAuthClient.java
|
OAuthClient.getAccessTokenSet
|
public HashMap<String, String> getAccessTokenSet(String verifier) {
try {
mOAuthProvider.retrieveAccessToken(mOAuthConsumer, verifier);
}
catch (OAuthException e) {
e.printStackTrace();
}
return setTokenWithSecret(mOAuthConsumer.getToken(), mOAuthConsumer.getTokenSecret());
}
|
java
|
public HashMap<String, String> getAccessTokenSet(String verifier) {
try {
mOAuthProvider.retrieveAccessToken(mOAuthConsumer, verifier);
}
catch (OAuthException e) {
e.printStackTrace();
}
return setTokenWithSecret(mOAuthConsumer.getToken(), mOAuthConsumer.getTokenSecret());
}
|
[
"public",
"HashMap",
"<",
"String",
",",
"String",
">",
"getAccessTokenSet",
"(",
"String",
"verifier",
")",
"{",
"try",
"{",
"mOAuthProvider",
".",
"retrieveAccessToken",
"(",
"mOAuthConsumer",
",",
"verifier",
")",
";",
"}",
"catch",
"(",
"OAuthException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"setTokenWithSecret",
"(",
"mOAuthConsumer",
".",
"getToken",
"(",
")",
",",
"mOAuthConsumer",
".",
"getTokenSecret",
"(",
")",
")",
";",
"}"
] |
Get access token-secret pair
@param verifier OAuth verifier, which was got after authorization
@return Access token-secret pair
|
[
"Get",
"access",
"token",
"-",
"secret",
"pair"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/OAuthClient.java#L122-L131
|
9,574
|
upwork/java-upwork
|
src/com/Upwork/api/OAuthClient.java
|
OAuthClient.setTokenWithSecret
|
public final HashMap<String, String> setTokenWithSecret(String aToken, String aSecret) {
HashMap<String, String> token = new HashMap<String, String>();
accessToken = aToken;
accessSecret = aSecret;
mOAuthConsumer.setTokenWithSecret(accessToken, accessSecret);
token.put("token", accessToken);
token.put("secret", accessSecret);
return token;
}
|
java
|
public final HashMap<String, String> setTokenWithSecret(String aToken, String aSecret) {
HashMap<String, String> token = new HashMap<String, String>();
accessToken = aToken;
accessSecret = aSecret;
mOAuthConsumer.setTokenWithSecret(accessToken, accessSecret);
token.put("token", accessToken);
token.put("secret", accessSecret);
return token;
}
|
[
"public",
"final",
"HashMap",
"<",
"String",
",",
"String",
">",
"setTokenWithSecret",
"(",
"String",
"aToken",
",",
"String",
"aSecret",
")",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"token",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"accessToken",
"=",
"aToken",
";",
"accessSecret",
"=",
"aSecret",
";",
"mOAuthConsumer",
".",
"setTokenWithSecret",
"(",
"accessToken",
",",
"accessSecret",
")",
";",
"token",
".",
"put",
"(",
"\"token\"",
",",
"accessToken",
")",
";",
"token",
".",
"put",
"(",
"\"secret\"",
",",
"accessSecret",
")",
";",
"return",
"token",
";",
"}"
] |
Setup access token and secret for OAuth client
@param aToken Access token
@param aSecret Access secret
@return Token-secret pair
|
[
"Setup",
"access",
"token",
"and",
"secret",
"for",
"OAuth",
"client"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/OAuthClient.java#L140-L152
|
9,575
|
upwork/java-upwork
|
src/com/Upwork/api/OAuthClient.java
|
OAuthClient.get
|
public JSONObject get(String url, HashMap<String, String> params) throws JSONException {
return sendGetRequest(url, METHOD_GET, params);
}
|
java
|
public JSONObject get(String url, HashMap<String, String> params) throws JSONException {
return sendGetRequest(url, METHOD_GET, params);
}
|
[
"public",
"JSONObject",
"get",
"(",
"String",
"url",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"sendGetRequest",
"(",
"url",
",",
"METHOD_GET",
",",
"params",
")",
";",
"}"
] |
Send signed OAuth GET request
@param url Relative URL
@param params Hash of parameters
@throws JSONException If JSON object is invalid or request was abnormal
@return {@link JSONObject} JSON Object that contains data from response
|
[
"Send",
"signed",
"OAuth",
"GET",
"request"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/OAuthClient.java#L182-L184
|
9,576
|
upwork/java-upwork
|
src/com/Upwork/api/OAuthClient.java
|
OAuthClient.post
|
public JSONObject post(String url, HashMap<String, String> params) throws JSONException {
return sendPostRequest(url, METHOD_POST, params);
}
|
java
|
public JSONObject post(String url, HashMap<String, String> params) throws JSONException {
return sendPostRequest(url, METHOD_POST, params);
}
|
[
"public",
"JSONObject",
"post",
"(",
"String",
"url",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"sendPostRequest",
"(",
"url",
",",
"METHOD_POST",
",",
"params",
")",
";",
"}"
] |
Send signed OAuth POST request
@param url Relative URL
@param params Hash of parameters
@throws JSONException If JSON object is invalid or request was abnormal
@return {@link JSONObject} JSON Object that contains data from response
|
[
"Send",
"signed",
"OAuth",
"POST",
"request"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/OAuthClient.java#L194-L196
|
9,577
|
upwork/java-upwork
|
src/com/Upwork/api/OAuthClient.java
|
OAuthClient.put
|
public JSONObject put(String url) throws JSONException {
return sendPostRequest(url, METHOD_PUT, new HashMap<String, String>());
}
|
java
|
public JSONObject put(String url) throws JSONException {
return sendPostRequest(url, METHOD_PUT, new HashMap<String, String>());
}
|
[
"public",
"JSONObject",
"put",
"(",
"String",
"url",
")",
"throws",
"JSONException",
"{",
"return",
"sendPostRequest",
"(",
"url",
",",
"METHOD_PUT",
",",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
")",
";",
"}"
] |
Send signed OAuth PUT request
@param url Relative URL
@throws JSONException If JSON object is invalid or request was abnormal
@return {@link JSONObject} JSON Object that contains data from response
|
[
"Send",
"signed",
"OAuth",
"PUT",
"request"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/OAuthClient.java#L205-L207
|
9,578
|
upwork/java-upwork
|
src/com/Upwork/api/OAuthClient.java
|
OAuthClient.delete
|
public JSONObject delete(String url, HashMap<String, String> params) throws JSONException {
return sendPostRequest(url, METHOD_DELETE, params);
}
|
java
|
public JSONObject delete(String url, HashMap<String, String> params) throws JSONException {
return sendPostRequest(url, METHOD_DELETE, params);
}
|
[
"public",
"JSONObject",
"delete",
"(",
"String",
"url",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"sendPostRequest",
"(",
"url",
",",
"METHOD_DELETE",
",",
"params",
")",
";",
"}"
] |
Send signed OAuth DELETE request
@param url Relative URL
@param params Hash of parameters
@throws JSONException If JSON object is invalid or request was abnormal
@return {@link JSONObject} JSON Object that contains data from response
|
[
"Send",
"signed",
"OAuth",
"DELETE",
"request"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/OAuthClient.java#L240-L242
|
9,579
|
upwork/java-upwork
|
src/com/Upwork/api/OAuthClient.java
|
OAuthClient._getAuthorizationUrl
|
private String _getAuthorizationUrl(String oauthCallback) {
String url = null;
try {
url = mOAuthProvider.retrieveRequestToken(mOAuthConsumer, oauthCallback);
}
catch (OAuthException e) {
e.printStackTrace();
}
return url;
}
|
java
|
private String _getAuthorizationUrl(String oauthCallback) {
String url = null;
try {
url = mOAuthProvider.retrieveRequestToken(mOAuthConsumer, oauthCallback);
}
catch (OAuthException e) {
e.printStackTrace();
}
return url;
}
|
[
"private",
"String",
"_getAuthorizationUrl",
"(",
"String",
"oauthCallback",
")",
"{",
"String",
"url",
"=",
"null",
";",
"try",
"{",
"url",
"=",
"mOAuthProvider",
".",
"retrieveRequestToken",
"(",
"mOAuthConsumer",
",",
"oauthCallback",
")",
";",
"}",
"catch",
"(",
"OAuthException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"url",
";",
"}"
] |
Get authorization URL, use provided callback URL
@param oauthCallback URL, i.e. oauth_callback
@return URL for authorizing application
|
[
"Get",
"authorization",
"URL",
"use",
"provided",
"callback",
"URL"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/OAuthClient.java#L250-L261
|
9,580
|
upwork/java-upwork
|
src/com/Upwork/api/OAuthClient.java
|
OAuthClient.sendGetRequest
|
private JSONObject sendGetRequest(String url, Integer type, HashMap<String, String> params) throws JSONException {
String fullUrl = getFullUrl(url);
HttpGet request = new HttpGet(fullUrl);
if (params != null) {
URI uri;
String query = "";
try {
URIBuilder uriBuilder = new URIBuilder(request.getURI());
// encode values and add them to the request
for (Map.Entry<String, String> entry : params.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
// to prevent double encoding, we need to create query string ourself
// uriBuilder.addParameter(key, URLEncoder.encode(value).replace("%3B", ";"));
query = query + key + "=" + value.replace("&", "&") + "&";
// what the hell is going on in java - no adequate way to encode query string
// lets temporary replace "&" in the value, to encode it manually later
}
// this routine will encode query string
uriBuilder.setCustomQuery(query);
uri = uriBuilder.build();
// re-create request to have validly encoded ampersand
request = new HttpGet(fullUrl + "?" + uri.getRawQuery().replace("&", "%26"));
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
mOAuthConsumer.sign(request);
}
catch (OAuthException e) {
e.printStackTrace();
}
return UpworkRestClient.getJSONObject(request, type);
}
|
java
|
private JSONObject sendGetRequest(String url, Integer type, HashMap<String, String> params) throws JSONException {
String fullUrl = getFullUrl(url);
HttpGet request = new HttpGet(fullUrl);
if (params != null) {
URI uri;
String query = "";
try {
URIBuilder uriBuilder = new URIBuilder(request.getURI());
// encode values and add them to the request
for (Map.Entry<String, String> entry : params.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
// to prevent double encoding, we need to create query string ourself
// uriBuilder.addParameter(key, URLEncoder.encode(value).replace("%3B", ";"));
query = query + key + "=" + value.replace("&", "&") + "&";
// what the hell is going on in java - no adequate way to encode query string
// lets temporary replace "&" in the value, to encode it manually later
}
// this routine will encode query string
uriBuilder.setCustomQuery(query);
uri = uriBuilder.build();
// re-create request to have validly encoded ampersand
request = new HttpGet(fullUrl + "?" + uri.getRawQuery().replace("&", "%26"));
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
mOAuthConsumer.sign(request);
}
catch (OAuthException e) {
e.printStackTrace();
}
return UpworkRestClient.getJSONObject(request, type);
}
|
[
"private",
"JSONObject",
"sendGetRequest",
"(",
"String",
"url",
",",
"Integer",
"type",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"String",
"fullUrl",
"=",
"getFullUrl",
"(",
"url",
")",
";",
"HttpGet",
"request",
"=",
"new",
"HttpGet",
"(",
"fullUrl",
")",
";",
"if",
"(",
"params",
"!=",
"null",
")",
"{",
"URI",
"uri",
";",
"String",
"query",
"=",
"\"\"",
";",
"try",
"{",
"URIBuilder",
"uriBuilder",
"=",
"new",
"URIBuilder",
"(",
"request",
".",
"getURI",
"(",
")",
")",
";",
"// encode values and add them to the request",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"params",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"String",
"value",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"// to prevent double encoding, we need to create query string ourself",
"// uriBuilder.addParameter(key, URLEncoder.encode(value).replace(\"%3B\", \";\"));",
"query",
"=",
"query",
"+",
"key",
"+",
"\"=\"",
"+",
"value",
".",
"replace",
"(",
"\"&\"",
",",
"\"&\"",
")",
"+",
"\"&\"",
";",
"// what the hell is going on in java - no adequate way to encode query string",
"// lets temporary replace \"&\" in the value, to encode it manually later",
"}",
"// this routine will encode query string",
"uriBuilder",
".",
"setCustomQuery",
"(",
"query",
")",
";",
"uri",
"=",
"uriBuilder",
".",
"build",
"(",
")",
";",
"// re-create request to have validly encoded ampersand",
"request",
"=",
"new",
"HttpGet",
"(",
"fullUrl",
"+",
"\"?\"",
"+",
"uri",
".",
"getRawQuery",
"(",
")",
".",
"replace",
"(",
"\"&\"",
",",
"\"%26\"",
")",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"// TODO Auto-generated catch block",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"try",
"{",
"mOAuthConsumer",
".",
"sign",
"(",
"request",
")",
";",
"}",
"catch",
"(",
"OAuthException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"UpworkRestClient",
".",
"getJSONObject",
"(",
"request",
",",
"type",
")",
";",
"}"
] |
Send signed GET OAuth request
@param url Relative URL
@param type Type of HTTP request (HTTP method)
@param params Hash of parameters
@throws JSONException If JSON object is invalid or request was abnormal
@return {@link JSONObject} JSON Object that contains data from response
|
[
"Send",
"signed",
"GET",
"OAuth",
"request"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/OAuthClient.java#L272-L312
|
9,581
|
upwork/java-upwork
|
src/com/Upwork/api/OAuthClient.java
|
OAuthClient.sendPostRequest
|
private JSONObject sendPostRequest(String url, Integer type, HashMap<String, String> params) throws JSONException {
String fullUrl = getFullUrl(url);
HttpPost request = new HttpPost(fullUrl);
switch(type) {
case METHOD_PUT:
case METHOD_DELETE:
// assign overload value
String oValue;
if (type == METHOD_PUT) {
oValue = "put";
} else {
oValue = "delete";
}
params.put(OVERLOAD_PARAM, oValue);
case METHOD_POST:
break;
default:
throw new RuntimeException("Wrong http method requested");
}
// doing post request using json to avoid issue with urlencoded symbols
JSONObject json = new JSONObject();
for (Map.Entry<String, String> entry : params.entrySet()) {
json.put(entry.getKey(), entry.getValue());
}
request.setHeader("Content-Type", "application/json");
try {
request.setEntity(new StringEntity(json.toString()));
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// sign request
try {
mOAuthConsumer.sign(request);
}
catch (OAuthException e) {
e.printStackTrace();
}
return UpworkRestClient.getJSONObject(request, type, params);
}
|
java
|
private JSONObject sendPostRequest(String url, Integer type, HashMap<String, String> params) throws JSONException {
String fullUrl = getFullUrl(url);
HttpPost request = new HttpPost(fullUrl);
switch(type) {
case METHOD_PUT:
case METHOD_DELETE:
// assign overload value
String oValue;
if (type == METHOD_PUT) {
oValue = "put";
} else {
oValue = "delete";
}
params.put(OVERLOAD_PARAM, oValue);
case METHOD_POST:
break;
default:
throw new RuntimeException("Wrong http method requested");
}
// doing post request using json to avoid issue with urlencoded symbols
JSONObject json = new JSONObject();
for (Map.Entry<String, String> entry : params.entrySet()) {
json.put(entry.getKey(), entry.getValue());
}
request.setHeader("Content-Type", "application/json");
try {
request.setEntity(new StringEntity(json.toString()));
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// sign request
try {
mOAuthConsumer.sign(request);
}
catch (OAuthException e) {
e.printStackTrace();
}
return UpworkRestClient.getJSONObject(request, type, params);
}
|
[
"private",
"JSONObject",
"sendPostRequest",
"(",
"String",
"url",
",",
"Integer",
"type",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"String",
"fullUrl",
"=",
"getFullUrl",
"(",
"url",
")",
";",
"HttpPost",
"request",
"=",
"new",
"HttpPost",
"(",
"fullUrl",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"METHOD_PUT",
":",
"case",
"METHOD_DELETE",
":",
"// assign overload value",
"String",
"oValue",
";",
"if",
"(",
"type",
"==",
"METHOD_PUT",
")",
"{",
"oValue",
"=",
"\"put\"",
";",
"}",
"else",
"{",
"oValue",
"=",
"\"delete\"",
";",
"}",
"params",
".",
"put",
"(",
"OVERLOAD_PARAM",
",",
"oValue",
")",
";",
"case",
"METHOD_POST",
":",
"break",
";",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Wrong http method requested\"",
")",
";",
"}",
"// doing post request using json to avoid issue with urlencoded symbols",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"params",
".",
"entrySet",
"(",
")",
")",
"{",
"json",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"request",
".",
"setHeader",
"(",
"\"Content-Type\"",
",",
"\"application/json\"",
")",
";",
"try",
"{",
"request",
".",
"setEntity",
"(",
"new",
"StringEntity",
"(",
"json",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e1",
")",
"{",
"// TODO Auto-generated catch block",
"e1",
".",
"printStackTrace",
"(",
")",
";",
"}",
"// sign request",
"try",
"{",
"mOAuthConsumer",
".",
"sign",
"(",
"request",
")",
";",
"}",
"catch",
"(",
"OAuthException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"UpworkRestClient",
".",
"getJSONObject",
"(",
"request",
",",
"type",
",",
"params",
")",
";",
"}"
] |
Send signed POST OAuth request
@param url Relative URL
@param type Type of HTTP request (HTTP method)
@param params Hash of parameters
@throws JSONException If JSON object is invalid or request was abnormal
@return {@link JSONObject} JSON Object that contains data from response
|
[
"Send",
"signed",
"POST",
"OAuth",
"request"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/OAuthClient.java#L323-L368
|
9,582
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Reports/Finance/Billings.java
|
Billings.getByFreelancersTeam
|
public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/billings", params);
}
|
java
|
public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/billings", params);
}
|
[
"public",
"JSONObject",
"getByFreelancersTeam",
"(",
"String",
"freelancerTeamReference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/finreports/v2/provider_teams/\"",
"+",
"freelancerTeamReference",
"+",
"\"/billings\"",
",",
"params",
")",
";",
"}"
] |
Generate Billing Reports for a Specific Freelancer's Team
@param freelancerTeamReference Freelancer's team reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Generate",
"Billing",
"Reports",
"for",
"a",
"Specific",
"Freelancer",
"s",
"Team"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Finance/Billings.java#L66-L68
|
9,583
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Reports/Finance/Billings.java
|
Billings.getByFreelancersCompany
|
public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
}
|
java
|
public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
}
|
[
"public",
"JSONObject",
"getByFreelancersCompany",
"(",
"String",
"freelancerCompanyReference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/finreports/v2/provider_companies/\"",
"+",
"freelancerCompanyReference",
"+",
"\"/billings\"",
",",
"params",
")",
";",
"}"
] |
Generate Billing Reports for a Specific Freelancer's Company
@param freelancerCompanyReference Freelancer's company reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Generate",
"Billing",
"Reports",
"for",
"a",
"Specific",
"Freelancer",
"s",
"Company"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Finance/Billings.java#L78-L80
|
9,584
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Reports/Finance/Billings.java
|
Billings.getByBuyersTeam
|
public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/billings", params);
}
|
java
|
public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/billings", params);
}
|
[
"public",
"JSONObject",
"getByBuyersTeam",
"(",
"String",
"buyerTeamReference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/finreports/v2/buyer_teams/\"",
"+",
"buyerTeamReference",
"+",
"\"/billings\"",
",",
"params",
")",
";",
"}"
] |
Generate Billing Reports for a Specific Buyer's Team
@param buyerTeamReference Buyer team reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Generate",
"Billing",
"Reports",
"for",
"a",
"Specific",
"Buyer",
"s",
"Team"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Finance/Billings.java#L90-L92
|
9,585
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Reports/Finance/Billings.java
|
Billings.getByBuyersCompany
|
public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/billings", params);
}
|
java
|
public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/billings", params);
}
|
[
"public",
"JSONObject",
"getByBuyersCompany",
"(",
"String",
"buyerCompanyReference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/finreports/v2/buyer_companies/\"",
"+",
"buyerCompanyReference",
"+",
"\"/billings\"",
",",
"params",
")",
";",
"}"
] |
Generate Billing Reports for a Specific Buyer's Company
@param buyerCompanyReference Buyer company reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Generate",
"Billing",
"Reports",
"for",
"a",
"Specific",
"Buyer",
"s",
"Company"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Finance/Billings.java#L102-L104
|
9,586
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Workdays.java
|
Workdays.getByCompany
|
public JSONObject getByCompany(String company, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v3/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
}
|
java
|
public JSONObject getByCompany(String company, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v3/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
}
|
[
"public",
"JSONObject",
"getByCompany",
"(",
"String",
"company",
",",
"String",
"fromDate",
",",
"String",
"tillDate",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/team/v3/workdays/companies/\"",
"+",
"company",
"+",
"\"/\"",
"+",
"fromDate",
"+",
"\",\"",
"+",
"tillDate",
",",
"params",
")",
";",
"}"
] |
Get Workdays by Company
@param company Company ID
@param fromDate Start date
@param tillDate End date
@param params (Optional) Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"Workdays",
"by",
"Company"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Workdays.java#L56-L58
|
9,587
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Workdays.java
|
Workdays.getByContract
|
public JSONObject getByContract(String contract, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v3/workdays/contracts/" + contract + "/" + fromDate + "," + tillDate, params);
}
|
java
|
public JSONObject getByContract(String contract, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v3/workdays/contracts/" + contract + "/" + fromDate + "," + tillDate, params);
}
|
[
"public",
"JSONObject",
"getByContract",
"(",
"String",
"contract",
",",
"String",
"fromDate",
",",
"String",
"tillDate",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/team/v3/workdays/contracts/\"",
"+",
"contract",
"+",
"\"/\"",
"+",
"fromDate",
"+",
"\",\"",
"+",
"tillDate",
",",
"params",
")",
";",
"}"
] |
Get Workdays by Contract
@param contract Contract ID
@param fromDate Start date
@param tillDate End date
@param params (Optional) Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"Workdays",
"by",
"Contract"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Workdays.java#L70-L72
|
9,588
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Hr/Jobs.java
|
Jobs.postJob
|
public JSONObject postJob(HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v2/jobs", params);
}
|
java
|
public JSONObject postJob(HashMap<String, String> params) throws JSONException {
return oClient.post("/hr/v2/jobs", params);
}
|
[
"public",
"JSONObject",
"postJob",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/hr/v2/jobs\"",
",",
"params",
")",
";",
"}"
] |
Post a new job
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Post",
"a",
"new",
"job"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Jobs.java#L75-L77
|
9,589
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Hr/Jobs.java
|
Jobs.editJob
|
public JSONObject editJob(String key, HashMap<String, String> params) throws JSONException {
return oClient.put("/hr/v2/jobs/" + key, params);
}
|
java
|
public JSONObject editJob(String key, HashMap<String, String> params) throws JSONException {
return oClient.put("/hr/v2/jobs/" + key, params);
}
|
[
"public",
"JSONObject",
"editJob",
"(",
"String",
"key",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"put",
"(",
"\"/hr/v2/jobs/\"",
"+",
"key",
",",
"params",
")",
";",
"}"
] |
Edit existent job
@param key Job key
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Edit",
"existent",
"job"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Jobs.java#L87-L89
|
9,590
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Hr/Jobs.java
|
Jobs.deleteJob
|
public JSONObject deleteJob(String key, HashMap<String, String> params) throws JSONException {
return oClient.delete("/hr/v2/jobs/" + key, params);
}
|
java
|
public JSONObject deleteJob(String key, HashMap<String, String> params) throws JSONException {
return oClient.delete("/hr/v2/jobs/" + key, params);
}
|
[
"public",
"JSONObject",
"deleteJob",
"(",
"String",
"key",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"delete",
"(",
"\"/hr/v2/jobs/\"",
"+",
"key",
",",
"params",
")",
";",
"}"
] |
Delete existent job
@param key Job key
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Delete",
"existent",
"job"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Jobs.java#L99-L101
|
9,591
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Hr/Clients/Offers.java
|
Offers.getList
|
public JSONObject getList(HashMap<String, String> params) throws JSONException {
return oClient.get("/offers/v1/clients/offers", params);
}
|
java
|
public JSONObject getList(HashMap<String, String> params) throws JSONException {
return oClient.get("/offers/v1/clients/offers", params);
}
|
[
"public",
"JSONObject",
"getList",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/offers/v1/clients/offers\"",
",",
"params",
")",
";",
"}"
] |
Get list of offers
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"list",
"of",
"offers"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Clients/Offers.java#L53-L55
|
9,592
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Hr/Clients/Offers.java
|
Offers.getSpecific
|
public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
return oClient.get("/offers/v1/clients/offers/" + reference, params);
}
|
java
|
public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
return oClient.get("/offers/v1/clients/offers/" + reference, params);
}
|
[
"public",
"JSONObject",
"getSpecific",
"(",
"String",
"reference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/offers/v1/clients/offers/\"",
"+",
"reference",
",",
"params",
")",
";",
"}"
] |
Get specific offer
@param reference Offer reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"specific",
"offer"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Clients/Offers.java#L65-L67
|
9,593
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Reports/Time.java
|
Time.getByAgency
|
public JSONObject getByAgency(String company, String agency, HashMap<String, String> params) throws JSONException {
return _getByType(company, null, agency, params, false);
}
|
java
|
public JSONObject getByAgency(String company, String agency, HashMap<String, String> params) throws JSONException {
return _getByType(company, null, agency, params, false);
}
|
[
"public",
"JSONObject",
"getByAgency",
"(",
"String",
"company",
",",
"String",
"agency",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"_getByType",
"(",
"company",
",",
"null",
",",
"agency",
",",
"params",
",",
"false",
")",
";",
"}"
] |
Generating Agency Specific Reports
@param company Company ID
@param agency Agency ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Generating",
"Agency",
"Specific",
"Reports"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Time.java#L106-L108
|
9,594
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Reports/Time.java
|
Time.getByCompany
|
public JSONObject getByCompany(String company, HashMap<String, String> params) throws JSONException {
return _getByType(company, null, null, params, false);
}
|
java
|
public JSONObject getByCompany(String company, HashMap<String, String> params) throws JSONException {
return _getByType(company, null, null, params, false);
}
|
[
"public",
"JSONObject",
"getByCompany",
"(",
"String",
"company",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"_getByType",
"(",
"company",
",",
"null",
",",
"null",
",",
"params",
",",
"false",
")",
";",
"}"
] |
Generating Company Wide Reports
@param company Company ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Generating",
"Company",
"Wide",
"Reports"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Time.java#L118-L120
|
9,595
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Messages.java
|
Messages.getRoomDetails
|
public JSONObject getRoomDetails(String company, String roomId, HashMap<String, String> params) throws JSONException {
return oClient.get("/messages/v3/" + company + "/rooms/" + roomId, params);
}
|
java
|
public JSONObject getRoomDetails(String company, String roomId, HashMap<String, String> params) throws JSONException {
return oClient.get("/messages/v3/" + company + "/rooms/" + roomId, params);
}
|
[
"public",
"JSONObject",
"getRoomDetails",
"(",
"String",
"company",
",",
"String",
"roomId",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/messages/v3/\"",
"+",
"company",
"+",
"\"/rooms/\"",
"+",
"roomId",
",",
"params",
")",
";",
"}"
] |
Get a specific room information
@param company Company ID
@param roomId Room ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"a",
"specific",
"room",
"information"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L62-L64
|
9,596
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Messages.java
|
Messages.getRoomByOffer
|
public JSONObject getRoomByOffer(String company, String offerId, HashMap<String, String> params) throws JSONException {
return oClient.get("/messages/v3/" + company + "/rooms/offers/" + offerId, params);
}
|
java
|
public JSONObject getRoomByOffer(String company, String offerId, HashMap<String, String> params) throws JSONException {
return oClient.get("/messages/v3/" + company + "/rooms/offers/" + offerId, params);
}
|
[
"public",
"JSONObject",
"getRoomByOffer",
"(",
"String",
"company",
",",
"String",
"offerId",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/messages/v3/\"",
"+",
"company",
"+",
"\"/rooms/offers/\"",
"+",
"offerId",
",",
"params",
")",
";",
"}"
] |
Get a specific room by offer ID
@param company Company ID
@param offerId Offer ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"a",
"specific",
"room",
"by",
"offer",
"ID"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L75-L77
|
9,597
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Messages.java
|
Messages.getRoomByApplication
|
public JSONObject getRoomByApplication(String company, String applicationId, HashMap<String, String> params) throws JSONException {
return oClient.get("/messages/v3/" + company + "/rooms/appications/" + applicationId, params);
}
|
java
|
public JSONObject getRoomByApplication(String company, String applicationId, HashMap<String, String> params) throws JSONException {
return oClient.get("/messages/v3/" + company + "/rooms/appications/" + applicationId, params);
}
|
[
"public",
"JSONObject",
"getRoomByApplication",
"(",
"String",
"company",
",",
"String",
"applicationId",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/messages/v3/\"",
"+",
"company",
"+",
"\"/rooms/appications/\"",
"+",
"applicationId",
",",
"params",
")",
";",
"}"
] |
Get a specific room by application ID
@param company Company ID
@param applicationId Application ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"a",
"specific",
"room",
"by",
"application",
"ID"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L88-L90
|
9,598
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Messages.java
|
Messages.getRoomByContract
|
public JSONObject getRoomByContract(String company, String contractId, HashMap<String, String> params) throws JSONException {
return oClient.get("/messages/v3/" + company + "/rooms/contracts/" + contractId, params);
}
|
java
|
public JSONObject getRoomByContract(String company, String contractId, HashMap<String, String> params) throws JSONException {
return oClient.get("/messages/v3/" + company + "/rooms/contracts/" + contractId, params);
}
|
[
"public",
"JSONObject",
"getRoomByContract",
"(",
"String",
"company",
",",
"String",
"contractId",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/messages/v3/\"",
"+",
"company",
"+",
"\"/rooms/contracts/\"",
"+",
"contractId",
",",
"params",
")",
";",
"}"
] |
Get a specific room by contract ID
@param company Company ID
@param contractId Contract ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Get",
"a",
"specific",
"room",
"by",
"contract",
"ID"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L101-L103
|
9,599
|
upwork/java-upwork
|
src/com/Upwork/api/Routers/Messages.java
|
Messages.createRoom
|
public JSONObject createRoom(String company, HashMap<String, String> params) throws JSONException {
return oClient.post("/messages/v3/" + company + "/rooms", params);
}
|
java
|
public JSONObject createRoom(String company, HashMap<String, String> params) throws JSONException {
return oClient.post("/messages/v3/" + company + "/rooms", params);
}
|
[
"public",
"JSONObject",
"createRoom",
"(",
"String",
"company",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/messages/v3/\"",
"+",
"company",
"+",
"\"/rooms\"",
",",
"params",
")",
";",
"}"
] |
Create a new room
@param company Company ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
|
[
"Create",
"a",
"new",
"room"
] |
342297161503a74e9e0bddbd381ab5eebf4dc454
|
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L113-L115
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.